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

2015-11-19 Thread luser.droog at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68454

Bug ID: 68454
   Summary: internal compiler error: Segmentation fault
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: blocker
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: luser.droog at gmail dot com
  Target Milestone: ---

Created attachment 36778
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36778&action=edit
gcc -E -o main.cpp src/lib/xpost_main.c

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-cygwin/5.2.0/lto-wrapper.exe
Target: x86_64-pc-cygwin
Configured with:
/cygdrive/i/szsz/tmpp/gcc/gcc-5.2.0-1.x86_64/src/gcc-5.2.0/configure
--srcdir=/cygdrive/i/szsz/tmpp/gcc/gcc-5.2.0-1.x86_64/src/gcc-5.2.0
--prefix=/usr --exec-prefix=/usr --localstatedir=/var --sysconfdir=/etc
--docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C
--build=x86_64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin
--without-libiconv-prefix --without-libintl-prefix --libexecdir=/usr/lib
--enable-shared --enable-shared-libgcc --enable-static
--enable-version-specific-runtime-libs --enable-bootstrap --enable-__cxa_atexit
--with-dwarf2 --with-tune=generic
--enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-graphite
--enable-threads=posix --enable-libatomic --enable-libgomp --disable-libitm
--enable-libquadmath --enable-libquadmath-support --enable-libssp
--enable-libada --enable-libgcj-sublibs --disable-java-awt --disable-symvers
--with-ecj-jar=/usr/share/java/ecj.jar --with-gnu-ld --with-gnu-as
--with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix
--without-libintl-prefix --with-system-zlib --enable-linker-build-id
Thread model: posix
gcc version 5.2.0 (GCC) 

FWIW I got the same error from the 4.9.2-3 release.


Here's my complete session, from a fresh clone of the git to the error.

josh@LAPTOP-ILO10OOF ~
$ git clone https://github.com/luser-dr00g/xpost.git
Cloning into 'xpost'...
remote: Counting objects: 7988, done.
remote: Total 7988 (delta 0), reused 0 (delta 0), pack-reused 7988
Receiving objects: 100% (7988/7988), 1.38 MiB | 58.00 KiB/s, done.
Resolving deltas: 100% (5880/5880), done.
Checking connectivity... done.

josh@LAPTOP-ILO10OOF ~
$ cd xpost

josh@LAPTOP-ILO10OOF ~/xpost
$ ./autogen.sh
autoreconf-2.69: Entering directory `.'
autoreconf-2.69: configure.ac: not using Gettext
autoreconf-2.69: running: aclocal --force -I m4
autoreconf-2.69: configure.ac: tracing
autoreconf-2.69: running: libtoolize --copy --force
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
autoreconf-2.69: running: /usr/bin/autoconf-2.69 --force
autoreconf-2.69: running: /usr/bin/autoheader-2.69 --force
autoreconf-2.69: running: automake --add-missing --copy --force-missing
Unescaped left brace in regex is deprecated, passed through in regex; marked by
<-- HERE in m/\${ <-- HERE ([^ \t=:+{}]+)}/ at /usr/bin/automake-1.14 line
3930.
configure.ac:16: installing './compile'
configure.ac:21: installing './config.guess'
configure.ac:21: installing './config.sub'
configure.ac:18: installing './install-sh'
configure.ac:18: installing './missing'
Makefile.am: installing './depcomp'
autoreconf-2.69: Leaving directory `.'
configure: creating cache config.cache
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for a BSD-compatible install... /usr/

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

2015-11-19 Thread luser.droog at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68454

--- Comment #1 from M Joshua Ryan  ---
This is on a fresh install of cygwin64 on a new Windows 10 laptop.

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

2015-11-20 Thread luser.droog at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68454

M Joshua Ryan  changed:

   What|Removed |Added

  Attachment #36778|0   |1
is obsolete||

--- Comment #3 from M Joshua Ryan  ---
Created attachment 36786
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36786&action=edit
.i file left by `gcc -g -O2 -save-temps src/lib/xpost_main.c`

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

2015-11-20 Thread luser.droog at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68454

--- Comment #4 from M Joshua Ryan  ---
Created attachment 36789
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36789&action=edit
.i file left by `make CFLAGS='-g -O2 -save-temps'`

I think this is the correct file now. I see "0" "0" and "1" instead of the
version symbols discovered above.

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

2015-11-20 Thread luser.droog at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68454

M Joshua Ryan  changed:

   What|Removed |Added

  Attachment #36786|0   |1
is obsolete||

