[PATCH][mem-ref2] Fix object-size

Richard Guenther rguenther@suse.de
Wed Mar 24 15:51:00 GMT 2010


This fixes most of the chk builtins and builtin-object size tests.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to the 
branch.

Richard.

2010-03-24  Richard Guenther  <rguenther@suse.de>

	* tree-object-size.c (compute_object_offset): Handle MEM_REF.

Index: mem-ref2/gcc/tree-object-size.c
===================================================================
--- mem-ref2.orig/gcc/tree-object-size.c	2010-03-24 15:41:11.000000000 +0100
+++ mem-ref2/gcc/tree-object-size.c	2010-03-24 15:41:16.000000000 +0100
@@ -140,6 +140,11 @@ compute_object_offset (const_tree expr,
       off = size_binop (MULT_EXPR, TYPE_SIZE_UNIT (TREE_TYPE (expr)), t);
       break;
 
+    case MEM_REF:
+      gcc_assert (TREE_CODE (TREE_OPERAND (expr, 0)) == ADDR_EXPR);
+      return TREE_OPERAND (expr, 1);
+      break;
+
     default:
       return error_mark_node;
     }



More information about the Gcc-patches mailing list