https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115688
--- Comment #4 from Peter Bergner <bergner at gcc dot gnu.org> --- (In reply to Kewen Lin from comment #2) > // 32 bit has altivec_abi unset, so that's why it doesn't ICE at -m64. Ah yes, that does explain the difference between 32-bit and 64-bit! ...and that means it ICEs for 64-bit as well, both BE and LE with the following options: bergner@ltcden2-lp1:ICE$ gcc -S -m64 -O2 -mcpu=power5 -mabi=no-altivec bug.c bug.c:3:1: internal compiler error: in rs6000_option_override_internal, at config/rs6000/rs6000.cc:3952 3 | { | ^ 0x11e4f7a7 rs6000_option_override_internal /home/bergner/gcc/gcc-fsf-mainline-rop/gcc/config/rs6000/rs6000.cc:3952 0x11eb7f13 rs6000_valid_attribute_p /home/bergner/gcc/gcc-fsf-mainline-rop/gcc/config/rs6000/rs6000.cc:24809 0x10aace97 handle_target_attribute /home/bergner/gcc/gcc-fsf-mainline-rop/gcc/c-family/c-attribs.cc:5915 > diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc > index cd14e5a34ed..a8a3b79dda0 100644 > --- a/gcc/config/rs6000/rs6000.cc > +++ b/gcc/config/rs6000/rs6000.cc > @@ -3925,8 +3925,12 @@ rs6000_option_override_internal (bool global_init_p) > not for 32-bit. Don't move this before the above code using > ignore_masks, > since it can reset the cleared VSX/ALTIVEC flag again. */ > if (main_target_opt && !main_target_opt->x_rs6000_altivec_abi) > - rs6000_isa_flags &= ~((OPTION_MASK_VSX | OPTION_MASK_ALTIVEC) > - & ~rs6000_isa_flags_explicit); > + { > + rs6000_isa_flags &= ~(OPTION_MASK_VSX & ~rs6000_isa_flags_explicit); Given this... > + /* Don't mask off ALTIVEC if it is enabled by an explicit VSX. */ > + if (!TARGET_VSX || !(rs6000_isa_flags_explicit & OPTION_MASK_VSX)) TARGET_VSX is only true here if it was explictly used, so I think you can drop the "|| !(rs6000_isa_flags_explicit & OPTION_MASK_VSX)" part of this test. That said, how does your patch handle the following test case? long __attribute__ ((target ("no-altivec,vsx"))) foo (void) { return 0; } ...currently, this compiles with with no error or warning message which seems wrong to me.