#1316 Bug with some uses of sizeof(static local array) (MCS51)

closed-fixed
Borut Ražem
5
2007-04-22
2007-04-13
Anonymous
No

sizeof(static global array) works fine.
sizeof(static local array) fails when used as in code below.

/*
SDCC version: mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.6.0 #4309 (Jul 28 2006) (MINGW32)

command line: sdcc.exe -c --debug --use-stdout -V --std-sdcc99 --no-peep-comments -I... Source2.c

verbose: + sdcpp.exe -nostdinc -Wall -std=c99 -I"..." -obj-ext=.rel -DSDCC_MODEL_SMALL -DSDCC=260 -DSDCC_mcs51 -D__mcs51 -I"...\SDCC\bin\..\include\mcs51" -I"...\SDCC\bin\..\include" "...\Source2.c"
+ asx8051.exe -plosgffc "Source2.asm"

Paths (local drives) are replaced with '...' above.
WXP HE PL SP2
*/
static __code const char Str_global[] = "Hello1";
char s1, s2;
void Foo(void)
{
static __code const char str_local[] = "Hello2";

static char str1[sizeof(Str_global)];
static char str2[sizeof(str_local)]; // causes error 20: Undefined identifier 'str_local'

s1 = sizeof(Str_global);
s2 = sizeof(str_local); // no error and proper result when line causing error (above) is removed

return;
}

Discussion

  • Source code showing bug

     
    Attachments
  • Borut Ražem
    Borut Ražem
    2007-04-22

    Logged In: YES
    user_id=568035
    Originator: NO

    Fixed in sdcc release #7462.

    Borut

     
  • Borut Ražem
    Borut Ražem
    2007-04-22

    • assigned_to: nobody --> borutr
    • status: open --> closed-fixed