https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115713

--- Comment #1 from Kewen Lin <linkw at gcc dot gnu.org> ---
There IS a warning for:

long __attribute__ ((target ("vsx,no-altivec")))
foo1 (void)
{
  return 0;
}

, interesting. :)

It's due to that we enable altivec when parsing vsx in target attribute, but
don't consider if it's explicit set, so the fix can be:

diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 76bbb3a28ea..4638c34cc24 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -24638,8 +24638,11 @@ rs6000_inner_target_options (tree args, bool attr_p)
                           {
                             if (mask == OPTION_MASK_VSX)
                               {
-                                mask |= OPTION_MASK_ALTIVEC;
-                                TARGET_AVOID_XFORM = 0;
+                                if (!(rs6000_isa_flags_explicit
+                                      & OPTION_MASK_ALTIVEC))
+                                  mask |= OPTION_MASK_ALTIVEC;
+                                if (!OPTION_SET_P (TARGET_AVOID_XFORM))
+                                  TARGET_AVOID_XFORM = 0;
                               }
                           }

Reply via email to