This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PR target/30383 (ICE in i386 stringops rewrite)


Hi,
the ICE is ccaused by middle end passing alignment of 0 to i386 backend for
string operations.  Since the representation of alignment here is in bytes,
value of 0 is not meaningful.  

This is caused by fact that LABEL_DECLs have alignment set to 1 (in bits) that
is almost certainly wrong.  The catch is that I am not quite sure where the
alignment shall be done - all labels seems to be build by build_decl and they
are never layouted like variables.

The following patch set initialization to make_node_stat that is already
special casing functions, so it might be good place for it.  I also have tested
alternative patch that simply makes i386 backend to tolerate this, but it seems
like middle-end omision and I don't think it is possible to construct particularly
evil different testcase where middle-end would be right to claim sub unit pointer
just because the argument is pointer.

Bootstrapped/regtested i686-linux, thanks to pinskia for testcase, OK?
 void jumpfunc(int copy, void *p)
{
__builtin_memcpy (p, &&dummy, 128);
 dummy: ;
}
	PR target/30383
	* tree.c (make_node_stat): Initialize alignments of labels.
Index: tree.c
===================================================================
*** tree.c	(revision 120528)
--- tree.c	(working copy)
*************** make_node_stat (enum tree_code code MEM_
*** 589,595 ****
  	DECL_IN_SYSTEM_HEADER (t) = in_system_header;
        if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
  	{
! 	  if (code != FUNCTION_DECL)
  	    DECL_ALIGN (t) = 1;
  	  DECL_USER_ALIGN (t) = 0;	  
  	  /* We have not yet computed the alias set for this declaration.  */
--- 589,597 ----
  	DECL_IN_SYSTEM_HEADER (t) = in_system_header;
        if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
  	{
! 	  if (code == LABEL_DECL)
! 	    DECL_ALIGN (t) = BITS_PER_UNIT;
! 	  else if (code != FUNCTION_DECL)
  	    DECL_ALIGN (t) = 1;
  	  DECL_USER_ALIGN (t) = 0;	  
  	  /* We have not yet computed the alias set for this declaration.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]