Port-powerpc archive

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

Re: possible bug in gcc

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@localhost wrote:


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).


$ cc -v
Using builtin specs.
gcc version 2.95.3 20010315 (release) (NetBSD nb3)
$ cat > dummy.c
dummy(int i)
       int n;

       switch (i) {
       case 0:
               n = 0;
       case 1:
               n = 1;
       case 2:
               n = 2;
       case 3:
               n = 3;
       case 4:
               n = 4;
$ 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/

Home | Main Index | Thread Index | Old Index