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