Patch for PR 12072 (set constants generate wrong code)

Waldek Hebisch hebisch@math.uni.wroc.pl
Thu Aug 28 16:34:00 GMT 2003


In gcc-3.3.1 set constants may be compiled incorrectly -- backend
tries to emit identical constants only once, however in the
test for equality the result is reversed (so two constant
are unified when hashes are equal and constants are not equal).
The problem affects GNU Pascal (IMHO "standard" frontends do not use
sets so problem can not be reproduced with them). The patch below
fixes the problem. Tested on i686-pc-linux-gnu (bootstraped gcc+gpc).


ChangeLog:
        * fixes PR middle-end/12072 (set constants generate wrong code)

*** gcc-3.3.1.orig/gcc/varasm.c	Thu Jul 24 21:11:26 2003
--- gcc-3.3.1/gcc/varasm.c	Wed Aug 27 23:45:47 2003
*************** compare_constant (t1, t2)
*** 2411,2417 ****
  	  if (get_set_constructor_bytes (t2, tmp2, len) != NULL_TREE)
  	    return 0;
  
! 	  return memcmp (tmp1, tmp2, len) != 0;
  	}
        else
  	{
--- 2411,2417 ----
  	  if (get_set_constructor_bytes (t2, tmp2, len) != NULL_TREE)
  	    return 0;
  
! 	  return memcmp (tmp1, tmp2, len) == 0;
  	}
        else
  	{

-- 
                              Waldek Hebisch
hebisch@math.uni.wroc.pl    or hebisch@hera.math.uni.wroc.pl 



More information about the Gcc-patches mailing list