Hi,

On 28/02/17 09:09, Casper Ti. Vector wrote:
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;
}

This list is for the bug-tracker's auto-generated emails.
To report the bug please use the bugzilla bug tracker following the instructions
described at https://gcc.gnu.org/bugs/#where



------------------------------------------------------------------------

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'.


Reply via email to