Skip to content
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

globalopt crash for packed structs #1863

Closed
llvmbot opened this issue Jun 3, 2007 · 7 comments
Closed

globalopt crash for packed structs #1863

llvmbot opened this issue Jun 3, 2007 · 7 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla compile-fail Use [accepts-invalid] and [rejects-valid] instead ipo Interprocedural optimizations

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Jun 3, 2007

Bugzilla Link 1491
Resolution FIXED
Resolved on Feb 22, 2010 12:50
Version 2.0
OS All
Reporter LLVM Bugzilla Contributor
CC @asl

Extended Description

I compile this program to LLVM bytecode:

#include
std::map<int, int> someMap;

Using this command line:

$ llvm-g++ -O2 --emit-llvm -o mapbug.bc -c mapbug.cc

Then when I try to use the resulting bytecode module, the LLVM tools will
complain about it being invalid. For example:

$ llvm-link -f -o mapbug.linked.bc mapbug.bc
Global variable initializer type does not match global variable type!
"struct.std::map<int,int,std::less,std::allocator<std::pair<const int,
int> > >"* @​someMap
Broken module found, compilation aborted!

This problem disappears if I remove "-O2" or replace it by "-O0".

I'm using LLVM 2.0 and its g++ front-end, compiled from source with GCC 4.1.3.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Jun 3, 2007

assigned to @lattner

@asl
Copy link
Collaborator

asl commented Jun 3, 2007

Confirmed on TOT. Cannot reproduce via "plain" opt. Seems to be somehow
FunctionPasses-specific. Investigating.

@asl
Copy link
Collaborator

asl commented Jun 3, 2007

Reduced.

Steps to reproduce:

./opt -globalopt bugpoint-reduced-simplified.bc

diff'ing:

-@llvm.global_ctors = appending global [1 x { i32, void ()* }] [ { i32, void ()*
} { i32 65535, void ()* @​_GLOBAL__I_someMap } ] ; <[1 x { i32, void
()* }]> [#uses=0]
+@llvm.global_ctors = appending global [0 x { i32, void ()
}] zeroinitializer
; <[0 x { i32, void ()* }]*> [#uses=0]

It seems, it dropped the function at all

@asl
Copy link
Collaborator

asl commented Jun 3, 2007

@lattner
Copy link
Collaborator

lattner commented Jun 5, 2007

Fixed, patch here:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070604/050206.html

Testcase here: GlobalOpt/2007-06-04-PackedStruct.ll

-Chris

@llvmbot
Copy link
Collaborator Author

llvmbot commented Jun 5, 2007

I recompiled LLVM and its GCC with the patch and I can confirm that the bug is
fixed. Thanks to you both!

@asl
Copy link
Collaborator

asl commented Nov 26, 2021

mentioned in issue llvm/llvm-bugzilla-archive#1493

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
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 compile-fail Use [accepts-invalid] and [rejects-valid] instead ipo Interprocedural optimizations
Projects
None yet
Development

No branches or pull requests

3 participants