This is the mail archive of the
mailing list for the GCC project.
Re: [RFC] Isolate & simplify paths with undefined behaviour
- From: Marc Glisse <marc dot glisse at inria dot fr>
- To: Jeff Law <law at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 18 Oct 2013 23:15:18 +0200 (CEST)
- 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> <5261A072 dot 3010805 at redhat dot com>
- Reply-to: gcc-patches at gcc dot gnu dot org
On Fri, 18 Oct 2013, Jeff Law wrote:
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
What are you going to do with that information?
Uh? I must have been very unclear in my post, this sentence was supposed
to describe what *your* patch is doing...
The only use I can see for this pass would be discovering more
statements that, if a NULL value flows in, result in undefined
Yes, precisely. All I was talking about was separating the predicate:
"this statement results in UB if that SSA_NAME pointer is NULL" into its
own function, and we happen to already have a function in VRP which does
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.
Yes, and I think you would get that for free if you called the VRP
function instead of manually checking if the statement is an indirection.
Similarly if we find a NULL flowing to a return statement in a function
decorated as never returning NULL.
Sorry for the misunderstandings...