summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-09-18 19:38:38 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-09-18 19:38:38 +0000
commit2b1d88abfb0f113833de02562457625aba819ef0 (patch)
tree338e88f8d82fec206a3d38e6852a9036c79c39ea /clang/test
parentdbb199d89b58f4c2f1060dc209cd04ceb077e564 (diff)
downloadbcm5719-llvm-2b1d88abfb0f113833de02562457625aba819ef0.tar.gz
bcm5719-llvm-2b1d88abfb0f113833de02562457625aba819ef0.zip
Problem with gnu conditional extension with missing
LHS and when conditional expression is an array. Since it will be decayed, saved expression must be saved with decayed expression. This is necessary to preserve semantics of this extension (and prevent an IRGen crash which expects an array to always be decayed). I am sure there will be other cases in c++ (aggregate conditionals for example) when saving of the expression must happen after some transformation on conditional expression has happened. Doug, please review. Fixes // rdar://8446940 llvm-svn: 114296
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGen/conditional-gnu-ext.c9
-rw-r--r--clang/test/CodeGenCXX/gnu-conditional-scalar-ext.cpp13
2 files changed, 22 insertions, 0 deletions
diff --git a/clang/test/CodeGen/conditional-gnu-ext.c b/clang/test/CodeGen/conditional-gnu-ext.c
index f4ac81bf593..5e5801af93c 100644
--- a/clang/test/CodeGen/conditional-gnu-ext.c
+++ b/clang/test/CodeGen/conditional-gnu-ext.c
@@ -10,3 +10,12 @@ float test(float x, int Y) {
return Y != 0 ? : x;
}
+// rdar://8446940
+extern void abort();
+void test1 () {
+ char x[1];
+ char *y = x ? : 0;
+
+ if (x != y)
+ abort();
+}
diff --git a/clang/test/CodeGenCXX/gnu-conditional-scalar-ext.cpp b/clang/test/CodeGenCXX/gnu-conditional-scalar-ext.cpp
index 8c529c30e17..dfd9d414895 100644
--- a/clang/test/CodeGenCXX/gnu-conditional-scalar-ext.cpp
+++ b/clang/test/CodeGenCXX/gnu-conditional-scalar-ext.cpp
@@ -9,3 +9,16 @@ int main(int argc, char **argv) {
printf("%p\n", (void *)0xdeadbeef ? : (void *)0xaaaaaa);
return 0;
}
+
+// rdar://8446940
+namespace radar8446940 {
+extern "C" void abort();
+
+int main () {
+ char x[1];
+ char *y = x ? : 0;
+
+ if (x != y)
+ abort();
+}
+}
OpenPOWER on IntegriCloud