1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // RUN: %clang_cc1 -x c++ -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s
3 // RUN: %clang_cc1 -x c++ -fsanitize=pointer-overflow -fno-sanitize-recover=pointer-overflow -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s
11 // CHECK-LABEL: @_Z23get_offset_of_y_naivelyv(
13 // CHECK-NEXT: ret i64 ptrtoint (ptr getelementptr inbounds ([[STRUCT_S:%.*]], ptr null, i32 0, i32 1) to i64)
15 uintptr_t get_offset_of_y_naively() {
16 return ((uintptr_t)(&(((S
*)nullptr)->y
)));
19 // CHECK-LABEL: @_Z27get_offset_of_y_via_builtinv(
21 // CHECK-NEXT: ret i64 4
23 uintptr_t get_offset_of_y_via_builtin() {
24 return __builtin_offsetof(S
, y
);