#1606 incorrect warning 'auto' variable 'a' may be used before in

closed-fixed
Erik Petrich
5
2013-05-25
2010-01-23
Borut Ražem
No

This example:

static int
f (void)
{
int a = 0;
if (a > 0)
{
return a;
}

return 0;
}

produces incorrect warning:
t.c:7: warning 84: 'auto' variable 'a' may be used before initialization
t.c:7: warning 126: unreachable code

SDCC version:
SDCC : mcs51/gbz80/z80/ds390/pic16/pic14/TININative/ds400/hc08 2.9.7 #5646 (Jan 23 2010) (UNIX)

Borut

Discussion

  • Borut Ražem
    Borut Ražem
    2010-01-23

    I forgot to specify the command line:

    sdcc -S t.c

    Borut

     
  • Maarten Brock
    Maarten Brock
    2010-09-17

    Warning 126 is correct, warning 84 is not.
    This bug is present in both SDCC 2.9.0 and 2.9.7 #5973.

     
  • Erik Petrich
    Erik Petrich
    2011-12-24

    Fixed in SDCC revision 7128

     
  • Erik Petrich
    Erik Petrich
    2011-12-24

    • milestone: --> fixed
    • assigned_to: nobody --> epetrich
    • status: open --> closed-fixed