diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-10-25 11:09:30 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-10-25 11:10:01 -0700 |
commit | 52b97cb9116301bb42f16edc865f807ee920e0ba (patch) | |
tree | bdbe52ed5d44c275b680d386cceae515eea75aad /tests | |
parent | 39cb6c0776360c72f3b34e5f8145919e7d794b04 (diff) |
handle internal illegal iX fields in calculateStructAlignment
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cases/2xi40.ll | 40 | ||||
-rw-r--r-- | tests/cases/2xi40.txt | 1 |
2 files changed, 41 insertions, 0 deletions
diff --git a/tests/cases/2xi40.ll b/tests/cases/2xi40.ll new file mode 100644 index 00000000..a2c04d22 --- /dev/null +++ b/tests/cases/2xi40.ll @@ -0,0 +1,40 @@ +; ModuleID = '/tmp/tmpe4Pk1F/a.out.bc' +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:32" +target triple = "le32-unknown-nacl" + +%struct.pair = type { [5 x i8], [5 x i8] } + +@.str = private unnamed_addr constant [6 x i8] c"|%d|\0A\00", align 1 +@.str1 = private unnamed_addr constant [7 x i8] c"%s,%s\0A\00", align 1 + +define i32 @main() { + %1 = alloca i32, align 4 + %pp = alloca [2 x i40], align 8 + %p = bitcast [2 x i40]* %pp to %struct.pair* + store i32 0, i32* %1 + %2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([6 x i8]* @.str, i32 0, i32 0), i32 10) + %3 = bitcast %struct.pair* %p to i8* + call void @llvm.memset.p0i8.i32(i8* %3, i8 120, i32 10, i32 1, i1 false) + %4 = getelementptr inbounds %struct.pair* %p, i32 0, i32 0 + %5 = getelementptr inbounds [5 x i8]* %4, i32 0, i32 2 + store i8 97, i8* %5, align 1 + %6 = getelementptr inbounds %struct.pair* %p, i32 0, i32 0 + %7 = getelementptr inbounds [5 x i8]* %6, i32 0, i32 4 + store i8 0, i8* %7, align 1 + %8 = getelementptr inbounds %struct.pair* %p, i32 0, i32 1 + %9 = getelementptr inbounds [5 x i8]* %8, i32 0, i32 3 + store i8 98, i8* %9, align 1 + %10 = getelementptr inbounds %struct.pair* %p, i32 0, i32 1 + %11 = getelementptr inbounds [5 x i8]* %10, i32 0, i32 4 + store i8 0, i8* %11, align 1 + %12 = getelementptr inbounds %struct.pair* %p, i32 0, i32 0 + %13 = getelementptr inbounds [5 x i8]* %12, i32 0, i32 0 + %14 = getelementptr inbounds %struct.pair* %p, i32 0, i32 1 + %15 = getelementptr inbounds [5 x i8]* %14, i32 0, i32 0 + %16 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([7 x i8]* @.str1, i32 0, i32 0), i8* %13, i8* %15) + ret i32 0 +} + +declare i32 @printf(i8*, ...) + +declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) nounwind diff --git a/tests/cases/2xi40.txt b/tests/cases/2xi40.txt new file mode 100644 index 00000000..59a1104e --- /dev/null +++ b/tests/cases/2xi40.txt @@ -0,0 +1 @@ +xxax,xxxb |