[Bug ada/103014] New: gnat1 segfaults in tree_could_trap_p when C double parameter, -O2 -gnatn -gnatVa

nicolas at debian dot org gcc-bugzilla@gcc.gnu.org
Sun Oct 31 14:17:37 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103014

            Bug ID: 103014
           Summary: gnat1 segfaults in tree_could_trap_p when C double
                    parameter, -O2 -gnatn -gnatVa
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nicolas at debian dot org
  Target Milestone: ---

Hello.

The following valid Ada sources crash 'gcc-11 -O2 -gnatn -gnatVa' as shown
below.
All goes well with gcc-10, with -O1, without inlining or without validity
checks.

The tests have been performed on Debian/x86_64-linux-gnu, with gcc-11/11.2.0-10
and gcc-10/10.3.12.

cat > p.ads <<EOF
package P is
   procedure P3;
end P;
EOF
cat > p.adb <<EOF
with Interfaces.C;
package body P is
   procedure P1 (A : Interfaces.C.double) is null;
   procedure P2 (A : Interfaces.C.double) is
   begin
      P1 (A);
   end P2;
   procedure P3 is
   begin
      P2 (0.0);
   end P3;
end P;
EOF
gdb /usr/lib/gcc/x86_64-linux-gnu/11/gnat1
(gdb) run -O2 -dumpbase p.adb -gnatn -gnatVa p.adb
Starting program: /usr/lib/gcc/x86_64-linux-gnu/11/gnat1 -O2 -dumpbase p.adb
-gnatn -gnatVa p.adb
[...]
P.P1 P.P2 P.P3 System.Fat_Lflt.Attr_Long_Float.Valid
Analyzing compilation unit
Performing interprocedural optimizations
<*free_lang_data> {heap 2040k} <visibility> {heap 2040k} <build_ssa_passes>
{heap 2040k} <opt_local_passes> {heap 2040k} <remove_symbols> {heap 2936k}
<targetclone> {heap 2936k} <free-fnsummary> {heap 2936k}Streaming LTO
<whole-program> {heap 2936k} <profile_estimate> {heap 2936k} <icf> {heap 2936k}
<devirt> {heap 2936k} <cp> {heap 2936k} <sra> {heap 2936k} <fnsummary> {heap
2936k} <inline> {heap 2936k} <pure-const> {heap 2936k} <modref> {heap 2936k}
<fre\
e-fnsummary> {heap 2936k} <static-var> {heap 2936k} <single-use> {heap 2936k}
<comdats> {heap 2936k}Assembling functions:
<simdclone> {heap 2936k} P.P3
Program received signal SIGSEGV, Segmentation fault.
0x000000000119a4f6 in tree_could_trap_p(tree_node*) ()


More information about the Gcc-bugs mailing list