This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[ia64 PATCH] Fix up ia64 attribute handling (PR target/61137)


Hi!

Seems the gcc.target/ia64/small-addr-1.c testcase is failing on ia64 since
r210262 but clearly has been failing for much longer if compiled with C++
(just there is insufficient testsuite coverage).
The problem is that for the model attribute (and apparently common_object on
VMS too), the argument of that attribute is supposed to be an identifier
rather than expression (for common_object either an identifier or string),
and these days one has to tell the frontends about that in order not to
get the argument parsed as an expression.

The following untested patch fixes that (tested on small-addr-1.c with
a cross-compiler), I don't have ia64 hw nor spare cycles to test this
though, so I'm just offering the patch as is if anyone wants to test it.
Perhaps better testsuite coverage wouldn't hurt (test the model (small)
attribute also in C++, perhaps test the common_object attribute on VMS?).

2014-11-20  Jakub Jelinek  <jakub@redhat.com>

	PR target/61137
	* config/ia64/ia64.c (ia64_attribute_takes_identifier_p): New function.
	(TARGET_ATTRIBUTE_TAKES_IDENTIFIER_P): Redefine to it.

--- gcc/config/ia64/ia64.c.jj	2014-11-11 00:06:23.000000000 +0100
+++ gcc/config/ia64/ia64.c	2014-11-20 11:51:59.729478773 +0100
@@ -324,6 +324,7 @@ static bool ia64_vms_valid_pointer_mode
 static tree ia64_vms_common_object_attribute (tree *, tree, tree, int, bool *)
      ATTRIBUTE_UNUSED;
 
+static bool ia64_attribute_takes_identifier_p (const_tree);
 static tree ia64_handle_model_attribute (tree *, tree, tree, int, bool *);
 static tree ia64_handle_version_id_attribute (tree *, tree, tree, int, bool *);
 static void ia64_encode_section_info (tree, rtx, int);
@@ -669,8 +670,26 @@ static const struct attribute_spec ia64_
 #undef TARGET_VECTORIZE_VEC_PERM_CONST_OK
 #define TARGET_VECTORIZE_VEC_PERM_CONST_OK ia64_vectorize_vec_perm_const_ok
 
+#undef TARGET_ATTRIBUTE_TAKES_IDENTIFIER_P
+#define TARGET_ATTRIBUTE_TAKES_IDENTIFIER_P ia64_attribute_takes_identifier_p
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
+/* Returns TRUE iff the target attribute indicated by ATTR_ID takes a plain
+   identifier as an argument, so the front end shouldn't look it up.  */
+
+static bool
+ia64_attribute_takes_identifier_p (const_tree attr_id)
+{
+  if (is_attribute_p ("model", attr_id))
+    return true;
+#if TARGET_ABI_OPEN_VMS
+  if (is_attribute_p ("common_object", attr_id))
+    return true;
+#endif
+  return false;
+}
+
 typedef enum
   {
     ADDR_AREA_NORMAL,	/* normal address area */

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]