get memcpy EXC_BAD_ACCESS only with LTO on multi platform!

Innot Sagg donovinsbbkgbi at gmail.com
Sat Jul 18 03:48:26 UTC 2020


On Saturday, 18 July 2020 at 03:33:30 UTC, Kagamin wrote:
> Maybe the compiler can understand that new_ptr=1 and remove the 
> copy.

Thanks for replay. "new_ptr=1" is typo, the code already remove 
that line.


If i remove bitfields from Buffer struct, the error will gone.

This code will trigger LTO error:

struct Buffer {
    ubyte*	m_data;
    union {
	   ulong   m_placeholder;
	   uint	m_location;
	   mixin(bitfields!(
	             uint,    "",	32 ,
	             uint,    "m_size",	31 ,
	             bool,    "is_new",	1 ,
	   )) ;
	}
}

replace it to this will be no error:


struct Buffer {
    ubyte*	m_data;
    uint		m_location;
    uint         m_size;
    bool         is_new;
}


I am still not able to reduce it into minimal test case, because 
any small change in the code will made the errno disappear.






More information about the digitalmars-d-ldc mailing list