Skip to content

[llvm-gcc] llvm-gcc lays out bitfields backwards on big endian systems #966

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lattner opened this issue Jul 14, 2005 · 2 comments
Closed
Assignees
Labels
bugzilla Issues migrated from bugzilla llvm-tools All llvm tools that do not have corresponding tag miscompilation

Comments

@lattner
Copy link
Collaborator

lattner commented Jul 14, 2005

Bugzilla Link 594
Resolution FIXED
Resolved on Feb 22, 2010 12:51
Version 1.0
OS MacOS X

Extended Description

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);
}

@lattner
Copy link
Collaborator Author

lattner commented Jul 14, 2005

assigned to @lattner

@lattner
Copy link
Collaborator Author

lattner commented Jul 21, 2005

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
keryell pushed a commit to keryell/llvm-project that referenced this issue Oct 19, 2024
…d (in CIR + Direct to LLVM) (llvm#966)

Fixes llvm/clangir#931
Added type definition in CIRTypes.td, created appropriate functions for
the same in CIRTypes.cpp like getPreferredAlignment,
getPreferredAlignment, etc. Optionally added lowering in LowerToLLVM.cpp
xlauko pushed a commit to trailofbits/instafix-llvm that referenced this issue Mar 28, 2025
…d (in CIR + Direct to LLVM) (llvm#966)

Fixes llvm/clangir#931
Added type definition in CIRTypes.td, created appropriate functions for
the same in CIRTypes.cpp like getPreferredAlignment,
getPreferredAlignment, etc. Optionally added lowering in LowerToLLVM.cpp
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla llvm-tools All llvm tools that do not have corresponding tag miscompilation
Projects
None yet
Development

No branches or pull requests

1 participant