public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60252] New: [4.7/4.8/4.9 Regression] [c++11] ICE with invalid variable-length array in lambda parameter
@ 2014-02-17 21:43 reichelt at gcc dot gnu.org
  2014-02-17 21:44 ` [Bug c++/60252] " reichelt at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: reichelt at gcc dot gnu.org @ 2014-02-17 21:43 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60252

            Bug ID: 60252
           Summary: [4.7/4.8/4.9 Regression] [c++11] ICE with invalid
                    variable-length array in lambda parameter
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org

The following invalid code snippet (compiled with "-std=c++11") triggers
an ICE since GCC 4.6.0:

====================================
struct A
{
  int i;

  void foo()
  {
    [&](){ [&](int[i]){}; };
  }
};
====================================

bug.cc: In lambda function:
bug.cc:7:20: internal compiler error: Segmentation fault
     [&](){ [&](int[i]){}; };
                    ^
0xba529f crash_signal
        ../../gcc/gcc/toplev.c:337
0x7a3135 tree_check
        ../../gcc/gcc/tree.h:2708
0x7a3135 build_capture_proxy(tree_node*)
        ../../gcc/gcc/cp/lambda.c:360
0x7a3c07 add_capture(tree_node*, tree_node*, tree_node*, bool, bool)
        ../../gcc/gcc/cp/lambda.c:553
0x7a43be add_default_capture(tree_node*, tree_node*, tree_node*)
        ../../gcc/gcc/cp/lambda.c:610
0x7a48b9 lambda_expr_this_capture(tree_node*)
        ../../gcc/gcc/cp/lambda.c:705
0x7a4cc9 maybe_resolve_dummy(tree_node*)
        ../../gcc/gcc/cp/lambda.c:752
0x72a87a finish_non_static_data_member(tree_node*, tree_node*, tree_node*)
        ../../gcc/gcc/cp/semantics.c:1668
0x72fa77 finish_id_expression(tree_node*, tree_node*, tree_node*, cp_id_kind*,
bool, bool, bool*, bool, bool, bool, bool, char const**, unsigned int)
        ../../gcc/gcc/cp/semantics.c:3515
0x6b0b26 cp_parser_primary_expression
        ../../gcc/gcc/cp/parser.c:4614
0x6b20dd cp_parser_postfix_expression
        ../../gcc/gcc/cp/parser.c:5971
0x6b50b6 cp_parser_unary_expression
        ../../gcc/gcc/cp/parser.c:7170
0x6b5ddf cp_parser_binary_expression
        ../../gcc/gcc/cp/parser.c:7874
0x6b62d1 cp_parser_assignment_expression
        ../../gcc/gcc/cp/parser.c:8112
0x6b6795 cp_parser_assignment_expression
        ../../gcc/gcc/cp/parser.c:8162
0x6b6795 cp_parser_constant_expression
        ../../gcc/gcc/cp/parser.c:8372
0x6bd1bc cp_parser_direct_declarator
        ../../gcc/gcc/cp/parser.c:17217
0x6bd1bc cp_parser_declarator
        ../../gcc/gcc/cp/parser.c:16943
0x6c51c1 cp_parser_parameter_declaration
        ../../gcc/gcc/cp/parser.c:18491
0x6c64e1 cp_parser_parameter_declaration_list
        ../../gcc/gcc/cp/parser.c:18258
Please submit a full bug report, [etc.]


With a slightly different testcase I get a different stack-trace:

====================================
struct A
{
  int i;

  void foo()
  {
    [&](){ [this](int[i]){}; };
  }
};
====================================

bug.cc: In lambda function:
bug.cc:7:23: internal compiler error: in lambda_expr_this_capture, at
cp/lambda.c:717
     [&](){ [this](int[i]){}; };
                       ^
0x7a4ad5 lambda_expr_this_capture(tree_node*)
        ../../gcc/gcc/cp/lambda.c:716
0x7a4cc9 maybe_resolve_dummy(tree_node*)
        ../../gcc/gcc/cp/lambda.c:752
0x72a87a finish_non_static_data_member(tree_node*, tree_node*, tree_node*)
        ../../gcc/gcc/cp/semantics.c:1668
0x72fa77 finish_id_expression(tree_node*, tree_node*, tree_node*, cp_id_kind*,
bool, bool, bool*, bool, bool, bool, bool, char const**, unsigned int)
        ../../gcc/gcc/cp/semantics.c:3515
0x6b0b26 cp_parser_primary_expression
        ../../gcc/gcc/cp/parser.c:4614
0x6b20dd cp_parser_postfix_expression
        ../../gcc/gcc/cp/parser.c:5971
0x6b50b6 cp_parser_unary_expression
        ../../gcc/gcc/cp/parser.c:7170
0x6b5ddf cp_parser_binary_expression
        ../../gcc/gcc/cp/parser.c:7874
0x6b62d1 cp_parser_assignment_expression
        ../../gcc/gcc/cp/parser.c:8112
0x6b6795 cp_parser_assignment_expression
        ../../gcc/gcc/cp/parser.c:8162
0x6b6795 cp_parser_constant_expression
        ../../gcc/gcc/cp/parser.c:8372
0x6bd1bc cp_parser_direct_declarator
        ../../gcc/gcc/cp/parser.c:17217
0x6bd1bc cp_parser_declarator
        ../../gcc/gcc/cp/parser.c:16943
0x6c51c1 cp_parser_parameter_declaration
        ../../gcc/gcc/cp/parser.c:18491
0x6c64e1 cp_parser_parameter_declaration_list
        ../../gcc/gcc/cp/parser.c:18258
0x6c6b32 cp_parser_parameter_declaration_clause
        ../../gcc/gcc/cp/parser.c:18179
0x6b100f cp_parser_lambda_declarator_opt
        ../../gcc/gcc/cp/parser.c:9050
0x6b100f cp_parser_lambda_expression
        ../../gcc/gcc/cp/parser.c:8754
0x6b100f cp_parser_primary_expression
        ../../gcc/gcc/cp/parser.c:4305
0x6b20dd cp_parser_postfix_expression
        ../../gcc/gcc/cp/parser.c:5971
Please submit a full bug report, [etc.]


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

* [Bug c++/60252] [4.7/4.8/4.9 Regression] [c++11] ICE with invalid variable-length array in lambda parameter
  2014-02-17 21:43 [Bug c++/60252] New: [4.7/4.8/4.9 Regression] [c++11] ICE with invalid variable-length array in lambda parameter reichelt at gcc dot gnu.org
@ 2014-02-17 21:44 ` reichelt at gcc dot gnu.org
  2014-02-18  7:25 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: reichelt at gcc dot gnu.org @ 2014-02-17 21:44 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60252

