diff --git a/compiler/i8086/symcpu.pas b/compiler/i8086/symcpu.pas index 7e6aca0d7b..b7be9b552b 100644 --- a/compiler/i8086/symcpu.pas +++ b/compiler/i8086/symcpu.pas @@ -59,6 +59,7 @@ type class function default_x86_data_pointer_type: tx86pointertyp; override; function alignment:shortint;override; function pointer_arithmetic_int_type:tdef; override; + function pointer_arithmetic_uint_type:tdef; override; function pointer_subtraction_result_type:tdef; override; function converted_pointer_to_array_range_type: tdef; override; end; @@ -441,6 +442,26 @@ implementation end; + function tcpupointerdef.pointer_arithmetic_uint_type:tdef; + begin + case x86pointertyp of + x86pt_huge: + result:=u32inttype; + x86pt_far, + x86pt_near, + x86pt_near_cs, + x86pt_near_ds, + x86pt_near_ss, + x86pt_near_es, + x86pt_near_fs, + x86pt_near_gs: + result:=u16inttype; + else + internalerror(2016100403); + end; + end; + + function tcpupointerdef.pointer_subtraction_result_type:tdef; begin case x86pointertyp of diff --git a/compiler/symdef.pas b/compiler/symdef.pas index 90892eaf96..6d6016c88c 100644 --- a/compiler/symdef.pas +++ b/compiler/symdef.pas @@ -255,6 +255,8 @@ interface Normally, this is sinttype, except on i8086, where it takes into account the special i8086 pointer types (near, far, huge). } function pointer_arithmetic_int_type:tdef;virtual; + {# the unsigned version of pointer_arithmetic_int_type. Used with inc/dec. } + function pointer_arithmetic_uint_type:tdef;virtual; {# returns the int type produced when subtracting two pointers of the given type. Normally, this is sinttype, except on i8086, where it takes into account the special i8086 pointer types (near, far, huge). } @@ -3376,6 +3378,12 @@ implementation end; + function tpointerdef.pointer_arithmetic_uint_type:tdef; + begin + result:=ptruinttype; + end; + + function tpointerdef.pointer_subtraction_result_type:tdef; begin result:=ptrsinttype;