public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/64227] New: Forwarding an argument of a function template to a generic lambda causes a compiler crash
@ 2014-12-08 16:32 ville.voutilainen at gmail dot com
  2014-12-08 16:51 ` [Bug c++/64227] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: ville.voutilainen at gmail dot com @ 2014-12-08 16:32 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 64227
           Summary: Forwarding an argument of a function template to a
                    generic lambda causes a compiler crash
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ville.voutilainen at gmail dot com
                CC: jason at redhat dot com

The problem occurs with forward and move, but not with a static_cast<T&&>(t).

#include <utility>

template<typename T>
auto greater_than(T&& t)
{
  return [val = std::forward<T&&>(t)] (const auto& arg) { return arg > val; };
}



template<typename Functor>
void g(Functor f)
{
  for (int i = 0; i < 100000; i++)
    f(i);
}

int main()
{
  g(greater_than(10));
}

[ville@localhost ~]$ g++ --std=c++1z -c lambda-bada-boom.cpp 
lambda-bada-boom.cpp: In function ‘auto greater_than(T&&)’:
lambda-bada-boom.cpp:6:36: internal compiler error: Segmentation fault
   return [val = std::forward<T&&>(t)] (const auto& arg) { return arg > val; };
                                    ^
0xc954af crash_signal
        ../../gcc/toplev.c:359
0xf1bb0a tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
        ../../gcc/tree.h:2886
0xf1bb0a variably_modified_type_p(tree_node*, tree_node*)
        ../../gcc/tree.c:8809
0x7d9b79 add_capture(tree_node*, tree_node*, tree_node*, bool, bool)
        ../../gcc/cp/lambda.c:486
0x6e6f9f cp_parser_lambda_introducer
        ../../gcc/cp/parser.c:9252
0x6e6f9f cp_parser_lambda_expression
        ../../gcc/cp/parser.c:8964
0x6e6f9f cp_parser_primary_expression
        ../../gcc/cp/parser.c:4447
0x6ebe0d cp_parser_postfix_expression
        ../../gcc/cp/parser.c:6089
0x6eca19 cp_parser_unary_expression
        ../../gcc/cp/parser.c:7370
0x6ed7a7 cp_parser_binary_expression
        ../../gcc/cp/parser.c:8104
0x6edd1f cp_parser_assignment_expression
        ../../gcc/cp/parser.c:8347
0x6f036d cp_parser_expression
        ../../gcc/cp/parser.c:8501
0x6e60d2 cp_parser_jump_statement
        ../../gcc/cp/parser.c:10995
0x6e60d2 cp_parser_statement
        ../../gcc/cp/parser.c:9651
0x6e6842 cp_parser_statement_seq_opt
        ../../gcc/cp/parser.c:10039
0x6e699b cp_parser_compound_statement
        ../../gcc/cp/parser.c:9993
0x6f3e8b cp_parser_function_body
        ../../gcc/cp/parser.c:19093
0x6f3e8b cp_parser_ctor_initializer_opt_and_function_body
        ../../gcc/cp/parser.c:19129
0x6fe1ca cp_parser_function_definition_after_declarator
        ../../gcc/cp/parser.c:23369
0x700103 cp_parser_function_definition_from_specifiers_and_declarator
        ../../gcc/cp/parser.c:23281
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
>From gcc-bugs-return-469769-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Dec 08 16:46:18 2014
Return-Path: <gcc-bugs-return-469769-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 2644 invoked by alias); 8 Dec 2014 16:46:17 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 2599 invoked by uid 55); 8 Dec 2014 16:46:13 -0000
From: "joseph at codesourcery dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/64223] same warning repeated twice with same line number
Date: Mon, 08 Dec 2014 16:46:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Version: 4.8.3
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: joseph at codesourcery dot com
X-Bugzilla-Status: WAITING
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-64223-4-DTRiorvDde@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64223-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64223-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-12/txt/msg00776.txt.bz2
Content-length: 532

https://gcc.gnu.org/bugzilla/show_bug.cgi?idd223

--- Comment #3 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
On Mon, 8 Dec 2014, harald at gigawatt dot nl wrote:

> I do not know if the problem is in the headers (that they should not be
> specifying the format attribute), or in GCC (that it should be ignoring the
> format attribute if it's already known).

GCC is meant to ignore duplicate attributes; maybe the code in
decl_attributes is failing to detect this one as duplicate for some
reason.


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

* [Bug c++/64227] Forwarding an argument of a function template to a generic lambda causes a compiler crash
  2014-12-08 16:32 [Bug c++/64227] New: Forwarding an argument of a function template to a generic lambda causes a compiler crash ville.voutilainen at gmail dot com
@ 2014-12-08 16:51 ` redi at gcc dot gnu.org
  2014-12-08 16:52 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2014-12-08 16:51 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-12-08
     Ever confirmed|0                           |1


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