Volker Reichelt <reichelt at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.5.0
   Target Milestone|---                         |4.7.4
      Known to fail|                            |4.6.0, 4.7.0, 4.8.0, 4.9.0


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

* [Bug c++/60252] [4.7/4.8/4.9 Regression] [c++11] ICE with invalid variable-length array in lambda parameter
  2014-02-17 21:43 [Bug c++/60252] New: [4.7/4.8/4.9 Regression] [c++11] ICE with invalid variable-length array in lambda parameter reichelt at gcc dot gnu.org
  2014-02-17 21:44 ` [Bug c++/60252] " reichelt at gcc dot gnu.org
@ 2014-02-18  7:25 ` jakub at gcc dot gnu.org
  2014-02-18  9:24 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-02-18  7:25 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60252

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-02-18
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r158809.


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

* [Bug c++/60252] [4.7/4.8/4.9 Regression] [c++11] ICE with invalid variable-length array in lambda parameter
  2014-02-17 21:43 [Bug c++/60252] New: [4.7/4.8/4.9 Regression] [c++11] ICE with invalid variable-length array in lambda parameter reichelt at gcc dot gnu.org
  2014-02-17 21:44 ` [Bug c++/60252] " reichelt at gcc dot gnu.org
  2014-02-18  7:25 ` jakub at gcc dot gnu.org
