From: Martin Liska Date: Mon, 11 Jun 2018 11:47:00 +0000 (+0200) Subject: Fix typo done in MPX removal (PR tree-optimization/86089). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2dcab30bf737912fab9acfa560282c50c1d65c91;p=gcc.git 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 --- 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) {