diff --git a/.gitattributes b/.gitattributes index 210f39e1d2..7d1dfd31ce 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8821,6 +8821,7 @@ tests/webtbs/tw13345x.pp svneol=native#text/plain tests/webtbs/tw13456.pp svneol=native#text/plain tests/webtbs/tw1348.pp svneol=native#text/plain tests/webtbs/tw1351.pp svneol=native#text/plain +tests/webtbs/tw13536.pp svneol=native#text/plain tests/webtbs/tw1364.pp svneol=native#text/plain tests/webtbs/tw1365.pp svneol=native#text/plain tests/webtbs/tw1374.pp svneol=native#text/plain diff --git a/compiler/ncgcal.pas b/compiler/ncgcal.pas index e32e2b7af4..e21363a3a1 100644 --- a/compiler/ncgcal.pas +++ b/compiler/ncgcal.pas @@ -538,11 +538,22 @@ implementation {$ifdef x86} tcgx86(cg).inc_fpu_stack; {$else x86} - if getsupreg(procdefinition.funcretloc[callerside].register)LOC_REGISTER then + internalerror(2009042001); + { See #13536 comment above. } + if (cnf_return_value_used in callnodeflags) then + begin + tg.GetTemp(current_asmdata.CurrAsmList,16,8,tt_normal,ref); + location_reset_ref(location,LOC_REFERENCE,OS_NO,0); + location.reference:=ref; + if getsupreg(retloc.register)LOC_REGISTER then internalerror(200409141); - { the function result registers are already allocated } - if getsupreg(retloc.register64.reglo)OS_NO then - tmpcgsize:=def_cgsize(resultdef) + { but use def_size only if it returns something valid because in + case of odd sized structured results in registers def_cgsize(resultdef) + could return OS_NO } + if def_cgsize(resultdef)<>OS_NO then + tmpcgsize:=def_cgsize(resultdef) + else + tmpcgsize:=cgsize; + + location.register:=cg.getintregister(current_asmdata.CurrAsmList,tmpcgsize); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,cgsize,tmpcgsize,procdefinition.funcretloc[callerside].register,location.register); + end else - tmpcgsize:=cgsize; - - location.register:=cg.getintregister(current_asmdata.CurrAsmList,tmpcgsize); - cg.a_load_reg_reg(current_asmdata.CurrAsmList,cgsize,tmpcgsize,procdefinition.funcretloc[callerside].register,location.register); + location:=procdefinition.funcretloc[callerside]; end; {$ifdef arm} if (resultdef.typ=floatdef) and (current_settings.fputype in [fpu_fpa,fpu_fpa10,fpu_fpa11]) then @@ -618,11 +654,17 @@ implementation LOC_MMREGISTER: begin - location_reset(location,LOC_MMREGISTER,cgsize); - if getsupreg(procdefinition.funcretloc[callerside].register)0 do + begin + if not aFindNextFile (F.FindHandle,F.FindData) then + begin + Result:=GetLastError; + exit; + end; + end; + + { Convert some attributes back } + WinToDosTime(F.FindData.ftLastWriteTime,F.Time); + + f.size:=F.FindData.NFileSizeLow+(qword(maxdword)+1)*F.FindData.NFileSizeHigh; + f.attr:=F.FindData.dwFileAttributes; + f.Name:=StrPas(@F.FindData.cFileName[0]); + Result:=0; +end; + +var n : TMySearchRec; + +begin + // make sure it gets past the while loop. + n.finddata.dwfileattributes:=1; + n.excludeattr:=0; + + n.FindData.NFileSizeLow:=$10101; + n.FindData.NFileSizehigh:=$20202; + // attempt to avoid problems with strpas. + n.finddata.cfilename:='bla'#0; + aFindMatch(n); + + writeln(n.size); + writeln(inttohex(n.size,16)); + if (n.size<>$0002020200010101) then + halt(1); +end.