[LLVMbugs] [Bug 11326] New: Clang generates incorrect code for structure member offsets on ARM

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Nov 7 08:56:57 PST 2011


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

             Bug #: 11326
           Summary: Clang generates incorrect code for structure member
                    offsets on ARM
           Product: clang
           Version: trunk
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: mcharleb at codeaurora.org
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 7585
  --> http://llvm.org/bugs/attachment.cgi?id=7585
Output and assembly showing the incorrectly generated structure offsets

I have been working on compiling Linux for ARM with Clang and think I may have
found the source of several data aborts. There is a global variable "init_task"
of type "struct task_struct" that appears to be improperly initialized by
Clang.

I created code to re-initialize the structure to see why it was not being set
correctly and found the same problem that occurred had occurred in global
initialization. Clang seems to be generating incorrect code for accessing
structure members of struct task_struct.

I have attached a file showing the code snipit I used to generate the output
and the assembly generated for both and GCC and Clang.

The "error" column shows the difference between the address generated by the
compiler for the structure member and the offset reported by 
__builtin_offsetof() plus the address of the struct.

The included assembly also shows that Clang is generating the incorrect offset
for the members, using &init_task.comm as an example. You can see what the
offset address should be from the table included in the attachment in the
"expected" column.

-- 
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