diff options
author | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2012-04-21 18:38:31 +0000 |
---|---|---|
committer | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2012-04-21 18:38:31 +0000 |
commit | 186a9d3c976e609883ab40ce24e2ba4e8d15825f (patch) | |
tree | ad60866e40809139f25f7c49514905bcc352536e /compiler/htypechk.pas | |
parent | a51ab241701c3dd87f8cf7b705d262a93e054c35 (diff) | |
download | fpc-186a9d3c976e609883ab40ce24e2ba4e8d15825f.tar.gz |
* if we assign something to a record field whose type is not regable by
itself (e.g. a 3-byte record as field insde a 4 byte record), make
the parent record non-regable either. The reason is that the parent
record will be forced to memory in that case when subscripting, and
the assignment will happen to this temporary memory location.
Fixes tests/test/tw15357.pp on ppc64 when compiled with -O2 and
without -Cg (not sure why enabling PIC disables global regvars)
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@20959 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/htypechk.pas')
-rw-r--r-- | compiler/htypechk.pas | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler/htypechk.pas b/compiler/htypechk.pas index ac18751339..a909abfdcf 100644 --- a/compiler/htypechk.pas +++ b/compiler/htypechk.pas @@ -1328,6 +1328,17 @@ implementation CGMessagePos(hp.fileinfo,parser_e_packed_element_no_var_addr); exit; end; + { if we assign something to a field of a record that is not + regable, then then the record can't be kept in a regvar, + because we will force the record into memory for this + subscript operation (to a temp location, so the assignment + will happen to the temp and be lost) } + if not gotsubscript and + not gotderef and + not gotvec and + not tstoreddef(hp.resultdef).is_intregable then + make_not_regable(hp,[ra_addr_regable]); + gotsubscript:=true; { loop counter? } if not(Valid_Const in opts) and |