public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110809] New: ICE: in unify, at cp/pt.cc:25226 with floating-point NTTPs
@ 2023-07-25 18:58 ed at catmur dot uk
  2023-07-25 19:04 ` [Bug c++/110809] " mpolacek at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: ed at catmur dot uk @ 2023-07-25 18:58 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110809
           Summary: ICE: in unify, at cp/pt.cc:25226 with floating-point
                    NTTPs
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ed at catmur dot uk
  Target Milestone: ---

#include <boost/hana.hpp>
using A = double;
template<A> struct S {};
auto x = boost::hana::make_map(
    boost::hana::make_pair(boost::hana::type_c<S<A(1)>>, 1),
    boost::hana::make_pair(boost::hana::type_c<S<A(2)>>, 2))[
        boost::hana::type_c<S<A(1)>>];

/opt/compiler-explorer/libs/boost_1_82_0/boost/hana/detail/hash_table.hpp:51:62:
internal compiler error: in unify, at cp/pt.cc:25226
   51 |         using type =
decltype(detail::find_indices_impl<Hash>(std::declval<Map>()));
      |                              
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
0x246af2e internal_error(char const*, ...)
        ???:0
0xac8ab6 fancy_abort(char const*, int, char const*)
        ???:0
0xd01e11 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
        ???:0
0xaf7db9 build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        ???:0
0xd2379c finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ???:0
0xcddfef tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xcde6fc tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xd06d50 instantiate_class_template(tree_node*)
        ???:0
0xd5954f complete_type_or_maybe_complain(tree_node*, tree_node*, int)
        ???:0
0xcdf1a7 tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xcde6fc tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xd06d50 instantiate_class_template(tree_node*)
        ???:0
0xd5954f complete_type_or_maybe_complain(tree_node*, tree_node*, int)
        ???:0
0xcdf1a7 tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xcde6fc tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xcd6618 instantiate_decl(tree_node*, bool, bool)
        ???:0
0xbb8461 maybe_instantiate_decl(tree_node*)
        ???:0
0xbb9ebf mark_used(tree_node*, int)
        ???:0
0xaf673e build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
        ???:0
0xd22eaf finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ???:0

Changing `A` to `int` makes it compile, so this is a problem with
floating-point NTTPs.

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

* [Bug c++/110809] ICE: in unify, at cp/pt.cc:25226 with floating-point NTTPs
  2023-07-25 18:58 [Bug c++/110809] New: ICE: in unify, at cp/pt.cc:25226 with floating-point NTTPs ed at catmur dot uk
@ 2023-07-25 19:04 ` mpolacek at gcc dot gnu.org
  2023-07-25 22:34 ` pinskia at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-07-25 19:04 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
                 CC|                            |mpolacek at gcc dot gnu.org
   Last reconfirmed|                            |2023-07-25

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.  Even 11 ICEs; 10 gives errors.

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

* [Bug c++/110809] ICE: in unify, at cp/pt.cc:25226 with floating-point NTTPs
  2023-07-25 18:58 [Bug c++/110809] New: ICE: in unify, at cp/pt.cc:25226 with floating-point NTTPs ed at catmur dot uk
  2023-07-25 19:04 ` [Bug c++/110809] " mpolacek at gcc dot gnu.org
@ 2023-07-25 22:34 ` pinskia at gcc dot gnu.org
  2023-07-26  5:04 ` pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-25 22:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reducing ...

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

* [Bug c++/110809] ICE: in unify, at cp/pt.cc:25226 with floating-point NTTPs
  2023-07-25 18:58 [Bug c++/110809] New: ICE: in unify, at cp/pt.cc:25226 with floating-point NTTPs ed at catmur dot uk
  2023-07-25 19:04 ` [Bug c++/110809] " mpolacek at gcc dot gnu.org
  2023-07-25 22:34 ` pinskia at gcc dot gnu.org
