https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68499

            Bug ID: 68499
           Summary: Unclear STDC FP_CONTRACT behavior in non-standard
                    modes
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vincent-gcc at vinc17 dot net
  Target Milestone: ---

Created attachment 36807
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36807&action=edit
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.

Reply via email to