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]

Re: PR c++/35652 [4.2/4.3/4.4 Regression] offset warning should be given in the front-end


On Fri, Feb 06, 2009 at 04:53:10AM +0100, Manuel López-Ibáñez wrote:
> +	  else
> +	    offset = tree_low_cst (offset_node, 0);
> +
> +	  offset = offset + tree_low_cst (intop, 0);
> +	  if (offset < 0 || offset > max)
> +	    warning_at (location, 0,
> +			"offset %<%ld%> outside bounds of constant string",
> +			tree_low_cst (intop, 0));
> +	}
> +    }
> +

tree_low_cst returns HOST_WIDE_INT. We need HOST_WIDE_INT_PRINT_DEC
insted of %ld. I am checking in this patch.


H.J.
----
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 145107)
+++ ChangeLog	(working copy)
@@ -1,3 +1,8 @@
+2009-03-27  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* c-common.c (pointer_int_sum): Use HOST_WIDE_INT_PRINT_DEC
+	on return from tree_low_cst.
+
 2009-03-27  Andrew Pinski  <andrew_pinski@playstation.sony.com>
 
 	PR c++/36799
Index: c-common.c
===================================================================
--- c-common.c	(revision 145107)
+++ c-common.c	(working copy)
@@ -3315,8 +3315,8 @@ pointer_int_sum (location_t location, en
 
 	  offset = offset + tree_low_cst (intop, 0);
 	  if (offset < 0 || offset > max)
-	    warning_at (location, 0,
-			"offset %<%ld%> outside bounds of constant string",
+	    warning_at (location, 0, "offset %<" HOST_WIDE_INT_PRINT_DEC
+			"%> outside bounds of constant string",
 			tree_low_cst (intop, 0));
 	}
     }


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