Commit 3d3f9e7e by Jakub Jelinek Committed by Jakub Jelinek

re PR debug/70628 (ICE in get_reg_rtx, at emit-rtl.c:1025)

	PR debug/70628
	* rtl.h (convert_memory_address_addr_space_1): New prototype.
	* explow.c (convert_memory_address_addr_space_1): No longer static,
	add NO_EMIT argument and don't call convert_modes if true, pass
	it down recursively, remove break after return.
	(convert_memory_address_addr_space): Adjust caller.
	* simplify-rtx.c (simplify_unary_operation_1): Call
	convert_memory_address_addr_space_1 instead of convert_memory_address,
	if it returns NULL, don't simplify.

	* gcc.dg/torture/pr70628.c: New test.

From-SVN: r234933
parent 12de2245
2016-04-13 Jakub Jelinek <jakub@redhat.com>
PR debug/70628
* rtl.h (convert_memory_address_addr_space_1): New prototype.
* explow.c (convert_memory_address_addr_space_1): No longer static,
add NO_EMIT argument and don't call convert_modes if true, pass
it down recursively, remove break after return.
(convert_memory_address_addr_space): Adjust caller.
* simplify-rtx.c (simplify_unary_operation_1): Call
convert_memory_address_addr_space_1 instead of convert_memory_address,
if it returns NULL, don't simplify.
2016-04-12 Eric Botcazou <ebotcazou@adacore.com> 2016-04-12 Eric Botcazou <ebotcazou@adacore.com>
PR target/70630 PR target/70630
......
...@@ -259,12 +259,14 @@ break_out_memory_refs (rtx x) ...@@ -259,12 +259,14 @@ break_out_memory_refs (rtx x)
which way). We take advantage of the fact that pointers are not allowed to which way). We take advantage of the fact that pointers are not allowed to
overflow by commuting arithmetic operations over conversions so that address overflow by commuting arithmetic operations over conversions so that address
arithmetic insns can be used. IN_CONST is true if this conversion is inside arithmetic insns can be used. IN_CONST is true if this conversion is inside
a CONST. */ a CONST. NO_EMIT is true if no insns should be emitted, and instead
it should return NULL if it can't be simplified without emitting insns. */
static rtx rtx
convert_memory_address_addr_space_1 (machine_mode to_mode ATTRIBUTE_UNUSED, convert_memory_address_addr_space_1 (machine_mode to_mode ATTRIBUTE_UNUSED,
rtx x, addr_space_t as ATTRIBUTE_UNUSED, rtx x, addr_space_t as ATTRIBUTE_UNUSED,
bool in_const ATTRIBUTE_UNUSED) bool in_const ATTRIBUTE_UNUSED,
bool no_emit ATTRIBUTE_UNUSED)
{ {
#ifndef POINTERS_EXTEND_UNSIGNED #ifndef POINTERS_EXTEND_UNSIGNED
gcc_assert (GET_MODE (x) == to_mode || GET_MODE (x) == VOIDmode); gcc_assert (GET_MODE (x) == to_mode || GET_MODE (x) == VOIDmode);
...@@ -310,19 +312,16 @@ convert_memory_address_addr_space_1 (machine_mode to_mode ATTRIBUTE_UNUSED, ...@@ -310,19 +312,16 @@ convert_memory_address_addr_space_1 (machine_mode to_mode ATTRIBUTE_UNUSED,
temp = gen_rtx_LABEL_REF (to_mode, LABEL_REF_LABEL (x)); temp = gen_rtx_LABEL_REF (to_mode, LABEL_REF_LABEL (x));
LABEL_REF_NONLOCAL_P (temp) = LABEL_REF_NONLOCAL_P (x); LABEL_REF_NONLOCAL_P (temp) = LABEL_REF_NONLOCAL_P (x);
return temp; return temp;
break;
case SYMBOL_REF: case SYMBOL_REF:
temp = shallow_copy_rtx (x); temp = shallow_copy_rtx (x);
PUT_MODE (temp, to_mode); PUT_MODE (temp, to_mode);
return temp; return temp;
break;
case CONST: case CONST:
return gen_rtx_CONST (to_mode, temp = convert_memory_address_addr_space_1 (to_mode, XEXP (x, 0), as,
convert_memory_address_addr_space_1 true, no_emit);
(to_mode, XEXP (x, 0), as, true)); return temp ? gen_rtx_CONST (to_mode, temp) : temp;
break;
case PLUS: case PLUS:
case MULT: case MULT:
...@@ -338,18 +337,25 @@ convert_memory_address_addr_space_1 (machine_mode to_mode ATTRIBUTE_UNUSED, ...@@ -338,18 +337,25 @@ convert_memory_address_addr_space_1 (machine_mode to_mode ATTRIBUTE_UNUSED,
&& CONST_INT_P (XEXP (x, 1)) && CONST_INT_P (XEXP (x, 1))
&& ((in_const && POINTERS_EXTEND_UNSIGNED != 0) && ((in_const && POINTERS_EXTEND_UNSIGNED != 0)
|| XEXP (x, 1) == convert_memory_address_addr_space_1 || XEXP (x, 1) == convert_memory_address_addr_space_1
(to_mode, XEXP (x, 1), as, in_const) (to_mode, XEXP (x, 1), as, in_const,
no_emit)
|| POINTERS_EXTEND_UNSIGNED < 0))) || POINTERS_EXTEND_UNSIGNED < 0)))
return gen_rtx_fmt_ee (GET_CODE (x), to_mode, {
convert_memory_address_addr_space_1 temp = convert_memory_address_addr_space_1 (to_mode, XEXP (x, 0),
(to_mode, XEXP (x, 0), as, in_const), as, in_const, no_emit);
XEXP (x, 1)); return temp ? gen_rtx_fmt_ee (GET_CODE (x), to_mode,
temp, XEXP (x, 1))
: temp;
}
break; break;
default: default:
break; break;
} }
if (no_emit)
return NULL_RTX;
return convert_modes (to_mode, from_mode, return convert_modes (to_mode, from_mode,
x, POINTERS_EXTEND_UNSIGNED); x, POINTERS_EXTEND_UNSIGNED);
#endif /* defined(POINTERS_EXTEND_UNSIGNED) */ #endif /* defined(POINTERS_EXTEND_UNSIGNED) */
...@@ -364,7 +370,7 @@ convert_memory_address_addr_space_1 (machine_mode to_mode ATTRIBUTE_UNUSED, ...@@ -364,7 +370,7 @@ convert_memory_address_addr_space_1 (machine_mode to_mode ATTRIBUTE_UNUSED,
rtx rtx
convert_memory_address_addr_space (machine_mode to_mode, rtx x, addr_space_t as) convert_memory_address_addr_space (machine_mode to_mode, rtx x, addr_space_t as)
{ {
return convert_memory_address_addr_space_1 (to_mode, x, as, false); return convert_memory_address_addr_space_1 (to_mode, x, as, false, false);
} }
......
...@@ -2747,6 +2747,8 @@ extern unsigned int subreg_highpart_offset (machine_mode, ...@@ -2747,6 +2747,8 @@ extern unsigned int subreg_highpart_offset (machine_mode,
machine_mode); machine_mode);
extern int byte_lowpart_offset (machine_mode, machine_mode); extern int byte_lowpart_offset (machine_mode, machine_mode);
extern rtx make_safe_from (rtx, rtx); extern rtx make_safe_from (rtx, rtx);
extern rtx convert_memory_address_addr_space_1 (machine_mode, rtx,
addr_space_t, bool, bool);
extern rtx convert_memory_address_addr_space (machine_mode, rtx, extern rtx convert_memory_address_addr_space (machine_mode, rtx,
addr_space_t); addr_space_t);
#define convert_memory_address(to_mode,x) \ #define convert_memory_address(to_mode,x) \
......
...@@ -1482,7 +1482,14 @@ simplify_unary_operation_1 (enum rtx_code code, machine_mode mode, rtx op) ...@@ -1482,7 +1482,14 @@ simplify_unary_operation_1 (enum rtx_code code, machine_mode mode, rtx op)
&& REG_POINTER (SUBREG_REG (op)) && REG_POINTER (SUBREG_REG (op))
&& GET_MODE (SUBREG_REG (op)) == Pmode)) && GET_MODE (SUBREG_REG (op)) == Pmode))
&& !targetm.have_ptr_extend ()) && !targetm.have_ptr_extend ())
return convert_memory_address (Pmode, op); {
temp
= convert_memory_address_addr_space_1 (Pmode, op,
ADDR_SPACE_GENERIC, false,
true);
if (temp)
return temp;
}
#endif #endif
break; break;
...@@ -1604,7 +1611,14 @@ simplify_unary_operation_1 (enum rtx_code code, machine_mode mode, rtx op) ...@@ -1604,7 +1611,14 @@ simplify_unary_operation_1 (enum rtx_code code, machine_mode mode, rtx op)
&& REG_POINTER (SUBREG_REG (op)) && REG_POINTER (SUBREG_REG (op))
&& GET_MODE (SUBREG_REG (op)) == Pmode)) && GET_MODE (SUBREG_REG (op)) == Pmode))
&& !targetm.have_ptr_extend ()) && !targetm.have_ptr_extend ())
return convert_memory_address (Pmode, op); {
temp
= convert_memory_address_addr_space_1 (Pmode, op,
ADDR_SPACE_GENERIC, false,
true);
if (temp)
return temp;
}
#endif #endif
break; break;
......
2016-04-13 Jakub Jelinek <jakub@redhat.com>
PR debug/70628
* gcc.dg/torture/pr70628.c: New test.
2016-04-12 Patrick Palka <ppalka@gcc.gnu.org> 2016-04-12 Patrick Palka <ppalka@gcc.gnu.org>
PR c++/70610 PR c++/70610
......
/* PR debug/70628 */
/* { dg-do compile } */
/* { dg-options "-g -w" } */
struct S { char s[64]; int *t; } *a;
char b[64];
int *foo (void);
struct S *bar (int *);
int baz (void);
void
test (const char *p, long q)
{
int *c;
c = foo ();
while (a = bar (c))
{
if (__builtin_strstr (p, "ABCD")
|| __builtin_strstr (p, "EFGHI")
|| __builtin_strstr (p, "JKL")
|| __builtin_strstr (p, "MNOPQR")
|| __builtin_strstr (p, "STUV")
|| __builtin_strstr (p, "WXYZabcd")
|| __builtin_strstr (p, "efghij")
|| __builtin_strstr (p, "klmno")
|| __builtin_strstr (p, "pqrstuvw")
|| __builtin_strstr (b, "MNOPQR") != "EFGHI"
|| __builtin_strstr (b, "JKL"))
if (__builtin_strstr (a->s, "xyz12"))
continue;
__builtin_printf ("%p\n", a->t);
}
bar (c);
while (a)
if (__builtin_strstr (p, "ABCD")
|| __builtin_strstr (p, "EFGHI")
|| __builtin_strstr (p, "JKL")
|| __builtin_strstr (p, "MNOPQR")
|| __builtin_strstr (p, "STUV")
|| __builtin_strstr (p, "WXYZabcd")
|| __builtin_strstr (p, "efghij")
|| __builtin_strstr (p, "klmno")
|| __builtin_strstr (p, "pqrstuvw")
|| __builtin_strstr ((const char *) q, "MNOPQR"))
baz ();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment