* disable regular array -> dynamic array type coversion support unless

{$modeswitch arraytodynarray} is active (mantis #35576)
   o changed compiler to compile without this modeswitch
   o added the modeswitch to a test that depends on it

git-svn-id: trunk@42118 -
This commit is contained in:
Jonas Maebe 2019-05-25 12:31:32 +00:00
parent c752aa5cf5
commit 77658b925b
14 changed files with 29 additions and 25 deletions

View File

@ -92,7 +92,7 @@ unit cpupara;
function tcpuparamanager.get_saved_registers_int(calloption: tproccalloption): tcpuregisterarray;
const
saved_regs : array[0..9] of tsuperregister =
saved_regs : {$ifndef VER3_0}tcpuregisterarray{$else}array[0..9] of tsuperregister{$endif} =
(RS_X19,RS_X20,RS_X21,RS_X22,RS_X23,RS_X24,RS_X25,RS_X26,RS_X27,RS_X28);
begin
result:=saved_regs;
@ -101,7 +101,8 @@ unit cpupara;
function tcpuparamanager.get_saved_registers_mm(calloption: tproccalloption): tcpuregisterarray;
const
saved_mm_regs : array[0..7] of tsuperregister = (RS_D8,RS_D9,RS_D10,RS_D11,RS_D12,RS_D13,RS_D14,RS_D15);
saved_mm_regs : {$ifndef VER3_0}tcpuregisterarray{$else}array[0..7] of tsuperregister{$endif} =
(RS_D8,RS_D9,RS_D10,RS_D11,RS_D12,RS_D13,RS_D14,RS_D15);
begin
result:=saved_mm_regs;
end;

View File

@ -87,7 +87,7 @@ unit cpupara;
function tcpuparamanager.get_saved_registers_int(calloption : tproccalloption):tcpuregisterarray;
const
saved_regs : array[0..6] of tsuperregister =
saved_regs : {$ifndef VER3_0}tcpuregisterarray{$else}array[0..6] of tsuperregister{$endif} =
(RS_R4,RS_R5,RS_R6,RS_R7,RS_R8,RS_R9,RS_R10);
begin
result:=saved_regs;

View File

@ -1037,8 +1037,8 @@ implementation
{ dynamic array -> dynamic array }
if is_dynamic_array(def_from) then
eq:=te_equal
{ fpc modes only: array -> dyn. array }
else if (current_settings.modeswitches*[m_objfpc,m_fpc]<>[]) and
{ regular array -> dynamic array }
else if (m_array2dynarray in current_settings.modeswitches) and
not(is_special_array(def_from)) and
is_zero_based_array(def_from) then
begin

View File

@ -483,7 +483,8 @@ interface
m_isolike_program_para, { program parameters as it required by an ISO compatible compiler }
m_isolike_mod, { mod operation as it is required by an iso compatible compiler }
m_array_operators, { use Delphi compatible array operators instead of custom ones ("+") }
m_multi_helpers { helpers can appear in multiple scopes simultaneously }
m_multi_helpers, { helpers can appear in multiple scopes simultaneously }
m_array2dynarray { regular arrays can be implicitly converted to dynamic arrays }
);
tmodeswitches = set of tmodeswitch;
@ -673,7 +674,8 @@ interface
'ISOPROGRAMPARAS',
'ISOMOD',
'ARRAYOPERATORS',
'MULTIHELPERS'
'MULTIHELPERS',
'ARRAYTODYNARRAY'
);

View File

@ -299,8 +299,8 @@ unit cpupara;
function tcpuparamanager.get_saved_registers_int(calloption : tproccalloption):tcpuregisterarray;
const
saveregs : array[0..3] of tsuperregister = (RS_EBX,RS_ESI,RS_EDI,RS_EBP);
saveregs_oldfpccall : array[0..0] of tsuperregister = (RS_EBP);
saveregs : {$ifndef VER3_0}tcpuregisterarray{$else}array[0..3] of tsuperregister{$endif} = (RS_EBX,RS_ESI,RS_EDI,RS_EBP);
saveregs_oldfpccall : {$ifndef VER3_0}tcpuregisterarray{$else}array[0..0] of tsuperregister{$endif} = (RS_EBP);
begin
case calloption of
pocall_internproc,

