-Ofast -Ofast忽略严格的标准合规性. -Ofast启用所有-O3优化.它也是 启用对所有符合标准的程序均无效的优化.它打开 -ffast-math和特定于Fortran的-fno-protect-parens和-fstack-arrays.Disregard strict standards compliance. -Ofast enables all -O3 optimizations. It also enables optimizations that are not valid for all standard-compliant programs. It turns on -ffast-math and the Fortran-specific -fno-protect-parens and -fstack-arrays.和 -快速数学 -ffast-math设置-fno-math-errno,-funsafe-math优化, -fno-trapping-math,-fno-only-math,-fno-rounding-math,-fno-signaling-nans和fcx-limited-range.Sets -fno-math-errno, -funsafe-math-optimizations, -fno-trapping-math, -ffinite-math-only, -fno-rounding-math, -fno-signaling-nans and fcx-limited-range.和 -仅有限个数 -ffinite-math-only允许对假定参数和的浮点算法进行优化 结果不是NaN或+ -Infs.Allow optimizations for floating-point arithmetic that assume that arguments and results are not NaNs or +-Infs.有几个针对此标记为无效的gcc错误报告.There are several gcc bug reports for this marked invalid. -ffast-math和isnan问题此外,严格的IEEE浮点数比较始终会导致错误.Additionally, comparison of strict IEEE floating points always results in false. 检查是否为double(或float) C ++中的NaN这不一定适用于-ffast-math,但可以解释您显示的内容.This doesn't necessarily apply for -ffast-math but it explains what you show. gcc并未描述有关-ffast-math浮点数工作方式的正式标准,因此,如果必须且不假定gcc版本之间的一致性,则只需凭经验确定细节.更好的是,完全避免使用NaN和-ffast-math的组合.gcc does not describe a formal standard for how -ffast-math floats work so you'll just have to work out the details empirically if you must and not assume consistency between versions of gcc. Better yet, completely avoid the combination of NaN and -ffast-math. 这篇关于gcc -Ofast-限制的完整列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
05-29 08:53
查看更多