public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/103874] New: [11/12 Regression] ICE in internal_error on riscv64
@ 2021-12-31 12:48 aurelien at aurel32 dot net
  2021-12-31 12:55 ` [Bug c/103874] " aurelien at aurel32 dot net
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: aurelien at aurel32 dot net @ 2021-12-31 12:48 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103874
           Summary: [11/12 Regression] ICE in internal_error on riscv64
           Product: gcc
           Version: 11.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aurelien at aurel32 dot net
  Target Milestone: ---

Created attachment 52099
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52099&action=edit
Reproducer

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug c/103874] [11/12 Regression] ICE in internal_error on riscv64
  2021-12-31 12:48 [Bug c/103874] New: [11/12 Regression] ICE in internal_error on riscv64 aurelien at aurel32 dot net
@ 2021-12-31 12:55 ` aurelien at aurel32 dot net
  2021-12-31 15:14 ` [Bug target/103874] " aurelien at aurel32 dot net
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: aurelien at aurel32 dot net @ 2021-12-31 12:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Aurelien Jarno <aurelien at aurel32 dot net> ---
Sorry I submitted the bug by mistake without filling a comment.

pytorch failed to build in Debian on riscv64 following the switch to GCC 11 by
default:
https://buildd.debian.org/status/fetch.php?pkg=pytorch&arch=riscv64&ver=1.8.1-2%2Bb3&stamp=1640951671&raw=0

I have extracted a reproducer (attached), here are the output with GCC 10, 11
and 12:

aurel32@beaglev:~/pytorch$ gcc-10 -v
Using built-in specs.
COLLECT_GCC=gcc-10
COLLECT_LTO_WRAPPER=/usr/lib/gcc/riscv64-linux-gnu/10/lto-wrapper
Target: riscv64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 10.3.0-13'
--with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs
--enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr
--with-gcc-major-version-only --program-suffix=-10
--program-prefix=riscv64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new
--enable-gnu-unique-object --disable-libitm --disable-libsanitizer
--disable-libquadmath --disable-libquadmath-support --enable-plugin
--enable-default-pie --with-system-zlib --enable-libphobos-checking=release
--with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch
--disable-werror --disable-multilib --with-arch=rv64imafdc --with-abi=lp64d
--enable-checking=release --build=riscv64-linux-gnu --host=riscv64-linux-gnu
--target=riscv64-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.3.1 20211117 (Debian 10.3.0-13)
aurel32@beaglev:~/pytorch$ /usr/bin/gcc-10 -gsplit-dwarf -O2 -g -fPIC -std=c90
-c ./onnxifi_loader.c.i
aurel32@beaglev:~/pytorch$


aurel32@beaglev:~/pytorch$ gcc-11 -v
Using built-in specs.
COLLECT_GCC=gcc-11
COLLECT_LTO_WRAPPER=/usr/lib/gcc/riscv64-linux-gnu/11/lto-wrapper
Target: riscv64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 11.2.0-13'
--with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs
--enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr
--with-gcc-major-version-only --program-suffix=-11
--program-prefix=riscv64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new
--enable-gnu-unique-object --disable-libitm --disable-libquadmath
--disable-libquadmath-support --enable-plugin --enable-default-pie
--with-system-zlib --enable-libphobos-checking=release
--with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch
--disable-werror --disable-multilib --with-arch=rv64imafdc --with-abi=lp64d
--enable-checking=release --build=riscv64-linux-gnu --host=riscv64-linux-gnu
--target=riscv64-linux-gnu --with-build-config=bootstrap-lto-lean
--enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.0 (Debian 11.2.0-13)   
(sid-riscv64)aurel32@beaglev:~/pytorch$ /usr/bin/gcc-11 -gsplit-dwarf -O2 -g
-fPIC -std=c90 -c ./onnxifi_loader.c.i
/home/aurel32/pytorch/pytorch-1.8.1/debian/foxi/foxi/onnxifi_loader.c:212:1:
internal compiler error: Segmentation fault
  212 | }
      | ^
0xa26915 internal_error(char const*, ...)
        ???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-11/README.Bugs> for instructions.
aurel32@beaglev:~/pytorch$


aurel32@beaglev:~/pytorch$ gcc-12 -v
Using built-in specs.
COLLECT_GCC=gcc-12
COLLECT_LTO_WRAPPER=/usr/lib/gcc/riscv64-linux-gnu/12/lto-wrapper
Target: riscv64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 12-20211217-1'
--with-bugurl=file:///usr/share/doc/gcc-12/README.Bugs
--enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr
--with-gcc-major-version-only --program-suffix=-12
--program-prefix=riscv64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new
--enable-gnu-unique-object --disable-libitm --disable-libquadmath
--disable-libquadmath-support --enable-plugin --enable-default-pie
--with-system-zlib --enable-libphobos-checking=release
--with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch
--disable-werror --disable-multilib --with-arch=rv64imafdc --with-abi=lp64d
--enable-checking=release --build=riscv64-linux-gnu --host=riscv64-linux-gnu
--target=riscv64-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.0 20211217 (experimental) [master r12-6027-g774269aa4b9]
(Debian 12-20211217-1)
aurel32@beaglev:~/pytorch$ /usr/bin/gcc-12 -gsplit-dwarf -O2 -g -fPIC -std=c90
-c ./onnxifi_loader.c.i
/home/aurel32/pytorch/pytorch-1.8.1/debian/foxi/foxi/onnxifi_loader.c:212:1:
internal compiler error: Segmentation fault
  212 | }
      | ^
0xc730d3 internal_error(char const*, ...)
        ???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-12/README.Bugs> for instructions.
aurel32@beaglev:~/pytorch$

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug target/103874] [11/12 Regression] ICE in internal_error on riscv64
  2021-12-31 12:48 [Bug c/103874] New: [11/12 Regression] ICE in internal_error on riscv64 aurelien at aurel32 dot net
  2021-12-31 12:55 ` [Bug c/103874] " aurelien at aurel32 dot net
