[LLVMbugs] [Bug 2464] New: Miscompilation: register smashed on ppc

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Jun 16 01:35:15 PDT 2008


http://llvm.org/bugs/show_bug.cgi?id=2464

           Summary: Miscompilation: register smashed on ppc
           Product: libraries
           Version: trunk
          Platform: Macintosh
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Backend: PowerPC
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: gbenson at redhat.com
                CC: llvmbugs at cs.uiuc.edu


func5 in the attached test.bc gets miscompiled on 32-bit ppc Linux.  The
failing section is instrumented with calls to trace_bytecode and print_value,
which product the following output:

  630: iload
  local_4_113 = 0
  632: iload
  local_5_114 = 57
  local_4_113 = 0
  634: if_icmplt
  132: aload_3
  133: iload
  135: caload
  136: istore
  138: iload
  140: sipush
  143: if_icmpge
  146: iload
  148: iload
  150: if_icmplt
  185: aload
  187: iload
  189: iinc
  192: iload 
  194: i2b
  195: bastore
  196: iinc 
  199: goto 
  630: iload
  local_4_419 = 1 
  632: iload 
  local_5_420 = 261095424
  local_4_419 = 1 

The variable local_5_* is used to see when to exit a loop; it's "sl" in this:

  int sp = 0;
  int sl = whatever;
  while (sp < sl) {
    // do stuff
  }

In the attached test.s (and test.ll):

  lines 2646-2648 (line 3993 in test.ll) print the first "632: iload"
  lines 2649-2652 (line 3994 in test.ll) print "local_5_114 = 57" (correct)

>From line 2651 you can see that the 57 came from r26.

At the bottom: 

  lines 4901-4903 (7791 in test.ll) print the second "632: iload"
  lines 4904-4907 (7792 in test.ll) print "local_5_420 = 261095424" (junk) 

>From line 4906 you can see that the 261095424 also came from r26. Looking at
what happens to r26 in the meantime it seems it's being used to hold temporary
values:

 lines 2684 and 2685 (4048 and 4049 in test.ll calculate an offset into an
array which is then used in line 2687.
 line 2703 (the top half of the 261101980 in lines 4074 and 4075 in test.ll)
stores the high word of a pair of inlined pointers, used in lines 2704 and
2711.

That last one is where the 261095424 comes from.

This is all with svn revision 52213 BTW, but the miscompilation was also
present in 49380.


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list