View File

@ -237,8 +237,8 @@ unit cpupara;
function tcpuparamanager.get_saved_registers_int(calloption : tproccalloption):tcpuregisterarray;
const
saveregs_cdecl: array [0..2] of tsuperregister = (RS_BP,RS_SI,RS_DI);
saveregs_pascal: array [0..0] of tsuperregister = (RS_BP);
saveregs_cdecl: {$ifndef VER3_0}tcpuregisterarray{$else}array [0..2] of tsuperregister{$endif} = (RS_BP,RS_SI,RS_DI);
saveregs_pascal: {$ifndef VER3_0}tcpuregisterarray{$else}array [0..0] of tsuperregister{$endif} = (RS_BP);
begin
case calloption of
pocall_register,

View File

@ -74,7 +74,7 @@ implementation
function tcpuparamanager.get_saved_registers_int(calloption: tproccalloption): tcpuregisterarray;
const
{ dummy, not used for JVM }
saved_regs: array [0..0] of tsuperregister = (RS_NO);
saved_regs: {$ifndef VER3_0}tcpuregisterarray{$else}array [0..0] of tsuperregister{$endif} = (RS_NO);
begin
result:=saved_regs;
end;

View File

@ -104,21 +104,21 @@ unit cpupara;
function tcpuparamanager.get_saved_registers_int(calloption:tproccalloption):tcpuregisterarray;
const
saved_regs: array[0..5] of tsuperregister = (RS_D2,RS_D3,RS_D4,RS_D5,RS_D6,RS_D7);
saved_regs: {$ifndef VER3_0}tcpuregisterarray{$else}array[0..5] of tsuperregister{$endif} = (RS_D2,RS_D3,RS_D4,RS_D5,RS_D6,RS_D7);
begin
result:=saved_regs;
end;
function tcpuparamanager.get_saved_registers_address(calloption:tproccalloption):tcpuregisterarray;
const
saved_addr_regs: array[0..4] of tsuperregister = (RS_A2,RS_A3,RS_A4,RS_A5,RS_A6);
saved_addr_regs: {$ifndef VER3_0}tcpuregisterarray{$else}array[0..4] of tsuperregister{$endif} = (RS_A2,RS_A3,RS_A4,RS_A5,RS_A6);
begin
result:=saved_addr_regs;
end;
function tcpuparamanager.get_saved_registers_fpu(calloption:tproccalloption):tcpuregisterarray;
const
saved_fpu_regs: array[0..5] of tsuperregister = (RS_FP2,RS_FP3,RS_FP4,RS_FP5,RS_FP6,RS_FP7);
saved_fpu_regs: {$ifndef VER3_0}tcpuregisterarray{$else}array[0..5] of tsuperregister{$endif} = (RS_FP2,RS_FP3,RS_FP4,RS_FP5,RS_FP6,RS_FP7);
begin
result:=saved_fpu_regs;
end;

View File

@ -109,7 +109,7 @@ implementation
function tcpuparamanager.get_saved_registers_int(calloption : tproccalloption):TCpuRegisterArray;
const
saved_regs : array[0..0] of tsuperregister =
saved_regs : {$ifndef VER3_0}tcpuregisterarray{$else}array[0..0] of tsuperregister{$endif} =
(RS_NO);
begin
result:=saved_regs;

View File

