View Issue Details

IDProjectCategoryView StatusLast Update
0000653LDMud 3.5LPC Compiler/Preprocessorpublic2017-09-30 18:49
ReporterGnomi Assigned ToGnomi  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Platformi686OSDebian GNU/LinuxOS Version4.0
Fixed in Version3.5.0 
Summary0000653: lvalue 5: Make explicit lvalues fragile
DescriptionExplicitly created lvalues behave somewhat inconsistent. Sometimes they are automatically derefenced, sometimes not.

   int var = 10;
   mixed lv;

   lv = &var; /* typeof(lv) returns T_NUMBER. */
   lv = ({ &var }); /* typeof(lv[0]) returns T_LVALUE. */

I think when pushing an element which is a protected lvalue onto the stack it has to be dereferenced. The only exception is pushing it as an lvalue on the stack (in the above example typeof(lv) and typeof(lv[0]) should return T_NUMBER, but typeof(&lv) and typeof(&(lv[0])) should return T_LVALUE).

So conceptually lvalues are fragile, to keep them you have to use & everywhere you want to copy them.) This is also for security reasons: It shouldn't be possible to give an object an lvalue and observe the values it gets during its processing, unless the object preserves the lvalues by using &.

That's why also x=fun() and x=&(fun()) have to be distinguished (if the former returns an lvalue it has to be changed to an rvalue).
TagsNo tags attached.

Relationships

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 15:11 Gnomi New Issue
2009-06-03 15:11 Gnomi Status new => assigned
2009-06-03 15:11 Gnomi Assigned To => Gnomi
2009-06-03 15:12 Gnomi Relationship added child of 0000546
2017-09-30 18:49 Gnomi Status assigned => resolved
2017-09-30 18:49 Gnomi Resolution open => fixed
2017-09-30 18:49 Gnomi Fixed in Version => 3.5.0