@ 2021-12-31 15:14 ` aurelien at aurel32 dot net
  2021-12-31 15:15 ` aurelien at aurel32 dot net
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: aurelien at aurel32 dot net @ 2021-12-31 15:14 UTC (permalink / raw)
  To: gcc-bugs

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

Aurelien Jarno <aurelien at aurel32 dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #52099|0                           |1
        is obsolete|                            |

--- Comment #2 from Aurelien Jarno <aurelien at aurel32 dot net> ---
Created attachment 52100
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52100&action=edit
Minimal reproducer

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug target/103874] [11/12 Regression] ICE in internal_error on riscv64
  2021-12-31 12:48 [Bug c/103874] New: [11/12 Regression] ICE in internal_error on riscv64 aurelien at aurel32 dot net
  2021-12-31 12:55 ` [Bug c/103874] " aurelien at aurel32 dot net
  2021-12-31 15:14 ` [Bug target/103874] " aurelien at aurel32 dot net
@ 2021-12-31 15:15 ` aurelien at aurel32 dot net
  2021-12-31 16:26 ` aurelien at aurel32 dot net
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: aurelien at aurel32 dot net @ 2021-12-31 15:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Aurelien Jarno <aurelien at aurel32 dot net> ---
I have been able to reduce the reproducer code to almost nothing, so I guess
the issue is mostly related to the options and not to the source code.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug target/103874] [11/12 Regression] ICE in internal_error on riscv64
  2021-12-31 12:48 [Bug c/103874] New: [11/12 Regression] ICE in internal_error on riscv64 aurelien at aurel32 dot net
                   ` (2 preceding siblings ...)
  2021-12-31 15:15 ` aurelien at aurel32 dot net
@ 2021-12-31 16:26 ` aurelien at aurel32 dot net
  2022-01-01  1:05 ` aurelien at aurel32 dot net
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: aurelien at aurel32 dot net @ 2021-12-31 16:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Aurelien Jarno <aurelien at aurel32 dot net> ---
This is a better backtrace after building a riscv64 cross compiler from the
releases/gcc-11 branch:

/tmp/onnxifi_loader.c.i:6:1: internal compiler error: Segmentation fault
    6 | }
      | ^
0xadad0f crash_signal
        /home/aurel32/git/gcc/gcc/toplev.c:327
0x76ef21 output_rnglists
        /home/aurel32/git/gcc/gcc/dwarf2out.c:12174
