public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/99806] New: ICE in tsubst_copy of gcc-trunk and tree_code_size of gcc-10
@ 2021-03-29  4:53 hewillk at gmail dot com
  2021-03-29 17:40 ` [Bug c++/99806] [10/11 Regression] ICE: in tsubst_copy, at cp/pt.c:17247 mpolacek at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: hewillk at gmail dot com @ 2021-03-29  4:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99806
           Summary: ICE in tsubst_copy of gcc-trunk and tree_code_size of
                    gcc-10
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/s687ePeGG


template <class T> concept C = requires (T a) { a.f(0); };
struct S { void f(auto) noexcept(); };
static_assert(C<S>);


gcc-trunk:

<source>:2:17: internal compiler error: in tsubst_copy, at cp/pt.c:17247
    2 | struct S { void f(auto) noexcept(); };
      |                 ^

gcc-10:

<source>:2:17: internal compiler error: in tree_code_size, at tree.c:910
    2 | struct S { void f(auto) noexcept(); };
      |

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

* [Bug c++/99806] [10/11 Regression] ICE: in tsubst_copy, at cp/pt.c:17247
  2021-03-29  4:53 [Bug c++/99806] New: ICE in tsubst_copy of gcc-trunk and tree_code_size of gcc-10 hewillk at gmail dot com
@ 2021-03-29 17:40 ` mpolacek at gcc dot gnu.org
  2021-03-29 17:40 ` mpolacek at gcc dot gnu.org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-03-29 17:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org
                 CC|                            |mpolacek at gcc dot gnu.org
   Target Milestone|---                         |10.3
            Summary|ICE: in tsubst_copy, at     |[10/11 Regression] ICE: in
                   |cp/pt.c:17247               |tsubst_copy, at
                   |                            |cp/pt.c:17247

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r272586, so mine.  GCC 9:

99806.C:2:34: error: expected primary-expression before ‘)’ token
    2 | struct S { void f(auto) noexcept(); };
      |                                  ^

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

* [Bug c++/99806] [10/11 Regression] ICE: in tsubst_copy, at cp/pt.c:17247
  2021-03-29  4:53 [Bug c++/99806] New: ICE in tsubst_copy of gcc-trunk and tree_code_size of gcc-10 hewillk at gmail dot com
  2021-03-29 17:40 ` [Bug c++/99806] [10/11 Regression] ICE: in tsubst_copy, at cp/pt.c:17247 mpolacek at gcc dot gnu.org
@ 2021-03-29 17:40 ` mpolacek at gcc dot gnu.org
  2021-04-07 21:20 ` mpolacek at gcc dot gnu.org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-03-29 17:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2021-03-29

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

* [Bug c++/99806] [10/11 Regression] ICE: in tsubst_copy, at cp/pt.c:17247
  2021-03-29  4:53 [Bug c++/99806] New: ICE in tsubst_copy of gcc-trunk and tree_code_size of gcc-10 hewillk at gmail dot com
  2021-03-29 17:40 ` [Bug c++/99806] [10/11 Regression] ICE: in tsubst_copy, at cp/pt.c:17247 mpolacek at gcc dot gnu.org
  2021-03-29 17:40 ` mpolacek at gcc dot gnu.org
@ 2021-04-07 21:20 ` mpolacek at gcc dot gnu.org
  2021-04-08  1:13 ` mpolacek at gcc dot gnu.org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-04-07 21:20 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|ice-on-invalid-code         |ice-on-valid-code
           Priority|P3                          |P2

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
// PR c++/99806

constexpr bool B = true;
template <class T> concept C = requires (T a) { a.f(0); };
struct S { void f(auto) noexcept(B); };
static_assert(C<S>);

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

* [Bug c++/99806] [10/11 Regression] ICE: in tsubst_copy, at cp/pt.c:17247
  2021-03-29  4:53 [Bug c++/99806] New: ICE in tsubst_copy of gcc-trunk and tree_code_size of gcc-10 hewillk at gmail dot com
                   ` (2 preceding siblings ...)
  2021-04-07 21:20 ` mpolacek at gcc dot gnu.org
