[clang] [FPEnv] Add strictfp in some C++ constructors lacking a FunctionDecl. (PR #74883)

John McCall via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 22 10:16:47 PST 2024


https://github.com/rjmccall requested changes to this pull request.

I'm sorry for failing to notice this in my previous review, but I don't think this patch is right.  A global initializer should be FP-constrained based on whether the variable is defined in an FP-constrained context.  This is testing whether the outermost level of the initializer is a call to an FP-constrained constructor.  That means that we will not treat the initializer as FP constrained if it's not of class type or if it calls a non-FP-constrained constructor but passes arguments that require FP-constrained code emission.  (It will also be wrong if the expression requires temporaries, because then the expression will not be directly a `CXXConstructExpr`.)

If we don't currently capture in the AST whether a global variable definition is in an FP-constrained context, that seems like something we should fix.

https://github.com/llvm/llvm-project/pull/74883


More information about the cfe-commits mailing list