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]

[PATCH] Fix PR53937


We fail to handle constant addresses in get_pointer_alignment_1
so we use too pessimistic alignment when accessing a packed
structure via such a pointer.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Richard.

2012-07-13  Richard Guenther  <rguenther@suse.de>

	PR middle-end/53937
	* builtins.c (get_pointer_alignment_1): Handle constant
	pointers.

Index: gcc/builtins.c
===================================================================
--- gcc/builtins.c	(revision 189451)
+++ gcc/builtins.c	(working copy)
@@ -536,6 +536,13 @@ get_pointer_alignment_1 (tree exp, unsig
 	  return false;
 	}
     }
+  else if (TREE_CODE (exp) == INTEGER_CST)
+    {
+      *alignp = BIGGEST_ALIGNMENT;
+      *bitposp = ((TREE_INT_CST_LOW (exp) * BITS_PER_UNIT)
+		  & (BIGGEST_ALIGNMENT - 1));
+      return true;
+    }
 
   *bitposp = 0;
   *alignp = BITS_PER_UNIT;


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