GDC generates invalid assembly around fiber yield operations (Not re-reading data from clobberedd memory to registers)

Liran Zvibel via D.gnu d.gnu at puremagic.com
Tue May 5 07:57:37 PDT 2015


Hi,

Another thing that I noticed about this issue, is that in this 
isolated test case, the problem only happens if the added value 
is returned from the function that performs the 'yield()'.
If I call 'yield()' directly, then add to 'globalSum', or if I 
just call 'otherFunc()', ignore the return value and then add to 
'globalSum' then the result is correct.

An example of run version that works:
     void run()
     {
         foreach(int k; 0 .. numAddition) {
             otherFunc();
             globalSum += index;
             writefln("DerivedFiber(%d) iteration %d globalSum is 
%d", index, k, globalSum);
         }
     }

An example of run version that breaks (exactly like the one from 
my previous mail):
     void run()
     {
         foreach(int k; 0 .. numAddition) {
             globalSum += otherFunc();
             writefln("DerivedFiber(%d) iteration %d globalSum is 
%d", index, k, globalSum);
         }
     }

Maybe this can help you understand something ...

Thanks,

Liran


More information about the D.gnu mailing list