public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97011] New: ICE on C++ 20 code: gcc_assert failure in DWARF generation (tree_add_const_value_attribute, at dwarf2out.c:20283)
@ 2020-09-10 15:37 dimitri.gorokhovik at free dot fr
  2020-09-11  6:28 ` [Bug c++/97011] " rguenth at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: dimitri.gorokhovik at free dot fr @ 2020-09-10 15:37 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97011
           Summary: ICE on C++ 20 code: gcc_assert failure in DWARF
                    generation (tree_add_const_value_attribute, at
                    dwarf2out.c:20283)
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dimitri.gorokhovik at free dot fr
  Target Milestone: ---

a) This code:

template <unsigned> struct posit {};
template <typename T> concept Posit = true; 
template <auto T> concept Posit_Term = true;

template <auto ...> struct s
{
        template <Posit_Term
#if BUG
                  at
#endif
                  > struct ss {};
        constexpr auto at (Posit pos) const { return ss <pos> {}; };
};

constexpr auto t = s <> {}.at (posit <0> {});


when compiled as follows:
g++ -c -std=c++2a -fconcepts-ts -g3 bug-1.cpp -DBUG=1

provokes the internal compiler error:
bug-1.cpp:15:45: internal compiler error: in tree_add_const_value_attribute, at
dwarf2out.c:20283
   15 | constexpr auto t = s <> {}.at (posit <0> {});
      |                                             ^
0x701df1 tree_add_const_value_attribute
        ../../src/gcc/dwarf2out.c:20283
0xc5fbc1 gen_remaining_tmpl_value_param_die_attribute
        ../../src/gcc/dwarf2out.c:27130
0xc6ec58 gen_remaining_tmpl_value_param_die_attribute
        ../../src/gcc/dwarf2out.c:27116
0xc6ec58 dwarf2out_early_finish
        ../../src/gcc/dwarf2out.c:32076
0xbce88a symbol_table::finalize_compilation_unit()
        ../../src/gcc/cgraphunit.c:3012
Please submit a full bug report,

Defining 'BUG' and compiling with '-g3' are necessary conditions for
reproduction.

B) Indently (BUG undefined), the same code, compiled with '-W -Wall -Wextra'
added, gives the warning

bug-1.cpp: In instantiation of ‘constexpr auto s<elts>::at(auto:1) const [with
auto:1 = posit<0>; auto ...elts = {}]’:
bug-1.cpp:15:44:   required from here
bug-1.cpp:12:34: warning: parameter ‘pos’ set but not used
[-Wunused-but-set-parameter]
   12 |         constexpr auto at (Posit pos) const { return ss <pos> {}; };
      |                            ~~~~~~^~~

which doesn't seem correct.

gcc version:
g++ (GCC) 11.0.0 20200910 (experimental)

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

* [Bug c++/97011] ICE on C++ 20 code: gcc_assert failure in DWARF generation (tree_add_const_value_attribute, at dwarf2out.c:20283)
  2020-09-10 15:37 [Bug c++/97011] New: ICE on C++ 20 code: gcc_assert failure in DWARF generation (tree_add_const_value_attribute, at dwarf2out.c:20283) dimitri.gorokhovik at free dot fr
@ 2020-09-11  6:28 ` rguenth at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-09-11  6:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-09-11

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  FE trees leak:

#1  0x0000000001038170 in tree_add_const_value_attribute (
    die=<dw_die_ref 0x7ffff6594230 DW_TAG_template_value_param
<parent=0x7ffff65940f0 DW_TAG_structure_type>>, t=<parm_decl 0x7ffff66d5580
pos>)
    at /home/rguenther/src/gcc5/gcc/dwarf2out.c:20283
20283     gcc_assert (!DECL_P (init));
(gdb) p init
$1 = <parm_decl 0x7ffff66d5580 pos>

0  fancy_abort (file=0x2a54bf8 "/home/rguenther/src/gcc5/gcc/dwarf2out.c", 
    line=20283, 
    function=0x2a60120 <tree_add_const_value_attribute(die_struct*,
tree_node*)::__FUNCTION__> "tree_add_const_value_attribute")
    at /home/rguenther/src/gcc5/gcc/diagnostic.c:1824
#1  0x0000000001038170 in tree_add_const_value_attribute (
    die=<dw_die_ref 0x7ffff6594230 DW_TAG_template_value_param
<parent=0x7ffff65940f0 DW_TAG_structure_type>>, t=<parm_decl 0x7ffff66d5580
pos>)
    at /home/rguenther/src/gcc5/gcc/dwarf2out.c:20283
#2  0x000000000104b106 in gen_remaining_tmpl_value_param_die_attribute ()
    at /home/rguenther/src/gcc5/gcc/dwarf2out.c:27130
#3  0x0000000001056378 in dwarf2out_early_finish (filename=0x3b0c930 "t.ii")
    at /home/rguenther/src/gcc5/gcc/dwarf2out.c:32076
#4  0x0000000000f7d04e in symbol_table::finalize_compilation_unit (
    this=0x7ffff656d100) at /home/rguenther/src/gcc5/gcc/cgraphunit.c:3012
#5  0x00000000016678f2 in compile_file ()
    at /home/rguenther/src/gcc5/gcc/toplev.c:482
#6  0x000000000166ab8a in do_compile ()
    at /home/rguenther/src/gcc5/gcc/toplev.c:2314
#7  0x000000000166ae83 in toplev::main (this=0x7fffffffdd7e, argc=7, 
    argv=0x7fffffffde78) at /home/rguenther/src/gcc5/gcc/toplev.c:2453
#8  0x000000000286fd02 in main (argc=7, argv=0x7fffffffde78)
    at /home/rguenther/src/gcc5/gcc/main.c:39

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

end of thread, other threads:[~2020-09-11  6:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-10 15:37 [Bug c++/97011] New: ICE on C++ 20 code: gcc_assert failure in DWARF generation (tree_add_const_value_attribute, at dwarf2out.c:20283) dimitri.gorokhovik at free dot fr
2020-09-11  6:28 ` [Bug c++/97011] " rguenth 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).