This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] Isolate & simplify paths with undefined behaviour
- From: Jeff Law <law at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 18 Oct 2013 14:56:18 -0600
- Subject: Re: [RFC] Isolate & simplify paths with undefined behaviour
- Authentication-results: sourceware.org; auth=none
- References: <52616BFC dot 6010205 at redhat dot com> <alpine dot DEB dot 2 dot 10 dot 1310182019300 dot 4203 at laptop-mg dot saclay dot inria dot fr> <52618D60 dot 9090101 at redhat dot com> <alpine dot DEB dot 2 dot 10 dot 1310182151270 dot 4203 at laptop-mg dot saclay dot inria dot fr>
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