34 lines · c
1// RUN: %clang_cc1 -triple x86_64-apple-darwin %s -emit-llvm -o - | FileCheck %s --check-prefix=DEFAULT2// RUN: %clang_cc1 -triple x86_64-apple-darwin %s -emit-llvm -o - -fwrapv | FileCheck %s --check-prefix=DEFAULT3// RUN: %clang_cc1 -triple x86_64-apple-darwin %s -emit-llvm -o - -ftrapv | FileCheck %s --check-prefix=DEFAULT4// RUN: %clang_cc1 -triple x86_64-apple-darwin %s -emit-llvm -o - -fwrapv-pointer | FileCheck %s --check-prefix=FWRAPV-POINTER5 6void test(void) {7 // -fwrapv-pointer should turn off inbounds for GEP's8 extern int* P;9 ++P;10 // DEFAULT: getelementptr inbounds nuw i32, ptr11 // FWRAPV-POINTER: getelementptr i32, ptr12}13 14struct S {15 int a;16 int b;17 int c: 10;18 int d: 10;19};20 21int test_struct(struct S* s) {22 // -fwrapv-pointer should turn off inbounds nuw for struct GEP's23 return s->b;24 // DEFAULT: getelementptr inbounds nuw %struct.S, ptr25 // FWRAPV-POINTER: getelementptr %struct.S, ptr26}27 28int test_struct_bitfield(struct S* s) {29 // -fwrapv-pointer should turn off inbounds nuw for struct GEP's30 return s->d;31 // DEFAULT: getelementptr inbounds nuw %struct.S, ptr32 // FWRAPV-POINTER: getelementptr %struct.S, ptr33}34