https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79768
Jeffrey A. Law <law at redhat dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |NEW Last reconfirmed| |2017-10-01 CC| |law at redhat dot com Resolution|WORKSFORME |--- Ever confirmed|0 |1 --- Comment #6 from Jeffrey A. Law <law at redhat dot com> --- 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 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; } ~