[LLVMbugs] [Bug 8516] New: Clang generates incorrect big endian multibyte character strings

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Oct 30 12:37:36 PDT 2010


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

           Summary: Clang generates incorrect big endian multibyte
                    character strings
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jpbonn-keyword-llvmbug.a51747 at corniceresearch.com
                CC: llvmbugs at cs.uiuc.edu


This is from the GCC testsuite.  

On big endian architectures the string L"ab" is in little endian format. The C
code below generates the same string on both big and little endian
architectures:
@.str = private constant [12 x i8] c"a\00\00\00b\00\00\00\00\00\00\00" ; <[12 x
i8]*> [#uses=1]
For big endian the string generated by GCC is equivalent to:
@.str = private constant [12 x i8] c"\00\00\00a\00\00\00b\00\00\00\00" ; <[12 x
i8]*> [#uses=1]



extern void exit(int);
extern void abort(void);

int
main(void)
{
  if (L"ab"[1] != L'b')
    abort();
  exit(0);
}

I tested this on qemu using a debian linux distribution.

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