www.digitalmars.com         C & C++   DMDScript  

D.gnu - [Issue 1036] New: regression: invalid code generation for class literal expression unless -fPIC or -release is used

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

           Summary: regression: invalid code generation for class literal
                    expression unless -fPIC or -release is used
           Product: DGCC aka GDC
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: glue layer
        AssignedTo: dvdfrdmn users.sf.net
        ReportedBy: thomas-dloop kuehne.cn
































gdmd-0.23 run/c/class_26_B.d -ofx && ./x -> Error: AssertError Failure 
run/c/class_26_B.d(32)
gdmd-0.23 run/c/class_26_B.d -fPIC -ofx && ./x -> success

test case:
http://dstress.kuehne.cn/run/c/class_26_B.d


-- 
Mar 07 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1036


dvdfrdmn users.sf.net changed:

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





Exiting from 'foo' invalidates the anonymous class' link to 'status'. The
correct way to do this is to have a direct pointer to the outer stack frame:

    return &(new class
        {
            int *p_status;
            this() { p_status = & status; }
            int dg() {
                return ++ *p_status;
            }
        }
         ).dg;


-- 
Mar 11 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1036






Thanks, fixed


-- 
Mar 11 2007