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
This commit is contained in:
Jakub Jelinek 2017-04-12 15:57:45 +02:00
parent 940c9a7c2c
commit 7687375840
4 changed files with 53 additions and 5 deletions

View File

@ -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

View File

@ -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,

View File

@ -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.

View File

@ -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;
}