JoeyWheeler's blog

By JoeyWheeler, history, 8 years ago, In English
#include <algorithm>

struct RT {
    std::pair<int,int> v[100000]; // runtime linked with size of this array, 6s at 10000, 20s at 20000, who knows at 200000 (quadratic time? who knows)
} z;

int main() {
}

The above code seems to be stuck in compiling on g++ with c++11 under linux. (compiled as g++ -o prog prog.cpp -std=c++11) It's been tested and has failed under

  • Linux 4.0.6-1-ARCH x86_64 GNU/Linux — g++ (GCC) 5.1.0

  • Linux 4.3.3-1-ARCH x86_64 GNU/Linux — g++ (GCC) 5.3.0

  • Linux 3.19.0-21-generic x86_64 GNU/Linux — g++ (GCC) 5.3.0

  • It also fails when submitted to ideone.com, codeforces.com (eg), dmoj.ca

It appears to compile successfully using clang++ and when using cygwin

Could other people try compile this and see what results they get?

  • Vote: I like it
  • +72
  • Vote: I do not like it

»
8 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by JoeyWheeler (previous revision, new revision, compare).

»
8 years ago, # |
Rev. 2   Vote: I like it +10 Vote: I do not like it

For me compiling it works with both g++ prog.cpp and g++ prog.cpp -std=c++11.

Linux 3.19.0-42-generic x86_64, gcc version 4.8.4

»
8 years ago, # |
Rev. 3   Vote: I like it +15 Vote: I do not like it

For me it compiles without -std=c++11 on g++ 5.2.1 (doesn't with the option on), and both works on g++ 4.9.3

Linux 4.2.0-22-generic x86_64 (Ubuntu Gnome 15.10), g++ version 5.2.1 / 4.9.3

  • »
    »
    8 years ago, # ^ |
    Rev. 2   Vote: I like it +10 Vote: I do not like it

    Also using tuple won't work. Containers (vectors, sets and maps) and strings seem to be okay.

»
8 years ago, # |
  Vote: I like it +3 Vote: I do not like it

You should report this bug here: https://gcc.gnu.org/bugs/

»
8 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Compiles just fine for me both with and without std=c++11 on Windows (MinGW-w64, GCC 4.9.2) and Linux (g++ (Debian 4.7.2-5) 4.7.2)

»
8 years ago, # |
  Vote: I like it +69 Vote: I do not like it

I've submitted it as bug on gcc issue tracker two months ago https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68203