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

            Bug ID: 104366
           Summary: Regression: infinite loop in add_sibling_attributes
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bj...@xn--rombobjrn-67a.se
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

Created attachment 52339
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52339&action=edit
source code for reproducing the problem

Compiling certain Ada source files with -g -flto -ffat-lto-objects triggers
what looks like infinite tail recursion in add_sibling_attributes in
dwarf2out.c. This began when GCC 12 landed in Fedora Rawhide. It does not
happen in GCC 11. Removing either -g, -flto or -ffat-lto-objects, or appending
-fno-lto, works around the problem.

It seems to be specific to 64-bit arches. Builds consistently continue running
indefinitely on all of Fedora's four 64-bit arches, but not on the two 32-bit
arches. I have investigated only on x86-64.

It's probably more or less specific to Ada, because otherwise it would have
caused lots and lots of failures in the recent Fedora mass rebuild.

# gcc --version
gcc (GCC) 12.0.1 20220129 (Red Hat 12.0.1-0)

# rpm -q gcc-gnat
gcc-gnat-12.0.1-0.4.fc36.x86_64

To reproduce:
gnatchop sources.ada
gcc -c -g -flto -ffat-lto-objects posix-process_environment.adb

Reply via email to