[LLVMbugs] [Bug 12506] New: wrong Sizeof struct

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Apr 9 12:04:44 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=12506

             Bug #: 12506
           Summary: wrong Sizeof struct
           Product: new-bugs
           Version: 3.0
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: jose.francisco.hevia at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8358
  --> http://llvm.org/bugs/attachment.cgi?id=8358
the bug test file

llvm calculates the size of a struct wrong.

I discovered this bug while programming the iphone. In the iphone it works
right, in the mac intel 64 env wrong, so I can't read what I store with the
iphone, as block sizes are different.

For reproduction:

1)Compile the "main.c" basic example with clang in the command line or xcode.

2)Execute it.

3)In my system it displays:

 enigma size is 64

 enigma2 size is 64

But enigma struct has nine ints and enigma2 ten. ??

In the original program I use "unsigned ints" instead of ints, with other
names, and a different order(ints first then 3 doubles, then more ints). The
same problem. If you replace "double" with floats it works fine, so it is a
"double" problem.

my computer uses snow leopard with xcode4.2:
clang -v
Apple clang version 3.0 (tags/Apple/clang-211.10.1) (based on LLVM 3.0svn)
Target: x86_64-apple-darwin10.8.0
Thread model: posix

For me this is really serious, it seems that it is a problem with double sizes,
and the iOS system uses a lot of doubles for a lot of things, like inertial
information, so I considered this bug critical.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list