https://bugs.llvm.org/show_bug.cgi?id=49562

            Bug ID: 49562
           Summary: WORDSIZE is incorrectly defined as 64 on Linux SPARC
                    with -mcpu=v9 and -m32
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Driver
          Assignee: unassignedclangb...@nondot.org
          Reporter: glaub...@physik.fu-berlin.de
                CC: jrt...@jrtc27.com, llvm-bugs@lists.llvm.org,
                    neeil...@live.com, richard-l...@metafoo.co.uk,
                    r...@gcc.gnu.org

Test case:

glaubitz@gcc202:~$ cat test.c
#include <stdio.h>
#include <bits/wordsize.h>

int main () {
#if __WORDSIZE == 32
        printf("Hello 32-bit World!\n");
#elif __WORDSIZE == 64
        printf("Hello 64-bit World!\n");
#endif
        return 0;
}

With gcc:

glaubitz@gcc202:~$ gcc test.c -o test -m32 -mcpu=v9
glaubitz@gcc202:~$ file test
test: ELF 32-bit MSB pie executable, SPARC32PLUS, V8+ Required, total store
ordering, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2,
BuildID[sha1]=e29c566d1d767ede628ff31e5a32df089341caea, for GNU/Linux 3.2.0,
not stripped
glaubitz@gcc202:~$ ./test
Hello 32-bit World!
glaubitz@gcc202:~$

With clang:

glaubitz@gcc202:~$ llvm-project/stage1.install/bin/clang test.c -o test -m32
-mcpu=v9
glaubitz@gcc202:~$ file test
test: ELF 32-bit MSB executable, SPARC32PLUS, V8+ Required, total store
ordering, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2,
for GNU/Linux 3.2.0, not stripped
glaubitz@gcc202:~$ ./test
Hello 64-bit World!
glaubitz@gcc202:~$

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to