Repository navigation
Non-IA-64 ABI: wrong pointer freed when initialization of an over-aligned array new throws #552
lexx42xxel
started this conversation in
Issue Triage - Compilation
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 the non-IA-64 ABI,
new A[n]{}of an over-aligned class uses the alignment as the prefix size, but the cleanup run when an element constructor throws freesp - __array_new_prefix_sizeinstead: a bad free (and a leak).Reproducing Source Code
Command-line Options
eccp --c++17 --g++ --exceptions t.cpp -o t && ./t
Type of Issue
[Back End] There is a problem with the generated C code.
Additional Details
Version: EDG C/C++ front end 7.0, main at commit
6a6c7f2d6bd8027f1b0c90877b4ba222fbff6642(2026-11-15).Actual output:
Expected: The pointer returned by operator new[] is freed.
The cleanup for a throwing brace/list initialization must be passed the actual prefix size. IA-64
configurations are not affected.
The program exits nonzero when the bug is present. A fix with a regression
test is ready (branch
fix/noia64-aligned-array-new-eh-prefix); 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).Reproducing (Standard) Configuration(s)
No response
Reproducing (Non-standard) Configuration
Not reproducible with the standard presets (they all use the IA-64 ABI).
Configuration:
linux-gccwith the IA-64 ABI disabled; macro configuration(
cmake/macro-conf/agent-noia64/base.cmakedef, the other.cmakedeffilesjust import
linux-gcc):Full
--dump_configurationoutput of this build:noia64-config.txt
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