Summary: | [14 Regression] ICE in redeclare_class_template, at cp/pt.cc:6391 on json-3.11.2 | ||
---|---|---|---|
Product: | gcc | Reporter: | Sergei Trofimovich <slyfox> |
Component: | c++ | Assignee: | Patrick Palka <ppalka> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | dcb314, enrico.seiler+gccbugs, ppalka, webrown.cpp |
Priority: | P3 | Keywords: | ice-on-valid-code |
Version: | 14.0 | ||
Target Milestone: | 14.0 | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2023-07-02 00:00:00 | |
Attachments: | bug.cpp.orig.xz |
Description
Sergei Trofimovich
2023-07-02 14:51:46 UTC
Created attachment 55452 [details]
bug.cpp.orig.xz
In case I reduced the file incorrectly attaching bug.cpp.orig.xz which should build with both gcc-13 and gcc-14.
Re-reducing it so it is warning free as the original was warning free. Better reduced testcase: ``` template <typename> class v {}; template <template <typename> class a = v> class basic_json {}; template <typename t> struct json_pointer { template <template <typename> class a> friend class basic_json; using type = t; }; json_pointer<int>::type t; json_pointer<basic_json<>>::type t1; ``` I see something similar when building dlib: /home/dcb38/rpmbuild/BUILD/dlib-65bce59a1512cf222dec01d3e0f29b612dd181f5/dlib/../dlib/dnn/core.h:799:22: internal compiler error: in redeclare_class_template, at cp/pt.cc:6391 The compiler seems to break as follows: /home/dcb38/gcc/results.20230701/bin/gcc /home/dcb38/gcc/results.20230703.asan.ubsan/bin/gcc /home/dcb38/rpmbuild/BUILD/dlib-65bce59a1512cf222dec01d3e0f29b612dd181f5/dlib/../dlib/dnn/core.h:799:22: internal compiler error: in redeclare_class_template, at cp/pt.cc:6391 $ /home/dcb38/gcc/results.20230701/bin/gcc -v 2>&1 | grep exp gcc version 14.0.0 20230630 (experimental) (c3c0ba5436170e01) $ /home/dcb38/gcc/results.20230703.asan.ubsan/bin/gcc -v 2>&1 | grep exp gcc version 14.0.0 20230703 (experimental) (9a856f67ee2f13ea) $ git log c3c0ba5436170e01..9a856f67ee2f13ea | grep -c "^commit" 45 $ The only C++ related commit in that range is: commit db38b285ba61c5b888adc0d117177bfd774c1153 Author: Patrick Palka <ppalka@redhat.com> Date: Fri Jun 30 15:05:22 2023 -0400 c++: fix up caching of level lowered ttps I have tried to start a git bisect and the current range is g:f3d87219dd502d5c .. g:9757e4440bd8755d. This is 15 commits. (In reply to David Binderman from comment #7) > I have tried to start a git bisect and the current range is > g:f3d87219dd502d5c .. g:9757e4440bd8755d. > > This is 15 commits. I messed this one up and started again. As expected, Patrick's commit seems to be the one: $ git bisect bad db38b285ba61c5b8 db38b285ba61c5b888adc0d117177bfd774c1153 is the first bad commit commit db38b285ba61c5b888adc0d117177bfd774c1153 Author: Patrick Palka <ppalka@redhat.com> Date: Fri Jun 30 15:05:22 2023 -0400 c++: fix up caching of level lowered ttps Simplified: template<template<class, class> class> class basic_json; template<class> struct json_pointer { template<template<class, class> class> friend class basic_json; }; template struct json_pointer<int>; template struct json_pointer<char>; template struct json_pointer<long>; The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>: https://gcc.gnu.org/g:2c60368ab5706a870a1a3be190acc4d673672c30 commit r14-2421-g2c60368ab5706a870a1a3be190acc4d673672c30 Author: Patrick Palka <ppalka@redhat.com> Date: Mon Jul 10 10:59:40 2023 -0400 c++: redeclare_class_template and ttps [PR110523] Now that we cache level-lowered ttps we can end up processing the same ttp multiple times via (multiple calls to) redeclare_class_template, so we can't assume a ttp's DECL_CONTEXT is initially empty. PR c++/110523 gcc/cp/ChangeLog: * pt.cc (redeclare_class_template): Relax the ttp DECL_CONTEXT assert, and downgrade it to a checking assert. gcc/testsuite/ChangeLog: * g++.dg/template/ttp37.C: New test. Fixed. I confirm ICE gone away for json-3.11.2. json-3.11.2 still odes not compile same as in https://gcc.gnu.org/PR110580 |