@ 2023-07-26  5:04 ` pinskia at gcc dot gnu.org
  2023-07-26  5:06 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-26  5:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I reduced it to an invalid code (I don't know if the original was valid or
not):
```
template <double> struct S {};
template <typename Hash, int i> struct bucket {};
template <typename Hash, int i>
int find_indices_impl(bucket<Hash, i> const &);
using HashTable = bucket<S<2.0>, 1>;
auto t = find_indices_impl<S<1.0>>(HashTable{});
```

If I remove the i template argument, GCC correctly rejects the above. If I
change 1.0 and 2.0 to the same value, GCC accepts the code correctly.


Note clang does not support double as a non-type template argument (yet).

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

* [Bug c++/110809] ICE: in unify, at cp/pt.cc:25226 with floating-point NTTPs
  2023-07-25 18:58 [Bug c++/110809] New: ICE: in unify, at cp/pt.cc:25226 with floating-point NTTPs ed at catmur dot uk
                   ` (2 preceding siblings ...)
  2023-07-26  5:04 ` pinskia at gcc dot gnu.org
@ 2023-07-26  5:06 ` pinskia at gcc dot gnu.org
  2023-07-26  5:29 ` ed at catmur dot uk
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-26  5:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note if we do:
```
struct A{}; struct B{};
template <auto> struct S {};
template <typename Hash, int i> struct bucket {};
template <typename Hash, int i>
int find_indices_impl(bucket<Hash, i> const &);
using HashTable = bucket<S<A{}>, 1>;
auto t = find_indices_impl<S<B{}>>(HashTable{});
```
GCC correctly rejects the above but if we replace B{} with a floating point
value, we get the ICE (but not if we replace A{}). Maybe that will give an hint
of what is going wrong in the end.

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

* [Bug c++/110809] ICE: in unify, at cp/pt.cc:25226 with floating-point NTTPs
  2023-07-25 18:58 [Bug c++/110809] New: ICE: in unify, at cp/pt.cc:25226 with floating-point NTTPs ed at catmur dot uk
                   ` (3 preceding siblings ...)
  2023-07-26  5:06 ` pinskia at gcc dot gnu.org
@ 2023-07-26  5:29 ` ed at catmur dot uk
  2023-07-26  5:38 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ed at catmur dot uk @ 2023-07-26  5:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Ed Catmur <ed at catmur dot uk> ---
The original code is valid. A reduced valid case would be:
```
template <double> struct S {};
template <typename Hash, int i> struct bucket {};
template <typename Hash, int i>
int find_indices_impl(bucket<Hash, i> const &);
struct HashTable : bucket<S<1.>, 1>, bucket<S<2.>, 2> {};
auto t = find_indices_impl<S<1.>>(HashTable{});
```

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

* [Bug c++/110809] ICE: in unify, at cp/pt.cc:25226 with floating-point NTTPs
  2023-07-25 18:58 [Bug c++/110809] New: ICE: in unify, at cp/pt.cc:25226 with floating-point NTTPs ed at catmur dot uk
                   ` (4 preceding siblings ...)
  2023-07-26  5:29 ` ed at catmur dot uk
@ 2023-07-26  5:38 ` pinskia at gcc dot gnu.org
  2023-07-26 14:18 ` ppalka at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-26  5:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Ed Catmur from comment #5)
> The original code is valid. A reduced valid case would be:
> ```
> template <double> struct S {};
> template <typename Hash, int i> struct bucket {};
> template <typename Hash, int i>
> int find_indices_impl(bucket<Hash, i> const &);
> struct HashTable : bucket<S<1.>, 1>, bucket<S<2.>, 2> {};
> auto t = find_indices_impl<S<1.>>(HashTable{});
> ```

Oh yes and yes the above looks like the original code even.
It is definitely trying to match bucket<S<2.>, 2> base class with bucket<S<1.>,
i> though and it is ICEing there.

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

* [Bug c++/110809] ICE: in unify, at cp/pt.cc:25226 with floating-point NTTPs
  2023-07-25 18:58 [Bug c++/110809] New: ICE: in unify, at cp/pt.cc:25226 with floating-point NTTPs ed at catmur dot uk
                   ` (5 preceding siblings ...)
  2023-07-26  5:38 ` pinskia at gcc dot gnu.org
