the following program causes a crash
---cut---
#include "p16f876.h"
void main(void)
{
const char s[4] = { 1, 2, 3, 4 };
char i;
for(i = 0; i < 4; i++) {
char x = s[i];
PORTC = x;
}
}
---cut---
# sdcc -v
SDCC :
mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51
/ds400/hc08 2.4.0 (Feb 3 2005) (UNIX)
# sdcc -S -V -mpic14 -p16f84 -mplab-comp test2.c
Processor: 16f84
+ "sdcpp" -nostdinc -Wall -std=c99 -DSDCC=1 -
DSDCC_MODEL_SMALL -DSDCC_pic14 -D__pic14 -
I"/usr/local/share/sdcc/include" "test2.c"
Caught signal 11: SIGSEGV
Logged In: YES
user_id=1160854
Try with current version. My be it's solved in 2.4.8 #987
(see changelog). I got the signal 11 too and detected a
memory allocation problem, which was solved by erik
Logged In: YES
user_id=568035
I tried it with MINGW sdcc version 2.4.8 #1001 on Windows
2000 and it doesn't crash.
Logged In: YES
user_id=568035
Tested with MINGW sdcc version 2.4.8 #1004 on Windows XP and
it doesn't crash.
Logged In: YES
user_id=1115835
This now will compile after making the array
const char s[4] = { 1, 2, 3, 4 };
global (complex-typed locals seem still to be broken).
It crashed because of a bug in genarith.c:genAdd (index
out-of-bounds), fixed in SDCC 2.5.1 #1053.
Logged In: YES
user_id=1115835
Fixed with local s[] in SDCC 2.5.1 #1064.