Просмотр исходного кода

* fixed evaluating "nil +/- int_const" expressions (mantis #13815)

git-svn-id: trunk@13194 -
Jonas Maebe 16 лет назад
Родитель
Сommit
17a7903e60
3 измененных файлов с 9 добавлено и 1 удалено
  1. 1 0
      .gitattributes
  2. 1 1
      compiler/nadd.pas
  3. 7 0
      tests/webtbs/tw13815.pp

+ 1 - 0
.gitattributes

@@ -8872,6 +8872,7 @@ tests/webtbs/tw1374.pp svneol=native#text/plain
 tests/webtbs/tw1375.pp svneol=native#text/plain
 tests/webtbs/tw1376.pp svneol=native#text/plain
 tests/webtbs/tw13763.pp svneol=native#text/plain
+tests/webtbs/tw13815.pp svneol=native#text/plain
 tests/webtbs/tw1398.pp svneol=native#text/plain
 tests/webtbs/tw1401.pp svneol=native#text/plain
 tests/webtbs/tw1407.pp svneol=native#text/plain

+ 1 - 1
compiler/nadd.pas

@@ -228,7 +228,7 @@ implementation
              allowenumop(nodetype))
             ) or
             (
-             (lt = pointerconstn) and
+             (lt in [pointerconstn,niln]) and
              is_constintnode(right) and
              (nodetype in [addn,subn])
             ) or

+ 7 - 0
tests/webtbs/tw13815.pp

@@ -0,0 +1,7 @@
+var
+  p: pointer;
+begin
+  p:=nil+1;
+  if (p<>pointer(1)) then
+    halt(1);
+end.