31 lines · c
1/* RUN: %clang_cc1 -std=c89 %s -emit-llvm -o - | FileCheck %s2 RUN: %clang_cc1 -std=c99 %s -emit-llvm -o - | FileCheck %s3 RUN: %clang_cc1 -std=c11 %s -emit-llvm -o - | FileCheck %s4 RUN: %clang_cc1 -std=c17 %s -emit-llvm -o - | FileCheck %s5 RUN: %clang_cc1 -std=c2x %s -emit-llvm -o - | FileCheck %s6 */7 8/* WG14 DR494: yes9 * Part 1: Alignment specifier expression evaluation10 */11void dr494(void) {12 int i = 12;13 int j = _Alignof(int [++i]);14 int k = sizeof(int [++i]);15 /* Check that we store a straight value for i and j, but have to calculate a16 * value for storing into k. That's because sizeof() needs to execute code to17 * get the correct value from a VLA, but _Alignof is not allowed to execute18 * the VLA extent at runtime.19 */20/* CHECK: %[[I:.+]] = alloca i3221 CHECK: %[[J:.+]] = alloca i3222 CHECK: %[[K:.+]] = alloca i3223 CHECK: store i32 12, ptr %[[I]]24 CHECK: store i32 4, ptr %[[J]]25 CHECK: %[[ZERO:.+]] = load i32, ptr %[[I]]26 CHECK: %[[INC:.+]] = add nsw i32 %[[ZERO]], 127 CHECK: store i32 %[[INC]], ptr %[[I]]28 */29}30 31