Skip to content

goto-cc: fix dead -fsingle-precision-constant query - #9050

Open
tautschnig wants to merge 1 commit into
diffblue:developfrom
tautschnig:extract/ansi-c-fms-anon-members
Open

goto-cc: fix dead -fsingle-precision-constant query#9050
tautschnig wants to merge 1 commit into
diffblue:developfrom
tautschnig:extract/ansi-c-fms-anon-members

Conversation

@tautschnig

@tautschnigtautschnig commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

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 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.

  • 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.

@tautschnigtautschnig self-assigned this Jun 18, 2026
CopilotAI review requested due to automatic review settings June 18, 2026 15:48

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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_extensions config flag (default false) and reset it in configt::set.
  • Enable the flag when -fms-extensions is passed through goto-gcc.
  • Extend compound member typechecking to accept tagged anonymous struct/union members only when ms_extensions is 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
FileDescription
src/util/config.hAdds ansi_c.ms_extensions configuration flag.
src/util/config.cppInitializes/resets ansi_c.ms_extensions during configt::set.
src/goto-cc/gcc_mode.cppParses -fms-extensions and maps it to config.ansi_c.ms_extensions.
src/ansi-c/c_typecheck_type.cppImplements conditional acceptance of tagged anonymous struct/union members.
regression/goto-gcc/ms_extensions_anonymous_member/test.descAdds a regression test driver for the new behavior.
regression/goto-gcc/ms_extensions_anonymous_member/main.cAdds a regression C file asserting layout and injected member access.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadsrc/goto-cc/gcc_mode.cpp Outdated
Comment threadregression/goto-gcc/ms_extensions_anonymous_member/main.c Outdated
Comment threadregression/goto-gcc/ms_extensions_anonymous_member/main.c Outdated
Comment threadsrc/goto-cc/gcc_mode.cpp Outdated
@codecov

codecovBot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.72%. Comparing base (17ab9f4) to head (51e6e0c).
⚠️ Report is 2 commits behind head on develop.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tautschnig

tautschnig commented Jun 18, 2026

Copy link
Copy Markdown
CollaboratorAuthor

We'll have to consider whether to take this one or #9022. Edit: picked #9022 with slight updates.

@tautschnig
tautschnigforce-pushed the extract/ansi-c-fms-anon-members branch from ae1b3ef to 8a14ea8CompareJune 18, 2026 18:42
@tautschnigtautschnig changed the title ansi-c: support -fms-extensions anonymous tagged struct/union membersgoto-cc: fix dead -fsingle-precision-constant queryJun 24, 2026
@tautschnig
tautschnigforce-pushed the extract/ansi-c-fms-anon-members branch from 8a14ea8 to 63c056eCompareJune 24, 2026 11:25
@tautschnig
tautschnigforce-pushed the extract/ansi-c-fms-anon-members branch 2 times, most recently from c2b8455 to 1827cbeCompareJune 25, 2026 08:40
@tautschnig
tautschnig requested a review from a team as a code ownerJune 25, 2026 08:40
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 `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>
@tautschnig
tautschnigforce-pushed the extract/ansi-c-fms-anon-members branch from 1827cbe to 51e6e0cCompareJune 30, 2026 06:49
@kroeningkroening assigned tautschnig and unassigned kroeningJul 6, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@tautschnig@kroening