On Fri, Oct 28, 2016 at 09:12:29AM -0600, Jeff Law wrote: > > The PPC port is stumbling over the new integer in boolean context warnings. > > In particular this code from rs6000_option_override_internal is > problematical: > > HOST_WIDE_INT flags = ((TARGET_DEFAULT) ? TARGET_DEFAULT > : > processor_target_table[cpu_index].target_enable); > > The compiler is flagging the (TARGET_DEFAULT) condition. That's > supposed to to be a boolean. > > After all the macro expansions are done it ultimately looks something > like this: > > long flags = (((1L << 7)) ? (1L << 7) > : processor_target_table[cpu_index].target_enable); > > Note the (1L << 7) used as the condition for the ternary. That's what > has the int-in-boolean-context warning tripping. It's a false positive > IMHO.
Yes, there is an implicit conversion to bool here afaics. So can the misfiring warning be fixed instead, please? > diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c > index 5e35e33..38a5226 100644 > --- a/gcc/config/rs6000/rs6000.c > +++ b/gcc/config/rs6000/rs6000.c > @@ -3880,7 +3880,7 @@ rs6000_option_override_internal (bool global_init_p) > > If there is a TARGET_DEFAULT, use that. Otherwise fall back to using > -mcpu=powerpc, -mcpu=powerpc64, or -mcpu=powerpc64le defaults. */ > - HOST_WIDE_INT flags = ((TARGET_DEFAULT) ? TARGET_DEFAULT > + HOST_WIDE_INT flags = ((TARGET_DEFAULT) != 0 ? TARGET_DEFAULT > : processor_target_table[cpu_index].target_enable); > rs6000_isa_flags |= (flags & ~rs6000_isa_flags_explicit); > } Eww. HOST_WIDE_INT flags = TARGET_DEFAULT; if (flags == 0) flags = processor_target_table[cpu_index].target_enable); instead, if you have to do anything? Segher