www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1530] New: Aliasing problem in DMD front end code

reply d-bugmail puremagic.com writes:
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 digitalmars.com
        ReportedBy: dvdfrdmn 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;


-- 
Sep 23 2007
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1530


braddr puremagic.com changed:

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





Fixed in 1.022/2.005 (though only listed in the 2.005 change log currently)


-- 
Oct 20 2007