This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Isolate & simplify paths with undefined behaviour


On 10/18/13 14:31, Marc Glisse wrote:

But once you have that pointer defined by a PHI containing a zero, you
look at all its uses, trying to find one that proves the pointer is
non-zero
What are you going to do with that information? The only use I can see for this pass would be discovering more statements that, if a NULL value flows in, result in undefined behaviour.




(only dereferences for now, but you have a comment about the
non-null attribute).
The comment about the non-null attribute refers to cases where we've decorated an argument as "must be non-null". If we see a NULL flowing into such a call, then we've crossed the line into undefined behaviour. We'd want to treat the call just like *0 -- isolate the path with NULL flowing to that call and turn the call into a trap.

Similarly if we find a NULL flowing to a return statement in a function decorated as never returning NULL.




Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]