Merge of revisions 39731 39825 39849 39912 39913 39914 39924 39935 39999 40000 40001 40026 40115 40132 40163 from trunk to fixes_3_2

------------------------------------------------------------------------
r39731 | pierre | 2018-09-11 08:00:54 +0000 (Tue, 11 Sep 2018) | 1 line

 Disable overflow for UDIVX ans SDIVX 64-bit instructions
------------------------------------------------------------------------
--- Merging r39731 into '.':
U    compiler/sparcgen/ncpumat.pas
--- Recording mergeinfo for merge of r39731 into '.':
 G   .
------------------------------------------------------------------------
r39825 | pierre | 2018-09-27 06:59:07 +0000 (Thu, 27 Sep 2018) | 1 line

 Add rtl dependency and fix fpcdir value
------------------------------------------------------------------------
--- Merging r39825 into '.':
U    packages/ide/compiler/Makefile.fpc
--- Recording mergeinfo for merge of r39825 into '.':
 G   .
------------------------------------------------------------------------
r39849 | pierre | 2018-10-01 21:50:13 +0000 (Mon, 01 Oct 2018) | 1 line

 Use vfpv2 as default fpu for eabihf if cpu is below armv7
------------------------------------------------------------------------
--- Merging r39849 into '.':
U    compiler/options.pas
--- Recording mergeinfo for merge of r39849 into '.':
 G   .
------------------------------------------------------------------------
r39912 | pierre | 2018-10-11 20:38:39 +0000 (Thu, 11 Oct 2018) | 1 line

 Fix ppuload for string type for i8086, use getasizeint for all string defs but short string
------------------------------------------------------------------------
--- Recording mergeinfo for merge of r39912 into '.':
 G   .
------------------------------------------------------------------------
r39913 | pierre | 2018-10-11 21:02:25 +0000 (Thu, 11 Oct 2018) | 1 line

 fix position of ppuload_platform for trecorddef
------------------------------------------------------------------------
--- Recording mergeinfo for merge of r39913 into '.':
 G   .
------------------------------------------------------------------------
r39914 | pierre | 2018-10-12 06:05:50 +0000 (Fri, 12 Oct 2018) | 1 line

 Adapt ppudump to fix introduced in revision 39912
------------------------------------------------------------------------
--- Recording mergeinfo for merge of r39914 into '.':
 G   .
------------------------------------------------------------------------
r39924 | pierre | 2018-10-13 11:35:34 +0000 (Sat, 13 Oct 2018) | 1 line

 Downgrade some warnings to notes for EXTDEBUG
------------------------------------------------------------------------
--- Merging r39924 into '.':
U    compiler/pass_2.pas
U    compiler/tgobj.pas
--- Recording mergeinfo for merge of r39924 into '.':
 G   .
------------------------------------------------------------------------
r39935 | pierre | 2018-10-14 22:18:50 +0000 (Sun, 14 Oct 2018) | 1 line

 Add missing setting of expectloc for multiplications
------------------------------------------------------------------------
--- Merging r39935 into '.':
U    compiler/nadd.pas
--- Recording mergeinfo for merge of r39935 into '.':
 G   .
------------------------------------------------------------------------
r39999 | pierre | 2018-10-20 18:44:05 +0000 (Sat, 20 Oct 2018) | 1 line

 Avoid run time error if compiled with -CR option
------------------------------------------------------------------------
--- Merging r39999 into '.':
U    compiler/m68k/cpupara.pas
--- Recording mergeinfo for merge of r39999 into '.':
 G   .
------------------------------------------------------------------------
r40000 | pierre | 2018-10-20 18:49:53 +0000 (Sat, 20 Oct 2018) | 1 line

Avoid range check error when compiled with -CR
------------------------------------------------------------------------
--- Merging r40000 into '.':
U    compiler/m68k/cgcpu.pas
--- Recording mergeinfo for merge of r40000 into '.':
 G   .
------------------------------------------------------------------------
r40001 | pierre | 2018-10-20 22:19:08 +0000 (Sat, 20 Oct 2018) | 1 line

 Add explicit typecast to avoid range check error
------------------------------------------------------------------------
--- Recording mergeinfo for merge of r40001 into '.':
 G   .
------------------------------------------------------------------------
r40026 | pierre | 2018-10-24 21:37:22 +0000 (Wed, 24 Oct 2018) | 1 line

 Explicitly disable range checking
