This is an archive of the discontinued LLVM Phabricator instance.

Solve PR49479, File scope fp pragma should propagate to functions nested in struct, and initialization expressions
ClosedPublic

Authored by mibintc on Mar 8 2021, 12:13 PM.

Details

Summary

Currently, the CurFPFeatures state is set to command line settings before semantic analysis of the nested member functions and initialization expressions, that's not correct. This patch fixes that.

Diff Detail

Event Timeline

mibintc requested review of this revision.Mar 8 2021, 12:13 PM
mibintc created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptMar 8 2021, 12:13 PM
mibintc added inline comments.Mar 8 2021, 12:15 PM
clang/lib/Parse/ParseDeclCXX.cpp
3419

I remember worrying about this issue when I wrote the initial patch but I can't remember what my thinking was in putting this in. Nobody remarked about its presence or absence as far as I have found. Now that I read over the #pragma float_control in the C standard it seems clear that it should apply to these expressions. And why would the command line options take effect but not the pragma, doesn't make sense.

clang/test/CodeGen/fp-floatcontrol-stack.cpp
241

this is the test case from the bug report

erichkeane accepted this revision.Mar 11 2021, 6:24 AM

The description of the problem, and hte patch and tests seem to make sense, so I think this should be ok. Please give some of the others a little bit of time before committing to speak their final bit, but LGTM .

This revision is now accepted and ready to land.Mar 11 2021, 6:24 AM
aaron.ballman accepted this revision.Mar 11 2021, 6:42 AM

LGTM as well, but feel free to give the other reviewers a chance to weigh in.