Menu

#1276 codeseg/constseg #pragma fail

closed-fixed
5
2007-04-19
2007-01-10
xdh
No

>sdcc -v
SDCC :mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.6.3 #4543 (Dec 31 2006) (MINGW32)

#pragma codeseg and #pragma constseg produce errors in the generated assembly oode.

#if 1
#pragma codeseg MYCODE
#endif
#if 0
#pragma constseg MYCONST
#endif
const int g_const = 0xDEAD;
int g_global;
void main(void)
{
g_global = 0x1234;
while (1)
{}
}
>sdcc area02.c
?ASxxxx-Error-<q> in line 113 of area02.asm
<q> missing or improper operators, terminators, or delimiters removing area02.rel

The offending code is:
;--------------------------------------------------------
; code
;--------------------------------------------------------
.area (CODE)
Note the missing area name.

In SDCC.lex, the switch cases:
case P_CODESEG: and case P_CONSTSEG: do not handle the buffer properly (the get_pragma_token call to check for end of line blows away the token containing the token dbuf containing the name).

Similarly, the command line processing for the corresponding --codeseg and --constseg options do not append (CODE) qualifier to the area string.

Discussion

  • Borut Ražem

    Borut Ražem - 2007-01-10

    Logged In: YES
    user_id=568035
    Originator: NO

    fixed in svn revision #4568

    Borut

     
  • Borut Ražem

    Borut Ražem - 2007-01-10
    • assigned_to: nobody --> borutr
    • status: open --> closed-fixed
     
  • Borut Ražem

    Borut Ražem - 2007-04-18

    Logged In: YES
    user_id=568035
    Originator: NO

    The (CODE) extension should not be appended on z80 target!

    Lin Rongrong reported the problem:

    1. in src\SDCCmain.c, line 1154-1163, the "--codeseg" option is handled wrong, will cause as-z80.exe report "Error: <u> undefined symbol encountered during assembly". Modify line 1159:
    dbuf_printf (&segname, "%-8s(CODE)", getStringArg (OPTION_CODE_SEG, argv, &i, argc));
    to
    dbuf_printf (&segname, "%-8s", getStringArg (OPTION_CODE_SEG, argv, &i, argc));
    solved this problem.

    Borut

     
  • Borut Ražem

    Borut Ražem - 2007-04-18
    • status: closed-fixed --> open-rejected
     
  • Borut Ražem

    Borut Ražem - 2007-04-19

    Logged In: YES
    user_id=568035
    Originator: NO

    fixed in sdcc revisio #4758.

    Borut

     
  • Borut Ražem

    Borut Ražem - 2007-04-19
    • status: open-rejected --> closed-fixed
     

Log in to post a comment.