[Bug c++/70824] New: cc1plus consumes all available memory on specific template code

2016-04-27 Thread trulsjo at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70824

Bug ID: 70824
   Summary: cc1plus consumes all available memory on specific
template code
   Product: gcc
   Version: 6.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: trulsjo at gmail dot com
  Target Milestone: ---

Created attachment 38348
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38348&action=edit
Prerocessed source for failed compile

Compiling this code with g++ 6.1.0 causes cc1plus to consume all available
memory (or at least more than 12GB):

#include 

template 
size_t 
a() {
  const int v = std::max({1});
  return v;
}

Compiled with
g++ TJOTest.cpp -c --save-temps

gcc version is 6.1.0 release, compiled on Ubuntu 16.04 system with ./configure
&& make && make install

The same code compiles successfully on stock compiler in Ubuntu 16.04 (g++
5.3.1-14ubuntu2) 5.3.1 20160413

[Bug c++/70824] cc1plus consumes all available memory on specific template code

2016-05-04 Thread trulsjo at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70824

--- Comment #1 from Truls Johnsen  ---
Reduced the test case to only include  and changed max to a
one-liner that still shows the same behavior. Removing constexpr from max, or
the (unused) template from a() makes the code compile:

#include 

constexpr
int
max(std::initializer_list __l)
{ return *__l.begin(); }

template 
void
a() {
  const int v =  max({1});
}


I forgot to mention the host in the initial report:
Intel(R) Core(TM) i5-2300 CPU @ 2.80GHz

[Bug c++/70824] cc1plus consumes all available memory on specific template code

2016-05-04 Thread trulsjo at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70824

Truls Johnsen  changed:

   What|Removed |Added

  Attachment #38348|0   |1
is obsolete||

--- Comment #2 from Truls Johnsen  ---
Created attachment 38411
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38411&action=edit
Preprocessed source for test case only including