www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6698] New: Regression(2.053): segfault with naked asm in inner function

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6698

           Summary: Regression(2.053): segfault with naked asm in inner
                    function
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: clugdbug yahoo.com.au



This comes from the test suite, fail_compilation/fail135.d
The code actually worked for a very long time (since around DMD1.000), but
wasn't compiling because it had a missing import for printf.


// segfault on 0.150
void fail135()
{
    int i = 0;

    void fn()
    {
    asm
    {
        naked;
        lea EAX, i;
        mov [EAX], 42;
        ret;
    }
    }
    fn();
    assert(i==42);
}

void main()
{
    fail135();
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 20 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6698


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
           Severity|normal                      |regression


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 20 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6698




I'm actually not sure if this should really work, or not. It may simply be code
that was relying on undefined behaviour.
Despite nominally being a "regression", it should be given low priority.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 17 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6698




This is not caused by the compiler. The change seems to have been caused by a
change in druntime between 2.052 and 2.053.

This code didn't actually work before. If you change the assert to:

assert(i==49);
(which should fail), it doesn't fail!

This code is actually clobbering the return address.

The test case is bug 701, which hasn't been fixed. The bug is that this test
case is in the test suite.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 24 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6698


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED



13:39:10 PDT ---
https://github.com/D-Programming-Language/dmd/commit/9224e1cae4b0d08898f4ee737c1ea510fc84fbdc

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