Fix D compilation on Solaris

Iain Buclaw ibuclaw@gdcproject.org
Tue Oct 30 19:00:00 GMT 2018


On Tue, 30 Oct 2018 at 14:13, Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
>
> Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
>
> > * On sparc, I didn't get that far, unfortunately: as I mentioned, many
> >   compilations die with SIGBUS:
> >
> > libtool: compile:  /var/gcc/regression/trunk/11.5-gcc/build/./gcc/gdc -B/var/gcc/regression/trunk/11.5-gcc/build/./gcc/ -B/vol/gcc/sparc-sun-solaris2.11/bin/ -B/vol/gcc/sparc-sun-solaris2.11/lib/ -isystem /vol/gcc/sparc-sun-solaris2.11/include -isystem /vol/gcc/sparc-sun-solaris2.11/sys-include -fno-checking -fPIC -O2 -g -nostdinc -I /vol/gcc/src/hg/trunk/local/libphobos/libdruntime -I . -c /vol/gcc/src/hg/trunk/local/libphobos/libdruntime/core/thread.d -fversion=Shared -o core/.libs/thread.o
> > d21: internal compiler error: Bus Error
> > 0xbb5507 crash_signal
> >         /vol/gcc/src/hg/trunk/local/gcc/toplev.c:325
> > 0x518700 IntegerExp::toInteger()
> >         /vol/gcc/src/hg/trunk/local/gcc/d/dmd/expression.c:2943
> > 0x4d05c3 interpret
> >         /vol/gcc/src/hg/trunk/local/gcc/d/dmd/dinterpret.c:5984
> > 0x4d1543 interpret
> >         /vol/gcc/src/hg/trunk/local/gcc/d/dmd/dinterpret.c:6017
> > 0x4d1543 interpret(Statement*, InterState*)
> >         /vol/gcc/src/hg/trunk/local/gcc/d/dmd/dinterpret.c:6024
> > 0x4d263b interpretFunction
> >         /vol/gcc/src/hg/trunk/local/gcc/d/dmd/dinterpret.c:906
> > 0x4d263b interpretFunction
> >         /vol/gcc/src/hg/trunk/local/gcc/d/dmd/dinterpret.c:726
> > 0x4d05c3 interpret
> >         /vol/gcc/src/hg/trunk/local/gcc/d/dmd/dinterpret.c:5984
> > 0x4d14df interpret(Expression*, InterState*, CtfeGoal)
> >         /vol/gcc/src/hg/trunk/local/gcc/d/dmd/dinterpret.c:5994
> > 0x4d05c3 interpret
> >         /vol/gcc/src/hg/trunk/local/gcc/d/dmd/dinterpret.c:5984
> > 0x4d14df interpret(Expression*, InterState*, CtfeGoal)
> >         /vol/gcc/src/hg/trunk/local/gcc/d/dmd/dinterpret.c:5994
> > 0x5243d7 DeclarationExp::accept(Visitor*)
> >         /vol/gcc/src/hg/trunk/local/gcc/d/dmd/expression.h:661
> > 0x4d05c3 interpret
> >         /vol/gcc/src/hg/trunk/local/gcc/d/dmd/dinterpret.c:5984
> > 0x4d1543 interpret
> >         /vol/gcc/src/hg/trunk/local/gcc/d/dmd/dinterpret.c:6017
> > 0x4d1543 interpret(Statement*, InterState*)
> >         /vol/gcc/src/hg/trunk/local/gcc/d/dmd/dinterpret.c:6024
> > 0x4d263b interpretFunction
> >         /vol/gcc/src/hg/trunk/local/gcc/d/dmd/dinterpret.c:906
> > 0x4d263b interpretFunction
> >         /vol/gcc/src/hg/trunk/local/gcc/d/dmd/dinterpret.c:726
> > 0x4d05c3 interpret
> >         /vol/gcc/src/hg/trunk/local/gcc/d/dmd/dinterpret.c:5984
> > 0x4d14df interpret(Expression*, InterState*, CtfeGoal)
> >         /vol/gcc/src/hg/trunk/local/gcc/d/dmd/dinterpret.c:5994
> > 0x4d05c3 interpret
> >         /vol/gcc/src/hg/trunk/local/gcc/d/dmd/dinterpret.c:5984
> >
> >   Will need to dig further here.
>
> It's exactly as I suspected:
>
> $ d21 /vol/gcc/src/hg/trunk/local/libphobos/libdruntime/core/thread.d -mcpu=v9 -fversion=Shared -I /vol/gcc/src/hg/trunk/local/libphobos/libdruntime -o thread.s
>

Hi Rainer,

Thanks for looking into this.

My first suspect here would be 'struct UnionExp', see d/dmd/expression.h

Upstream dmd use a poor man's alignment, from what I recall to be
compatible with the dmc compiler.

        // Ensure that the union is suitably aligned.
        real_t for_alignment_only;

What happens if you were to replace that with marking the type as
__attribute__ ((aligned (8))) ?

-- 
Iain



More information about the Gcc-patches mailing list