diff options
| author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-11-09 01:30:48 +0000 |
|---|---|---|
| committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-11-09 01:30:48 +0000 |
| commit | 8909686b2282231201c354bffe92bda833f12ab0 (patch) | |
| tree | 3b81398aecbacbf0f609216e0431c1395bda2773 /clang/test | |
| parent | 45b49245502eda6ab774b3d6ecd9398d86d17717 (diff) | |
| download | bcm5719-llvm-8909686b2282231201c354bffe92bda833f12ab0.tar.gz bcm5719-llvm-8909686b2282231201c354bffe92bda833f12ab0.zip | |
Fix miscompilation regarding VLAs; subscription of VLA pointers was incorrect.
Fixes rdar://8644873 & http://llvm.org/PR8567.
llvm-svn: 118468
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/CodeGen/vla.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/clang/test/CodeGen/vla.c b/clang/test/CodeGen/vla.c index fa7a22fd0bd..f1f5a70a5e6 100644 --- a/clang/test/CodeGen/vla.c +++ b/clang/test/CodeGen/vla.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o - | FileCheck %s int b(char* x); @@ -85,3 +85,16 @@ int test2(int n) return GLOB; } +// http://llvm.org/PR8567 +// CHECK: define double @test_PR8567 +double test_PR8567(int n, double (*p)[n][5]) { + // CHECK: store [[vla_type:.*]] %p, + // CHECK: load i32* %n + // CHECK-NEXT: mul i32 40 + // CHECK-NEXT: [[byte_idx:%.*]] = mul i32 1 + // CHECK-NEXT: [[tmp_1:%.*]] = load [[vla_type]]* + // CHECK-NEXT: [[tmp_2:%.*]] = bitcast [[vla_type]] [[tmp_1]] to i8* + // CHECK-NEXT: [[idx:%.*]] = getelementptr inbounds i8* [[tmp_2]], i32 [[byte_idx]] + // CHECK-NEXT: bitcast i8* [[idx]] to [[vla_type]] + return p[1][2][3]; +} |

