This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Fwd: Segmentation fault at gcov exit
- From: Miguel Munoz <miguiman at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Fri, 20 Oct 2017 09:55:04 +0200
- Subject: Fwd: Segmentation fault at gcov exit
- Authentication-results: sourceware.org; auth=none
- References: <CAA3pFtkTYwO0QW_Qt5wE7MD3yx9LMzJS1OcG16=zAVbZ1k8nCw@mail.gmail.com> <f521ad7f-9787-fd35-fad8-f7b675f79242@free.fr> <CAA3pFtk4BGZZPqE5wQvC4J1p2tsvAzhSiLq1-T1xYvhhgq_KxQ@mail.gmail.com>
I found the problem. It was an issue with my code. I was writing out
of an array's boudaries, with the bad luck of overwriting some
internal gcov data.
Thanks anyway.
Miguel
2017-10-19 18:07 GMT+02:00 Mason <slash.tmp@free.fr>:
> On 19/10/2017 17:29, Miguel Munoz wrote:
>
>> I'm running a C program using gcov and I get a segmentation fault when
>> gcov is dumping the results at the end of the execution. The program
>> exits correctly when compiled without coverage.
>>
>> The problem appears when one of the files contains a function call to
>> an extern function defined in another file. If I comment this call, no
>> SIGSEGV occurs. If I leave the call and compile without coverage, the
>> SIGSEGV also disappears.
>>
>> I'm compiling with the options: -O0 -g -fprofile-arcs -ftest-coverage.
>> Adding -Wall -Wextra doesn't show anything suspicious.
>>
>> Could you help me debugging this error? The backtrace doesn't give me
>> any source file or line number inside the gcov code, and I don't know
>> how to investigate the problem further.
>
> I cannot reproduce your issue with a trivial test case.
>
> $ cat main.c
> extern int foo(void);
> int main(void) { return foo(); }
> $ cat foo.c
> int foo(void) { return 0; }
> $ gcc-7 -O0 -g -fprofile-arcs -ftest-coverage foo.c main.c
> $ ./a.out
> $ echo $?
> 0
>
>
> If you provide a reproducible test case, some people might be able
> to help.
>
> Regards.