Subject: Re: possible bug in gcc
To: None <erik.anggard@packetfront.com>
From: Derek Godfrey <derek0godfrey@netscape.net>
List: port-powerpc
Date: 03/15/2003 16:42:01
humm I don't see whats wrong. The routine does nothing, or are you
saying it should produce nothing at all :-). a blr, well show us where
it gets
called - it might replace the call just the side effect. better yet
make it do something.
erik.anggard@packetfront.com wrote:
> Hi,
>
> I'd like to know if it is only my gcc that has been messed up somehow
> or if anyone else running NetBSD on a powerpc arch (I'm running 1.6D
> macppc) can reproduce this bug as shown below. Note: the
> dummy-function used below is of course pretty useless but I'd still
> like gcc to produce at least an blr-instruction at the end. If I
> remove any of the case-blocks or if I use -O0 or -O1 gcc will produce
> correct code. Very strange. (I've also tried the procedure below on an
> i386 machine and there gcc produced correct code with -O2, that's why
> I posted this question on port-powerpc).
>
> Thanks,
> Erik
>
> $ cc -v
> Using builtin specs.
> gcc version 2.95.3 20010315 (release) (NetBSD nb3)
> $ cat > dummy.c
> void
> dummy(int i)
> {
> int n;
>
> switch (i) {
> case 0:
> n = 0;
> break;
> case 1:
> n = 1;
> break;
> case 2:
> n = 2;
> break;
> case 3:
> n = 3;
> break;
> case 4:
> n = 4;
> break;
> }
> }
> ^d
> $ cc -O2 -c dummy.c
> $ objdump -D dummy.o
>
> dummy.o: file format elf32-powerpc
>
> Disassembly of section .text:
>
> 00000000 <dummy>:
> 0: 28 03 00 04 cmplwi r3,4
> Disassembly of section .data:
> $
>
>
--
Your favorite stores, helpful shopping tools and great gift ideas.
Experience the convenience of buying online with Shop@Netscape!
http://shopnow.netscape.com/