On Mon, Aug 07, 2017 at 10:54:18AM -0400, Jason Merrill wrote: > On 08/07/2017 05:08 AM, Jakub Jelinek wrote: > > + tree s = lookup_attribute ("omp declare simd", > > + DECL_ATTRIBUTES (newdecl)); > > + if (s) > > + { > > + tree b > > + = builtin_decl_explicit (DECL_FUNCTION_CODE (newdecl)); > > + if (b) > > + { > > + tree s2 = lookup_attribute ("omp declare simd", > > + DECL_ATTRIBUTES (b)); > > + while (s) > > + { > > + tree s3; > > + for (s3 = s2; s3; > > + s3 = lookup_attribute ("omp declare simd", > > + TREE_CHAIN (s3))) > > + if (attribute_value_equal (s, s3)) > > + break; > > + if (!s3) > > + { > > + s3 = copy_node (s); > > + TREE_CHAIN (s3) = DECL_ATTRIBUTES (b); > > + DECL_ATTRIBUTES (b) = s3; > > + } > > + s = lookup_attribute ("omp declare simd", > > + TREE_CHAIN (s)); > > + } > > + } > > + } > > This should really be a separate function. Perhaps "merge_one_attribute"?
If it is outlined without the first 7 lines, i.e. just the body of if (b), then it could be duplicate_one_attribute (tree *, tree, const char *); called like if (b) duplicate_one_attribute (&DECL_ATTRIBUTES (b), s, "omp declare simd"); If it is duplicated as whole, it should be called duplicate_one_attr_to_builtin or something similar. In any case, it could be in tree.c or attribs.c. The primary question is if we want this behavior, or if we should go the libstdc++ patch routine (and for Jonathan the question is if he knows why __builtin_XXXf has been used there rather than the ::XXXf). Jakub