public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/100474] New: ICE: in diagnose_trait_expr, at cp/constraint.cc:3706
@ 2021-05-07 14:49 hewillk at gmail dot com
  2021-05-10  7:56 ` [Bug c++/100474] " rguenth at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: hewillk at gmail dot com @ 2021-05-07 14:49 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100474
           Summary: ICE: in diagnose_trait_expr, at cp/constraint.cc:3706
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

This is a very tough one that is extremely difficult to reduce, but I will try.

https://godbolt.org/z/69GsTKrxe

#include <range/v3/all.hpp>

struct S {
  S(auto, auto...);
};

ranges::single_view<S> s(ranges::in_place, {0});

/opt/compiler-explorer/libs/rangesv3/trunk/include/concepts/concepts.hpp:1076:13:
internal compiler error: in diagnose_trait_expr, at cp/constraint.cc:3706
 1076 |             META_IS_CONSTRUCTIBLE(T, Args...);
      |             ^~~~~~~~~~~~~~~~~~~~~
0x1d05ab9 internal_error(char const*, ...)
        ???:0
0x6bdddd fancy_abort(char const*, int, char const*)
        ???:0
0x742edf diagnose_constraints(unsigned int, tree_node*, tree_node*)
        ???:0
0x959a35 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
        ???:0
0x6e2a4a build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
        ???:0
0x6e3f50 build_special_member_call(tree_node*, tree_node*, vec<tree_node*,
va_gc, vl_embed>**, tree_node*, int, int)
        ???:0
0x7f7fd8 build_aggr_init(tree_node*, tree_node*, int, int)
        ???:0
0x7b65f4 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        ???:0
0x8e533d c_parse_file()
        ???:0
0xa65902 c_common_parse_file()
        ???:0
Please submit a full bug report,
with preprocessed source if appropriate.

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

* [Bug c++/100474] ICE: in diagnose_trait_expr, at cp/constraint.cc:3706
  2021-05-07 14:49 [Bug c++/100474] New: ICE: in diagnose_trait_expr, at cp/constraint.cc:3706 hewillk at gmail dot com
@ 2021-05-10  7:56 ` rguenth at gcc dot gnu.org
  2021-08-12  7:47 ` enrico.seiler at hotmail dot de
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-10  7:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
guessing invalid - it would be nice if you state your opinion on the validness
of testcases you post.

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

* [Bug c++/100474] ICE: in diagnose_trait_expr, at cp/constraint.cc:3706
  2021-05-07 14:49 [Bug c++/100474] New: ICE: in diagnose_trait_expr, at cp/constraint.cc:3706 hewillk at gmail dot com
  2021-05-10  7:56 ` [Bug c++/100474] " rguenth at gcc dot gnu.org
@ 2021-08-12  7:47 ` enrico.seiler at hotmail dot de
  2021-08-12  8:18 ` hewillk at gmail dot com
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: enrico.seiler at hotmail dot de @ 2021-08-12  7:47 UTC (permalink / raw)
  To: gcc-bugs

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

Enrico Seiler <enrico.seiler at hotmail dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |enrico.seiler at hotmail dot de

--- Comment #2 from Enrico Seiler <enrico.seiler at hotmail dot de> ---
Here is a version not dependent on range-v3:

https://godbolt.org/z/PvdhxGo5c

```
template <typename T, typename... Args>
concept foo = __is_constructible(T, Args...);

class S
{
public:
    S() = delete;
    S(S const &) = default;
    S(S &&) = default;
    S & operator=(S const &) = default;
    S & operator=(S &&) = default;
    ~S() = default;
};

int main()
{
    // static_assert(!__is_constructible(S)); // OK
    // static_assert(!foo<S>); // OK
    // static_assert(__is_constructible(S)); // FAILS
    static_assert(foo<S>); // ICE
}
```

The parameter pack is not necessary for the ICE to occur, however, it is what
META_IS_CONSTRUCTIBLE is expanded to in range-v3.

Using `concept foo = static_cast<bool>(__is_constructible(T, Args...));` will
remove the ICE, even though `__is_constructible` should already return a bool.

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

