aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-08-11 13:46:14 +0200
committerJakub Jelinek <jakub@redhat.com>2020-08-11 13:51:46 +0200
commit6b815e113c9aec397a86d7194f66455eb189cc7a (patch)
tree9b3cc54708c82f2edcda876aeca3b84bf70f2e0b /gcc/tree.c
parent1118a3ff9d3ad6a64bba25dc01e7703325e23d92 (diff)
downloadgcc-6b815e113c9aec397a86d7194f66455eb189cc7a.zip
gcc-6b815e113c9aec397a86d7194f66455eb189cc7a.tar.gz
gcc-6b815e113c9aec397a86d7194f66455eb189cc7a.tar.bz2
tree: Fix up get_narrower [PR96549]
My changes to get_narrower to support COMPOUND_EXPRs apparently used a wrong type for the COMPOUND_EXPRs, while e.g. the rhs type was unsigned short, the COMPOUND_EXPR got int type as that was the original type of op. The type of COMPOUND_EXPR should be always the type of the rhs. 2020-08-11 Jakub Jelinek <jakub@redhat.com> PR c/96549 * tree.c (get_narrower): Use TREE_TYPE (ret) instead of TREE_TYPE (win) for COMPOUND_EXPRs. * gcc.c-torture/execute/pr96549.c: New test.
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 6dea32a..d0202c3 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -8877,7 +8877,7 @@ get_narrower (tree op, int *unsignedp_ptr)
v.safe_push (op);
FOR_EACH_VEC_ELT_REVERSE (v, i, op)
ret = build2_loc (EXPR_LOCATION (op), COMPOUND_EXPR,
- TREE_TYPE (win), TREE_OPERAND (op, 0),
+ TREE_TYPE (ret), TREE_OPERAND (op, 0),
ret);
return ret;
}