mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-06 15:47:52 +02:00
+ handle LOC_FLAGS in thlcgobj.location_force_mem, resolves #39292
This commit is contained in:
parent
a08ac618a4
commit
5afd809e88
@ -4267,6 +4267,7 @@ implementation
|
||||
var
|
||||
r : treference;
|
||||
forcesize: aint;
|
||||
hregister: TRegister;
|
||||
begin
|
||||
case l.loc of
|
||||
LOC_FPUREGISTER,
|
||||
@ -4288,6 +4289,18 @@ implementation
|
||||
location_reset_ref(l,LOC_REFERENCE,l.size,size.alignment,[]);
|
||||
l.reference:=r;
|
||||
end;
|
||||
{$ifdef cpuflags}
|
||||
LOC_FLAGS :
|
||||
begin
|
||||
hregister:=getregisterfordef(list,size);
|
||||
g_flags2reg(list,size,l.resflags,hregister);
|
||||
cg.a_reg_dealloc(list,NR_DEFAULTFLAGS);
|
||||
tg.gethltemp(list,size,size.size,tt_normal,r);
|
||||
a_load_reg_ref(list,size,size,hregister,r);
|
||||
location_reset_ref(l,LOC_REFERENCE,l.size,size.alignment,[]);
|
||||
l.reference:=r;
|
||||
end;
|
||||
{$endif cpuflags}
|
||||
LOC_CONSTANT,
|
||||
LOC_REGISTER,
|
||||
LOC_CREGISTER,
|
||||
|
19
tests/webtbs/tw39292.pp
Normal file
19
tests/webtbs/tw39292.pp
Normal file
@ -0,0 +1,19 @@
|
||||
{$mode objfpc} {$modeswitch typehelpers}
|
||||
type
|
||||
BoolHelper = type helper for boolean
|
||||
function ToChar: char;
|
||||
end;
|
||||
|
||||
function BoolHelper.ToChar: char;
|
||||
begin
|
||||
result := pChar('-+')[ord(self)];
|
||||
end;
|
||||
|
||||
var
|
||||
x: uint32;
|
||||
|
||||
begin
|
||||
writeln((@x = @x).ToChar);
|
||||
if (@x = @x).ToChar<>'+' then
|
||||
halt(1);
|
||||
end.
|
Loading…
Reference in New Issue
Block a user