[Bug middle-end/116065] [13/14/15 Regression] Function attribute optimize() might make ISA target attribute broken

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jul 24 11:28:53 GMT 2024


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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
"Reduced":

#ifndef __AVX__
#pragma GCC push_options
#pragma GCC target("avx")
#define __DISABLE_AVX__
#endif /* __AVX__ */

extern inline double __attribute__((__gnu_inline__,__always_inline__))
     foo (double x) { return x; }

#ifdef __DISABLE_AVX__
#undef __DISABLE_AVX__
#pragma GCC pop_options
#endif /* __DISABLE_AVX__ */

void __attribute__((target ("avx"), optimize(3)))
bar (double *p)
{
  *p = foo (*p);
}

works with -mavx _or_ with -O[23], fails without.  Fails(!?) with -O1
as well.

So it's somehow the interaction between optimize and target.

Somebody needs to sit down and trace differences between -O2 and -O1
for example.


More information about the Gcc-bugs mailing list