Menu

#3597 Compilation error with extern array redefinition

closed-fixed
None
Front-end
5
2023-07-29
2023-06-07
dom
No

An odd code case that was reported via https://github.com/z88dk/z88dk/issues/2291

Code (much reduced):

const int foo[] = {42,43,44,45,46,47};

extern const int foo[];

int main(void)
{
        return 0;
}

Compiler: SDCC : z80/z180/r2ka/r3ka/sm83/ez80_z80/z80n TD- 4.3.0 #14110 (Mac OS X x86_64) (and earlier versions)

Compile line: sdcc -S -mz80 blah.c

Results in:

blah.c:4: error 91: extern definition for 'foo' mismatches with declaration.
blah.c:2: error 177: previously defined here

Other compilers accept without complaint.

Related

Wiki: NGI0-SDCC

Discussion

  • Philipp Klaus Krause

    I can reproduce the issue using an SDCC built from current trunk on Debian GNU/Linux testing on amd64.

     
  • Philipp Klaus Krause

    • status: open --> closed-fixed
    • assigned_to: Philipp Klaus Krause
    • Category: Z80 --> Front-end
     
  • Philipp Klaus Krause

    Fixed in [r14247].

     

    Related

    Commit: [r14247]


    Last edit: Philipp Klaus Krause 2023-07-29

Log in to post a comment.