[Issue 8986] The PVS-Studio analyzer has something for you

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Nov 9 04:47:24 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8986


bearophile_hugs at eml.cc changed:

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


--- Comment #1 from bearophile_hugs at eml.cc 2012-11-09 04:47:20 PST ---
(In reply to comment #0)

> Perhaps there are other errors. I have studied the report unthoughtful. The
> report can be viewed by downloading the PVS-Studio trial version of the
> analyzer. I think trial version will be enough.

Thank you for your valuable work Andrey, we read often your articles linked and
discussed on Reddit. PVS-Studio seems a interesting tool.

D language itself (and not its compilers) is designed to help D programmers
avoid or remove many of the bugs found by PVS-Studio, see as example:
http://d.puremagic.com/issues/show_bug.cgi?id=5409
So in a sense D makes tools like PVS-Studio less necessary.


> V519 The 'c2' variable is assigned values twice successively. Perhaps this is a
> mistake. Check lines: 1860, 1861. cod2.c 1861
> 
> code *cdcond(elem *e,regm_t *pretregs)
> {
>   code *cc,*c,*c1,*cnop1,*c2,*cnop2;
>   ....
>   c2 = codelem(e22,&retregs,FALSE);
>   c2 = cat(c1, fixresult(e22,retregs,pretregs));
>   ....
> }
> 
> Most likely this is what should be written here: c2 = cat(c2, ....);

That's a bug in the C++ code. Maybe it's possible to add a warning inside the D
compiler to guard against similar bugs in D code.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list