aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@gcc.gnu.org>2017-04-12 15:57:45 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2017-04-12 15:57:45 +0200
commit76873758402927ca5fca67abc018eab862fd1b96 (patch)
tree3ee9c7544c16c0adf77cb08020ba136611a605cf /gcc
parent940c9a7c2cf3bbbf43b0602c9283bf7579cf05ec (diff)
downloadgcc-76873758402927ca5fca67abc018eab862fd1b96.zip
gcc-76873758402927ca5fca67abc018eab862fd1b96.tar.gz
gcc-76873758402927ca5fca67abc018eab862fd1b96.tar.bz2
re PR middle-end/80163 (ICE on hopefully valid code)
PR c/80163 * expr.c <CASE_CONVERT>: For EXPAND_INITIALIZER determine SIGN_EXTEND vs. ZERO_EXTEND based on signedness of treeop0's type rather than signedness of the result type. * gcc.dg/torture/pr80163.c: New test. From-SVN: r246876
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/expr.c3
-rw-r--r--gcc/testsuite/ChangeLog9
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr80163.c35
4 files changed, 53 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1f98b88..3a7675e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
+2017-04-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/80163
+ * expr.c <CASE_CONVERT>: For EXPAND_INITIALIZER determine SIGN_EXTEND
+ vs. ZERO_EXTEND based on signedness of treeop0's type rather than
+ signedness of the result type.
+
2017-04-12 Richard Biener <rguenther@suse.de>
- Jeff Law <law@redhat.com>
+ Jeff Law <law@redhat.com>
PR tree-optimization/80359
* tree-ssa-dse.c (maybe_trim_partially_dead_store): Do not
@@ -18,7 +25,7 @@
for quad_address_p for TImode, instead of just not indexed_address.
2017-04-12 Richard Biener <rguenther@suse.de>
- Bernd Edlinger <bernd.edlinger@hotmail.de>
+ Bernd Edlinger <bernd.edlinger@hotmail.de>
PR middle-end/79671
* alias.c (component_uses_parent_alias_set_from): Handle
diff --git a/gcc/expr.c b/gcc/expr.c
index 91d7ea2..29ebad3 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -8333,7 +8333,8 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode tmode,
}
else if (modifier == EXPAND_INITIALIZER)
- op0 = gen_rtx_fmt_e (unsignedp ? ZERO_EXTEND : SIGN_EXTEND, mode, op0);
+ op0 = gen_rtx_fmt_e (TYPE_UNSIGNED (TREE_TYPE (treeop0))
+ ? ZERO_EXTEND : SIGN_EXTEND, mode, op0);
else if (target == 0)
op0 = convert_to_mode (mode, op0,
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index bc2424a..f43a4d9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,11 +1,16 @@
+2017-04-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/80163
+ * gcc.dg/torture/pr80163.c: New test.
+
2017-04-12 Richard Biener <rguenther@suse.de>
- Jeff Law <law@redhat.com>
+ Jeff Law <law@redhat.com>
PR tree-optimization/80359
* gcc.dg/torture/pr80359.c: New testcase.
2017-04-12 Richard Biener <rguenther@suse.de>
- Bernd Edlinger <bernd.edlinger@hotmail.de>
+ Bernd Edlinger <bernd.edlinger@hotmail.de>
PR middle-end/79671
* g++.dg/torture/pr79671.C: New testcase.
diff --git a/gcc/testsuite/gcc.dg/torture/pr80163.c b/gcc/testsuite/gcc.dg/torture/pr80163.c
new file mode 100644
index 0000000..80cc68d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr80163.c
@@ -0,0 +1,35 @@
+/* PR c/80163 */
+/* { dg-do compile { target int128 } } */
+
+volatile int v;
+
+__attribute__((noinline, noclone)) void
+bar (void)
+{
+ v++;
+ asm volatile ("" : : : "memory");
+}
+
+__attribute__((noinline, noclone)) __int128_t *
+foo (unsigned long **p)
+{
+a:
+ bar ();
+b:
+ bar ();
+ static __int128_t d = (unsigned long) &&a - (unsigned long) &&b;
+ static unsigned long e = (unsigned long) &&a - (unsigned long) &&b;
+ *p = &e;
+ return &d;
+}
+
+int
+main ()
+{
+ __int128_t *p;
+ unsigned long *q;
+ p = foo (&q);
+ if (*p != *q)
+ __builtin_abort ();
+ return 0;
+}