https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89702
Bug ID: 89702 Summary: 03 issue with SIGALRM causes program to SEGV on Solaris Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other Assignee: unassigned at gcc dot gnu.org Reporter: karl.burgess at oracle dot com Target Milestone: --- Created attachment 45959 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45959&action=edit Program source files I have a program which compiles and works ok with -O1, but when I compile with -O3 the program crashes. The platform Solaris SunOS 5.10 is significant. The program works fine when compiled with -O3 on Linux. The key thing in the program to reproduce the crash is to have a SIGALRM signal handled during the execution of the optimized function ConvertUTF8toUTF16(). Setting the input buffer large enough for that function to take longer to execute is important. Steps to reproduce the bug: -bash-3.2$ uname -a SunOS bazalgette.uk.oracle.com 5.10 Generic_150401-63 i86pc i386 i86pc Solaris -bash-3.2$ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/opt/tarantella/libexec/gcc/i386-pc-solaris2.10/4.8.0/lto-wrapper Target: i386-pc-solaris2.10 Configured with: ../gcc-4.8.0/configure --with-fpmath=sse --disable-sjlj-exceptions --with-gnu-as --with-as=/opt/tarantella/bin/as --without-gnu-ld --with-ld=/usr/ccs/bin/ld --with-system-zlib --build=i386-pc-solaris2.10 --host=i386-pc-solaris2.10 --with-boot-ldflags=-Wl,-R,/opt/tarantella/lib --disable-werror --disable-silent-rules --enable-multilib --prefix=/opt/tarantella --with-gmp=/opt/tarantella/ --with-mpfr=/opt/tarantella/ --with-mpc=/opt/tarantella/ --enable-threads=posix --enable-libgomp --enable-languages=c,c++ --with-cloog=/opt/tarantella/ --with-isl=/opt/tarantella/ --with-libelf=/opt/tarantella/ --disable-nls --enable-cloog-backend=isl --disable-cloog-version-check Thread model: posix gcc version 4.8.0 (GCC) -bash-3.2$ make gcc -c main.c -O3 -ggdb -save-temps gcc -c ConvertUTF.c -O3 -ggdb -save-temps gcc -otest main.o ConvertUTF.o -O3 -ggdb -save-temps -bash-3.2$ ./test Clipboard data len 26214400 Segmentation Fault (core dumped) The problem also occurs with gcc 8.3.0 on Solaris: COLLECT_GCC=/export/home/kb161603/build_gcc/gcc/xgcc Target: i386-pc-solaris2.10 Configured with: ../gcc-8.3.0/configure --with-mpc=/opt/tarantella --with-gmp=/opt/tarantella --with-mpfr=/opt/tarantella : (reconfigured) ../gcc-8.3.0/configure --with-mpc=/opt/tarantella --with-gmp=/opt/tarantella --with-mpfr=/opt/tarantella --enable-languages=c,c++ Thread model: posix gcc version 8.3.0 (GCC) The attachment gccbug.tar.gz contains the program source files, .i files and Makefile: -bash-3.2$ tar tvf gccbug.tar -rw-r--r-- kb161603/other 9120 2019-03-12 15:59 ConvertUTF.c -rw-r--r-- kb161603/other 6695 2019-03-07 11:29 ConvertUTF.h -rw-r--r-- kb161603/other 5595 2019-03-13 13:59 ConvertUTF.i -rw-r--r-- kb161603/other 6308 2019-03-13 13:59 ConvertUTF.o -rw-r--r-- kb161603/other 26821 2019-03-13 13:59 ConvertUTF.s -rw-r--r-- kb161603/other 1945 2019-03-12 16:14 main.c -rw-r--r-- kb161603/other 38874 2019-03-13 13:59 main.i -rw-r--r-- kb161603/other 10004 2019-03-13 13:59 main.o -rw-r--r-- kb161603/other 37056 2019-03-13 13:59 main.s -rw-r--r-- kb161603/other 268 2019-03-12 16:16 Makefile -rwxr-xr-x kb161603/other 18936 2019-03-13 13:59 test