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