www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6497] New: [safeD] Escaping a reference to a local variable from safe function

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

           Summary: [safeD] Escaping a reference to a local variable from
                    safe function
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: timon.gehr gmx.ch



int* foo() safe{
    int n;
    int*x=&(0?n:n);
    return x;
}

This currently compiles without error.

(When fixing, make sure that safe functions can still assign to a
ConditionalExpression, afaik it is currently implemented by taking the address
of the 2. and 3. operands.)

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


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |yebblies gmail.com
           Platform|Other                       |All
         AssignedTo|nobody puremagic.com        |yebblies gmail.com
            Summary|[safeD] Escaping a          |[safeD] Can take address of
                   |reference to a local        |local variable through ?:
                   |variable from safe function |
         OS/Version|Linux                       |All



https://github.com/D-Programming-Language/dmd/pull/664

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 30 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6497




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/40755eef0bbc746375aec08e7b66d4196a100c38
Issue 6497 - [safeD] Can take address of local variable through ?:

If the compiler rewrote `&(a ? b : c)` to `&*(a ? &b : &c)`, re-run semantic on
the `AddrExp`s to ensure they don't take addresses of local variables.

Fixes issue 6497

https://github.com/D-Programming-Language/dmd/commit/fe4ea16128943196247b28e0ccc804c69e52d255


Issue 6497 - [safeD] Can take address of local variable through ?:

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 14 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6497


Kenji Hara <k.hara.pg gmail.com> changed:

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


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 14 2012