abau / co4

COmplexity COncerned COnstraint COmpiler
GNU General Public License v3.0
2 stars 3 forks source link

Wrong Assertion? #118

Closed csternagel closed 6 years ago

csternagel commented 6 years ago

I think I stumbled over another wrong assertion (in line 231 of EncodedAdt.hs).

Starting decoder
*** Exception: Assertion failed
CallStack (from HasCallStack):
  assert, called at /home/griff/repos/tools/co4/src/CO4/EncodedAdt.hs:231:3

Its strange effect for students in my class was that for those students who (accidentally) had 2^n constructors, decoding succeeded but for others (where the number of constructors was not a power of 2) it failed.

csternagel commented 6 years ago

Just a further remark: For me stack ghc doesn't check assertions (that's why I didn't notice the above issue at first), but for some of my students (in one case I have seen this with my own eyes) stack ghc still checks assertions. I have no clue why ghc behaves different on our machines (I thought the purpose of stack was that this does not happen) ;)

abau commented 6 years ago

another wrong assertion

Thanks, I fixed that.

I have no clue why ghc behaves different on our machines

Strange. For me, stack ghc doesn't check assertions neither, but according to ghc's manual

GHC ignores assertions when optimisation is turned on with the -O flag. [..] You can also disable assertions using the -fignore-asserts option.

Thus, when just running stack ghc Bug.hs, I'd expect assertions being checked since I neither used -O nor -fignore-asserts.

Anyway, the present issue should be fixed. Thanks again!