Bug 49276 - [C++0x] Segmentation fault with default lambda parameter in member function
[C++0x] Segmentation fault with default lambda parameter in member function
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: c++
4.6.0
: P3 normal
: 4.6.1
Assigned To: Jakub Jelinek
: ice-on-valid-code
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-06-03 13:24 UTC by Lepesme "Jiboo" Jean-Baptiste
Modified: 2011-06-03 20:37 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-06-03 13:36:58


Attachments
The segfault source + 2 different sources that pass + temps + compile logs (274.95 KB, application/x-gzip)
2011-06-03 13:24 UTC, Lepesme "Jiboo" Jean-Baptiste
Details
gcc46-pr49276.patch (1.35 KB, patch)
2011-06-03 15:06 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lepesme "Jiboo" Jean-Baptiste 2011-06-03 13:24:40 UTC
Created attachment 24424 [details]
The segfault source + 2 different sources that pass + temps + compile logs

Hi, I don't know if what I'm doing is correct, but GCC crashs on it.

Segfault: Member function with a default lambda parameter.
Pass-1: Global function with a default lambda parameter.
Pass-2: Member function without default lambda parameter.

[jiboo@localhost gccbag]$ uname -a
Linux localhost.localdomain 2.6.38.6-27.fc15.x86_64 #1 SMP Sun May 15 17:23:28 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

[jiboo@localhost gccbag]$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.6.0/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.6.0 20110509 (Red Hat 4.6.0-7) (GCC) 

[jiboo@localhost gccbag]$ g++ -v -save-temps -Wall -Wextra -fno-strict-aliasing -fwrapv -std=c++0x boog-pass-1.cpp 2>boog-pass-1.log
[jiboo@localhost gccbag]$ g++ -v -save-temps -Wall -Wextra -fno-strict-aliasing -fwrapv -std=c++0x boog-pass-2.cpp 2>boog-pass-2.log
[jiboo@localhost gccbag]$ g++ -v -save-temps -Wall -Wextra -fno-strict-aliasing -fwrapv -std=c++0x boog-segfault.cpp 2>boog-segfault.log
Comment 1 Jonathan Wakely 2011-06-03 13:36:58 UTC
confirmed
Comment 2 Jakub Jelinek 2011-06-03 13:48:55 UTC
@@ -943,7 +943,7 @@ write_nested_name (const tree decl)
   else
     {
       /* No, just use <prefix>  */
-      write_prefix (DECL_CONTEXT (decl));
+      write_prefix (CP_DECL_CONTEXT (decl));
       write_unqualified_name (decl);
     }
   write_char ('E');

fixes this, will try to reduce and submit patch.
Comment 3 Jakub Jelinek 2011-06-03 15:06:30 UTC
Created attachment 24425 [details]
gcc46-pr49276.patch

Untested fix.
Comment 4 Jakub Jelinek 2011-06-03 20:19:46 UTC
Author: jakub
Date: Fri Jun  3 20:19:42 2011
New Revision: 174619

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=174619
Log:
	PR c++/49276
	* mangle.c (write_nested_name): Use CP_DECL_CONTEXT instead of
	DECL_CONTEXT.

	* g++.dg/cpp0x/lambda/lambda-mangle2.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle2.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/mangle.c
    trunk/gcc/testsuite/ChangeLog
Comment 5 Jakub Jelinek 2011-06-03 20:21:41 UTC
Author: jakub
Date: Fri Jun  3 20:21:38 2011
New Revision: 174620

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=174620
Log:
	PR c++/49276
	* mangle.c (write_nested_name): Use CP_DECL_CONTEXT instead of
	DECL_CONTEXT.

	* g++.dg/cpp0x/lambda/lambda-mangle2.C: New test.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle2.C
Modified:
    branches/gcc-4_6-branch/gcc/cp/ChangeLog
    branches/gcc-4_6-branch/gcc/cp/mangle.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
Comment 6 Jakub Jelinek 2011-06-03 20:37:39 UTC
Fixed.