Skip to content

ActOnPragmaFloatControl() restores last fp eval method from a different location than where it was saved #56802

@mrwalker61

Description

@mrwalker61

See clang/lib/Sema/SemaAttr.cpp.

Here PP.setLastFPEvalMethod(PP.getCurrentFPEvalMethod()) saves the eval method (case PFC_NoPrecise).

PP.setCurrentFPEvalMethod(SourceLocation(), CurFPFeatures.getFPEvalMethod()) restores the eval method (case PFC_Pop).

Should it not be restored like PP.setCurrentFPEvalMethod(SourceLocation(), PP.getLastFPEvalMethod())?

Compiling a C++ snippet that did #include <numeric> (from MSVC 14, as distributed with Microsoft Visual Studio 2022) with a newly built Clang 15 produced an outpour of warnings (32-bit x86 build without SSE enabled). This was caused by the initial value 2 for the fp eval method suddenly changing to 0, an illegal value on the platform. Debugging the issue I can see the value 2 is not restored in this code, in effect just set back to a default (0), but this is not even the correct default on x86 (which is 2).

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions