On 09/30/2016 10:56 AM, James Greenhalgh wrote:
Hi,
This option is added to control which values of FLT_EVAL_METHOD the
compiler is allowed to set.
ISO/IEC TS 18661-3 defines new permissible values for
FLT_EVAL_METHOD that indicate that operations and constants with
a semantic type that is an interchange or extended format should be
evaluated to the precision and range of that type. These new values are
a superset of those permitted under C99/C11, which does not specify the
meaning of other positive values of FLT_EVAL_METHOD. As such, code
conforming to C11 may not have been written expecting the possibility of
the new values.
-fpermitted-flt-eval-methods specifies whether the compiler
should allow only the values of FLT_EVAL_METHOD specified in C99/C11,
or the extended set of values specified in ISO/IEC TS 18661-3.
The two possible values this option can take are "c11" or "ts-18661-3".
The default when in a standards compliant mode (-std=c11 or similar)
is -fpermitted-flt-eval-methods=c11. The default when in a GNU
dialect (-std=gnu11 or similar) is -fpermitted-flt-eval-methods=ts-18661-3.
I've added two testcases which test that when this option, or a C standards
dialect, would restrict the range of values to {-1, 0, 1, 2}, those are
the only values we see. At this stage in the patch series this trivially
holds for all targets.
Bootstrapped on x86_64 with no issues and tested in series on AArch64.
OK?
Thanks,
James
---
gcc/c-family/
2016-09-30 James Greenhalgh <james.greenha...@arm.com>
* c-opts.c (c_common_post_options): Add logic to handle the default
case for -fpermitted-flt-eval-methods.
gcc/
2016-09-30 James Greenhalgh <james.greenha...@arm.com>
* common.opt (fpermitted-flt-eval-methods): New.
* doc/invoke.texi (-fpermitted-flt-eval-methods): Document it.
* flag_types.h (permitted_flt_eval_methods): New.
gcc/testsuite/
2016-09-30 James Greenhalgh <james.greenha...@arm.com>
* gcc.dg/fpermitted-flt-eval-methods_1.c: New.
* gcc.dg/fpermitted-flt-eval-methods_2.c: New.
OK. Are you going to need to do something for C++ (or gasp ObjC) in
the future, or do you expect this to be C only indefinitely?
jeff