@ 2023-07-26 14:18 ` ppalka at gcc dot gnu.org
  2023-07-26 20:52 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-07-26 14:18 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

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

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

* [Bug c++/110809] ICE: in unify, at cp/pt.cc:25226 with floating-point NTTPs
  2023-07-25 18:58 [Bug c++/110809] New: ICE: in unify, at cp/pt.cc:25226 with floating-point NTTPs ed at catmur dot uk
                   ` (6 preceding siblings ...)
  2023-07-26 14:18 ` ppalka at gcc dot gnu.org
@ 2023-07-26 20:52 ` cvs-commit at gcc dot gnu.org
  2023-07-26 20:53 ` ppalka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-26 20:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 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:744e1f35266dbd6b6fb95c7e8422562815f8b56f

commit r14-2806-g744e1f35266dbd6b6fb95c7e8422562815f8b56f
Author: Patrick Palka <ppalka@redhat.com>
Date:   Wed Jul 26 16:52:13 2023 -0400

    c++: unifying REAL_CSTs [PR110809]

    This teaches unify how to compare two REAL_CSTs.

            PR c++/110809

    gcc/cp/ChangeLog:

            * pt.cc (unify) <case INTEGER_CST>: Generalize to handle
            REAL_CST as well.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/nontype-float3.C: New test.

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

* [Bug c++/110809] ICE: in unify, at cp/pt.cc:25226 with floating-point NTTPs
  2023-07-25 18:58 [Bug c++/110809] New: ICE: in unify, at cp/pt.cc:25226 with floating-point NTTPs ed at catmur dot uk
                   ` (7 preceding siblings ...)
  2023-07-26 20:52 ` cvs-commit at gcc dot gnu.org
@ 2023-07-26 20:53 ` ppalka at gcc dot gnu.org
  2023-07-27 14:35 ` cvs-commit at gcc dot gnu.org
  2024-01-24 16:32 ` ppalka at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-07-26 20:53 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.3

--- Comment #8 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed on trunk so far.

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

* [Bug c++/110809] ICE: in unify, at cp/pt.cc:25226 with floating-point NTTPs
  2023-07-25 18:58 [Bug c++/110809] New: ICE: in unify, at cp/pt.cc:25226 with floating-point NTTPs ed at catmur dot uk
                   ` (8 preceding siblings ...)
  2023-07-26 20:53 ` ppalka at gcc dot gnu.org
@ 2023-07-27 14:35 ` cvs-commit at gcc dot gnu.org
  2024-01-24 16:32 ` ppalka at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-27 14:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:8e811edea309b2097e23cde48ee6fb6467a9094d

commit r13-7614-g8e811edea309b2097e23cde48ee6fb6467a9094d
Author: Patrick Palka <ppalka@redhat.com>
Date:   Wed Jul 26 16:52:13 2023 -0400

    c++: unifying REAL_CSTs [PR110809]

    This teaches unify how to compare two REAL_CSTs.

            PR c++/110809

    gcc/cp/ChangeLog:

            * pt.cc (unify) <case INTEGER_CST>: Generalize to handle
            REAL_CST as well.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/nontype-float3.C: New test.

    (cherry picked from commit 744e1f35266dbd6b6fb95c7e8422562815f8b56f)

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

* [Bug c++/110809] ICE: in unify, at cp/pt.cc:25226 with floating-point NTTPs
  2023-07-25 18:58 [Bug c++/110809] New: ICE: in unify, at cp/pt.cc:25226 with floating-point NTTPs ed at catmur dot uk
                   ` (9 preceding siblings ...)
  2023-07-27 14:35 ` cvs-commit at gcc dot gnu.org
@ 2024-01-24 16:32 ` ppalka at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-01-24 16:32 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

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

--- Comment #10 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 13.3 / 14.

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

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

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-25 18:58 [Bug c++/110809] New: ICE: in unify, at cp/pt.cc:25226 with floating-point NTTPs ed at catmur dot uk
2023-07-25 19:04 ` [Bug c++/110809] " mpolacek at gcc dot gnu.org
2023-07-25 22:34 ` pinskia at gcc dot gnu.org
2023-07-26  5:04 ` pinskia at gcc dot gnu.org
2023-07-26  5:06 ` pinskia at gcc dot gnu.org
2023-07-26  5:29 ` ed at catmur dot uk
2023-07-26  5:38 ` pinskia at gcc dot gnu.org
2023-07-26 14:18 ` ppalka at gcc dot gnu.org
2023-07-26 20:52 ` cvs-commit at gcc dot gnu.org
2023-07-26 20:53 ` ppalka at gcc dot gnu.org
2023-07-27 14:35 ` cvs-commit at gcc dot gnu.org
2024-01-24 16:32 ` 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).