public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67247] New: ICE on std::forward args&& inside nested lambda function
@ 2015-08-17 10:43 tower120 at gmail dot com
  2015-08-17 11:03 ` [Bug c++/67247] " trippels at gcc dot gnu.org
  2015-08-19  9:29 ` mpolacek at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: tower120 at gmail dot com @ 2015-08-17 10:43 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67247
           Summary: ICE on std::forward args&& inside nested lambda
                    function
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tower120 at gmail dot com
  Target Milestone: ---

Code as is:
http://coliru.stacked-crooked.com/a/903e76d5446bfeb2
----------------------------------------------------------------
#include <iostream>
#include <tuple>

#include <utility>

template <class F1, class F2>
decltype(auto) operator >> (F1 &&f1, F2 &&f2){
    using namespace std;
    return f2(forward<F1>(f1));
}

template <class F1, class F2>
decltype(auto) operator << (F1 &&f1, F2 &&f2){
    using namespace std;
    return f1(forward<F2>(f2));
}


// curry 2 args pack (temporary)
#define f(...) \
    [](auto&& ...args1){return  \
        [&](auto&& ...args2){return __VA_ARGS__
(std::forward<decltype(args1)>(args1)..., args2...);} ;  /* <-- ICE HERE!*/ \ 
    }


using namespace std;

auto sum(int a, int b){
    return a+b;
}

auto divide(int a, int b){
    return a/b;
}


int main() {
    float a = 10;
    float b = 20;

    auto part1 =  f(divide) << 5;          // just for test purpose

    auto res = sum(a,b) >> f(divide) << 5;

    auto res_ctrl = divide(sum(a,b), 5.0);


    cout << "res : "<< res << endl;
    cout << "ctrl: "<< res_ctrl << endl;

    return 0;
}

----------------------------------------------------------------

C:\Dropbox\C++\exp_chained_call\simple_chain.h:22:49: internal compiler error:
Segmentation fault
         [&](auto&& ...args2){return __VA_ARGS__
(std::forward<decltype(args1)>(args1)..., args2...);} ; \

Without std::forward<decltype(args1)> it is ok.
With [&](auto&& ...args2){return __VA_ARGS__ (args1...,
std::forward<decltype(args2)>(args2)...);} ; ok also.


P.S. I just realize, that args1 is probably stored as &, not && inside
lambda... But ICE is ICE.


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

* [Bug c++/67247] ICE on std::forward args&& inside nested lambda function
  2015-08-17 10:43 [Bug c++/67247] New: ICE on std::forward args&& inside nested lambda function tower120 at gmail dot com
@ 2015-08-17 11:03 ` trippels at gcc dot gnu.org
  2015-08-19  9:29 ` mpolacek at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: trippels at gcc dot gnu.org @ 2015-08-17 11:03 UTC (permalink / raw)
  To: gcc-bugs

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

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-08-17
                 CC|                            |trippels at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
markus@x4 tmp % cat la.ii
template <typename _Tp> _Tp forward (int);
template <class F1, class F2>
auto
operator>> (F1, F2 f2)
{
  return f2 (0);
}

template <class F1, class F2>
decltype (0)
operator<< (F1 f1, F2)
{
  f1 (0);
}

auto divide (int, int)
{
  0 >> [](auto... args1)
  {
    return [&](auto... args2)
    {
      divide (forward<decltype (args1)> (args1)..., args2...);
    };
  } << 0;
}

markus@x4 tmp % g++ -c la.ii
la.ii: In instantiation of ‘divide(int, int)::<lambda(auto:1
...)>::<lambda(auto:2 ...)> [with auto:2 = {int}; auto:1 = {int}]’:
la.ii:13:6:   required from ‘int operator<<(F1, F2) [with F1 = divide(int,
int)::<lambda(auto:1 ...)> [with auto:1 = {int}]::<lambda(auto:2 ...)>; F2 =
int]’
la.ii:24:8:   required from here
la.ii:22:14: internal compiler error: Segmentation fault
       divide (forward<decltype (args1)> (args1)..., args2...);
              ^
0xc795ef crash_signal
        ../../gcc/gcc/toplev.c:352
0x7f7dae93e70f ???
        /var/tmp/glibc/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
0x5c1525 resolve_args
        ../../gcc/gcc/cp/call.c:3942
0x5d8ee9 build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, bool, int)
        ../../gcc/gcc/cp/call.c:4052
0x7666d8 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ../../gcc/gcc/cp/semantics.c:2391
0x643032 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc/gcc/cp/pt.c:15860
0x633ea8 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:15029
0x632d41 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:14440
0x634b0f tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:14612
0x633103 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:14426
0x634b0f tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:14612
0x631815 instantiate_decl(tree_node*, int, bool)
        ../../gcc/gcc/cp/pt.c:21154
0x6b6e42 mark_used(tree_node*, int)
        ../../gcc/gcc/cp/decl2.c:5101
0x5c9f2a build_over_call
        ../../gcc/gcc/cp/call.c:7569
0x5d9cf1 build_op_call_1
        ../../gcc/gcc/cp/call.c:4358
0x5d9cf1 build_op_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int)
        ../../gcc/gcc/cp/call.c:4381
0x7668e8 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ../../gcc/gcc/cp/semantics.c:2408
0x643032 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc/gcc/cp/pt.c:15860
0x633ea8 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:15029
0x632d41 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:14440
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-494977-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Aug 17 11:23:27 2015
Return-Path: <gcc-bugs-return-494977-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 12346 invoked by alias); 17 Aug 2015 11:23:27 -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 12310 invoked by uid 55); 17 Aug 2015 11:23:22 -0000
From: "yroux at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/67127] [ARM] Avoiding odd-number ldrd/strd in movdi introduced a regression on armeb-linux-gnueabihf
Date: Mon, 17 Aug 2015 11:23:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: yroux at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: yroux at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-67127-4-C9JSzYw5zM@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-67127-4@http.gcc.gnu.org/bugzilla/>
References: <bug-67127-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: 2015-08/txt/msg01119.txt.bz2
Content-length: 615

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

--- Comment #2 from Yvan Roux <yroux at gcc dot gnu.org> ---
Author: yroux
Date: Mon Aug 17 11:22:49 2015
New Revision: 226937

URL: https://gcc.gnu.org/viewcvs?rev"6937&root=gcc&view=rev
Log:
2015-08-17  Yvan Roux  <yvan.roux@linaro.org>

        Backport from mainline:
        2015-08-12  Yvan Roux  <yvan.roux@linaro.org>

        PR target/67127
        * config/arm/arm.md (movdi): Restrict illegitimate ldrd/strd checking
        to ARM core registers.


Modified:
    branches/gcc-5-branch/gcc/ChangeLog
    branches/gcc-5-branch/gcc/config/arm/arm.md


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

* [Bug c++/67247] ICE on std::forward args&& inside nested lambda function
  2015-08-17 10:43 [Bug c++/67247] New: ICE on std::forward args&& inside nested lambda function tower120 at gmail dot com
  2015-08-17 11:03 ` [Bug c++/67247] " trippels at gcc dot gnu.org
@ 2015-08-19  9:29 ` mpolacek at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-08-19  9:29 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Testcase in Comment 2 started ICEing with r211084.


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

end of thread, other threads:[~2015-08-19  9:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-17 10:43 [Bug c++/67247] New: ICE on std::forward args&& inside nested lambda function tower120 at gmail dot com
2015-08-17 11:03 ` [Bug c++/67247] " trippels at gcc dot gnu.org
2015-08-19  9:29 ` 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).