[PATCH] Fix ICE in arm_function_in_section_p (PR target/38695)

Jakub Jelinek jakub@redhat.com
Sat Jan 10 13:48:00 GMT 2009


Hi!

pr37433.c testcase fails on ARM, because SYMBOL_REF_DECL of the called
symbol isn't necessarily FUNCTION_DECL, in the testcase it is STRING_CST,
could be VAR_DECL etc.  DECL_SECTION_NAME isn't defined for STRING_CST,
nor other macros.  Fixed by only trying sibcall if decl is a FUNCTION_DECL.
Other ports also check tree code before using DECL_SECTIO_NAME etc.

Laurent regtested this on arm, see
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38695#c6
Ok for trunk?

2009-01-10  Jakub Jelinek  <jakub@redhat.com>

	PR target/38695
	* config/arm/arm.c (arm_function_in_section_p): Return false
	for decl other than FUNCTION_DECL.

--- gcc/config/arm/arm.c.jj	2008-12-27 10:12:25.000000000 +0100
+++ gcc/config/arm/arm.c	2009-01-07 18:55:11.000000000 +0100
@@ -3310,6 +3310,9 @@ arm_set_default_type_attributes (tree ty
 static bool
 arm_function_in_section_p (tree decl, section *section)
 {
+  if (TREE_CODE (decl) != FUNCTION_DECL)
+    return false;
+
   /* We can only be certain about functions defined in the same
      compilation unit.  */
   if (!TREE_STATIC (decl))

	Jakub



More information about the Gcc-patches mailing list