[Bug c++/88604] Initializing constexpr array consumes all memory

2018-12-26 Thread gcc-bugs at oxyware dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88604

--- Comment #1 from Hubert Matthews  ---
Created attachment 45288
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45288&action=edit
Source code

[Bug c++/88604] New: Initializing constexpr array consumes all memory

2018-12-26 Thread gcc-bugs at oxyware dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88604

Bug ID: 88604
   Summary: Initializing constexpr array consumes all memory
   Product: gcc
   Version: 8.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: gcc-bugs at oxyware dot com
  Target Milestone: ---

Compiling the attached code with g++ 8.2.1 and no optimisation or compiler
flags causes cc1plus to consume all of physical memory until it hits an OOM
Linux error.  Clang compiles this without any problems.  I tried this on
gcc.godbolt.org for various compiler versions and the problem is present in
many previous versions of g++.

The problem doesn't appear if numAirports is set to 500 but it does when at the
full 26^3.  Also, if latArray[i] is assigned a constant rather than copying a
value from the other constexpr class then it works at full size (26^3).  Using
4000, cc1plus peaks at 2.1GB of resident RAM.

# with numAirports == 4000
$ /usr/bin/time g++ index.cpp
3.27user 1.07system 0:04.38elapsed 99%CPU (0avgtext+0avgdata
2224108maxresident)k
0inputs+144outputs (0major+559502minor)pagefaults 0swaps

$ g++ --version
g++ (GCC) 8.2.1 20181215 (Red Hat 8.2.1-6)

$ uname -a
Linux konan.oxyware.net 4.19.8-200.fc28.x86_64 #1 SMP Mon Dec 10 15:43:40 UTC
2018 x86_64 x86_64 x86_64 GNU/Linux

$ cat /etc/fedora-release 
Fedora release 28 (Twenty Eight)

[Bug c++/86000] New: ICE with requires statement in a non constexpr if

2018-05-30 Thread gcc-bugs at oxyware dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86000

Bug ID: 86000
   Summary: ICE with requires statement in a non constexpr if
   Product: gcc
   Version: 8.1.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: gcc-bugs at oxyware dot com
  Target Milestone: ---

Created attachment 44213
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44213&action=edit
Preprocessed source with command-line options

// This code when compiled with -fconcepts causes an ICE.  I'm not
// sure if this should even compile.  I am expecting that the requires
// clause will return true since "3 > 4;" is well-formed.  When compiled
// with -std=c++17 then if constexpr(requires { 3 > 4; }) does compile and
// the function returns 1.

template 
int f()
{
if (requires { 3 > 4; }) return 1;
else return 2;
}

int main()
{
return f();
}

[Bug c++/86002] New: ICE with requires in constexpr if condition

2018-05-30 Thread gcc-bugs at oxyware dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86002

Bug ID: 86002
   Summary: ICE with requires in constexpr if condition
   Product: gcc
   Version: 8.1.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: gcc-bugs at oxyware dot com
  Target Milestone: ---

Created attachment 44214
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44214&action=edit
Pre-processed source and command-line options

// ICE when using requires to detect welll-formedness of code using constexpr
if

struct X {};
struct Y { int i; };

template 
int f(T t)
{
if constexpr (requires { t.i; })
return t.i;
else
return {};
}

int main()
{
return f(X{}) + f(Y{});
}

[Bug c++/86000] ICE with requires statement in a non constexpr if

2018-05-31 Thread gcc-bugs at oxyware dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86000

--- Comment #1 from Hubert Matthews  ---
template 
int f()
{
bool check = requires { 3 > 4; };
if (check) return 1;
else return 2;
}

compiles cleanly and gives the expected result.  This is essentially the same
code but with the check performed separately and stored in an intermediate
variable.

[Bug c++/86000] ICE with requires statement in a non constexpr if

2018-05-31 Thread gcc-bugs at oxyware dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86000

--- Comment #2 from Hubert Matthews  ---
template 
int f()
{
bool check = requires { 3 > 4; };
if (check) return 1;
else return 2;
}

compiles cleanly and gives the expected result.  This is essentially the same
code but with the check performed separately and stored in an intermediate
variable.