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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Nov 9 04:20:54 PST 2012


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

           Summary: The PVS-Studio analyzer has something for you
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: karpov at viva64.com


--- Comment #0 from Andrey Karpov <karpov at viva64.com> 2012-11-09 04:20:53 PST ---
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.

---------------------

V522 Dereferencing of the null pointer 'v' might take place. interpret.c 1711

Expression *getVarExp(Loc loc, InterState *istate, Declaration *d, CtfeGoal
goal)
{
  ....
  VarDeclaration *v = d->isVarDeclaration();
  if (v)
  {
    ....
  }
  else if (s)
  {
    if (s->dsym->toInitializer() == s->sym)
      ....
    else
      error(loc,
            "cannot interpret symbol %s at compile time",
            v->toChars());
  }
  ....
}
---------------------
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, ....);
---------------------
V612 An unconditional 'return' within a loop. cgxmm.c 825

code *cdvector(elem *e, regm_t *pretregs)
{
  ....
  code *c = CNIL;
  for (int i = 0; i < n; i++)
  {
    c = cat(c, codelem(params[i], pretregs, FALSE));
    *pretregs = 0;      // in case they got set
    return c;
  }
  ....
}

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