diff mbox series

Fix typo done in MPX removal (PR tree-optimization/86089).

Message ID b572fbca-8612-2b37-d88c-d712704b23d8@suse.cz
State New
Headers show
Series Fix typo done in MPX removal (PR tree-optimization/86089). | expand

Commit Message

Martin Liška June 11, 2018, 7:05 a.m. UTC
Hi.

This is typo I did when MPX was removed. I'm moving back hunk with BUILT_IN_STPCPY_CHK.

Ready after testing?
Martin

gcc/ChangeLog:

2018-06-11  Martin Liska  <mliska@suse.cz>

        PR tree-optimization/86089
	* tree-ssa-strlen.c (get_string_length): Move back removed hunk.

gcc/testsuite/ChangeLog:

2018-06-11  Martin Liska  <mliska@suse.cz>

        PR tree-optimization/86089
	* gcc.dg/tree-ssa/pr86089.c: New test.
---
 gcc/testsuite/gcc.dg/tree-ssa/pr86089.c | 13 +++++++++++++
 gcc/tree-ssa-strlen.c                   |  6 +++++-
 2 files changed, 18 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr86089.c

Comments

Jakub Jelinek June 11, 2018, 10:15 a.m. UTC | #1
On Mon, Jun 11, 2018 at 09:05:26AM +0200, Martin Liška wrote:
> Hi.
> 
> This is typo I did when MPX was removed. I'm moving back hunk with BUILT_IN_STPCPY_CHK.
> 
> Ready after testing?
> Martin
> 
> gcc/ChangeLog:
> 
> 2018-06-11  Martin Liska  <mliska@suse.cz>
> 
>         PR tree-optimization/86089
> 	* tree-ssa-strlen.c (get_string_length): Move back removed hunk.
> 
> gcc/testsuite/ChangeLog:
> 
> 2018-06-11  Martin Liska  <mliska@suse.cz>
> 
>         PR tree-optimization/86089
> 	* gcc.dg/tree-ssa/pr86089.c: New test.

Ok, thanks.

	Jakub
diff mbox series

Patch

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr86089.c b/gcc/testsuite/gcc.dg/tree-ssa/pr86089.c
new file mode 100644
index 00000000000..58d542949cb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr86089.c
@@ -0,0 +1,13 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wall" } */
+
+extern char* stpcpy (char*, const char*);
+
+int f (char* s)
+{
+  char a[32];
+
+  __builtin___strcpy_chk (a, s, __builtin_object_size (a, 1));
+
+  return __builtin_strlen (a);
+}
diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c
index 804905d09a2..50562144078 100644
--- a/gcc/tree-ssa-strlen.c
+++ b/gcc/tree-ssa-strlen.c
@@ -617,8 +617,12 @@  get_string_length (strinfo *si)
 	  lhs = NULL_TREE;
 	  /* FALLTHRU */
 	case BUILT_IN_STRCPY:
+	case BUILT_IN_STRCPY_CHK:
 	  gcc_assert (builtin_decl_implicit_p (BUILT_IN_STPCPY));
-	  fn = builtin_decl_implicit (BUILT_IN_STPCPY);
+	  if (gimple_call_num_args (stmt) == 2)
+	    fn = builtin_decl_implicit (BUILT_IN_STPCPY);
+	  else
+	    fn = builtin_decl_explicit (BUILT_IN_STPCPY_CHK);
 	  gcc_assert (lhs == NULL_TREE);
 	  if (dump_file && (dump_flags & TDF_DETAILS) != 0)
 	    {