View Issue Details

IDProjectCategoryView StatusLast Update
0000650LDMud 3.5Runtimepublic2017-09-30 18:46
ReporterGnomi Assigned ToGnomi  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Platformi686OSDebian GNU/LinuxOS Version4.0
Fixed in Version3.5.0 
Summary0000650: lvalue 2: Give variable references unlimited lifespan
DescriptionCurrently it is possible to create variable references that life longer than the variable itself:

    int var;
    return ({ 0 || &var });

This function would return an lvalue to an invalid stack entry. The compiler tries to check this (return &var; is forbidden), but I don't think it can catch all possibilities.

There are to kinds of variable lvalues: Implicit (var = ...) and explicit (&var). The first kind will have subtype LVALUE_UNPROTECTED and any such lvalue must be consumed by the next operation, it's reference to the svalue is uncounted (just as it is now).

The second kind will have subtype LVALUE_PROTECTED and points to a dynamically allocated structure consisting of a reference count and a svalue_t. Whenever an explicit reference to a variable is done, the contents of the variable is copied to such a structure and the variable itself is replaced by a protected lvalue pointing to this structure.

&(arr[i]) can also be implemented that way without the need for protector references of the array.

All other protected lvalue structures (for ranges) get a reference counter, too.
TagsNo tags attached.

Relationships

parent of 0000487 resolvedGnomi Protected lvalues are copied without their protectors 
child of 0000546 resolvedGnomi Rework lvalue handling 

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2009-06-03 14:29 Gnomi New Issue
2009-06-03 14:29 Gnomi Status new => assigned
2009-06-03 14:29 Gnomi Assigned To => Gnomi
2009-06-03 14:30 Gnomi Relationship added parent of 0000487
2009-06-03 14:31 Gnomi Relationship added child of 0000546
2017-09-30 18:46 Gnomi Status assigned => resolved
2017-09-30 18:46 Gnomi Resolution open => fixed
2017-09-30 18:46 Gnomi Fixed in Version => 3.5.0