https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104439
Bug ID: 104439 Summary: arm crc feature not enabled in assembly for function with crc target attribute Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: ebiggers3 at gmail dot com Target Milestone: --- Minimized reproducer: void some_other_function(void) { } unsigned int __attribute__((target("arch=armv8-a+crc"))) crc32_arm(unsigned int crc, const unsigned char *data, unsigned long size) { for (unsigned long i = 0; i < size; i++) crc = __builtin_arm_crc32b(crc, data[i]); return crc; } #pragma GCC push_options #pragma GCC pop_options $ arm-linux-gnueabihf-gcc -c test.c /tmp/ccCUwib8.s: Assembler messages: /tmp/ccCUwib8.s:58: Error: selected processor does not support `crc32b r3,r3,r2' in ARM mode $ arm-linux-gnueabihf-gcc --version arm-linux-gnueabihf-gcc (GCC) 11.2.0 The crc32_arm() function is compiled with crc instructions enabled, and gcc is emitting assembly code using them. However, gcc isn't emitting the directives that tell the assembler to allow these instructions. The problem goes away if either some_other_function() is deleted, or if the "GCC push_options" and "GCC pop_options" pair is deleted. I don't see any logical reason why either change would make a difference. (The original, non-minimized code this problem was seen on can be found at https://github.com/ebiggers/libdeflate/blob/v1.9/lib/arm/crc32_impl.h#L75.)