0x7b7782 dwarf2out_finish
        /home/aurel32/git/gcc/gcc/dwarf2out.c:32058
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug target/103874] [11/12 Regression] ICE in internal_error on riscv64
  2021-12-31 12:48 [Bug c/103874] New: [11/12 Regression] ICE in internal_error on riscv64 aurelien at aurel32 dot net
                   ` (3 preceding siblings ...)
  2021-12-31 16:26 ` aurelien at aurel32 dot net
@ 2022-01-01  1:05 ` aurelien at aurel32 dot net
  2022-01-01  1:23 ` [Bug debug/103874] [11/12 Regression] ICE in internal_error on riscv64 and -gsplit-dwarf pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: aurelien at aurel32 dot net @ 2022-01-01  1:05 UTC (permalink / raw)
  To: gcc-bugs

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

Aurelien Jarno <aurelien at aurel32 dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at redhat dot com

--- Comment #5 from Aurelien Jarno <aurelien at aurel32 dot net> ---
A bisect pointed me to that commit:

commit 4b33c5aaab9e863da162942ab8bcd54070b705af
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Mar 31 21:25:58 2021 +0200

    dwarf2out: Fix up ranges for -gdwarf-5 -gsplit-dwarf [PR99490]

    For -gdwarf-4 -gsplit-dwarf we used to emit .debug_ranges section
    (so in the binaries/shared libraries) with DW_AT_ranges from skeleton
    units as well as .debug_info.dwo pointing to it through DW_FORM_sec_offset
    (and DW_AT_GNU_ranges_base pointing into section, not sure for what
    reason exactly).
    When DWARF5 support was being added, we've started using .debug_rnglists
    section, added DW_AT_rnglists_base to the DW_TAG_skeleton_unit, kept
    DW_AT_ranges with DW_FORM_sec_offset in the skeleton and switched
    over to DW_FORM_rnglistx for DW_AT_ranges in .debug_info.dwo.
    But the DWARF5 spec actually means for the ranges section (at least
    everything for those DW_AT_ranges in .debug_info.dwo) to sit
    in .debug_rnglists.dwo section next to the .debug_info.dwo, rather than
    having consumers look it up in the binary/shared library instead.
    Based on some discussions in the DWARF discuss mailing list:
   
http://lists.dwarfstd.org/pipermail/dwarf-discuss-dwarfstd.org/2021-March/thread.html#4765
    this patch mostly follows what LLVM emits for that right now:
    1) small .debug_rnglists section (when needed) just to cover the
       skeleton DW_AT_ranges (if present); the content of the section
       uses the Split DWARFy DW_RLE_* codes with addrx encodings where
       possible
    2) DW_AT_ranges in the skeleton uses DW_FORM_sec_offset (difference
       from LLVM which uses DW_FORM_rnglistx, which makes it larger
       and ambiguous)
    3) DW_AT_rnglists_base attribute is gone from the skeleton (again,
       unlike LLVM where it is just confusing what exactly it means because
       it is inherited; it would make sense if we emitted DW_FORM_rnglistx
       in non-split DWARF, but unless ranges are shared, I'm afraid we'd
       make DWARF larger with fewer relocations by that)
    4) usually big .debug_rnglists.dwo section again with using DW_RLE_*x*
       where possible
    5) DW_AT_ranges with DW_FORM_rnglistx from .debug_info.dwo referring to
       that .debug_rnglists.dwo ranges

    2021-03-31  Jakub Jelinek  <jakub@redhat.com>

            PR debug/99490
            * dwarf2out.c (debug_ranges_dwo_section): New variable.
            (DW_RANGES_IDX_SKELETON): Define.
            (struct dw_ranges): Add begin_entry and end_entry members.
            (DEBUG_DWO_RNGLISTS_SECTION): Define.
            (add_ranges_num): Adjust r initializer for addition of *_entry
            members.
            (add_ranges_by_labels): For -gsplit-dwarf and force_direct,
            set idx to DW_RANGES_IDX_SKELETON.
            (use_distinct_base_address_for_range): New function.
            (index_rnglists): Don't set r->idx if it is equal to
            DW_RANGES_IDX_SKELETON.  Initialize r->begin_entry and
            r->end_entry for -gsplit-dwarf if those will be needed by
            output_rnglists.
            (output_rnglists): Add DWO argument.  If true, switch to
            debug_ranges_dwo_section rather than debug_ranges_section.
            Adjust l1/l2 label indexes.  Only output the offset table when
            dwo is true and don't include in there the skeleton range
            entry if present.  For -gsplit-dwarf, skip ranges that belong
            to the other rnglists section.  Change return type from void
            to bool and return true if there are any range entries for
            the other section.  For dwarf_split_debug_info use
            DW_RLE_startx_endx, DW_RLE_startx_length and DW_RLE_base_addressx
            entries instead of DW_RLE_start_end, DW_RLE_start_length and
            DW_RLE_base_address.  Use use_distinct_base_address_for_range.
            (init_sections_and_labels): Initialize debug_ranges_dwo_section
            if -gsplit-dwarf and DWARF >= 5.  Adjust ranges_section_label
            and range_base_label indexes.
            (dwarf2out_finish): Call index_rnglists earlier before finalizing
            .debug_addr.  Never emit DW_AT_rnglists_base attribute.  For
            -gsplit-dwarf and DWARF >= 5 call output_rnglists up to twice
            with different dwo arguments.
            (dwarf2out_c_finalize): Clear debug_ranges_dwo_section.

 gcc/dwarf2out.c | 255 ++++++++++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 211 insertions(+), 44 deletions(-)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug debug/103874] [11/12 Regression] ICE in internal_error on riscv64 and -gsplit-dwarf
  2021-12-31 12:48 [Bug c/103874] New: [11/12 Regression] ICE in internal_error on riscv64 aurelien at aurel32 dot net
                   ` (4 preceding siblings ...)
  2022-01-01  1:05 ` aurelien at aurel32 dot net
