Build problems on Solaris 2.5.1

Richard Earnshaw rearnsha@arm.com
Fri Nov 10 05:50:00 GMT 2000


All this is while trying to build an arm-elf cross compiler.

I'm not a sparc expert, so I may be missing something somewhere, but this 
change:

2000-11-03  Joseph S. Myers  <jsm28@cam.ac.uk>

        * c-decl.c (duplicate_decls, copy_lang_decl), dwarfout.c
        (dwarfout_line), gcc.c (main, save_string), tree.c (init_obstacks,
        perm_calloc, get_identifier, maybe_get_identifier,
        real_value_from_int_cst, simple_cst_equal), varasm.c
        (assemble_name, assemble_real, immed_real_const_1,
        compare_constant_1, decode_rtx_const, output_constant_pool): Use
        strrchr () instead of rindex ().  Use memcmp () instead of bcmp
        ().  Use memcpy () instead of bcopy ().  Use memset () instead of
        bzero ().

appears to be revealing a latent bug in the compiler.

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?

R.



More information about the Gcc-bugs mailing list