Browse Source

* allow absolutes on open arrays (use of this is doubtful though), resolves #41147

florian 5 months ago
parent
commit
29b3b09251
3 changed files with 17 additions and 1 deletions
  1. 1 0
      compiler/ncnv.pas
  2. 1 1
      compiler/x86/aoptx86.pas
  3. 15 0
      tests/webtbs/tw41147.pp

+ 1 - 0
compiler/ncnv.pas

@@ -4667,6 +4667,7 @@ implementation
         if result and
         if result and
            { don't try to check the size of an open array }
            { don't try to check the size of an open array }
            (is_open_array(resultdef) or
            (is_open_array(resultdef) or
+            is_open_array(left.resultdef) or
             (resultdef.size<left.resultdef.size) or
             (resultdef.size<left.resultdef.size) or
             ((resultdef.size=left.resultdef.size) and
             ((resultdef.size=left.resultdef.size) and
              (left.resultdef.size<sizeof(aint)) and
              (left.resultdef.size<sizeof(aint)) and

+ 1 - 1
compiler/x86/aoptx86.pas

@@ -23,7 +23,7 @@ unit aoptx86;
 
 
 {$i fpcdefs.inc}
 {$i fpcdefs.inc}
 
 
-{$define DEBUG_AOPTCPU}
+{ $define DEBUG_AOPTCPU}
 
 
 {$ifdef EXTDEBUG}
 {$ifdef EXTDEBUG}
 {$define DEBUG_AOPTCPU}
 {$define DEBUG_AOPTCPU}

+ 15 - 0
tests/webtbs/tw41147.pp

@@ -0,0 +1,15 @@
+{ %norun }
+{ the code makes no sense, but it should compile }
+{$MODE OBJFPC}
+{$MODESWITCH ADVANCEDRECORDS+}
+program test;
+
+procedure Resolve(out Unsigned: array of QWord);
+var
+   Signed: array of Int64 absolute Unsigned;
+begin
+   SetLength(Signed, 0);
+end;
+
+begin
+end.