Build problems on Solaris 2.5.1

Richard Earnshaw rearnsha@arm.com
Fri Nov 10 07:36:00 GMT 2000


> The problem is decode_rtx_const, which tries to memset its VALUE argument.
> However, this has just been xmalloced (in record_constant_rtx) with
> 
> 
>       ptr = ((struct constant_descriptor *) 
>              xcalloc (1, 
>                       (sizeof (struct constant_descriptor) 
>                        + sizeof (struct rtx_const) - 1)));
>       decode_rtx_const (mode, x, (struct rtx_const *) ptr->contents);
> 
> Now the native compiler is optimizing the memset into two "std" 
> instructions.  Unfortunately, the pointer is only word aligned, not dword 
> aligned, so the std instruction is generating a bus error.
> 
> Now it looks to me that the code in record_constant_rtx is doing the dodgy 
> thing (since after all, it is messing around with casts), but I could be 
> wrong.  Is it reasonable to expect struct rtx_const to be dword aligned on 
> a sparc?
> 


Here's a patch

<date>  Richard Earnshaw (rearnsha@arm.com>

	* varasm.c (struct constant_descriptor): Put CONTENTS inside a
	union to make it well-aligned.  Update all uses.




More information about the Gcc-bugs mailing list