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
  • [Bug ada/104703] New: GNAT 11.2 ... cthowie at netzero dot net via Gcc-bugs

Reply via email to