avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] modulo vs. loop (gcc 4.3.x bug)


From: Joerg Wunsch
Subject: Re: [avr-gcc-list] modulo vs. loop (gcc 4.3.x bug)
Date: Sun, 28 Mar 2010 00:52:39 +0100 (MET)

Szikra Istvan <address@hidden> wrote:

> -bootloader section cannot have calls to the application section !

That's only your problem though.  The compiler can reasonably expect
you to include all its helper functions into the resulting binary.

I agree it's a pessimization here, but it's correct code.  The
compiler cannot have any idea about you distinguishing between an
application and a bootloader area.

Rule of thumb: whenever you are tempted to create a separate
..bootloader section, you are usually wrong.  The bootloader is simply
a standalone application of its own, so compile/link it that way.

> if I wanted modulo, I would have written %

It's a machine.  The optimizer is tuned to catch situations which the
developer didn't write in a machine-friendly (but usually in a
user-friendly) way, and from its point of view, your code probably
just looks like a poor attempt to write down a simple division/modulus
operation.  The only fault of the optimizer here is to not recognize
that including the library function will result in larger code.

-- 
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]