public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/113498] New: ICE in GCC trunk: tree check: have using_decl in get_template_info, at cp/pt.cc:357
@ 2024-01-19  6:35 bobmiller at nvidia dot com
  2024-01-19  6:44 ` [Bug c++/113498] " bobmiller at nvidia dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: bobmiller at nvidia dot com @ 2024-01-19  6:35 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113498
           Summary: ICE in GCC trunk: tree check: have using_decl in
                    get_template_info, at cp/pt.cc:357
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bobmiller at nvidia dot com
  Target Milestone: ---

Created attachment 57154
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57154&action=edit
GCC Bug report generated via -freport-bug

the exact version of GCC: Any GCC trunk at/after 14.0.0-20240107gita6b8d8f919c4

the system type: x86_64-pc-linux-gnu

the options given when GCC was configured/built: ../configure
--prefix=/opt/gcc-latest --enable-languages=c,c++ --enable-libstdcxx-debug
--enable-libstdcxx-backtrace --disable-bootstrap --disable-multilib
--disable-libvtv --with-system-zlib --without-isl --enable-multiarch

the complete command line that triggers the bug: ./g++ -O3 --std=c++23 -Wall
-Wextra -pedantic -freport-bug /test.cpp -o /test


the compiler output (error messages, warnings, etc.):




the preprocessed file (*.i*) that triggers the bug, generated by adding
-save-temps to the complete compilation command, or, in the case of a bug
report for the GNAT front end, a complete set of source files (see below): This
is the file attached to this bug.

root@ceceda56193b:/opt/gcc-latest/bin# ./g++ -O3 --std=c++23 -Wall -Wextra
-pedantic -freport-bug /test.cpp -o /test
/test.cpp: In instantiation of 'constexpr ThisTT<T, Dims ...> S<ThisTT, T,
Dims>::f() const requires ('using_decl' not supported by expression) > 0 [with
ThisTT = S2; T = int; long unsigned int ...Dims = {1, 1}]':
/test.cpp:30:9:   required from here
   30 |     s2.f();
      |     ~~~~^~
/test.cpp:18:26: error: no return statement in 'constexpr' function returning
non-void
   18 |         requires(D > 0) {}
      |                          ^
/test.cpp: In instantiation of 'constexpr ThisTT<T, Dims ...> S<ThisTT, T,
Dims>::f() const requires ('using_decl' not supported by expression) > 0 [with
ThisTT = S2; T = int; long unsigned int ...Dims = {1, 1}]':
/test.cpp:17:34: internal compiler error: tree check: expected var_decl or
function_decl or field_decl or type_decl or concept_decl or template_decl, have
using_decl in get_template_info, at cp/pt.cc:357
   17 |     constexpr ThisTT<T, Dims...> f() const
      |                                  ^
0x7994c4 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc/tree.cc:8954
0xafa224 template_info_decl_check(tree_node const*, char const*, int, char
const*)
        ../../gcc/cp/cp-tree.h:665
0xafa224 get_template_info(tree_node const*)
        ../../gcc/cp/pt.cc:357
0xb0455f most_general_template(tree_node const*)
        ../../gcc/cp/pt.cc:26017
0xa063f2 write_unqualified_name
        ../../gcc/cp/mangle.cc:1601
0xa12561 write_nested_name
        ../../gcc/cp/mangle.cc:1273
0xa13159 write_encoding
        ../../gcc/cp/mangle.cc:938
0xa1338b write_mangled_name
        ../../gcc/cp/mangle.cc:820
0xa0a00f write_expression
        ../../gcc/cp/mangle.cc:3441
0xa08f8e write_expression
        ../../gcc/cp/mangle.cc:3942
0xa1327d write_constraint_expression
        ../../gcc/cp/mangle.cc:860
0xa1327d write_encoding
        ../../gcc/cp/mangle.cc:968
0xa1338b write_mangled_name
        ../../gcc/cp/mangle.cc:820
0xa15138 mangle_decl_string
        ../../gcc/cp/mangle.cc:4420
0xa153d8 get_mangled_id
        ../../gcc/cp/mangle.cc:4441
0xa153d8 mangle_decl(tree_node*)
        ../../gcc/cp/mangle.cc:4479
0x16a2175 decl_assembler_name(tree_node*)
        ../../gcc/tree.cc:719
0xd947ab symtab_node::get_comdat_group_id()
        ../../gcc/cgraph.h:258
0xd947ab analyze_functions
        ../../gcc/cgraphunit.cc:1200
0xd960cd symbol_table::finalize_compilation_unit()
        ../../gcc/cgraphunit.cc:2555
Please submit a full bug report, with preprocessed source.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.


Please let me know if additional information is required :D

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

* [Bug c++/113498] ICE in GCC trunk: tree check: have using_decl in get_template_info, at cp/pt.cc:357
  2024-01-19  6:35 [Bug c++/113498] New: ICE in GCC trunk: tree check: have using_decl in get_template_info, at cp/pt.cc:357 bobmiller at nvidia dot com
@ 2024-01-19  6:44 ` bobmiller at nvidia dot com
  2024-01-19  7:58 ` bobmiller at nvidia dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: bobmiller at nvidia dot com @ 2024-01-19  6:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Bob Miller <bobmiller at nvidia dot com> ---
Bug also occurs on GCC Trunk in Compiler Explorer.
Small test case to reproduce bug: https://godbolt.org/z/TorE88bMT

#include <cstdlib>

template<template<typename, size_t...> class ThisTT,
            typename T,
            size_t...Dims>
struct S_Base
{
    static constexpr size_t D = (Dims *...);
};

template<template<typename, size_t...> class ThisTT,
            typename T,
            size_t...Dims>
struct S : public S_Base<ThisTT, T, Dims...>
{
    using S_Base<ThisTT, T, Dims...>::D;
    constexpr ThisTT<T, Dims...> f() const
        requires(D > 0) {return {};}

};

template<typename T, size_t M, size_t N>
struct S2 : public S<S2, T, M, N>
{
};

int main(int, char**)
{
    S2<int, 1, 1> s2;
    s2.f();
    return 0;
}

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

* [Bug c++/113498] ICE in GCC trunk: tree check: have using_decl in get_template_info, at cp/pt.cc:357
  2024-01-19  6:35 [Bug c++/113498] New: ICE in GCC trunk: tree check: have using_decl in get_template_info, at cp/pt.cc:357 bobmiller at nvidia dot com
  2024-01-19  6:44 ` [Bug c++/113498] " bobmiller at nvidia dot com
