Skip to content

Instantly share code, notes, and snippets.

@kaityo256
Created July 10, 2017 06:11
Show Gist options
  • Save kaityo256/6ba47b403356d59854712d1bc1fe427f to your computer and use it in GitHub Desktop.
Save kaityo256/6ba47b403356d59854712d1bc1fe427f to your computer and use it in GitHub Desktop.
Compilation takes too long
#include <stdio.h>
const int N = 100000000;
int
main(void){
static int a[N] = {};
printf("%d\n",a[0]);
}
@kaityo256
Copy link
Author

If you compile it with "g++ -O3 -g", then it takes too long to compile.
This phenomenon depends on version of GCC. I observed this behavior with following versions,

  • g++ (Homebrew GCC 6.3.0_1) 6.3.0
  • g++ (GCC) 5.1.0
  • g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4)

Other compilers, such as clang++ and icpc, does not show this behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment