[LLVMbugs] [Bug 1099] NEW: CBE miscompilation of 197.parser

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Jan 8 21:51:46 PST 2007


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

           Summary: CBE miscompilation of 197.parser
           Product: libraries
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Backend: C
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sabre at nondot.org


Reduced by bugpoint.  The issue is that this testcase:

target datalayout = "e-p:32:32"
target endian = little
target pointersize = 32
target triple = "i686-apple-darwin8"
        %struct.Connector = type { i16, i16, i8, i8, %struct.Connector*, i8* }

implementation   ; Functions:

define bool %prune_match_entry_2E_ce(%struct.Connector* %a, i16 %b.0.0.val) {
newFuncRoot:
        br label %entry.ce

cond_next.exitStub:             ; preds = %entry.ce
        ret bool true

entry.return_crit_edge.exitStub:                ; preds = %entry.ce
        ret bool false

entry.ce:               ; preds = %newFuncRoot
        %tmp = getelementptr %struct.Connector* %a, i32 0, i32 0                ; <i16*> [#uses=1]
        %tmp = load i16* %tmp           ; <i16> [#uses=1]
        %tmp = icmp eq i16 %tmp, %b.0.0.val             ; <bool> [#uses=1]
        br bool %tmp, label %cond_next.exitStub, label %entry.return_crit_edge.exitStub
}


is compiled to:

struct l_struct_2E_Connector {
  signed short field0;
  signed short field1;
  signed char field2;
  signed char field3;
  struct l_struct_2E_Connector *field4;
  signed char *field5;
};
...
bool prune_match_entry_2E_ce(struct l_struct_2E_Connector *ltmp_0_1, unsigned short ltmp_1_2) {
  signed short ltmp_2_2;

  ltmp_2_2 = *(&ltmp_0_1->field0);
  return ((((ltmp_2_2 == ltmp_1_2)) ? (1) : (0)));
}


Note that the == is comparing a signed short and an unsigned short.  These both get extended 
(differently) to int before the comparison is done.

-Chris



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



More information about the llvm-bugs mailing list