1 // RUN: %clang_cc1 -triple x86_64-pc-win32 -emit-llvm -O2 -o - %s | FileCheck %s
3 // Under Windows 64, int and long are 32-bits. Make sure pointer math doesn't
4 // cause any sign extensions.
6 // CHECK: [[P:%.*]] = add i64 %param, -8
7 // CHECK-NEXT: [[Q:%.*]] = inttoptr i64 [[P]] to [[R:%.*]]*
8 // CHECK-NEXT: {{%.*}} = getelementptr inbounds [[R]], [[R]]* [[Q]], i64 0, i32 0
10 #define CR(Record, TYPE, Field) \
11 ((TYPE *) ((unsigned char *) (Record) - (unsigned char *) &(((TYPE *) 0)->Field)))
13 typedef struct _LIST_ENTRY {
14 struct _LIST_ENTRY *ForwardLink;
15 struct _LIST_ENTRY *BackLink;
19 unsigned long long Signature;
23 int test(unsigned long long param)
28 Link = (LIST_ENTRY *) param;
30 Entry = CR (Link, MEMORY_MAP, Link);
31 return (int) Entry->Signature;