diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2015-10-07 10:22:08 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2015-10-07 10:22:08 +0000 |
commit | f2440332caa2641e8615a9464c39acc49a892960 (patch) | |
tree | 0e8cbe6379701cb9715f2052a2473fdad8d6271a /clang/test/CodeGenCXX/cast-to-ref-bool.cpp | |
parent | 4d31a482bb90969a9f8ef12f3a7b00dd5b4f64ac (diff) | |
download | bcm5719-llvm-f2440332caa2641e8615a9464c39acc49a892960.tar.gz bcm5719-llvm-f2440332caa2641e8615a9464c39acc49a892960.zip |
Fix crash in codegen on casting to `bool &`.
Currently codegen crashes trying to emit casting to bool &. It happens because bool type is converted to i1 and later then lvalue for reference is converted to i1*. But when codegen tries to load this lvalue it crashes trying to load value from this i1*.
Differential Revision: http://reviews.llvm.org/D13325
llvm-svn: 249534
Diffstat (limited to 'clang/test/CodeGenCXX/cast-to-ref-bool.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/cast-to-ref-bool.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/cast-to-ref-bool.cpp b/clang/test/CodeGenCXX/cast-to-ref-bool.cpp new file mode 100644 index 00000000000..10647205de3 --- /dev/null +++ b/clang/test/CodeGenCXX/cast-to-ref-bool.cpp @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o - %s | FileCheck %s + +// CHECK-LABEL: main +int main(int argc, char **argv) { + // CHECK: load i8, i8* % + // CHECK-NEXT: trunc i8 %{{.+}} to i1 + bool b = (bool &)argv[argc][1]; + return b; +} |