On 19/02/2025 12:53, Richard Sandiford wrote:
No unfortunately the error is just:

../FMV_REWRITE/gcc/testsuite/g++.target/aarch64/mvc-error2.C:9:1: error:
redefinition of ‘float foo()’
      9 | foo () { return 3; }
        | ^~~
../FMV_REWRITE/gcc/testsuite/g++.target/aarch64/mvc-error2.C:6:1: note:
‘float foo()’ previously defined here
      6 | foo () { return 3; }
        | ^~~

This is obviously not great.

I didn't do anything about this as all the ways I could think of to
improve this are quite involved.

Currently this is handled by the common_function_version hook which only
indicates if the decl's are part of the same function version set or
not. Then in this case where they're not distinct versions it tries to
combine them (which fails) and then diagnoses the conflict as usual.

I think I've got a way to make this slightly better, which I will try.
Sounds good!  I don't think this is a blocker, so no worries if it
turns out to be too awkward.  I was just curious.

Thanks,
Richard

Hello,

Having given this more thought, it's worse than I thought, and needs a rethink.

The issue is cases like:

__attribute__ ((target_clones ("default, dotprod"))) float
foo ();

__attribute__ ((target_clones ("dotprod", "mve"))) float
foo () { return 3; }

Which is not handled well by the current structure as it does define a common version, and isn't a duplicate definition (as one is not a definition). Currently this is an ICE :(

I am going to refactor the common_function_version hook to be more flexible and handle the logic properly in the front end which will enable me to emit a sensible diagnostic as well.

Thanks,
Alfie

Reply via email to