First Last Prev Next    No search results available
Details
: [llvm-gcc] llvm-gcc lays out bitfields backwards on big e...
Bug#: 594
: tools
: llvm-gcc
Status: RESOLVED
Resolution: FIXED
: Macintosh
: MacOS X
: 1.0
: P2
: normal
: 1.6

:
: miscompilation
:
:
  Show dependency tree - Show dependency graph
People
Reporter: Chris Lattner <sabre@nondot.org>
Assigned To: Chris Lattner <sabre@nondot.org>

Attachments


Note

You need to log in before you can comment on or make changes to this bug.

Related actions


Description:   Opened: 2005-07-14 01:56
This program is miscompiled by LLVM on powerpc.  It appears that bitfields are
being layed out backwards by the CFE.  This may be related to Bug 449.  It
probably also affects Sparc.  This testcase should be compiled with
-fno-strict-aliasing.

-Chris


struct X {
   int A : 4;
   int Z : 28;
};

void test(struct X *P, int A) {
   P->A = A;
}

int main() {
  int Y = ~0;
  test((struct X*)&Y, 0);
  printf("%x\n", Y);
}
------- Comment #1 From Chris Lattner 2005-07-20 18:23:30 -------
Fixed.  Patches here and here:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20050711/027100.html
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20050718/027152.html

Fixing this fixes NAMD, 176.gcc and others.

-Chris

First Last Prev Next    No search results available