Commit 5fe353c8 by Jakub Jelinek Committed by Jakub Jelinek

re PR middle-end/78201 (ICE in tree_to_shwi, at tree.h:4037 (seen both on ARM32 an AArch64))

	PR middle-end/78201
	* varasm.c (default_use_anchors_for_symbol_p): Fix a comment typo.
	Don't test decl != NULL.  Don't look at DECL_SIZE, but DECL_SIZE_UNIT
	instead, return false if it is NULL, or doesn't fit into uhwi, or
	is larger or equal to targetm.max_anchor_offset.

	* g++.dg/opt/pr78201.C: New test.

From-SVN: r242555
parent 86a21121
2016-11-17 Jakub Jelinek <jakub@redhat.com>
PR middle-end/78201
* varasm.c (default_use_anchors_for_symbol_p): Fix a comment typo.
Don't test decl != NULL. Don't look at DECL_SIZE, but DECL_SIZE_UNIT
instead, return false if it is NULL, or doesn't fit into uhwi, or
is larger or equal to targetm.max_anchor_offset.
2016-11-17 Pip Cet <pipcet@gmail.com> 2016-11-17 Pip Cet <pipcet@gmail.com>
Eric Botcazou <ebotcazou@adacore.com> Eric Botcazou <ebotcazou@adacore.com>
2016-11-17 Jakub Jelinek <jakub@redhat.com>
PR middle-end/78201
* g++.dg/opt/pr78201.C: New test.
2016-11-17 Christophe Lyon <christophe.lyon@linaro.org> 2016-11-17 Christophe Lyon <christophe.lyon@linaro.org>
* gcc.dg/pr78333.c: Add empty implementations of * gcc.dg/pr78333.c: Add empty implementations of
......
// PR middle-end/78201
// { dg-do compile }
// { dg-options "-O2" }
struct B { long d (); } *c;
long e;
void
foo ()
{
char a[e] = "";
c && c->d();
}
...@@ -6804,11 +6804,12 @@ default_use_anchors_for_symbol_p (const_rtx symbol) ...@@ -6804,11 +6804,12 @@ default_use_anchors_for_symbol_p (const_rtx symbol)
return false; return false;
/* Don't use section anchors for decls that won't fit inside a single /* Don't use section anchors for decls that won't fit inside a single
anchor range to reduce the amount of instructions require to refer anchor range to reduce the amount of instructions required to refer
to the entire declaration. */ to the entire declaration. */
if (decl && DECL_SIZE (decl) if (DECL_SIZE_UNIT (decl) == NULL_TREE
&& tree_to_shwi (DECL_SIZE (decl)) || !tree_fits_uhwi_p (DECL_SIZE_UNIT (decl))
>= (targetm.max_anchor_offset * BITS_PER_UNIT)) || (tree_to_uhwi (DECL_SIZE_UNIT (decl))
>= (unsigned HOST_WIDE_INT) targetm.max_anchor_offset))
return false; return false;
} }
......
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