[Bug c++/78743] New: g++ segfaults when printing warning for captured constexpr variable

2016-12-09 Thread bjarni.sigurdsson at marel dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78743

Bug ID: 78743
   Summary: g++ segfaults when printing warning for captured
constexpr variable
   Product: gcc
   Version: 6.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: bjarni.sigurdsson at marel dot com
  Target Milestone: ---

The following code will result in a segmentation fault when compiled with g++
version 6.2.0.

// --
static constexpr double foo = 1.0;

int main()
{
auto foobar = [foo](){return (double)foo;};
return 0;
}
// --


Example compile output from "g++ test_crash.cpp":

test_crash.cpp: In function 'int main()':
test_crash.cpp:5:20: warning: capture of variable 'foo' with non-automatic
storage duration
 auto foobar = [foo](){return (double)foo;};
^~~
'
Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


Fixing the warning of course resolves the crash, but also removing the
constexpr:

// --
static double foo = 1.0;

int main()
{
auto foobar = [foo](){return (double)foo;};
return 0;
}
// --

Example output from "g++ test_ok.cpp":

test_ok.cpp: In function 'int main()':
test_ok.cpp:5:20: warning: capture of variable 'foo' with non-automatic storage
duration
 auto foobar = [foo](){return (double)foo;};
^~~
test_ok.cpp:1:15: note: 'double foo' declared here
 static double foo = 1.0;
   ^~~




GCC 6.2.0 was built with the following options:
Configured with: ../gcc-6.2.0/configure --prefix=/opt/plutotoolchain
--target=i686-marel-linux-gnu --with-sysroot=/opt/pluto-targets/i386-rootfs/
--enable-languages=c,c++ --enable-threads=posix --enable-shared
--disable-multilib --enable-__cxa_atexit --disable-sjlj-exceptions
--disable-nls --disable-decimal-float --disable-fixed-point
--enable-checking=release --enable-symvers=gnu --enable-c99 --enable-long-long
--enable-profile --with-system-zlib
--with-default-libstdcxx-abi=gcc4-compatible --with-tune=intel

[Bug c++/78743] g++ segfaults when printing warning for captured constexpr variable

2016-12-09 Thread bjarni.sigurdsson at marel dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78743

--- Comment #1 from bjarni.sigurdsson at marel dot com ---
FYI: This code does not cause a segfault for GCC 5.2.0.

[Bug c++/78743] [6 Regression] g++ segfaults when printing warning for captured constexpr variable

2016-12-09 Thread bjarni.sigurdsson at marel dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78743

--- Comment #6 from bjarni.sigurdsson at marel dot com ---
Is this fix part of 6.2.1 ?

[Bug c++/78743] [6 Regression] g++ segfaults when printing warning for captured constexpr variable

2016-12-09 Thread bjarni.sigurdsson at marel dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78743

--- Comment #8 from bjarni.sigurdsson at marel dot com ---
Sorry, I mixed up the dates in the changelog (2016-09-16 vs. 2016-12-07)
Of course I don't expect a 36 hour fix to be available in an older snapshot :)

Thanks for the quick response. We will wait for 6.3.