https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105539

            Bug ID: 105539
           Summary: -ftrivial-auto-var-init=zero happening too late?
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kees at outflux dot net
  Target Milestone: ---

It looks like some pass is being run before the initializers are added:

int x (int z) {
    int y;
    if (z)
        y = 10;
    return y;
}

under "gcc -ftrivial-auto-var-init=zero -Wuninitialized -O2" does not test "z":

$ gcc -ftrivial-auto-var-init=zero -Wuninitialized -O2 -S x.c -o -
...
        movl    $10, %eax
        ret
...

This should be testing "z", e.g.:

        testl   %edi, %edi
        movl    $10, %eax
        cmovel  %edi, %eax
        retq

Reply via email to