[Bug other/29534] New: ICE in "gcc -O -ftrapv" with decreasing array index

h dot b dot furuseth at usit dot uio dot no gcc-bugzilla@gcc.gnu.org
Sat Oct 21 11:16:00 GMT 2006


bash$ cat bug.c
int foo(int arr[]) {
  int i = 2;
  while (arr[--i]) ;
  return i;
}
bash$ gcc -O -ftrapv -c bug.c
gcc: Internal error: Segmentation fault (program cc1)
bash$ g++ -O -ftrapv -c bug.c
g++: Internal error: Segmentation fault (program cc1plus)

Compilation succeeds if -O is removed.  OTOH, it still crashes
with -O -fno-<all -O1 options listed in (gcc)Optimize Options>:

bash$ gcc -O -fno-defer-pop -fno-delayed-branch \
 -fno-guess-branch-probability -fno-cprop-registers -fno-loop-optimize \
 -fno-if-conversion -fno-if-conversion2 -fno-tree-ccp -fno-tree-dce \
 -fno-tree-dominator-opts -fno-tree-dse -fno-tree-ter -fno-tree-lrs \
 -fno-tree-sra -fno-tree-copyrename -fno-tree-fre -fno-tree-ch \
 -fno-merge-constants -fno-omit-frame-pointer \
 -ftrapv -c bug.c
gcc: Internal error: Segmentation fault (program cc1)


-- 
           Summary: ICE in "gcc -O -ftrapv" with decreasing array index
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: h dot b dot furuseth at usit dot uio dot no
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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



More information about the Gcc-bugs mailing list