Repository navigation
Without exceptions, = {} does not zero a VLA of a class with a destructor
#559
lexx42xxel
started this conversation in
Issue Triage - Compilation
Replies: 2 comments
|
Found while implementing #561 (static/preallocated array construction without the allocating vector runtime). |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Issue Summary
With
--no_exceptions,D a[n] = {};for a class with a destructor leaves the elements uninitialized; with a pointer-to-data-member element, zeroing gives the wrong null value (not all-bits-zero in the IA-64 ABI).Reproducing Source Code
Command-line Options
eccp --c++11 --g++ --no_exceptions t.cpp -o t && ./t
Type of Issue
[Back End] There is a problem with the generated C code.
Additional Details
No response
Reproducing (Standard) Configuration(s)
linux-gcc-debug
Reproducing (Non-standard) Configuration
Version: EDG C/C++ front end 7.0, main at commit
6a6c7f2d6bd8027f1b0c90877b4ba222fbff6642(2026-11-15).Actual output:
Expected: sum of value-initialized elements: 0
The lowering keeps the constant part of the initializer and leaves zeroing to the back end, which
did nothing when no constant part was kept. Depends on the fix for #558 (VLAs with variable-length
rows).
The program exits nonzero when the bug is present. A fix with a regression
test is ready (branch
fix/vla-array-init-lowering); a PR will reference this issue.AddressSanitizer
AddressSanitizer detects the same bug in this variant, which has no counters or output of its own:
Report on main (6a6c7f2), addresses elided:
No report with the fix, nor with g++ (
-fsanitize=address).I acknowledge that:
LICENSE.txtfile in my.zipor.tar.gzupload. If I included aLICENSE.txtfile, any tests created using the reproducing source code will be governed by the terms of the license I provided instead.All reactions