diff options
author | Jakub Jelinek <jakub@redhat.com> | 2018-01-09 22:21:03 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2018-01-09 22:21:03 +0100 |
commit | 6ef72c3661318d0b5d7e3fc8821d136bbba37194 (patch) | |
tree | cacc6b6268cf2b10c6aab65f1c2c699a129b3d81 /gcc | |
parent | 0f1462579e348656b9a5549721f926d6f5894e1c (diff) | |
download | gcc-6ef72c3661318d0b5d7e3fc8821d136bbba37194.zip gcc-6ef72c3661318d0b5d7e3fc8821d136bbba37194.tar.gz gcc-6ef72c3661318d0b5d7e3fc8821d136bbba37194.tar.bz2 |
re PR c++/83734 (ice in cxx_eval _statement_list, at cp/constexpr.c:3869)
PR c++/83734
* constexpr.c (cxx_eval_statement_list): Ignore DEBUG_BEGIN_STMTs
in STATEMENT_LIST. Remove unneeded assert.
* g++.dg/cpp0x/pr83734.C: New test.
From-SVN: r256397
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/constexpr.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/pr83734.C | 6 |
4 files changed, 19 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 73a31df..54860dc 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-01-09 Jakub Jelinek <jakub@redhat.com> + + PR c++/83734 + * constexpr.c (cxx_eval_statement_list): Ignore DEBUG_BEGIN_STMTs + in STATEMENT_LIST. Remove unneeded assert. + 2018-01-03 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index c91ca96..b216e09 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -3851,6 +3851,8 @@ cxx_eval_statement_list (const constexpr_ctx *ctx, tree t, for (i = tsi_start (t); !tsi_end_p (i); tsi_next (&i)) { tree stmt = tsi_stmt (i); + if (TREE_CODE (stmt) == DEBUG_BEGIN_STMT) + continue; r = cxx_eval_constant_expression (ctx, stmt, false, non_constant_p, overflow_p, jump_target); @@ -3859,14 +3861,6 @@ cxx_eval_statement_list (const constexpr_ctx *ctx, tree t, if (returns (jump_target) || breaks (jump_target)) break; } - /* Make sure we don't use the "result" of a debug-only marker. That - would be wrong. We should be using the result of the previous - statement, or NULL if there isn't one. In practice, this should - never happen: the statement after the marker should override the - result of the marker, so its value shouldn't survive in R. Now, - should that ever change, we'll need some fixing here to stop - markers from modifying the generated executable code. */ - gcc_checking_assert (!r || TREE_CODE (r) != DEBUG_BEGIN_STMT); return r; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4515cfa..7d14817 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-01-09 Jakub Jelinek <jakub@redhat.com> + + PR c++/83734 + * g++.dg/cpp0x/pr83734.C: New test. + 2017-01-09 Carl Love <cel@us.ibm.com> * gcc.target/powerpc/builtins-1.c (main): Add tests for vec_mergee and diff --git a/gcc/testsuite/g++.dg/cpp0x/pr83734.C b/gcc/testsuite/g++.dg/cpp0x/pr83734.C new file mode 100644 index 0000000..958c2e9 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr83734.C @@ -0,0 +1,6 @@ +// PR c++/83734 +// { dg-do compile { target c++11 } } +// { dg-options "-g -O2" } + +struct A { constexpr A () { typedef int T; } }; +A a; |