Bug 68499 - Unclear STDC FP_CONTRACT behavior in non-standard modes
Summary: Unclear STDC FP_CONTRACT behavior in non-standard modes
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 6.0
: P3 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-23 12:18 UTC by Vincent Lefèvre
Modified: 2019-06-26 05:33 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
example of C program based on the STDC FP_CONTRACT pragma (651 bytes, text/x-csrc)
2015-11-23 12:18 UTC, Vincent Lefèvre
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vincent Lefèvre 2015-11-23 12:18:14 UTC
Created attachment 36807 [details]
example of C program based on the STDC FP_CONTRACT pragma

The following applies to:
gcc (Debian 20151030-1) 6.0.0 20151031 (experimental) [trunk revision 229615]

When I compile a C program like the attached one with

#pragma STDC FP_CONTRACT OFF

in a standard mode, the pragma is now taken into account as expected (see PR37845 / r204460). However, in a non-standard mode such as the default gnu99 (?), it is not taken into account (a FMA is generated for an operation like x*y+z), but one gets no warnings either. One should have one of the following behaviors in non-standard modes:

1. The pragma is taken into account.

2. The pragma is not taken into account, but one gets a warning (making it unknown in non-standard modes is OK).

If possible, (1) is probably the best choice, at least in gnu99 and gnu11 modes, as the user may want to disable contraction for some floating-point algorithms while still being able to use specific GNU extensions.
Comment 1 Vincent Lefèvre 2015-11-23 12:36:11 UTC
Well, actually the pragma is ignored in all cases. The fix was to set the default to OFF in the standard modes. So, currently, one should get a warning in non-standard modes.
Comment 2 jsm-csl@polyomino.org.uk 2015-11-23 13:08:50 UTC
Unknown pragmas are diagnosed with -Wunknown-pragmas (part of -Wall).
Comment 3 Vincent Lefèvre 2015-11-23 14:43:15 UTC
Sorry, I forgot that I had an alias gcc='gcc -Wall', so that I got a warning for gcc, but not for gcc-snapshot. I've now changed by config to define such an alias for each GCC command found in $PATH.

I'm closing this bug since nothing has changed concerning the warnings compared to old GCC versions.