@ 2014-02-18  9:24 ` rguenth at gcc dot gnu.org
  2014-02-21  5:35 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-02-18  9:24 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60252

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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

* [Bug c++/60252] [4.7/4.8/4.9 Regression] [c++11] ICE with invalid variable-length array in lambda parameter
  2014-02-17 21:43 [Bug c++/60252] New: [4.7/4.8/4.9 Regression] [c++11] ICE with invalid variable-length array in lambda parameter reichelt at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2014-02-18  9:24 ` rguenth at gcc dot gnu.org
@ 2014-02-21  5:35 ` jason at gcc dot gnu.org
  2014-02-21 14:57 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2014-02-21  5:35 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60252

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org


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

* [Bug c++/60252] [4.7/4.8/4.9 Regression] [c++11] ICE with invalid variable-length array in lambda parameter
  2014-02-17 21:43 [Bug c++/60252] New: [4.7/4.8/4.9 Regression] [c++11] ICE with invalid variable-length array in lambda parameter reichelt at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2014-02-21  5:35 ` jason at gcc dot gnu.org
@ 2014-02-21 14:57 ` jason at gcc dot gnu.org
  2014-02-21 15:51 ` jason at gcc dot gnu.org
  2014-02-21 21:51 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2014-02-21 14:57 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60252

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Fri Feb 21 14:56:31 2014
New Revision: 207999

URL: http://gcc.gnu.org/viewcvs?rev=207999&root=gcc&view=rev
Log:
    PR c++/60252
    * lambda.c (maybe_resolve_dummy): Don't try to capture this
    in declaration context.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice11.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/lambda.c


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

* [Bug c++/60252] [4.7/4.8/4.9 Regression] [c++11] ICE with invalid variable-length array in lambda parameter
  2014-02-17 21:43 [Bug c++/60252] New: [4.7/4.8/4.9 Regression] [c++11] ICE with invalid variable-length array in lambda parameter reichelt at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2014-02-21 14:57 ` jason at gcc dot gnu.org
@ 2014-02-21 15:51 ` jason at gcc dot gnu.org
  2014-02-21 21:51 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2014-02-21 15:51 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60252

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|4.7.4                       |4.9.0

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed in 4.9.


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

* [Bug c++/60252] [4.7/4.8/4.9 Regression] [c++11] ICE with invalid variable-length array in lambda parameter
  2014-02-17 21:43 [Bug c++/60252] New: [4.7/4.8/4.9 Regression] [c++11] ICE with invalid variable-length array in lambda parameter reichelt at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2014-02-21 15:51 ` jason at gcc dot gnu.org
@ 2014-02-21 21:51 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2014-02-21 21:51 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60252

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Fri Feb 21 21:50:52 2014
New Revision: 208028

URL: http://gcc.gnu.org/viewcvs?rev=208028&root=gcc&view=rev
Log:
    PR c++/60252
    * lambda.c (maybe_resolve_dummy): Check lambda_function rather
    than current_binding_level.

Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/lambda.c


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

end of thread, other threads:[~2014-02-21 21:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-17 21:43 [Bug c++/60252] New: [4.7/4.8/4.9 Regression] [c++11] ICE with invalid variable-length array in lambda parameter reichelt at gcc dot gnu.org
2014-02-17 21:44 ` [Bug c++/60252] " reichelt at gcc dot gnu.org
2014-02-18  7:25 ` jakub at gcc dot gnu.org
2014-02-18  9:24 ` rguenth at gcc dot gnu.org
2014-02-21  5:35 ` jason at gcc dot gnu.org
2014-02-21 14:57 ` jason at gcc dot gnu.org
2014-02-21 15:51 ` jason at gcc dot gnu.org
2014-02-21 21:51 ` 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).