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]

Crash in alias.c


While playing with the loop patch (see my previous email), I got a
segmentation fault in find_base_value. This function uses REGNO(src) to
index into new_reg_base_value without checking that this regno is within
the range of the array. Since I couldn't convince myself that this shouldn't
be able to happen, I added the following test.

Bernd

	* alias.c (find_base_value, case REG): Avoid crash if REGNO (src)
	out of bounds for new_reg_base_value.

diff -u -r1.1.1.16 alias.c
--- alias.c	1998/05/26 15:23:12	1.1.1.16
+++ alias.c	1998/05/27 15:08:58
@@ -115,6 +115,9 @@
       return src;
 
     case REG:
+      if (REGNO (src) >= reg_base_value_size)
+	return src;
+
       /* At the start of a function argument registers have known base
 	 values which may be lost later.  Returning an ADDRESS
 	 expression here allows optimization based on argument values


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