瀏覽代碼

* 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: trunk@20959 -

Jonas Maebe 13 年之前
父節點
當前提交
5f3db3c1ba
共有 1 個文件被更改,包括 11 次插入0 次删除
  1. 11 0
      compiler/htypechk.pas

+ 11 - 0
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