[Bug ada/106318] New: ICE when using 'Range in Ada22 Iterated Component Association
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106318 Bug ID: 106318 Summary: ICE when using 'Range in Ada22 Iterated Component Association Product: gcc Version: 12.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ada Assignee: unassigned at gcc dot gnu.org Reporter: cthowie at netzero dot net Target Milestone: --- PLATFORM: GCC 12.1.0 toolchain on Windows 10 Intel x64 using MSYS2 (Mingw64). ISSUE: the use of 'Range sometimes causes an internal compiler error (ICE) when used in an Iterated Component Association per Ada 2022 syntax. Note that in the example program below that illustrates the bug, I had to use a nested subprogram, otherwise 'Range seemed to work OK in the Main subprogram itself: In short, this syntax works: new Local_Array'(for I in Arr'First .. Arr'Last => but this syntax crashes GNAT: new Local_Array'(for I in Arr'Range => It seems a temporary workaround for the bug is to replace use of 'Range with 'First .. 'Last in cases where GNAT crashes ('Range isn't universally broken). EXAMPLE PROGRAM DEMONSTRATING THE BUG = -- COMPILE WITH: gnatmake main.adb -gnat2022 -- The code as it stands triggers an ICE as indicated in the comment below. -- The culprit is the "for I in Arr'Range" being used in the Iterated -- Component Association syntax of Ada 2022. -- If you comment out the line that "FAILS!", and uncomment the line that "WORKS", -- then you'll get stable code using Arr'First .. Arr'Last. with Ada.Text_IO; use Ada.Text_IO; with Ada.Unchecked_Deallocation; procedure Main is type Int_Array is array (Positive range <>) of Integer; type Int_Array_Acc is access Int_Array; procedure Free is new Ada.Unchecked_Deallocation (Int_Array, Int_Array_Acc); Foo : constant Int_Array := [1, 2, 3]; procedure Nested -- replaces Arr with a similar one (Arr : in out Int_Array_Acc) is -- +===GNAT BUG ETECTED = -- | 12.1.0 (x86_64-w64-mingw32) GCC error: -- | in gnat_to_gnu_entity, at ada/gcc-interface/decl.cc:472 Replace : constant Int_Array_Acc := --new Int_Array'(for I in Arr'First .. Arr'Last => -- THIS WORKS new Int_Array'(for I in Arr'Range => -- THIS FAILS! (if Arr (I) = 2 then 0 else Arr (I))); begin Free (Arr); Arr := Replace; end Nested; Goo : Int_Array_Acc := new Int_Array'(Foo); begin Put_Line ("Goo =" & Goo.all'Image); -- should print [ 1, 2, 3] Nested (Goo); Put_Line ("Goo =" & Goo.all'Image); -- should print [ 1, 0, 3] Free (Goo); end Main;
[Bug ada/104703] New: GNAT 11.2 exception traceback output is mostly garbled on Intel x64 (MSYS2)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104703 Bug ID: 104703 Summary: GNAT 11.2 exception traceback output is mostly garbled on Intel x64 (MSYS2) Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ada Assignee: unassigned at gcc dot gnu.org Reporter: cthowie at netzero dot net Target Milestone: --- PLATFORM: GCC 11.2 Revision 8 toolchain for MSYS2 on Windows 10 Intel x64 CPU. Note GNAT FSF 8.2 Revision 1 compiler does NOT have the problem as shown below. ISSUE: I upgraded from GNAT FSF 8.2 to GNAT FSF 11.2 and noticed the "traceback" output is now garbled as demonstrated below with a trivial Ada program: EXAMPLE PROGRAM DEMONSTRATING THE ISSUE: procedure Main is procedure Inner with No_Inline is begin raise Program_Error; end Inner; begin Inner; end Main; BUILD INSTRUCTIONS: Save the above example program to e.g., "main.adb" then run: gnatmake -g main.adb -bargs -Es so we get symbolic traceback for the raised exception. Then run the 'main.exe' from the command line. I get this broken trace (only the bottom 4 lines for KERNEL32.DLL and ntdll.dll are correct): $ ./main raised PROGRAM_ERROR : main.adb:8 explicit raise [C:\temp\GNAT bug\main.exe] 0x7ff6ecbe1a1e ??? at ??? [C:\temp\GNAT bug\main.exe] 0x7ff6ecbe1a41 ??? at ??? [C:\temp\GNAT bug\main.exe] 0x7ff6ecbe1992 ??? at ??? [C:\temp\GNAT bug\main.exe] 0x7ff6ecbe13af ??? at ??? [C:\temp\GNAT bug\main.exe] 0x7ff6ecbe14e4 ??? at ??? [C:\windows\System32\KERNEL32.DLL] 0x7ffb5c5f81f2 [C:\windows\SYSTEM32\ntdll.dll] 0x7ffb5f05a24f The trace is broken even: 1) if I bind with the "-Ea" binder flag 2) if I use the GNAT system package and Text_IO e.g., with GNAT.Traceback.Symbolic; use GNAT.Traceback.Symbolic; and add this to the bottom of the main subprogram: exception when e : others => Put_Line (Symbolic_Traceback (e)); Note that the traceback is correct if I compile exactly as above but with GNAT FSF 8.2 Revision 1 compiler for MSYS2: raised PROGRAM_ERROR : main.adb:8 explicit raise [C:\temp\GNAT bug\main.exe] Main.Inner at main.adb:8 Main at main.adb:12 Main at b~main.adb:188 __tmainCRTStartup at crtexe.c:333 mainCRTStartup at crtexe.c:217 [C:\windows\System32\KERNEL32.DLL] 0x7ffb5c5f81f2 [C:\windows\SYSTEM32\ntdll.dll] 0x7ffb5f05a24f