hth313 / Calypsi-tool-chains

Overview of the Calypsi tool chain and open source support packages
17 stars 0 forks source link

Compiler 5.6 68000 internal issue with optimizations arguments #48

Closed djipi closed 2 weeks ago

djipi commented 3 weeks ago

When compiling with --speed -O2 arguments, got the following problem. internal error: Translator\Compiler\IL\Variable.hs:(102,1)-(103,51): Non-exhaustive patterns in function lookupVariable

The error will occur with only -O2 too. The work around to avoid the error, it is to use only --speed

hth313 commented 3 weeks ago

Can you provide a source example with command line options?

djipi commented 3 weeks ago

This is the line options.

I was able to narrow the problem in the source, but got warnings and decided to keep them. There are not impacting the error. cmd.zip

hth313 commented 3 weeks ago

I have fixed this issue for the next release that is not so far away.

The problem is in the inliner if it encounters a function with a single return statement that contains a reference to a static variable that is not otherwise used in the function it is inlined in. Which is exactly what you have in the example.

You can temporarily use --no-inline to disable the inliner or lower optimization level.

hth313 commented 2 weeks ago

Fixed in release 5.7