This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/78460] [7/8 Regression] [SH] OOM building glibc string tst-cmp.c


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

--- Comment #6 from Joseph S. Myers <jsm28 at gcc dot gnu.org> ---
Author: jsm28
Date: Tue Aug 15 23:42:23 2017
New Revision: 251108

URL: https://gcc.gnu.org/viewcvs?rev=251108&root=gcc&view=rev
Log:
Limit SH strncmp inline expansion (PR target/78460).

GCC mainline built for sh4-linux-gnu runs out of memory building a
glibc test, which calls strncmp with very large constant size
argument, resulting in the SH inline strncmp expansion trying to
inline a fully unrolled expansion of strncmp for that size.

This patch limits that fully unrolled expansion to the case of less
than 32 bytes.  This is explicitly *not* trying to be optimal in any
way (very likely a lower threshold makes sense), just to limit enough
to avoid the out-of-memory issue in the glibc testsuite.

I have *not* run the GCC testsuite for SH.  I have verified that this
allows the glibc testsuite to build OK, with both GCC mainline and GCC
7 branch (and that the included test builds quickly with patched GCC,
runs out of memory with unpatched GCC).

        PR target/78460
        PR target/67712
gcc:
        * config/sh/sh-mem.cc (sh_expand_cmpnstr): Only unroll for
        constant count if that count is less than 32.

gcc/testsuite:
        * gcc.c-torture/compile/string-large-1.c: New test.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/string-large-1.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/sh/sh-mem.cc
    trunk/gcc/testsuite/ChangeLog

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]