------------------------------------------------------------------------
--- Merging r40026 into '.':
U    compiler/x86/cgx86.pas
--- Recording mergeinfo for merge of r40026 into '.':
 G   .
------------------------------------------------------------------------
r40115 | pierre | 2018-10-31 22:53:11 +0000 (Wed, 31 Oct 2018) | 1 line

 Avoid range check error in ReadPosInfo
------------------------------------------------------------------------
--- Recording mergeinfo for merge of r40115 into '.':
 G   .
------------------------------------------------------------------------
r40132 | pierre | 2018-11-01 07:09:47 +0000 (Thu, 01 Nov 2018) | 1 line

 Only call moved if len>0, as otherwise astring local variable is nil, which leads to a range check error for astring[1]
------------------------------------------------------------------------
--- Recording mergeinfo for merge of r40132 into '.':
 G   .
------------------------------------------------------------------------
r40163 | pierre | 2018-11-01 21:58:54 +0000 (Thu, 01 Nov 2018) | 8 lines

  More -CriotR fixes:
  * entfile.pas: Change PPU header falgs filed from longint to dword.
  * ngtcon.pas: Change local variable startoffset type to aword.
  * omfbase.pas: Avoid calling move with a nil string s indexed as s[1],
    to avoid a range check error.
  * owomflib.pas: Disable range check explicitly in hash computation.
  * utils/ppuutils/ppudump.pp: Adapt to flags type change in entfile.pas

------------------------------------------------------------------------
--- Recording mergeinfo for merge of r40163 into '.':
 G   .

git-svn-id: branches/fixes_3_2@40616 -
This commit is contained in:
pierre 2018-12-22 22:19:05 +00:00
parent 20799193a7
commit 1fafc17016
10 changed files with 48 additions and 15 deletions

View File

@ -2549,7 +2549,7 @@ unit cgcpu;
cg.a_load_const_reg(list,OS_S32,longint(highvalue),hreg); cg.a_load_const_reg(list,OS_S32,longint(highvalue),hreg);
{ don't use cg.a_op_const_reg() here, because a possible optimized { don't use cg.a_op_const_reg() here, because a possible optimized
ADDQ/SUBQ wouldn't set the eXtend bit } ADDQ/SUBQ wouldn't set the eXtend bit }
list.concat(taicpu.op_const_reg(opcode,S_L,lowvalue,regdst.reglo)); list.concat(taicpu.op_const_reg(opcode,S_L,longint(lowvalue),regdst.reglo));
list.concat(taicpu.op_reg_reg(xopcode,S_L,hreg,regdst.reghi)); list.concat(taicpu.op_reg_reg(xopcode,S_L,hreg,regdst.reghi));
end; end;
OP_AND,OP_OR,OP_XOR: OP_AND,OP_OR,OP_XOR:

View File

