diff mbox series

use warning_n instead of _at (PR 84818)

Message ID 18e8395b-9a2c-da42-781b-4f1fb6fbc73d@gmail.com
State New
Headers show
Series use warning_n instead of _at (PR 84818) | expand

Commit Message

Martin Sebor March 29, 2018, 2:45 p.m. UTC
The attached patch replaces a couple of uses of warning_at
in builtins.c with the more appropriate warning_n calls as
suggested in the bug.

The change passes regression testing on x86_64-linux.  I'll
go ahead and commit it as obvious in the next day or so unless
there are objections.

Thanks
Martin
diff mbox series

Patch

PR tree-optimization/84818 - integer_onep must not be used for i18n

gcc/ChangeLog:

	PR tree-optimization/84818
	* builtins.c (check_access): Use warning_n.

Index: gcc/builtins.c
===================================================================
--- gcc/builtins.c	(revision 258941)
+++ gcc/builtins.c	(working copy)
@@ -3172,13 +3172,12 @@  check_access (tree exp, tree, tree, tree dstwrite,
 			  exp, func, range[0], dstsize);
 	    }
 	  else if (tree_int_cst_equal (range[0], range[1]))
-	    warning_at (loc, opt,
-			(integer_onep (range[0])
-			 ? G_("%K%qD writing %E byte into a region "
-			      "of size %E overflows the destination")
-			 : G_("%K%qD writing %E bytes into a region "
-			      "of size %E overflows the destination")),
-			exp, func, range[0], dstsize);
+	    warning_n (loc, opt, tree_to_uhwi (range[0]),
+		       "%K%qD writing %E byte into a region "
+		       "of size %E overflows the destination",
+		       "%K%qD writing %E bytes into a region "
+		       "of size %E overflows the destination",
+		       exp, func, range[0], dstsize);
 	  else if (tree_int_cst_sign_bit (range[1]))
 	    {
 	      /* Avoid printing the upper bound if it's invalid.  */
@@ -3273,10 +3272,9 @@  check_access (tree exp, tree, tree, tree dstwrite,
       location_t loc = tree_nonartificial_location (exp);
 
       if (tree_int_cst_equal (range[0], range[1]))
-	warning_at (loc, opt,
-		    (tree_int_cst_equal (range[0], integer_one_node)
-		     ? G_("%K%qD reading %E byte from a region of size %E")
-		     : G_("%K%qD reading %E bytes from a region of size %E")),
+	warning_n (loc, opt, tree_to_uhwi (range[0]),
+		   "%K%qD reading %E byte from a region of size %E",
+		   "%K%qD reading %E bytes from a region of size %E",
 		    exp, func, range[0], slen);
       else if (tree_int_cst_sign_bit (range[1]))
 	{