Add minimal syntactic support for type _Float16#525
Merged
xavierleroy merged 1 commit intomasterfrom Oct 22, 2024
Merged
Conversation
_Float16, _Float32 and _Float64_Float16
Contributor
Author
|
A first cut of this PR also added |
This is part of C23 appendix H, and is starting to be used in system header files. `_Float16` is kept as a distinct FP type during elaboration, then rejected during conversion to CompCert C. The verified part of CompCert is unchanged.
m-schmidt
reviewed
Oct 21, 2024
Contributor
Author
|
Thanks for the feedback and testing. Merging! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Appendix H of ISO C 2023 makes provisions for built-in binary floating-point types
_FloatN, where N is the bit size of the type.Some C compilers and math libraries already make use of type
_Float16to denote half-precision FP numbers. That's the case for XCode 16 on macOS 15, which declares_Float16functions in<math.h>without guarding them with a#ifdef, e.g.With the current CompCert, any C source code that includes
<math.h>causes a syntax error on these declarations.This PR proposes to add minimal syntactic support for type
_Float16. It is kept as a distinct FP type during elaboration, then rejected during conversion to CompCert C. This way,_Float16functions declared in header files but not used in the C source file are silently ignored. If these functions are used, an "unsupported feature" error is reported.The verified part of CompCert is unchanged.