https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79768
--- Comment #7 from Eric Gallager <egallager at gcc dot gnu.org> --- (In reply to Jeffrey A. Law from comment #6) > Eric. Thanks for the BZ maintenance. It's definitely appreciated. > > For bugs like this (very sensitive to unrelated code generator changes) it > is often worth the time to bisect to what change fixed the bug. That helps > us identify something that just went latent vs something that actually got > fixed. I wish I could bisect but I don't exactly have the computing resources on this old laptop for the whole bisection process; is that something I could do on the gcc compile farm? > > I happened to have been looking at this yesterday so I had a bit of state. > I'm pretty sure this just went latent. Martin L's recent changes to switch > handling result in dropping the switch into an if-else which we often > optimize/analyze better. > > A slight tweak to keep Martin L's changes from firing brings the warning > back. > > > #include <stdio.h> > #include <stdlib.h> > > static int mk (int **a, int **b, int **c) { > if (!(*a = malloc (sizeof (int)))) goto a_err; > if (!(*b = malloc (sizeof (int)))) goto b_err; > if (!(*c = malloc (sizeof (int)))) goto c_err; > > return 1; c_err: > free (*b); b_err: > free (*a); a_err: > return 0; > } > > static void fin (int *a, int *b, int *c) { > free (c); > free (b); > free (a); > } > > int main (void) { > int *a, *b, *c, x, flag = mk (&a, &b, &c); > while ((x = getchar ()) != -1) { > if (flag) switch (x) { > case 0: > break; > case 0xdeadbeef: > goto retm; > default: > goto retn; > } else if (x) goto retn; > } > retn: > if (flag) fin (a, b, c); > return 0; > retm: > if (flag) fin (a, b, c); > return 0; > } > ~ Yup, confirmed that this brings the warning back.