@ 2024-01-19  7:58 ` bobmiller at nvidia dot com
  2024-01-19  9:19 ` [Bug c++/113498] [14 regression] " rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: bobmiller at nvidia dot com @ 2024-01-19  7:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Bob Miller <bobmiller at nvidia dot com> ---
Apologies, I should have reduced this test case further before submission, but
I was under the mistaken impression that the template weirdness was the cause.
I believe this is a minimized example: https://godbolt.org/z/s3vGEh4Wx

template<int d>
struct S_Base
{
    static constexpr int D = d;
};

template<int d>
struct S : public S_Base<d>
{
    using S_Base<d>::D;
    constexpr void f() const
        requires(D > 0) {}

};

int main(int, char**)
{
    S<1> s;
    s.f();
    return 0;
}

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

* [Bug c++/113498] [14 regression] ICE in GCC trunk: tree check: have using_decl in get_template_info, at cp/pt.cc:357
  2024-01-19  6:35 [Bug c++/113498] New: ICE in GCC trunk: tree check: have using_decl in get_template_info, at cp/pt.cc:357 bobmiller at nvidia dot com
  2024-01-19  6:44 ` [Bug c++/113498] " bobmiller at nvidia dot com
  2024-01-19  7:58 ` bobmiller at nvidia dot com
@ 2024-01-19  9:19 ` rguenth at gcc dot gnu.org
  2024-01-19 16:15 ` [Bug c++/113498] [14 regression] ICE in GCC trunk: tree check: have using_decl in get_template_info, at cp/pt.cc:357 since r14-6064 jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-01-19  9:19 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0

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

* [Bug c++/113498] [14 regression] ICE in GCC trunk: tree check: have using_decl in get_template_info, at cp/pt.cc:357 since r14-6064
  2024-01-19  6:35 [Bug c++/113498] New: ICE in GCC trunk: tree check: have using_decl in get_template_info, at cp/pt.cc:357 bobmiller at nvidia dot com
                   ` (2 preceding siblings ...)
  2024-01-19  9:19 ` [Bug c++/113498] [14 regression] " rguenth at gcc dot gnu.org
