dplassgit / d2lang

D2 is a strongly-typed, statically-typed, (mostly) inferred-type compiled language.
MIT License
7 stars 0 forks source link

Loop invariant optimizer broken for field-set and array-set lvalues #190

Closed dplassgit closed 2 years ago

dplassgit commented 2 years ago

In fact it's causing a segfault when there's a line like "p = NEW recordType"

dplassgit commented 2 years ago

Worse: the LIO was lifting temps out of the loop, which is no good, because temps are deallocated after first use, and so the 2nd time though the loop they will have lost their value. I wrote the LIO before the nasm code generator, which enforces one-and-done usage of temps...