https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101773

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING

--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Vincent Lefèvre from comment #4)
> GCOV_EXIT_AT_ERROR is not documented in the man page.

But we document that in GCC user manual.

> 
> Anyway, it doesn't seem to work:
> 
> $ export GCOV_EXIT_AT_ERROR=1
> $ printenv GCOV_EXIT_AT_ERROR
> 1
> $ gcc-test -O -fprofile-generate=dir tst.c
> $ ./a.out
> $ echo $?
> 0
> $ ls -l dir/*.gcda
> -rw-r--r-- 1 vlefevre vlefevre 0 2021-08-04 14:48:01
> dir/#home#vlefevre#a-tst.gcda

It works for me:

$ gcc --version
gcc (GCC) 12.0.0 20210804 (experimental)

$ df -h /tmp/ramdisk
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           4.0K  4.0K     0 100% /tmp/ramdisk

$ g++ ~/Programming/tramp3d/tramp3d-v4.ii -fprofile-generate=/tmp/ramdisk
$ GCOV_EXIT_AT_ERROR=1 ./a.out -n 0
...
libgcov profiling
error:/tmp/ramdisk/#home#marxin#Programming#testcases#a-tramp3d-v4.gcda:Error
writing
profiling:exiting after an error
$ echo $?
1

$ ./a.out -n 0
...
libgcov profiling
error:/tmp/ramdisk/#home#marxin#Programming#testcases#a-tramp3d-v4.gcda:Error
writing
echo $?
0

Reply via email to