public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/57408] New: lambda, Variable length arrays, thread, internal compiler error: in expand_expr_real_1, at expr.c:9327
@ 2013-05-25 2:53 superbem at gmail dot com
2013-05-25 8:45 ` [Bug c++/57408] " paolo.carlini at oracle dot com
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: superbem at gmail dot com @ 2013-05-25 2:53 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57408
Bug ID: 57408
Summary: lambda, Variable length arrays, thread, internal
compiler error: in expand_expr_real_1, at expr.c:9327
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: superbem at gmail dot com
#include <thread>
#include <cstdio>
using namespace std;
int main(){
int y=2;
float fa[2][y]; // thread compile fine if y were 2 hardcoded instead
fa[0][0]=0.8;
fa[0][1]=1.8;
auto fx=[&](){
for(int c=0;c<2;c++){ // thread compile fine if c<2 were c<1 instead
printf("\n%f",fa[0][c]); // (1*) "internal compiler error: in
expand_expr_real_1, at expr.c:9327"
}
};
fx(); // works fine everytime
thread(fx).join(); //error (1*)
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/57408] lambda, Variable length arrays, thread, internal compiler error: in expand_expr_real_1, at expr.c:9327
2013-05-25 2:53 [Bug c++/57408] New: lambda, Variable length arrays, thread, internal compiler error: in expand_expr_real_1, at expr.c:9327 superbem at gmail dot com
@ 2013-05-25 8:45 ` paolo.carlini at oracle dot com
2013-05-25 12:40 ` daniel.kruegler at googlemail dot com
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-05-25 8:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57408
--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
I'm not at all sure this is a C++ front-end issue.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/57408] lambda, Variable length arrays, thread, internal compiler error: in expand_expr_real_1, at expr.c:9327
2013-05-25 2:53 [Bug c++/57408] New: lambda, Variable length arrays, thread, internal compiler error: in expand_expr_real_1, at expr.c:9327 superbem at gmail dot com
2013-05-25 8:45 ` [Bug c++/57408] " paolo.carlini at oracle dot com
@ 2013-05-25 12:40 ` daniel.kruegler at googlemail dot com
2013-06-20 1:39 ` superbem at gmail dot com
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2013-05-25 12:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57408
Daniel Krügler <daniel.kruegler at googlemail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |daniel.kruegler@googlemail.
| |com
--- Comment #2 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
First attempt so simplify (and to get rid of some library dependencies):
//---------------------------------
#include <functional>
struct Impl_base
{
virtual ~Impl_base(){}
virtual void run() = 0;
};
template<typename Callable>
struct Impl : public Impl_base
{
Callable func;
Impl(Callable f) : func(f) { }
void run() { func(); }
};
template<typename Callable>
void
make_routine(Callable&& f)
{
new Impl<Callable>(static_cast<Callable&&>(f));
}
template<typename Callable>
void make(Callable&& f)
{
make_routine(std::__bind_simple(f));
}
extern void use(float);
int main(){
int y = 2;
float fa[2][y]; // compiles fine if y were 2 hard-coded instead
fa[0][0]=0.8;
fa[0][1]=1.8;
auto fx=[&](){
for(int c=0; c<2; c++){ // compiles fine if c<2 were c<1 instead
use(fa[0][c]);
}
};
make(fx); //error (1*)
}
//---------------------------------
causes the same error (using gcc 4.9.0 20130519 (experimental)):
"main.cpp||In function 'int main()':|
main.cpp|34|warning: ISO C++ forbids variable length array 'fa' [-Wvla]|
main.cpp||In member function 'void Impl<Callable>::run() [with Callable =
std::_Bind_simple<main()::<lambda()>()>]':|
main.cpp|39|warning: '<anonymous>' is used uninitialized in this function
[-Wuninitialized]|
|34|note: '<anonymous>' was declared here|
main.cpp|39|internal compiler error: in expand_expr_real_1, at expr.c:9361|
"
>From gcc-bugs-return-423146-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat May 25 13:37:26 2013
Return-Path: <gcc-bugs-return-423146-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 23662 invoked by alias); 25 May 2013 13:37:26 -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 23640 invoked by uid 48); 25 May 2013 13:37:22 -0000
From: "daniel.kruegler at googlemail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/57408] lambda, Variable length arrays, thread, internal compiler error: in expand_expr_real_1, at expr.c:9327
Date: Sat, 25 May 2013 13:37:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.8.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: daniel.kruegler at googlemail dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-57408-4-mQY8u5jYII@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-57408-4@http.gcc.gnu.org/bugzilla/>
References: <bug-57408-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-05/txt/msg01819.txt.bz2
Content-length: 1052
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57408
--- Comment #3 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
Further simplification down to a library-free test case:
//------------------------------------------------------
template<typename Callable>
struct Impl
{
Callable func;
Impl(Callable f) : func(f) { }
virtual void run() { func(); }
};
template<typename Callable>
void call(Callable f)
{
Impl<Callable>(f).run();
}
extern "C" int printf(const char*, ...);
int main(){
int y = 2;
float fa[2][y]; // compiles fine if y were 2 hard-coded instead
fa[0][0]=0.8;
fa[0][1]=1.8;
auto fx=[&](){
for(int c=0; c<2; c++){ // compiles fine if c<2 were c<1 instead
printf("use me", fa[0][c]);
}
};
call(fx); //error (1*)
}
//------------------------------------------------------
It seems relevant, that there is a virtual function that invokes the lambda
closure and that fa[0][c] is odr-used within the closure call expression.
>From gcc-bugs-return-423147-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat May 25 13:48:13 2013
Return-Path: <gcc-bugs-return-423147-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 28663 invoked by alias); 25 May 2013 13:48:13 -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 28620 invoked by uid 48); 25 May 2013 13:48:09 -0000
From: "dje at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/57415] New: [4.9 Regression] New PPC testsuite failure C++ compound literarl expr unimplemented
Date: Sat, 25 May 2013 13:48:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: dje at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-57415-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-05/txt/msg01820.txt.bz2
Content-length: 1453
http://gcc.gnu.org/bugzilla/show_bug.cgi?idW415
Bug ID: 57415
Summary: [4.9 Regression] New PPC testsuite failure C++
compound literarl expr unimplemented
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: dje at gcc dot gnu.org
/tmp/20130524/gcc/testsuite/g++2/../../xg++
-B/tmp/20130524/gcc/testsuite/g++2/../../
/nasfarm/dje/src/src/gcc/testsuite/g++.dg/ext/altivec-cell-2.C
-fno-diagnostics-show-caret -fdiagnostics-color=never -nostdinc++
-I/tmp/20130524/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/powerpc-ibm-aix7.1.0.0
-I/tmp/20130524/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include
-I/nasfarm/dje/src/src/libstdc++-v3/libsupc++
-I/nasfarm/dje/src/src/libstdc++-v3/include/backward
-I/nasfarm/dje/src/src/libstdc++-v3/testsuite/util -fmessage-length=0
-std=gnu++98 -maltivec -S -o altivec-cell-2.s (timeout = 300)
/nasfarm/dje/src/src/gcc/testsuite/g++.dg/ext/altivec-cell-2.C: In function
'int
g(__vector(8) short int, int)':
/nasfarm/dje/src/src/gcc/testsuite/g++.dg/ext/altivec-cell-2.C:41:27: sorry,
unimplemented: unexpected AST of kind compound_literal_expr
/nasfarm/dje/src/src/gcc/testsuite/g++.dg/ext/altivec-cell-2.C:41:27: internal
compiler error: in potential_constant_expression_1, at cp/semantics.c:8936
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/57408] lambda, Variable length arrays, thread, internal compiler error: in expand_expr_real_1, at expr.c:9327
2013-05-25 2:53 [Bug c++/57408] New: lambda, Variable length arrays, thread, internal compiler error: in expand_expr_real_1, at expr.c:9327 superbem at gmail dot com
2013-05-25 8:45 ` [Bug c++/57408] " paolo.carlini at oracle dot com
2013-05-25 12:40 ` daniel.kruegler at googlemail dot com
@ 2013-06-20 1:39 ` superbem at gmail dot com
2013-06-20 9:55 ` paolo.carlini at oracle dot com
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: superbem at gmail dot com @ 2013-06-20 1:39 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57408
--- Comment #4 from superbem at gmail dot com ---
Thanks for further testing it.
Isn't this confirmed yet? How to do.
I've stumbled across this issue several times, and I'm very admired that I'm
the only one.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/57408] lambda, Variable length arrays, thread, internal compiler error: in expand_expr_real_1, at expr.c:9327
2013-05-25 2:53 [Bug c++/57408] New: lambda, Variable length arrays, thread, internal compiler error: in expand_expr_real_1, at expr.c:9327 superbem at gmail dot com
` (2 preceding siblings ...)
2013-06-20 1:39 ` superbem at gmail dot com
@ 2013-06-20 9:55 ` paolo.carlini at oracle dot com
2013-06-21 9:01 ` paolo.carlini at oracle dot com
2013-06-21 12:40 ` jason at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-06-20 9:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57408
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-06-20
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/57408] lambda, Variable length arrays, thread, internal compiler error: in expand_expr_real_1, at expr.c:9327
2013-05-25 2:53 [Bug c++/57408] New: lambda, Variable length arrays, thread, internal compiler error: in expand_expr_real_1, at expr.c:9327 superbem at gmail dot com
` (3 preceding siblings ...)
2013-06-20 9:55 ` paolo.carlini at oracle dot com
@ 2013-06-21 9:01 ` paolo.carlini at oracle dot com
2013-06-21 12:40 ` jason at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-06-21 9:01 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57408
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC|superbem at gmail dot com |jason at gcc dot gnu.org
--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Jason, at first I thought this one could be a Dup of 55149 but I'm still seeing
it today.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/57408] lambda, Variable length arrays, thread, internal compiler error: in expand_expr_real_1, at expr.c:9327
2013-05-25 2:53 [Bug c++/57408] New: lambda, Variable length arrays, thread, internal compiler error: in expand_expr_real_1, at expr.c:9327 superbem at gmail dot com
` (4 preceding siblings ...)
2013-06-21 9:01 ` paolo.carlini at oracle dot com
@ 2013-06-21 12:40 ` jason at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2013-06-21 12:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57408
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-invalid-code
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> ---
The issue here is that this capture is not valid C++1y because an array bound
other than the first one is non-constant. Current 4.9 gives an error and then
crashes; I'll fix the crash, but it will still be rejected.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-06-21 12:40 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-25 2:53 [Bug c++/57408] New: lambda, Variable length arrays, thread, internal compiler error: in expand_expr_real_1, at expr.c:9327 superbem at gmail dot com
2013-05-25 8:45 ` [Bug c++/57408] " paolo.carlini at oracle dot com
2013-05-25 12:40 ` daniel.kruegler at googlemail dot com
2013-06-20 1:39 ` superbem at gmail dot com
2013-06-20 9:55 ` paolo.carlini at oracle dot com
2013-06-21 9:01 ` paolo.carlini at oracle dot com
2013-06-21 12:40 ` jason at gcc dot gnu.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).