[Bug target/63815] [5 Regression] g++.dg/other/pr53811.C fails with -mcmodel=large -fpic
hjl.tools at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Nov 12 14:05:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63815
--- Comment #10 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Uroš Bizjak from comment #9)
> (In reply to Uroš Bizjak from comment #8)
> > (In reply to H.J. Lu from comment #7)
> > > Created attachment 33942 [details]
> > > A patch
> >
> > Please also add a testcase that will exercise this functionality.
>
> ... runtime testcase ...
Here is a testcase:
[hjl@gnu-6 tmp]$ cat foo.h
struct ICCStringClass
{
virtual int CreateString (int) = 0;
};
struct AGSCCDynamicObject
{
virtual void Unserialize () = 0;
};
struct ScriptString:AGSCCDynamicObject, ICCStringClass
{
virtual int CreateString (int);
virtual void Unserialize ();
};
[hjl@gnu-6 tmp]$ cat foo1.cc
#include "foo.h"
int
__attribute__ ((noinline))
CreateNewScriptString (int fromText, bool reAllocate = true)
{
return fromText;
}
int
__attribute__ ((noinline))
ScriptString::CreateString (int fromText)
{
return CreateNewScriptString (fromText);
}
void
__attribute__ ((noinline))
ScriptString::Unserialize ()
{
}
[hjl@gnu-6 tmp]$ cat foo2.cc
#include "foo.h"
int
main ()
{
ICCStringClass *x = new ScriptString;
if (x->CreateString (1) != 1)
__builtin_abort ();
return 0;
}
[hjl@gnu-6 tmp]$ g++ -shared -fpic -O2 -mcmodel=large -o libfoo.so foo1.cc
[hjl@gnu-6 tmp]$ g++ foo2.cc ./libfoo.so
[hjl@gnu-6 tmp]$ ./a.out
Segmentation fault
[hjl@gnu-6 tmp]$
But I am having a hard time to add it to gcc testsuite.
More information about the Gcc-bugs
mailing list