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]

[Bug c/17072] New: loop optimizer with large stack causes core


Given this souce file:

int main(int argc, char **argv)
{
    int slot;
    long maxu = 7;              /* any number works */
    char buf[0x7fc1];           /* must be > 0x7fc0 */

    for ( slot = 0; slot < maxu + (2>((int)(0.1*maxu)))?2:((int)(maxu/10)); slot++)
        ;
}

compiling with the optimizer (-O) results in a core dump.  Turning off the
optimizer works fine.  Also, using "-O -fno-loop-optimize" causes the core to go
away.  Also, optimizing "-O2" makes the problem go away.  Finally, a smaller
local stack variable makes the problem go away.

Details:
Reading specs from /usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3.1/specs
Configured with: ../gcc-3.3.1/configure --disable-nls
Thread model: aix
gcc version 3.3.1
 /usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3.1/cc1 -E -quiet -v
-D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=1 foo.c -O foo.i
ignoring nonexistent directory "NONE/include"
ignoring nonexistent directory "/usr/local/powerpc-ibm-aix5.1.0.0/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3.1/include
 /usr/include
End of search list.
 /usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3.1/cc1 -fpreprocessed foo.i
-quiet -dumpbase foo.c -auxbase foo -O -version -o foo.s
GNU C version 3.3.1 (powerpc-ibm-aix5.1.0.0)
        compiled by GNU C version 3.3.1.
GGC heuristics: --param ggc-min-expand=32 --param ggc-min-heapsize=4096
 as -u -mcom -o foo.o foo.s
 /usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3.1/collect2 -bpT:0x10000000
-bpD:0x20000000 -btextro -bnodelcsect /lib/crt0.o
-L/usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3.1
-L/usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3.1/../../.. foo.o
/usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3.1/libgcc.a
/usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3.1/libgcc_eh.a -lc
/usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3.1/libgcc.a
/usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3.1/libgcc_eh.a
$ ./foo
Segmentation fault(coredump)

-- 
           Summary: loop optimizer with large stack causes core
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rk at divdb dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-ibm-aix5.1.0.0
  GCC host triplet: powerpc-ibm-aix5.1.0.0
GCC target triplet: powerpc-ibm-aix5.1.0.0


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]