xref: /llvm-project/clang/test/CodeGen/pointer-overflow.c (revision 1295aa2e814d1747d69520e34e2c5fb2888e666d)
1*1295aa2eSNikita Popov // RUN: %clang_cc1 -triple x86_64-apple-darwin %s -emit-llvm -o - | FileCheck %s --check-prefix=DEFAULT
2*1295aa2eSNikita Popov // RUN: %clang_cc1 -triple x86_64-apple-darwin %s -emit-llvm -o - -fwrapv | FileCheck %s --check-prefix=DEFAULT
3*1295aa2eSNikita Popov // RUN: %clang_cc1 -triple x86_64-apple-darwin %s -emit-llvm -o - -ftrapv | FileCheck %s --check-prefix=DEFAULT
4*1295aa2eSNikita Popov // RUN: %clang_cc1 -triple x86_64-apple-darwin %s -emit-llvm -o - -fwrapv-pointer | FileCheck %s --check-prefix=FWRAPV-POINTER
5*1295aa2eSNikita Popov 
6*1295aa2eSNikita Popov void test(void) {
7*1295aa2eSNikita Popov   // -fwrapv-pointer should turn off inbounds for GEP's
8*1295aa2eSNikita Popov   extern int* P;
9*1295aa2eSNikita Popov   ++P;
10*1295aa2eSNikita Popov   // DEFAULT: getelementptr inbounds nuw i32, ptr
11*1295aa2eSNikita Popov   // FWRAPV-POINTER: getelementptr i32, ptr
12*1295aa2eSNikita Popov }
13