Re: [PATCH 1/3] Release structures on function return

2024-06-26 Thread Jørgen Kvalsvik

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, vec> exprs;
to
 hash_map, auto_vec> 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





Re: [Linaro-TCWG-CI] gcc-15-8947-g8ed2d5d219e: 5 regressions on master-thumb_m23_soft_eabi

2025-03-28 Thread Jørgen Kvalsvik

On 3/28/25 14:44, Christophe Lyon wrote:

Hi,

On Fri, 28 Mar 2025 at 14:24,  wrote:


Dear contributor,

Our automatic CI has detected problems related to your patch(es). Please find 
some details below.

In  arm-eabi cortex-m23 soft, after:
   | commit gcc-15-8947-g8ed2d5d219e
   | Author: Jørgen Kvalsvik 
   | Date:   Tue Jun 4 14:13:22 2024 +0200
   |
   | Add prime path coverage to gcc/gcov
   |
   | This patch adds prime path coverage to gcc/gcov. First, a quick
   | introduction to path coverage, before I explain a bit on the pieces of
   | the patch.
   | ... 404 lines of the commit log omitted.

Produces 5 regressions:
   |
   | regressions.sum:
   | Running g++:g++.dg/gcov/gcov.exp ...
   | FAIL: g++.dg/gcov/gcov-22.C -std=gnu++17  gcov failed: spawn failed
   | FAIL: g++.dg/gcov/gcov-22.C -std=gnu++26  gcov failed: spawn failed
   | FAIL: g++.dg/gcov/gcov-22.C -std=gnu++98  gcov failed: spawn failed
   | Running gcc:gcc.misc-tests/gcov.exp ...
   | ... and 2 more



I've given a quick look at the logs, and gcov-22.C says:
spawn -ignore SIGHUP
/home/tcwg-buildslave/workspace/tcwg_gnu_0/abe/builds/destdir/x86_64-pc-linux-gnu/bin/gcov
--prime-paths gcov-22.C
FAIL: g++.dg/gcov/gcov-22.C  -std=gnu++98  gcov failed: spawn failed

I believe that rather than "dg-compile", it should use "dg-do run {
target native }" like almost all other gcov tests?


Not necessarily -- the functions in this file is a distillation of the 
odd CFGs and functions that caused gnarly and unexpected errors, usually 
ICEs. There is no main() and some of the functions are infinite loops. 
We get enough information by simply compiling.





For the other errors:
FAIL: gcc.misc-tests/gcov-31.c (test for excess errors)
FAIL: gcc.misc-tests/gcov-32.c (test for excess errors)
the log actually says:
/gcov-31.c:12:8: error: unknown type name 'sigjmp_buf'; did you mean 'jmp_buf'?
/gcov-31.c: In function 'run_pending_traps':
/gcov-31.c:22:5: error: implicit declaration of function '__sigsetjmp'
[-Wimplicit-function-declaration]

/gcov-32.c:6:8: error: unknown type name 'sigjmp_buf'; did you mean 'jmp_buf'?
/gcov-32.c:21:19: error: passing argument 1 of 'setjmp' makes pointer
from integer without a cast [-Wint-conversion]

I haven't looked further, but does this indicate a dependency on
glibc? (this target "arm-none-eabi" uses newlib)



Looks like it. This is only partially intentional -- the tests are 
cleaned examples from real programs (bash, check) which use sigjmp_buf. 
The bash case (gcov-31.c) uses __sigsetjmp and surely has a glibc 
dependency, but gcov-32.c could maybe be tuned to use jmp_buf. I don't 
know if that will preserve the failure mode however, and the root of the 
problem was fixed when the test was added.


Looks like Dimitar Dimitrov (CC) already addressed the failure.

commit 1c5c57092cf23ac6eae139627d2406f67fe3303b
Author: Dimitar Dimitrov 
Date:   Thu Mar 27 20:31:17 2025 +0200

testsuite: Require effective target sigsetjmp for gcov-31/32




Thanks,

Christophe


Used configuration :
  *CI config* tcwg_gnu_embed_check_gcc arm-eabi -mthumb -march=armv8-m.base 
-mtune=cortex-m23 -mfloat-abi=soft -mfpu=auto
  *configure and test flags:* --target arm-eabi --disable-multilib 
--with-mode=thumb --with-cpu=cortex-m23 --with-float=soft 
--target_board=-mthumb/-march=armv8-m.base/-mtune=cortex-m23/-mfloat-abi=soft/-mfpu=auto
 qemu_cpu=cortex-m33

We track this bug report under https://linaro.atlassian.net/browse/GNU-1551. 
Please let us know if you have a fix.

If you have any questions regarding this report, please ask on 
linaro-toolch...@lists.linaro.org mailing list.

-8<--8<--8<--

The information below contains the details of the failures, and the ways to 
reproduce a debug environment:

You can find the failure logs in *.log.1.xz files in
  * 
https://ci.linaro.org/job/tcwg_gnu_embed_check_gcc--master-thumb_m23_soft_eabi-build/312/artifact/artifacts/00-sumfiles/
The full lists of regressions and improvements as well as configure and make 
commands are in
  * 
https://ci.linaro.org/job/tcwg_gnu_embed_check_gcc--master-thumb_m23_soft_eabi-build/312/artifact/artifacts/notify/
The list of [ignored] baseline and flaky failures are in
  * 
https://ci.linaro.org/job/tcwg_gnu_embed_check_gcc--master-thumb_m23_soft_eabi-build/312/artifact/artifacts/sumfiles/xfails.xfail

Current build   : 
https://ci.linaro.org/job/tcwg_gnu_embed_check_gcc--master-thumb_m23_soft_eabi-build/312/artifact/artifacts
Reference build : 
https://ci.linaro.org/job/tcwg_gnu_embed_check_gcc--master-thumb_m23_soft_eabi-build/311/artifact/artifacts

Instruction to reproduce the build : 
https://git-us.linaro.org/toolchain/ci/interesting-commits.git/plain/gcc/sha1/8ed2d5d219e999aee42015a0db38612011c2c507/tcwg_gnu_e