@ 2021-04-08  1:13 ` mpolacek at gcc dot gnu.org
  2021-04-08 12:02 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-04-08  1:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
A test that should be accepted:

// PR c++/99806

struct S {
  template<typename T>
  void f(T) noexcept(B);
  static constexpr bool B = true;
};

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

* [Bug c++/99806] [10/11 Regression] ICE: in tsubst_copy, at cp/pt.c:17247
  2021-03-29  4:53 [Bug c++/99806] New: ICE in tsubst_copy of gcc-trunk and tree_code_size of gcc-10 hewillk at gmail dot com
                   ` (3 preceding siblings ...)
  2021-04-08  1:13 ` mpolacek at gcc dot gnu.org
@ 2021-04-08 12:02 ` rguenth at gcc dot gnu.org
  2021-04-08 17:44 ` mpolacek at gcc dot gnu.org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-08 12:02 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.3                        |10.4

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10.3 is being released, retargeting bugs to GCC 10.4.

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

* [Bug c++/99806] [10/11 Regression] ICE: in tsubst_copy, at cp/pt.c:17247
  2021-03-29  4:53 [Bug c++/99806] New: ICE in tsubst_copy of gcc-trunk and tree_code_size of gcc-10 hewillk at gmail dot com
                   ` (4 preceding siblings ...)
  2021-04-08 12:02 ` rguenth at gcc dot gnu.org
@ 2021-04-08 17:44 ` mpolacek at gcc dot gnu.org
  2021-04-08 19:14 ` mpolacek at gcc dot gnu.org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-04-08 17:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Another related test that we should probably accept:

// PR c++/99806

struct S {
  void f(auto, auto, int = 3);
};

void
g ()
{
  S s;
  s.f(1, 2);
}

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

* [Bug c++/99806] [10/11 Regression] ICE: in tsubst_copy, at cp/pt.c:17247
  2021-03-29  4:53 [Bug c++/99806] New: ICE in tsubst_copy of gcc-trunk and tree_code_size of gcc-10 hewillk at gmail dot com
                   ` (5 preceding siblings ...)
  2021-04-08 17:44 ` mpolacek at gcc dot gnu.org
@ 2021-04-08 19:14 ` mpolacek at gcc dot gnu.org
  2021-04-09 14:29 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-04-08 19:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Since Comment 3 isn't a regression, I've opened bug 99980.

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

* [Bug c++/99806] [10/11 Regression] ICE: in tsubst_copy, at cp/pt.c:17247
  2021-03-29  4:53 [Bug c++/99806] New: ICE in tsubst_copy of gcc-trunk and tree_code_size of gcc-10 hewillk at gmail dot com
                   ` (6 preceding siblings ...)
  2021-04-08 19:14 ` mpolacek at gcc dot gnu.org
