public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: optimization/4085: PPC -fPIC code generation problem
@ 2001-12-28 10:37 dje
  0 siblings, 0 replies; 2+ messages in thread
From: dje @ 2001-12-28 10:37 UTC (permalink / raw)
  To: dje, gcc-bugs, gcc-prs, green, nobody

Synopsis: PPC -fPIC code generation problem

Responsible-Changed-From-To: unassigned->dje
Responsible-Changed-By: dje
Responsible-Changed-When: Fri Dec 28 10:37:12 2001
Responsible-Changed-Why:
    PowerPC codegen
State-Changed-From-To: open->closed
State-Changed-By: dje
State-Changed-When: Fri Dec 28 10:37:12 2001
State-Changed-Why:
    I believe this bug is fixed.  If it is not, please re-open
    a PR and let me know.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=4085


^ permalink raw reply	[flat|nested] 2+ messages in thread

* optimization/4085: PPC -fPIC code generation problem
@ 2001-08-22 14:46 green
  0 siblings, 0 replies; 2+ messages in thread
From: green @ 2001-08-22 14:46 UTC (permalink / raw)
  To: gcc-gnats

>Number:         4085
>Category:       optimization
>Synopsis:       PPC -fPIC code generation problem
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 22 14:46:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        3.1 20010811 (experimental)
>Organization:
>Environment:
System: Linux peach.cygnus.co.uk 2.2.17pre20-ben3 #2 Wed Sep 6 01:14:01 CEST 2000 ppc unknown
Architecture: ppc

	
host: powerpc-unknown-linux-gnu
build: powerpc-unknown-linux-gnu
target: powerpc-unknown-linux-gnu
configured with: /peach/green/net/trunk/gcc/configure --prefix=/peach/green/net/trunk/i --enable-threads --enable-language=c,c++,java --enable-languages=c,c++,java --disable-multilibs --disable-multilib : (reconfigured)  : (reconfigured)  : (reconfigured)  : (reconfigured) 
>Description:
The following (admittedly bogus) code does not link on ppc Linux.
$ gcc -O2 -fPIC -o ppcbug ppcbug.c
/tmp/ccCbVD67.o(.rodata+0x10): undefined reference to `.L23'
/tmp/ccCbVD67.o(.rodata+0x14): undefined reference to `.L23'
/tmp/ccCbVD67.o(.rodata+0x18): undefined reference to `.L23'
/tmp/ccCbVD67.o(.rodata+0x1c): undefined reference to `.L23'
/tmp/ccCbVD67.o(.rodata+0x20): undefined reference to `.L22'
collect2: ld returned 1 exit status

It looks like gcc is creating a jump table for the switch.  It's
realizing that it can optimize away all cases except for default, but
references to the deleted code are left arount in the jump table.

#include <stdio.h>

int main (int argc, char *argv[])
{
  char *foo; 
  switch (argc) 
    {
    case 1:
      foo = "one";
    case 2:
      foo = "two";
    case 3:
      foo = "three";
    case 4:
      foo = "four";
    case 5:
      foo = "five";
    default:
      foo = "default";
    }
  puts (foo);
  return 0;
}


>How-To-Repeat:
	Try compiling the code above with "-O2 -fPIC".
>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-12-28 18:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-28 10:37 optimization/4085: PPC -fPIC code generation problem dje
  -- strict thread matches above, loose matches on Subject: below --
2001-08-22 14:46 green

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).