When compiling the attached file using current sdcc 3.6.3 #9787, on my Debian GNU/Linux system, SDCC uses too much memory. I tried compiling for mcs51 and stm8; for both targets, SDCC uses more than 16 GB of RAM (at which point I killed SDCC) during compilation.
The file has about 2000 lines and contains a function of about 1200 lines with 200 local variables. Big, but not unreasonable. It was obtained by using the LLVM+SDCC toolchain on the longlong regression test.
Philipp
P.S.: I've seen high memory use on few other files, too. But this seems to be the worst among files obtained from our regression tests.
The problem seems tobe in CSE. I started sdcc five times under gdb, then stopped it after a while when it had started eating up my memory, and looked at the backtraces. Here is the common part among them:
Philipp
Same problem here. I try to compile a file with a reasonably large function for 8051 and SDCC eats all the computer memory until I have to kill the process. I have reproduced the issue on two environments:
SDCC 3.6 --> 3.6.0 #9615 (MINGW64) <-- Downloaded from SF
SDCC 3.3 --> 3.3.0 #8604 (Dec 30 2013) (Linux) <-- Included in Ubuntu 14.04 LTS
Build command line:
sdcc --noinduction --nooverlay --no-peep --model-large --std-c99 --debug -I ./include -c -o build/main.rel src/main.c
Same file builds successfully with SDCC 2.6.3 #4543 (Dec 31 2006) (MINGW32). This (very old) version of SDCC is provided with SoftConsole v3.4, so it might have been patched by Microsemi (refer to SoftConsole Release Notes).
I do not have much experience with SDCC, so I cannot provide much more info about the issue.
Thanks,
Juan
Could you create a minimal code example from your code to reproduce this bug? Your code seems to be the first real-world hand-written code to trigger this bug. Before we only had code genrated by the LLVM C backend (which as you can see from the file.cbe.c attachment is not very human-readable).
Philipp
Sadly, I can't share the file because it's propietary code from the company I work for. I can tell you that the function is over 1000 lines and it has around 40 local variables (I will know the exact numbers when I get back to work on Monday). Nesting level is reasonably high (around 7 levels). Other than that, it is quite a simple function.
We should have split the code in smaller functions instead of copy-paste everything in the same one, but we were in a hurry and we didn't do much software engineering (I am starting to regret it, though). That's probably the reason no one hit this bug before.
When compiling this for stm8, the current [r10436] revision is down to about 855 MB.
When compiling this for z80, the current [r11800] revision eats about 509 MB.
I think Bug [#2009] is related.
Related
Bugs: #2009