--- Comment #5 from M Joshua Ryan  ---
Comment on attachment 36786
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36786
.i file left by `gcc -g -O2 -save-temps src/lib/xpost_main.c`

not fully preprocessed. still contains XPOST_VERSION symbols. Sorry.

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

2015-11-20 Thread luser.droog at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68454

--- Comment #6 from M Joshua Ryan  ---
Just to clarify, the file with symbols is marked obsolete; the latest file is
believed good. No external symbols. It produces the compiler error when run
with no options `gcc xpost_main.i`.

[Bug target/68454] internal compiler error: Segmentation fault

2015-11-24 Thread luser.droog at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68454

--- Comment #8 from M Joshua Ryan  ---
Yes, I think it must be something unique to cygwin over windows 10. This code
compiles fine with gcc on cygwin/win8, mingw, linux, suncc on solaris, and even
MSVC. I suppose it could even be something in the POSIX emu layer, and not gcc
per se.

[Bug target/68454] internal compiler error: Segmentation fault

2015-11-24 Thread luser.droog at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68454

--- Comment #9 from M Joshua Ryan  ---
Investigated the offending source line a little deeper. It now looks to me like
it has to do with mixed floating/integer arithmetic, especially with bizarre
types like `time_t`. Changing the source to use all integer arithmetic allows
the compiler to complete.

gettimeofday(&tv, NULL);
_xpost_start_time = (((long)tv.tv_sec) * 1000) + ((long)tv.tv_usec / 1000);

[Bug target/68454] internal compiler error: Segmentation fault

2015-11-24 Thread luser.droog at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68454

--- Comment #11 from M Joshua Ryan  ---
Created attachment 36831
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36831&action=edit
additional source triggering same error

Having successfully compiled the other file, I have received the same error on
a different file. Again it appears to involve mixing floating-point types. 

  CC   src/lib/src_lib_libxpost_la-xpost_op_math.lo
