[Top][All Lists]

[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 09:21:56 +0200 (MET DST)

Szikra Istvan <address@hidden> wrote:

> The compilet might not have any idea about it, but I argue that it
> could!


> If it's generating calls from my function (unwanted), it could be so
> kind to put the callee next to the caller.

It's the linker doing that, and it's simply not smart enough to handle
that.  It would require to include functions from libgcc.a twice, once
per section.

>> Rule of thumb: whenever you are tempted to create a separate
>> ..bootloader section, you are usually wrong. [...]

> In this case you are wrong. Don't let the name of the bootloader
> section mislead you. It's not a bootloader! It's part of an
> application, it's just needs to use spm instructions [...]

Yes, that's the exception, and that's why I wrote "usually". ;-)

> Please stop making the compiler "think" it's smarter than me!

*I* don't do anything with the compiler, I'm not a compiler builder.
I'm just trying you to explain how a compiler works, and programmers
usually *do want* the compiler to optimize the resulting code.  As
optimization is a large process, mostly being done at the level where
the compiler is still fairly independent of the target machine (it's
just got some kind of abstraction of that machine inside), there is
nothing like a simple knob where you could tell: "So please, turn just
*this* optimization off for an AVR."

> Ppl who think they can write a program that is smarter than other
> humans (with programming experience) are usually wrong!

If you want something that doesn't optimize your code, then please use
assembly language (but don't use linker relaxations then, they could
still modify the code at the linker stage).

C compilers are not for you then.  They have been passing your level
of understanding (being a "high-level language assembler") about 20
years ago.

> With this pattern recognition the compiler's writer might made some
> shitty programmers code better, but made a decent programmers code
> worse...

I don't think you are in a position to make such a claim.  It simply
sounds arrogant.

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]