> On Mar 20, 2023, at 6:25 PM, Jakub Jelinek <ja...@redhat.com> wrote: > > On Mon, Mar 20, 2023 at 10:05:57PM +0000, Qing Zhao via Gcc-patches wrote: >> My question: is the above section the place in C standard “explicitly allows >> contractions”? If not, where it is in C standard? > > http://port70.net/%7Ensz/c/c99/n1256.html#6.5p8 > http://port70.net/%7Ensz/c/c99/n1256.html#note78
78) This license is specifically intended to allow implementations to exploit fast machine instructions that combine multiple C operators. As contractions potentially undermine predictability, and can even decrease accuracy for containing expressions, their use needs to be well-defined and clearly documented. Looks like that the C99 standard clearly warned that the fp-contract might “undermine predictability”, “can even decrease accuracy” at the same time to allow it. Should we also provide such warning in our gcc documentation for -fp-contract (currently, there is no such warning): https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#Optimize-Options " -ffp-contract=style -ffp-contract=off disables floating-point expression contraction. -ffp-contract=fast enables floating-point expression contraction such as forming of fused multiply-add operations if the target has native support for them. -ffp-contract=on enables floating-point expression contraction if allowed by the language standard. This is currently not implemented and treated equal to -ffp-contract=off. The default is -ffp-contract=fast.” Most of the compiler users are not familiar with language standards, or no access to language standards. Without clearly documenting such warnings along with the option explicitly, the users have not way to know such potential impact. They will be confused with the result they see and raise the same questions to GCC community again and again. thanks. Qing > http://port70.net/%7Ensz/c/c99/n1256.html#F.6 > > Jakub >