public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/55076] New: ice when compiling lambda function
@ 2012-10-25 22:57 tim at klingt dot org
  2012-10-26 10:05 ` [Bug c++/55076] " paolo.carlini at oracle dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: tim at klingt dot org @ 2012-10-25 22:57 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55076
           Summary: ice when compiling lambda function
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tim@klingt.org


Created attachment 28533
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28533
preprocessed source

attached source produces an ICE with gcc-4.7, but not with gcc-4.6:

home/tim/workspace/supercollider/server/supernova/./audio_backend/upsampled_audio_backend.hpp:
In lambda function:
/home/tim/workspace/supercollider/server/supernova/./audio_backend/upsampled_audio_backend.hpp:59:67:
internal compiler error: Segmentation fault

gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc-4.7.real
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.7.2-2ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs
--enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.7 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object
--enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.2 (Ubuntu/Linaro 4.7.2-2ubuntu1)


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

* [Bug c++/55076] ice when compiling lambda function
  2012-10-25 22:57 [Bug c++/55076] New: ice when compiling lambda function tim at klingt dot org
@ 2012-10-26 10:05 ` paolo.carlini at oracle dot com
  2012-10-26 13:20 ` markus at trippelsdorf dot de
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-10-26 10:05 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2012-10-26
     Ever Confirmed|0                           |1

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-10-26 10:04:46 UTC ---
Please reduce the testcase to a manageable size: we have open quite a few
issues about lambdas and most likely this is a duplicate, but it's
unnecessarily hard to tell with a 600+ KB attachment.


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

* [Bug c++/55076] ice when compiling lambda function
  2012-10-25 22:57 [Bug c++/55076] New: ice when compiling lambda function tim at klingt dot org
  2012-10-26 10:05 ` [Bug c++/55076] " paolo.carlini at oracle dot com
@ 2012-10-26 13:20 ` markus at trippelsdorf dot de
  2012-10-26 13:31 ` paolo.carlini at oracle dot com
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: markus at trippelsdorf dot de @ 2012-10-26 13:20 UTC (permalink / raw)
  To: gcc-bugs


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

Markus Trippelsdorf <markus at trippelsdorf dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |markus at trippelsdorf dot
                   |                            |de

--- Comment #2 from Markus Trippelsdorf <markus at trippelsdorf dot de> 2012-10-26 13:19:45 UTC ---
Testcase was over 7.1 Mbyte, but parallel creduce is quick.

markus@x4 tmp % cat test.ii
void src_new (int);
template < bool > struct A
{
    void prepare ()
    {
        ([=] { src_new (con); });
    } 
    int con;
};

markus@x4 tmp % g++ -std=c++11 -c test.ii
test.ii: In lambda function:
test.ii:6:28: internal compiler error: Segmentation fault
         ([=] { src_new (con); });
                            ^


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

* [Bug c++/55076] ice when compiling lambda function
  2012-10-25 22:57 [Bug c++/55076] New: ice when compiling lambda function tim at klingt dot org
  2012-10-26 10:05 ` [Bug c++/55076] " paolo.carlini at oracle dot com
  2012-10-26 13:20 ` markus at trippelsdorf dot de
@ 2012-10-26 13:31 ` paolo.carlini at oracle dot com
  2012-10-26 13:42 ` markus at trippelsdorf dot de
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-10-26 13:31 UTC (permalink / raw)
  To: gcc-bugs


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

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

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

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-10-26 13:30:35 UTC ---
Indeed. Thanks Markus! Next, whether it's actually a (more or less manifest)
dup.


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

* [Bug c++/55076] ice when compiling lambda function
  2012-10-25 22:57 [Bug c++/55076] New: ice when compiling lambda function tim at klingt dot org
                   ` (2 preceding siblings ...)
  2012-10-26 13:31 ` paolo.carlini at oracle dot com
