<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - WORDSIZE is incorrectly defined as 64 on Linux SPARC with -mcpu=v9 and -m32"
   href="https://bugs.llvm.org/show_bug.cgi?id=49562">49562</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>WORDSIZE is incorrectly defined as 64 on Linux SPARC with -mcpu=v9 and -m32
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Driver
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>glaubitz@physik.fu-berlin.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>jrtc27@jrtc27.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk, ro@gcc.gnu.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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:~$</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>