PR 78534 Reinstate better string copy algorithm
authorJanne Blomqvist <jb@gcc.gnu.org>
Wed, 31 Jan 2018 13:23:20 +0000 (15:23 +0200)
committerJanne Blomqvist <jb@gcc.gnu.org>
Wed, 31 Jan 2018 13:23:20 +0000 (15:23 +0200)
commit9f3dcd14146c29ca01507051ae9729a0f5569173
tree739ec9feba8359bb7b7537197f70e7ec4aa29bab
parent957a25ab0c76a2beb268aad005804da41e136c37
PR 78534 Reinstate better string copy algorithm

As part of the change to larger character lengths, the string copy
algorithm was temporarily pessimized to get around some spurious
-Wstringop-overflow warnings.  Having tried a number of variations of
this algorithm I have managed to get it down to one spurious warning,
only with -O1 optimization, in the testsuite.  This patch reinstates
the optimized variant and modifies this one testcase to ignore the
warning.

Regtested on x86_64-pc-linux-gnu.

gcc/fortran/ChangeLog:

2018-01-31  Janne Blomqvist  <jb@gcc.gnu.org>

PR fortran/78534
* trans-expr.c (fill_with_spaces): Use memset instead of
generating loop.
(gfc_trans_string_copy): Improve opportunity to use builtins with
constant lengths.

gcc/testsuite/ChangeLog:

2018-01-31  Janne Blomqvist  <jb@gcc.gnu.org>

PR fortran/78534
* gfortran.dg/allocate_deferred_char_scalar_1.f03: Prune
-Wstringop-overflow warnings due to spurious warning with -O1.
* gfortran.dg/char_cast_1.f90: Update dump scan pattern.
* gfortran.dg/transfer_intrinsic_1.f90: Likewise.

From-SVN: r257233
gcc/fortran/ChangeLog
gcc/fortran/trans-expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/allocate_deferred_char_scalar_1.f03
gcc/testsuite/gfortran.dg/char_cast_1.f90
gcc/testsuite/gfortran.dg/transfer_intrinsic_1.f90