public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Problem with counting code coverage lines - return statement
@ 2021-09-21 14:14 Sara Graovac
  2021-10-04  7:30 ` Sara Graovac
  0 siblings, 1 reply; 3+ messages in thread
From: Sara Graovac @ 2021-09-21 14:14 UTC (permalink / raw)
  To: gcc-help

[-- Attachment #1: Type: text/plain, Size: 1000 bytes --]


Hi,

We use your tool gcov, exactly lcov, for code coverage. It is important to us.
We find a problem with counting lines, when in return statement call the
other function and the arguments of the function are on two lines, because of alignment.

Sometimes it counts only first line, sometimes it counts both lines.
In my current project first line is counted 109 times, the second one is counted 14 times.

I send you the example of return statement, please see attachment.

I tried to find where the problem is.
Can you help me to fix it?

Kind regards,
Sara Graovac
Contactor Syrmia
Software Engineer
Virtualization

Office:
Djordja Stanojevica 12
11070 Belgrade, Serbia
Phone: +(381)-21-4831-210
E-mail: sara.graovac@amd.com<mailto:sara.graovac@amd.com>
               sara.graovac@syrmia.com<mailto:sara.graovac@syrmia.com>

Headquarters:
Syrmia LLC @ Belgrade Office Park
Djordja Stanojevica 12,
11070 Belgrade, Serbia
www.syrmia.com<http://www.syrmia.com/>


[-- Attachment #2: return_example.cpp --]
[-- Type: text/plain, Size: 626 bytes --]

#include  <iostream>

using namespace std;

int f1(const char *name, const char *surname, uint32_t ages,
        const char *curr_addr){
        
        return ages;
}

int f2(bool val){
        const char *name = "Mary";
        const char *surname = "Connor";
        const char *addr = "123 Main St, Apartment 2 New York, NY 11111";
        if(val){
                return -1;
        }else{
                return f1(name, surname, 42,
                                addr);
        }
}

int main(){
        int ret = 0;
        ret = f2(false);
        cout << ret << endl;
        return 0;
}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: Problem with counting code coverage lines - return statement
  2021-09-21 14:14 Problem with counting code coverage lines - return statement Sara Graovac
@ 2021-10-04  7:30 ` Sara Graovac
  2021-10-04 15:20   ` Dan Kegel
  0 siblings, 1 reply; 3+ messages in thread
From: Sara Graovac @ 2021-10-04  7:30 UTC (permalink / raw)
  To: gcc-help

Hi,

Do you have time to look at this?

Best regards,
Sara Graovac

From: Sara Graovac
Sent: 21 September, 2021 16:15
To: gcc-help@gcc.gnu.org
Subject: Problem with counting code coverage lines - return statement


Hi,

We use your tool gcov, exactly lcov, for code coverage. It is important to us.
We find a problem with counting lines, when in return statement call the
other function and the arguments of the function are on two lines, because of alignment.

Sometimes it counts only first line, sometimes it counts both lines.
In my current project first line is counted 109 times, the second one is counted 14 times.

I send you the example of return statement, please see attachment.

I tried to find where the problem is.
Can you help me to fix it?

Kind regards,
Sara Graovac
Contactor Syrmia
Software Engineer
Virtualization

Office:
Djordja Stanojevica 12
11070 Belgrade, Serbia
Phone: +(381)-21-4831-210
E-mail: sara.graovac@amd.com<mailto:sara.graovac@amd.com>
               sara.graovac@syrmia.com<mailto:sara.graovac@syrmia.com>

Headquarters:
Syrmia LLC @ Belgrade Office Park
Djordja Stanojevica 12,
11070 Belgrade, Serbia
www.syrmia.com<http://www.syrmia.com/>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problem with counting code coverage lines - return statement
  2021-10-04  7:30 ` Sara Graovac
@ 2021-10-04 15:20   ` Dan Kegel
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Kegel @ 2021-10-04 15:20 UTC (permalink / raw)
  To: Sara Graovac; +Cc: gcc-help

I suspect it may have to do with optimization, does it persist at -O1 or
-O0?

See https://gcc.gnu.org/onlinedocs/gcc/Gcov-and-Optimization.html
- Dan

Sara Graovac <Sara.Graovac@syrmia.com> schrieb am Mo., 4. Okt. 2021, 00:31:

> Hi,
>
> Do you have time to look at this?
>
> Best regards,
> Sara Graovac
>
> From: Sara Graovac
> Sent: 21 September, 2021 16:15
> To: gcc-help@gcc.gnu.org
> Subject: Problem with counting code coverage lines - return statement
>
>
> Hi,
>
> We use your tool gcov, exactly lcov, for code coverage. It is important to
> us.
> We find a problem with counting lines, when in return statement call the
> other function and the arguments of the function are on two lines, because
> of alignment.
>
> Sometimes it counts only first line, sometimes it counts both lines.
> In my current project first line is counted 109 times, the second one is
> counted 14 times.
>
> I send you the example of return statement, please see attachment.
>
> I tried to find where the problem is.
> Can you help me to fix it?
>
> Kind regards,
> Sara Graovac
> Contactor Syrmia
> Software Engineer
> Virtualization
>
> Office:
> Djordja Stanojevica 12
> 11070 Belgrade, Serbia
> Phone: +(381)-21-4831-210
> E-mail: sara.graovac@amd.com<mailto:sara.graovac@amd.com>
>                sara.graovac@syrmia.com<mailto:sara.graovac@syrmia.com>
>
> Headquarters:
> Syrmia LLC @ Belgrade Office Park
> Djordja Stanojevica 12,
> 11070 Belgrade, Serbia
> www.syrmia.com<http://www.syrmia.com/>
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-04 15:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-21 14:14 Problem with counting code coverage lines - return statement Sara Graovac
2021-10-04  7:30 ` Sara Graovac
2021-10-04 15:20   ` Dan Kegel

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).