https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63815
--- Comment #11 from Uroš Bizjak <ubizjak at gmail dot com> --- (In reply to H.J. Lu from comment #10) > But I am having a hard time to add it to gcc testsuite. IMO, the following should be sufficient: --cut here-- Index: g++.dg/other/pr63815.C =================================================================== --- g++.dg/other/pr63815.C (revision 0) +++ g++.dg/other/pr63815.C (working copy) @@ -0,0 +1,50 @@ +// PR target/63815 +// { dg-do run { target { { i?86-*-* x86_64-*-* } && lp64 } } } +// { dg-options "-mcmodel=large" } +// { dg-additional-options "-fpic" { target fpic } } + +struct ICCStringClass +{ + virtual int CreateString (int) = 0; +}; + +struct AGSCCDynamicObject +{ + virtual void Unserialize () = 0; +}; + +struct ScriptString:AGSCCDynamicObject, ICCStringClass +{ + virtual int CreateString (int); + virtual void Unserialize (); +}; + +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 () +{ +} + +int +main () +{ + ICCStringClass *x = new ScriptString; + + if (x->CreateString (1) != 1) + __builtin_abort (); + return 0; +} --cut here-- Currently, this test crashes, and when fixed, there is little chance that the (allocatable) PIC register from main equals r11 in the thunk.