Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C/C++ front-end: accept all floating-point extensions that GCC and Clang support #8169

Merged
merged 1 commit into from
Mar 12, 2024

Conversation

tautschnig
Copy link
Collaborator

Testing with Compiler Explorer showed that Clang supports a subset of GCC's extensions, and GCC also supports some more extensions that what we previously covered.

  • Each commit message has a non-empty body, explaining why the change was made.
  • n/a Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

@@ -217,10 +217,13 @@ hexfloat1 "0"[xX]{hexdigit}*"."{hexdigit}+[pP][+-]?{integer}
hexfloat2 "0"[xX]{hexdigit}*"."[pP][+-]?{integer}
hexfloat3 "0"[xX]{hexdigit}*[pP][+-]?{integer}
float_suffix [fFlLiIjJ]*
gcc_ext_float_suffix [wWqQ]|[dD][fFdDlL]?|"f16"|"f32"|"f64"|"f128"|"f32x"|"f64x"|"f128x"
clang_ext_float_suffix [qQ]|"f16"|"F16"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe these are standardised in the C++ standards; e.g., bf16 is C++23. They are not clang extensions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GCC and Clang support these at varying versions, and while the standard appears to specify them I wasn't able to make them work when using -std=c++23 (Clang) or /std:c++latest (MSVC).

@tautschnig tautschnig force-pushed the bugfixes/float-extensions branch from 36f9d99 to 39da677 Compare January 25, 2024 11:51
Copy link

codecov bot commented Jan 25, 2024

Codecov Report

Attention: 26 lines in your changes are missing coverage. Please review.

Comparison is base (2d1c1a3) 79.68% compared to head (4735bf5) 79.69%.
Report is 2 commits behind head on develop.

❗ Current head 4735bf5 differs from pull request most recent head bf1159f. Consider uploading reports for the commit bf1159f to get more accurate results

Files Patch % Lines
src/cpp/cpp_typecheck.cpp 47.82% 12 Missing ⚠️
src/ansi-c/scanner.l 50.00% 6 Missing ⚠️
src/ansi-c/ansi_c_internal_additions.cpp 37.50% 5 Missing ⚠️
src/ansi-c/gcc_version.cpp 66.66% 2 Missing ⚠️
src/cpp/cpp_parser.cpp 90.90% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #8169   +/-   ##
========================================
  Coverage    79.68%   79.69%           
========================================
  Files         1681     1680    -1     
  Lines       195297   195294    -3     
========================================
+ Hits        155625   155630    +5     
+ Misses       39672    39664    -8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tautschnig tautschnig force-pushed the bugfixes/float-extensions branch from 39da677 to f27ca35 Compare January 25, 2024 12:40
@tautschnig
Copy link
Collaborator Author

tautschnig commented Jan 25, 2024

I have inserted a TODO in the regression test, and would really like to get #8133 merged first so as to properly address the TODO in the test. Edit: #8133 has been merged and this PR has been updated.

@tautschnig tautschnig force-pushed the bugfixes/float-extensions branch from f27ca35 to e1f6f9a Compare February 1, 2024 10:55
@tautschnig tautschnig requested a review from a team as a code owner February 1, 2024 10:55
@tautschnig tautschnig force-pushed the bugfixes/float-extensions branch from e1f6f9a to 5867ffc Compare February 1, 2024 11:54
@tautschnig tautschnig self-assigned this Feb 1, 2024
@tautschnig tautschnig force-pushed the bugfixes/float-extensions branch 2 times, most recently from 4735bf5 to b7a7e38 Compare February 5, 2024 20:06
…ang support

Testing with Compiler Explorer showed that Clang supports a subset of
GCC's extensions, and GCC also supports some more extensions than what
we previously covered.
@tautschnig tautschnig force-pushed the bugfixes/float-extensions branch from b7a7e38 to bf1159f Compare February 5, 2024 21:55
@tautschnig tautschnig removed their assignment Feb 6, 2024
@peterschrammel peterschrammel removed their assignment Mar 12, 2024
@tautschnig tautschnig merged commit 689c552 into diffblue:develop Mar 12, 2024
36 of 37 checks passed
@tautschnig tautschnig deleted the bugfixes/float-extensions branch March 12, 2024 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants