]> gcc.gnu.org Git - gcc.git/commit
c++: Fix handling of internal fn calls in statement expressions [PR94385]
authorJakub Jelinek <jakub@redhat.com>
Mon, 30 Mar 2020 20:55:36 +0000 (22:55 +0200)
committerJakub Jelinek <jakub@redhat.com>
Tue, 7 Apr 2020 19:00:35 +0000 (21:00 +0200)
commita6bf0e5fb11cc0e231ac016a1995caaa93fdc4a0
treeae03adca20334d55e159c96168a6641b04862eed
parent57e276f3e304ef92483763ee1028e5b3e1345e0f
c++: Fix handling of internal fn calls in statement expressions [PR94385]

The following testcase ICEs, because the FE when processing the statement
expression changes the .VEC_CONVERT internal fn CALL_EXPR into .PHI call.
That is because the internal fn call is recorded in the base.u.ifn
field, which overlaps base.u.bits.lang_flag_1 which is used for
STMT_IS_FULL_EXPR_P, so this essentially does ifn |= 2 on little-endian.
STMT_IS_FULL_EXPR_P bit is used in:
cp-gimplify.c-  if (STATEMENT_CODE_P (code))
cp-gimplify.c-    {
cp-gimplify.c-      saved_stmts_are_full_exprs_p = stmts_are_full_exprs_p ();
cp-gimplify.c-      current_stmt_tree ()->stmts_are_full_exprs_p
cp-gimplify.c:        = STMT_IS_FULL_EXPR_P (*expr_p);
cp-gimplify.c-    }
and
pt.c-  if (STATEMENT_CODE_P (TREE_CODE (t)))
pt.c:    current_stmt_tree ()->stmts_are_full_exprs_p = STMT_IS_FULL_EXPR_P (t);
so besides being wrong on some other codes, it actually isn't beneficial at
all to set it on anything else, so the following patch restricts it to
trees with STATEMENT_CODE_P TREE_CODE.

2020-03-30  Jakub Jelinek  <jakub@redhat.com>

PR c++/94385
* semantics.c (add_stmt): Only set STMT_IS_FULL_EXPR_P on trees with
STATEMENT_CODE_P code.

* c-c++-common/pr94385.c: New test.
gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/pr94385.c [new file with mode: 0644]
This page took 0.074986 seconds and 6 git commands to generate.