Repository navigation
Diagnose array designators in initializers of variable-length arrays [GH #556] - #568
lexx42xxel wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
AcknowlEDG review results updated for
|
…[GH edgcpp#556] GNU C++ mode accepts an initializer for a variable-length array, but the lowering of designated initializers assumes that the designated array has a constant size. An array designator in such an initializer (for the VLA itself or for a VLA nested in it) silently lost the designated values, wrote rows past the end of the array, or hit an internal error; range designators hit an internal error as well. g++ does not support these initializers either. Issue an error instead. Designators for arrays of constant size within the initializer, field designators, and designators for arrays of pointers to VLAs are still accepted. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
fd527d7 to
f9a4a66
Compare
|
Rebased onto current Retested after the rebase: rebuilt, and ran all |
|
AcknowlEDG review results updated for
CI success. |
Fixes the problem reported in triage discussion #556.
Problem and fix
GNU C++ mode accepts an initializer for a variable-length array, but the
lowering of designated initializers assumes that the designated array has
a constant size. An array designator in such an initializer (for the VLA
itself or for a VLA nested in it) silently lost the designated values,
wrote rows past the end of the array, or hit an internal error; range
designators hit an internal error as well. g++ does not support these
initializers either. Issue an error instead. Designators for arrays of
constant size within the initializer, field designators, and designators
for arrays of pointers to VLAs are still accepted.
Alternatives considered
Implement designated initialization with run-time indices. Rejected for now: large change for a GNU extension combination that g++ itself rejects ("sorry, unimplemented").
Tests
New:
tests/tests/regressions/vla-array-designator-negative.sft.cpp.Verified failing on main and passing with the fix (IA-64 and non-IA-64 builds); reproducer in the discussion.
Checklist
Commits are tagged
[GH #556]with the discussion number; happy to retag once an issue is opened.[GH #556].src/pending_changes/gh-556-vla-array-designator.txt.edg-docker-test --posture=extensive(edg_x86_64, edg_x86_64_cp, edg_x86_32, edg_x86_32_cp): no regressions; recordings updated with-W.Summary by CodeRabbit