* [Bug c++/64227] Forwarding an argument of a function template to a generic lambda causes a compiler crash
  2014-12-08 16:32 [Bug c++/64227] New: Forwarding an argument of a function template to a generic lambda causes a compiler crash ville.voutilainen at gmail dot com
  2014-12-08 16:51 ` [Bug c++/64227] " redi at gcc dot gnu.org
@ 2014-12-08 16:52 ` redi at gcc dot gnu.org
  2015-03-04  8:01 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2014-12-08 16:52 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxim.yegorushkin at gmail dot com

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 64085 has been marked as a duplicate of this bug. ***


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

* [Bug c++/64227] Forwarding an argument of a function template to a generic lambda causes a compiler crash
  2014-12-08 16:32 [Bug c++/64227] New: Forwarding an argument of a function template to a generic lambda causes a compiler crash ville.voutilainen at gmail dot com
  2014-12-08 16:51 ` [Bug c++/64227] " redi at gcc dot gnu.org
  2014-12-08 16:52 ` redi at gcc dot gnu.org
@ 2015-03-04  8:01 ` paolo.carlini at oracle dot com
  2015-03-04  8:14 ` ville.voutilainen at gmail dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-03-04  8:01 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |paolo.carlini at oracle dot com

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
I guess we should resolve this one as fixed and re-open c++/64085, which still
ICEs for me. Agreed?


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

* [Bug c++/64227] Forwarding an argument of a function template to a generic lambda causes a compiler crash
  2014-12-08 16:32 [Bug c++/64227] New: Forwarding an argument of a function template to a generic lambda causes a compiler crash ville.voutilainen at gmail dot com
                   ` (2 preceding siblings ...)
  2015-03-04  8:01 ` paolo.carlini at oracle dot com
@ 2015-03-04  8:14 ` ville.voutilainen at gmail dot com
  2015-03-04 10:21 ` paolo at gcc dot gnu.org
  2015-03-04 10:22 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: ville.voutilainen at gmail dot com @ 2015-03-04  8:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
(In reply to Paolo Carlini from comment #2)
> I guess we should resolve this one as fixed and re-open c++/64085, which
> still ICEs for me. Agreed?

Yes, this bug doesn't reproduce anymore, whereas 64085 ICEs.


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

* [Bug c++/64227] Forwarding an argument of a function template to a generic lambda causes a compiler crash
  2014-12-08 16:32 [Bug c++/64227] New: Forwarding an argument of a function template to a generic lambda causes a compiler crash ville.voutilainen at gmail dot com
                   ` (3 preceding siblings ...)
  2015-03-04  8:14 ` ville.voutilainen at gmail dot com
@ 2015-03-04 10:21 ` paolo at gcc dot gnu.org
  2015-03-04 10:22 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: paolo at gcc dot gnu.org @ 2015-03-04 10:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Wed Mar  4 10:20:23 2015
New Revision: 221181

URL: https://gcc.gnu.org/viewcvs?rev=221181&root=gcc&view=rev
Log:
2015-03-04  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/64227
    * g++.dg/cpp1y/lambda-generic-ice1.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp1y/lambda-generic-ice1.C
Modified:
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/64227] Forwarding an argument of a function template to a generic lambda causes a compiler crash
  2014-12-08 16:32 [Bug c++/64227] New: Forwarding an argument of a function template to a generic lambda causes a compiler crash ville.voutilainen at gmail dot com
                   ` (4 preceding siblings ...)
  2015-03-04 10:21 ` paolo at gcc dot gnu.org
@ 2015-03-04 10:22 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-03-04 10:22 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|paolo.carlini at oracle dot com    |
         Resolution|---                         |FIXED
   Target Milestone|---                         |5.0

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Ok, I added a testcase. Note that back in December this specific issue was a
Regression in mainline.


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

end of thread, other threads:[~2015-03-04 10:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-08 16:32 [Bug c++/64227] New: Forwarding an argument of a function template to a generic lambda causes a compiler crash ville.voutilainen at gmail dot com
2014-12-08 16:51 ` [Bug c++/64227] " redi at gcc dot gnu.org
2014-12-08 16:52 ` redi at gcc dot gnu.org
2015-03-04  8:01 ` paolo.carlini at oracle dot com
2015-03-04  8:14 ` ville.voutilainen at gmail dot com
2015-03-04 10:21 ` paolo at gcc dot gnu.org
2015-03-04 10:22 ` paolo.carlini at oracle dot com

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).