<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/56802>56802</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            ActOnPragmaFloatControl() restores last fp eval method from a different location than where it was saved
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          mrwalker61
      </td>
    </tr>
</table>

<pre>
    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>` (MSVC 14) 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).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVVNuO0zAQ_ZrkZUSVOG1pHvKwZLcCiUulIl6RL9PErGNHvmzZv2ecbhdYgRBSlIs9c-bMmRMLpx67IyJIw-1QsL3Rgu5HnPjT4yZGv5LzvCqq26K6udzfokcottXhsAoY3_MQ94e7B24-YBydKtiONgaMffIe7cu9grX52lYQ-AMGiCMCUgBMSwRQiOQB4bDvv350B49SB6SM3xg8F_9zjaNLXuJ7J3nUzl6L9kDR-8MeeUweQ6b4V260H53_B72Dm18SO44uGQU6gnURBF6BFBh9_4to_8f7oucfhH4mXDT7X2n0bpq10XYADn3B3tAFwep5xkgd8QhKq0ymYI220iRF1Jrepgm9lkVzlyUg-A_HLz3UayoBZx1HArN4No8gkjYR-mwaqDcwe6eSpB65BZfiTF2AOwGcubfEIWSohr0SpMr33XbJVgsgBcPxeAdouTCospjwedSBMgNIngJhisdlBtrqqGkM1H1CYHByflk_zb-NJySl0BJFORK5LEB0UGUNiZs2BodnDGcXgNnwSGDTCm5RpOGSkwuGQEHviIaFQL9IXrsWJ4Z5vM-z1RmKFqVTmGvRN55OKCN8SyFSOlmBy_vMhYPCE08kH4lSPc1XpHgBeALGB7yQk45sQjDXHOKcFaTU86jlmONZVq3Ert5u2qplLduWqmtU27S8jDoa7G5k_GQPng8T3xvHY-9s9M5c7PPT6Ybs9VLOk3dTpqypm-xXME_ezC6ycB7zSUBjzfPKv7MqkzfdGOMciuaGzhC6Bhp0EivppnzAmIfr4xXZ5hs1R5-L1oFeNttdxcqxa5VoudqJWtYb_lrWbCsVY5wJXjdc7nal4QJN6IoNWZuRKS_jovdic1vqjlWMVa9ZW9fVbr1ZqUqJNVeybUS7ljtRrCs627RZZR4r54fSdwslMkCgTaNDDD83eQh6sIhLOcLnicTx3eTP3Nyj39blUr1b2P8ApSO_RA">