[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#486347: gcc-4.3: Superfluous warning when -std=c99/gnu99 and noreturn on main()



On Sun, Jun 15, 2008 at 04:13:26PM +0200, Peter Lebbing wrote:
> This bug report is actually a duplicate of bug #141015, which was filed
> against gcc-3.0. The bug was never fixed because it was deemed unimportant:
> when the bug reporter used a different combination of settings, he no longer
> got the warning. However, he also no longer got the /functionality/.

Well, main returns always in a hosted environment.

> This bug is still a bit bothersome to me. When I compile a C program for use
> on a microcontroller with the package gcc-avr, the noreturn attribute on
> main() actually triggers better optimisation, resulting in more optimal
> stack usage. This can be a big benefit on a device with usually between 128
> and 1024 bytes of RAM. Most programs on these devices never return from
> main(). Very often an endless loop like above is used, or something similar.

I doubt that you want a hosted compiler environment while building code
for such a device. Use -ffreestanding and/or use a different name then
main.

Bastian

-- 
Mind your own business, Spock.  I'm sick of your halfbreed interference.



Reply to: