[Bug c/32575] New: GCC 4.3.0 with -ftree-vrp miscompiles a single line of code in SQLite

drh at sqlite dot org gcc-bugzilla@gcc.gnu.org
Sun Jul 1 22:07:00 GMT 2007


A bug reported against SQLite appears to be a case of GCC 4.3.0
miscompiling a single line of code within SQLite.  The problem only
appears with -O2 or -Os.  The problem goes away if we add the
-fno-tree-vrp option.  The original bug report can be found at

   http://www.sqlite.org/cvstrac/tktview?tn=2469

The line of code that is miscompiled is found in the source file
named vdbe.c (version 1.635) on line 4309.

  4308  for(j=0; j<nRoot; j++){
  4309    aRoot[j] = pTos[-j].u.i;
  4310  }
  4311  aRoot[j] = 0;

By setting a breakpoint on line 4311 and examining the values
of aRoot[] one finds that all nRoot entries of aRoot[] are being
filled from pTos[0].u.i instead of being filled from pTos[0].u.i,
pTos[-1].u.i, pTos[-2].u.i, and so forth as the loop intends.

I will be happy to supply any additional debugging information
that might help in fixing this problem (such as vdbe.s files 
compiled both with and without -fno-tree-vrp).  I regret that 
I have so far been unable to replicate this problem in a small 
test program.


-- 
           Summary: GCC 4.3.0 with -ftree-vrp miscompiles a single line of
                    code in SQLite
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: drh at sqlite dot org


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



More information about the Gcc-bugs mailing list