Bug 85807 - [8/9 Regression] ICEs related to noexcept
Summary: [8/9 Regression] ICEs related to noexcept
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 8.1.0
: P2 normal
Target Milestone: 8.2
Assignee: Jason Merrill
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2018-05-16 13:56 UTC by Petr Azmanov
Modified: 2018-06-12 19:47 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 7.3.1
Known to fail: 8.1.0
Last reconfirmed: 2018-05-16 00:00:00


Attachments
self-contained test (438 bytes, text/x-csrc)
2018-05-16 13:56 UTC, Petr Azmanov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Azmanov 2018-05-16 13:56:20 UTC
Created attachment 44138 [details]
self-contained test

After upgrade to version 8.1.0, encountered ICE:
"internal compiler error: in check_noexcept_r, at cp/except.c:1027"

Slight modifications led to other ICEs.

Test script:
echo "==== Segfault internal compiler error"
/usr/bin/g++ -DSEGFAULT_ERROR test.cpp
echo "==== Noexcept internal compiler error"
/usr/bin/g++ -DNOEXCEPT_ERROR test.cpp
echo "==== Unexpected expression internal compiler error"
/usr/bin/g++ -DUNEXPECTED_EXPR_ERROR -Wall test.cpp
echo "==== cp_get_fndecl_from_callee internal compiler error (1)"
/usr/bin/g++ -DUNEXPECTED_EXPR_ERROR test.cpp
echo "==== cp_get_fndecl_from_callee internal compiler error (2)"
/usr/bin/g++ test.cpp

echo "==== Workaround"
/usr/bin/g++ -DWORKAROUND test.cpp

Output:
==== Segfault internal compiler error
test.cpp: In function ‘value_statistics_t<> calc() [with T = double]’:
test.cpp:25:13: internal compiler error: Segmentation fault
     return {};
             ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.archlinux.org/> for instructions.
==== Noexcept internal compiler error
test.cpp: In instantiation of ‘value_statistics_t<> calc() [with T = double]’:
test.cpp:39:46:   required from here
test.cpp:28:24: internal compiler error: in check_noexcept_r, at cp/except.c:1027
   value_statistics_t<> result;
                        ^~~~~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.archlinux.org/> for instructions.
==== Unexpected expression internal compiler error
test.cpp: In instantiation of ‘value_statistics_t<> calc() [with T = double]’:
test.cpp:39:46:   required from here
test.cpp:31:31: internal compiler error: unexpected expression ‘(size_t)0’ of kind implicit_conv_expr
   return value_statistics_t<>{};
                               ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.archlinux.org/> for instructions.
==== cp_get_fndecl_from_callee internal compiler error (1)
test.cpp: In instantiation of ‘value_statistics_t<> calc() [with T = double]’:
test.cpp:39:46:   required from here
test.cpp:35:1: internal compiler error: in cp_get_fndecl_from_callee, at cp/cvt.c:957
 }
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.archlinux.org/> for instructions.
==== cp_get_fndecl_from_callee internal compiler error (2)
test.cpp: In instantiation of ‘value_statistics_t<> calc() [with T = double]’:
test.cpp:39:46:   required from here
test.cpp:35:1: internal compiler error: in cp_get_fndecl_from_callee, at cp/cvt.c:957
 }
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.archlinux.org/> for instructions.
==== Workaround
Comment 1 Marek Polacek 2018-05-16 14:09:02 UTC
Confirmed.
Comment 2 Marek Polacek 2018-05-16 14:14:45 UTC
Started with r253599.
Comment 3 Jason Merrill 2018-05-30 19:31:46 UTC
Author: jason
Date: Wed May 30 19:31:11 2018
New Revision: 260972

URL: https://gcc.gnu.org/viewcvs?rev=260972&root=gcc&view=rev
Log:
	PR c++/85807 - ICE with call in template NSDMI.

	* init.c (get_nsdmi): Use push_to/pop_from_top_level.
	* tree.c (bot_manip): Don't set_flags_from_callee in a template.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/nsdmi-template17.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/init.c
    trunk/gcc/cp/tree.c
    trunk/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice14.C
    trunk/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi8.C
Comment 4 Jason Merrill 2018-06-11 22:02:34 UTC
Author: jason
Date: Mon Jun 11 22:02:01 2018
New Revision: 261461

URL: https://gcc.gnu.org/viewcvs?rev=261461&root=gcc&view=rev
Log:
	PR c++/85807 - ICE with call in template NSDMI.

	* init.c (get_nsdmi): Use push_to/pop_from_top_level.
	* tree.c (bot_manip): Don't set_flags_from_callee in a template.

Added:
    branches/gcc-8-branch/gcc/testsuite/g++.dg/cpp0x/nsdmi-template17.C
Modified:
    branches/gcc-8-branch/gcc/cp/ChangeLog
    branches/gcc-8-branch/gcc/cp/init.c
    branches/gcc-8-branch/gcc/cp/tree.c
    branches/gcc-8-branch/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice14.C
    branches/gcc-8-branch/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi8.C
Comment 5 Jason Merrill 2018-06-12 19:47:27 UTC
Fixed for 8.2.