src/lib/xpost_op_math.c: In function ‘Ratan’:
src/lib/xpost_op_math.c:341:5: internal compiler error: Segmentation fault
 real ang = atan2((num.real_.val * RAD_PER_DEG),
 ^
Please submit a full bug report,
with preprocessed source if appropriate.

`real` is a typedef for float.

[Bug target/68454] internal compiler error: Segmentation fault

2015-11-25 Thread luser.droog at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68454

--- Comment #12 from M Joshua Ryan  ---
(In reply to Andrew Pinski from comment #10)
> This sounds related to GMP/MPFR, can you recompile those?

Downloading the src packages now. Will update.

[Bug target/68454] internal compiler error: Segmentation fault

2015-11-25 Thread luser.droog at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68454

--- Comment #13 from M Joshua Ryan  ---
I get the same error compiling GMP.

Following instructions from http://stackoverflow.com/a/9450422/733077

josh@LAPTOP-ILO10OOF /tmp
$ cd gmp-4.3.2

josh@LAPTOP-ILO10OOF /tmp/gmp-4.3.2
$ mkdir ../gcc

josh@LAPTOP-ILO10OOF /tmp/gmp-4.3.2
$ ./configure --prefix=/tmp/gcc
checking build system type... x86_64-unknown-cygwin
checking host system type... x86_64-unknown-cygwin
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking ABI=64
checking compiler gcc -O2 -pedantic -m64 ... yes
checking compiler gcc -O2 -pedantic -m64  -mtune=k8... yes
checking for gcc... gcc
checking for C compiler default output file name... a.exe
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... .exe
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for gcc option to accept ISO C99... none needed
checking for gcc option to accept ISO Standard C... (cached) none needed
checking how to run the C preprocessor... gcc -E
checking build system compiler gcc... yes
checking for build system preprocessor... gcc -E
checking for build system executable suffix... .exe
checking whether build system compiler is ANSI... yes
checking for build system compiler math library... -lm
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
using ABI="64"
  CC="gcc"
  CFLAGS="-O2 -pedantic -m64 -mtune=k8"
  CPPFLAGS=""
  MPN_PATH=" x86_64 generic"
checking for function prototypes... yes
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking whether assembler supports --noexecstack option... no
checking for ar... ar
checking for BSD-compatible nm... /usr/bin/nm -B
checking for a sed that does not truncate output... /usr/bin/sed
checking for ld used by gcc... /usr/x86_64-pc-cygwin/bin/ld.exe
checking if the linker (/usr/x86_64-pc-cygwin/bin/ld.exe) is GNU ld... yes
checking for /usr/x86_64-pc-cygwin/bin/ld.exe option to reload object files...
-r
checking whether ln -s works... yes
checking how to recognize dependent libraries... file_magic ^x86 archive
import|^x86 DLL
checking for dlltool... dlltool
checking for as... as
checking for objdump... objdump
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 8192
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for objdir... .libs
checking for ar... (cached) ar
checking for ranlib... ranlib
checking for strip... strip
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -DDLL_EXPORT
checking if gcc PIC flag -DDLL_EXPORT works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking whether the gcc linker (/usr/x86_64-pc-cygwin/bin/ld.exe) supports
shared libraries... yes
checking dynamic linker characteristics... Win32 ld.exe
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
configure: creating libtool
checking for ANSI C header files... (cached) yes
checking whether time.h and sys/time.h may both be included... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking float.h usability... yes
checking float.h presence... yes
checking for float.h... yes
checking invent.h usability... no
checking invent.h presence... no
checking for invent.h... no
checking langinfo.h usability... yes
checking langinfo.h presence... yes
checking for langinfo.h... yes
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking nl_types.h usability... no
checking nl_types.h presence... no
checking for nl_types.h... no
checking sys/attributes.h usability... no
checking sys/attributes.h presence... no
checking for sys/attributes.h... no
checking sys/iograph.h usability... no
checking sys/iograph.h presence... no
checking for sys/iograph.h... no
checking sys/mman.h usability... yes
checking sys/mman.h presence... yes
ch

[Bug target/68454] internal compiler error: Segmentation fault

2015-11-26 Thread luser.droog at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68454

--- Comment #14 from M Joshua Ryan  ---
Created attachment 36850
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36850&action=edit
gmp component triggering the same error

I've been able to modify some of the gmp sources to avoid this bug, by changing
fp constants to integer. But this one won't work since 1e37 is way outside
`int` range.

josh@LAPTOP-ILO10OOF /tmp/gmp-4.3.2
$ make CFLAGS=-save-temps
make  all-recursive
make[1]: Entering directory '/tmp/gmp-4.3.2'
Making all in tests
make[2]: Entering directory '/tmp/gmp-4.3.2/tests'
Making all in .
make[3]: Entering directory '/tmp/gmp-4.3.2/tests'
make[3]: Nothing to be done for 'all-am'.
make[3]: Leaving directory '/tmp/gmp-4.3.2/tests'
Making all in devel
make[3]: Entering directory '/tmp/gmp-4.3.2/tests/devel'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/tmp/gmp-4.3.2/tests/devel'
Making all in mpn
make[3]: Entering directory '/tmp/gmp-4.3.2/tests/mpn'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/tmp/gmp-4.3.2/tests/mpn'
Making all in mpz
make[3]: Entering directory '/tmp/gmp-4.3.2/tests/mpz'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/tmp/gmp-4.3.2/tests/mpz'
Making all in mpq
make[3]: Entering directory '/tmp/gmp-4.3.2/tests/mpq'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/tmp/gmp-4.3.2/tests/mpq'
Making all in mpf
make[3]: Entering directory '/tmp/gmp-4.3.2/tests/mpf'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/tmp/gmp-4.3.2/tests/mpf'
Making all in rand
make[3]: Entering directory '/tmp/gmp-4.3.2/tests/rand'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/tmp/gmp-4.3.2/tests/rand'
Making all in misc
make[3]: Entering directory '/tmp/gmp-4.3.2/tests/misc'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/tmp/gmp-4.3.2/tests/misc'
Making all in cxx
make[3]: Entering directory '/tmp/gmp-4.3.2/tests/cxx'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/tmp/gmp-4.3.2/tests/cxx'
Making all in mpbsd
make[3]: Entering directory '/tmp/gmp-4.3.2/tests/mpbsd'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/tmp/gmp-4.3.2/tests/mpbsd'
make[2]: Leaving directory '/tmp/gmp-4.3.2/tests'
Making all in mpn
make[2]: Entering directory '/tmp/gmp-4.3.2/mpn'
/bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I..
-D__GMP_WITHIN_GMP -I.. -DOPERATION_`echo mp_bases | sed 's/_$//'`   
-save-temps -c -o mp_bases.lo mp_bases.c
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_mp_bases
-save-temps -c mp_bases.c -o mp_bases.o
mp_bases.c:13:13: internal compiler error: Segmentation fault
   /*   1 */ { 0, 1e37, 0 },
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.
Makefile:385: recipe for target 'mp_bases.lo' failed
make[2]: *** [mp_bases.lo] Error 1
make[2]: Leaving directory '/tmp/gmp-4.3.2/mpn'
Makefile:925: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/tmp/gmp-4.3.2'
Makefile:666: recipe for target 'all' failed
make: *** [all] Error 2