Is "optimize" attribute on fndecl handled differently?
FX <fxcoudert <at> gmail.com>
2014-09-28 15:24:20 GMT
I’m trying to get the Fortran front-end to add function-specific optimization flags to certain
functions (those that request IEEE compliance through use of the specific Fortran module). It seems
simple enough, adding the attribute to the fndecl, but though I’ve tried to do so at two different places
(when we first build the function decl, and when we later call it), both fail with:
Warning: ‘optimize’ attribute directive ignored [-Wattributes]
I’m getting the feeling that maybe it’s because I gave the attribute a string value, and it’s
expecting a tree already… but the functions to do so are not generic, they’re in c-family, which
probably means I can’t use them.
Any idea how I could get to the result I want? (setting options from the Fortran front-end)
--- trans-decl.c (revision 215668)
+++ trans-decl.c (working copy)
<at> <at> -1961,6 +1961,13 <at> <at>
TREE_USED (fndecl) = 1;
attributes = add_attributes_to_decl (attr, NULL_TREE);
+#define OPT "fno-unsafe-math-optimizations"
+ tree opt = build_tree_list (NULL_TREE, build_string (strlen (OPT), OPT));
+ attributes = tree_cons (get_identifier ("optimize"), opt, attributes);