public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/65636] New: [c++-concepts] ICE (Segmentation fault) when a type requirement names a typedef or type alias
@ 2015-03-31  8:25 tom at honermann dot net
  2015-04-03 15:01 ` [Bug c++/65636] " andrew.n.sutton at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: tom at honermann dot net @ 2015-03-31  8:25 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65636
           Summary: [c++-concepts] ICE (Segmentation fault) when a type
                    requirement names a typedef or type alias
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tom at honermann dot net

Encountered with the latest revision of the gcc c++-concepts branch (r221742).

An internal compiler error occurs when a type requirement names a typedef or
type alias.  I suspect this code is ill-formed - a proper diagnostic is
produced if a builtin type (ie, 'int') is named in lieu of the type alias.

$ svn info   # From my local svn gcc repo.
Path: .
URL: svn://gcc.gnu.org/svn/gcc/branches/c++-concepts
Repository Root: svn://gcc.gnu.org/svn/gcc
Repository UUID: 138bc75d-0d04-0410-961f-82ee72b054a4
Revision: 221742
Node Kind: directory
Schedule: normal
Last Changed Author: asutton
Last Changed Rev: 221733
Last Changed Date: 2015-03-27 10:44:22 -0400 (Fri, 27 Mar 2015)

$ cat t.cpp
using TD = int;
template<typename T>
concept bool C() {
    return requires () {
               typename TD;
           };
}
static_assert(C<int>(), "");

$ g++ -c -std=c++1z t.cpp 
t.cpp:1:13: internal compiler error: Segmentation fault
 typedef int TD;
             ^
0xcc91ef crash_signal
        ../../gcc-c++-concepts2/c++-concepts/gcc/toplev.c:383
0x6754ff tsubst_decl
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/pt.c:11859
0x68b9c6 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/pt.c:12388
0x82eb81 tsubst_type_requirement
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/constraint.cc:1390
0x82eb81 tsubst_requirement
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/constraint.cc:1426
0x82eb81 tsubst_requirement_body
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/constraint.cc:1446
0x82eb81 tsubst_requires_expr(tree_node*, tree_node*, int, tree_node*)
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/constraint.cc:1476
0x67ca83 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/pt.c:16301
0x682b56 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/pt.c:14970
0x82da7f lift_function_definition
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/constraint.cc:340
0x82db43 evaluate_function_concept(tree_node*, tree_node*)
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/constraint.cc:1885
0x620cc3 build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, bool, int)
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/call.c:4161
0x79f4da finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/semantics.c:2407
0x7269c7 cp_parser_postfix_expression
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/parser.c:6448
0x729219 cp_parser_unary_expression
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/parser.c:7511
0x729e07 cp_parser_binary_expression
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/parser.c:8245
0x72a61f cp_parser_assignment_expression
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/parser.c:8503
0x72a9f5 cp_parser_constant_expression
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/parser.c:8749
0x72aad4 cp_parser_static_assert
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/parser.c:12308
0x721399 cp_parser_block_declaration
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/parser.c:11564


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

* [Bug c++/65636] [c++-concepts] ICE (Segmentation fault) when a type requirement names a typedef or type alias
  2015-03-31  8:25 [Bug c++/65636] New: [c++-concepts] ICE (Segmentation fault) when a type requirement names a typedef or type alias tom at honermann dot net
@ 2015-04-03 15:01 ` andrew.n.sutton at gmail dot com
  2015-04-03 15:04 ` andrew.n.sutton at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: andrew.n.sutton at gmail dot com @ 2015-04-03 15:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Sutton <andrew.n.sutton at gmail dot com> ---
Created attachment 35225
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35225&action=edit
Proposed solution


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

* [Bug c++/65636] [c++-concepts] ICE (Segmentation fault) when a type requirement names a typedef or type alias
  2015-03-31  8:25 [Bug c++/65636] New: [c++-concepts] ICE (Segmentation fault) when a type requirement names a typedef or type alias tom at honermann dot net
  2015-04-03 15:01 ` [Bug c++/65636] " andrew.n.sutton at gmail dot com
@ 2015-04-03 15:04 ` andrew.n.sutton at gmail dot com
  2015-04-07 18:28 ` tom at honermann dot net
  2015-07-09 22:15 ` jason at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: andrew.n.sutton at gmail dot com @ 2015-04-03 15:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Sutton <andrew.n.sutton at gmail dot com> ---
Confirmed and with a tentative fix in r221856.

Certain type declarations occurring at namespace scope are not given C++
language extensions, so when we try to pass those through tsubst_decl, the
specialization handling bits fail. This prevents those from being used, but
still performs the substitution, performing access checks, copying attributes,
etc.

I'd like a maintainer to look at the solution. There's probably a better way to
address the problem.


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

* [Bug c++/65636] [c++-concepts] ICE (Segmentation fault) when a type requirement names a typedef or type alias
  2015-03-31  8:25 [Bug c++/65636] New: [c++-concepts] ICE (Segmentation fault) when a type requirement names a typedef or type alias tom at honermann dot net
  2015-04-03 15:01 ` [Bug c++/65636] " andrew.n.sutton at gmail dot com
  2015-04-03 15:04 ` andrew.n.sutton at gmail dot com
@ 2015-04-07 18:28 ` tom at honermann dot net
  2015-07-09 22:15 ` jason at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: tom at honermann dot net @ 2015-04-07 18:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Tom Honermann <tom at honermann dot net> ---
Confirmed fixed with r221861.  I'll leave the bug open though since comment 2
is requesting additional followup.


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

* [Bug c++/65636] [c++-concepts] ICE (Segmentation fault) when a type requirement names a typedef or type alias
  2015-03-31  8:25 [Bug c++/65636] New: [c++-concepts] ICE (Segmentation fault) when a type requirement names a typedef or type alias tom at honermann dot net
                   ` (2 preceding siblings ...)
  2015-04-07 18:28 ` tom at honermann dot net
@ 2015-07-09 22:15 ` jason at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2015-07-09 22:15 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |jason at gcc dot gnu.org
         Resolution|---                         |FIXED

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> ---
I've just reverted this change and the testcase still passes, so it seems to
have been fixed elsewhere as well.


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

end of thread, other threads:[~2015-07-09 22:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-31  8:25 [Bug c++/65636] New: [c++-concepts] ICE (Segmentation fault) when a type requirement names a typedef or type alias tom at honermann dot net
2015-04-03 15:01 ` [Bug c++/65636] " andrew.n.sutton at gmail dot com
2015-04-03 15:04 ` andrew.n.sutton at gmail dot com
2015-04-07 18:28 ` tom at honermann dot net
2015-07-09 22:15 ` jason 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).