public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/103561] New: internal compiler error: segmentation fault when using decay copy (auto(x)) inside requires expression
@ 2021-12-05  4:12 cooky.ykooc922 at gmail dot com
  2021-12-06  8:39 ` [Bug c++/103561] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: cooky.ykooc922 at gmail dot com @ 2021-12-05  4:12 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103561
           Summary: internal compiler error: segmentation fault when using
                    decay copy (auto(x)) inside requires expression
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cooky.ykooc922 at gmail dot com
  Target Milestone: ---

When I attempt to use `auto(expr)` or `auto{expr}` inside `requires`
expression:

#include <concepts>
#include <utility>

template <typename T>
constexpr std::decay_t<T> decay_copy(T&& x) noexcept {
    return std::forward<T>(x);
}

void dummy() {
    int arr[] {1, 2, 1, 1};
    static_assert(requires {
        // ok:
        { arr } -> std::same_as<int(&)[4]>;
        // ok:
        { decay_copy(arr) } -> std::same_as<int*>;
        // but:
        { auto(arr) } -> std::same_as<int*>;
    });
}

The following will have an internal compiler error:
<source>: In function 'void dummy()':
<source>:17:19: internal compiler error: Segmentation fault
   17 |         { auto(arr) } -> std::same_as<int*>;
      |                   ^
0x20f3889 internal_error(char const*, ...)
        ???:0
0xa4571d template_parms_to_args(tree_node*)
        ???:0
0xa4f3c9 do_auto_deduction(tree_node*, tree_node*, tree_node*, int,
auto_deduction_context, tree_node*, int)
        ???:0
0xb3f325 build_functional_cast(unsigned int, tree_node*, tree_node*, int)
        ???:0
0xa2858d c_parse_file()
        ???:0
0xbb0f02 c_common_parse_file()
        ???:0

I'm using godbolt since GCC 12 is still experimental
(https://godbolt.org/z/M3GbGqMnb)

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

* [Bug c++/103561] internal compiler error: segmentation fault when using decay copy (auto(x)) inside requires expression
  2021-12-05  4:12 [Bug c++/103561] New: internal compiler error: segmentation fault when using decay copy (auto(x)) inside requires expression cooky.ykooc922 at gmail dot com
@ 2021-12-06  8:39 ` rguenth at gcc dot gnu.org
  2021-12-06 13:12 ` [Bug c++/103561] ICE: " marxin at gcc dot gnu.org
  2021-12-06 13:59 ` ppalka at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-12-06  8:39 UTC (permalink / raw)
  To: gcc-bugs

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

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> ---
clang rejects it

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

* [Bug c++/103561] ICE: segmentation fault when using decay copy (auto(x)) inside requires expression
  2021-12-05  4:12 [Bug c++/103561] New: internal compiler error: segmentation fault when using decay copy (auto(x)) inside requires expression cooky.ykooc922 at gmail dot com
  2021-12-06  8:39 ` [Bug c++/103561] " rguenth at gcc dot gnu.org
@ 2021-12-06 13:12 ` marxin at gcc dot gnu.org
  2021-12-06 13:59 ` ppalka at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-12-06 13:12 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|internal compiler error:    |ICE: segmentation fault
                   |segmentation fault when     |when using decay copy
                   |using decay copy (auto(x))  |(auto(x)) inside requires
                   |inside requires expression  |expression
                 CC|                            |marxin at gcc dot gnu.org,
                   |                            |mpolacek at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-12-06
     Ever confirmed|0                           |1

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r12-5386-g93810fd673654db9.

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

* [Bug c++/103561] ICE: segmentation fault when using decay copy (auto(x)) inside requires expression
  2021-12-05  4:12 [Bug c++/103561] New: internal compiler error: segmentation fault when using decay copy (auto(x)) inside requires expression cooky.ykooc922 at gmail dot com
  2021-12-06  8:39 ` [Bug c++/103561] " rguenth at gcc dot gnu.org
  2021-12-06 13:12 ` [Bug c++/103561] ICE: " marxin at gcc dot gnu.org
@ 2021-12-06 13:59 ` ppalka at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-12-06 13:59 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|NEW                         |RESOLVED
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
essentially a dup of PR103408

*** This bug has been marked as a duplicate of bug 103408 ***

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

end of thread, other threads:[~2021-12-06 13:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-05  4:12 [Bug c++/103561] New: internal compiler error: segmentation fault when using decay copy (auto(x)) inside requires expression cooky.ykooc922 at gmail dot com
2021-12-06  8:39 ` [Bug c++/103561] " rguenth at gcc dot gnu.org
2021-12-06 13:12 ` [Bug c++/103561] ICE: " marxin at gcc dot gnu.org
2021-12-06 13:59 ` 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).