[Bug c++/80587] Incorrect type from outer scope inside lambda under some conditions

2017-05-04 Thread jas...@3db-labs.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80587

--- Comment #1 from jas...@3db-labs.com ---
I neglected to include the preprocessed source file. It is too large to attach
here, so I posted it at:

https://gist.github.com/otherjason/9f50d3f36207ea4b40bb805f6c710304

[Bug c++/80587] New: Incorrect type from outer scope inside lambda under some conditions

2017-05-01 Thread jas...@3db-labs.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80587

Bug ID: 80587
   Summary: Incorrect type from outer scope inside lambda under
some conditions
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jas...@3db-labs.com
  Target Milestone: ---

Created attachment 41292
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41292=edit
Test case source file

I observed this error on an Ubuntu 17.04 system; here is the output of `g++
-v`:

-

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

-

The nature of the bug is tough to explain, so see the attached test case. I
minimized it as much as possible, but I ran into it when using Boost.Hana from
Boost v1.64. Based on the test case, this appears to be a compiler bug, not an
issue with the library.

In the test, I create a `boost::hana::tuple<>` object, then use
`boost::hana::for_each()` to invoke a callable with each element of the tuple.
In my test case, I provide a lambda as the callable. I've noticed that, if I
try to use the enclosing tuple type from within the lambda, g++ uses the
incorrect type in some cases. I would expect the program to print:

-

working example:
tuple type before for_each: boost::hana::tuple<int, int>
tuple type inside for_each: boost::hana::tuple<int, int>
tuple type inside for_each: boost::hana::tuple<int, int>

non-working example:
tuple type before for_each: boost::hana::tuple<int, int>
tuple type inside for_each: boost::hana::tuple<int, int>
tuple type inside for_each: boost::hana::tuple<int, int>

-

However, when I compile and run the program using g++ as follows:

g++ tuple_test.cc -o tuple_test -std=c++14

I get the following output:

-

working example:
tuple type before for_each: boost::hana::tuple<int, int>
tuple type inside for_each: boost::hana::tuple<int, int>
tuple type inside for_each: boost::hana::tuple<int, int>

non-working example:
tuple type before for_each: boost::hana::tuple<int, int>
tuple type inside for_each: int
tuple type inside for_each: int

-

I see this error on every version of gcc that I've tried: 6.1, 6.2, 6.3, 7.0,
and 8.0 trunk (https://wandbox.org/permlink/4zKtIIZ9k7sI7Ckv). All versions of
clang that I've tried that are supported by Hana seem to work fine. I've
minimized the test case as much as I can, but I haven't been able to identify a
workaround.

[Bug c/68986] New: internal compiler error: Segmentation fault

2015-12-18 Thread jas...@3db-labs.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68986

Bug ID: 68986
   Summary: internal compiler error: Segmentation fault
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jas...@3db-labs.com
  Target Milestone: ---

Created attachment 37087
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37087=edit
C source file that demonstrates the error

I'm running on Ubuntu 14.04 (x86_64) using gcc 5.3.0. I've also observed this
problem with 5.2.0 and 5.2.1 at least, however. I haven't seen any problems
with any gcc versions in the 4.x series; it appears to be isolated to 5.x at
least.

Here is the output of gcc run with the `-v` argument:

$ gcc-5 -v
Using built-in specs.
COLLECT_GCC=gcc-5
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
5.3.0-3ubuntu1~14.04' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs
--enable-languages=c,ada,c++,java,go,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-5 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=gcc4-compatible --disable-libstdcxx-dual-abi
--enable-gnu-unique-object --disable-vtable-verify --enable-libmpx
--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-5-amd64/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-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 --enable-multilib
--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 5.3.0 20151204 (Ubuntu 5.3.0-3ubuntu1~14.04)

I compile the attached C file (which is reduced down from the original file,
down to the minimum code required to show the compiler error) using the
following command line:

gcc-5 tracesig.c -c -fPIC -mpreferred-stack-boundary=5
-mincoming-stack-boundary=4

The stack-related options come from source code elsewhere in this project that
has particular SIMD requirements. When I execute the above command line, I get
the following output:

tracesig.c: In function ‘char* __check_point_msg_buffer()’:
tracesig.c:20:1: internal compiler error: Segmentation fault
 }
 ^
0xa8842f crash_signal
../../src/gcc/toplev.c:383
0xcca22c ix86_expand_prologue()
../../src/gcc/config/i386/i386.c:11503
0xda9dca gen_prologue()
../../src/gcc/config/i386/i386.md:12254
0x877cbf thread_prologue_and_epilogue_insns()
../../src/gcc/function.c:5930
0x8784a2 rest_of_handle_thread_prologue_and_epilogue
../../src/gcc/function.c:6500
0x8784a2 execute
../../src/gcc/function.c:6538
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

I will attach the preprocessed file in a subsequent reply to the report.

[Bug c/68986] internal compiler error: Segmentation fault

2015-12-18 Thread jas...@3db-labs.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68986

--- Comment #1 from jas...@3db-labs.com ---
Created attachment 37088
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37088=edit
preprocessed output file from gcc