@ 2022-01-01  1:23 ` pinskia at gcc dot gnu.org
  2022-01-04 14:01 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-01  1:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I doubt many people use gsplit-dwarf really.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug debug/103874] [11/12 Regression] ICE in internal_error on riscv64 and -gsplit-dwarf
  2021-12-31 12:48 [Bug c/103874] New: [11/12 Regression] ICE in internal_error on riscv64 aurelien at aurel32 dot net
                   ` (5 preceding siblings ...)
  2022-01-01  1:23 ` [Bug debug/103874] [11/12 Regression] ICE in internal_error on riscv64 and -gsplit-dwarf pinskia at gcc dot gnu.org
@ 2022-01-04 14:01 ` rguenth at gcc dot gnu.org
  2022-01-19 12:42 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-04 14:01 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.3
           Priority|P3                          |P2

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug debug/103874] [11/12 Regression] ICE in internal_error on riscv64 and -gsplit-dwarf
  2021-12-31 12:48 [Bug c/103874] New: [11/12 Regression] ICE in internal_error on riscv64 aurelien at aurel32 dot net
                   ` (6 preceding siblings ...)
  2022-01-04 14:01 ` rguenth at gcc dot gnu.org
@ 2022-01-19 12:42 ` jakub at gcc dot gnu.org
  2022-01-20  2:22 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-01-19 12:42 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2022-01-19
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 52231
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52231&action=edit
gcc12-pr103874.patch

Untested fix.  No access to riscv64, so all I can do is test it on
{x86_64,i686}-linux.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug debug/103874] [11/12 Regression] ICE in internal_error on riscv64 and -gsplit-dwarf
  2021-12-31 12:48 [Bug c/103874] New: [11/12 Regression] ICE in internal_error on riscv64 aurelien at aurel32 dot net
                   ` (7 preceding siblings ...)
  2022-01-19 12:42 ` jakub at gcc dot gnu.org
@ 2022-01-20  2:22 ` pinskia at gcc dot gnu.org
  2022-01-20 10:59 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-20  2:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
RISCV is the only (modern) target which does not have HAVE_AS_LEB128 defined
really; see PR 91602 for the reasons why.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug debug/103874] [11/12 Regression] ICE in internal_error on riscv64 and -gsplit-dwarf
  2021-12-31 12:48 [Bug c/103874] New: [11/12 Regression] ICE in internal_error on riscv64 aurelien at aurel32 dot net
                   ` (8 preceding siblings ...)
  2022-01-20  2:22 ` pinskia at gcc dot gnu.org
