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

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

Re: [avr-gcc-list] Inconsisten behaviour of switch statement


From: Joerg Wunsch
Subject: Re: [avr-gcc-list] Inconsisten behaviour of switch statement
Date: Tue, 27 Mar 2007 07:10:06 +0200 (MET DST)

Paulo Marques <address@hidden> wrote:

> This is not a "missed optimization".

I agree.

> I would need some time to build an actual test case to show this.
> Unfortunately, time is something that I don't have abundantly right
> now :(

I tried a quick test with some variations of:

volatile int i;

extern void dosomething(int);

void
decide(void)
{
        switch (i) {
        case 0:         dosomething(42); break;
        case 1:         dosomething(99); break;
        case 5:         dosomething(95); break;
        case 65200:     dosomething(90); break;
        case 30100:     dosomething(85); break;
        default:        dosomething(0); break;
        }
}

....and could not get it to reproduce the bug.  While it is never using
a jump table for such a relatively small switch statement, it always
loaded i into a register pair first, and then decided on it.  This is
with GCC 4.1.1.

Knut, can you provide us an example that reproduces the problem?

-- 
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]