https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82146

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to MaaSoftware from comment #5)
> Ok.
> 
> I am sorry,
> return MyFunc(Num, *(CMaaString *)NULL, doc); // produces GPF in calling
> method not here.

So what? Dereferencing a null pointer has undefined behaviour, so anything can
happen. It could crash immediately, or it could produce unexpected results
elsewhere in the program.

> I have think before what all references are object memory pointers inside
> compiller,

You are wrong.

> just it is more easy working with references of objects not with
> pointers in most ways.

But references can't be null, so if you need something that can be null you
must use a pointer. It's quite simple, please stop wasting our time.

> And no warning generated to *(CMaaString *)NULL code.
> CXXFLAGS = -pipe -W -O3 -fpermissive

Just because there's no warning doesn't mean the code is correct.

Reply via email to