Compile the attached program with:

  gcc -O0 wrong-code-tree-vrp.cc
  gcc -O2 wrong-code-tree-vrp.cc
  gcc -O2 -fno-tree-vrp wrong-code-tree-vrp.cc

with gcc 4.1.0, native i686-pc-linux-gnu.

The -O0 and -O2 -fno-tree-vrp versions produce the correct output: g1[3] ==
100, g1[4] == 100.  The -O2 version produces incorrect output: g1[3] == 101,
g1[4] == 101.

Works fine with gcc 4.0.3, native i686-pc-linux-gnu, -O2.

Still broken with gcc 4.2-20060513, native i686-pc-linux-gnu, -O2.

Haven't checked with gcc 4.1-LATEST yet.


-- 
           Summary: wrong code, apparently due to bad VRP
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mec at google dot com
 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=27603

Reply via email to