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.
From-SVN: r251109
Backport from mainline
2017-08-09 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/79820
PR libstdc++/81751
* config/io/basic_file_stdio.cc (sys_open(FILE*, ios_base::openmode)):
Call fflush on the stream instead of calling sync() while _M_cfile is
null. Restore original value of errno.
* testsuite/ext/stdio_filebuf/char/79820.cc: New.
* testsuite/ext/stdio_filebuf/char/81751.cc: New.
From-SVN: r251090
2017-08-08 Richard Biener <rguenther@suse.de>
PR middle-end/81766
* function.c (thread_prologue_and_epilogue_insns): Restore
behavior of always calling find_many_sub_basic_blocks on
the inserted prologue.
* gcc.target/i386/pr81766.c: New testcase.
From-SVN: r250958
When finalizing the methods of a named struct type, we used to
finalize all the field types first. That can fail if the field types
refer indirectly to the named type. Change it to just finalize the
embedded field types first, and the rest of the fields later.
Fixesgolang/go#21253
Reviewed-on: https://go-review.googlesource.com/52570
From-SVN: r250833
PR tree-optimization/81655
PR tree-optimization/81588
* gcc.dg/tree-ssa/pr81588.c: Use -mbranch-cost=2 where possible,
don't run the test on branch-cost=1 targets.
From-SVN: r250819
PR middle-end/79499
* function.c (thread_prologue_and_epilogue_insns): Determine blocks
for find_many_sub_basic_blocks bitmap by looking up BLOCK_FOR_INSN
of first NONDEBUG_INSN_P in each of the split_prologue_seq and
prologue_seq sequences - if any.
* gcc.dg/pr79499.c: New test.
From-SVN: r250815
PR target/81641
* config/i386/i386.c (ix86_print_operand_address_as): For -masm=intel
print "ds:" only for immediates in generic address space.
testsuite/ChangeLog:
PR target/81641
* gcc.target/i386/pr81641.c: New test.
From-SVN: r250801
PR target/81622
* config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): For
__builtin_vec_cmpne verify both arguments are compatible vectors
before looking at TYPE_MODE on the element type. For __builtin_vec_ld
verify arg1_type is a pointer or array type. For __builtin_vec_st,
move computation of aligned to after checking the argument types.
Formatting fixes.
* gcc.target/powerpc/pr81622.c: New test.
From-SVN: r250787
2017-08-01 Martin Liska <mliska@suse.cz>
Backport from mainline
2017-07-26 Martin Liska <mliska@suse.cz>
PR gcov-profile/81561
* gcov.c (unblock): Make unblocking safe as we need to preserve
index correspondence of blocks and block_lists.
From-SVN: r250782
2017-08-01 Richard Biener <rguenther@suse.de>
PR tree-optimization/71752
PR tree-optimization/81633
* tree-vect-slp.c (vect_get_slp_defs): Handle null operands
in the original suggested way.
* gcc.dg/vect/pr81633.c: New testcase.
From-SVN: r250779
2017-08-01 Richard Sandiford <richard.sandiford@linaro.org>
gcc/
PR tree-optimization/80769
* tree-ssa-strlen.c (strinfo): Document that "stmt" is also used
for malloc and calloc. Document the new invariant that all related
strinfos have delayed lengths or none do.
(get_next_strinfo): New function.
(verify_related_strinfos): Move earlier in file.
(set_endptr_and_length): New function, split out from...
(get_string_length): ...here. Also set the lengths of related
strinfos.
gcc/testsuite/
PR tree-optimization/80769
* gcc.dg/strlenopt-31.c: New test.
* gcc.dg/strlenopt-31g.c: Likewise.
From-SVN: r250772
PR tree-optimization/81588
* tree-ssa-reassoc.c (optimize_range_tests_var_bound): If
ranges[i].in_p, invert comparison code ccode. For >/>=,
swap rhs1 and rhs2 and comparison code unconditionally,
for </<= don't do that. Don't swap rhs1/rhs2 again if
ranges[i].in_p, instead invert comparison code ccode if
opcode or oe->rank is BIT_IOR_EXPR.
* gcc.dg/tree-ssa/pr81588.c: New test.
* gcc.dg/pr81588.c: New test.
* gcc.c-torture/execute/pr81588.c: New test.
From-SVN: r250761
With IBM z14 officially announced we can add support for z14 as
preferred CPU name. We still pass arch12 to Binutils in order to keep
older Binutils versions supported.
gcc/ChangeLog:
2017-07-31 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
Backport from mainline
2017-07-31 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* config.gcc: Add z14.
* config/s390/driver-native.c (s390_host_detect_local_cpu): Add
CPU model numbers for z13s and z14.
* config/s390/s390-c.c (s390_resolve_overloaded_builtin): Replace
arch12 with z14.
* config/s390/s390-opts.h (enum processor_type): Rename
PROCESSOR_ARCH12 to PROCESSOR_3906_Z14.
* config/s390/s390.c (processor_table): Add field for CPU name to
be passed to Binutils.
(s390_asm_output_machine_for_arch): Use the new field in
processor_table for Binutils.
(s390_expand_builtin): Replace arch12 with z14.
(s390_issue_rate): Rename PROCESSOR_ARCH12 to PROCESSOR_3906_Z14.
(s390_get_sched_attrmask): Likewise.
(s390_get_unit_mask): Likewise.
* config/s390/s390.opt: Add z14 to processor_type enum.
From-SVN: r250740
PR sanitizer/81604
* ubsan.c (ubsan_type_descriptor): For UBSAN_PRINT_ARRAY don't
change type to the element type, instead add eltype variable and
use it where we are interested in the element type.
* c-c++-common/ubsan/pr81604.c: New test.
From-SVN: r250729
Backport from mainline
2017-07-25 David Edelsohn <dje.gcc@gmail.com>
* dwarf2asm.c (dw2_asm_output_nstring): Encode double quote
character for AIX.
* dwarf2out.c (output_macinfo): Copy debug_line_section_label
to dl_section_ref. On AIX, append an expression to subtract
the size of the section length to dl_section_ref.
From-SVN: r250663
Backport from mainline r250496
2017-07-25 Bin Cheng <bin.cheng@arm.com>
PR target/81414
* config/aarch64/cortex-a57-fma-steering.c (analyze): Skip fmul/fmac
instructions if no du chain is found.
* gcc.target/aarch64/pr81414.C: New.
From-SVN: r250657