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 tree-optimization/24142] New: VRP miscompiles unzip inflate.c


For the following testcase reduced from inflate.c

int bar(void);
int foobar(void);
static unsigned dbits = 6;
int foo(void)
{
  int retval;
  unsigned bd;
  unsigned nl;

  bd = dbits;
  retval = bar();
  if (retval == 1)
    retval = 0;
  if (bd == 0 && nl > 257)
    retval = 1;
  if (retval)
    return retval;

  return foobar();
}

VRP removes the call to foobar() because it thinks it can fold the
last comparison:
Folding predicate retval_2 != 0 to 1

-- 
           Summary: VRP miscompiles unzip inflate.c
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
OtherBugsDependingO 23968
             nThis:


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


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