--- /dev/null
+/* { dg-do compile }
+ { dg-options "-fdump-tree-gimple" } */
+
+__attribute__ ((aligned (32)))
+__attribute__ ((access (write_only, 2, 1)))
+void f (int n, void *p)
+{
+ __builtin_memset (p, 0, n);
+}
+
+/* Verify the DECL_ATTRIBUTE "aligned" is mentioned:
+ { dg-final { scan-tree-dump "__attribute__\\(\\(aligned" "gimple" } }
+ and the TYPE_ATTRIBUTE "access" is also mentioned:
+ { dg-final { scan-tree-dump "__attribute__\\(\\(access" "gimple" } }
+ and the function signature including its return type is mentioned:
+ { dg-final { scan-tree-dump "void f *\\(int n, void *\\* *p\\)" "gimple" } } */
&& decl_is_tm_clone (fndecl));
struct function *fun = DECL_STRUCT_FUNCTION (fndecl);
- if (DECL_ATTRIBUTES (fndecl) != NULL_TREE)
+ tree fntype = TREE_TYPE (fndecl);
+ tree attrs[] = { DECL_ATTRIBUTES (fndecl), TYPE_ATTRIBUTES (fntype) };
+
+ for (int i = 0; i != 2; ++i)
{
+ if (!attrs[i])
+ continue;
+
fprintf (file, "__attribute__((");
bool first = true;
tree chain;
- for (chain = DECL_ATTRIBUTES (fndecl); chain;
- first = false, chain = TREE_CHAIN (chain))
+ for (chain = attrs[i]; chain; first = false, chain = TREE_CHAIN (chain))
{
if (!first)
fprintf (file, ", ");
}
}
else
- fprintf (file, "%s %s(", function_name (fun), tmclone ? "[tm-clone] " : "");
+ {
+ print_generic_expr (file, TREE_TYPE (fntype), dump_flags);
+ fprintf (file, " %s %s(", function_name (fun),
+ tmclone ? "[tm-clone] " : "");
+ }
arg = DECL_ARGUMENTS (fndecl);
while (arg)