Am Thu, 11 Jun 2015 22:30:39 +0200 schrieb "Iain Buclaw via D.gnu" <d.gnu@puremagic.com>:
> On 11 June 2015 at 20:27, Johannes Pfau via D.gnu > <d.gnu@puremagic.com> wrote: > > > Some recent change in GDC broke ARM cross compiler builds. Same > > error with gcc-5.1 and gcc-4.9: > > > > https://gist.github.com/jpf91/1de81d6ff55587d702ae > > > > I'm not sure if this only happens for ARM cross compilers or for all > > cross compilers. But it doesn't seem to happen with native builds > > (or maybe it's target specific and it doesn't happen for x86 > > builds). > > > > > > Iain, any clue what could cause this? Otherwise I'll have to debug > > this later on. > > > > The comment above says: > > If the DECL isn't in memory, then the DECL wasn't properly > marked TREE_ADDRESSABLE, which will be either a front-end > or a tree optimizer bug. > > Peek returns a ubyte[4] - so my initial guess would be the recent NRVO > change. Perhaps it wasn't quite as bullet-proof as I hoped. > Small update: It's indeed the NRVO changes, reduced test case: ------------------ private union EndianSwapper { uint value; ubyte[4] array; } struct CRC32 { public: @trusted pure nothrow finish() { auto tmp = peek(); return tmp; } @trusted pure nothrow peek() { EndianSwapper es; es.value = 0; return es.array; } } ------------------ Only happens with certain optimizations (-O or higher). Using -O -fno-tree-sra or -O -tree-no-inline hides the problem. Tree dump before crash: ------------------ finish (struct CRC32 & this) { union EndianSwapper es.0; <bb 2>: es.0 ={v} {CLOBBER}; MEM[(ubyte[4] *)&<retval>] = 0; return <retval>; }