aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-08-11 13:46:14 +0200
committerGiuliano Belinassi <giuliano.belinassi@usp.br>2020-08-17 15:07:58 -0300
commitb76a9e0d9e1a2240c1c955461e58297aea066cca (patch)
tree5041757945f973d415b36f4772bf8760c841d599 /gcc/testsuite
parent72bffce616a841ba03d5bba68bc2c650c5e2a83d (diff)
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/testsuite')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr96549.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr96549.c b/gcc/testsuite/gcc.c-torture/execute/pr96549.c
new file mode 100644
index 00000000000..9d992a82c19
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr96549.c
@@ -0,0 +1,12 @@
+/* PR c/96549 */
+
+long c = -1L;
+long b = 0L;
+
+int
+main ()
+{
+ if (3L > (short) ((c ^= (b = 1L)) * 3L))
+ return 0;
+ __builtin_abort ();
+}