[Bug c++/57408] lambda, Variable length arrays, thread, internal compiler error: in expand_expr_real_1, at expr.c:9327

2013-08-02 Thread paolo.carlini at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57408

Paolo Carlini paolo.carlini at oracle dot com changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 CC|jason at gcc dot gnu.org   |
 Resolution|--- |FIXED
   Target Milestone|--- |4.9.0

--- Comment #7 from Paolo Carlini paolo.carlini at oracle dot com ---
Thus fixed for 4.9.0.


[Bug c++/57408] lambda, Variable length arrays, thread, internal compiler error: in expand_expr_real_1, at expr.c:9327

2013-06-21 Thread paolo.carlini at oracle dot com
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.


[Bug c++/57408] lambda, Variable length arrays, thread, internal compiler error: in expand_expr_real_1, at expr.c:9327

2013-06-21 Thread jason at gcc dot gnu.org
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.


[Bug c++/57408] lambda, Variable length arrays, thread, internal compiler error: in expand_expr_real_1, at expr.c:9327

2013-06-20 Thread paolo.carlini at oracle dot com
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


[Bug c++/57408] lambda, Variable length arrays, thread, internal compiler error: in expand_expr_real_1, at expr.c:9327

2013-06-19 Thread superbem at gmail dot com
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.


[Bug c++/57408] lambda, Variable length arrays, thread, internal compiler error: in expand_expr_real_1, at expr.c:9327

2013-05-25 Thread paolo.carlini at oracle dot com
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.


[Bug c++/57408] lambda, Variable length arrays, thread, internal compiler error: in expand_expr_real_1, at expr.c:9327

2013-05-25 Thread daniel.kruegler at googlemail dot com
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;
};

templatetypename Callable
  struct Impl : public Impl_base
  {
Callable func;
Impl(Callable f) : func(f) { }
void run() { func(); }
  };

templatetypename Callable
  void
  make_routine(Callable f)
  {
new ImplCallable(static_castCallable(f));
  }

templatetypename 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; c2; c++){ // compiles fine if c2 were c1 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 ImplCallable::run() [with Callable =
std::_Bind_simplemain()::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|


[Bug c++/57408] lambda, Variable length arrays, thread, internal compiler error: in expand_expr_real_1, at expr.c:9327

2013-05-25 Thread daniel.kruegler at googlemail dot com
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:

//--
templatetypename Callable
  struct Impl
  {
Callable func;
Impl(Callable f) : func(f) { }
virtual void run() { func(); }
  };

templatetypename Callable
void call(Callable f)
  {
ImplCallable(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; c2; c++){ // compiles fine if c2 were c1 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.