dimitriv / Ziria

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

noloc location information in bound checks #106

Closed bradunov closed 9 years ago

bradunov commented 9 years ago

The following code (with infile containing number 8) fails on Bounds check violation (as it should) but gives noLoc as error location. Also, if you replace i with 8 in the code itself, it will compile during static type checking (I believe) but it will also produce noLoc location info.

fun test(i : int) { var a:arr[10] int;

a[i+4] := 0; return 0; }

let comp main = read[int] >>> {x<-take; emit test(x)} >>> write;

@mainland : you told me to assign you on these kinds of bugs...

dimitriv commented 9 years ago

Hmm it could also be the case that some internal transformation/pass has erased the location. Maybe @mainland can eliminate that the frontend is to blame and then I can take it from there if the bug is not there.

mainland commented 9 years ago

@bradunov Indeed, I did :) Thanks!

Fixed in 89afcff01c72170a44b3e6fe340536d0d5c3fe2c.

bradunov commented 9 years ago

@mainland : Hey, this still doesn't work. I made sure I pulled the latest version, did make clean; make, and I still get noLoc. Anything else I am missing? Is there a place where we can add a unit test?

bradunov commented 9 years ago

I also now managed to get the following error in a very complex Ziria code: Data\Loc.hs:(274,1)-(293,19): Non-exhaustive patterns in function displaySLoc Note that the version of Ziria prior to 89afcff compiles this code without a problem.

mainland commented 9 years ago

OK, please try master now. If it still doesn't work, please send me precise instructions for reproducing the bug, including input files, and I will fix it.

bradunov commented 9 years ago

Now it looks good. My complex code compiles and mock examples give correct error messages. Thanks! Closing the issue.