public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/112288] New: internal compiler error: in instantiate_decl, at cp/pt.cc:26861
@ 2023-10-30 12:07 falemagn at gmail dot com
2023-10-30 12:09 ` [Bug c++/112288] " falemagn at gmail dot com
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: falemagn at gmail dot com @ 2023-10-30 12:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112288
Bug ID: 112288
Summary: internal compiler error: in instantiate_decl, at
cp/pt.cc:26861
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: falemagn at gmail dot com
Target Milestone: ---
It's a regression, it compiles fine with v13.2.1.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/112288] internal compiler error: in instantiate_decl, at cp/pt.cc:26861
2023-10-30 12:07 [Bug c++/112288] New: internal compiler error: in instantiate_decl, at cp/pt.cc:26861 falemagn at gmail dot com
@ 2023-10-30 12:09 ` falemagn at gmail dot com
2023-10-30 14:22 ` [Bug c++/112288] [14 Regression] ICE - " rguenth at gcc dot gnu.org
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: falemagn at gmail dot com @ 2023-10-30 12:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112288
Fabio Alemagna <falemagn at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #56472|0 |1
is obsolete| |
CC| |falemagn at gmail dot com
--- Comment #1 from Fabio Alemagna <falemagn at gmail dot com> ---
Created attachment 56474
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56474&action=edit
Generated with -freport-bug
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/112288] [14 Regression] ICE - internal compiler error: in instantiate_decl, at cp/pt.cc:26861
2023-10-30 12:07 [Bug c++/112288] New: internal compiler error: in instantiate_decl, at cp/pt.cc:26861 falemagn at gmail dot com
2023-10-30 12:09 ` [Bug c++/112288] " falemagn at gmail dot com
@ 2023-10-30 14:22 ` rguenth at gcc dot gnu.org
2023-10-30 16:28 ` [Bug c++/112288] [11/12/13/14 " mpolacek at gcc dot gnu.org
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-10-30 14:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112288
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |needs-bisection
Target Milestone|--- |14.0
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/112288] [11/12/13/14 Regression] ICE - internal compiler error: in instantiate_decl, at cp/pt.cc:26861
2023-10-30 12:07 [Bug c++/112288] New: internal compiler error: in instantiate_decl, at cp/pt.cc:26861 falemagn at gmail dot com
2023-10-30 12:09 ` [Bug c++/112288] " falemagn at gmail dot com
2023-10-30 14:22 ` [Bug c++/112288] [14 Regression] ICE - " rguenth at gcc dot gnu.org
@ 2023-10-30 16:28 ` mpolacek at gcc dot gnu.org
2023-10-30 16:31 ` mpolacek at gcc dot gnu.org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-10-30 16:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112288
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords|needs-bisection |ice-on-valid-code
Summary|[14 Regression] ICE - |[11/12/13/14 Regression]
|internal compiler error: in |ICE - internal compiler
|instantiate_decl, at |error: in instantiate_decl,
|cp/pt.cc:26861 |at cp/pt.cc:26861
CC| |mpolacek at gcc dot gnu.org,
| |ppalka at gcc dot gnu.org
Last reconfirmed| |2023-10-30
Priority|P3 |P2
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed. Started with r6-6830-g20a0c6f9bdbd78:
commit 20a0c6f9bdbd781ed5d413a10a06764a174dc394
Author: Patrick Palka <ppalka@gcc.gnu.org>
Date: Mon Feb 8 23:02:50 2016 +0000
Fix PR c++/69283 (auto deduction fails when ADL is required)
but reverting that fix doesn't make the ICE go away.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/112288] [11/12/13/14 Regression] ICE - internal compiler error: in instantiate_decl, at cp/pt.cc:26861
2023-10-30 12:07 [Bug c++/112288] New: internal compiler error: in instantiate_decl, at cp/pt.cc:26861 falemagn at gmail dot com
` (2 preceding siblings ...)
2023-10-30 16:28 ` [Bug c++/112288] [11/12/13/14 " mpolacek at gcc dot gnu.org
@ 2023-10-30 16:31 ` mpolacek at gcc dot gnu.org
2023-10-30 17:43 ` falemagn at gmail dot com
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-10-30 16:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112288
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
// PR c++/112288
namespace {
template <typename Context, int Start = 0, int Step = 1>
class counter
{
public:
template <typename Unique>
static constexpr int next()
{
return next<Unique>(0)*Step+Start;
}
private:
template <int I>
struct slot
{
template <typename Dummy>
friend constexpr auto slot_allocated(Dummy, slot<I>);
};
template <int I>
struct allocate_slot {
template <typename Dummy>
friend constexpr auto slot_allocated(Dummy, slot<I>) {
return true;
}
enum { value = I };
};
template <typename Unique, int I = 0, int Dummy = 0, bool =
slot_allocated(Dummy, slot<I>())>
static constexpr int next(int)
{
return next<Unique, I+1>(0);
}
template <typename Unique, int I = 0>
static constexpr int next(double)
{
return allocate_slot<I>::value;
}
};
}
template <int I>
struct U;
struct C: counter<U<1>>{};
int a = C::next<struct unique_1>();
int b = C::next<struct unique_2>();
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/112288] [11/12/13/14 Regression] ICE - internal compiler error: in instantiate_decl, at cp/pt.cc:26861
2023-10-30 12:07 [Bug c++/112288] New: internal compiler error: in instantiate_decl, at cp/pt.cc:26861 falemagn at gmail dot com
` (3 preceding siblings ...)
2023-10-30 16:31 ` mpolacek at gcc dot gnu.org
@ 2023-10-30 17:43 ` falemagn at gmail dot com
2023-10-30 17:57 ` pinskia at gcc dot gnu.org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: falemagn at gmail dot com @ 2023-10-30 17:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112288
--- Comment #4 from Fabio Alemagna <falemagn at gmail dot com> ---
(In reply to Marek Polacek from comment #2)
> Confirmed. Started with r6-6830-g20a0c6f9bdbd78:
>
> commit 20a0c6f9bdbd781ed5d413a10a06764a174dc394
> Author: Patrick Palka <ppalka@gcc.gnu.org>
> Date: Mon Feb 8 23:02:50 2016 +0000
>
> Fix PR c++/69283 (auto deduction fails when ADL is required)
>
> but reverting that fix doesn't make the ICE go away.
That seems waaaay to old to be the cause of the issue.
As said, it works with v13.2.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/112288] [11/12/13/14 Regression] ICE - internal compiler error: in instantiate_decl, at cp/pt.cc:26861
2023-10-30 12:07 [Bug c++/112288] New: internal compiler error: in instantiate_decl, at cp/pt.cc:26861 falemagn at gmail dot com
` (4 preceding siblings ...)
2023-10-30 17:43 ` falemagn at gmail dot com
@ 2023-10-30 17:57 ` pinskia at gcc dot gnu.org
2023-10-30 18:03 ` mpolacek at gcc dot gnu.org
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-30 17:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112288
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Fabio Alemagna from comment #4)
> (In reply to Marek Polacek from comment #2)
> > Confirmed. Started with r6-6830-g20a0c6f9bdbd78:
> >
> > commit 20a0c6f9bdbd781ed5d413a10a06764a174dc394
> > Author: Patrick Palka <ppalka@gcc.gnu.org>
> > Date: Mon Feb 8 23:02:50 2016 +0000
> >
> > Fix PR c++/69283 (auto deduction fails when ADL is required)
> >
> > but reverting that fix doesn't make the ICE go away.
>
> That seems waaaay to old to be the cause of the issue.
>
> As said, it works with v13.2.1
Note the trunk has extra checkings enabled compared to a release if not
configured with `--enable-checking=release` so you might be seeing that effect
here.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/112288] [11/12/13/14 Regression] ICE - internal compiler error: in instantiate_decl, at cp/pt.cc:26861
2023-10-30 12:07 [Bug c++/112288] New: internal compiler error: in instantiate_decl, at cp/pt.cc:26861 falemagn at gmail dot com
` (5 preceding siblings ...)
2023-10-30 17:57 ` pinskia at gcc dot gnu.org
@ 2023-10-30 18:03 ` mpolacek at gcc dot gnu.org
2023-10-30 20:55 ` falemagn at gmail dot com
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-10-30 18:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112288
--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #5)
> (In reply to Fabio Alemagna from comment #4)
> > (In reply to Marek Polacek from comment #2)
> > > Confirmed. Started with r6-6830-g20a0c6f9bdbd78:
> > >
> > > commit 20a0c6f9bdbd781ed5d413a10a06764a174dc394
> > > Author: Patrick Palka <ppalka@gcc.gnu.org>
> > > Date: Mon Feb 8 23:02:50 2016 +0000
> > >
> > > Fix PR c++/69283 (auto deduction fails when ADL is required)
> > >
> > > but reverting that fix doesn't make the ICE go away.
> >
> > That seems waaaay to old to be the cause of the issue.
> >
> > As said, it works with v13.2.1
>
> Note the trunk has extra checkings enabled compared to a release if not
> configured with `--enable-checking=release` so you might be seeing that
> effect here.
That's right. Trunk configured with --enable-checking=release doesn't ICE,
either.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/112288] [11/12/13/14 Regression] ICE - internal compiler error: in instantiate_decl, at cp/pt.cc:26861
2023-10-30 12:07 [Bug c++/112288] New: internal compiler error: in instantiate_decl, at cp/pt.cc:26861 falemagn at gmail dot com
` (6 preceding siblings ...)
2023-10-30 18:03 ` mpolacek at gcc dot gnu.org
@ 2023-10-30 20:55 ` falemagn at gmail dot com
2023-11-03 17:27 ` [Bug c++/112288] [11/12/13/14 Regression] ICE - internal compiler error: in instantiate_decl, at cp/pt.cc:26861 since r6-6830-g20a0c6f9bdbd78 ppalka at gcc dot gnu.org
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: falemagn at gmail dot com @ 2023-10-30 20:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112288
--- Comment #7 from Fabio Alemagna <falemagn at gmail dot com> ---
(In reply to Marek Polacek from comment #6)
> (In reply to Andrew Pinski from comment #5)
> > (In reply to Fabio Alemagna from comment #4)
> > > (In reply to Marek Polacek from comment #2)
> > > > Confirmed. Started with r6-6830-g20a0c6f9bdbd78:
> > > >
> > > > commit 20a0c6f9bdbd781ed5d413a10a06764a174dc394
> > > > Author: Patrick Palka <ppalka@gcc.gnu.org>
> > > > Date: Mon Feb 8 23:02:50 2016 +0000
> > > >
> > > > Fix PR c++/69283 (auto deduction fails when ADL is required)
> > > >
> > > > but reverting that fix doesn't make the ICE go away.
> > >
> > > That seems waaaay to old to be the cause of the issue.
> > >
> > > As said, it works with v13.2.1
> >
> > Note the trunk has extra checkings enabled compared to a release if not
> > configured with `--enable-checking=release` so you might be seeing that
> > effect here.
>
> That's right. Trunk configured with --enable-checking=release doesn't ICE,
> either.
Oh! Didn't know that, my bad.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/112288] [11/12/13/14 Regression] ICE - internal compiler error: in instantiate_decl, at cp/pt.cc:26861 since r6-6830-g20a0c6f9bdbd78
2023-10-30 12:07 [Bug c++/112288] New: internal compiler error: in instantiate_decl, at cp/pt.cc:26861 falemagn at gmail dot com
` (7 preceding siblings ...)
2023-10-30 20:55 ` falemagn at gmail dot com
@ 2023-11-03 17:27 ` ppalka at gcc dot gnu.org
2023-11-03 17:36 ` falemagn at gmail dot com
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-11-03 17:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112288
--- Comment #8 from Patrick Palka <ppalka at gcc dot gnu.org> ---
The issue was probably latent before r6-6830. The testcase is kind of strange,
e.g. 'slot_allocated' is defined within 'allocate_slot' instead of within
'slot', which would arguably be more natural given that its 'slot<T>' function
parameter. And consecutive equivalent calls to 'next' apparently resolve to
different overloads due to 'slot_allocated' being defined only after we
instantiate the second 'next' overload.
Reduced:
template<class T>
struct slot {
template<class U>
friend constexpr bool slot_allocated(slot<T>, U);
};
template<class T>
struct allocate_slot {
template<class U>
friend constexpr bool slot_allocated(slot<T>, U) { return true; }
};
template<class T, bool = slot_allocated(slot<T>{}, 0)>
constexpr int next(int) { return 0; }
template<class T>
constexpr int next(...) { allocate_slot<T> s; return 42; }
// slot_allocated<slot<int>, int>() not defined yet
static_assert(next<int>(0) == 42);
// now it's defined
static_assert(next<int>(0) == 0);
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/112288] [11/12/13/14 Regression] ICE - internal compiler error: in instantiate_decl, at cp/pt.cc:26861 since r6-6830-g20a0c6f9bdbd78
2023-10-30 12:07 [Bug c++/112288] New: internal compiler error: in instantiate_decl, at cp/pt.cc:26861 falemagn at gmail dot com
` (8 preceding siblings ...)
2023-11-03 17:27 ` [Bug c++/112288] [11/12/13/14 Regression] ICE - internal compiler error: in instantiate_decl, at cp/pt.cc:26861 since r6-6830-g20a0c6f9bdbd78 ppalka at gcc dot gnu.org
@ 2023-11-03 17:36 ` falemagn at gmail dot com
2023-11-04 18:41 ` ppalka at gcc dot gnu.org
2024-05-07 7:42 ` [Bug c++/112288] [11/12/13/14/15 " rguenth at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: falemagn at gmail dot com @ 2023-11-03 17:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112288
--- Comment #9 from Fabio Alemagna <falemagn at gmail dot com> ---
(In reply to Patrick Palka from comment #8)
> The issue was probably latent before r6-6830. The testcase is kind of
> strange,
It's the "friend injection" technique. In this case, it's used to create a
compile-time counter. The specific test case uses templates in such a way as to
try and circumvent a diagnostic-related bug (bug #112267), which however
triggered this other bug.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/112288] [11/12/13/14 Regression] ICE - internal compiler error: in instantiate_decl, at cp/pt.cc:26861 since r6-6830-g20a0c6f9bdbd78
2023-10-30 12:07 [Bug c++/112288] New: internal compiler error: in instantiate_decl, at cp/pt.cc:26861 falemagn at gmail dot com
` (9 preceding siblings ...)
2023-11-03 17:36 ` falemagn at gmail dot com
@ 2023-11-04 18:41 ` ppalka at gcc dot gnu.org
2024-05-07 7:42 ` [Bug c++/112288] [11/12/13/14/15 " rguenth at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-11-04 18:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112288
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
--- Comment #10 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Fabio Alemagna from comment #9)
> (In reply to Patrick Palka from comment #8)
> > The issue was probably latent before r6-6830. The testcase is kind of
> > strange,
>
> It's the "friend injection" technique. In this case, it's used to create a
> compile-time counter. The specific test case uses templates in such a way as
> to try and circumvent a diagnostic-related bug (bug #112267), which however
> triggered this other bug.
Ah thanks, I see. I have a fix for the failing assert.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/112288] [11/12/13/14/15 Regression] ICE - internal compiler error: in instantiate_decl, at cp/pt.cc:26861 since r6-6830-g20a0c6f9bdbd78
2023-10-30 12:07 [Bug c++/112288] New: internal compiler error: in instantiate_decl, at cp/pt.cc:26861 falemagn at gmail dot com
` (10 preceding siblings ...)
2023-11-04 18:41 ` ppalka at gcc dot gnu.org
@ 2024-05-07 7:42 ` rguenth at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-05-07 7:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112288
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|14.0 |14.2
--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 14.1 is being released, retargeting bugs to GCC 14.2.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2024-05-07 7:42 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-30 12:07 [Bug c++/112288] New: internal compiler error: in instantiate_decl, at cp/pt.cc:26861 falemagn at gmail dot com
2023-10-30 12:09 ` [Bug c++/112288] " falemagn at gmail dot com
2023-10-30 14:22 ` [Bug c++/112288] [14 Regression] ICE - " rguenth at gcc dot gnu.org
2023-10-30 16:28 ` [Bug c++/112288] [11/12/13/14 " mpolacek at gcc dot gnu.org
2023-10-30 16:31 ` mpolacek at gcc dot gnu.org
2023-10-30 17:43 ` falemagn at gmail dot com
2023-10-30 17:57 ` pinskia at gcc dot gnu.org
2023-10-30 18:03 ` mpolacek at gcc dot gnu.org
2023-10-30 20:55 ` falemagn at gmail dot com
2023-11-03 17:27 ` [Bug c++/112288] [11/12/13/14 Regression] ICE - internal compiler error: in instantiate_decl, at cp/pt.cc:26861 since r6-6830-g20a0c6f9bdbd78 ppalka at gcc dot gnu.org
2023-11-03 17:36 ` falemagn at gmail dot com
2023-11-04 18:41 ` ppalka at gcc dot gnu.org
2024-05-07 7:42 ` [Bug c++/112288] [11/12/13/14/15 " 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).