[LLVMbugs] [Bug 16147] New: PPC64: Possible endian issue in optimization

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun May 26 14:02:01 PDT 2013


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

            Bug ID: 16147
           Summary: PPC64: Possible endian issue in optimization
           Product: libraries
           Version: trunk
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: PowerPC
          Assignee: unassignedbugs at nondot.org
          Reporter: kai at redstar.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 10584
  --> http://llvm.org/bugs/attachment.cgi?id=10584&action=edit
IR file demonstrating the problem.

You get 2 different results for the attached file y.ll depending on
optimization level:

[u0012540 at 172-29-171-104 build-ldc]$ llvm-as y.ll; opt -O1 y.bc | llc
-filetype=obj >y.o ; gcc -m64 -o y y.o ; ./y ; echo $?
1
[u0012540 at 172-29-171-104 build-ldc]$ llvm-as y.ll; opt -O2 y.bc | llc
-filetype=obj >y.o ; gcc -m64 -o y y.o ; ./y ; echo $?
0

The result from level -O1 is the right one. The wrong output does not occur if
you only use llc. The IR code is derived from the following D code:

private union EndianSwapper
{
    bool value;
    ubyte[bool.sizeof] array;
}

int main()
{
    EndianSwapper es = void;
    es.array[0] = 1;
    immutable retval = es.value;
    return retval;
}

which is derived from the failure of the following identity:

assert(bigEndianToNative!bool(nativeToBigEndian(bool.max)) == bool.max);

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130526/e318bb56/attachment.html>


More information about the llvm-bugs mailing list