https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64554
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Richard Biener from comment #6) > (In reply to charles from comment #5) > > No you're right. > > > > I could add, though, that the compiler should have said something. > > > > Also, why did it compile just fine with -O0? > > Sounds like a bug (we should error immediately here IMHO). Probably > needs to annotate the CIF codes with whether this is "fatal" (won't > change with other inlining, IPA or LTO). > > OTOH the headers are also poorly designed to trigger this kind of error. > > Maybe we want to support __attribute__((always_inline("ISA not enabled"))) > instead to be able to print a custom error message? The difference is that for __OPTIMIZE__ _mm_clmulepi64_si128 is implemented as always_inline function (surrounded by #pragma GCC target("pclmul")), so for -O1+ the inlining error is expected, such function can't be inlined into the current function, and always_inline mandates that it is inlined (without always_inline it would simply not be inlined, and the out of line _mm_clmulepi64_si128 would use the pclmul ISA, while the caller would not). For -O0, this is implemented using a macro, since the last argument must be a constant, and the reason you get no error is that the function is const and you don't use the result, so it is DCEd. If you actually use the result (at -O0 it is enough to store it into say __m128i c = _mm_clmulepi64_si128(a, b, 1); , for -O1 you'd need something better, store into volatile var, or global var or otherwise make sure it isn't DCEd), then you get this diagnosed: /tmp/z.c: In function ‘main’: /tmp/z.c:6:11: error: ‘__builtin_ia32_pclmulqdq128’ needs isa option -m32 -mpclmul __m128i c = _mm_clmulepi64_si128(a, b, 1); ^ So I don't see any bug on the gcc side here.