1. 28 Jan, 2020 27 commits
    • Increase GFC_MAX_MANGLED_SYMBOL_LEN to handle submodule names. · ad690d79
              PR fortran/93461
              * trans.h: Increase GFC_MAX_MANGLED_SYMBOL_LEN to
              GFC_MAX_SYMBOL_LEN*3+5 to allow for inclusion of submodule name,
              plus the "." between module and submodule names.
              * gfortran.dg/pr93461.f90: New test.
      Andrew Benson committed
    • Allow concatenated module+submodule names. · a83b5cc5
      Increase length of char variables "parent1" and "parent2" in
      set_syms_host_assoc() to allow them to hold concatenated module +
      submodule names.
      
              PR fortran/93473
              * parse.c: Increase length of char variables to allow them to hold
              a concatenated module + submodule name.
              * gfortran.dg/pr93473.f90: New test.
      Andrew Benson committed
    • preprocessor: Make __has_include a builtin macro [PR93452] · 3d056cbf
      The clever hack of '#define __has_include __has_include' breaks -dD
      and -fdirectives-only, because that emits definitions.  This turns
      __has_include into a proper builtin macro.  Thus it's never emitted
      via -dD, and because use outside of directive processing is undefined,
      we can just expand it anywhere.
      
      	PR preprocessor/93452
      	* internal.h (struct spec_nodes): Drop n__has_include{,_next}.
      	* directives.c (lex_macro_node): Don't check __has_include redef.
      	* expr.c (eval_token): Drop __has_include eval.
      	(parse_has_include): Move to ...
      	* macro.c (builtin_has_include): ... here.
      	(_cpp_builtin_macro_text): Eval __has_include{,_next}.
      	* include/cpplib.h (enum cpp_builtin_type): Add BT_HAS_INCLUDE{,_NEXT}.
      	* init.c (builtin_array): Add them.
      	(cpp_init_builtins): Drop __has_include{,_next} init here ...
      	* pch.c (cpp_read_state): ... and here.
      	* traditional.c (enum ls): Drop has_include states ...
      	(_cpp_scan_out_logical_line): ... and here.
      Nathan Sidwell committed
    • libstdc++: Fix order of changelog entries · a5d81aaa
      Rebasing my last two commits put the changelog entries at the wrong
      place in the file. Fixed by this change.
      Jonathan Wakely committed
    • c++: Function declared with typedef with eh-specification. · 0968f7da
      We just need to handle the exception specification like other properties of
      a function typedef.
      
      	PR c++/90731
      	* decl.c (grokdeclarator): Propagate eh spec from typedef.
      Jason Merrill committed
    • Check array contiguity for OpenACC/Fortran · a5ed4958
      	PR fortran/93025
      
      	gcc/fortran/
      	* openmp.c (resolve_omp_clauses): Check array references for contiguity.
      
      	gcc/testsuite/
      	* gfortran.dg/goacc/mapping-tests-2.f90: New test.
      	* gfortran.dg/goacc/subarrays.f95: Expect rejection of non-contiguous
      	array.
      Julian Brown committed
    • Don't allow mixed component and non-component accesses for OpenACC/Fortran · 278c3214
      	gcc/fortran/
      	* gfortran.h (gfc_symbol): Add comp_mark bitfield.
      	* openmp.c (resolve_omp_clauses): Disallow mixed component and
      	full-derived-type accesses to the same variable within a single
      	directive.
      
      	libgomp/
      	* testsuite/libgomp.oacc-fortran/deep-copy-2.f90: Remove test from here.
      	* testsuite/libgomp.oacc-fortran/deep-copy-3.f90: Don't use mixed
      	component/non-component variable refs in a single directive.
      	* testsuite/libgomp.oacc-fortran/classtypes-1.f95: Likewise.
      
      	gcc/testsuite/
      	* gfortran.dg/goacc/deep-copy-2.f90: Move test here (from libgomp
      	testsuite). Make a compilation test, and expect rejection of mixed
      	component/non-component accesses.
      	* gfortran.dg/goacc/mapping-tests-1.f90: New test.
      Julian Brown committed
    • Add OpenACC test for sub-references being pointer or allocatable variables · 99b9f5b4
      	gcc/testsuite/
      	* gfortran.dg/goacc/strided-alloc-ptr.f90: New test.
      Julian Brown committed
    • libstdc++: Avoid using sizeof with function types (PR 93470) · 72a9fd20
      	PR libstdc++/93470
      	* include/bits/refwrap.h (reference_wrapper::operator()): Restrict
      	static assertion to object types.
      Jonathan Wakely committed
    • libstdc++: Replace glibc-specific check for clock_gettime (PR 93325) · 759812fd
      It's wrong to assume that clock_gettime is unavailable on any *-*-linux*
      target that doesn't have glibc 2.17 or later. Use a generic test instead
      of using __GLIBC_PREREQ. Only do that test when is_hosted=yes so that we
      don't get an error for cross targets without a working linker.
      
      This ensures that C library's clock_gettime will be used on non-glibc
      targets, instead of an incorrect syscall to SYS_clock_gettime.
      
      	PR libstdc++/93325
      	* acinclude.m4 (GLIBCXX_ENABLE_LIBSTDCXX_TIME): Use AC_SEARCH_LIBS for
      	clock_gettime instead of explicit glibc version check.
      	* configure: Regenerate.
      Jonathan Wakely committed
    • tree-optimization/93439 move clique bookkeeping to OMP expansion · 6c42e27c
      Autopar was doing clique bookkeeping too early when creating destination
      functions but then later introducing new cliques via versioning loops.
      The following moves the bookkeeping to the actual outlining process.
      
      2020-01-28  Richard Biener  <rguenther@suse.de>
      
      	PR tree-optimization/93439
      	* tree-parloops.c (create_loop_fn): Move clique bookkeeping...
      	* tree-cfg.c (move_sese_region_to_fn): ... here.
      	(verify_types_in_gimple_reference): Verify used cliques are
      	tracked.
      
      	* gfortran.dg/graphite/pr93439.f90: New testcase.
      Richard Biener committed
    • i386: Don't use ix86_tune_ctrl_string in parse_mtune_ctrl_str · 1e964774
      There are
      
      static void
      parse_mtune_ctrl_str (bool dump)
      {
        if (!ix86_tune_ctrl_string)
          return;
      
      parse_mtune_ctrl_str is only called from set_ix86_tune_features, which
      is only called from ix86_function_specific_restore and
      ix86_option_override_internal.  parse_mtune_ctrl_str shouldn't use
      ix86_tune_ctrl_string which is defined with global_options.  Instead,
      opts should be passed to parse_mtune_ctrl_str.
      
      	PR target/91399
      	* config/i386/i386-options.c (set_ix86_tune_features): Add an
      	argument of a pointer to struct gcc_options and pass it to
      	parse_mtune_ctrl_str.
      	(ix86_function_specific_restore): Pass opts to
      	set_ix86_tune_features.
      	(ix86_option_override_internal): Likewise.
      	(parse_mtune_ctrl_str): Add an argument of a pointer to struct
      	gcc_options and use it for x_ix86_tune_ctrl_string.
      H.J. Lu committed
    • [ARC] Pass along -mcode-density flag to the assembler. · 92860593
      This change makes sure that if the driver is invoked with
      "-mcode-density" flag, then the assembler will receive it too.
      
      Note Claudiu Zissulescu:
      This is an old patch of which I forgot to add the test.
      
      testsuite/
      2019-09-03  Sahahb Vahedi  <shahab@synopsys.com>
      
              * gcc.target/arc/code-density-flag.c: New test.
      Claudiu Zissulescu committed
    • simplify-rtx: Extend (truncate (*extract ...)) fold [PR87763] · 465c7c89
      In the gcc.target/aarch64/lsl_asr_sbfiz.c part of this PR, we have:
      
      Failed to match this instruction:
      (set (reg:SI 95)
          (ashift:SI (subreg:SI (sign_extract:DI (subreg:DI (reg:SI 97) 0)
                      (const_int 3 [0x3])
                      (const_int 0 [0])) 0)
              (const_int 19 [0x13])))
      
      If we perform the natural simplification to:
      
      (set (reg:SI 95)
          (ashift:SI (sign_extract:SI (reg:SI 97)
                      (const_int 3 [0x3])
                      (const_int 0 [0])) 0)
              (const_int 19 [0x13])))
      
      then the pattern matches.  And it turns out that we do have a
      simplification like that already, but it would only kick in for
      extractions from a reg, not a subreg.  E.g.:
      
      (set (reg:SI 95)
          (ashift:SI (subreg:SI (sign_extract:DI (reg:DI X)
                      (const_int 3 [0x3])
                      (const_int 0 [0])) 0)
              (const_int 19 [0x13])))
      
      would simplify to:
      
      (set (reg:SI 95)
          (ashift:SI (sign_extract:SI (subreg:SI (reg:DI X) 0)
                      (const_int 3 [0x3])
                      (const_int 0 [0])) 0)
              (const_int 19 [0x13])))
      
      IMO the subreg case is even more obviously a simplification
      than the bare reg case, since the net effect is to remove
      either one or two subregs, rather than simply change the
      position of a subreg/truncation.
      
      However, doing that regressed gcc.dg/tree-ssa/pr64910-2.c
      for -m32 on x86_64-linux-gnu, because we could then simplify
      a :HI zero_extract to a :QI one.  The associated *testqi_ext_3
      pattern did already seem to want to handle QImode extractions:
      
        "ix86_match_ccmode (insn, CCNOmode)
         && ((TARGET_64BIT && GET_MODE (operands[2]) == DImode)
             || GET_MODE (operands[2]) == SImode
             || GET_MODE (operands[2]) == HImode
             || GET_MODE (operands[2]) == QImode)
      
      but I'm not sure how often the QI case would trigger in practice,
      since the zero_extract mode was restricted to HI and above.  I checked
      the other x86 patterns and couldn't see any other instances of this.
      
      2020-01-28  Richard Sandiford  <richard.sandiford@arm.com>
      
      gcc/
      	PR rtl-optimization/87763
      	* simplify-rtx.c (simplify_truncation): Extend sign/zero_extract
      	simplification to handle subregs as well as bare regs.
      	* config/i386/i386.md (*testqi_ext_3): Match QI extracts too.
      Richard Sandiford committed
    • vect: Pattern-matched calls in reduction chains · 1e26ff73
      gcc.dg/pr56350.c started ICEing for SVE in GCC 10 because we
      pattern-matched a division reduction:
      
            a /= 8;
      
      into a signed shift with division semantics:
      
            ... = IFN_SDIV_POW2 (..., 3);
      
      whereas the reduction code expected it still to be a gassign.
      
      One fix would be to check for a reduction in the pattern matcher
      (but current patterns don't generally do that).  Another would be
      to fail gracefully for reductions involving calls.  Since we can't
      vectorise the reduction either way, and probably have a better shot
      with the shift form, this patch goes for the "fail gracefully" approach.
      
      2020-01-28  Richard Sandiford  <richard.sandiford@arm.com>
      
      gcc/
      	* tree-vect-loop.c (vectorizable_reduction): Fail gracefully
      	for reduction chains that (now) include a call.
      Richard Sandiford committed
    • [Fortran] avoid ICE in gfc_omp_check_optional_argument (PR93464) · 627d59b6
              PR fortran/93464
              * openmp.c (gfc_omp_check_optional_argument): Avoid ICE when
              DECL_LANG_SPECIFIC and GFC_DESCRIPTOR_TYPE_P but not
              GFC_DECL_SAVED_DESCRIPTOR as for local allocatable character vars.
      
              PR fortran/93464
              * gfortran.dg/goacc/pr93464.f90: New.
      Tobias Burnus committed
    • forwprop: Tweak choice of VEC_PERM_EXPR filler [PR92822] · 1ee3b380
      For the 2s failures in the PR, we have a V4SF VEC_PERM_EXPR in
      which the first two elements are duplicates of one element and
      the other two are don't-care:
      
          v4sf_b = VEC_PERM_EXPR <v4sf_a, v4sf_a, { 1, 1, ?, ? }>;
      
      The heuristic was to extend this with a blend:
      
          v4sf_b = VEC_PERM_EXPR <v4sf_a, v4sf_a, { 1, 1, 2, 3 }>;
      
      but it seems better to extend a partial duplicate to a full duplicate:
      
          v4sf_b = VEC_PERM_EXPR <v4sf_a, v4sf_a, { 1, 1, 1, 1 }>;
      
      Obviously this is still just a heuristic though.
      
      I wondered whether to restrict this to two elements or more
      but couldn't find any examples in which it made a difference.
      Either way should be fine for the purposes of fixing this PR.
      
      2020-01-28  Richard Sandiford  <richard.sandiford@arm.com>
      
      gcc/
      	PR tree-optimization/92822
      	* tree-ssa-forwprop.c (simplify_vector_constructor): When filling
      	out the don't-care elements of a vector whose significant elements
      	are duplicates, make the don't-care elements duplicates too.
      Richard Sandiford committed
    • predcom: Fix invalid store-store commoning [PR93434] · 6cedf5d8
      predcom has the following code to stop one rogue load from
      interfering with other store-load opportunities:
      
            /* If A is read and B write or vice versa and there is unsuitable
      	 dependence, instead of merging both components into a component
      	 that will certainly not pass suitable_component_p, just put the
      	 read into bad component, perhaps at least the write together with
      	 all the other data refs in it's component will be optimizable.  */
      
      But when store-store commoning was added later, this had the effect
      of ignoring loads that occur between two candidate stores.
      
      There is code further up to handle loads and stores with unknown
      dependences:
      
            /* Don't do store elimination if there is any unknown dependence for
      	 any store data reference.  */
            if ((DR_IS_WRITE (dra) || DR_IS_WRITE (drb))
      	  && (DDR_ARE_DEPENDENT (ddr) == chrec_dont_know
      	      || DDR_NUM_DIST_VECTS (ddr) == 0))
      	eliminate_store_p = false;
      
      But the store-load code above skips loads for *known* dependences
      if (a) the load has already been marked "bad" or (b) the data-ref
      machinery knows the dependence distance, but determine_offsets
      can't handle the combination.
      
      (a) happens to be the problem in the testcase, but a different
      sequence could have given (b) instead.  We have writes to individual
      fields of a structure and reads from the whole structure.  Since
      determine_offsets requires the types to be the same, it returns false
      for each such read/write combination.
      
      This patch records which components have had loads removed and
      prevents store-store commoning for them.  It's a bit too pessimistic,
      since there shouldn't be a problem if a "bad" load dominates all stores
      in a component.  But (a) we can't AFAIK use pcom_stmt_dominates_stmt_p
      here and (b) the handling for that case would probably need to be
      removed again if we handled more exotic cases in future.
      
      2020-01-28  Richard Sandiford  <richard.sandiford@arm.com>
      
      gcc/
      	PR tree-optimization/93434
      	* tree-predcom.c (split_data_refs_to_components): Record which
      	components have had aliasing loads removed.  Prevent store-store
      	commoning for all such components.
      
      gcc/testsuite/
      	PR tree-optimization/93434
      	* gcc.c-torture/execute/pr93434.c: New test.
      Richard Sandiford committed
    • testsuite: Add -Wpsabi to gcc.dg/torture/pr93170.c [PR93460] · 3aa64a0f
      2020-01-28  Richard Sandiford  <richard.sandiford@arm.com>
      
      gcc/testsuite/
      	PR testsuite/93460
      	* gcc.dg/torture/pr93170.c: Add -Wpsabi.
      Richard Sandiford committed
    • [Fortran] gfortran.texi - minor style cleanup · 4593f605
              * gfortran.texi (Runtime): Remove tailing '.' in @menu.
      Tobias Burnus committed
    • Add couple of auto_diagnostic_group in redeclare_class_template. · 1d859307
      	PR c++/92440
      	* pt.c (redeclare_class_template): Group couple of
      	errors and inform messages with auto_diagnostic_group.
      Martin Liska committed
    • Replace one error with inform. · d3c00969
      	PR c++/92440
      	* pt.c (redeclare_class_template): Use inform
      	for the second location.
      	PR c++/92440
      	* g++.dg/template/pr92440.C: New test.
      	* g++.dg/cpp0x/vt-34314.C: Update error to note.
      	* g++.dg/template/pr59930-2.C: Likewise.
      	* g++.old-deja/g++.pt/redecl1.C: Likewise.
      Martin Liska committed
    • Fix 2 typos in documentation of libstdc++. · 06d481d0
      	PR libstdc++/93478
      	* include/std/atomic: Fix typo.
      	* include/std/optional: Likewise.
      Martin Liska committed
    • i386: Fix ix86_fold_builtin shift folding [PR93418] · bff948aa
      The following testcase is miscompiled, because the variable shift left
      operand, { -1, -1, -1, -1 } is represented as a VECTOR_CST with
      VECTOR_CST_NPATTERNS 1 and VECTOR_CST_NELTS_PER_PATTERN 1, so when
      we call builder.new_unary_operation, builder.encoded_nelts () will be just 1
      and thus we encode the resulting vector as if all the elements were the
      same.
      For non-masked is_vshift, we could perhaps call builder.new_binary_operation
      (TREE_TYPE (args[0]), args[0], args[1], false), but then there are masked
      shifts, for non-is_vshift we could perhaps call it too but with args[2]
      instead of args[1], but there is no builder.new_ternary_operation.
      All this stuff is primarily for aarch64 anyway, on x86 we don't have any
      variable length vectors, and it is not a big deal to compute all elements
      and just let builder.finalize () find the most efficient VECTOR_CST
      representation of the vector.  So, instead of doing too much, this just
      keeps using new_unary_operation only if only one VECTOR_CST is involved
      (i.e. non-masked shift by constant) and for the rest just compute all elts.
      
      2020-01-28  Jakub Jelinek  <jakub@redhat.com>
      
      	PR target/93418
      	* config/i386/i386.c (ix86_fold_builtin) <do_shift>: If mask is not
      	-1 or is_vshift is true, use new_vector with number of elts npatterns
      	rather than new_unary_operation.
      
      	* gcc.target/i386/avx2-pr93418.c: New test.
      Jakub Jelinek committed
    • gimple-fold: Fix buffer overflow in fold_array_ctor_reference [PR93454] · 3c076c96
      libgcrypt FAILs to build on aarch64-linux with
      *** stack smashing detected ***: terminated
      when gcc is compiled with -D_FORTIFY_SOURCE=2.  The problem is if
      fold_array_ctor_reference is called with size equal to or very close to
      MAX_BITSIZE_MODE_ANY_MODE bits and non-zero inner_offset.
      The first native_encode_expr is called with that inner_offset and bufoff 0,
      the subsequent ones with offset of 0, and bufoff elt_size - inner_offset,
      2 * elt_size - inner_offset etc.  So, e.g. on the testcase where we start
      with inner_offset 1 and size is e.g. 256 bytes and elt_size 4 bytes
      we then call native_encode_expr at bufoff 251 and then 255, but that one
      overwrites 3 bytes beyond the buf array.
      The following patch fixes that.  In addition, it avoids calling
      elt_size.to_uhwi () all the time, and punts if elt_sz would be too large.
      
      2020-01-28  Jakub Jelinek  <jakub@redhat.com>
      
      	PR tree-optimization/93454
      	* gimple-fold.c (fold_array_ctor_reference): Perform
      	elt_size.to_uhwi () just once, instead of calling it in every
      	iteration.  Punt if that value is above size of the temporary
      	buffer.  Decrease third native_encode_expr argument when
      	bufoff + elt_sz is above size of buf.
      
      	* gcc.dg/pr93454.c: New test.
      Jakub Jelinek committed
    • analyzer: fix ICE when canonicalizing NaN (PR 93451) · 8c08c983
      PR analyzer/93451 reports an ICE when canonicalizing the constants
      in a region_model, with a failed qsort_chk when attempting to sort
      the constants within the region_model.
      
      The svalues in the model were:
        sv0: {poisoned: uninit}
        sv1: {type: ‘double’, ‘0.0’}
        sv2: {type: ‘double’, ‘1.0e+0’}
        sv3: {type: ‘double’, ‘ Nan’}
      
      The qsort_chk of the 3 constants fails due to tree_cmp using the
      LT_EXPR ordering of the REAL_CSTs, which doesn't work for NaN.
      
      This patch adjusts tree_cmp to impose an arbitrary ordering during
      canonicalization for UNORDERED_EXPR cases w/o relying on the LT_EXPR
      ordering, fixing the ICE.
      
      gcc/analyzer/ChangeLog:
      	PR analyzer/93451
      	* region-model.cc (tree_cmp): For the REAL_CST case, impose an
      	arbitrary order on NaNs relative to other NaNs and to non-NaNs;
      	const-correctness tweak.
      	(ana::selftests::build_real_cst_from_string): New function.
      	(ana::selftests::append_interesting_constants): New function.
      	(ana::selftests::test_tree_cmp_on_constants): New test.
      	(ana::selftests::test_canonicalization_4): New test.
      	(ana::selftests::analyzer_region_model_cc_tests): Call the new
      	tests.
      
      gcc/testsuite/ChangeLog:
      	PR analyzer/93451
      	* gcc.dg/analyzer/torture/pr93451.c: New test.
      David Malcolm committed
    • Daily bump. · 85d6090e
      GCC Administrator committed
  2. 27 Jan, 2020 13 commits
    • gcc: Add new configure options to allow static libraries to be selected · e7c26e04
      The motivation behind this change is to make it easier for a user to
      link against static libraries on a target where dynamic libraries are
      the default library type (for example GNU/Linux).
      
      Further, my motivation is really for linking libraries into GDB,
      however, the binutils-gdb/config/ directory is a copy of gcc/config/
      so changes for GDB need to be approved by the GCC project first.
      
      After making this change in the gcc/config/ directory I've run
      autoreconf on all of the configure scripts in the GCC tree and a
      couple have been updated, so I'll use one of these to describe what my
      change does.
      
      Consider libcpp, this library links against libiconv.  Currently if
      the user builds on a system with both static and dynamic libiconv
      installed then autotools will pick up the dynamic libiconv by
      default.  This is almost certainly the right thing to do.
      
      However, if the user wants to link against static libiconv then things
      are a little harder, they could remove the dynamic libiconv from their
      system, but this is probably a bad idea (other things might depend on
      that library), or the user can build their own version of libiconv,
      install it into a unique prefix, and then configure gcc using the
      --with-libiconv-prefix=DIR flag.  This works fine, but is somewhat
      annoying, the static library available, I just can't get autotools to
      use it.
      
      My change then adds a new flag --with-libiconv-type=TYPE, where type
      is either auto, static, or shared.  The default auto, ensures we keep
      the existing behaviour unchanged.
      
      If the user configures with --with-libiconv-type=static then the
      configure script will ignore any dynamic libiconv it finds, and will
      only look for a static libiconv, if no static libiconv is found then
      the configure will continue as though there is no libiconv at all
      available.
      
      Similarly a user can specify --with-libiconv-type=shared and force the
      use of shared libiconv, any static libiconv will be ignored.
      
      As I've implemented this change within the AC_LIB_LINKFLAGS_BODY macro
      then only libraries configured using the AC_LIB_LINKFLAGS or
      AC_LIB_HAVE_LINKFLAGS macros will gain the new configure flag.
      
      If this is accepted into GCC then there will be follow on patches for
      binutils and GDB to regenerate some configure scripts in those
      projects.
      
      For GCC only two configure scripts needed updated after this commit,
      libcpp and libstdc++-v3, both of which link against libiconv.
      
      config/ChangeLog:
      
      	* lib-link.m4 (AC_LIB_LINKFLAGS_BODY): Add new
      	--with-libXXX-type=... option.  Use this to guide the selection of
      	either a shared library or a static library.
      
      libcpp/ChangeLog:
      
      	* configure: Regenerate.
      
      libstdc++-v3/ChangeLog:
      
      	* configure: Regenerate.
      Andrew Burgess committed
    • Support gnu_unique_object symbols on MIPS. · 15d55239
      mips_declare_object_name is missing the support for declaring symbols
      as gnu_unique_object that is present in the generic
      ASM_DECLARE_OBJECT_NAME in elfos.h.  I'm not aware of any
      MIPS-specific reason for that support to be absent;
      mips_declare_object_name predates the addition of gnu_unique_object
      support and as far as I can tell this was simply an oversight when
      that support was added.  This patch adds the missing support,
      following the code in elfos.h.
      
      Tested with no regressions with cross to mips-linux-gnu.  In
      particular, this fixes the failure of the recently-added glibc test
      elf/tst-dlopen-nodelete-reloc, which relies on the compiler generating
      such symbols, for MIPS.
      
      	* config/mips/mips.c (mips_declare_object_name)
      	[USE_GNU_UNIQUE_OBJECT]: Support use of gnu_unique_object.
      Joseph Myers committed
    • compiler: cleanups permitted by GCC requirement of MPFR 3.1.0 · 2f195832
      For MPFR functions, change from GMP_RND* to MPFR_RND*.
      Also change mp_exp_t to mpfr_expt_t.
      
      Fixes PR go/92463
      
      Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/216417
      Ian Lance Taylor committed
    • c++: Fix array of char typedef in template (PR90966). · 8f25c39c
      Since Martin Sebor's patch for PR 71625 to change braced array initializers
      to STRING_CST in some cases, we need to be ready for STRING_CST with types
      that are changed by tsubst.  fold_convert doesn't know how to deal with
      STRING_CST, which is reasonable; we really shouldn't expect it to here.  So
      let's handle STRING_CST separately.
      
      	PR c++/90966
      	* pt.c (tsubst_copy) [STRING_CST]: Don't use fold_convert.
      Jason Merrill committed
    • coroutines: Ensure the ramp return object is checked (PR93443). · 1f2e8423
      As the PR shows, there is a pathway through the code where the
      no_warning value is not set, which corresponds to a missing check
      of the ramp return when it was constructed from the 'get return
      object'  Fixed by ensuring that the check of the return value is
      carried out for both return cases.
      
      gcc/cp/ChangeLog:
      
      2020-01-27  Iain Sandoe  <iain@sandoe.co.uk>
      
      	PR c++/93443
      	* coroutines.cc (morph_fn_to_coro): Check the ramp return
      	value when it is constructed from the 'get return object'.
      Iain Sandoe committed
    • Hi all, · 73380abd
      This was committed following offline approval by Kyryl.
      
      One minor intended optimisation introduced by :
      
      https://gcc.gnu.org/ml/gcc-patches/2020-01/msg01237.html
      
      was to set a preference for both __fp16 types and __bf16 types to be
      loaded/stored directly into/from the FP/NEON registers (if they are available
      and if the vld1.16 is compatible), rather than be passed through the regular
      r-registers.
      
      This would convert many observed instances of:
      
      **	ldrh	r3, [r3]	@ __fp16
      **	vmov.f16	s15, r3	@ __fp16
      
      Into a single:
      
      **	vld1.16	{d7[2]}, [r3]
      
      This resulted in a regression of a dg-scan-assembler in a __fp16 test.
      
      This patch updates the test to the same testing standard used by the BFloat
      tests (use check-function-bodies to explicitly check for correct assembler
      generated by each function) and updates it for the latest optimisation.
      
      Cheers,
      Stam
      
      gcc/testsuite/ChangeLog:
      
      2020-01-27  Stam Markianos-Wright  <stam.markianos-wright@arm.com>
      
      	* gcc.target/arm/armv8_2-fp16-move-1.c: Update following load/store
              optimisation.
      Stam Markianos-Wright committed
    • analyzer: restore input_location (PR 93349) · 2fbea419
      PR analyzer/93349 reports an ICE in IPA pass: simdclone for
      some input files when -fanalyzer is supplied, with:
        error: location references block not in block tree
      
      The root cause is that the analyzer touches input_location in some
      places (to make it easier to track down which source construct the
      analyzer can't handle in the case of an analyzer ICE) and fails to reset
      it.  For the ICE in question, this sets input_location to a location_t
      that references some arbitrary block (specifically, that of the last
      statement to be analyzed, within the original CFG of whichever is the
      last such function to be analyzed).
      
      Later, within omp-simd-clone.c, input_location is used by gimplify_expr
      (called via gimplify_and_add), which has:
      
      14492	      if (!gimple_seq_empty_p (*pre_p))
      14493		annotate_all_with_location_after (*pre_p, pre_last_gsi, input_location);
      
      thus using whatever the value of input_location is, leading
      to statements that reference some arbitrary block in the original CFG.
      For the reproducer, this happens to be a block in the CFG for the
      original function, rather than that of the clone, but in general it
      could be some arbitrary other function in the TU.
      
      This code appears to assume that input_location has some arbitrary
      value *not* in the block tree, which is potentially violated by the
      analyzer's changes to input_location.
      
      This patch adds a save and restore of input_location at the top-level
      function of the analyzer, fixing the ICE.
      
      gcc/analyzer/ChangeLog:
      	PR analyzer/93349
      	* engine.cc (run_checkers): Save and restore input_location.
      
      gcc/testsuite/ChangeLog:
      	PR analyzer/93349
      	* gcc.dg/analyzer/torture/pr93349.c: New test.
      David Malcolm committed
    • analyzer: fix pattern-test-2.c (PR 93291) · f89e844f
      Amongst the inputs to the analyzer state machines that can lead to state
      transitions are conditions on CFG edges, such as a test for a pointer
      being non-NULL.
      
      These conditionals can be non-trivial to determine in the face of
      optimization.  For example, at -O2:
      
        if (p == NULL || q == NULL)
      
      is optimized on some targets (e.g. x86_64) to a bitwise-or:
      
        _1 = p_5(D) == 0B;
        _2 = q_6(D) == 0B;
        _3 = _1 | _2;
        if (_3 != 0)
          goto <bb 4>; [51.12%]
        else
          goto <bb 3>; [48.88%]
      
      but on other targets (e.g. powerpc64le) as control flow:
      
        if (p_2(D) == 0B)
          goto <bb 5>; [18.09%]
        else
          goto <bb 3>; [81.91%]
      
        <bb 3> [local count: 879501929]:
        if (q_3(D) == 0B)
          goto <bb 5>; [30.95%]
        else
          goto <bb 4>; [69.05%]
      
      region_model::add_any_constraints_from_ssa_def_stmt attempts to walk
      SSA def chains to reconstruct the conditions that hold, so that
      e.g. in the above case of bitwise-or, the state machine for
      "p" can transition to the "known-null" state along the edge leading
      to bb 3.
      
      In gcc.dg/analyzer/pattern-test-2.c I attempted to write test coverage
      for this, but the test fails on those targets for which the || is
      expressed via control flow.
      
      This patch rewrites the test to make explicit use of bitwise-or, and
      adds coverage for bitwise-and for good measure.
      
      gcc/testsuite/ChangeLog:
      	PR analyzer/93291
      	* gcc.dg/analyzer/pattern-test-2.c: Remove include of stdlib.h.
      	(test_2): Rewrite to explicitly perform a bitwise-or of two
      	boolean conditions.
      	(test_3): New function, to test bitwise-and.
      David Malcolm committed
    • aarch64: Fix pr71727.c failure · a044dfb0
      This test started failing after the switch to -fno-common because we can
      now force the array to be aligned to 16 bytes, which in turn lets us use
      SIMD accesses.  Locally restoring -fcommon seems the most faithful to
      the original PR.
      
      2020-01-27  Richard Sandiford  <richard.sandiford@arm.com>
      
      gcc/testsuite/
      	PR testsuite/71727
      	* gcc.target/aarch64/pr71727.c: Add -fcommon.
      Richard Sandiford committed
    • Add __gcov_indirect_call_profiler_v4_atomic. · 3ae37f92
      	PR gcov-profile/93403
      	* tree-profile.c (gimple_init_gcov_profiler): Generate
      	both __gcov_indirect_call_profiler_v4 and
      	__gcov_indirect_call_profiler_v4_atomic.
      	PR gcov-profile/93403
      	* libgcov-profiler.c (__gcov_indirect_call_profiler_v4):
      	Call __gcov_indirect_call_profiler_body.
      	(__gcov_indirect_call_profiler_body): New.
      	(__gcov_indirect_call_profiler_v4_atomic): New.
      	* libgcov.h (__gcov_indirect_call_profiler_v4_atomic):
      	New declaration.
      Martin Liska committed
    • analyzer: fixes to tree_cmp and other comparators · 6a81cabc
      region_model.cc's tree_cmp attempted to verify that the ordering
      is symmetric by asserting that
        tree_cmp (x, y) == -tree_cmp (y, x)
      
      This condition is too strong: it's only required for a comparator that
        sign (tree_cmp (x, y)) == -sign (tree_cmp (y, x))
      and the incorrect form of the assertion doesn't hold e.g. on s390x where
      for certain inputs x, y, tree_cmp (x, y) == 1 and tree_cmp (y, x) == -2,
      breaking the build in "make selftest" in stage1.
      
      In any case, these checks are redundant, since qsort_chk performs them.
      
      Additionally, there is a potential lack of transitivity in
      worklist::key_t::cmp where hashval_t values are compared by subtraction,
      which could fail to be transitive if overflows occur.
      
      This patch eliminates the redundant checks and reimplements the hashval_t
      comparisons in terms of < and >, fixing these issues.
      
      gcc/analyzer/ChangeLog:
      	* call-string.cc (call_string::cmp_1): Delete, moving body to...
      	(call_string::cmp): ...here.
      	* call-string.h (call_string::cmp_1): Delete decl.
      	* engine.cc (worklist::key_t::cmp_1): Delete, moving body to...
      	(worklist::key_t::cmp): ...here.  Implement hash comparisons
      	via comparison rather than subtraction to avoid overflow issues.
      	* exploded-graph.h (worklist::key_t::cmp_1): Delete decl.
      	* region-model.cc (tree_cmp): Eliminate buggy checking for
      	symmetry.
      David Malcolm committed
    • aarch64: Add vector/vector vec_extract patterns [PR92822] · c15893df
      Part of the problem in this PR is that we don't provide patterns
      to extract a 64-bit vector from one half of a 128-bit vector.
      Adding them fixes:
      
      FAIL: gcc.target/aarch64/fmul_intrinsic_1.c scan-assembler-times fmul\\td[0-9]+, d[0-9]+, d[0-9]+ 1
      FAIL: gcc.target/aarch64/fmul_intrinsic_1.c scan-assembler-times fmul\\tv[0-9]+.2d, v[0-9]+.2d, v[0-9]+.d\\[[0-9]+\\] 3
      
      The 2s failures need target-independent changes, after which they rely
      on these patterns too.
      
      2020-01-27  Richard Sandiford  <richard.sandiford@arm.com>
      
      gcc/
      	PR target/92822
      	* config/aarch64/aarch64-simd.md (aarch64_get_half<mode>): New
      	expander.
      	(@aarch64_split_simd_mov<mode>): Use it.
      	(aarch64_simd_mov_from_<mode>low): Add a GPR alternative.
      	Leave the vec_extract patterns to handle 2-element vectors.
      	(aarch64_simd_mov_from_<mode>high): Likewise.
      	(vec_extract<VQMOV_NO2E:mode><Vhalf>): New expander.
      	(vec_extractv2dfv1df): Likewise.
      Richard Sandiford committed
    • aarch64: Fix failure in cmpimm_branch_1.c · e2a14bec
      gcc.target/aarch64/cmpimm_branch_1.c started failing after Bernd's
      fix to make combine take the costs of jumps into account
      (g:391500af).  This is because the rtx costs
      of *compare_condjump<GPI:mode> were higher than the costs
      of the instructions it combines.
      
      2020-01-27  Richard Sandiford  <richard.sandiford@arm.com>
      
      gcc/
      	* config/aarch64/aarch64.c (aarch64_if_then_else_costs): Match
      	jump conditions for *compare_condjump<GPI:mode>.
      Richard Sandiford committed