From ae500e4d0964adea69372d083416b0f13e9a87eb Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Sun, 16 Aug 2020 15:44:51 -0700 Subject: [PATCH] Always keep unset fields in FPOptionsOverride zeroed. There are three fields that the FPOptions default constructor sets to non-zero values; those fields previously could have been zero or non-zero depending on whether they'd been explicitly removed from the FPOptionsOverride set. However, that doesn't seem to ever actually happen, so this is NFC, except that it makes the AST file representation of FPOptionsOverride make more sense. --- clang/include/clang/Basic/LangOptions.h | 2 +- clang/test/PCH/determinism.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/clang/include/clang/Basic/LangOptions.h b/clang/include/clang/Basic/LangOptions.h index 31e8af4..f1601aa 100644 --- a/clang/include/clang/Basic/LangOptions.h +++ b/clang/include/clang/Basic/LangOptions.h @@ -475,7 +475,7 @@ public: /// The is implemented as a value of the new FPOptions plus a mask showing which /// fields are actually set in it. class FPOptionsOverride { - FPOptions Options; + FPOptions Options = FPOptions(0); FPOptions::storage_type OverrideMask = 0; public: diff --git a/clang/test/PCH/determinism.cpp b/clang/test/PCH/determinism.cpp index 540088e..ea52971 100644 --- a/clang/test/PCH/determinism.cpp +++ b/clang/test/PCH/determinism.cpp @@ -6,6 +6,10 @@ // RUN: cmp %t/a.pch %t/b.pch #pragma float_control(push) +double fp_control_0(double x) { + return -x + x; +} + double fp_control_1(double x) { #pragma float_control(precise, on) return -x + x; -- 2.7.4