* label 'continue' already bound, unreplaced symbol 'return'
@ 2008-02-14 0:16 Pavel Roskin
2008-02-22 19:16 ` Christopher Li
0 siblings, 1 reply; 2+ messages in thread
From: Pavel Roskin @ 2008-02-14 0:16 UTC (permalink / raw)
To: linux-sparse
Hello!
Here are some interesting testcases from the same hal.c from ndiswrapper
that was triggering the crash.
static inline int foo(void)
{
do {
} while (0);
return 0;
}
int bar(void);
int bar(void)
{
return foo();
}
typeof(bar) quux;
hal.c:12:13: warning: symbol 'quux' was not declared. Should it be
static?
hal.c:3:5: warning: label 'continue' already bound
hal.c:3:5: warning: label 'break' already bound
static inline int foo(void)
{
return 0;
}
typeof(foo) quux;
hal.c:3:5: warning: unreplaced symbol 'return'
hal.c:1:19: warning: unreplaced symbol 'return'
hal.c:5:13: warning: symbol 'quux' was not declared. Should it be
static?
static inline void foo(void)
{
do {} while (0);
}
typeof(foo) quux;
hal.c:3:5: warning: unreplaced symbol 'break'
hal.c:3:5: warning: unreplaced symbol 'continue'
hal.c:1:20: warning: unreplaced symbol 'return'
hal.c:5:13: warning: symbol 'quux' was not declared. Should it be
static?
"extern" before "typeof" fixes all warnings.
--
Regards,
Pavel Roskin
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: label 'continue' already bound, unreplaced symbol 'return'
2008-02-14 0:16 label 'continue' already bound, unreplaced symbol 'return' Pavel Roskin
@ 2008-02-22 19:16 ` Christopher Li
0 siblings, 0 replies; 2+ messages in thread
From: Christopher Li @ 2008-02-22 19:16 UTC (permalink / raw)
To: Pavel Roskin; +Cc: linux-sparse
> static inline int foo(void)
> {
> do {
> } while (0);
> return 0;
> }
> int bar(void);
> int bar(void)
> {
> return foo();
> }
> typeof(bar) quux;
>
>
> hal.c:12:13: warning: symbol 'quux' was not declared. Should it be
> static?
> hal.c:3:5: warning: label 'continue' already bound
> hal.c:3:5: warning: label 'break' already bound
This happen because you try to make quux has type of *function*,
not a function pointer. Sparse literary assign the base type of bar
as base type of quux. This result in body of bar get linearized twice.
I don't thing typeof(bar) quux is doing any thing useful.
I am not sure what is the gcc rules here. I try gcc -S with the test
case, it does not even generate any thing for quux.
The rest of the test case is more or less the same thing.
> "extern" before "typeof" fixes all warnings.
That is because, once you declear it as "extern", it does not emit
any code.
I guess I can skip typeof(function) to fix it, like gcc does. Is there
better suggestions?
Chris
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-02-22 19:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-14 0:16 label 'continue' already bound, unreplaced symbol 'return' Pavel Roskin
2008-02-22 19:16 ` Christopher Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).