Package: gcc-6 Version: 6.3.0-18+deb9u GCC produces incorrect code for the following program. The C11 standard requires (§ F.8.5) that the floating point exception flag is set by the following code, yet the generated assembly does not set it. These results are for an x86-64 system running Debian 9.
The interaction is: “““ $ gcc -W -Wall -S -std=c11 -O3 -march=native -masm=intel -fverbose-asm test.c test.c:2:0: warning: ignoring #pragma STDC FENV_ACCESS [-Wunknown-pragmas] #pragma STDC FENV_ACCESS ON test.c: In function ‘main’: test.c:11:9: warning: unused variable ‘x’ [-Wunused-variable] float x = 0.0 / 0.0; ^ ””” The file “test.c” is: “““ #include <fenv.h> #pragma STDC FENV_ACCESS ON #if !defined(__STDC_IEC_559__) #error "Requires IEC 60559 compliance" #endif int f(); int main(void) { float x = 0.0 / 0.0; f(); return 0; } ””” The output file “test.s” is (excluding comments) is: “““ .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "Hello world!" .section .text.startup,"ax",@progbits .p2align 4,,15 .globl main .type main, @function main: .LFB5: .cfi_startproc sub rsp, 8 #, .cfi_def_cfa_offset 16 xor eax, eax # call f@PLT # lea rdi, .LC0[rip] #, xor eax, eax # call printf@PLT # xor eax, eax # add rsp, 8 #, .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE5: .size main, .-main .ident "GCC: (Debian 6.3.0-18+deb9u1) 6.3.0 20170516" .section .note.GNU-stack,"",@progbits ”””