[Bug c++/98551] [10/11 Regression] ICE in replace_result_decl, at cp/constexpr.c:2150

2021-01-08 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98551

Patrick Palka  changed:

   What|Removed |Added

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

--- Comment #4 from Patrick Palka  ---
Fixed for GCC 10.3+

[Bug c++/98551] [10/11 Regression] ICE in replace_result_decl, at cp/constexpr.c:2150

2021-01-08 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98551

--- Comment #3 from CVS Commits  ---
The releases/gcc-10 branch has been updated by Patrick Palka
:

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

commit r10-9241-gee697d4bbb7991c99539ba6c20ec76b5d488cffc
Author: Patrick Palka 
Date:   Fri Jan 8 10:11:25 2021 -0500

c++: ICE with constexpr call that returns a PMF [PR98551]

We shouldn't do replace_result_decl after evaluating a call that returns
a PMF because PMF temporaries aren't wrapped in a TARGET_EXPR (and so we
can't trust ctx->object), and PMF initializers can't be self-referential
anyway, so replace_result_decl would always be a no-op.

To that end, this patch changes the relevant AGGREGATE_TYPE_P test to
CLASS_TYPE_P, which should rule out PMFs (as well as arrays, which we
can't return and therefore won't see here).  This fixes an ICE from the
sanity check in replace_result_decl in the below testcase during
constexpr evaluation of the call f() in the initializer g(f()).

gcc/cp/ChangeLog:

PR c++/98551
* constexpr.c (cxx_eval_call_expression): Check CLASS_TYPE_P
instead of AGGREGATE_TYPE_P before calling replace_result_decl.

gcc/testsuite/ChangeLog:

PR c++/98551
* g++.dg/cpp0x/constexpr-pmf2.C: New test.

(cherry picked from commit bb1f0b50abbfa01e0ed720a5225a11aa7af32a89)

[Bug c++/98551] [10/11 Regression] ICE in replace_result_decl, at cp/constexpr.c:2150

2021-01-08 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98551

--- Comment #2 from CVS Commits  ---
The master branch has been updated by Patrick Palka :

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

commit r11-6554-gbb1f0b50abbfa01e0ed720a5225a11aa7af32a89
Author: Patrick Palka 
Date:   Fri Jan 8 10:11:25 2021 -0500

c++: ICE with constexpr call that returns a PMF [PR98551]

We shouldn't do replace_result_decl after evaluating a call that returns
a PMF because PMF temporaries aren't wrapped in a TARGET_EXPR (and so we
can't trust ctx->object), and PMF initializers can't be self-referential
anyway, so replace_result_decl would always be a no-op.

To that end, this patch changes the relevant AGGREGATE_TYPE_P test to
CLASS_TYPE_P, which should rule out PMFs (as well as arrays, which we
can't return and therefore won't see here).  This fixes an ICE from the
sanity check in replace_result_decl in the below testcase during
constexpr evaluation of the call f() in the initializer g(f()).

gcc/cp/ChangeLog:

PR c++/98551
* constexpr.c (cxx_eval_call_expression): Check CLASS_TYPE_P
instead of AGGREGATE_TYPE_P before calling replace_result_decl.

gcc/testsuite/ChangeLog:

PR c++/98551
* g++.dg/cpp0x/constexpr-pmf2.C: New test.

[Bug c++/98551] [10/11 Regression] ICE in replace_result_decl, at cp/constexpr.c:2150

2021-01-06 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98551

Patrick Palka  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |ppalka at gcc dot 
gnu.org
 Status|NEW |ASSIGNED

[Bug c++/98551] [10/11 Regression] ICE in replace_result_decl, at cp/constexpr.c:2150

2021-01-05 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98551

Marek Polacek  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Priority|P3  |P2
   Target Milestone|--- |10.3
Summary|[11 Regression] ICE in  |[10/11 Regression] ICE in
   |replace_result_decl, at |replace_result_decl, at
   |cp/constexpr.c:2150 |cp/constexpr.c:2150
   Last reconfirmed||2021-01-05
 Status|UNCONFIRMED |NEW
 CC||mpolacek at gcc dot gnu.org,
   ||ppalka at gcc dot gnu.org

--- Comment #1 from Marek Polacek  ---
Started with r10-7718.