Conversation
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.
C file-scope declarations such as
int x; int x;andextern int x; int x;currently receive different variable IDs and separateVariableobjects. This fixes both parts of Trac #6418, including the symbol-database issue noted in comment 2.Reuse the ID in the actual file-scope variable map, then combine C global declarations before assigning symbol pointers. Prefer the initialized/non-extern declaration while preserving linkage flags and previously complete array dimensions. Function parameters, local shadows, record members and C++ declaration identities remain separate.
Two supporting changes prevent regressions exposed by the shared identity: a late static initializer must not restore a constant value after an earlier function write or address escape, and a later unsized array initializer must not shrink a bound provided by an earlier declaration. The resulting analysis finds out-of-bounds accesses both before and after a complete array declaration, while accepting in-bounds accesses with partial initializers.
Preserve each merged declaration's original tokens and storage/initialization flags, and expose them as additive
<declaration>children in the XML dump. The Python parser retains one canonical variable and accepts older dumps. MISRA declaration checks and cross-file summaries use the occurrence metadata, so earlier extern declarations remain visible and declarations are not counted as ordinary uses. Internal and definition summaries retain one object identity.Validation on Windows with Clang 22.1.8 and CMake/Ninja (Debug, PCH disabled, serial build):
-Werror --strict-markers, including four new parser/declaration/CTU cases. Original suppression expectations are unchanged. The CTU reader now closes its input files deterministically.git diff --checkpass. The GCC range-loop warning in the new value-flow test is fixed.f775f03(the helper commit adds only its verification workflow): Ubuntu 22.04/GCC 11.4, standalone-Werrorand-Werror=range-loop-construct, 5,364 native tests with 360 existing TODOs and zero failures; 29 addon tests; 112 dump-parser tests with 3 expected failures; original MISRA CTU and C89/C11 verification. Compiler commands and logs are attached to that run. This is independent validation; the new upstream workflows still require maintainer approval. GUI was not tested in this follow-up.This covers compatible C file-scope redeclarations; it does not implement block-scope extern merging or full declaration compatibility checking.
Please assign this work to KiritoYG if needed and consider it under the published $10 bounty schedule, subject to acceptance and the required ticket closure. Please confirm eligibility and the supported settlement route; GitHub Sponsors is available if accepted. No award or payment is being claimed.