This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix up __builtin_alloca_with_align (0, ...) folding (PR sanitizer/91707)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Biener <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 24 Sep 2019 15:16:00 +0200
- Subject: Re: [PATCH] Fix up __builtin_alloca_with_align (0, ...) folding (PR sanitizer/91707)
- References: <20190924104615.GJ15914@tucnak> <nycvar.YFH.7.76.1909241314550.5566@zhemvz.fhfr.qr> <20190924122852.GL15914@tucnak> <nycvar.YFH.7.76.1909241509540.5566@zhemvz.fhfr.qr>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, Sep 24, 2019 at 03:10:49PM +0200, Richard Biener wrote:
> Hmm yeah.
>
> Note that in principle the domain could be signed so that the
> -1 is more obvious. Also [1:0] would be an equally valid empty
> domain. Not sure if that helps the specific jump-threading case, of
> course...
No, that doesn't help.
The code is essentially
void
foo (int x)
{
if (x == 0)
bar ();
int v[x];
v[0] = 1;
if (x == 0)
bar ();
}
where if jump threading creates
if (x == 0) { bar (); int v[0]; v[0] = 1; bar (); }
else { int v[x]; v[0] = 1; }
out of it, we do warn. Whether we should warn in that case is something for
ongoing debate (I don't like such warnings, because the if (x == 0) doesn't
necessarily mean the code will be called with such arguments, it might be
just that something written generically got inlined in, but others like them
(Martin, Jeff)), in this specific case it is even that the if (x == 0) bar ();
doesn't actually come from the user code at all, but from the sanitization
and so even less desirable, because, well, user code didn't have any tests
like that at all.
Jakub