http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57259
Bug ID: 57259 Summary: extra load and store with -fexcess-precision=standard Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: nszabolcs at gmail dot com Target: i686-pc-linux-gnu with -fexcess-precision=standard extra load and store is generated on i386 linux even when it is not needed (the code is correct but does unnecessary work on all optimization levels) in the following example volatile enforces the store of x+y and is correctly compiled with default flags, but with -fexcess-precision=standard a further fstps/flds pair is generated (note that using volatile to force the evaluation of an expression to modify fenv as a side-effect is common idiom in code that uses fenv, such code also needs standard excess-precision handling) $ cat example.c void f(float x, float y) { volatile float z = x+y; } $ gcc-4.8 -S -fno-asynchronous-unwind-tables -fomit-frame-pointer example.c $ cat example.s .file "example.c" .text .globl f .type f, @function f: subl $16, %esp flds 20(%esp) fadds 24(%esp) fstps 12(%esp) addl $16, %esp ret .size f, .-f .ident "GCC: (GNU) 4.8.0" .section .note.GNU-stack,"",@progbits $ gcc-4.8 -S -fno-asynchronous-unwind-tables -fomit-frame-pointer -fexcess-precision=standard example.c $ cat example.s .file "example.c" .text .globl f .type f, @function f: subl $20, %esp flds 24(%esp) flds 28(%esp) faddp %st, %st(1) fstps (%esp) flds (%esp) fstps 16(%esp) addl $20, %esp ret .size f, .-f .ident "GCC: (GNU) 4.8.0" .section .note.GNU-stack,"",@progbits