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]

[PATCH] Fix execute/980205 on 32bit SPARC


Hi!

If -O0, reload may happily store %fp + non-8-aligned const into some stack
slot, load it then again and mem_min_alignment will assume it is 8 byte
aligned which results in SIGBUS.

2000-03-21  Jakub Jelinek  <jakub@redhat.com>

	* config/sparc/sparc.c (mem_min_alignment): If not optimizing,
	we cannot be sure that if reload completed base register will
	be properly aligned.

--- gcc/config/sparc/sparc.c.jj	Tue Mar 21 17:47:52 2000
+++ gcc/config/sparc/sparc.c	Tue Mar 21 17:47:16 2000
@@ -2935,9 +2935,11 @@ mem_min_alignment (mem, desired)
 	{
 	  /* Check if the compiler has recorded some information
 	     about the alignment of the base REG.  If reload has
-	     completed, we already matched with proper alignments.  */
+	     completed, we already matched with proper alignments.
+	     If not running global_alloc, reload might give us
+	     unaligned pointer to local stack though.  */
 	  if (((cfun != 0 && REGNO_POINTER_ALIGN (regno) >= desired)
-	       || reload_completed)
+	       || (optimize && reload_completed))
 	      && ((INTVAL (offset) & (desired - 1)) == 0))
 	    return 1;
 	}

Cheers,
    Jakub
___________________________________________________________________
Jakub Jelinek | jakub@redhat.com | http://sunsite.mff.cuni.cz/~jj
Linux version 2.3.99-pre2 on a sparc64 machine (1343.49 BogoMips)
___________________________________________________________________

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