Răsfoiți Sursa

* simplify constant expressions after re-ordering, resolves #37062

git-svn-id: trunk@45360 -
florian 5 ani în urmă
părinte
comite
7a60e044e3
3 a modificat fișierele cu 14 adăugiri și 0 ștergeri
  1. 1 0
      .gitattributes
  2. 2 0
      compiler/nadd.pas
  3. 11 0
      tests/webtbs/tw37062.pp

+ 1 - 0
.gitattributes

@@ -18285,6 +18285,7 @@ tests/webtbs/tw3695.pp svneol=native#text/plain
 tests/webtbs/tw3697.pp svneol=native#text/plain
 tests/webtbs/tw3700.pp svneol=native#text/plain
 tests/webtbs/tw37013.pp svneol=native#text/plain
+tests/webtbs/tw37062.pp svneol=native#text/pascal
 tests/webtbs/tw3708.pp svneol=native#text/plain
 tests/webtbs/tw3719.pp svneol=native#text/plain
 tests/webtbs/tw3721.pp svneol=native#text/plain

+ 2 - 0
compiler/nadd.pas

@@ -765,6 +765,7 @@ implementation
                           hp:=right;
                           right:=taddnode(left).right;
                           taddnode(left).right:=hp;
+                          left:=left.simplify(forinline);
                           if resultdef.typ<>pointerdef then
                             begin
                               { ensure that the constant is not expanded to a larger type due to overflow,
@@ -3238,6 +3239,7 @@ implementation
         end;
       end;
 
+
     function taddnode.first_adddynarray : tnode;
       var
         newstatement : tstatementnode;

+ 11 - 0
tests/webtbs/tw37062.pp

@@ -0,0 +1,11 @@
+program project1;
+
+{$mode objfpc}{$H+}
+
+Var
+  LOut : array of Byte;
+  LLength, LSSize : integer;
+begin
+  SetLength(LOut, 1+LLength+1+4+4+2+4+4+2+LSSize+2);
+end.
+