[LLVMbugs] [Bug 22538] New: <ctype.h> doesn't handle -fpack-struct

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Feb 10 19:11:56 PST 2015


            Bug ID: 22538
           Summary: <ctype.h> doesn't handle -fpack-struct
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P
         Component: Headers
          Assignee: unassignedclangbugs at nondot.org
          Reporter: kenbrody at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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.

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/20150211/f8d6bd04/attachment.html>

More information about the llvm-bugs mailing list