public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97412] New: [concepts] ICE with requires requires and parameter packs
@ 2020-10-13 22:19 hello at josephloser dot com
  2020-10-14 20:50 ` [Bug c++/97412] [10/11 Regression] " ppalka at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: hello at josephloser dot com @ 2020-10-13 22:19 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97412
           Summary: [concepts] ICE with requires requires and parameter
                    packs
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hello at josephloser dot com
  Target Milestone: ---

Created attachment 49367
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49367&action=edit
requires requires with parameter packs bug

The code below causes an internal compiler error/segfault when parsing a
requires requires expression involving parameter packs.

The ICE occurs in GCC 10.2.0 (which was used to produce the attached
preprocessed file), but the issue also occurs on trunk. 

c++-10 -v       
Using built-in specs.
COLLECT_GCC=c++-10
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/10.2.0/libexec/gcc/x86_64-apple-darwin19/10.2.0/lto-wrapper
Target: x86_64-apple-darwin19
Configured with: ../configure --build=x86_64-apple-darwin19
--prefix=/usr/local/Cellar/gcc/10.2.0
--libdir=/usr/local/Cellar/gcc/10.2.0/lib/gcc/10 --disable-nls
--enable-checking=release --enable-languages=c,c++,objc,obj-c++,fortran
--program-suffix=-10 --with-gmp=/usr/local/opt/gmp
--with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc
--with-isl=/usr/local/o
pt/isl --with-system-zlib --with-pkgversion='Homebrew GCC 10.2.0'
--with-bugurl=https://github.com/Homebrew/homebrew-core/issues
--disable-multilib --with-native-system-header-dir=/usr/include
--with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk
SED=/usr/bin/sed
Thread model: posix
Supported LTO compression algorithms: zlib

Output of compiling the program with -std=c++2a:
prog.cc:8:38: internal compiler error: Segmentation fault
    8 |   requires call_bar_with<T, TArgs...>;
      |                                      ^
0xc310af crash_signal
        ../../source/gcc/toplev.c:330
0x5de480 tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
        ../../source/gcc/cp/pt.c:12929
0x7562e1 tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
        ../../source/gcc/cp/pt.c:13233
0x756768 tsubst_argument_pack(tree_node*, tree_node*, int, tree_node*)
        ../../source/gcc/cp/pt.c:13195
0x7562b4 tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
        ../../source/gcc/cp/pt.c:13245
0x65d551 normalize_concept_check
        ../../source/gcc/cp/constraint.cc:689
0x65d551 normalize_atom
        ../../source/gcc/cp/constraint.cc:723
0x65d551 normalize_expression
        ../../source/gcc/cp/constraint.cc:752
0x65d894 get_normalized_constraints
        ../../source/gcc/cp/constraint.cc:764
0x65d894 normalize_constraint_expression
        ../../source/gcc/cp/constraint.cc:906
0x65f358 normalize_constraint_expression
        ../../source/gcc/cp/constraint.cc:902
0x65f358 finish_nested_requirement(unsigned int, tree_node*)
        ../../source/gcc/cp/constraint.cc:2997
0x7082dd cp_parser_nested_requirement
        ../../source/gcc/cp/parser.c:28279
0x7082dd cp_parser_requirement
        ../../source/gcc/cp/parser.c:28079
0x7082dd cp_parser_requirement_seq
        ../../source/gcc/cp/parser.c:28050
0x7082dd cp_parser_requirement_body
        ../../source/gcc/cp/parser.c:28030
0x7082dd cp_parser_requires_expression
        ../../source/gcc/cp/parser.c:27976
0x7082dd cp_parser_primary_expression
        ../../source/gcc/cp/parser.c:5644
0x712374 cp_parser_postfix_expression
        ../../source/gcc/cp/parser.c:7328
0x6f5a8a cp_parser_binary_expression
        ../../source/gcc/cp/parser.c:9648
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Wandbox link: https://wandbox.org/permlink/j6GtQTNEFVTgZYW5

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

* [Bug c++/97412] [10/11 Regression] [concepts] ICE with requires requires and parameter packs
  2020-10-13 22:19 [Bug c++/97412] New: [concepts] ICE with requires requires and parameter packs hello at josephloser dot com
@ 2020-10-14 20:50 ` ppalka at gcc dot gnu.org
  2020-10-29 18:03 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-10-14 20:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
      Known to fail|                            |10.2.0, 11.0
             Status|UNCONFIRMED                 |ASSIGNED
            Summary|[concepts] ICE with         |[10/11 Regression]
                   |requires requires and       |[concepts] ICE with
                   |parameter packs             |requires requires and
                   |                            |parameter packs
   Target Milestone|---                         |10.3
   Last reconfirmed|                            |2020-10-14
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org
                 CC|                            |ppalka at gcc dot gnu.org
      Known to work|                            |9.3.0

