On Sun, Sep 28, 2014 at 5:24 PM, FX wrote: > 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)
AFAIU, it looks like you run into the warning from decl_attributes at "if (spec == NULL)" where spec is the attribute specification. I don't think you want to go through that path (of decl_attributes); instead you probably want to set DECL_FUNCTION_SPECIFIC_OPTIMIZATION directly. You've found handle_optimize_attribute and parse_optimize_options in c-family/c-common.c. . It looks like parse_optimize_options has nothing c-family specific in it, so it could be moved to attribs.c. Then you'd use build_optimization_node to set DECL_FUNCTION_SPECIFIC_OPTIMIZATION, as done in c-common.c:handle_optimize_attribute. Hope this helps. Thanks for all the work you're putting into this! Ciao! Steven