This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/50474] New: GCC (cc1plus) hangs forever compiling with -O2 (-fcse-follow-jumps)


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50474

             Bug #: 50474
           Summary: GCC (cc1plus) hangs forever compiling with -O2
                    (-fcse-follow-jumps)
    Classification: Unclassified
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: steffen-schmidt@siemens.com


Created attachment 25332
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25332
Source example

Compilation hangs forever in the following example when using optimization >=
-O2
The option causing the hang seems to be -fcse-follow-jumps, when lowering
optimization level or explicitly excluding the option cse-follow-jumps
(-fno-cse-follow-jumps) compilation works as expected.

Compiler command line:
mips-sde-elf-gcc -O2 -c -oopterror.o opterror.cpp //<-- this hangs
mips-sde-elf-gcc -O2 -fno-cse-follow-jumps -c -oopterror.o opterror.cpp //<--
this works fine

//=================================
// File opterror.cpp
unsigned short global;
void get_R(unsigned char * data);

bool processFirstCall() {
    unsigned char r = 0; 
    get_R(&r);
    if(r != !!r) {
      return false;
    }
    if(r) global = 1;
    return true;
}
//=================================


I was only able to reproduce this behavour on mips toolchains (4.3.2, 4.5.1,
4.6.0) provided by CodeSourcery and own compilation (MinGW32).

gcc -v shows:

Target: mips-sde-elf
Configured with: /scratch/clm/2011.03-sde-lite/src/gcc-4.5-2011.03/configure
--build=i686-pc-linux-gnu --host=i686-mingw32 --target=mips-sde-elf
--enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch
--with-arch=mips32r2 --enable-sgxx-sde-multilibs --disable-threads
--with-gnu-as --with-gnu-ld --with-specs='%{save-temps: -fverbose-asm}
-D__CS_SOURCERYGXX_MAJ__=2011 -D__CS_SOURCERYGXX_MIN__=3
-D__CS_SOURCERYGXX_REV__=52 %{O2:%{!fno-remove-local-statics:
-fremove-local-statics}} %{O*:%{O|O0|O1|O2|Os:;:%{!fno-remove-local-statics:
-fremove-local-statics}}}' --enable-languages=c,c++ --disable-shared
--enable-lto --with-newlib --with-pkgversion='Sourcery G++ Lite 2011.03-52'
--with-bugurl=https://support.codesourcery.com/GNUToolchain/ --disable-nls
--prefix=/opt/codesourcery --with-headers=yes
--with-sysroot=/opt/codesourcery/mips-sde-elf
--with-build-sysroot=/scratch/clm/2011.03-sde-lite/install/host-i686-mingw32/mips-sde-elf
--with-libiconv-prefix=/scratch/clm/2011.03-sde-lite/obj/host-libs-2011.03-52-mips-sde-elf-i686-mingw32/usr
--with-gmp=/scratch/clm/2011.03-sde-lite/obj/host-libs-2011.03-52-mips-sde-elf-i686-mingw32/usr
--with-mpfr=/scratch/clm/2011.03-sde-lite/obj/host-libs-2011.03-52-mips-sde-elf-i686-mingw32/usr
--with-mpc=/scratch/clm/2011.03-sde-lite/obj/host-libs-2011.03-52-mips-sde-elf-i686-mingw32/usr
--with-ppl=/scratch/clm/2011.03-sde-lite/obj/host-libs-2011.03-52-mips-sde-elf-i686-mingw32/usr
--with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm'
--with-cloog=/scratch/clm/2011.03-sde-lite/obj/host-libs-2011.03-52-mips-sde-elf-i686-mingw32/usr
--with-libelf=/scratch/clm/2011.03-sde-lite/obj/host-libs-2011.03-52-mips-sde-elf-i686-mingw32/usr
--disable-libgomp --enable-poison-system-directories
--with-build-time-tools=/scratch/clm/2011.03-sde-lite/obj/tools-i686-pc-linux-gnu-2011.03-52-mips-sde-elf-i686-mingw32/mips-sde-elf/bin
--with-build-time-tools=/scratch/clm/2011.03-sde-lite/obj/tools-i686-pc-linux-gnu-2011.03-52-mips-sde-elf-i686-mingw32/mips-sde-elf/bin
Thread model: single
gcc version 4.5.2 (Sourcery G++ Lite 2011.03-52)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]