Hi Joseph,

Thank you for the review and nice to meet you.

@@ -3191,6 +3240,14 @@ duplicate_decls (tree newdecl, tree olddecl)
      return false;
    }

+  /* If both new and old are Function Multi Versioned functions then they are
+     not duplicates.  */
+  if (TREE_CODE (newdecl) == FUNCTION_DECL
+      && TREE_CODE (olddecl) == FUNCTION_DECL
+      && DECL_FUNCTION_VERSIONED (newdecl)
+      && DECL_FUNCTION_VERSIONED (olddecl))
+    return false;

Is that really the case?  I'd expect duplicates to be possible if there
are multiple declarations of the same version of the function.  So there
should be tests in the testsuite both for valid cases of declaring the
same version multiple times, in the same or different scopes, and invalid
cases that define the same version multiple times.

Ahh this is a problem. I hadn't considered the merging of declarations
and it leads to duplicate entries in the resolver. Thank you for pointing
this out.

Im working to find a way to fix this and merge declarations of functions
with the same target. It seems like the C frontend is written assuming one
declaration per name, which is normally a good assumption I suppose, but
this invalidates.

Im currently planning to do this at the `pushdecl` level, by iterating through
the `shadows` link in c bindings, and then only doing `duplicate_decls` on
functions with matching targets.

I will get back to you soon,

Alfie Richards
alfie.richa...@arm.com

Reply via email to