File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -460,10 +460,14 @@ package body Files_Table is
460
460
return ;
461
461
end if ;
462
462
463
- New_Lines :=
464
- new Source_Line_Array'
465
- (FI.Lines.Last_Index + 1 .. Line =>
466
- (State => (others => No_Code), others => <>));
463
+ -- Allocate the array first and then initialize it. Don't do it in one
464
+ -- single statement as this would create a big aggregate on the stack,
465
+ -- triggering a stack overflow when the number of line is too high.
466
+
467
+ New_Lines := new Source_Line_Array (FI.Lines.Last_Index + 1 .. Line);
468
+ for Line of New_Lines.all loop
469
+ Line := (State => (others => No_Code), others => <>);
470
+ end loop ;
467
471
468
472
Bump (Line_Table_Alloc);
469
473
Bump (Line_Table_Alloc_Size, How_Many => New_Lines'Length);
You can’t perform that action at this time.
0 commit comments