[llvm-bugs] [Bug 49562] New: WORDSIZE is incorrectly defined as 64 on Linux SPARC with -mcpu=v9 and -m32

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Mar 12 09:50:08 PST 2021


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: unassignedclangbugs at nondot.org
          Reporter: glaubitz at physik.fu-berlin.de
                CC: jrtc27 at jrtc27.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk,
                    ro at gcc.gnu.org

Test case:

glaubitz at 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 at gcc202:~$ gcc test.c -o test -m32 -mcpu=v9
glaubitz at 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 at gcc202:~$ ./test
Hello 32-bit World!
glaubitz at gcc202:~$

With clang:

glaubitz at gcc202:~$ llvm-project/stage1.install/bin/clang test.c -o test -m32
-mcpu=v9
glaubitz at 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 at gcc202:~$ ./test
Hello 64-bit World!
glaubitz at gcc202:~$

-- 
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/20210312/c62fed99/attachment.html>


More information about the llvm-bugs mailing list