summaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/ChangeLog6
-rw-r--r--gcc/c-family/c-warn.c5
2 files changed, 11 insertions, 0 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 3f195ebcc5d..0d805c64bde 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,9 @@
+2020-03-23 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/91993
+ * c-warn.c (warnings_for_convert_and_check): For expr and/or
+ result being COMPOUND_EXPRs, skip to ultimate rhs.
+
2020-03-20 Richard Sandiford <richard.sandiford@arm.com>
PR middle-end/94072
diff --git a/gcc/c-family/c-warn.c b/gcc/c-family/c-warn.c
index 9315cac683e..f6b3afc727c 100644
--- a/gcc/c-family/c-warn.c
+++ b/gcc/c-family/c-warn.c
@@ -1359,6 +1359,11 @@ warnings_for_convert_and_check (location_t loc, tree type, tree expr,
{
loc = expansion_point_location_if_in_system_header (loc);
+ while (TREE_CODE (expr) == COMPOUND_EXPR)
+ expr = TREE_OPERAND (expr, 1);
+ while (TREE_CODE (result) == COMPOUND_EXPR)
+ result = TREE_OPERAND (result, 1);
+
bool cst = TREE_CODE_CLASS (TREE_CODE (result)) == tcc_constant;
tree exprtype = TREE_TYPE (expr);