[Bug c++/90998] [9 Regression] ICE (segfault) in gcc/cp/call.c compare_ics() with -std=c++17

2020-02-25 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90998

--- Comment #8 from CVS Commits  ---
The releases/gcc-8 branch has been updated by Jason Merrill
:

https://gcc.gnu.org/g:f52ec6bc163af837cd13e234b7c2eab6bc456e12

commit r8-10081-gf52ec6bc163af837cd13e234b7c2eab6bc456e12
Author: Marek Polacek 
Date:   Wed Feb 26 00:33:52 2020 -0500

PR c++/90998 - ICE with copy elision in init by ctor and -Wconversion.

After r269667 which introduced joust_maybe_elide_copy, in C++17 we can
elide
a constructor if it uses a conversion function that returns a prvalue, and
use the conversion function in its stead.

This eliding means that if we have a candidate that previously didn't have
->second_conv, it can have it after the elision.  This confused the
-Wconversion warning because it was assuming that if cand1->second_conv is
non-null, so is cand2->second_conv.  Here cand1->second_conv was non-null
but cand2->second_conv remained null, so it crashed in compare_ics.

I checked with clang that both compilers call A::operator B() in C++17 and
B::B(A const &) otherwise.

gcc/cp/ChangeLog
2020-02-26  Marek Polacek  

PR c++/90998 - ICE with copy elision in init by ctor and -Wconversion.
* call.c (joust): Don't attempt to warn if ->second_conv is null.

gcc/testsuite/ChangeLog
2020-02-26  Marek Polacek  

PR c++/90998 - ICE with copy elision in init by ctor and -Wconversion.
* g++.dg/cpp0x/overload-conv-4.C: New test.

[Bug c++/90998] [9 Regression] ICE (segfault) in gcc/cp/call.c compare_ics() with -std=c++17

2019-11-08 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90998

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #7 from Marek Polacek  ---
Fixed.

[Bug c++/90998] [9 Regression] ICE (segfault) in gcc/cp/call.c compare_ics() with -std=c++17

2019-11-08 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90998

--- Comment #6 from Marek Polacek  ---
Author: mpolacek
Date: Fri Nov  8 21:52:39 2019
New Revision: 277992

URL: https://gcc.gnu.org/viewcvs?rev=277992=gcc=rev
Log:
PR c++/90998 - ICE with copy elision in init by ctor and -Wconversion.

* call.c (joust): Don't attempt to warn if ->second_conv is null.

* g++.dg/cpp0x/overload-conv-4.C: New test.

Added:
branches/gcc-9-branch/gcc/testsuite/g++.dg/cpp0x/overload-conv-4.C
Modified:
branches/gcc-9-branch/gcc/cp/ChangeLog
branches/gcc-9-branch/gcc/cp/call.c

[Bug c++/90998] [9 Regression] ICE (segfault) in gcc/cp/call.c compare_ics() with -std=c++17

2019-10-29 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90998

Marek Polacek  changed:

   What|Removed |Added

Summary|[9/10 Regression] ICE   |[9 Regression] ICE
   |(segfalut) in gcc/cp/call.c |(segfault) in gcc/cp/call.c
   |compare_ics() with  |compare_ics() with
   |-std=c++17  |-std=c++17

--- Comment #5 from Marek Polacek  ---
Fixed on trunk so far.