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

           Summary: Infinite recursion in fold_binary_loc()
           Product: gcc
           Version: 4.4.5
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: arthur.j.odw...@gmail.com


Created attachment 24097
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24097
Output of "ajo-gcc -O2 -fwrapv -ftrapv -S test746998981.c -v"

The following test case causes gcc to enter an infinite regress, recursing
among fold_binary_loc() and fold_build2_stat_loc(). They can't decide whether
the tree should contain a MINUS_EXPR or a PLUS_EXPR.  This reproduces for me
with svn revision 172796 (2011-04-20), and at least as far back as gcc 4.4.5.
I'm on Ubuntu 10.10, x86-64.  Attached "gcc-v.txt".

cat >test746998981.c <<EOF
extern short g, a, b;
void f() {
    g -= (a == -32768 && b == -1) ? -32768 : (a / b);
}
EOF
gcc -O2 -fwrapv -ftrapv -S test746998981.c

gcc: Internal error: Segmentation fault (program cc1)


This test case is reduced from the output of Csmith
(http://embed.cs.utah.edu/csmith/), using the following command line:
csmith --bitfields --packed-struct -s 746998981 > test746998981.c

Reply via email to