[LLVMbugs] [Bug 2812] New: Segfault on big endian processor in LegalizeDAG.cpp

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sat Sep 20 04:33:45 PDT 2008


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

           Summary: Segfault on big endian processor in LegalizeDAG.cpp
           Product: new-bugs
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: rich at pennware.com
                CC: llvmbugs at cs.uiuc.edu


The following patch fixes a segfault that occurs in LegalizeDAG.cpp when the
target processor is big endian:

Index: LegalizeDAG.cpp
===================================================================
--- LegalizeDAG.cpp     (revision 847)
+++ LegalizeDAG.cpp     (working copy)
@@ -2480,7 +2480,7 @@
           ExpandOp(ST->getValue(), Lo, Hi);
           IncrementSize = Hi.getNode() ? Hi.getValueType().getSizeInBits()/8 :
0;

-          if (TLI.isBigEndian())
+          if (Hi.getNode() && TLI.isBigEndian())
             std::swap(Lo, Hi);
         }

Unfortunately I don't have a test case for this, because it only fails in my
code generator for the Nios2. All of the other code generator either don't go
down this path or fail for other reasons.

The code that triggered this in my code generator was an i32 to f32 conversion.

It is clear from looking at the code that Hi.getNode() is expected to be NULL
in the case of i32 <-> f32 conversions.

After I applied this patch, the test results:

                ===  Summary ===

# of expected passes            2736
# of expected failures          7


-- 
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