@ -268,7 +268,7 @@ unit cpupara;
We also have to figure out a better switch for this, because this is We also have to figure out a better switch for this, because this is
now compiler and platform specific... (KB) } now compiler and platform specific... (KB) }
if (tprocdef(p).proccalloption in [pocall_syscall,pocall_cdecl,pocall_cppdecl]) and if (tabstractprocdef(p).proccalloption in [pocall_syscall,pocall_cdecl,pocall_cppdecl]) and
(target_info.system in [system_m68k_palmos,system_m68k_linux]) and (target_info.system in [system_m68k_palmos,system_m68k_linux]) and
assigned(result.def) and assigned(result.def) and
(result.def.typ in [stringdef,pointerdef,classrefdef,objectdef, (result.def.typ in [stringdef,pointerdef,classrefdef,objectdef,
@ -408,9 +408,9 @@ unit cpupara;
return a struct by address. we will probably need some kind of a return a struct by address. we will probably need some kind of a
switch to support these various ABIs when generating cdecl calls (KB) } switch to support these various ABIs when generating cdecl calls (KB) }
if ((vo_is_funcret in hp.varoptions) and if ((vo_is_funcret in hp.varoptions) and
(tprocdef(p).proccalloption in [pocall_cdecl,pocall_cppdecl]) and (tabstractprocdef(p).proccalloption in [pocall_cdecl,pocall_cppdecl]) and
(target_info.system in [system_m68k_linux]) and (target_info.system in [system_m68k_linux]) and
(tprocdef(p).returndef.typ = recorddef)) then (tabstractprocdef(p).returndef.typ = recorddef)) then
begin begin
paraloc^.loc:=LOC_REGISTER; paraloc^.loc:=LOC_REGISTER;
paraloc^.register:=NR_M68K_STRUCT_RESULT_REG; paraloc^.register:=NR_M68K_STRUCT_RESULT_REG;

View File

@ -3604,6 +3604,7 @@ implementation
begin begin
{ if the code generator can handle 32 to 64-bit muls, { if the code generator can handle 32 to 64-bit muls,
we're done here } we're done here }
expectloc:=LOC_REGISTER;
end end
{$ifndef cpu64bitalu} {$ifndef cpu64bitalu}
{ is there a 64 bit type ? } { is there a 64 bit type ? }

View File

@ -4091,7 +4091,10 @@ begin
{ Set FPU type } { Set FPU type }
if not(option.FPUSetExplicitly) then if not(option.FPUSetExplicitly) then
begin begin
init_settings.fputype:=fpu_vfpv3_d16 if init_settings.cputype < cpu_armv7 then
init_settings.fputype:=fpu_vfpv2
else
init_settings.fputype:=fpu_vfpv3_d16;
end end
else else
begin begin

View File

@ -210,7 +210,14 @@ implementation
if (not codegenerror) then if (not codegenerror) then
begin begin
if (p.location.loc<>p.expectloc) then if (p.location.loc<>p.expectloc) then
begin
if ((p.location.loc=loc_register) and (p.expectloc=loc_cregister))
or ((p.location.loc=loc_fpuregister) and (p.expectloc=loc_cfpuregister))
or ((p.location.loc=loc_reference) and (p.expectloc=loc_creference)) then
Comment(V_Note,'Location ('+tcgloc2str[p.location.loc]+') not equal to expectloc ('+tcgloc2str[p.expectloc]+'): '+nodetype2str[p.nodetype])
else
Comment(V_Warning,'Location ('+tcgloc2str[p.location.loc]+') not equal to expectloc ('+tcgloc2str[p.expectloc]+'): '+nodetype2str[p.nodetype]); Comment(V_Warning,'Location ('+tcgloc2str[p.location.loc]+') not equal to expectloc ('+tcgloc2str[p.expectloc]+'): '+nodetype2str[p.nodetype]);
end;
if (p.location.loc=LOC_INVALID) then if (p.location.loc=LOC_INVALID) then
Comment(V_Warning,'Location not set in secondpass: '+nodetype2str[p.nodetype]); Comment(V_Warning,'Location not set in secondpass: '+nodetype2str[p.nodetype]);
end; end;

View File

@ -94,6 +94,7 @@ implementation
resultreg : tregister; resultreg : tregister;
overflowlabel : tasmlabel; overflowlabel : tasmlabel;
ai : taicpu; ai : taicpu;
no_overflow : boolean;
begin begin
secondpass(left); secondpass(left);
secondpass(right); secondpass(right);
@ -140,18 +141,30 @@ implementation
op := divops[true, is_signed(right.resultdef), op := divops[true, is_signed(right.resultdef),
cs_check_overflow in current_settings.localswitches]; cs_check_overflow in current_settings.localswitches];
if op=A_NOP then
{ current_asmdata.CurrAsmList.concat(tai_comment.create(strpnew('Wrong code generated here'))); }
begin
no_overflow:=true;
op:=divops[true,is_signed(right.resultdef),false];
end
else
no_overflow:=false;
if (divider<>NR_NO) then if (divider<>NR_NO) then
current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(op,numerator,divider,resultreg)) current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(op,numerator,divider,resultreg))
else else
current_asmdata.CurrAsmList.concat(taicpu.op_reg_const_reg(op,numerator,right.location.value,resultreg)); current_asmdata.CurrAsmList.concat(taicpu.op_reg_const_reg(op,numerator,right.location.value,resultreg));
if (nodetype = modn) then if (nodetype = modn) then
begin
if not no_overflow then
begin begin
current_asmdata.getjumplabel(overflowlabel); current_asmdata.getjumplabel(overflowlabel);
ai:=taicpu.op_cond_sym(A_Bxx,C_VS,overflowlabel); ai:=taicpu.op_cond_sym(A_Bxx,C_VS,overflowlabel);
ai.delayslot_annulled:=true; ai.delayslot_annulled:=true;
current_asmdata.CurrAsmList.concat(ai); current_asmdata.CurrAsmList.concat(ai);
end;
current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_NOT,resultreg)); current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_NOT,resultreg));
if not no_overflow then
cg.a_label(current_asmdata.CurrAsmList,overflowlabel); cg.a_label(current_asmdata.CurrAsmList,overflowlabel);
if (divider<>NR_NO) then if (divider<>NR_NO) then
current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_MULX,resultreg,divider,resultreg)) current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_MULX,resultreg,divider,resultreg))

