public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/41896]  New: [cxx0x-lambda] Segfault because of a nested lambda function
@ 2009-11-01 14:31 adam dot rak at streamnovation dot com
  2009-11-01 15:33 ` [Bug c++/41896] " adam dot rak at streamnovation dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: adam dot rak at streamnovation dot com @ 2009-11-01 14:31 UTC (permalink / raw)
  To: gcc-bugs

Code for triggering the BUG:

float nested_lambda()
{
        float val;

        [val]()
        {
                [val]()
                {
                }
        }
}

 float nested_lambda() nested_lambda()::<lambda()>
<stdin>:7:4: internal compiler error: Szegmens hiba
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

according to gdb, the segfault originates at: cp/semantics.c:2814, and it's a
null pointer dereferencing. After a bit of inspection, it was revealed that in
the code:

decl = add_default_capture (lambda_stack,

llambda_stack is NULL.

I tried the code:
float nested_lambda()
{
        float val;

        [val]()
        {
                float val2 = val;
                [val2]()
                {
                }
        }
}

which seems to be working fine.


-- 
           Summary: [cxx0x-lambda] Segfault because of a nested lambda
                    function
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: adam dot rak at streamnovation dot com
 GCC build triplet: x86_64-unknown-linux
  GCC host triplet: x86_64-unknown-linux
GCC target triplet: x86_64-unknown-linux


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


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

* [Bug c++/41896] [cxx0x-lambda] Segfault because of a nested lambda function
  2009-11-01 14:31 [Bug c++/41896] New: [cxx0x-lambda] Segfault because of a nested lambda function adam dot rak at streamnovation dot com
@ 2009-11-01 15:33 ` adam dot rak at streamnovation dot com
  2009-11-01 15:39 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: adam dot rak at streamnovation dot com @ 2009-11-01 15:33 UTC (permalink / raw)
  To: gcc-bugs



-- 

adam dot rak at streamnovation dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical


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


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

* [Bug c++/41896] [cxx0x-lambda] Segfault because of a nested lambda function
  2009-11-01 14:31 [Bug c++/41896] New: [cxx0x-lambda] Segfault because of a nested lambda function adam dot rak at streamnovation dot com
  2009-11-01 15:33 ` [Bug c++/41896] " adam dot rak at streamnovation dot com
@ 2009-11-01 15:39 ` pinskia at gcc dot gnu dot org
  2009-11-15 16:59 ` paolo dot carlini at oracle dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-11-01 15:39 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |normal


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


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

* [Bug c++/41896] [cxx0x-lambda] Segfault because of a nested lambda function
  2009-11-01 14:31 [Bug c++/41896] New: [cxx0x-lambda] Segfault because of a nested lambda function adam dot rak at streamnovation dot com
  2009-11-01 15:33 ` [Bug c++/41896] " adam dot rak at streamnovation dot com
  2009-11-01 15:39 ` pinskia at gcc dot gnu dot org
@ 2009-11-15 16:59 ` paolo dot carlini at oracle dot com
  2010-01-18  2:37 ` paolo dot carlini at oracle dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-11-15 16:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from paolo dot carlini at oracle dot com  2009-11-15 16:58 -------
Let's CC Jason here too, being an issue with lambda...


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu dot org


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


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

* [Bug c++/41896] [cxx0x-lambda] Segfault because of a nested lambda function
  2009-11-01 14:31 [Bug c++/41896] New: [cxx0x-lambda] Segfault because of a nested lambda function adam dot rak at streamnovation dot com
                   ` (2 preceding siblings ...)
  2009-11-15 16:59 ` paolo dot carlini at oracle dot com
@ 2010-01-18  2:37 ` paolo dot carlini at oracle dot com
  2010-02-10 22:02 ` jason at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-01-18  2:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from paolo dot carlini at oracle dot com  2010-01-18 02:37 -------
*** Bug 42738 has been marked as a duplicate of this bug. ***


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vimal78 at gmail dot com


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


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

* [Bug c++/41896] [cxx0x-lambda] Segfault because of a nested lambda function
  2009-11-01 14:31 [Bug c++/41896] New: [cxx0x-lambda] Segfault because of a nested lambda function adam dot rak at streamnovation dot com
                   ` (3 preceding siblings ...)
  2010-01-18  2:37 ` paolo dot carlini at oracle dot com
@ 2010-02-10 22:02 ` jason at gcc dot gnu dot org
  2010-02-10 22:45 ` jason at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-02-10 22:02 UTC (permalink / raw)
  To: gcc-bugs



-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jason at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-02-10 22:01:58
               date|                            |


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


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

* [Bug c++/41896] [cxx0x-lambda] Segfault because of a nested lambda function
  2009-11-01 14:31 [Bug c++/41896] New: [cxx0x-lambda] Segfault because of a nested lambda function adam dot rak at streamnovation dot com
                   ` (4 preceding siblings ...)
  2010-02-10 22:02 ` jason at gcc dot gnu dot org
@ 2010-02-10 22:45 ` jason at gcc dot gnu dot org
  2010-02-10 22:46 ` [Bug c++/41896] [c++0x] " jason at gcc dot gnu dot org
  2010-02-11  2:13 ` jason at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-02-10 22:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jason at gcc dot gnu dot org  2010-02-10 22:45 -------
