[Bug c++/83556] New: ICE in gimplify_expr, at gimplify.c:12004

2017-12-22 Thread p.pettinato+gcc at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83556

Bug ID: 83556
   Summary: ICE in gimplify_expr, at gimplify.c:12004
   Product: gcc
   Version: 7.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: p.pettinato+gcc at gmail dot com
  Target Milestone: ---

Compiling the following on gcc 7.2.0 (Ubuntu Artful, x86_64-linux-gnu) fails:

int func()
{
return 1;
}

struct Data
{
int good = func();
int bad = 1;
int ugly = good ? 1 * bad : 2 * bad;
};

struct MoreData
{
Data d{};
};

int main()
{
MoreData m{};
return m.d.ugly;
}


Output:

$ g++ test.cpp -o a
test.cpp: In function 'int main()':
test.cpp:10:37: internal compiler error: in gimplify_expr, at gimplify.c:12004
 int ugly = good ? 1 * bad : 2 * bad;
 ^~~
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.

[Bug c++/83556] ICE in gimplify_expr, at gimplify.c:12004

2017-12-22 Thread p.pettinato+gcc at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83556

--- Comment #1 from Paolo Pettinato  ---
gcc 5.4.0 (Ubuntu Xenial, x86_64-linux-gnu) gives a more reasonable output:

$ g++ test.cpp -o a
test.cpp:8:21: warning: non-static data member initializers only available with
-std=c++11 or -std=gnu++11
 int good = func();
 ^
test.cpp:9:15: warning: non-static data member initializers only available with
-std=c++11 or -std=gnu++11
 int bad = 1;
   ^
test.cpp:10:37: warning: non-static data member initializers only available
with -std=c++11 or -std=gnu++11
 int ugly = good ? 1 * bad : 2 * bad;
 ^
test.cpp:15:12: warning: non-static data member initializers only available
with -std=c++11 or -std=gnu++11
 Data d{};
^
test.cpp:15:11: warning: extended initializer lists only available with
-std=c++11 or -std=gnu++11
 Data d{};
   ^
test.cpp:15:12: warning: extended initializer lists only available with
-std=c++11 or -std=gnu++11
 Data d{};
^
test.cpp: In function 'int main()':
test.cpp:20:15: warning: extended initializer lists only available with
-std=c++11 or -std=gnu++11
 MoreData m{};
   ^
test.cpp:20:16: error: in C++98 'm' must be initialized by constructor, not by
'{...}'
 MoreData m{};
^

[Bug c++/83556] ICE in gimplify_expr, at gimplify.c:12004

2017-12-22 Thread p.pettinato+gcc at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83556

Paolo Pettinato  changed:

   What|Removed |Added

  Known to work||5.4.0

--- Comment #2 from Paolo Pettinato  ---
Some notes:
- Won't ICE if I set "good" to some static value
- Won't ICE if I create a Data struct instance only (instead of MoreData)
- Won't ICE if I write something like:
int ugly = (good ? 1 : 2) * bad;
instead of:
int ugly = good ? 1 * bad : 2 * bad;

[Bug c++/83556] Regression (7): ICE in gimplify_expr, at gimplify.c:12004

2017-12-22 Thread p.pettinato+gcc at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83556

Paolo Pettinato  changed:

   What|Removed |Added

  Known to work||6.3.0
Summary|ICE in gimplify_expr, at|Regression (7): ICE in
   |gimplify.c:12004|gimplify_expr, at
   ||gimplify.c:12004

--- Comment #3 from Paolo Pettinato  ---
Also compiles & links correctly on gcc 6.3.0 (Ubuntu Zesty, x86_64-linux-gnu)