30 lines · c
1/* RUN: %clang_cc1 -std=c89 -emit-llvm -o - %s | FileCheck %s2 RUN: %clang_cc1 -std=c99 -emit-llvm -o - %s | FileCheck %s3 RUN: %clang_cc1 -std=c11 -emit-llvm -o - %s | FileCheck %s4 RUN: %clang_cc1 -std=c17 -emit-llvm -o - %s | FileCheck %s5 RUN: %clang_cc1 -std=c2x -emit-llvm -o - %s | FileCheck %s6 */7 8/* WG14 DR094: yes9 * Are constraints on function return the same as assignment?10 */11 12float func(void) { return 1.0f; }13void other_func(void) {14 int i;15 float f;16 17 /* Test that there's been a conversion from float to int. */18 i = func();19 // CHECK: %call = call float @func()20 // CHECK-NEXT: %conv = fptosi float %call to i3221 // CHECK-NEXT: store i32 %conv, ptr %i, align 422 23 /* Test that the conversion looks the same as an assignment. */24 i = f;25 // CHECK: %0 = load float, ptr %f, align 426 // CHECK-NEXT: %conv1 = fptosi float %0 to i3227 // CHECK-NEXT: store i32 %conv1, ptr %i, align 428}29 30