* [Bug c++/100474] ICE: in diagnose_trait_expr, at cp/constraint.cc:3706
  2021-05-07 14:49 [Bug c++/100474] New: ICE: in diagnose_trait_expr, at cp/constraint.cc:3706 hewillk at gmail dot com
  2021-05-10  7:56 ` [Bug c++/100474] " rguenth at gcc dot gnu.org
  2021-08-12  7:47 ` enrico.seiler at hotmail dot de
@ 2021-08-12  8:18 ` hewillk at gmail dot com
  2022-03-29 19:23 ` ppalka at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hewillk at gmail dot com @ 2021-08-12  8:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from 康桓瑋 <hewillk at gmail dot com> ---
(In reply to Enrico Seiler from comment #2)
> Here is a version not dependent on range-v3:
> 
> https://godbolt.org/z/PvdhxGo5c
> 
> ```
> template <typename T, typename... Args>
> concept foo = __is_constructible(T, Args...);
> 
> class S
> {
> public:
>     S() = delete;
>     S(S const &) = default;
>     S(S &&) = default;
>     S & operator=(S const &) = default;
>     S & operator=(S &&) = default;
>     ~S() = default;
> };
> 
> int main()
> {
>     // static_assert(!__is_constructible(S)); // OK
>     // static_assert(!foo<S>); // OK
>     // static_assert(__is_constructible(S)); // FAILS
>     static_assert(foo<S>); // ICE
> }
> ```
> 
> The parameter pack is not necessary for the ICE to occur, however, it is
> what META_IS_CONSTRUCTIBLE is expanded to in range-v3.
> 
> Using `concept foo = static_cast<bool>(__is_constructible(T, Args...));`
> will remove the ICE, even though `__is_constructible` should already return
> a bool.

I can't imagine you can reduce it, thank you very much!

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

* [Bug c++/100474] ICE: in diagnose_trait_expr, at cp/constraint.cc:3706
  2021-05-07 14:49 [Bug c++/100474] New: ICE: in diagnose_trait_expr, at cp/constraint.cc:3706 hewillk at gmail dot com
                   ` (2 preceding siblings ...)
  2021-08-12  8:18 ` hewillk at gmail dot com
@ 2022-03-29 19:23 ` ppalka at gcc dot gnu.org
  2022-03-30 14:13 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-03-29 19:23 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppalka at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2022-03-29

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

* [Bug c++/100474] ICE: in diagnose_trait_expr, at cp/constraint.cc:3706
  2021-05-07 14:49 [Bug c++/100474] New: ICE: in diagnose_trait_expr, at cp/constraint.cc:3706 hewillk at gmail dot com
                   ` (3 preceding siblings ...)
  2022-03-29 19:23 ` ppalka at gcc dot gnu.org
@ 2022-03-30 14:13 ` cvs-commit at gcc dot gnu.org
  2022-03-30 14:16 ` ppalka at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-30 14:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:3aaf9bf77047aecc23072fe3db7f13ecff72a7cf

commit r12-7921-g3aaf9bf77047aecc23072fe3db7f13ecff72a7cf
Author: Patrick Palka <ppalka@redhat.com>
Date:   Wed Mar 30 10:13:11 2022 -0400

    c++: ICE with failed __is_constructible constraint [PR100474]

    Here we're crashing when diagnosing an unsatisfied __is_constructible
    constraint because diagnose_trait_expr doesn't recognize this trait
    (along with a bunch of other traits).  Fix this by adding handling for
    all remaining traits and removing the default case so that when adding a
    new trait we'll get a warning that diagnose_trait_expr needs to handle it.

            PR c++/100474

    gcc/cp/ChangeLog:

            * constraint.cc (diagnose_trait_expr): Handle all remaining
            traits appropriately.  Remove default case.

    gcc/testsuite/ChangeLog:

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

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

* [Bug c++/100474] ICE: in diagnose_trait_expr, at cp/constraint.cc:3706
  2021-05-07 14:49 [Bug c++/100474] New: ICE: in diagnose_trait_expr, at cp/constraint.cc:3706 hewillk at gmail dot com
                   ` (4 preceding siblings ...)
  2022-03-30 14:13 ` cvs-commit at gcc dot gnu.org
@ 2022-03-30 14:16 ` ppalka at gcc dot gnu.org
  2022-04-21  7:49 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-03-30 14:16 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.3
      Known to work|                            |12.0

--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 12 so far.

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

* [Bug c++/100474] ICE: in diagnose_trait_expr, at cp/constraint.cc:3706
  2021-05-07 14:49 [Bug c++/100474] New: ICE: in diagnose_trait_expr, at cp/constraint.cc:3706 hewillk at gmail dot com
                   ` (5 preceding siblings ...)
  2022-03-30 14:16 ` ppalka at gcc dot gnu.org
@ 2022-04-21  7:49 ` rguenth at gcc dot gnu.org
  2023-05-22  3:12 ` cvs-commit at gcc dot gnu.org
  2023-05-22  3:14 ` ppalka at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-04-21  7:49 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|11.3                        |11.4

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 11.3 is being released, retargeting bugs to GCC 11.4.

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

* [Bug c++/100474] ICE: in diagnose_trait_expr, at cp/constraint.cc:3706
  2021-05-07 14:49 [Bug c++/100474] New: ICE: in diagnose_trait_expr, at cp/constraint.cc:3706 hewillk at gmail dot com
                   ` (6 preceding siblings ...)
  2022-04-21  7:49 ` rguenth at gcc dot gnu.org
@ 2023-05-22  3:12 ` cvs-commit at gcc dot gnu.org
  2023-05-22  3:14 ` ppalka at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-22  3:12 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:c06cb992797903b4759dd26ad28e966babdc2b17

commit r11-10801-gc06cb992797903b4759dd26ad28e966babdc2b17
Author: Patrick Palka <ppalka@redhat.com>
Date:   Wed Mar 30 10:13:11 2022 -0400

    c++: ICE with failed __is_constructible constraint [PR100474]

    Here we're crashing when diagnosing an unsatisfied __is_constructible
    constraint because diagnose_trait_expr doesn't recognize this trait
    (along with a bunch of other traits).  Fix this by adding handling for
    all remaining traits and removing the default case so that when adding a
    new trait we'll get a warning that diagnose_trait_expr needs to handle it.

            PR c++/100474

    gcc/cp/ChangeLog:

            * constraint.cc (diagnose_trait_expr): Handle all remaining
            traits appropriately.  Remove default case.

    gcc/testsuite/ChangeLog:

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

    (cherry picked from commit 3aaf9bf77047aecc23072fe3db7f13ecff72a7cf)

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

* [Bug c++/100474] ICE: in diagnose_trait_expr, at cp/constraint.cc:3706
  2021-05-07 14:49 [Bug c++/100474] New: ICE: in diagnose_trait_expr, at cp/constraint.cc:3706 hewillk at gmail dot com
                   ` (7 preceding siblings ...)
  2023-05-22  3:12 ` cvs-commit at gcc dot gnu.org
@ 2023-05-22  3:14 ` ppalka at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-05-22  3:14 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #8 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 11.4+

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

end of thread, other threads:[~2023-05-22  3:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-07 14:49 [Bug c++/100474] New: ICE: in diagnose_trait_expr, at cp/constraint.cc:3706 hewillk at gmail dot com
2021-05-10  7:56 ` [Bug c++/100474] " rguenth at gcc dot gnu.org
2021-08-12  7:47 ` enrico.seiler at hotmail dot de
2021-08-12  8:18 ` hewillk at gmail dot com
2022-03-29 19:23 ` ppalka at gcc dot gnu.org
2022-03-30 14:13 ` cvs-commit at gcc dot gnu.org
2022-03-30 14:16 ` ppalka at gcc dot gnu.org
2022-04-21  7:49 ` rguenth at gcc dot gnu.org
2023-05-22  3:12 ` cvs-commit at gcc dot gnu.org
2023-05-22  3:14 ` 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).