All of lore.kernel.org
 help / color / mirror / Atom feed
* IA32 (2.6.2 - 2004-02-05.22.30) - 3 New warnings (gcc 3.2.2)
@ 2004-02-06 11:22 John Cherry
  2004-02-06 11:33 ` viro
  0 siblings, 1 reply; 12+ messages in thread
From: John Cherry @ 2004-02-06 11:22 UTC (permalink / raw)
  To: linux-kernel

drivers/net/ne.c:168: warning: unused variable `irq'
drivers/scsi/imm.c:1146: warning: `ports' might be used uninitialized in this function
drivers/scsi/ppa.c:1006: warning: `ports' might be used uninitialized in this function

^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: IA32 (2.6.2 - 2004-02-05.22.30) - 3 New warnings (gcc 3.2.2)
@ 2004-02-08  1:00 Jon Foster
  2004-02-08  5:45 ` viro
  0 siblings, 1 reply; 12+ messages in thread
From: Jon Foster @ 2004-02-08  1:00 UTC (permalink / raw)
  To: linux-kernel

Linus wrote:
> On Fri, 6 Feb 2004 viro wrote:
>>
>> IOW, gcc doesn't realize that we never return from BUG(). AFAICS, it
>> should. Some changes of __volatile__ semantics?
> 
> Thsrs is no way to tell gcc that an inline asm doesn't return. The only
> way to do it would be to add something like a "for (;;);" (that gcc will
> actually generate real code for) inside the BUG() macro, but I'd hate to
> do that.

Why would you hate to do that?  Because of the extra code this generates?
Or because it's a hack (we should just be able to tell GCC that the inline
assembly never returns)?

Although the loop does generate real code, GCC is currently generating real
code to handle what happens after BUG() returns.  The two pretty much cancel
each other out - they're both basically a jump (possibly with a nop for
alignment).  This is extremely non-obvious (at least to me), since the code
to handle BUG() returning is implicit, whereas the for(;;); is explicit.

I've just done some benchmarks (using a vendor 2.4 kernel) and the for(;;);
change actually reduced the kernel size.  The change was a negligible
amount, almost lost in the noise, but at least the size didn't go up.  See
my recent l-k post "Re: [Compile Regression in 2.4.25-pre8][PATCH 37/42]".

I agree with Viro that the best solution would be if there was some way
to tell GCC that the inline assembly doesn't return - probably by attaching
__attribute__((noreturn)) to it.

Kind regards,

Jon

> 
> Better to just initialize the variable to a default value and avoid the
> warning for now.
> 
> Linus




^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2004-02-10 15:51 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-06 11:22 IA32 (2.6.2 - 2004-02-05.22.30) - 3 New warnings (gcc 3.2.2) John Cherry
2004-02-06 11:33 ` viro
2004-02-06 16:52   ` Linus Torvalds
2004-02-06 18:22     ` viro
2004-02-06 18:35       ` Petr Vandrovec
2004-02-06 18:42       ` Linus Torvalds
2004-02-06 18:47         ` viro
2004-02-06 19:09           ` viro
2004-02-10 13:32         ` Dick Streefland
2004-02-10 15:44           ` Randy.Dunlap
  -- strict thread matches above, loose matches on Subject: below --
2004-02-08  1:00 Jon Foster
2004-02-08  5:45 ` viro

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.