Fix typo done in MPX removal (PR tree-optimization/86089).
authorMartin Liska <mliska@suse.cz>
Mon, 11 Jun 2018 11:47:00 +0000 (13:47 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Mon, 11 Jun 2018 11:47:00 +0000 (11:47 +0000)
2018-06-11  Martin Liska  <mliska@suse.cz>

        PR tree-optimization/86089
* tree-ssa-strlen.c (get_string_length): Move back removed hunk.
2018-06-11  Martin Liska  <mliska@suse.cz>

        PR tree-optimization/86089
* gcc.dg/tree-ssa/pr86089.c: New test.

From-SVN: r261434

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/pr86089.c [new file with mode: 0644]
gcc/tree-ssa-strlen.c

index a046620b30762d45f931c0b43b132e93b297a0d6..4032e6c079cba12ca4eab47d5a36b6ae6a2f5e5c 100644 (file)
@@ -1,3 +1,8 @@
+2018-06-11  Martin Liska  <mliska@suse.cz>
+
+        PR tree-optimization/86089
+       * tree-ssa-strlen.c (get_string_length): Move back removed hunk.
+
 2018-06-11  Julia Koval  <julia.koval@intel.com>
 
        * config/i386/vaesintrin.h (_mm_aesdec_epi128, _mm_aesdeclast_epi128)
index 4d38f53ebaf1c302a18e8fd3ed7df51f59c283e8..5c14949e1d7c65ae939f1eef21b628fe7f4e834d 100644 (file)
@@ -1,3 +1,8 @@
+2018-06-11  Martin Liska  <mliska@suse.cz>
+
+        PR tree-optimization/86089
+       * gcc.dg/tree-ssa/pr86089.c: New test.
+
 2018-06-11  Julia Koval  <julia.koval@intel.com>
 
        * gcc.target/i386/avx512fvl-vaes-1.c: Remove 128bit versions from test.
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr86089.c b/gcc/testsuite/gcc.dg/tree-ssa/pr86089.c
new file mode 100644 (file)
index 0000000..58d5429
--- /dev/null
@@ -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);
+}
index 804905d09a28a0c7eda3bcded641b6b8a7e2ffba..50562144078b391e72b59d368a8f19c0c1695176 100644 (file)
@@ -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)
            {