Patchwork Fix PR62292

login
register
mail settings
Submitter Richard Guenther
Date Aug. 29, 2014, 8:05 a.m.
Message ID <alpine.LSU.2.11.1408291005120.20733@zhemvz.fhfr.qr>
Download mbox | patch
Permalink /patch/384082/
State New
Headers show

Comments

Richard Guenther - Aug. 29, 2014, 8:05 a.m.
The refactoring had two errors, fixed as below.

Boostrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2014-08-29  Richard Biener  <rguenther@suse.de>

	* gimple-fold.c (gimple_fold_builtin_strcpy): Fix error
	from previous refactoring.
	(gimple_fold_builtin_strncpy): Likewise.

Patch

Index: gcc/gimple-fold.c
===================================================================
--- gcc/gimple-fold.c	(revision 214680)
+++ gcc/gimple-fold.c	(working copy)
@@ -1440,7 +1440,7 @@  gimple_fold_builtin_strcpy (gimple_stmt_
   if (!fn)
     return false;
 
-  tree len = get_maxval_strlen (src, 1);
+  tree len = get_maxval_strlen (src, 0);
   if (!len)
     return false;
 
@@ -1477,7 +1477,7 @@  gimple_fold_builtin_strncpy (gimple_stmt
     return false;
 
   /* Now, we must be passed a constant src ptr parameter.  */
-  tree slen = get_maxval_strlen (src, 1);
+  tree slen = get_maxval_strlen (src, 0);
   if (!slen || TREE_CODE (slen) != INTEGER_CST)
     return false;