Thread overview
[Issue 2232] New: DMD generates invalid code when an object file is compiled -inline
Jul 16, 2008
d-bugmail
Jul 16, 2008
d-bugmail
Jul 16, 2008
d-bugmail
Sep 03, 2008
d-bugmail
July 16, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2232

           Summary: DMD generates invalid code when an object file is
                    compiled -inline
           Product: D
           Version: 1.033
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: wrong-code
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: schveiguy@yahoo.com


The attached files when compiled in this manner:

dmd -c -O -inline Path.d
dmd testpath.d Path.obj

Will yield an executable that corrupts the return value from the 'modified', 'accessed', and 'created' functions.  I'm also printing out the values when they are read from the OS as a comparison.

If the Path object file is compiled without -inline, it works.
If you compile Path and testpath all at once with -inline, it works.
If you change e.g. created() to use a temporary variable to store the return
value, it works.

This is the most minimal example I could create, it happens with both Phobos and Tango, this example is for Phobos.

The code comes from tango.io.Path.d


-- 

July 16, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2232





------- Comment #1 from schveiguy@yahoo.com  2008-07-16 15:55 -------
Created an attachment (id=262)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=262&action=view)
Path.d file

Compile this file with -c -inline -O


-- 

July 16, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2232





------- Comment #2 from schveiguy@yahoo.com  2008-07-16 15:55 -------
Created an attachment (id=263)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=263&action=view)
main program

compile this with Path.obj using dmd testpath.d Path.obj


-- 

September 03, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2232


bugzilla@digitalmars.com changed:

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




------- Comment #3 from bugzilla@digitalmars.com  2008-09-03 01:35 -------
Fixed dmd 1.035 and 2.019


--