www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9466] New: Line number dependent bug of coverage

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

           Summary: Line number dependent bug of coverage
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Windows
            Status: NEW
          Keywords: ice
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: kekeniro2 yahoo.co.jp


--- Comment #0 from kekeniro2 yahoo.co.jp 2013-02-06 18:26:47 PST ---
Created an attachment (id=1183)
reduced test case

DMD crashes when compile the attaced source files with -cov switch.
They are reduced, but have many many blank lines to keep line number.

Environment:
Windows7 64-bit ( Non -m64 )

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 06 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9466



--- Comment #1 from kekeniro2 yahoo.co.jp 2013-02-06 18:33:13 PST ---
DMD crashes but its process is alive.
DMD 2.058 or older, seems to go silently into loop.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 06 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9466


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-02-06
18:40:50 PST ---
It crashes in Module::genobjfile, in this call:

free(covb);

covb is allocated via:

covb = (unsigned *)calloc((numlines + 32) / 32, sizeof(*covb));

I would sure like to understand the meaning of this magical expression. Why is
it dividing by 32? Another case of premature optimization?

If you replace that with:

covb = (unsigned *)calloc(numlines, sizeof(*covb));

Then it works fine.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 06 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9466


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
         AssignedTo|nobody puremagic.com        |andrej.mitrovich gmail.com
           Severity|normal                      |major


--- Comment #3 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-02-08
11:06:51 PST ---
https://github.com/D-Programming-Language/dmd/pull/1647

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 08 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9466



--- Comment #4 from Kenji Hara <k.hara.pg gmail.com> 2013-02-09 02:51:55 PST ---
Created an attachment (id=1184)
More reduced test case

If move the code line `int dummy = 0;` in cb.i from line 161 to 160, segfault
disappeared. The line number depends on minimum allocation size of calloc(). As
far as I see, currently it allocates at least 20 bytes (20 * 8 == 160 bit).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 09 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9466


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|pull                        |
         AssignedTo|andrej.mitrovich gmail.com  |nobody puremagic.com


--- Comment #5 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-02-09
06:10:46 PST ---
The pull was invalid, I'll let others handle this one.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 09 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9466



--- Comment #6 from kekeniro2 yahoo.co.jp 2013-05-21 20:50:42 PDT ---
Probably this is a duplicate of Issue 9353.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 21 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9466


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com


--- Comment #7 from Walter Bright <bugzilla digitalmars.com> 2013-05-21
22:53:23 PDT ---
(In reply to comment #2)
 covb is allocated via:
 
 covb = (unsigned *)calloc((numlines + 32) / 32, sizeof(*covb));
 
 I would sure like to understand the meaning of this magical expression. Why is
 it dividing by 32? Another case of premature optimization?

covb is a bit vector, it must have numlines bits in it. Since unsigned's are 32 bits wide, it rounds it up to the number of 32 bit unsigned's to allocate. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 21 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9466


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME


--- Comment #8 from Walter Bright <bugzilla digitalmars.com> 2013-10-01
23:21:13 PDT ---
Can't duplicate any problem with 2.064 head, although it does fail with 2.063.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 01 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9466


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WORKSFORME                  |


--- Comment #9 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-10-02
05:54:36 PDT ---
(In reply to comment #8)
 Can't duplicate any problem with 2.064 head, although it does fail with 2.063.

I can reproduce it with git-head. Have you made sure to compile with: dmd.exe -cov -c cb.d -J. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 02 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9466



--- Comment #10 from kekeniro2 yahoo.co.jp 2013-10-02 07:29:35 PDT ---
I made a DMD.exe of 2.063.2 by the _tuned_ DMC. (Memory allocation improvement
ver.) 
It does _not_ reproduce the bug ... why?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 02 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9466



--- Comment #11 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-10-02
08:03:03 PDT ---
(In reply to comment #10)
 I made a DMD.exe of 2.063.2 by the _tuned_ DMC. (Memory allocation improvement
 ver.) 
 It does _not_ reproduce the bug ... why?

Which tuned DMC? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 02 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9466



--- Comment #12 from kekeniro2 yahoo.co.jp 2013-10-02 08:19:52 PDT ---
(In reply to comment #11)
 (In reply to comment #10)
 I made a DMD.exe of 2.063.2 by the _tuned_ DMC. (Memory allocation improvement
 ver.) 
 It does _not_ reproduce the bug ... why?

Which tuned DMC?

I mean DMC 8.57 and new snn.lib, which came in August. DMC 8.57 http://forum.dlang.org/thread/ktenl9$1e68$1 digitalmars.com snn.lib http://forum.dlang.org/thread/ktju8h$efb$1 digitalmars.com -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 02 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9466



--- Comment #13 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-10-02
08:27:19 PDT ---
(In reply to comment #12)
 (In reply to comment #11)
 (In reply to comment #10)
 I made a DMD.exe of 2.063.2 by the _tuned_ DMC. (Memory allocation improvement
 ver.) 
 It does _not_ reproduce the bug ... why?

Which tuned DMC?

I mean DMC 8.57 and new snn.lib, which came in August. DMC 8.57 http://forum.dlang.org/thread/ktenl9$1e68$1 digitalmars.com snn.lib http://forum.dlang.org/thread/ktju8h$efb$1 digitalmars.com

I still get a crash with these when using with both 2.063.2 and 2.064. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 02 2013