diff options
author | Akira Hatanaka <ahatanaka@apple.com> | 2018-04-16 20:23:52 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@apple.com> | 2018-04-16 20:23:52 +0000 |
commit | 7c55265c2dfad74f91530f86a61357e22a472dfa (patch) | |
tree | 0aefb9183e16a324ed3cc7fa3f6ad2003e9f123b /clang/test/CodeGenObjC/strong-in-c-struct.m | |
parent | 9ff8083d98af733e4d98efb78d1d9f0684fe0a87 (diff) | |
download | bcm5719-llvm-7c55265c2dfad74f91530f86a61357e22a472dfa.tar.gz bcm5719-llvm-7c55265c2dfad74f91530f86a61357e22a472dfa.zip |
[CodeGen] Fix a crash that occurs when a non-trivial C struct with a
volatile array field is copied.
The crash occurs because method 'visitArray' passes a null FieldDecl to
method 'visit' and some of the methods called downstream expect a
non-null FieldDecl to be passed.
This reapplies r330151 with a fix to the test case.
rdar://problem/33599681
llvm-svn: 330155
Diffstat (limited to 'clang/test/CodeGenObjC/strong-in-c-struct.m')
-rw-r--r-- | clang/test/CodeGenObjC/strong-in-c-struct.m | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/CodeGenObjC/strong-in-c-struct.m b/clang/test/CodeGenObjC/strong-in-c-struct.m index 6310943d2ef..36e9049635f 100644 --- a/clang/test/CodeGenObjC/strong-in-c-struct.m +++ b/clang/test/CodeGenObjC/strong-in-c-struct.m @@ -70,6 +70,11 @@ typedef struct { volatile char i6; } Bitfield1; +typedef struct { + id x; + volatile int a[16]; +} VolatileArray ; + #endif #ifdef USESTRUCT @@ -540,4 +545,19 @@ void test_strong_in_union() { U t; } +// CHECK: define void @test_copy_constructor_VolatileArray( +// CHECK: call void @__copy_constructor_8_8_s0_AB8s4n16_tv64w32_AE( + +// CHECK: define linkonce_odr hidden void @__copy_constructor_8_8_s0_AB8s4n16_tv64w32_AE( +// CHECK: %[[ADDR_CUR:.*]] = phi i8** +// CHECK: %[[ADDR_CUR1:.*]] = phi i8** +// CHECK: %[[V12:.*]] = bitcast i8** %[[ADDR_CUR]] to i32* +// CHECK: %[[V13:.*]] = bitcast i8** %[[ADDR_CUR1]] to i32* +// CHECK: %[[V14:.*]] = load volatile i32, i32* %[[V13]], align 4 +// CHECK: store volatile i32 %[[V14]], i32* %[[V12]], align 4 + +void test_copy_constructor_VolatileArray(VolatileArray *a) { + VolatileArray t = *a; +} + #endif /* USESTRUCT */ |