1 // RUN: %clang_cc1 -triple x86_64-pc-win32 -emit-llvm -O2 -o - %s | FileCheck %s 2 3 // Under Windows 64, int and long are 32-bits. Make sure pointer math doesn't 4 // cause any sign extensions. 5 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 9 10 #define CR(Record, TYPE, Field) \ 11 ((TYPE *) ((unsigned char *) (Record) - (unsigned char *) &(((TYPE *) 0)->Field))) 12 13 typedef struct _LIST_ENTRY { 14 struct _LIST_ENTRY *ForwardLink; 15 struct _LIST_ENTRY *BackLink; 16 } LIST_ENTRY; 17 18 typedef struct { 19 unsigned long long Signature; 20 LIST_ENTRY Link; 21 } MEMORY_MAP; 22 test(unsigned long long param)23int test(unsigned long long param) 24 { 25 LIST_ENTRY *Link; 26 MEMORY_MAP *Entry; 27 28 Link = (LIST_ENTRY *) param; 29 30 Entry = CR (Link, MEMORY_MAP, Link); 31 return (int) Entry->Signature; 32 } 33