[parisc-linux] gcc (g++) problem

Jeremy Drake jeremyd@apptechsys.com
Mon, 25 Feb 2002 19:53:40 -0800 (PST)

As you may remember from my last question, I'm having some problems
building some code on parisc-linux.  I have been able to reproduce the
problem using a more simple program.

Here's the problem.  This program segfaults when compiled with -fPIC, as
required to build a .so.  It is fine when compiled without -fPIC.  It is
also fine on intel platform with both.  Is there something wrong with the
code that I'm not seeing, or is this a compiler bug?  I have tried this
with gcc-3 on an intel box, and it is fine, so I assume it is this port?

Thanks for your help...

g++ -g -o test -fPIC test.cpp

---- test.cpp ----
#include <stdio.h>

class Foo
	Foo(const char * const blah);
	unsigned char* text;
Foo::Foo(const char * const blah)
	text=(unsigned char *)blah;

const Foo test("Blah");
int main()
	printf("%s\n", test.text);
	return 0;

Advertisements contain the only truths to be relied on in a newspaper.
		-- Thomas Jefferson