@ -315,7 +315,7 @@ implementation
function tparamanager.get_saved_registers_int(calloption : tproccalloption):tcpuregisterarray;
const
inv: array [0..0] of tsuperregister = (RS_INVALID);
inv: {$ifndef VER3_0}tcpuregisterarray{$else}array [0..0] of tsuperregister{$endif} = (RS_INVALID);
begin
result:=inv;
end;
@ -323,7 +323,7 @@ implementation
function tparamanager.get_saved_registers_address(calloption : tproccalloption):tcpuregisterarray;
const
inv: array [0..0] of tsuperregister = (RS_INVALID);
inv: {$ifndef VER3_0}tcpuregisterarray{$else}array [0..0] of tsuperregister{$endif} = (RS_INVALID);
begin
result:=inv;
end;
@ -331,7 +331,7 @@ implementation
function tparamanager.get_saved_registers_fpu(calloption : tproccalloption):tcpuregisterarray;
const
inv: array [0..0] of tsuperregister = (RS_INVALID);
inv: {$ifndef VER3_0}tcpuregisterarray{$else}array [0..0] of tsuperregister{$endif} = (RS_INVALID);
begin
result:=inv;
end;
@ -339,7 +339,7 @@ implementation
function tparamanager.get_saved_registers_mm(calloption : tproccalloption):tcpuregisterarray;
const
inv: array [0..0] of tsuperregister = (RS_INVALID);
inv: {$ifndef VER3_0}tcpuregisterarray{$else}array [0..0] of tsuperregister{$endif} = (RS_INVALID);
begin
result:=inv;
end;

View File

@ -81,7 +81,7 @@ unit cpupara;
function tcpuparamanager.get_saved_registers_int(calloption : tproccalloption):tcpuregisterarray;
const
saved_regs : array[0..18] of tsuperregister = (
saved_regs : {$ifndef VER3_0}tcpuregisterarray{$else}array[0..18] of tsuperregister{$endif} = (
RS_R13,RS_R14,RS_R15,RS_R16,RS_R17,RS_R18,RS_R19,
RS_R20,RS_R21,RS_R22,RS_R23,RS_R24,RS_R25,RS_R26,RS_R27,RS_R28,RS_R29,
RS_R30,RS_R31

View File

@ -83,7 +83,7 @@ end;
function tcpuparamanager.get_saved_registers_int(calloption: tproccalloption):
tcpuregisterarray;
const
saved_regs: array[0..17] of tsuperregister = (
saved_regs: {$ifndef VER3_0}tcpuregisterarray{$else}array[0..17] of tsuperregister{$endif} = (
RS_R14, RS_R15, RS_R16, RS_R17, RS_R18, RS_R19,
RS_R20, RS_R21, RS_R22, RS_R23, RS_R24, RS_R25,
RS_R26, RS_R27, RS_R28, RS_R29, RS_R30, RS_R31

View File

@ -1372,8 +1372,8 @@ unit cpupara;
function tcpuparamanager.get_saved_registers_int(calloption : tproccalloption):tcpuregisterarray;
const
win64_saved_std_regs : array[0..7] of tsuperregister = (RS_RBX,RS_RDI,RS_RSI,RS_R12,RS_R13,RS_R14,RS_R15,RS_RBP);
others_saved_std_regs : array[0..4] of tsuperregister = (RS_RBX,RS_R12,RS_R13,RS_R14,RS_R15);
win64_saved_std_regs : {$ifndef VER3_0}tcpuregisterarray{$else}array[0..7] of tsuperregister{$endif} = (RS_RBX,RS_RDI,RS_RSI,RS_R12,RS_R13,RS_R14,RS_R15,RS_RBP);
others_saved_std_regs : {$ifndef VER3_0}tcpuregisterarray{$else}array[0..4] of tsuperregister{$endif} = (RS_RBX,RS_R12,RS_R13,RS_R14,RS_R15);
begin
if tcgx86_64(cg).use_ms_abi then
result:=win64_saved_std_regs
@ -1384,7 +1384,7 @@ unit cpupara;
function tcpuparamanager.get_saved_registers_mm(calloption: tproccalloption):tcpuregisterarray;
const
win64_saved_xmm_regs : array[0..9] of tsuperregister = (RS_XMM6,RS_XMM7,
win64_saved_xmm_regs : {$ifndef VER3_0}tcpuregisterarray{$else}array[0..9] of tsuperregister{$endif} = (RS_XMM6,RS_XMM7,
RS_XMM8,RS_XMM9,RS_XMM10,RS_XMM11,RS_XMM12,RS_XMM13,RS_XMM14,RS_XMM15);
begin
if tcgx86_64(cg).use_ms_abi then

View File

@ -1,4 +1,5 @@
{$mode objfpc}
{$modeswitch arraytodynarray}
type
ta1 = array[0..10] of longint;
var