dimitriv / Ziria

A domain-specific-language and compiler for low-level bitstream processing.
92 stars 18 forks source link

Bug in codegen for ELetRef #68

Open edsko opened 9 years ago

edsko commented 9 years ago

In perm_test.wpl, if you insert a println before the ‘var out’ in function ‘perm’, the type checker was giving an error; this was because zonking did not properly deal with ‘length’ expressions in types (in fact, it ignored scoping completely). This is now fixed because the length expressions no longer exist after the renamer, so perm_test with the extra println now makes it past the type checker, but actually with the extra println it now fails in the code generator, so there is a bug in there somewhere too. The generated code fails to compile with

gcc -Wno-typedef-redefinition -c test.c -o test.o
test.c:129:66: error: use of undeclared identifier '_r3'
                                                                (_r3 + 7 >> 3) *
                                                                 ^
1 error generated.

where _r3 is the type variable introduced by the renamer for the length of the ‘data’ parameter; so I guess there is a bug in the treatment of LetERef somewhere.