[Bug c++/54052] g++ takes excessive time in opt and generate phase; can lead to Segmentation Fault when not enough memory available

2018-09-18 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54052

Jonathan Wakely  changed:

   What|Removed |Added

   Last reconfirmed|2017-08-22 00:00:00 |2018-9-18
 CC|redi at gcc dot gnu.org|

--- Comment #9 from Jonathan Wakely  ---
Compiles successfully using i686-pc-linux-gnu, but takes a long time. As I
said, it's an unreasonably large expression (3883 lines!) so that's not
surprising. Don't write silly code if you don't have enough memory to compile
it.

I tried compiling it with Clang and it crashes.

[Bug c++/54052] g++ takes excessive time in opt and generate phase; can lead to Segmentation Fault when not enough memory available

2017-08-22 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54052

--- Comment #8 from Eric Gallager  ---
(In reply to Jonathan Wakely from comment #7)
> (In reply to Eric Gallager from comment #6)
> > Doesn't ICE for me, just takes an inordinately long time to compile (once I
> > add -fpermissive):
> 
> You should have used -m32 not -fpermissive, the preprocessed source was
> created on i686-pc-cygwin i.e. an ILP32 target. That's why you got those
> warnings on x86_64.
> 

I'm actually on a 32-bit target myself (i386-apple-darwin9.8.0) so -m32 is
already the default for me

[Bug c++/54052] g++ takes excessive time in opt and generate phase; can lead to Segmentation Fault when not enough memory available

2017-08-22 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54052

--- Comment #7 from Jonathan Wakely  ---
(In reply to Eric Gallager from comment #6)
> Doesn't ICE for me, just takes an inordinately long time to compile (once I
> add -fpermissive):

You should have used -m32 not -fpermissive, the preprocessed source was created
on i686-pc-cygwin i.e. an ILP32 target. That's why you got those warnings on
x86_64.

> Extra diagnostic checks enabled; compiler may run slowly.
> Configure with --enable-checking=release to disable checks.

It's expected that compilation takes longer when those checks are enabled.

The code has an unreasonably large expression, so it's not entirely surprising
that it takes unreasonable long to optimize.

[Bug c++/54052] g++ takes excessive time in opt and generate phase; can lead to Segmentation Fault when not enough memory available

2017-08-21 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54052

Eric Gallager  changed:

   What|Removed |Added

   Keywords||compile-time-hog,
   ||memory-hog
 Status|UNCONFIRMED |NEW
   Last reconfirmed|2012-07-24 00:00:00 |2017-08-22
 CC||egallager at gcc dot gnu.org
Summary|Segmentation Fault  |g++ takes excessive time in
   ||opt and generate phase; can
   ||lead to Segmentation Fault
   ||when not enough memory
   ||available
 Ever confirmed|0   |1

--- Comment #6 from Eric Gallager  ---
(In reply to Christophe DUVERGER from comment #5)
> Created attachment 27868 [details]
> test08.ii file

Doesn't ICE for me, just takes an inordinately long time to compile (once I add
-fpermissive):

$ /usr/local/bin/g++ -Wno-system-headers -Wall -Wextra -ansi -pedantic -O6 -c
-o test08.o test08.ii
In file included from
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/ext/new_allocator.h:33:0,
 from
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/i686-pc-cygwin/bits/c++allocator.h:34,
 from
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/bits/allocator.h:48,
 from /usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/string:43,
 from
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/bits/locale_classes.h:42,
 from
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/bits/ios_base.h:43,
 from /usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/ios:43,
 from /usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/ostream:40,
 from
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/iostream:40,
 from test08.cpp:1:
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/new:93:54: error: ‘operator new’
takes type ‘size_t’ (‘long unsigned int’) as first parameter [-fpermissive]
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/new:94:56: error: ‘operator new’
takes type ‘size_t’ (‘long unsigned int’) as first parameter [-fpermissive]
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/new:97:62: error: ‘operator new’
takes type ‘size_t’ (‘long unsigned int’) as first parameter [-fpermissive]
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/new:98:64: error: ‘operator new’
takes type ‘size_t’ (‘long unsigned int’) as first parameter [-fpermissive]
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/new:103:57: error: ‘operator new’
takes type ‘size_t’ (‘long unsigned int’) as first parameter [-fpermissive]
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/new:104:59: error: ‘operator new’
takes type ‘size_t’ (‘long unsigned int’) as first parameter [-fpermissive]
$ /usr/local/bin/g++ -Wno-system-headers -Wall -Wextra -ansi -pedantic -O6
-fpermissive -time -ftime-report -c -o test08.o test08.ii

Execution times (seconds)
 phase setup :   0.03 ( 0%) usr   0.01 ( 0%) sys   0.06 ( 0%) wall 
   641 kB ( 0%) ggc
 phase parsing   : 384.38 (10%) usr   4.41 ( 2%) sys 390.09 ( 2%) wall 
 48551 kB (12%) ggc
 phase lang. deferred:   0.23 ( 0%) usr   0.06 ( 0%) sys   0.30 ( 0%) wall 
  2462 kB ( 1%) ggc
 phase opt and generate  :3355.32 (90%) usr 241.76 (98%) sys15451.71 (98%) wall
 362698 kB (88%) ggc
 phase last asm  :   0.00 ( 0%) usr   0.01 ( 0%) sys   1.07 ( 0%) wall 
 7 kB ( 0%) ggc
 phase finalize  :   0.00 ( 0%) usr   0.00 ( 0%) sys   0.24 ( 0%) wall 
 0 kB ( 0%) ggc
 |name lookup:   1.21 ( 0%) usr   0.50 ( 0%) sys   1.83 ( 0%) wall 
  1946 kB ( 0%) ggc
 |overload resolution:   1.88 ( 0%) usr   0.50 ( 0%) sys   2.43 ( 0%) wall 
 13196 kB ( 3%) ggc
 garbage collection  :   3.70 ( 0%) usr   3.27 ( 1%) sys 577.45 ( 4%) wall 
 0 kB ( 0%) ggc
 dump files  :   0.04 ( 0%) usr   0.04 ( 0%) sys   0.77 ( 0%) wall 
 0 kB ( 0%) ggc
 callgraph construction  :   0.86 ( 0%) usr   0.15 ( 0%) sys   4.51 ( 0%) wall 
  8014 kB ( 2%) ggc
 callgraph optimization  :   0.85 ( 0%) usr   0.20 ( 0%) sys   2.05 ( 0%) wall 
11 kB ( 0%) ggc
 ipa function summary:   0.27 ( 0%) usr   0.03 ( 0%) sys   0.34 ( 0%) wall 
44 kB ( 0%) ggc
 ipa dead code removal   :   0.06 ( 0%) usr   0.03 ( 0%) sys   0.25 ( 0%) wall 
 0 kB ( 0%) ggc
 ipa virtual call target :   0.00 ( 0%) usr   0.00 ( 0%) sys   0.02 ( 0%) wall 
 0 kB ( 0%) ggc
 ipa devirtualization:   0.02 ( 0%) usr   0.00 ( 0%) sys   0.02 ( 0%) wall 
 0 kB ( 0%) ggc
 ipa cp  :   0.65 ( 0%) usr   0.12 ( 0%) sys   1.81 ( 0%) wall 
  4870 kB ( 1%) ggc
 ipa inlining heuristics :   1.14 ( 0%) usr   0.03 ( 0%) sys   2.88 ( 0%) wall 
73 kB ( 0%) ggc