On Tue, 14 Mar 2017, Richard Biener wrote: > On Tue, 14 Mar 2017, Martin Liška wrote: > > > > /tmp/gcov-1.gcno: block > > 2:`/home/marxin/Programming/gcc/gcc/testsuite/gcc.misc-tests/gcov-1.c':10, > > 14 > > /tmp/gcov-1.gcno: block > > 4:`/home/marxin/Programming/gcc/gcc/testsuite/gcc.misc-tests/gcov-1.c':14 > > > > where blocks 2 and 4 are: > > > > <bb 2> [0.00%]: > > i_3 = 0; > > goto <bb 4>; [0.00%] > > > > ... > > > > <bb 4> [0.00%]: > > # i_1 = PHI <i_3(2), i_7(3)> > > if (i_1 <= 9) > > goto <bb 3>; [0.00%] > > else > > goto <bb 5>; [0.00%] > > > > The same happens to int a = b < 1 ? (c < 3 ? d : c) : a; > > > > /tmp/gcov2.gcno: block 2:`/tmp/gcov2.c':1, 3 > > > > <bb 2> [0.00%]: > > if (b_3(D) <= 0) > > goto <bb 3>; [0.00%] > > else > > goto <bb 7>; [0.00%] > > > > That showed a caching of locations actually magically handles loops and > > ternary operations. > > I'm still wondering how should be defined line count for a multiple > > statements happening > > on the line? Having that we can find a proper solution. > > It should be number of times the line is _entered_, that is, lineno > changed from something != lineno to lineno. Consider > > foo (); goto baz; lab: bar (); // line 1 > baz: > goto lab; > > should increment line 1 when entering to foo () as well as when > entering through goto lab. but both times just once.
Of course with -a you are supposed to get sub-line accuracy for these cases, but then you'll get not a single number per line (and not sure how you can reasonably interpret -a info without column info or so). Richard. > Richard. > > > > Martin > > > > > > > > for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) > > > { > > > gimple *stmt = gsi_stmt (gsi); > > > if (!RESERVED_LOCATION_P (gimple_location (stmt))) > > > output_location (gimple_filename (stmt), gimple_lineno > > > (stmt), > > > &offset, bb); > > > > > > should use expand_location and then look at the spelling location, > > > otherwise we'll get interesting effects with macro expansion? > > > > > > } > > > > > > Richard. > > > > > >> Martin > > >> > > >> > > >>> > > >>> Richard. > > >>> > > >>>> Martin > > >>>> > > >>>>> > > >>>>>> Martin > > >>>>>> > > >>>>>>> > > >>>>>>> > > >>>>>>>> Martin > > >>>>>>>> > > >>>>>>>>> > > >>>>>>>>> Richard. > > >>>>>>>>> > > >>>>>>>>> > > >>>>>>>>>> Hope Nathan will find time to provide review as he's familiar > > >>>>>>>>>> with content of gcov.c. > > >>>>>>>>>> > > >>>>>>>>>> Martin > > >>>>>>>>>> > > >>>>>>>>>>> > > >>>>>>>>>>> OTOH I don't know much about gcov format. > > >>>>>>>>>>> > > >>>>>>>>>>> Richard. > > >>>>>>>>>>> > > >>>>>>>>>>>> Martin > > >>>>>>>>>>>> > > >>>>>>>>>>>>> > > >>>>>>>>>>>>> Richard. > > >>>>>>>>>>>>> > > >>>>>>>>>>>>>> Martin > > >>>>>>>>>>>>>> > > >>>>>>>>>>>>>>> > > >>>>>>>>>>>>>>> Richard. > > >>>>>>>>>>>>>>> > > >>>>>>>>>>>>>> > > >>>>>>>>>>>>>> > > >>>>>>>>>>>>> > > >>>>>>>>>>>> > > >>>>>>>>>>>> > > >>>>>>>>>>> > > >>>>>>>>>> > > >>>>>>>>>> > > >>>>>>>>> > > >>>>>>>> > > >>>>>>>> > > >>>>>>> > > >>>>>> > > >>>>>> > > >>>>> > > >>>> > > >>>> > > >>> > > >> > > >> > > > > > > > > > -- Richard Biener <rguent...@suse.de> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)