public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58824] New: Lambda trigger internal compiler error
@ 2013-10-21  9:23 thomas.sanchz at gmail dot com
  2013-10-21  9:25 ` [Bug c++/58824] " thomas.sanchz at gmail dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: thomas.sanchz at gmail dot com @ 2013-10-21  9:23 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58824
           Summary: Lambda trigger internal compiler error
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: thomas.sanchz at gmail dot com

Created attachment 31058
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31058&action=edit
Source file + ii + s

Hi,

Please see in attached file the source triggering an internal error in gcc.

The source file is compiled like this:

$> g++ -std=c++11 -W -Wall -Wextra test.cpp 
test.cpp: In instantiation of ‘struct test<dummy>::__lambda0’:
test.cpp:5:8:   required from here
test.cpp:8:20: internal compiler error: in tsubst_copy, at cp/pt.c:12116
         { "test", [this]{} }

The bug is triggered when `this` is captured from a template class and the
lambda is assigned directly from the class definition.

The platform tested is an ubuntu 13.10 with default shipped compiler:

$gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.8.1-10ubuntu8' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.8 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin
--with-system-zlib --disable-browser-plugin --enable-java-awt=gtk
--enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre
--enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --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.8.1 (Ubuntu/Linaro 4.8.1-10ubuntu8) 

The bug is still present in gcc4.9 (tested via: http://gcc.godbolt.org/).
I joined the *i files even if I doubt that they'll be helpful in this
particular bug.
>From gcc-bugs-return-432321-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Oct 21 09:24:41 2013
Return-Path: <gcc-bugs-return-432321-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 2773 invoked by alias); 21 Oct 2013 09:24:40 -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 2399 invoked by uid 48); 21 Oct 2013 09:24:36 -0000
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/58742] [4.7/4.8/4.9 Regression] pointer arithmetic simplification
Date: Mon, 21 Oct 2013 09:24:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords: missed-optimization
X-Bugzilla-Severity: normal
X-Bugzilla-Who: rguenth at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.7.4
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: component cf_known_to_work target_milestone short_desc cf_known_to_fail
Message-ID: <bug-58742-4-SZ58i8knzK@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-58742-4@http.gcc.gnu.org/bugzilla/>
References: <bug-58742-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: 2013-10/txt/msg01465.txt.bz2
Content-length: 2162

http://gcc.gnu.org/bugzilla/show_bug.cgi?idX742

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|tree-optimization           |middle-end
      Known to work|                            |4.1.2
   Target Milestone|---                         |4.7.4
            Summary|pointer arithmetic          |[4.7/4.8/4.9 Regression]
                   |simplification              |pointer arithmetic
                   |                            |simplification
      Known to fail|                            |4.2.0

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
This case is a signed exact division followed by an unsigned multiply.  We do
that to avoid introducing undefined signed overflow.

signed exact division and unsigned multiply still cancel out though, handling
of these is in extract_muldiv (ugh).  I'm not going to enhance that but
pattern match this case.  Testing

Index: gcc/fold-const.c
==================================================================--- gcc/fold-const.c    (revision 203885)
+++ gcc/fold-const.c    (working copy)
@@ -11002,6 +11002,13 @@ fold_binary_loc (location_t loc,
                                fold_build2_loc (loc, MULT_EXPR, type,
                                             build_int_cst (type, 2) , arg1));

+         /* ((T) (X /[ex] C)) * C cancels out if the conversion is
+            sign-changing only.  */
+         if (TREE_CODE (arg1) == INTEGER_CST
+             && TREE_CODE (arg0) == EXACT_DIV_EXPR
+             && operand_equal_p (arg1, TREE_OPERAND (arg0, 1), 0))
+           return fold_convert_loc (loc, type, TREE_OPERAND (arg0, 0));
+
          strict_overflow_p = false;
          if (TREE_CODE (arg1) == INTEGER_CST
              && 0 != (tem = extract_muldiv (op0, arg1, code, NULL_TREE,

note that this simplification worked in 4.1.2 but stopped working in 4.2.0.
Likely a wrong-code fix for extract_muldiv disabled this case (the way
that function works makes special casing a pattern like above impossible).


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

* [Bug c++/58824] Lambda trigger internal compiler error
  2013-10-21  9:23 [Bug c++/58824] New: Lambda trigger internal compiler error thomas.sanchz at gmail dot com
@ 2013-10-21  9:25 ` thomas.sanchz at gmail dot com
  2013-10-21  9:27 ` paolo.carlini at oracle dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: thomas.sanchz at gmail dot com @ 2013-10-21  9:25 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Sanchez <thomas.sanchz at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #31058|0                           |1
        is obsolete|                            |

--- Comment #1 from Thomas Sanchez <thomas.sanchz at gmail dot com> ---
Created attachment 31059
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31059&action=edit
Only source file

Sorry for the archive...


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

* [Bug c++/58824] Lambda trigger internal compiler error
  2013-10-21  9:23 [Bug c++/58824] New: Lambda trigger internal compiler error thomas.sanchz at gmail dot com
  2013-10-21  9:25 ` [Bug c++/58824] " thomas.sanchz at gmail dot com
@ 2013-10-21  9:27 ` paolo.carlini at oracle dot com
  2013-10-21  9:30 ` thomas.sanchz at gmail dot com
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-10-21  9:27 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-10-21
             Blocks|                            |54367
     Ever confirmed|0                           |1

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Please do your best to simplify the testcase to a few lines with no includes,
to speed up the debugging. In my experience, less than 100 lines are almost
always enough.


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