@ 2021-04-09 14:29 ` cvs-commit at gcc dot gnu.org
  2021-04-09 14:32 ` [Bug c++/99806] [10 " mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-09 14:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:625dadaf5df5a2ae0d8c5660fd1eec8ba354479c

commit r11-8095-g625dadaf5df5a2ae0d8c5660fd1eec8ba354479c
Author: Marek Polacek <polacek@redhat.com>
Date:   Thu Apr 8 14:39:28 2021 -0400

    c++: Fix two issues with auto function parameter [PR99806]

    When we have a member function with auto parameter like this:

      struct S {
        void f(auto);
      };

    cp_parser_member_declaration -> grokfield produces a FUNCTION_DECL
    "void S::foo(auto:1)", and then finish_fully_implicit_template turns
    that FUNCTION_DECL into a TEMPLATE_DECL.  The bug here is that we only
    call cp_parser_save_default_args for a FUNCTION_DECL.  As a consequence,
    abbrev10.C is rejected because we complain that the default argument has
    not been defined, and abbrev11.C ICEs, because we don't re-parse the
    delayed noexcept, so the DEFERRED_PARSE tree leaks into tsubst* where we
    crash.  This patch fixes both issues.

    gcc/cp/ChangeLog:

            PR c++/99806
            * parser.c (cp_parser_member_declaration): Call
            cp_parser_save_default_args even for function templates.  Use
            STRIP_TEMPLATE on the declaration we're passing.

    gcc/testsuite/ChangeLog:

            PR c++/99806
            * g++.dg/concepts/abbrev10.C: New test.
            * g++.dg/concepts/abbrev11.C: New test.

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

* [Bug c++/99806] [10 Regression] ICE: in tsubst_copy, at cp/pt.c:17247
  2021-03-29  4:53 [Bug c++/99806] New: ICE in tsubst_copy of gcc-trunk and tree_code_size of gcc-10 hewillk at gmail dot com
                   ` (7 preceding siblings ...)
  2021-04-09 14:29 ` cvs-commit at gcc dot gnu.org
@ 2021-04-09 14:32 ` mpolacek at gcc dot gnu.org
  2021-04-09 14:51 ` ppalka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-04-09 14:32 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[10/11 Regression] ICE: in  |[10 Regression] ICE: in
                   |tsubst_copy, at             |tsubst_copy, at
                   |cp/pt.c:17247               |cp/pt.c:17247

--- Comment #8 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed on trunk so far.

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

* [Bug c++/99806] [10 Regression] ICE: in tsubst_copy, at cp/pt.c:17247
  2021-03-29  4:53 [Bug c++/99806] New: ICE in tsubst_copy of gcc-trunk and tree_code_size of gcc-10 hewillk at gmail dot com
                   ` (8 preceding siblings ...)
  2021-04-09 14:32 ` [Bug c++/99806] [10 " mpolacek at gcc dot gnu.org
@ 2021-04-09 14:51 ` ppalka at gcc dot gnu.org
  2021-04-09 22:47 ` cvs-commit at gcc dot gnu.org
  2021-04-09 22:48 ` mpolacek at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-04-09 14:51 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |stream009 at gmail dot com

--- Comment #9 from Patrick Palka <ppalka at gcc dot gnu.org> ---
*** Bug 99864 has been marked as a duplicate of this bug. ***

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

* [Bug c++/99806] [10 Regression] ICE: in tsubst_copy, at cp/pt.c:17247
  2021-03-29  4:53 [Bug c++/99806] New: ICE in tsubst_copy of gcc-trunk and tree_code_size of gcc-10 hewillk at gmail dot com
                   ` (9 preceding siblings ...)
  2021-04-09 14:51 ` ppalka at gcc dot gnu.org
@ 2021-04-09 22:47 ` cvs-commit at gcc dot gnu.org
  2021-04-09 22:48 ` mpolacek at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-09 22:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Marek Polacek
<mpolacek@gcc.gnu.org>:

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

commit r10-9691-g8f4f2fbc17c2a225c29ea20a2b6046cbdc7b3155
Author: Marek Polacek <polacek@redhat.com>
Date:   Thu Apr 8 14:39:28 2021 -0400

    c++: Fix two issues with auto function parameter [PR99806]

    When we have a member function with auto parameter like this:

      struct S {
        void f(auto);
      };

    cp_parser_member_declaration -> grokfield produces a FUNCTION_DECL
    "void S::foo(auto:1)", and then finish_fully_implicit_template turns
    that FUNCTION_DECL into a TEMPLATE_DECL.  The bug here is that we only
    call cp_parser_save_default_args for a FUNCTION_DECL.  As a consequence,
    abbrev10.C is rejected because we complain that the default argument has
    not been defined, and abbrev11.C ICEs, because we don't re-parse the
    delayed noexcept, so the DEFERRED_PARSE tree leaks into tsubst* where we
    crash.  This patch fixes both issues.

    gcc/cp/ChangeLog:

            PR c++/99806
            * parser.c (cp_parser_member_declaration): Call
            cp_parser_save_default_args even for function templates.  Use
            STRIP_TEMPLATE on the declaration we're passing.

    gcc/testsuite/ChangeLog:

            PR c++/99806
            * g++.dg/concepts/abbrev10.C: New test.
            * g++.dg/concepts/abbrev11.C: New test.

    (cherry picked from commit 625dadaf5df5a2ae0d8c5660fd1eec8ba354479c)

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

* [Bug c++/99806] [10 Regression] ICE: in tsubst_copy, at cp/pt.c:17247
  2021-03-29  4:53 [Bug c++/99806] New: ICE in tsubst_copy of gcc-trunk and tree_code_size of gcc-10 hewillk at gmail dot com
                   ` (10 preceding siblings ...)
  2021-04-09 22:47 ` cvs-commit at gcc dot gnu.org
@ 2021-04-09 22:48 ` mpolacek at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-04-09 22:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #11 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2021-04-09 22:48 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-29  4:53 [Bug c++/99806] New: ICE in tsubst_copy of gcc-trunk and tree_code_size of gcc-10 hewillk at gmail dot com
2021-03-29 17:40 ` [Bug c++/99806] [10/11 Regression] ICE: in tsubst_copy, at cp/pt.c:17247 mpolacek at gcc dot gnu.org
2021-03-29 17:40 ` mpolacek at gcc dot gnu.org
2021-04-07 21:20 ` mpolacek at gcc dot gnu.org
2021-04-08  1:13 ` mpolacek at gcc dot gnu.org
2021-04-08 12:02 ` rguenth at gcc dot gnu.org
2021-04-08 17:44 ` mpolacek at gcc dot gnu.org
2021-04-08 19:14 ` mpolacek at gcc dot gnu.org
2021-04-09 14:29 ` cvs-commit at gcc dot gnu.org
2021-04-09 14:32 ` [Bug c++/99806] [10 " mpolacek at gcc dot gnu.org
2021-04-09 14:51 ` ppalka at gcc dot gnu.org
2021-04-09 22:47 ` cvs-commit at gcc dot gnu.org
2021-04-09 22:48 ` mpolacek 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).