From: "Jørgen Kvalsvik" <j@lambda.is>
To: Jan Hubicka <hubicka@ucw.cz>
Cc: gcc-patches@gcc.gnu.org, linaro-toolchain@lists.linaro.org,
gcc-regression@gcc.gnu.org
Subject: Re: [PATCH 1/3] Release structures on function return
Date: Thu, 27 Jun 2024 08:26:29 +0200 [thread overview]
Message-ID: <2e695e9e-27ab-46c9-bdeb-4a532f36170e@lambda.is> (raw)
In-Reply-To: <ZnqahTtCsc5GaA01@kam.mff.cuni.cz>
I think we need to revert this.
I got this email from linaro/gcc-regressions:
[Linaro-TCWG-CI] gcc-15-1649-g19f630e6ae8d: FAIL: 2 regressions on aarch64
regressions.sum:
=== gcc tests ===
Running gcc:gcc.misc-tests/gcov.exp ...
FAIL: gcc.misc-tests/gcov-23.c (internal compiler error: in operator[],
at vec.h:910)
FAIL: gcc.misc-tests/gcov-23.c (test for excess errors)
This did not reproduce on my machine, but I took a quick look at the
hash-map implementation. hash_map.put calls
hash_table.find_slot_with_hash, which calls hash_table.expand, which
does move+destroy. auto_vec is not really move-aware which leads to a
double-free.
The fix is either to make auto_vec move-aware (and more like C++'s
std::vector) or revert this patch and apply the original version with an
explicit release.
OK?
Thanks,
Jørgen
On 6/25/24 12:23, Jan Hubicka wrote:
>> The value vec objects are destroyed on exit, but release still needs to
>> be called explicitly.
>>
>> gcc/ChangeLog:
>>
>> * tree-profile.cc (find_conditions): Release vectors before
>> return.
> I wonder if you turn
> hash_map<int_hash<unsigned, 0>, vec<basic_block>> exprs;
> to
> hash_map<int_hash<unsigned, 0>, auto_vec<basic_block>> exprs;
> Won't hash_map destructor take care of this by itself?
>
> Honza
>> ---
>> gcc/tree-profile.cc | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/gcc/tree-profile.cc b/gcc/tree-profile.cc
>> index e4bb689cef5..18f48e8d04e 100644
>> --- a/gcc/tree-profile.cc
>> +++ b/gcc/tree-profile.cc
>> @@ -919,6 +919,9 @@ find_conditions (struct function *fn)
>> if (!have_post_dom)
>> free_dominance_info (fn, CDI_POST_DOMINATORS);
>>
>> + for (auto expr : exprs)
>> + expr.second.release ();
>> +
>> cov->m_masks.safe_grow_cleared (2 * cov->m_index.last ());
>> const size_t length = cov_length (cov);
>> for (size_t i = 0; i != length; i++)
>> --
>> 2.39.2
>>
next prev parent reply other threads:[~2024-06-27 6:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-25 8:03 [PATCH 0/3] Condition coverage docs, bugfix Jørgen Kvalsvik
2024-06-25 8:03 ` [PATCH 1/3] Release structures on function return Jørgen Kvalsvik
2024-06-25 10:23 ` Jan Hubicka
2024-06-25 10:37 ` Jørgen Kvalsvik
2024-06-26 10:20 ` Jørgen Kvalsvik
2024-06-27 6:26 ` Jørgen Kvalsvik [this message]
2024-06-25 8:03 ` [PATCH 2/3] Add section on MC/DC in gcov manual Jørgen Kvalsvik
2024-06-25 10:23 ` Jan Hubicka
2024-06-26 10:21 ` Jørgen Kvalsvik
2024-06-25 8:03 ` [PATCH 3/3] Use the term MC/DC in help for gcov --conditions Jørgen Kvalsvik
2024-06-25 10:25 ` Jan Hubicka
2024-06-25 10:42 ` Jørgen Kvalsvik
2024-06-26 10:21 ` Jørgen Kvalsvik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2e695e9e-27ab-46c9-bdeb-4a532f36170e@lambda.is \
--to=j@lambda.is \
--cc=gcc-patches@gcc.gnu.org \
--cc=gcc-regression@gcc.gnu.org \
--cc=hubicka@ucw.cz \
--cc=linaro-toolchain@lists.linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).