patches/gcc/4.0.0/pr20973-fix.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Feb 24 11:00:05 2007 +0000 (2007-02-24)
changeset 1 eeea35fbf182
permissions -rw-r--r--
Add the full crosstool-NG sources to the new repository of its own.
You might just say: 'Yeah! crosstool-NG's got its own repo!".
Unfortunately, that's because the previous repo got damaged beyond repair and I had no backup.
That means I'm putting backups in place in the afternoon.
That also means we've lost history... :-(
yann@1
     1
http://gcc.gnu.org/PR20973
yann@1
     2
yann@1
     3
"gcc 4 (about RC1) miscompiles khtml, in fact something in CSS, which basically 
yann@1
     4
leads to all websites being misrendered.  I can't easily reduce the testcase, 
yann@1
     5
but have applied the whole preprocessed source of css/cssstyleselector.ii. 
yann@1
     6
 
yann@1
     7
It is to be compiled with g++ -O2 -fPIC -march=i586 -mtune=i686 
yann@1
     8
-fno-exceptions.  A more detailed analysis will follow, as we've found out 
yann@1
     9
some things already."
yann@1
    10
yann@1
    11
---
yann@1
    12
yann@1
    13
Subject: Bug 20973
yann@1
    14
yann@1
    15
CVSROOT:	/cvs/gcc
yann@1
    16
Module name:	gcc
yann@1
    17
Branch: 	gcc-4_0-branch
yann@1
    18
Changes by:	matz@gcc.gnu.org	2005-04-22 17:30:21
yann@1
    19
yann@1
    20
Modified files:
yann@1
    21
	gcc            : ChangeLog reload.c 
yann@1
    22
yann@1
    23
Log message:
yann@1
    24
	PR middle-end/20973
yann@1
    25
	* reload.c (push_reload, find_dummy_reload): Check for uninitialized
yann@1
    26
	pseudos.
yann@1
    27
yann@1
    28
Patches:
yann@1
    29
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.177&r2=2.7592.2.178
yann@1
    30
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/reload.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.268&r2=1.268.2.1
yann@1
    31
yann@1
    32
---
yann@1
    33
yann@1
    34
===================================================================
yann@1
    35
RCS file: /cvs/gcc/gcc/gcc/reload.c,v
yann@1
    36
retrieving revision 1.268
yann@1
    37
retrieving revision 1.268.2.1
yann@1
    38
diff -u -r1.268 -r1.268.2.1
yann@1
    39
--- gcc/gcc/reload.c	2005/02/24 22:06:06	1.268
yann@1
    40
+++ gcc/gcc/reload.c	2005/04/22 17:30:15	1.268.2.1
yann@1
    41
@@ -1520,7 +1520,7 @@
yann@1
    42
      But if there is no spilling in this block, that is OK.
yann@1
    43
      An explicitly used hard reg cannot be a spill reg.  */
yann@1
    44
 
yann@1
    45
-  if (rld[i].reg_rtx == 0 && in != 0)
yann@1
    46
+  if (rld[i].reg_rtx == 0 && in != 0 && hard_regs_live_known)
yann@1
    47
     {
yann@1
    48
       rtx note;
yann@1
    49
       int regno;
yann@1
    50
@@ -1534,6 +1534,11 @@
yann@1
    51
 	    && REG_P (XEXP (note, 0))
yann@1
    52
 	    && (regno = REGNO (XEXP (note, 0))) < FIRST_PSEUDO_REGISTER
yann@1
    53
 	    && reg_mentioned_p (XEXP (note, 0), in)
yann@1
    54
+	    /* Check that we don't use a hardreg for an uninitialized
yann@1
    55
+	       pseudo.  See also find_dummy_reload().  */
yann@1
    56
+	    && (ORIGINAL_REGNO (XEXP (note, 0)) < FIRST_PSEUDO_REGISTER
yann@1
    57
+		|| ! bitmap_bit_p (ENTRY_BLOCK_PTR->global_live_at_end,
yann@1
    58
+				   ORIGINAL_REGNO (XEXP (note, 0))))
yann@1
    59
 	    && ! refers_to_regno_for_reload_p (regno,
yann@1
    60
 					       (regno
yann@1
    61
 						+ hard_regno_nregs[regno]
yann@1
    62
@@ -1997,7 +2002,17 @@
yann@1
    63
 				is a subreg, and in that case, out
yann@1
    64
 				has a real mode.  */
yann@1
    65
 			     (GET_MODE (out) != VOIDmode
yann@1
    66
-			      ? GET_MODE (out) : outmode)))
yann@1
    67
+			      ? GET_MODE (out) : outmode))
yann@1
    68
+        /* But only do all this if we can be sure, that this input
yann@1
    69
+           operand doesn't correspond with an uninitialized pseudoreg.
yann@1
    70
+           global can assign some hardreg to it, which is the same as
yann@1
    71
+	   a different pseudo also currently live (as it can ignore the
yann@1
    72
+	   conflict).  So we never must introduce writes to such hardregs,
yann@1
    73
+	   as they would clobber the other live pseudo using the same.
yann@1
    74
+	   See also PR20973.  */
yann@1
    75
+      && (ORIGINAL_REGNO (in) < FIRST_PSEUDO_REGISTER
yann@1
    76
+          || ! bitmap_bit_p (ENTRY_BLOCK_PTR->global_live_at_end,
yann@1
    77
+			     ORIGINAL_REGNO (in))))
yann@1
    78
     {
yann@1
    79
       unsigned int regno = REGNO (in) + in_offset;
yann@1
    80
       unsigned int nwords = hard_regno_nregs[regno][inmode];