[Issue 1530] New: Aliasing problem in DMD front end code

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Sep 23 10:39:53 PDT 2007


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

           Summary: Aliasing problem in DMD front end code
           Product: D
           Version: 2.004
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: dvdfrdmn at users.sf.net


The following code in Parser::parseDeclarator does not follow C++ aliasing
rules(?).  It will malfunction when compiled by g++ 4.1.2.

  TypeNext *ta = new TypeFunction(arguments, t, varargs, linkage);
  TypeNext **pt;
  for (pt = (TypeNext **)&ts; *pt != t; pt = (TypeNext **)&(*pt)->next)
    ;
  *pt = ta;

Suggest:

  Type *ta = new TypeFunction(arguments, t, varargs, linkage);
  Type **pt;
  for (pt = &ts; *pt != t; pt = &((TypeNext*)*pt)->next)
    ;
  *pt = ta;


-- 



More information about the Digitalmars-d-bugs mailing list