From 2dcab30bf737912fab9acfa560282c50c1d65c91 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 11 Jun 2018 13:47:00 +0200 Subject: [PATCH] Fix typo done in MPX removal (PR tree-optimization/86089). 2018-06-11 Martin Liska PR tree-optimization/86089 * tree-ssa-strlen.c (get_string_length): Move back removed hunk. 2018-06-11 Martin Liska PR tree-optimization/86089 * gcc.dg/tree-ssa/pr86089.c: New test. From-SVN: r261434 --- gcc/ChangeLog | 5 +++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/tree-ssa/pr86089.c | 13 +++++++++++++ gcc/tree-ssa-strlen.c | 6 +++++- 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr86089.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a046620b307..4032e6c079c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-06-11 Martin Liska + + PR tree-optimization/86089 + * tree-ssa-strlen.c (get_string_length): Move back removed hunk. + 2018-06-11 Julia Koval * config/i386/vaesintrin.h (_mm_aesdec_epi128, _mm_aesdeclast_epi128) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4d38f53ebaf..5c14949e1d7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-06-11 Martin Liska + + PR tree-optimization/86089 + * gcc.dg/tree-ssa/pr86089.c: New test. + 2018-06-11 Julia Koval * 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 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) { -- 2.30.2