<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </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 --- - <ctype.h> doesn't handle -fpack-struct"
   href="http://llvm.org/bugs/show_bug.cgi?id=22538">22538</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td><ctype.h> doesn't handle -fpack-struct
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>FreeBSD
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Headers
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>kenbrody@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The <ctype.h> header doesn't protect itself from being included in source code
when "-fpack-struct" is being used with a non-default value.  This causes the
is* macros to mis-read the required structs

This is on a 64-bit version of FreeBSD 10.0, should that make a difference.

========== istest.c

#include <stdio.h>
#include <ctype.h>

int main(int argc,char *argv[])
     {
     printf("isalnum('z') returns %d\n",isalnum('z'));
     }

==========

When compiled with the simple:

     clang -o istest istest.c

you get the expected "1" result.

However, when compiled with 2-byte packing:

    clang -fpack-struct-2 -o istest istest.c

you get "0" for the output.</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>