浏览代码

* do not crash with an internal error if an indexed access is done on a constant pointer node

git-svn-id: trunk@27789 -
florian 11 年之前
父节点
当前提交
417d444376
共有 3 个文件被更改,包括 15 次插入0 次删除
  1. 1 0
      .gitattributes
  2. 4 0
      compiler/ncgmem.pas
  3. 10 0
      tests/webtbs/tw26162.pp

+ 1 - 0
.gitattributes

@@ -13927,6 +13927,7 @@ tests/webtbs/tw25956.pp svneol=native#text/pascal
 tests/webtbs/tw25959.pp svneol=native#text/pascal
 tests/webtbs/tw25959.pp svneol=native#text/pascal
 tests/webtbs/tw2602.pp svneol=native#text/plain
 tests/webtbs/tw2602.pp svneol=native#text/plain
 tests/webtbs/tw2607.pp svneol=native#text/plain
 tests/webtbs/tw2607.pp svneol=native#text/plain
+tests/webtbs/tw26162.pp svneol=native#text/pascal
 tests/webtbs/tw2620.pp svneol=native#text/plain
 tests/webtbs/tw2620.pp svneol=native#text/plain
 tests/webtbs/tw2626.pp svneol=native#text/plain
 tests/webtbs/tw2626.pp svneol=native#text/plain
 tests/webtbs/tw2627.pp svneol=native#text/plain
 tests/webtbs/tw2627.pp svneol=native#text/plain

+ 4 - 0
compiler/ncgmem.pas

@@ -894,6 +894,10 @@ implementation
                     hlcg.reference_reset_base(location.reference,left.resultdef,hlcg.getaddressregister(current_asmdata.CurrAsmList,left.resultdef),0,location.reference.alignment);
                     hlcg.reference_reset_base(location.reference,left.resultdef,hlcg.getaddressregister(current_asmdata.CurrAsmList,left.resultdef),0,location.reference.alignment);
                     hlcg.a_load_ref_reg(current_asmdata.CurrAsmList,left.resultdef,left.resultdef,left.location.reference,location.reference.base);
                     hlcg.a_load_ref_reg(current_asmdata.CurrAsmList,left.resultdef,left.resultdef,left.location.reference,location.reference.base);
                   end;
                   end;
+                LOC_CONSTANT:
+                  begin
+                    hlcg.reference_reset_base(location.reference,left.resultdef,NR_NO,left.location.value,location.reference.alignment);
+                  end;
                 else
                 else
                   internalerror(2002032218);
                   internalerror(2002032218);
               end;
               end;

+ 10 - 0
tests/webtbs/tw26162.pp

@@ -0,0 +1,10 @@
+{ %norun }
+{$inline on}
+procedure p(const s : ansistring);inline;
+begin
+  writeln(s[1]);
+end;
+
+begin
+  p('');
+end.