This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hello, the following source file (here called `gcc_bug.c') triggers `-Wmaybe-uninitialized' when compiled with `-Os', `-O1' or stronger optimisation, plus `-Wall': ------------------------------------------------------------------------ #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; default: goto retn; } else if (x) goto retn; } retn: if (flag) fin (a, b, c); return 0; } ------------------------------------------------------------------------ Attached are required output files: * gcc_bug.txt: `gcc -v -save-temps -Wall -O2 -c gcc_bug.c -o gcc_bug.o'. * gcc_bug.ii: `sed '/^#/d; /^[ \t]*$/d' < gcc_bug.i'. -- My current OpenPGP key: RSA4096/0x227E8CAAB7AA186C (expires: 2020.10.19) 7077 7781 B859 5166 AE07 0286 227E 8CAA B7AA 186C
Attachment:
gcc_bug.txt
Description: Text document
Attachment:
gcc_bug.ii
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |