Hi Eike On December 4, 2017 10:22 PM, Eike Rathke wrote: > From what I understood by browsing shortly gcc enables > this by default for -std=gnu* and it can be unset by > #pragma STDC FP_CONTRACT OFF > [...] > Could you try if adding the pragma to include/sal/config.h > helps?
I gave it a try but GCC didn't appreciate it and threw warnings back at me: include/sal/config.h:100:0: warning: ignoring #pragma STDC FP_CONTRACT [-Wunknown-pragmas] I didn't let the compilation finish since in light of the warning I expect the outcome to be the same as without pragma. (If you think otherwise, let me know then I'll invest a couple of hours into the compilation.) The GCC version used was 6.4.0 but GCC 5 shows the same behaviour. Sadly, I currently have no GCC 7 at my disposal to test if that version supports the STDC FP_CONTRACT pragma (but I don't think it does). I took the liberty to google around a little. Here is what I've found: The GCC manual [0] (for version 6.4 but also for version 7.2) states: | Whether and how floating expressions are contracted when | not disallowed by the FP_CONTRACT pragma (C99 and C11 6.5). | | Expressions are currently only contracted if | -ffp-contract=fast, -funsafe-math-optimizations or | -ffast-math are used. This is subject to change. The C99 status page of GCC[1] reads: | standard pragmas: Not implemented. Associated command-line | options to control the state of the pragmas for the whole | translation unit are available. which hint to me that instead of the pragma we should use the command line option -ffp-contract. There is also GCC bug #37845 "gcc ignores FP_CONTRACT pragma set to OFF". The last entry is: | [...] | Note: This bug was about FP contraction being done despite | the use of: | #pragma STDC FP_CONTRACT OFF | not about the pragma being ignored (the implementation of | this pragma is not required by the ISO C standard if the | default is OFF, which is now the case with GCC). So, this | bug is really fixed. A new enhancement bug could be opened | (if not already done) for the implementation of the STDC | FP_CONTRACT pragma. So GCC does not recognize the pragma and its "default" behaviour is "FP_CONTRACT=OFF". However, GCC enables FP_CONTRACT as soon as -O2 (or higher) is enabled and the target hardware supports it. LLVM/clang seems to understand the pragma FP_CONTRACT, though [3,4] Best Milton [0] https://gcc.gnu.org/onlinedocs/gcc-6.4.0/gcc/Floating-point-implementation.html [1] https://gcc.gnu.org/c99status.html [2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37845 [3] https://reviews.llvm.org/D24481 [4] https://github.com/llvm-mirror/clang/blob/master/test/Preprocessor/pragma_unknown.c _______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice