www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5848] New: Coverage always report 0000000 for inlined function

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5848

           Summary: Coverage always report 0000000 for inlined function
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: kennytm gmail.com



When a function is inlined, the coverage result will not consider it was
called, and always report the coverage count as 0000000.

For example, the program:

int inlined(int p, int q) {
    return p+q;
}
void main() {
    inlined(1, 3);
}

without -inline, the coverage result is

       |int inlined(int p, int q) {
      1|    return p+q;
       |}
       |void main() {
      1|    inlined(1, 3);
       |}
x.d is 100% covered

with -inline, the 'inlined' function becomes uncovered

       |int inlined(int p, int q) {
0000000|    return p+q;
       |}
       |void main() {
      1|    inlined(1, 3);
       |}
x.d is 50% covered

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 16 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5848


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc



What kind of textual output do you desire in this situation?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 16 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5848





 What kind of textual output do you desire in this situation?
What do you mean? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 16 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5848






 What kind of textual output do you desire in this situation?
What do you mean?
What coverage results textual file do you want DMD to save on disk about that inlined() function when you compile the program with the -inline switch too? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 16 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5848







 What kind of textual output do you desire in this situation?
What do you mean?
What coverage results textual file do you want DMD to save on disk about that inlined() function when you compile the program with the -inline switch too?
Ideally that line should display "1", like the 2nd piece of code I've shown in the first post. The coverage percent should be 100%, not 50%. Why would one expect to get 0000000 when a line of code is used? If it's not possible to get an exact count, at least it should show something other than 0000000, and count that line as covered. In gcov the equivalent program shows '1' in the corresponding line even with maximum optimization (-O3). So avoiding 0000000 in most of the cases should be possible. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 17 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5848


SomeDude <lovelydear mailmetrash.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lovelydear mailmetrash.com



PDT ---
With dmd 2.059:

PS E:\DigitalMars\dmd2\samples> rdmd -cov bug
PS E:\DigitalMars\dmd2\samples> cat bug.lst
       |//import std.stdio, std.range, std.algorithm, std.string;
       |
       |import std.stdio;
       |
       |int inlined(int p, int q) {
      1|    return p+q;
       |}
       |void main() {
      1|    inlined(1, 3);
       |}
bug.d is 100% covered
PS E:\DigitalMars\dmd2\samples>

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 23 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5848





 With dmd 2.059:
 
 PS E:\DigitalMars\dmd2\samples> rdmd -cov bug
 PS E:\DigitalMars\dmd2\samples> cat bug.lst
        |//import std.stdio, std.range, std.algorithm, std.string;
        |
        |import std.stdio;
        |
        |int inlined(int p, int q) {
       1|    return p+q;
        |}
        |void main() {
       1|    inlined(1, 3);
        |}
 bug.d is 100% covered
 PS E:\DigitalMars\dmd2\samples>
Please make sure you have the '-inline' flag. Test with 'dmd', not 'rdmd'. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 23 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5848




PDT ---


 Please make sure you have the '-inline' flag. Test with 'dmd', not 'rdmd'.
OK, with -inline I get the same result you got. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 23 2012