@ 2024-01-19 16:15 ` jakub at gcc dot gnu.org
  2024-01-19 17:01 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-19 16:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[14 regression] ICE in GCC  |[14 regression] ICE in GCC
                   |trunk: tree check: have     |trunk: tree check: have
                   |using_decl in               |using_decl in
                   |get_template_info, at       |get_template_info, at
                   |cp/pt.cc:357                |cp/pt.cc:357 since r14-6064
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2024-01-19
           Priority|P3                          |P1
             Status|UNCONFIRMED                 |NEW

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r14-6064-gc3f281a0c1ca50e4df5049923aa2f5d1c3c39ff6

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

* [Bug c++/113498] [14 regression] ICE in GCC trunk: tree check: have using_decl in get_template_info, at cp/pt.cc:357 since r14-6064
  2024-01-19  6:35 [Bug c++/113498] New: ICE in GCC trunk: tree check: have using_decl in get_template_info, at cp/pt.cc:357 bobmiller at nvidia dot com
                   ` (3 preceding siblings ...)
  2024-01-19 16:15 ` [Bug c++/113498] [14 regression] ICE in GCC trunk: tree check: have using_decl in get_template_info, at cp/pt.cc:357 since r14-6064 jakub at gcc dot gnu.org
@ 2024-01-19 17:01 ` jason at gcc dot gnu.org
  2024-01-19 19:23 ` cvs-commit at gcc dot gnu.org
  2024-01-19 19:24 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2024-01-19 17:01 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

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

* [Bug c++/113498] [14 regression] ICE in GCC trunk: tree check: have using_decl in get_template_info, at cp/pt.cc:357 since r14-6064
  2024-01-19  6:35 [Bug c++/113498] New: ICE in GCC trunk: tree check: have using_decl in get_template_info, at cp/pt.cc:357 bobmiller at nvidia dot com
                   ` (4 preceding siblings ...)
  2024-01-19 17:01 ` jason at gcc dot gnu.org
@ 2024-01-19 19:23 ` cvs-commit at gcc dot gnu.org
  2024-01-19 19:24 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-19 19:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:1338ad23ff3c1e4f552cdb64e36cef12eda2e050

commit r14-8294-g1338ad23ff3c1e4f552cdb64e36cef12eda2e050
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Jan 19 13:11:05 2024 -0500

    c++: requires and using-decl [PR113498]

    get_template_info was crashing because it assumed that any decl with
    DECL_LANG_SPECIFIC could use DECL_TEMPLATE_INFO.  It's more complicated
than
    that.

            PR c++/113498

    gcc/cp/ChangeLog:

            * pt.cc (decl_template_info): New fn.
            (get_template_info): Use it.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/concepts-using4.C: New test.

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

* [Bug c++/113498] [14 regression] ICE in GCC trunk: tree check: have using_decl in get_template_info, at cp/pt.cc:357 since r14-6064
  2024-01-19  6:35 [Bug c++/113498] New: ICE in GCC trunk: tree check: have using_decl in get_template_info, at cp/pt.cc:357 bobmiller at nvidia dot com
                   ` (5 preceding siblings ...)
  2024-01-19 19:23 ` cvs-commit at gcc dot gnu.org
@ 2024-01-19 19:24 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2024-01-19 19:24 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

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

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2024-01-19 19:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-19  6:35 [Bug c++/113498] New: ICE in GCC trunk: tree check: have using_decl in get_template_info, at cp/pt.cc:357 bobmiller at nvidia dot com
2024-01-19  6:44 ` [Bug c++/113498] " bobmiller at nvidia dot com
2024-01-19  7:58 ` bobmiller at nvidia dot com
2024-01-19  9:19 ` [Bug c++/113498] [14 regression] " rguenth at gcc dot gnu.org
2024-01-19 16:15 ` [Bug c++/113498] [14 regression] ICE in GCC trunk: tree check: have using_decl in get_template_info, at cp/pt.cc:357 since r14-6064 jakub at gcc dot gnu.org
2024-01-19 17:01 ` jason at gcc dot gnu.org
2024-01-19 19:23 ` cvs-commit at gcc dot gnu.org
2024-01-19 19:24 ` jason 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).