https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78534

--- Comment #26 from Janne Blomqvist <jb at gcc dot gnu.org> ---
Author: jb
Date: Wed Jan 31 13:23:20 2018
New Revision: 257233

URL: https://gcc.gnu.org/viewcvs?rev=257233&root=gcc&view=rev
Log:
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  <j...@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  <j...@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.

Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-expr.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/allocate_deferred_char_scalar_1.f03
    trunk/gcc/testsuite/gfortran.dg/char_cast_1.f90
    trunk/gcc/testsuite/gfortran.dg/transfer_intrinsic_1.f90

Reply via email to