[Bug target/115713] rs6000: Miss warning for incompatible no-altivec and vsx in target attribute
linkw at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jul 1 07:37:14 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115713
--- Comment #3 from Kewen Lin <linkw at gcc dot gnu.org> ---
(In reply to Peter Bergner from comment #2)
> (In reply to Kewen Lin from comment #0)
> > As Peter found in the PR115688, there isn't a warning for:
> >
> > long __attribute__ ((target ("no-altivec,vsx")))
> > foo (void)
> > {
> > return 0;
> > }
> >
> > It's expected to see warning like:
> >
> > warning: ‘-mvsx’ and ‘-mno-altivec’ are incompatible
>
> I think Segher and I mentioned in the other bug, that conflicting options
> like this should be an error, rather than a warning.
ah, thanks for noting this, sorry that I missed that part. I agree that error
sounds better as both are explicitly specified. I thought the reason why it's a
warning is that the whole processing hunk is for warning:
/* Add some warnings for VSX. */
if (TARGET_VSX)
{
const char *msg = NULL;
if (!TARGET_HARD_FLOAT)
{
if (rs6000_isa_flags_explicit & OPTION_MASK_VSX)
msg = N_("%<-mvsx%> requires hardware floating point");
else
{
rs6000_isa_flags &= ~ OPTION_MASK_VSX;
rs6000_isa_flags_explicit |= OPTION_MASK_VSX;
}
}
else if (TARGET_AVOID_XFORM > 0)
msg = N_("%<-mvsx%> needs indexed addressing");
else if (!TARGET_ALTIVEC && (rs6000_isa_flags_explicit
& OPTION_MASK_ALTIVEC))
{
if (rs6000_isa_flags_explicit & OPTION_MASK_VSX)
msg = N_("%<-mvsx%> and %<-mno-altivec%> are incompatible");
else
msg = N_("%<-mno-altivec%> disables vsx");
}
if (msg)
{
warning (0, msg);
rs6000_isa_flags &= ~ OPTION_MASK_VSX;
rs6000_isa_flags_explicit |= OPTION_MASK_VSX;
}
}
I think we still would like to leave the others as warning, then I'll add one
flag specific in explicit vsx and altivec arm for error.
More information about the Gcc-bugs
mailing list