View File

@ -4561,7 +4561,6 @@ implementation
end end
else else
begin begin
ppuload_platform(ppufile);
symtable:=trecordsymtable.create(objrealname^,0,0,0); symtable:=trecordsymtable.create(objrealname^,0,0,0);
trecordsymtable(symtable).fieldalignment:=shortint(ppufile.getbyte); trecordsymtable(symtable).fieldalignment:=shortint(ppufile.getbyte);
trecordsymtable(symtable).recordalignment:=shortint(ppufile.getbyte); trecordsymtable(symtable).recordalignment:=shortint(ppufile.getbyte);
@ -4571,6 +4570,9 @@ implementation
trecordsymtable(symtable).datasize:=ppufile.getasizeint; trecordsymtable(symtable).datasize:=ppufile.getasizeint;
trecordsymtable(symtable).paddingsize:=ppufile.getword; trecordsymtable(symtable).paddingsize:=ppufile.getword;
ppufile.getsmallset(trecordsymtable(symtable).managementoperators); ppufile.getsmallset(trecordsymtable(symtable).managementoperators);
{ position of ppuload_platform call must correspond
to position of writeentry in ppuwrite method }
ppuload_platform(ppufile);
trecordsymtable(symtable).ppuload(ppufile); trecordsymtable(symtable).ppuload(ppufile);
{ the variantrecdesc is needed only for iso-like new statements new(prec,1,2,3 ...); { the variantrecdesc is needed only for iso-like new statements new(prec,1,2,3 ...);
but because iso mode supports no units, there is no need to store the variantrecdesc but because iso mode supports no units, there is no need to store the variantrecdesc

View File

@ -488,6 +488,9 @@ implementation
if not(hp^.temptype in temptypes) then if not(hp^.temptype in temptypes) then
begin begin
{$ifdef EXTDEBUG} {$ifdef EXTDEBUG}
if hp^.temptype = tt_persistent then
Comment(V_Note,'tgobj: (Freetemp) temp at pos '+tostr(pos.val)+ ' has different type ('+TempTypeStr[hp^.temptype]+'), not releasing')
else
Comment(V_Warning,'tgobj: (Freetemp) temp at pos '+tostr(pos.val)+ ' has different type ('+TempTypeStr[hp^.temptype]+'), not releasing'); Comment(V_Warning,'tgobj: (Freetemp) temp at pos '+tostr(pos.val)+ ' has different type ('+TempTypeStr[hp^.temptype]+'), not releasing');
list.concat(tai_tempalloc.allocinfo(hp^.pos,hp^.size,'temp has wrong type ('+TempTypeStr[hp^.temptype]+') not releasing')); list.concat(tai_tempalloc.allocinfo(hp^.pos,hp^.size,'temp has wrong type ('+TempTypeStr[hp^.temptype]+') not releasing'));
{$endif} {$endif}

View File

@ -376,6 +376,10 @@ unit cgx86;
end; end;
{ Range check must be disabled explicitly as the code serves
on three different architecture sizes }
{$R-}
{**************************************************************************** {****************************************************************************
This is private property, keep out! :) This is private property, keep out! :)
****************************************************************************} ****************************************************************************}

View File

@ -6,7 +6,7 @@
main=ide main=ide
[require] [require]
packages=rtl-extra packages=rtl rtl-extra
[target] [target]
units=compunit units=compunit
@ -20,7 +20,7 @@ includedir=$(COMPILERDIR) $(COMPILERDIR)/$(PPC_TARGET)
fpcpackage=y fpcpackage=y
[default] [default]
fpcdir=../.. fpcdir=../../..
[prerules] [prerules]
COMPILERDIR=$(FPCDIR)/compiler COMPILERDIR=$(FPCDIR)/compiler