Uh oh!
There was an error while loading. Please reload this page.
goto-cc: fix dead -fsingle-precision-constant query - #9050
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds support for MS-style extensions needed to correctly typecheck and lay out tagged anonymous struct/union members (e.g., Linux kernel patterns) when compiling in GCC/Clang mode with -fms-extensions.
Changes:
- Introduce a new
ansi_c.ms_extensionsconfig flag (defaultfalse) and reset it inconfigt::set. - Enable the flag when
-fms-extensionsis passed throughgoto-gcc. - Extend compound member typechecking to accept tagged anonymous struct/union members only when
ms_extensionsis enabled, and add a regression test validating layout + member injection.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/util/config.h | Adds ansi_c.ms_extensions configuration flag. |
| src/util/config.cpp | Initializes/resets ansi_c.ms_extensions during configt::set. |
| src/goto-cc/gcc_mode.cpp | Parses -fms-extensions and maps it to config.ansi_c.ms_extensions. |
| src/ansi-c/c_typecheck_type.cpp | Implements conditional acceptance of tagged anonymous struct/union members. |
| regression/goto-gcc/ms_extensions_anonymous_member/test.desc | Adds a regression test driver for the new behavior. |
| regression/goto-gcc/ms_extensions_anonymous_member/main.c | Adds a regression C file asserting layout and injected member access. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@## develop #9050 +/- ##
========================================
Coverage 80.72% 80.72% ========================================
Files 1714 1714 Lines 189915 189915 Branches 73 73 ========================================
+ Hits 153311 153313 +2 + Misses 36604 36602 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ae1b3ef to
8a14ea8Compare8a14ea8 to
63c056eComparec2b8455 to
1827cbeComparegoto_cc_cmdlinet stores long options with a single leading '-' stripped,
so the existing isset("-fsingle-precision-constant") (with the dash)
never matched and the option was silently dead. Query it as
"fsingle-precision-constant", consistent with the other -f options.
Add regression/goto-gcc/fsingle_precision_constant, which compiles with
-fsingle-precision-constant and checks via _Static_assert that an
unsuffixed floating-point constant is `float` rather than `double`.
Before this fix the flag was ignored, the constant stayed `double`, and
the assertion (hence conversion) failed -- so the test fails without the
fix.
Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>1827cbe to
51e6e0cCompare
goto_cc_cmdlinet stores long options with a single leading '-' stripped, so the existing isset("-fsingle-precision-constant") (with the dash) never matched and the option was silently dead. Query it as "fsingle-precision-constant", consistent with the other -f options.
Add regression/goto-gcc/fsingle_precision_constant, which compiles with -fsingle-precision-constant and checks via _Static_assert that an unsuffixed floating-point constant is
floatrather thandouble. Before this fix the flag was ignored, the constant stayeddouble, and the assertion (hence conversion) failed -- so the test fails without the fix.