Don't leave the FPOptions in a UnaryOperator uninitialized.

We don't appear to use these FPOptions for anything right now, but
they shouldn't be uninitialized because that makes our AST file output
nondeterministic.
This commit is contained in:
Richard Smith 2020-08-16 15:15:16 -07:00
parent de71b46a51
commit 9860e68450
2 changed files with 20 additions and 0 deletions

View File

@ -4569,6 +4569,8 @@ UnaryOperator::UnaryOperator(const ASTContext &Ctx, Expr *input, Opcode opc,
UnaryOperatorBits.CanOverflow = CanOverflow;
UnaryOperatorBits.Loc = l;
UnaryOperatorBits.HasFPFeatures = FPFeatures.requiresTrailingStorage();
if (hasStoredFPFeatures())
setStoredFPFeatures(FPFeatures);
setDependence(computeDependence(this));
}

View File

@ -0,0 +1,18 @@
// RUN: rm -rf %t
// RUN: mkdir %t
// RUN: %clang_cc1 -x c++-header %s -emit-pch -o %t/a.pch
// RUN: %clang_cc1 -x c++-header %s -emit-pch -o %t/b.pch
// RUN: cmp %t/a.pch %t/b.pch
#pragma float_control(push)
double fp_control_1(double x) {
#pragma float_control(precise, on)
return -x + x;
}
double fp_control_2(double x) {
#pragma float_control(precise, off)
return -x + x;
}
#pragma float_control(pop)