http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58136

            Bug ID: 58136
           Summary: Initialized static global variables cause segfault on
                    AIX with debugging symbols
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc at rkeene dot org

Tested with gcc 4.6.3 and gcc 4.8.1 with binutils 2.22

Program Listing #1 (test-1.c):
        static unsigned int test = 3;
        int main(int argc, char **argv) {
                test = 4;
                return(0);
        }

Program Listing #2 (test-2.c):
        static unsigned int test;
        int main(int argc, char **argv) {
                test = 4;
                return(0);
        }

Compiling program listing #1 (above) with the "-gxcoff" argument causes a
segfault.  Leaving off the "-gxcoff" argument, or not initializing the static
global (program listing #2, above) causes the program to not segfault.

$ powerpc-ibm-aix5.3.0.0-gcc -gxcoff -o test-1_g test-1.c
$ ./test-1_g
Segmentation fault (core dumped)

$ powerpc-ibm-aix5.3.0.0-gcc -o test-1 test-1.c
$ ./test-1

$ powerpc-ibm-aix5.3.0.0-gcc -gxcoff -o test-2_g test-2.c
$ ./test-2_g

$ powerpc-ibm-aix5.3.0.0-gcc -o test-2 test-2.c
$ ./test-2

Reply via email to