--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Confirmed.  We started ICEing with r10-8077; looking into it.

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

* [Bug c++/97412] [10/11 Regression] [concepts] ICE with requires requires and parameter packs
  2020-10-13 22:19 [Bug c++/97412] New: [concepts] ICE with requires requires and parameter packs hello at josephloser dot com
  2020-10-14 20:50 ` [Bug c++/97412] [10/11 Regression] " ppalka at gcc dot gnu.org
@ 2020-10-29 18:03 ` cvs-commit at gcc dot gnu.org
  2020-10-30 13:06 ` cvs-commit at gcc dot gnu.org
  2020-10-30 13:07 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-10-29 18:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 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:5681668765e233735b4c5e6a305e73ae1f80a328

commit r11-4544-g5681668765e233735b4c5e6a305e73ae1f80a328
Author: Patrick Palka <ppalka@redhat.com>
Date:   Thu Oct 29 14:02:59 2020 -0400

    c++: Tolerate empty initial args during normalization [PR97412]

    When normalizing the constraint-expression of a nested-requirement, we
    pass NULL_TREE as the initial template arguments for normalization, but
    tsubst_argument_pack is not prepared to handle a NULL_TREE args vector.
    This causes us to ICE when normalizing a variadic concept as part of a
    nested-requirement.

    This patch fixes the ICE by guarding the call to tsubst_template_args in
    normalize_concept_check appropriately.  This will also enable us to
    simplify many of the normalization routines to just pass NULL_TREE
    (instead of a set of generic template arguments) as the initial template
    arguments.

    gcc/cp/ChangeLog:

            PR c++/97412
            * constraint.cc (normalize_concept_check): Don't call
            tsubst_template_args when 'args' is NULL.

    gcc/testsuite/ChangeLog:

            PR c++/97412
            * g++.dg/cpp2a/concepts-variadic2.C: New test.

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

* [Bug c++/97412] [10/11 Regression] [concepts] ICE with requires requires and parameter packs
  2020-10-13 22:19 [Bug c++/97412] New: [concepts] ICE with requires requires and parameter packs hello at josephloser dot com
  2020-10-14 20:50 ` [Bug c++/97412] [10/11 Regression] " ppalka at gcc dot gnu.org
  2020-10-29 18:03 ` cvs-commit at gcc dot gnu.org
@ 2020-10-30 13:06 ` cvs-commit at gcc dot gnu.org
  2020-10-30 13:07 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-10-30 13:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:5ab7959ee18980d676892fa6579f1ca09c5ecc08

commit r10-8957-g5ab7959ee18980d676892fa6579f1ca09c5ecc08
Author: Patrick Palka <ppalka@redhat.com>
Date:   Thu Oct 29 14:02:59 2020 -0400

    c++: Tolerate empty initial args during normalization [PR97412]

    When normalizing the constraint-expression of a nested-requirement, we
    pass NULL_TREE as the initial template arguments for normalization, but
    tsubst_argument_pack is not prepared to handle a NULL_TREE args vector.
    This causes us to ICE when normalizing a variadic concept as part of a
    nested-requirement.

    This patch fixes the ICE by guarding the call to tsubst_template_args in
    normalize_concept_check appropriately.  This will also enable us to
    simplify many of the normalization routines to just pass NULL_TREE
    (instead of a set of generic template arguments) as the initial template
    arguments.

    gcc/cp/ChangeLog:

            PR c++/97412
            * constraint.cc (normalize_concept_check): Don't call
            tsubst_template_args when 'args' is NULL.

    gcc/testsuite/ChangeLog:

            PR c++/97412
            * g++.dg/cpp2a/concepts-variadic2.C: New test.

    (cherry picked from commit 5681668765e233735b4c5e6a305e73ae1f80a328)

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

* [Bug c++/97412] [10/11 Regression] [concepts] ICE with requires requires and parameter packs
  2020-10-13 22:19 [Bug c++/97412] New: [concepts] ICE with requires requires and parameter packs hello at josephloser dot com
                   ` (2 preceding siblings ...)
  2020-10-30 13:06 ` cvs-commit at gcc dot gnu.org
@ 2020-10-30 13:07 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-10-30 13:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 10.3+, thanks for the bug report.

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

end of thread, other threads:[~2020-10-30 13:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-13 22:19 [Bug c++/97412] New: [concepts] ICE with requires requires and parameter packs hello at josephloser dot com
2020-10-14 20:50 ` [Bug c++/97412] [10/11 Regression] " ppalka at gcc dot gnu.org
2020-10-29 18:03 ` cvs-commit at gcc dot gnu.org
2020-10-30 13:06 ` cvs-commit at gcc dot gnu.org
2020-10-30 13:07 ` 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).