Subject: Bug 41896

Author: jason
Date: Wed Feb 10 22:45:07 2010
New Revision: 156673

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156673
Log:
        PR c++/41896
        * semantics.c (outer_lambda_capture_p): Use current_function_decl
        instead of current_class_type.

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


-- 


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


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

* [Bug c++/41896] [c++0x] Segfault because of a nested lambda function
  2009-11-01 14:31 [Bug c++/41896] New: [cxx0x-lambda] Segfault because of a nested lambda function adam dot rak at streamnovation dot com
                   ` (5 preceding siblings ...)
  2010-02-10 22:45 ` jason at gcc dot gnu dot org
@ 2010-02-10 22:46 ` jason at gcc dot gnu dot org
  2010-02-11  2:13 ` jason at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-02-10 22:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jason at gcc dot gnu dot org  2010-02-10 22:46 -------
Fixed.


-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
            Summary|[cxx0x-lambda] Segfault     |[c++0x] Segfault because of
                   |because of a nested lambda  |a nested lambda function
                   |function                    |
   Target Milestone|---                         |4.5.0


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


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

* [Bug c++/41896] [c++0x] Segfault because of a nested lambda function
  2009-11-01 14:31 [Bug c++/41896] New: [cxx0x-lambda] Segfault because of a nested lambda function adam dot rak at streamnovation dot com
                   ` (6 preceding siblings ...)
  2010-02-10 22:46 ` [Bug c++/41896] [c++0x] " jason at gcc dot gnu dot org
@ 2010-02-11  2:13 ` jason at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-02-11  2:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jason at gcc dot gnu dot org  2010-02-11 02:13 -------
Subject: Bug 41896

Author: jason
Date: Thu Feb 11 02:12:53 2010
New Revision: 156678

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156678
Log:
        PR c++/41896
        * semantics.c (outer_lambda_capture_p): Revert.
        (add_capture): Only finish_member_declaration if
        we're in the lambda class.
        (register_capture_members): New.
        * cp-tree.h: Declare it.
        * parser.c (cp_parser_lambda_expression): Call it.

Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/parser.c
    trunk/gcc/cp/semantics.c


-- 


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


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

end of thread, other threads:[~2010-02-11  2:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-01 14:31 [Bug c++/41896] New: [cxx0x-lambda] Segfault because of a nested lambda function adam dot rak at streamnovation dot com
2009-11-01 15:33 ` [Bug c++/41896] " adam dot rak at streamnovation dot com
2009-11-01 15:39 ` pinskia at gcc dot gnu dot org
2009-11-15 16:59 ` paolo dot carlini at oracle dot com
2010-01-18  2:37 ` paolo dot carlini at oracle dot com
2010-02-10 22:02 ` jason at gcc dot gnu dot org
2010-02-10 22:45 ` jason at gcc dot gnu dot org
2010-02-10 22:46 ` [Bug c++/41896] [c++0x] " jason at gcc dot gnu dot org
2010-02-11  2:13 ` jason at gcc dot gnu dot 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).