@ 2022-01-20 10:59 ` cvs-commit at gcc dot gnu.org
  2022-01-20 10:59 ` [Bug debug/103874] [11 " jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-20 10:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:68f03ac49cb4f585dbce78dc9e4c4a9ec950e83c

commit r12-6758-g68f03ac49cb4f585dbce78dc9e4c4a9ec950e83c
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Jan 20 11:58:20 2022 +0100

    dwarf2out: Fix -gsplit-dwarf on riscv [PR103874]

    riscv*-*-* are the only modern targets that !HAVE_AS_LEB128 (apparently
    due to some aggressive linker optimizations).
    As the following testcase shows, we mishandle in index_rnglists the
    !HAVE_AS_LEB128 && !have_multiple_function_sections case.

    output_rnglists does roughly:
      FOR_EACH_VEC_SAFE_ELT (ranges_table, i, r)
        {
    ...
          if (block_num > 0)
            {
    ...
              if (HAVE_AS_LEB128)
                {
                  if (!have_multiple_function_sections)
                    {
                      // code not using r->*_entry
                      continue;
                    }
                  // code that sometimes doesn't use r->*_entry,
                  // sometimes r->begin_entry
                }
              else if (dwarf_split_debug_info)
                {
                  // code that uses both r->begin_entry and r->end_entry
                }
              else
                {
                  // code not using r->*_entry
                }
            }
          else if (block_num < 0)
            {
              if (!have_multiple_function_sections)
                gcc_unreachable ();
    ...
            }
        }
    and index_rnglists is what sets up those r->{begin,end}_entry members.
    The code did an early if (!have_multiple_function_sections) continue;
    which is fine for the HAVE_AS_LEB128 case, because r->*_entry is not
    used in that case, but not for !HAVE_AS_LEB128 that uses it anyway.

    2022-01-20  Jakub Jelinek  <jakub@redhat.com>

            PR debug/103874
            * dwarf2out.cc (index_rnglists): For !HAVE_AS_LEB128 and
            block_num > 0, index entry even if
!have_multiple_function_sections.

            * gcc.dg/debug/dwarf2/pr103874.c: New test.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug debug/103874] [11 Regression] ICE in internal_error on riscv64 and -gsplit-dwarf
  2021-12-31 12:48 [Bug c/103874] New: [11/12 Regression] ICE in internal_error on riscv64 aurelien at aurel32 dot net
                   ` (9 preceding siblings ...)
  2022-01-20 10:59 ` cvs-commit at gcc dot gnu.org
