Browse Source

* don't crash when ranges are passed erroneously to an array of const, resolves #11632

git-svn-id: trunk@11353 -
florian 17 years ago
parent
commit
fffc05731c
3 changed files with 9 additions and 3 deletions
  1. 1 0
      .gitattributes
  2. 1 3
      compiler/nld.pas
  3. 7 0
      tests/webtbf/tw11632.pp

+ 1 - 0
.gitattributes

@@ -7937,6 +7937,7 @@ tests/webtbf/tw11254a.pp svneol=native#text/plain
 tests/webtbf/tw11295a.pp svneol=native#text/plain
 tests/webtbf/tw11295b.pp svneol=native#text/plain
 tests/webtbf/tw1157a.pp svneol=native#text/plain
+tests/webtbf/tw11632.pp svneol=native#text/plain
 tests/webtbf/tw1238.pp svneol=native#text/plain
 tests/webtbf/tw1251a.pp svneol=native#text/plain
 tests/webtbf/tw1270.pp svneol=native#text/plain

+ 1 - 3
compiler/nld.pas

@@ -798,10 +798,8 @@ implementation
 
     function tarrayconstructorrangenode.pass_1 : tnode;
       begin
-        firstpass(left);
-        firstpass(right);
-        expectloc:=LOC_CREFERENCE;
         result:=nil;
+        CGMessage(parser_e_illegal_expression);
       end;
 
 

+ 7 - 0
tests/webtbf/tw11632.pp

@@ -0,0 +1,7 @@
+{ %fail }
+{$mode objfpc}
+program crash1;
+procedure a(b: array of const); begin end;
+begin
+  a([0..1]);
+end.