aboutsummaryrefslogtreecommitdiff
path: root/clang/test/CodeGenCXX/static-init.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-03-30 19:44:53 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-03-30 19:44:53 +0000
commit8453795255ca34a804e01f5b3c7cb939f41ad20c (patch)
tree995276152663add165145dc07f06cae95bc0f1eb /clang/test/CodeGenCXX/static-init.cpp
parentdaa04130ed75e5c42a99bac91ac22306f9af8987 (diff)
downloadllvm-8453795255ca34a804e01f5b3c7cb939f41ad20c.zip
llvm-8453795255ca34a804e01f5b3c7cb939f41ad20c.tar.gz
llvm-8453795255ca34a804e01f5b3c7cb939f41ad20c.tar.bz2
Revert r153723, and its follow-ups r153728 and r153733.
These patches cause us to miscompile and/or reject code with static function-local variables in an extern-C context. Previously, we were papering over this as long as the variables are within the same translation unit, and had not seen any failures in the wild. We still need a proper fix, which involves mangling static locals inside of an extern-C block (as GCC already does), but this patch causes pretty widespread regressions. Firefox, and many other applications no longer build. Lots of test cases have been posted to the list in response to this commit, so there should be no problem reproducing the issues. llvm-svn: 153768
Diffstat (limited to 'clang/test/CodeGenCXX/static-init.cpp')
-rw-r--r--clang/test/CodeGenCXX/static-init.cpp71
1 files changed, 0 insertions, 71 deletions
diff --git a/clang/test/CodeGenCXX/static-init.cpp b/clang/test/CodeGenCXX/static-init.cpp
index 7e840f5..a96cb7a 100644
--- a/clang/test/CodeGenCXX/static-init.cpp
+++ b/clang/test/CodeGenCXX/static-init.cpp
@@ -3,7 +3,6 @@
// CHECK: @_ZZ1hvE1i = internal global i32 0, align 4
// CHECK: @base_req = global [4 x i8] c"foo\00", align 1
-// CHECK: @_ZZN5test31BC1EvE1u = internal global { i8, [3 x i8] } { i8 97, [3 x i8] undef }, align 4
// CHECK: @_ZZN5test1L6getvarEiE3var = internal constant [4 x i32] [i32 1, i32 0, i32 2, i32 4], align 16
// CHECK: @_ZZ2h2vE1i = linkonce_odr global i32 0
// CHECK: @_ZGVZ2h2vE1i = linkonce_odr global i64 0
@@ -80,73 +79,3 @@ namespace union_static_local {
c::main();
}
}
-
-// rdar://problem/11091093
-// Static variables should be consistent across constructor
-// or destructor variants.
-namespace test2 {
- struct A {
- A();
- ~A();
- };
-
- struct B : virtual A {
- B();
- ~B();
- };
-
- // If we ever implement this as a delegate ctor call, just change
- // this to take variadic arguments or something.
- extern int foo();
- B::B() {
- static int x = foo();
- }
- // CHECK: define void @_ZN5test21BC1Ev
- // CHECK: load atomic i8* bitcast (i64* @_ZGVZN5test21BC1EvE1x to i8*) acquire,
- // CHECK: call i32 @__cxa_guard_acquire(i64* @_ZGVZN5test21BC1EvE1x)
- // CHECK: [[T0:%.*]] = call i32 @_ZN5test23fooEv()
- // CHECK: store i32 [[T0]], i32* @_ZZN5test21BC1EvE1x,
- // CHECK: call void @__cxa_guard_release(i64* @_ZGVZN5test21BC1EvE1x)
-
- // CHECK: define void @_ZN5test21BC2Ev
- // CHECK: load atomic i8* bitcast (i64* @_ZGVZN5test21BC1EvE1x to i8*) acquire,
- // CHECK: call i32 @__cxa_guard_acquire(i64* @_ZGVZN5test21BC1EvE1x)
- // CHECK: [[T0:%.*]] = call i32 @_ZN5test23fooEv()
- // CHECK: store i32 [[T0]], i32* @_ZZN5test21BC1EvE1x,
- // CHECK: call void @__cxa_guard_release(i64* @_ZGVZN5test21BC1EvE1x)
-
- // This is just for completeness, because we actually emit this
- // using a delegate dtor call.
- B::~B() {
- static int y = foo();
- }
- // CHECK: define void @_ZN5test21BD1Ev(
- // CHECK: call void @_ZN5test21BD2Ev(
-
- // CHECK: define void @_ZN5test21BD2Ev(
- // CHECK: load atomic i8* bitcast (i64* @_ZGVZN5test21BD1EvE1y to i8*) acquire,
- // CHECK: call i32 @__cxa_guard_acquire(i64* @_ZGVZN5test21BD1EvE1y)
- // CHECK: [[T0:%.*]] = call i32 @_ZN5test23fooEv()
- // CHECK: store i32 [[T0]], i32* @_ZZN5test21BD1EvE1y,
- // CHECK: call void @__cxa_guard_release(i64* @_ZGVZN5test21BD1EvE1y)
-}
-
-// This shouldn't error out.
-namespace test3 {
- struct A {
- A();
- ~A();
- };
-
- struct B : virtual A {
- B();
- ~B();
- };
-
- B::B() {
- union U { char x; int i; };
- static U u = { 'a' };
- }
- // CHECK: define void @_ZN5test31BC1Ev(
- // CHECK: define void @_ZN5test31BC2Ev(
-}