@ 2022-01-20 10:59 ` jakub at gcc dot gnu.org
  2022-01-20 22:34 ` aurelien at aurel32 dot net
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-01-20 10:59 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|jakub at redhat dot com            |
            Summary|[11/12 Regression] ICE in   |[11 Regression] ICE in
                   |internal_error on riscv64   |internal_error on riscv64
                   |and -gsplit-dwarf           |and -gsplit-dwarf

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed on the trunk so far.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug debug/103874] [11 Regression] ICE in internal_error on riscv64 and -gsplit-dwarf
  2021-12-31 12:48 [Bug c/103874] New: [11/12 Regression] ICE in internal_error on riscv64 aurelien at aurel32 dot net
                   ` (10 preceding siblings ...)
  2022-01-20 10:59 ` [Bug debug/103874] [11 " jakub at gcc dot gnu.org
@ 2022-01-20 22:34 ` aurelien at aurel32 dot net
  2022-01-24  9:21 ` cvs-commit at gcc dot gnu.org
  2022-01-24  9:28 ` jakub at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: aurelien at aurel32 dot net @ 2022-01-20 22:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Aurelien Jarno <aurelien at aurel32 dot net> ---
Thanks for the patch! I confirm the issue is fixed on the trunk. I also tried
to apply it on the GCC 11 branch (which is basically renaming dwarf2out.cc into
dwarf2out.c in the patch) and this also works fine.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug debug/103874] [11 Regression] ICE in internal_error on riscv64 and -gsplit-dwarf
  2021-12-31 12:48 [Bug c/103874] New: [11/12 Regression] ICE in internal_error on riscv64 aurelien at aurel32 dot net
                   ` (11 preceding siblings ...)
  2022-01-20 22:34 ` aurelien at aurel32 dot net
@ 2022-01-24  9:21 ` cvs-commit at gcc dot gnu.org
  2022-01-24  9:28 ` jakub at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-24  9:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:3991e4c752b3450decdb36e0b562e044ce653b3d

commit r11-9505-g3991e4c752b3450decdb36e0b562e044ce653b3d
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Jan 20 11:58:20 2022 +0100

    dwarf2out: Fix -gsplit-dwarf on riscv [PR103874]

    riscv*-*-* are the only modern targets that !HAVE_AS_LEB128 (apparently
    due to some aggressive linker optimizations).
    As the following testcase shows, we mishandle in index_rnglists the
    !HAVE_AS_LEB128 && !have_multiple_function_sections case.

    output_rnglists does roughly:
      FOR_EACH_VEC_SAFE_ELT (ranges_table, i, r)
        {
    ...
          if (block_num > 0)
            {
    ...
              if (HAVE_AS_LEB128)
                {
                  if (!have_multiple_function_sections)
                    {
                      // code not using r->*_entry
                      continue;
                    }
                  // code that sometimes doesn't use r->*_entry,
                  // sometimes r->begin_entry
                }
              else if (dwarf_split_debug_info)
                {
                  // code that uses both r->begin_entry and r->end_entry
                }
              else
                {
                  // code not using r->*_entry
                }
            }
          else if (block_num < 0)
            {
              if (!have_multiple_function_sections)
                gcc_unreachable ();
    ...
            }
        }
    and index_rnglists is what sets up those r->{begin,end}_entry members.
    The code did an early if (!have_multiple_function_sections) continue;
    which is fine for the HAVE_AS_LEB128 case, because r->*_entry is not
    used in that case, but not for !HAVE_AS_LEB128 that uses it anyway.

    2022-01-20  Jakub Jelinek  <jakub@redhat.com>

            PR debug/103874
            * dwarf2out.c (index_rnglists): For !HAVE_AS_LEB128 and
            block_num > 0, index entry even if
!have_multiple_function_sections.

            * gcc.dg/debug/dwarf2/pr103874.c: New test.

    (cherry picked from commit 68f03ac49cb4f585dbce78dc9e4c4a9ec950e83c)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug debug/103874] [11 Regression] ICE in internal_error on riscv64 and -gsplit-dwarf
  2021-12-31 12:48 [Bug c/103874] New: [11/12 Regression] ICE in internal_error on riscv64 aurelien at aurel32 dot net
                   ` (12 preceding siblings ...)
  2022-01-24  9:21 ` cvs-commit at gcc dot gnu.org
@ 2022-01-24  9:28 ` jakub at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-01-24  9:28 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #13 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed for 11.3 too.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2022-01-24  9:28 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-31 12:48 [Bug c/103874] New: [11/12 Regression] ICE in internal_error on riscv64 aurelien at aurel32 dot net
2021-12-31 12:55 ` [Bug c/103874] " aurelien at aurel32 dot net
2021-12-31 15:14 ` [Bug target/103874] " aurelien at aurel32 dot net
2021-12-31 15:15 ` aurelien at aurel32 dot net
2021-12-31 16:26 ` aurelien at aurel32 dot net
2022-01-01  1:05 ` aurelien at aurel32 dot net
2022-01-01  1:23 ` [Bug debug/103874] [11/12 Regression] ICE in internal_error on riscv64 and -gsplit-dwarf pinskia at gcc dot gnu.org
2022-01-04 14:01 ` rguenth at gcc dot gnu.org
2022-01-19 12:42 ` jakub at gcc dot gnu.org
2022-01-20  2:22 ` pinskia at gcc dot gnu.org
2022-01-20 10:59 ` cvs-commit at gcc dot gnu.org
2022-01-20 10:59 ` [Bug debug/103874] [11 " jakub at gcc dot gnu.org
2022-01-20 22:34 ` aurelien at aurel32 dot net
2022-01-24  9:21 ` cvs-commit at gcc dot gnu.org
2022-01-24  9:28 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).