This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [m68k]: patch to fix m68k_output_mi_thunk() for ColdFire


Mark Mitchell wrote:
Bernardo Innocenti wrote:

Mark, I believe this patch is also needed on 3.4.
Without it, GCC may output invalid code for
ColdFire targets.

I can't find a specific PR, but I may file one if needed.

Please file a PR demonstrating the problem and attach the patch to it (or include a URL), and target the patch for 3.4.1.


Yes, the patch is needed for gcc 3.4 as well. here is code that allows to reproduce the problem. target m68k-elf, compile with -m5307:

    class FooA {
    public:
      virtual ~FooA () = 0;
      int data[100];
    };


class FooB { public: virtual void foo1 () = 0; void fooB () {foo1 ();} int data[100]; };


class FooC : public FooA, public FooB { public: virtual void foo1 () {} };


FooC* Test () { FooC* foc = new FooC; foc->fooB (); }

The thunk comes into play when FooB::fooB () calls the virtual
function foo1. While in FooB::fooB () the this pointer points
to FooB. Then when foo1 is called (which is overwridden by
FooC::foo1), the this pointer needs to be adjusted to point
to FooC, which is -404 in this example (the size of FooA).

Without the patch gcc generates "add.l #-404,4(%sp)" which is
not supported by ColdFire and rejected by the assembler.

I hope this helps,

Peter Jakubek
LaserAnimation Sollinger GmbH
peter@lasergraph-dsp.de






Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]