public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108104] New: ICE in unify, at cp/pt.c:24333 with template partial specialization
@ 2022-12-14 16:57 gawain.bolton at free dot fr
2022-12-14 18:39 ` [Bug c++/108104] ICE in unify, at cp/pt.c:24333 with template partial specialization and pointer to memeber function and nullptr pinskia at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: gawain.bolton at free dot fr @ 2022-12-14 16:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108104
Bug ID: 108104
Summary: ICE in unify, at cp/pt.c:24333 with template partial
specialization
Product: gcc
Version: 12.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: gawain.bolton at free dot fr
Target Milestone: ---
Created attachment 54091
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54091&action=edit
ICE with template partial specialization - No issue if WITH_STATE is 0 i.e. if
the State parameter is absent
Please see attached file which causes an internal compiler error.
Note that there is no issue if the "State" template argument is removed as can
be shown if you set WITH_STATE to 0.
No issue found with clang >= v13.0
ICE found with all versions of GCC I tried (from GCC v4.9.4 to GCC v12.2)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/108104] ICE in unify, at cp/pt.c:24333 with template partial specialization and pointer to memeber function and nullptr
2022-12-14 16:57 [Bug c++/108104] New: ICE in unify, at cp/pt.c:24333 with template partial specialization gawain.bolton at free dot fr
@ 2022-12-14 18:39 ` pinskia at gcc dot gnu.org
2022-12-14 18:45 ` pinskia at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-14 18:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108104
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-valid-code
Summary|ICE in unify, at |ICE in unify, at
|cp/pt.c:24333 with template |cp/pt.c:24333 with template
|partial specialization |partial specialization and
| |pointer to memeber function
| |and nullptr
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced testcase:
```
struct ss {
void h();
};
template <int, void (ss::*m)()> struct Fred {};
template <int state> struct Fred<state, nullptr> {};
Fred<1, &ss::h> f1;
```
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/108104] ICE in unify, at cp/pt.c:24333 with template partial specialization and pointer to memeber function and nullptr
2022-12-14 16:57 [Bug c++/108104] New: ICE in unify, at cp/pt.c:24333 with template partial specialization gawain.bolton at free dot fr
2022-12-14 18:39 ` [Bug c++/108104] ICE in unify, at cp/pt.c:24333 with template partial specialization and pointer to memeber function and nullptr pinskia at gcc dot gnu.org
@ 2022-12-14 18:45 ` pinskia at gcc dot gnu.org
2022-12-14 18:50 ` pinskia at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-14 18:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108104
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Known to fail| |5.1.0
Last reconfirmed| |2022-12-14
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Before GCC 5, we produced:
<source>:5:48: internal compiler error: unexpected expression '(void
(ss::*)())(nullptr)' of kind cast_expr
template <int state> struct Fred<state, nullptr> {};
^
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/108104] ICE in unify, at cp/pt.c:24333 with template partial specialization and pointer to memeber function and nullptr
2022-12-14 16:57 [Bug c++/108104] New: ICE in unify, at cp/pt.c:24333 with template partial specialization gawain.bolton at free dot fr
2022-12-14 18:39 ` [Bug c++/108104] ICE in unify, at cp/pt.c:24333 with template partial specialization and pointer to memeber function and nullptr pinskia at gcc dot gnu.org
2022-12-14 18:45 ` pinskia at gcc dot gnu.org
@ 2022-12-14 18:50 ` pinskia at gcc dot gnu.org
2022-12-14 23:50 ` ppalka at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-14 18:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108104
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
It is definitely a pointer to member function issue.
I tried with just a pointer to a function and it worked and even a pointer to a
member field works too:
```
struct ss {
int t;
};
template <int, int ss::*m> struct Fred {};
template <int state> struct Fred<state, nullptr> {};
Fred<1, &ss::t> f1;
```
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/108104] ICE in unify, at cp/pt.c:24333 with template partial specialization and pointer to memeber function and nullptr
2022-12-14 16:57 [Bug c++/108104] New: ICE in unify, at cp/pt.c:24333 with template partial specialization gawain.bolton at free dot fr
` (2 preceding siblings ...)
2022-12-14 18:50 ` pinskia at gcc dot gnu.org
@ 2022-12-14 23:50 ` ppalka at gcc dot gnu.org
2022-12-15 20:39 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-12-14 23:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108104
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
Status|NEW |ASSIGNED
CC| |ppalka at gcc dot gnu.org
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/108104] ICE in unify, at cp/pt.c:24333 with template partial specialization and pointer to memeber function and nullptr
2022-12-14 16:57 [Bug c++/108104] New: ICE in unify, at cp/pt.c:24333 with template partial specialization gawain.bolton at free dot fr
` (3 preceding siblings ...)
2022-12-14 23:50 ` ppalka at gcc dot gnu.org
@ 2022-12-15 20:39 ` cvs-commit at gcc dot gnu.org
2022-12-15 20:40 ` ppalka at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-12-15 20:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108104
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:38304846d18d6bb14b0fd6c627c5c6d43a814d01
commit r13-4728-g38304846d18d6bb14b0fd6c627c5c6d43a814d01
Author: Patrick Palka <ppalka@redhat.com>
Date: Thu Dec 15 15:38:47 2022 -0500
c++: partial ordering with memfn ptr cst [PR108104]
Here we're triggering an overzealous assert in unify during partial
ordering since the member function pointer constants are represented as
ordinary CONSTRUCTORs (with TYPE_PTRMEMFUNC_P TREE_TYPE) but the assert
expects COMPOUND_LITERAL_P constructors.
PR c++/108104
gcc/cp/ChangeLog:
* pt.cc (unify) <default>: Relax assert to accept any
CONSTRUCTOR parm, not just COMPOUND_LITERAL_P one.
gcc/testsuite/ChangeLog:
* g++.dg/template/ptrmem33.C: New test.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/108104] ICE in unify, at cp/pt.c:24333 with template partial specialization and pointer to memeber function and nullptr
2022-12-14 16:57 [Bug c++/108104] New: ICE in unify, at cp/pt.c:24333 with template partial specialization gawain.bolton at free dot fr
` (4 preceding siblings ...)
2022-12-15 20:39 ` cvs-commit at gcc dot gnu.org
@ 2022-12-15 20:40 ` ppalka at gcc dot gnu.org
2022-12-19 16:54 ` cvs-commit at gcc dot gnu.org
2022-12-19 16:56 ` ppalka at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-12-15 20:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108104
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |12.3
--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed on trunk so far
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/108104] ICE in unify, at cp/pt.c:24333 with template partial specialization and pointer to memeber function and nullptr
2022-12-14 16:57 [Bug c++/108104] New: ICE in unify, at cp/pt.c:24333 with template partial specialization gawain.bolton at free dot fr
` (5 preceding siblings ...)
2022-12-15 20:40 ` ppalka at gcc dot gnu.org
@ 2022-12-19 16:54 ` cvs-commit at gcc dot gnu.org
2022-12-19 16:56 ` ppalka at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-12-19 16:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108104
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:6e09ca0cba625b8bb2ef50f9df726eb455ebb813
commit r12-8997-g6e09ca0cba625b8bb2ef50f9df726eb455ebb813
Author: Patrick Palka <ppalka@redhat.com>
Date: Thu Dec 15 15:38:47 2022 -0500
c++: partial ordering with memfn ptr cst [PR108104]
Here we're triggering an overzealous assert in unify during partial
ordering since the member function pointer constants are represented as
ordinary CONSTRUCTORs (with TYPE_PTRMEMFUNC_P TREE_TYPE) but the assert
expects COMPOUND_LITERAL_P constructors.
PR c++/108104
gcc/cp/ChangeLog:
* pt.cc (unify) <default>: Relax assert to accept any
CONSTRUCTOR parm, not just COMPOUND_LITERAL_P one.
gcc/testsuite/ChangeLog:
* g++.dg/template/ptrmem33.C: New test.
(cherry picked from commit 38304846d18d6bb14b0fd6c627c5c6d43a814d01)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/108104] ICE in unify, at cp/pt.c:24333 with template partial specialization and pointer to memeber function and nullptr
2022-12-14 16:57 [Bug c++/108104] New: ICE in unify, at cp/pt.c:24333 with template partial specialization gawain.bolton at free dot fr
` (6 preceding siblings ...)
2022-12-19 16:54 ` cvs-commit at gcc dot gnu.org
@ 2022-12-19 16:56 ` ppalka at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-12-19 16:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108104
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #7 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 12.3/13, thanks for the bug report.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2022-12-19 16:56 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-14 16:57 [Bug c++/108104] New: ICE in unify, at cp/pt.c:24333 with template partial specialization gawain.bolton at free dot fr
2022-12-14 18:39 ` [Bug c++/108104] ICE in unify, at cp/pt.c:24333 with template partial specialization and pointer to memeber function and nullptr pinskia at gcc dot gnu.org
2022-12-14 18:45 ` pinskia at gcc dot gnu.org
2022-12-14 18:50 ` pinskia at gcc dot gnu.org
2022-12-14 23:50 ` ppalka at gcc dot gnu.org
2022-12-15 20:39 ` cvs-commit at gcc dot gnu.org
2022-12-15 20:40 ` ppalka at gcc dot gnu.org
2022-12-19 16:54 ` cvs-commit at gcc dot gnu.org
2022-12-19 16:56 ` ppalka 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).