public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "thomas.sanchz at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/58824] New: Lambda trigger internal compiler error
Date: Mon, 21 Oct 2013 09:23:00 -0000 [thread overview]
Message-ID: <bug-58824-4@http.gcc.gnu.org/bugzilla/> (raw)
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).
next reply other threads:[~2013-10-21 9:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-21 9:23 thomas.sanchz at gmail dot com [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-58824-4@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).