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

            Bug ID: 65958
           Summary: -fstack-check breaks __builtin(alloca)
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: felix.janda at posteo dot de
  Target Milestone: ---
            Target: arm

On arm, gcc-4.9.2 compiles the following snippet to a program which
returns 1 instead of 0 when the option -fstack-check is given.

int main(void)
{
        char *p;
        if(1) {
                char i[48];
                p = __builtin_alloca(8);
                p[0] = 1;
        }
        if(1) {
                char i[48], j[64];
                j[48] = 0;
        }
        return !p[0];
}


I could reproduce the behavior already with gcc-4.7.1.

The issue causes miscompilation of bash's lib/glob/glob.c. See:
https://bugs.gentoo.org/show_bug.cgi?id=518598

Reply via email to