@ 2012-10-26 13:42 ` markus at trippelsdorf dot de
  2012-10-26 14:01 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: markus at trippelsdorf dot de @ 2012-10-26 13:42 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #4 from Markus Trippelsdorf <markus at trippelsdorf dot de> 2012-10-26 13:41:36 UTC ---
Valgrind says:

markus@x4 tmp % /var/tmp/gcc_valgrind/usr/local/bin/g++ -std=c++11 -c test.ii
==10632== Invalid read of size 2
==10632==    at 0x668622: lvalue_kind(tree_node const*) (tree.c:148)
==10632==    by 0x668803: lvalue_kind(tree_node const*) (tree.c:103)
==10632==    by 0x6691C8: lvalue_p(tree_node const*) (tree.c:269)
==10632==    by 0x4CF7EC: standard_conversion(tree_node*, tree_node*,
tree_node*, bool, int) (call.c:1104)
==10632==    by 0x4D5629: implicit_conversion(tree_node*, tree_node*,
tree_node*, bool, int, int) (call.c:1696)
==10632==    by 0x4D7702: add_function_candidate(z_candidate**, tree_node*,
tree_node*, tree_node*, vec_t<tree_node*> const*, tree_node*, tree_node*,
 int, int) (call.c:1987)
==10632==    by 0x4D3EEE: add_candidates(tree_node*, tree_node*,
vec_t<tree_node*> const*, tree_node*, tree_node*, bool, tree_node*, tree_node*,
int,
 z_candidate**, int) (call.c:4954)
==10632==    by 0x4DA7B0: perform_overload_resolution(tree_node*,
vec_t<tree_node*> const*, z_candidate**, bool*, int) (call.c:3807)
==10632==    by 0x4E0D5C: build_new_function_call(tree_node*,
vec_t<tree_node*>**, bool, int) (call.c:3884)
==10632==    by 0x656EEA: finish_call_expr(tree_node*, vec_t<tree_node*>**,
bool, bool, int) (semantics.c:2190)
==10632==    by 0x5CEA2E: cp_parser_postfix_expression(cp_parser*, bool, bool,
bool, cp_id_kind*) (parser.c:5814)
==10632==    by 0x5D9D32: cp_parser_unary_expression(cp_parser*, bool, bool,
cp_id_kind*) (parser.c:6682)
==10632==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==10632==


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

* [Bug c++/55076] ice when compiling lambda function
  2012-10-25 22:57 [Bug c++/55076] New: ice when compiling lambda function tim at klingt dot org
                   ` (3 preceding siblings ...)
  2012-10-26 13:42 ` markus at trippelsdorf dot de
@ 2012-10-26 14:01 ` redi at gcc dot gnu.org
  2012-10-26 14:07 ` markus at trippelsdorf dot de
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2012-10-26 14:01 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-10-26 14:00:45 UTC ---
probably bug 54403


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

* [Bug c++/55076] ice when compiling lambda function
  2012-10-25 22:57 [Bug c++/55076] New: ice when compiling lambda function tim at klingt dot org
                   ` (4 preceding siblings ...)
  2012-10-26 14:01 ` redi at gcc dot gnu.org
@ 2012-10-26 14:07 ` markus at trippelsdorf dot de
  2012-10-26 16:49 ` markus at trippelsdorf dot de
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: markus at trippelsdorf dot de @ 2012-10-26 14:07 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #6 from Markus Trippelsdorf <markus at trippelsdorf dot de> 2012-10-26 14:07:11 UTC ---
(In reply to comment #5)
> probably bug 54403

Yes. Valgrind backtrace is the same.


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

* [Bug c++/55076] ice when compiling lambda function
  2012-10-25 22:57 [Bug c++/55076] New: ice when compiling lambda function tim at klingt dot org
                   ` (5 preceding siblings ...)
  2012-10-26 14:07 ` markus at trippelsdorf dot de
@ 2012-10-26 16:49 ` markus at trippelsdorf dot de
  2012-10-26 23:38 ` paolo.carlini at oracle dot com
  2013-02-14 23:43 ` paolo.carlini at oracle dot com
  8 siblings, 0 replies; 10+ messages in thread
From: markus at trippelsdorf dot de @ 2012-10-26 16:49 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #7 from Markus Trippelsdorf <markus at trippelsdorf dot de> 2012-10-26 16:48:46 UTC ---
What about the following naïve patch? 
At least it fixes the problem and causes no new test suite regressions.

diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 8d555c2..0f1a75d 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -145,7 +145,7 @@ lvalue_kind (const_tree ref)
     case ARRAY_REF:
     case PARM_DECL:
     case RESULT_DECL:
-      if (TREE_CODE (TREE_TYPE (ref)) != METHOD_TYPE)
+      if (TREE_TYPE (ref) && TREE_CODE (TREE_TYPE (ref)) != METHOD_TYPE)
        return clk_ordinary;
       break;


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

* [Bug c++/55076] ice when compiling lambda function
  2012-10-25 22:57 [Bug c++/55076] New: ice when compiling lambda function tim at klingt dot org
                   ` (6 preceding siblings ...)
  2012-10-26 16:49 ` markus at trippelsdorf dot de
@ 2012-10-26 23:38 ` paolo.carlini at oracle dot com
  2013-02-14 23:43 ` paolo.carlini at oracle dot com
  8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-10-26 23:38 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #8 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-10-26 23:38:33 UTC ---
I think that at some point I had the same trick in my local tree too, then I
don't remember sending it to the mailing list, not even as a RFC. I think you
should, CC Jason, and ask whether is it possible that at that point TREE_TYPE
is not set or the check would just paper over the real issue.


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

* [Bug c++/55076] ice when compiling lambda function
  2012-10-25 22:57 [Bug c++/55076] New: ice when compiling lambda function tim at klingt dot org
                   ` (7 preceding siblings ...)
  2012-10-26 23:38 ` paolo.carlini at oracle dot com
@ 2013-02-14 23:43 ` paolo.carlini at oracle dot com
  8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-02-14 23:43 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #9 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-02-14 23:42:45 UTC ---
Fixed mainline and 4.7.3.

*** This bug has been marked as a duplicate of bug 54122 ***


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

end of thread, other threads:[~2013-02-14 23:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-25 22:57 [Bug c++/55076] New: ice when compiling lambda function tim at klingt dot org
2012-10-26 10:05 ` [Bug c++/55076] " paolo.carlini at oracle dot com
2012-10-26 13:20 ` markus at trippelsdorf dot de
2012-10-26 13:31 ` paolo.carlini at oracle dot com
2012-10-26 13:42 ` markus at trippelsdorf dot de
2012-10-26 14:01 ` redi at gcc dot gnu.org
2012-10-26 14:07 ` markus at trippelsdorf dot de
2012-10-26 16:49 ` markus at trippelsdorf dot de
2012-10-26 23:38 ` paolo.carlini at oracle dot com
2013-02-14 23:43 ` 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).