Add minimal syntactic support for type _Float16
#525
Merged
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
_Float
N, where N is the bit size of the type.Some C compilers and math libraries already make use of type
_Float16
to denote half-precision FP numbers. That's the case for XCode 16 on macOS 15, which declares_Float16
functions 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,_Float16
functions 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.