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++/52699] infinite loop generated with -O0


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

Jarryd Beck <jarrydb at cse dot unsw.edu.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |i686-pc-linux-gnu
               Host|                            |i686-pc-linux-gnu
              Build|                            |i686-pc-linux-gnu

--- Comment #1 from Jarryd Beck <jarrydb at cse dot unsw.edu.au> 2012-03-24 07:54:23 UTC ---
When the attached file is compiled with no optimisation, the resulting program
never terminates.

  g++ -std=gnu++11 random.cpp

If I compile it with:

  g++ -std=gnu++11 random.cpp -O1

then it works.

The program is as follows, fully preprocessed sources are attached.

#include <random>

typedef std::mt19937::result_type unit_type;
typedef std::independent_bits_engine
<
  std::mt19937,
  sizeof(unit_type)*8,
  unit_type
> full_bits_generator;

int main()
{
  full_bits_generator gen;

  gen();
  return 0;
}

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/jarryd/local/gcc-4.8/libexec/gcc/i686-pc-linux-gnu/4.8.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: /home/jarryd/git/gcc-git/configure
--prefix=/home/jarryd/local/gcc-4.8 --disable-multilib --enable-languages=c,c++
Thread model: posix
gcc version 4.8.0 20120323 (experimental) (GCC)


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