diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2019-07-09 15:02:07 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2019-07-09 15:02:07 +0000 |
commit | b1e511bf5a4c702ace445848b30070ac2e021241 (patch) | |
tree | 22de771c7632577d77a3949f333a3231e4ac193a /clang/test/CodeGen/exprs.c | |
parent | d95557306585404893d610784edb3e32f1bfce18 (diff) | |
download | bcm5719-llvm-b1e511bf5a4c702ace445848b30070ac2e021241.tar.gz bcm5719-llvm-b1e511bf5a4c702ace445848b30070ac2e021241.zip |
Ignore trailing NullStmts in StmtExprs for GCC compatibility.
Ignore trailing NullStmts in compound expressions when determining the result type and value. This is to match the GCC behavior which ignores semicolons at the end of compound expressions.
Patch by Dominic Ferreira.
llvm-svn: 365498
Diffstat (limited to 'clang/test/CodeGen/exprs.c')
-rw-r--r-- | clang/test/CodeGen/exprs.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/CodeGen/exprs.c b/clang/test/CodeGen/exprs.c index f46b5748f23..14f58957bc3 100644 --- a/clang/test/CodeGen/exprs.c +++ b/clang/test/CodeGen/exprs.c @@ -196,3 +196,13 @@ void f18() { } // CHECK-LABEL: define void @f18() // CHECK: call i32 @returns_int() + +// Ensure the right stmt is returned +int f19() { + return ({ 3;;4;; }); +} +// CHECK-LABEL: define i32 @f19() +// CHECK: [[T:%.*]] = alloca i32 +// CHECK: store i32 4, i32* [[T]] +// CHECK: [[L:%.*]] = load i32, i32* [[T]] +// CHECK: ret i32 [[L]] |