Hello everyone,

I'm running into a bit of a problem when compiling with Nim, and I could really 
use some advice.

Here's what's happening:

When I compile using `nim -mm:orc` (debug mode), it takes about 1 minute and 
the executable file is a normal size. But when I add the `-d:release` flag, it 
takes over 10 minutes to compile, and the executable ends up being 10 times 
larger. After some quick digging, it looks like this might be a gcc (mingw) 
issue, and it only happens when using the default `--exceptions:goto`. 
Switching to `--exceptions:setjmp` seems to avoid the problem. I think gcc 
might be doing some optimization on the C code generated by Nim that's causing 
this unexpected side effect, but I'm not sure which optimization flag to 
disable or if there's another workaround.

Here's an example file I generated while compiling 
[InstantMenu](https://github.com/khchen/InstantMenu):

[Example file](https://tinyurl.com/ycxewzsd)

You can quickly compile it with `gcc -c -w -fmax-errors=3 -mno-ms-bitfields 
-DWIN32_LEAN_AND_MEAN -fno-ident -Id:\nim\lib @mInstantMenu.nim.c`, but adding 
optimization flags like `-O`, `-Os`, `-O3`, etc., causes the problem.

Any ideas or suggestions would be super helpful. Thanks!

Reply via email to