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

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

https://gcc.gnu.org/g:5b1fb8f8b4fe60745dece9b2f83c155c772ca66d

commit r14-9254-g5b1fb8f8b4fe60745dece9b2f83c155c772ca66d
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Fri Mar 1 14:57:15 2024 +0100

    dwarf2out: Don't move variable sized aggregates to comdat [PR114015]

    The following testcase ICEs, because we decide to move that
    struct { char a[n]; } DW_TAG_structure_type into .debug_types section
    / DW_UT_type DWARF5 unit, but refer from there to a DW_TAG_variable
    (created artificially for the array bounds).
    Even with non-bitint, I think it is just wrong to use .debug_types
    section / DW_UT_type for something that uses DW_OP_fbreg and similar
    in it, things clearly dependent on a particular function.
    In most cases, is_nested_in_subprogram (die) check results in such
    aggregates not being moved, but in the function parameter type case
    that is not the case.

    The following patch fixes it by returning false from
should_move_die_to_comdat
    for non-constant sized aggregate types, i.e. when either we gave up on
    adding DW_AT_byte_size for it because it wasn't expressable, or when
    it is something non-constant (location description, reference, ...).

    2024-03-01  Jakub Jelinek  <ja...@redhat.com>

            PR debug/114015
            * dwarf2out.cc (should_move_die_to_comdat): Return false for
            aggregates without DW_AT_byte_size attribute or with non-constant
            DW_AT_byte_size.

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

Reply via email to