public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/11438] New: optmization bug with -fPIC
@ 2003-07-04 22:58 stas at fromru dot com
  2003-07-04 23:11 ` [Bug optimization/11438] " pinskia at physics dot uc dot edu
  0 siblings, 1 reply; 2+ messages in thread
From: stas at fromru dot com @ 2003-07-04 22:58 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11438

           Summary: optmization bug with -fPIC
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: critical
          Priority: P1
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: stas at fromru dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu

gcc version 3.3 release.
If compile following source with #gcc -o ptest -O3 -fPIC test.c
get Segmentation fault.
If remove static from PTEST declaration all is fine. Compiling with 
#gcc -o ptest -O2 -fPIC test.c produce normal result.

[--cut--]
#include <stdio.h>
#include <stdlib.h>

typedef struct _test
 {
   int p1;
   int p2;
   char *p3;
 } tests;


static tests *PTEST = NULL;
/* tests *PTEST = NULL; */


void init()
 {
  tests *ptest;

   ptest = PTEST;
   ptest = (tests*) malloc(sizeof(tests));
   ptest->p1 = 1;
   PTEST = ptest;
 }


int p2()
 {
  tests *ptest;

   ptest = PTEST;
   return(ptest->p1);
 }

main()
 {
   init();
   printf("p1:%d\n", p2());
 }
[--cut--]


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

* [Bug optimization/11438] optmization bug with -fPIC
  2003-07-04 22:58 [Bug optimization/11438] New: optmization bug with -fPIC stas at fromru dot com
@ 2003-07-04 23:11 ` pinskia at physics dot uc dot edu
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-07-04 23:11 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11438


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


------- Additional Comments From pinskia at physics dot uc dot edu  2003-07-04 23:11 -------
This is a binutils bug (we will be documenting what version of `as' gcc requires, we already have a 
bug filed for that; bug 10877). Closing as dup of bug 10877.
The binutils bug is fixed in binutils 2.13.1, please update binutils and this will fix your seg fault.

*** This bug has been marked as a duplicate of 10877 ***


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

end of thread, other threads:[~2003-07-04 23:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-04 22:58 [Bug optimization/11438] New: optmization bug with -fPIC stas at fromru dot com
2003-07-04 23:11 ` [Bug optimization/11438] " pinskia at physics dot uc dot edu

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