* [Bug c++/58824] Lambda trigger internal compiler error
  2013-10-21  9:23 [Bug c++/58824] New: Lambda trigger internal compiler error thomas.sanchz at gmail dot com
  2013-10-21  9:25 ` [Bug c++/58824] " thomas.sanchz at gmail dot com
  2013-10-21  9:27 ` paolo.carlini at oracle dot com
@ 2013-10-21  9:30 ` thomas.sanchz at gmail dot com
  2013-10-21  9:33 ` paolo.carlini at oracle dot com
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: thomas.sanchz at gmail dot com @ 2013-10-21  9:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Thomas Sanchez <thomas.sanchz at gmail dot com> ---
The code is 21 lines... I can't reproduce the bug otherwise...


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

* [Bug c++/58824] Lambda trigger internal compiler error
  2013-10-21  9:23 [Bug c++/58824] New: Lambda trigger internal compiler error thomas.sanchz at gmail dot com
                   ` (2 preceding siblings ...)
  2013-10-21  9:30 ` thomas.sanchz at gmail dot com
@ 2013-10-21  9:33 ` paolo.carlini at oracle dot com
  2013-10-21  9:34 ` paolo.carlini at oracle dot com
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-10-21  9:33 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|thomas.sanchz at gmail dot com     |

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Almost certainly Dup of PR58761


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

* [Bug c++/58824] Lambda trigger internal compiler error
  2013-10-21  9:23 [Bug c++/58824] New: Lambda trigger internal compiler error thomas.sanchz at gmail dot com
                   ` (3 preceding siblings ...)
  2013-10-21  9:33 ` paolo.carlini at oracle dot com
@ 2013-10-21  9:34 ` paolo.carlini at oracle dot com
  2013-10-21  9:40 ` thomas.sanchz at gmail dot com
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-10-21  9:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> ---
I said *without includes* ;)


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

* [Bug c++/58824] Lambda trigger internal compiler error
  2013-10-21  9:23 [Bug c++/58824] New: Lambda trigger internal compiler error thomas.sanchz at gmail dot com
                   ` (4 preceding siblings ...)
  2013-10-21  9:34 ` paolo.carlini at oracle dot com
@ 2013-10-21  9:40 ` thomas.sanchz at gmail dot com
  2013-10-21  9:42 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: thomas.sanchz at gmail dot com @ 2013-10-21  9:40 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Sanchez <thomas.sanchz at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #31059|0                           |1
        is obsolete|                            |
                 CC|                            |thomas.sanchz at gmail dot com

--- Comment #6 from Thomas Sanchez <thomas.sanchz at gmail dot com> ---
Created attachment 31060
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31060&action=edit
Source file

Source file without any include added.


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

* [Bug c++/58824] Lambda trigger internal compiler error
  2013-10-21  9:23 [Bug c++/58824] New: Lambda trigger internal compiler error thomas.sanchz at gmail dot com
                   ` (5 preceding siblings ...)
  2013-10-21  9:40 ` thomas.sanchz at gmail dot com
@ 2013-10-21  9:42 ` paolo.carlini at oracle dot com
  2013-10-21  9:46 ` thomas.sanchz at gmail dot com
  2013-11-18 17:12 ` paolo.carlini at oracle dot com
  8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-10-21  9:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Great, thanks a lot!


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

* [Bug c++/58824] Lambda trigger internal compiler error
  2013-10-21  9:23 [Bug c++/58824] New: Lambda trigger internal compiler error thomas.sanchz at gmail dot com
                   ` (6 preceding siblings ...)
  2013-10-21  9:42 ` paolo.carlini at oracle dot com
@ 2013-10-21  9:46 ` thomas.sanchz at gmail dot com
  2013-11-18 17:12 ` paolo.carlini at oracle dot com
  8 siblings, 0 replies; 10+ messages in thread
From: thomas.sanchz at gmail dot com @ 2013-10-21  9:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Thomas Sanchez <thomas.sanchz at gmail dot com> ---
You're welcome, good luck !


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

* [Bug c++/58824] Lambda trigger internal compiler error
  2013-10-21  9:23 [Bug c++/58824] New: Lambda trigger internal compiler error thomas.sanchz at gmail dot com
                   ` (7 preceding siblings ...)
  2013-10-21  9:46 ` thomas.sanchz at gmail dot com
@ 2013-11-18 17:12 ` paolo.carlini at oracle dot com
  8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-11-18 17:12 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|thomas.sanchz at gmail dot com     |
         Resolution|---                         |DUPLICATE

--- Comment #9 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Dup.

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


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

end of thread, other threads:[~2013-11-18 17:12 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-21  9:23 [Bug c++/58824] New: Lambda trigger internal compiler error thomas.sanchz at gmail dot com
2013-10-21  9:25 ` [Bug c++/58824] " thomas.sanchz at gmail dot com
2013-10-21  9:27 ` paolo.carlini at oracle dot com
2013-10-21  9:30 ` thomas.sanchz at gmail dot com
2013-10-21  9:33 ` paolo.carlini at oracle dot com
2013-10-21  9:34 ` paolo.carlini at oracle dot com
2013-10-21  9:40 ` thomas.sanchz at gmail dot com
2013-10-21  9:42 ` paolo.carlini at oracle dot com
2013-10-21  9:46 ` thomas.sanchz at gmail dot com
2013-11-18 17:12 ` 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).