Skip to content
Snippets Groups Projects
  1. Nov 21, 2020
    • Aaron Sawdey's avatar
      Additional small changes to support opaque modes · 1e2d8575
      Aaron Sawdey authored
      After building some larger codes using opaque types and some c++ codes
      using opaque types it became clear I needed to go through and look for
      places where opaque types and modes needed to be handled. A whole pile
      of one-liners.
      
      gcc/
      	* typeclass.h: Add opaque_type_class.
      	* builtins.c (type_to_class): Identify opaque type class.
      	* dwarf2out.c (is_base_type): Handle opaque types.
      	(gen_type_die_with_usage): Handle opaque types.
      	* expr.c (count_type_elements): Opaque types should
      	never have initializers.
      	* ipa-devirt.c (odr_types_equivalent_p): No type-specific handling
      	for opaque types is needed as it eventually checks the underlying
      	mode which is what is important.
      	* tree-streamer.c (record_common_node): Handle opaque types.
      	* tree.c (type_contains_placeholder_1): Handle opaque types.
      	(type_cache_hasher::equal): No additional comparison needed for
      	opaque types.
      gcc/c-family
      	* c-pretty-print.c (c_pretty_printer::simple_type_specifier):
      	Treat opaque types like other types.
      	(c_pretty_printer::direct_abstract_declarator): Opaque types are
      	supported types.
      gcc/c
      	* c-aux-info.c (gen_type): Support opaque types.
      gcc/cp
      	* error.c (dump_type): Handle opaque types.
      	(dump_type_prefix): Handle opaque types.
      	(dump_type_suffix): Handle opaque types.
      	(dump_expr): Handle opaque types.
      	* pt.c (tsubst): Allow opaque types in templates.
      	(unify): Allow opaque types in templates.
      	* typeck.c (structural_comptypes): Handle comparison
      	of opaque types.
      1e2d8575
    • Iain Sandoe's avatar
      Darwin, libgfortran : Do not use environ directly from the library. · a3454130
      Iain Sandoe authored
      On macOS / Darwin, the environ variable can be used directly in the
      code of an executable, but cannot be used in the code of a shared
      library (i.e. libgfortran.dylib), in this case.
      
      In such cases, the  function _NSGetEnviron should be called to get
      the address of 'environ'.
      
      libgfortran/ChangeLog:
      
      	* intrinsics/execute_command_line.c (environ): Use
      	_NSGetEnviron to get the environment pointer on Darwin.
      a3454130
    • Iain Sandoe's avatar
      Darwin, libsanitizer : Support libsanitizer for x86_64-darwin20. · 93f1186f
      Iain Sandoe authored
      The sanitizer is supported for at least x86_64 and Darwin20.
      
      libsanitizer/ChangeLog:
      
      	* configure.tgt: Allow x86_64 Darwin2x.
      93f1186f
    • Ian Lance Taylor's avatar
    • GCC Administrator's avatar
      Daily bump. · 82e5048e
      GCC Administrator authored
      82e5048e
  2. Nov 20, 2020
    • Michael Meissner's avatar
      Include math.h in nextafter-2.c test. · 81a3f3d1
      Michael Meissner authored
      Since the test is compiled with -fno-builtin, include math.h to allow for
      implementations (like the PowerPC) that have multiple versions of long double
      that are selectable by switch.  Math.h could possibly switch what function
      nextafterl points to.
      
      gcc/testsuite/
      2020-11-17  Michael Meissner  <meissner@linux.ibm.com>
      
      	* gcc.dg/nextafter-2.c: Include math.h.
      81a3f3d1
    • Michael Meissner's avatar
      Power10: Add missing IEEE 128-bit XSCMP* built-in mappings. · 9bdb34ce
      Michael Meissner authored
      This patch adds support for mapping the scalar_cmp_exp_qp_* built-in functions
      to handle arguments that are either TFmode or KFmode, depending on whether long
      double uses the IEEE 128-bit representation (TFmode) or the IBM 128-bit
      representation (KFmode).  This shows up in the float128-cmp2-runnable.c test
      when long double uses the IEEE 128-bit representation.
      
      gcc/
      2020-11-20  Michael Meissner  <meissner@linux.ibm.com>
      
      	* config/rs6000/rs6000-call.c (rs6000_expand_builtin): Add missing
      	XSCMP* cases for IEEE 128-bit long double.
      9bdb34ce
    • Thomas Rodgers's avatar
      libstdc++: Add C++2a synchronization support · 83a1beee
      Thomas Rodgers authored
      Add support for -
        * atomic_flag::wait/notify_one/notify_all
        * atomic::wait/notify_one/notify_all
        * counting_semaphore
        * binary_semaphore
        * latch
      
      libstdc++-v3/ChangeLog:
      
      	* include/Makefile.am (bits_headers): Add new header.
      	* include/Makefile.in: Regenerate.
      	* include/bits/atomic_base.h (__atomic_flag::wait): Define.
      	(__atomic_flag::notify_one): Likewise.
      	(__atomic_flag::notify_all): Likewise.
      	(__atomic_base<_Itp>::wait): Likewise.
      	(__atomic_base<_Itp>::notify_one): Likewise.
      	(__atomic_base<_Itp>::notify_all): Likewise.
      	(__atomic_base<_Ptp*>::wait): Likewise.
      	(__atomic_base<_Ptp*>::notify_one): Likewise.
      	(__atomic_base<_Ptp*>::notify_all): Likewise.
      	(__atomic_impl::wait): Likewise.
      	(__atomic_impl::notify_one): Likewise.
      	(__atomic_impl::notify_all): Likewise.
      	(__atomic_float<_Fp>::wait): Likewise.
      	(__atomic_float<_Fp>::notify_one): Likewise.
      	(__atomic_float<_Fp>::notify_all): Likewise.
      	(__atomic_ref<_Tp>::wait): Likewise.
      	(__atomic_ref<_Tp>::notify_one): Likewise.
      	(__atomic_ref<_Tp>::notify_all): Likewise.
      	(atomic_wait<_Tp>): Likewise.
      	(atomic_wait_explicit<_Tp>): Likewise.
      	(atomic_notify_one<_Tp>): Likewise.
      	(atomic_notify_all<_Tp>): Likewise.
      	* include/bits/atomic_wait.h: New file.
      	* include/bits/atomic_timed_wait.h: New file.
      	* include/bits/semaphore_base.h: New file.
      	* include/std/atomic (atomic<bool>::wait): Define.
      	(atomic<bool>::wait_one): Likewise.
      	(atomic<bool>::wait_all): Likewise.
      	(atomic<_Tp>::wait): Likewise.
      	(atomic<_Tp>::wait_one): Likewise.
      	(atomic<_Tp>::wait_all): Likewise.
      	(atomic<_Tp*>::wait): Likewise.
      	(atomic<_Tp*>::wait_one): Likewise.
      	(atomic<_Tp*>::wait_all): Likewise.
      	* include/std/latch: New file.
      	* include/std/semaphore: New file.
      	* include/std/version: Add __cpp_lib_semaphore and
      	__cpp_lib_latch defines.
      	* testsuite/29_atomics/atomic/wait_notify/bool.cc: New test.
      	* testsuite/29_atomics/atomic/wait_notify/pointers.cc: Likewise.
      	* testsuite/29_atomics/atomic/wait_notify/generic.cc: Liekwise.
      	* testsuite/29_atomics/atomic_flag/wait_notify/1.cc: Likewise.
      	* testsuite/29_atomics/atomic_float/wait_notify.cc: Likewise.
      	* testsuite/29_atomics/atomic_integral/wait_notify.cc: Likewise.
      	* testsuite/29_atomics/atomic_ref/wait_notify.cc: Likewise.
      	* testsuite/30_threads/semaphore/1.cc: New test.
      	* testsuite/30_threads/semaphore/2.cc: Likewise.
      	* testsuite/30_threads/semaphore/least_max_value_neg.cc: Likewise.
      	* testsuite/30_threads/semaphore/try_acquire.cc: Likewise.
      	* testsuite/30_threads/semaphore/try_acquire_for.cc: Likewise.
      	* testsuite/30_threads/semaphore/try_acquire_posix.cc: Likewise.
      	* testsuite/30_threads/semaphore/try_acquire_until.cc: Likewise.
      	* testsuite/30_threads/latch/1.cc: New test.
      	* testsuite/30_threads/latch/2.cc: New test.
      	* testsuite/30_threads/latch/3.cc: New test.
      	* testsuite/util/atomic/wait_notify_util.h: New File.
      83a1beee
    • Jason Merrill's avatar
      dwarf2: ICE with local class in unused function [PR97918] · 89d9c634
      Jason Merrill authored
      Here, since we only mention bar<B>, we never emit debug information for it.
      But we do emit debug information for H<J>::h, so we need to refer to the
      debug info for bar<B>::J even though there is no bar<B>.  We deal with this
      sort of thing in dwarf2out with the limbo_die_list; parentless dies like J
      get attached to the CU at EOF.  But here, we were flushing the limbo list,
      then generating the template argument DIE for H<J> that refers to J, which
      adds J to the limbo list, too late to be flushed.  So let's flush a little
      later.
      
      gcc/ChangeLog:
      
      	PR c++/97918
      	* dwarf2out.c (dwarf2out_early_finish): flush_limbo_die_list
      	after gen_scheduled_generic_parms_dies.
      
      gcc/testsuite/ChangeLog:
      
      	PR c++/97918
      	* g++.dg/debug/localclass2.C: New test.
      89d9c634
    • Martin Sebor's avatar
      PR middle-end/97861 - ICE on an invalid redeclaration of a function with attribute access · 27c5416f
      Martin Sebor authored
      gcc/c-family/ChangeLog:
      	* c-warn.c (warn_parm_array_mismatch): Bail on invalid redeclarations
      	with fewer arguments.
      
      gcc/testsuite/ChangeLog:
      	* gcc.dg/attr-access-4.c: New test.
      27c5416f
    • François Dumont's avatar
      libstdc++: Limit memory allocation in stable_sort/inplace_merge (PR 83938) · ba23e045
      François Dumont authored
      
      Reduce memory allocation in stable_sort/inplace_merge algorithms to what is needed
      by the implementation.
      
      Co-authored-by: default avatarJohn Chang <john.chang@samba.tv>
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/83938
      	* include/bits/stl_tempbuf.h (get_temporary_buffer): Change __len
      	computation in the loop to avoid truncation.
      	* include/bits/stl_algo.h:
      	(__inplace_merge): Take temporary buffer length from smallest range.
      	(__stable_sort): Limit temporary buffer length.
      	* testsuite/25_algorithms/inplace_merge/1.cc (test4): New.
      	* testsuite/performance/25_algorithms/stable_sort.cc: Test stable_sort
      	under different heap memory conditions.
      	* testsuite/performance/25_algorithms/inplace_merge.cc: New test.
      ba23e045
    • Maciej W. Rozycki's avatar
      libada: Check for the presence of _SC_NPROCESSORS_ONLN · 9e071b6e
      Maciej W. Rozycki authored
      Check for the presence of _SC_NPROCESSORS_ONLN rather than using a list
      of OS-specific macros to decide whether to use `sysconf' like elsewhere
      across GCC sources, fixing a compilation error:
      
      adaint.c: In function '__gnat_number_of_cpus':
      adaint.c:2398:26: error: '_SC_NPROCESSORS_ONLN' undeclared (first use in this function)
       2398 |   cores = (int) sysconf (_SC_NPROCESSORS_ONLN);
            |                          ^~~~~~~~~~~~~~~~~~~~
      adaint.c:2398:26: note: each undeclared identifier is reported only once for each function it appears in
      
      at least with with VAX/NetBSD 1.6.2.
      
      	gcc/ada/
      	* adaint.c (__gnat_number_of_cpus): Check for the presence of
      	_SC_NPROCESSORS_ONLN rather than a list of OS-specific macros
      	to decide whether to use `sysconf'.
      9e071b6e
    • Maciej W. Rozycki's avatar
      NetBSD/libgcc: Check for TARGET_DL_ITERATE_PHDR in the unwinder · f50c417a
      Maciej W. Rozycki authored
      Disable USE_PT_GNU_EH_FRAME frame unwinder support for old OS versions,
      fixing compilation errors:
      
      .../libgcc/unwind-dw2-fde-dip.c:75:21: error: unknown type name 'Elf_Phdr'
         75 | # define ElfW(type) Elf_##type
            |                     ^~~~
      .../libgcc/unwind-dw2-fde-dip.c:132:9: note: in expansion of macro 'ElfW'
        132 |   const ElfW(Phdr) *p_eh_frame_hdr;
            |         ^~~~
      .../libgcc/unwind-dw2-fde-dip.c:75:21: error: unknown type name 'Elf_Phdr'
         75 | # define ElfW(type) Elf_##type
            |                     ^~~~
      .../libgcc/unwind-dw2-fde-dip.c:133:9: note: in expansion of macro 'ElfW'
        133 |   const ElfW(Phdr) *p_dynamic;
            |         ^~~~
      .../libgcc/unwind-dw2-fde-dip.c:165:37: warning: 'struct dl_phdr_info' declared inside parameter list will not be visible outside of this definition or declaration
        165 | _Unwind_IteratePhdrCallback (struct dl_phdr_info *info, size_t size, void *ptr)
            |                                     ^~~~~~~~~~~~
      [...]
      
      and producing a working cross-compiler at least with VAX/NetBSD 1.6.2.
      
      	libgcc/
      	* unwind-dw2-fde-dip.c [__OpenBSD__ || __NetBSD__]
      	(USE_PT_GNU_EH_FRAME): Do not define if !TARGET_DL_ITERATE_PHDR.
      f50c417a
    • Martin Sebor's avatar
      PR middle-end/97879 - ICE on invalid mode in attribute access · df90f070
      Martin Sebor authored
      gcc/c-family/ChangeLog:
      
      	PR middle-end/97879
      	* c-attribs.c (handle_access_attribute): Handle ATTR_FLAG_INTERNAL.
      	Error out on invalid modes.
      
      gcc/c/ChangeLog:
      	PR middle-end/97879
      	* c-decl.c (start_function): Set ATTR_FLAG_INTERNAL in flags.
      
      gcc/ChangeLog:
      
      	PR middle-end/97879
      	* tree-core.h (enum attribute_flags): Add ATTR_FLAG_INTERNAL.
      
      gcc/testsuite/ChangeLog:
      
      	PR middle-end/97879
      	* gcc.dg/attr-access-3.c: New test.
      df90f070
    • Ian Lance Taylor's avatar
      compiler, libgo: change mangling scheme · a01dda3c
      Ian Lance Taylor authored
      Overhaul the mangling scheme to avoid ambiguities if the package path
      contains a dot. Instead of using dot both to separate components and
      to mangle characters, use dot only to separate components and use
      underscore to mangle characters.
      
      For golang/go#41862
      
      Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/271726
      a01dda3c
    • François Dumont's avatar
      libstdc++: _Rb_tree code cleanup, remove lambdas · 90bf60c3
      François Dumont authored
      Use new template parameters to replace usage of lambdas to move or not
      tree values on copy.
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/move.h (_GLIBCXX_FWDREF): New.
      	* include/bits/stl_tree.h: Adapt to use latter.
      	(_Rb_tree<>::_M_clone_node): Add _MoveValue template parameter.
      	(_Rb_tree<>::_M_mbegin): New.
      	(_Rb_tree<>::_M_begin): Use latter.
      	(_Rb_tree<>::_M_copy): Add _MoveValues template parameter.
      	* testsuite/23_containers/map/allocator/move_cons.cc: New test.
      	* testsuite/23_containers/multimap/allocator/move_cons.cc: New test.
      	* testsuite/23_containers/multiset/allocator/move_cons.cc: New test.
      	* testsuite/23_containers/set/allocator/move_cons.cc: New test.
      90bf60c3
    • Jan Hubicka's avatar
      Improve hashing of decls in ipa-icf-gimple · d1081010
      Jan Hubicka authored
      Another remaining case is that we end up comparing calls with mismatching
      number of parameters or with different permutations of them.
      
      This is because we hash decls to nothing. This patch improves that by
      hashing decls by their code and parm decls by indexes that are stable.
      Also for defualt defs in SSA_NAMEs we can add the corresponding decl (that
      is usually parm decls).
      
      Still we could improve on this by hasing ssa names by their definit parameters
      and possibly making maps of other decls and assigning them stable function
      local IDs.
      
      	* ipa-icf-gimple.c (func_checker::hash_operand): Improve hashing of
      	decls.
      d1081010
    • Jan Hubicka's avatar
      Only compare sizes of automatic variables · 4c3b16f3
      Jan Hubicka authored
      one of common remaining reasons for ICF to fail after loading in fuction
      body is mismatched type of automatic vairable.   This is becuase
      compatible_types_p resorts to checking TYPE_MAIN_VARIANTS for
      euqivalence that prevents merging many TBAA compaitle cases.  (And thus
      is also not reflected by the hash extended by alias sets of accesses.)
      
      Since in gimple
      automatic variables are just blocks of memory I think we should only
      check its size only. All accesses are matched when copmparing the actual
      loads/stores.
      
      I am not sure if we need to match types of other DECLs but I decided I can try
      to be safe here: for PARM_DECl/RESUILT_DECL we match them anyway to be sure
      that functions are ABI compatible.  For CONST_DECL and readonly global
      VAR_DECLs they are matched when comparing their constructors.
      
      	* ipa-icf-gimple.c (func_checker::compare_decl): Do not compare types
      	of local variables.
      4c3b16f3
    • Andrew MacLeod's avatar
      re: FAIL: gcc.dg/pr97515.c · 65854626
      Andrew MacLeod authored
      Adjust testcase to check in CCP not EVRP.
      
      	gcc/testuite/
      	* gcc.dg/pr97515.c: Check in ccp2, not evrp.
      65854626
    • Andrea Corallo's avatar
      PR target/97727 aarch64: [testcase] fix bf16_vstN_lane_2.c for big endian targets · f671b3d7
      Andrea Corallo authored
      gcc/testsuite/ChangeLog
      
      2020-11-09  Andrea Corallo  <andrea.corallo@arm.com>
      
      	PR target/97727
      	* gcc.target/aarch64/advsimd-intrinsics/bf16_vstN_lane_2.c: Relax
      	regexps.
      f671b3d7
    • Nathan Sidwell's avatar
      doc: Fixup a couple of formatting nits · bf0a3968
      Nathan Sidwell authored
      I noticed a couple of places we used @code{program} instead of
      @command{program}.
      
      	gcc/
      	* doc/invoke.texi: Replace a couple of @code with @command
      bf0a3968
    • Andrea Corallo's avatar
      [PR target/97726] arm: [testsuite] fix some simd tests on armbe · 86706296
      Andrea Corallo authored
      2020-11-10  Andrea Corallo  <andrea.corallo@arm.com>
      
      	PR target/97726
      	* gcc.target/arm/simd/bf16_vldn_1.c: Relax regexps not to fail on
      	big endian.
      	* gcc.target/arm/simd/vldn_lane_bf16_1.c: Likewise
      	* gcc.target/arm/simd/vmmla_1.c: Add -mfloat-abi=hard flag.
      86706296
    • Tamar Christina's avatar
      SLP: Have vectorizable_slp_permutation set type on invariants · ad318e3f
      Tamar Christina authored
      This modifies vectorizable_slp_permutation to update the type of the children
      of a perm node before trying to permute them.  This allows us to be able to
      permute invariant nodes.
      
      This will be covered by test from the SLP pattern matcher.
      
      gcc/ChangeLog:
      
      	* tree-vect-slp.c (vectorizable_slp_permutation): Update types on nodes
      	when needed.
      ad318e3f
    • Jonathan Wakely's avatar
      libstdc++: Remove <memory_resource> dependency from <regex> [PR 92546] · 640ebeb3
      Jonathan Wakely authored
      Unlike the other headers that declare alias templates in namespace pmr,
      <regex> includes <memory_resource>. That was done because the
      pmr::string::const_iterator typedef requires pmr::string to be complete,
      which requires pmr::polymorphic_allocator<char> to be complete.
      
      By using __normal_iterator<const char*, pmr::string> instead of the
      const_iterator typedef we can avoid the completeness requirement.
      
      This makes <regex> smaller, by not requiring <memory_resource> and its
      <shared_mutex> dependency, which depends on <chrono>.  Backporting this
      will also help with PR 97876, where <stop_token> ends up being needed by
      <regex> via <memory_resource>.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/92546
      	* include/std/regex (pmr::smatch, pmr::wsmatch): Declare using
      	underlying __normal_iterator type, not nested typedef
      	basic_string::const_iterator.
      640ebeb3
    • Richard Biener's avatar
      Deal with (pattern) SLP consumed stmts in hybrid discovery · 4405edb4
      Richard Biener authored
      This makes hybrid SLP discovery deal with stmts indirectly consumed
      by SLP, for example via patterns.  This means that all uses of a
      stmt end up in SLP vectorized stmts.
      
      This helps my prototype patches for PR97832 where I make SLP discovery
      re-associate chains to make operands match.  This ends up building
      SLP computation nodes without 1:1 representatives in the scalar IL
      and thus no scalar lane defs in SLP_TREE_SCALAR_STMTS.  Nevertheless
      all of the original scalar stmts are consumed so this represents
      another kind of SLP pattern for the computation chain result.
      
      2020-11-20  Richard Biener  <rguenther@suse.de>
      
      	* tree-vect-slp.c (maybe_push_to_hybrid_worklist): New function.
      	(vect_detect_hybrid_slp): Use it.  Perform a backward walk
      	over the IL.
      4405edb4
    • Richard Biener's avatar
      dump SLP_TREE_REPRESENTATIVE · 6e820b94
      Richard Biener authored
      It always annoyed me to see those empty SLP nodes in dumpfiles:
      
      t.c:16:3: note:   node 0x3a2a280 (max_nunits=1, refcnt=1)
      t.c:16:3: note:         { }
      t.c:16:3: note:         children 0x3a29db0 0x3a29e90
      
      resulting from two-operator handling.  The following makes
      sure to also dump the operation template or VEC_PERM_EXPR.
      
      2020-11-20  Richard Biener  <rguenther@suse.de>
      
      	* tree-vect-slp.c (vect_print_slp_tree): Also dump
      	SLP_TREE_REPRESENTATIVE.
      6e820b94
    • Jakub Jelinek's avatar
      c++: Add __builtin_clear_padding builtin - C++20 P0528R3 compiler side [PR88101] · 1bea0d0a
      Jakub Jelinek authored
      The following patch implements __builtin_clear_padding builtin that clears
      the padding bits in object representation (but preserves value
      representation).  Inside of unions it clears only those padding bits that
      are padding for all the union members (so that it never alters value
      representation).
      
      It handles trailing padding, padding in the middle of structs including
      bitfields (PDP11 unhandled, I've never figured out how those bitfields
      work), VLAs (doesn't handle variable length structures, but I think almost
      nobody uses them and it isn't worth the extra complexity).  For VLAs and
      sufficiently large arrays it uses runtime clearing loop instead of emitting
      straight-line code (unless arrays are inside of a union).
      
      The way I think this can be used for atomics is e.g. if the structures
      are power of two sized and small enough that we use the hw atomics
      for say compare_exchange __builtin_clear_padding could be called first on
      the address of expected and desired arguments (for desired only if we want
      to ensure that most of the time the atomic memory will have padding bits
      cleared), then perform the weak cmpxchg and if that fails, we got the
      value from the atomic memory; we can call __builtin_clear_padding on a copy
      of that and then compare it with expected, and if it is the same with the
      padding bits masked off, we can use the original with whatever random
      padding bits in it as the new expected for next cmpxchg.
      __builtin_clear_padding itself is not atomic and therefore it shouldn't
      be called on the atomic memory itself, but compare_exchange*'s expected
      argument is a reference and normally the implementation may store there
      the current value from memory, so padding bits can be cleared in that,
      and desired is passed by value rather than reference, so clearing is fine
      too.
      When using libatomic, we can use it either that way, or add new libatomic
      APIs that accept another argument, pointer to the padding bit bitmask,
      and construct that in the template as
        alignas (_T) unsigned char _mask[sizeof (_T)];
        std::memset (_mask, ~0, sizeof (_mask));
        __builtin_clear_padding ((_T *) _mask);
      which will have bits cleared for padding bits and set for bits taking part
      in the value representation.  Then libatomic could internally instead
      of using memcmp compare
      for (i = 0; i < N; i++) if ((val1[i] & mask[i]) != (val2[i] & mask[i]))
      
      2020-11-20  Jakub Jelinek  <jakub@redhat.com>
      
      	PR libstdc++/88101
      gcc/
      	* builtins.def (BUILT_IN_CLEAR_PADDING): New built-in function.
      	* gimplify.c (gimplify_call_expr): Rewrite single argument
      	BUILT_IN_CLEAR_PADDING into two-argument variant.
      	* gimple-fold.c (clear_padding_unit, clear_padding_buf_size): New
      	const variables.
      	(struct clear_padding_struct): New type.
      	(clear_padding_flush, clear_padding_add_padding,
      	clear_padding_emit_loop, clear_padding_type,
      	clear_padding_union, clear_padding_real_needs_padding_p,
      	clear_padding_type_may_have_padding_p,
      	gimple_fold_builtin_clear_padding): New functions.
      	(gimple_fold_builtin): Handle BUILT_IN_CLEAR_PADDING.
      	* doc/extend.texi (__builtin_clear_padding): Document.
      gcc/c-family/
      	* c-common.c (check_builtin_function_arguments): Handle
      	BUILT_IN_CLEAR_PADDING.
      gcc/testsuite/
      	* c-c++-common/builtin-clear-padding-1.c: New test.
      	* c-c++-common/torture/builtin-clear-padding-1.c: New test.
      	* c-c++-common/torture/builtin-clear-padding-2.c: New test.
      	* c-c++-common/torture/builtin-clear-padding-3.c: New test.
      	* c-c++-common/torture/builtin-clear-padding-4.c: New test.
      	* c-c++-common/torture/builtin-clear-padding-5.c: New test.
      	* g++.dg/torture/builtin-clear-padding-1.C: New test.
      	* g++.dg/torture/builtin-clear-padding-2.C: New test.
      	* gcc.dg/builtin-clear-padding-1.c: New test.
      1bea0d0a
    • Jakub Jelinek's avatar
      arm: Fix up neon_vector_mem_operand [PR97528] · 410b8f6f
      Jakub Jelinek authored
      The documentation for POST_MODIFY says:
         Currently, the compiler can only handle second operands of the
         form (plus (reg) (reg)) and (plus (reg) (const_int)), where
         the first operand of the PLUS has to be the same register as
         the first operand of the *_MODIFY.
      The following testcase ICEs, because combine just attempts to simplify
      things and ends up with
      (post_modify (reg1) (plus (mult (reg2) (const_int 4)) (reg1))
      but the target predicates accept it, because they only verify
      that POST_MODIFY's second operand is PLUS and the second operand
      of the PLUS is a REG.
      
      The following patch fixes this by performing further verification that
      the POST_MODIFY is in the form it should be.
      
      2020-11-20  Jakub Jelinek  <jakub@redhat.com>
      
      	PR target/97528
      	* config/arm/arm.c (neon_vector_mem_operand): For POST_MODIFY, require
      	first POST_MODIFY operand is a REG and is equal to the first operand
      	of PLUS.
      
      	* gcc.target/arm/pr97528.c: New test.
      410b8f6f
    • Eric Botcazou's avatar
      Plug loophole in string store merging · 1b3c9813
      Eric Botcazou authored
      There is a loophole in new string store merging support added recently:
      it does not check that the stores are consecutive, which is obviously
      required if you want to concatenate them...  Simple fix attached, the
      nice thing being that it can fall back to the regular processing if
      any hole is detected in the series of stores, thanks to the handling
      of STRING_CST by native_encode_expr.
      
      gcc/ChangeLog:
      	* gimple-ssa-store-merging.c (struct merged_store_group): Add
      	new 'consecutive' field.
      	(merged_store_group): Set it to true.
      	(do_merge): Set it to false if the store is not consecutive and
      	set string_concatenation to false in this case.
      	(merge_into): Call do_merge on entry.
      	(merge_overlapping): Likewise.
      
      gcc/testsuite/ChangeLog:
      	* gnat.dg/opt90a.adb: New test.
      	* gnat.dg/opt90b.adb: Likewise.
      	* gnat.dg/opt90c.adb: Likewise.
      	* gnat.dg/opt90d.adb: Likewise.
      	* gnat.dg/opt90e.adb: Likewise.
      	* gnat.dg/opt90a_pkg.ads: New helper.
      	* gnat.dg/opt90b_pkg.ads: Likewise.
      	* gnat.dg/opt90c_pkg.ads: Likewise.
      	* gnat.dg/opt90d_pkg.ads: Likewise.
      	* gnat.dg/opt90e_pkg.ads: Likewise.
      1b3c9813
    • Jan Hubicka's avatar
      Fix comment in ipa-icf-gimple.c · cd287abe
      Jan Hubicka authored
      	* ipa-icf-gimple.c (func_checker::operand_equal_p): Fix comment.
      cd287abe
    • Jan Hubicka's avatar
      Fix comparsion of {CLOBBER} in icf · 8e394101
      Jan Hubicka authored
      after fixing few issues I gotto stage where 1.4M icf mismatches are due to
      comparing two gimple clobber.  The problem is that operand_equal_p match
      clobber
      
      case CONSTRUCTOR:
       /* In GIMPLE empty constructors are allowed in initializers of
          aggregates.  */
       return !CONSTRUCTOR_NELTS (arg0) && !CONSTRUCTOR_NELTS (arg1);
      
      But this happens too late after comparing its types (that are not very relevant
      for memory store).
      
      In the context of ipa-icf we do not really need to match RHS of gimple clobbers:
      it is enough to know that the LHS stores can be considered equivalent.
      
      I this added logic to hash them all the same way and compare using
      TREE_CLOBBER_P flag.  I see other option in extending operand_equal_p
      in fold-const to handle them more generously or making stmt hash and compare
      to skip comparing/hashing RHS of gimple_clobber_p.
      
      	* ipa-icf-gimple.c (func_checker::hash_operand): Hash gimple clobber.
      	(func_checker::operand_equal_p): Special case gimple clobber.
      8e394101
    • Uros Bizjak's avatar
      i386: Optimize abs expansion [PR97873] · fdace758
      Uros Bizjak authored
      The patch introduces absM named pattern to generate optimal insn sequence
      for CMOVE_TARGET targets.  Currently, the expansion goes through neg+max
      optabs, and the following code is generated:
      
      	movl    %edi, %eax
      	negl    %eax
      	cmpl    %edi, %eax
      	cmovl   %edi, %eax
      
      This sequence is unoptimal in two ways.  a) The compare instruction is
      not needed, since NEG insn sets the sign flag based on the result.
      The CMOV can use sign flag to select between negated and original value:
      
      	movl    %edi, %eax
      	negl    %eax
      	cmovs   %edi, %eax
      
      b) On some targets, CMOV is undesirable due to its performance issues.
      In addition to TARGET_EXPAND_ABS bypass, the patch introduces STV
      conversion of abs RTX to use PABS SSE insn:
      
      	vmovd   %edi, %xmm0
      	vpabsd  %xmm0, %xmm0
      	vmovd   %xmm0, %eax
      
      The patch changes compare mode of NEG instruction to CCGOCmode,
      which is the same mode as the mode of SUB instruction. IOW, sign bit
      becomes usable.
      
      Also, the mode iterator of <maxmin:code><mode>3 pattern is changed
      to SWI48x instead of SWI248. The purpose of maxmin expander is to
      prepare max/min RTX for STV to eventually convert them to SSE PMAX/PMIN
      instructions, in order to *avoid* CMOV insns with general registers.
      
      2020-11-20  Uroš Bizjak  <ubizjak@gmail.com>
      
      gcc/
      	PR target/97873
      	* config/i386/i386.md (*neg<mode>2_2): Rename from
      	"*neg<mode>2_cmpz".  Use CCGOCmode instead of CCZmode.
      	(*negsi2_zext): Rename from *negsi2_cmpz_zext.
      	Use CCGOCmode instead of CCZmode.
      	(*neg<mode>_ccc_1): New insn pattern.
      	(*neg<dwi>2_doubleword): Use *neg<mode>_ccc_1.
      
      	(abs<mode>2): Add FLAGS_REG clobber.
      	Use TARGET_CMOVE insn predicate.
      	(*abs<mode>2_1): New insn_and_split pattern.
      	(*absdi2_doubleword): Ditto.
      
      	(<maxmin:code><mode>3): Use SWI48x mode iterator.
      	(*<maxmin:code><mode>3): Use SWI48 mode iterator.
      
      	* config/i386/i386-features.c
      	(general_scalar_chain::compute_convert_gain): Handle ABS code.
      	(general_scalar_chain::convert_insn): Ditto.
      	(general_scalar_to_vector_candidate_p): Ditto.
      
      gcc/testsuite/
      	PR target/97873
      	* gcc.target/i386/pr97873.c: New test.
      	* gcc.target/i386/pr97873-1.c: New test.
      fdace758
    • Jakub Jelinek's avatar
      configury: Fix up --enable-link-serialization support · a774a6a2
      Jakub Jelinek authored
      Eric reported that the --enable-link-serialization changes seemed to
      cause the binaries to be always relinked, for example from the
      gcc/ directory of the build tree:
      make
      [relink of gnat1, brig1, cc1plus, d21, f951, go1, lto1, ...]
      make
      [relink of gnat1, brig1, cc1plus, d21, f951, go1, lto1, ...]
      Furthermore as reported in PR, it can cause problems during make install
      where make install rebuilds the binaries again.
      
      The problem is that for make .PHONY targets are just
      "rebuilt" always, so it is very much undesirable for the cc1plus$(exeext)
      etc. dependencies to include .PHONY targets, but I was using
      them - cc1plus.prev which would depend on some *.serial and
      e.g. cc1.serial depending on c and c depending on cc1$(exeext).
      
      The following patch rewrites this so that *.serial and *.prev aren't
      .PHONY targets, but instead just make variables.
      
      I was worried that the order in which the language makefile fragments are
      included (which is quite random, what order we get from the filesystem
      matching */config-lang.in) would be a problem but it seems to work fine
      - as it uses make = rather than := variables, later definitions are just
      fine for earlier uses as long as the uses aren't needed during the
      makefile parsing, but only in the dependencies of make targets and in
      their commands.
      
      2020-11-20  Jakub Jelinek  <jakub@redhat.com>
      
      	PR other/97911
      gcc/
      	* configure.ac: In SERIAL_LIST use lang words without .serial
      	suffix.  Change $lang.prev from a target to variable and instead
      	of depending on *.serial expand to the *.serial variable if
      	the word is in the SERIAL_LIST at all, otherwise to nothing.
      	* configure: Regenerated.
      gcc/c/
      	* Make-lang.in (c.serial): Change from goal to a variable.
      	(.PHONY): Drop c.serial.
      gcc/ada/
      	* gcc-interface/Make-lang.in (ada.serial): Change from goal to a
      	variable.
      	(.PHONY): Drop ada.serial and ada.prev.
      	(gnat1$(exeext)): Depend on $(ada.serial) rather than ada.serial.
      gcc/brig/
      	* Make-lang.in (brig.serial): Change from goal to a variable.
      	(.PHONY): Drop brig.serial and brig.prev.
      	(brig1$(exeext)): Depend on $(brig.serial) rather than brig.serial.
      gcc/cp/
      	* Make-lang.in (c++.serial): Change from goal to a variable.
      	(.PHONY): Drop c++.serial and c++.prev.
      	(cc1plus$(exeext)): Depend on $(c++.serial) rather than c++.serial.
      gcc/d/
      	* Make-lang.in (d.serial): Change from goal to a variable.
      	(.PHONY): Drop d.serial and d.prev.
      	(d21$(exeext)): Depend on $(d.serial) rather than d.serial.
      gcc/fortran/
      	* Make-lang.in (fortran.serial): Change from goal to a variable.
      	(.PHONY): Drop fortran.serial and fortran.prev.
      	(f951$(exeext)): Depend on $(fortran.serial) rather than
      	fortran.serial.
      gcc/go/
      	* Make-lang.in (go.serial): Change from goal to a variable.
      	(.PHONY): Drop go.serial and go.prev.
      	(go1$(exeext)): Depend on $(go.serial) rather than go.serial.
      gcc/jit/
      	* Make-lang.in (jit.serial): Change from goal to a
      	variable.
      	(.PHONY): Drop jit.serial and jit.prev.
      	($(LIBGCCJIT_FILENAME)): Depend on $(jit.serial) rather than
      	jit.serial.
      gcc/lto/
      	* Make-lang.in (lto1.serial, lto2.serial): Change from goals to
      	variables.
      	(.PHONY): Drop lto1.serial, lto2.serial, lto1.prev and lto2.prev.
      	($(LTO_EXE)): Depend on $(lto1.serial) rather than lto1.serial.
      	($(LTO_DUMP_EXE)): Depend on $(lto2.serial) rather than lto2.serial.
      gcc/objc/
      	* Make-lang.in (objc.serial): Change from goal to a variable.
      	(.PHONY): Drop objc.serial and objc.prev.
      	(cc1obj$(exeext)): Depend on $(objc.serial) rather than objc.serial.
      gcc/objcp/
      	* Make-lang.in (obj-c++.serial): Change from goal to a variable.
      	(.PHONY): Drop obj-c++.serial and obj-c++.prev.
      	(cc1objplus$(exeext)): Depend on $(obj-c++.serial) rather than
      	obj-c++.serial.
      a774a6a2
    • Kewen Lin's avatar
      rs6000: Fix p8_mtvsrd_df's insn type · 02109ea2
      Kewen Lin authored
      This patch is to fix insn type of p8_mtvsrd_df from mfvsr to mtvsr,
      in order to align with the other places using mtvsrd.
      
      gcc/ChangeLog:
      
      	* config/rs6000/rs6000.md (p8_mtvsrd_df): Fix insn type.
      02109ea2
    • Martin Uecker's avatar
      C: Drop qualifiers during lvalue conversion [PR97702] · 32934a4f
      Martin Uecker authored
      2020-11-20  Martin Uecker  <muecker@gwdg.de>
      
      gcc/
      	* gimplify.c (gimplify_modify_expr_rhs): Optimizie
      	NOP_EXPRs that contain compound literals.
      
      gcc/c/
      	* c-typeck.c (convert_lvalue_to_rvalue): Drop qualifiers.
      
      gcc/testsuite/
      	* gcc.dg/cond-constqual-1.c: Adapt test.
      	* gcc.dg/lvalue-11.c: New test.
      	* gcc.dg/pr60195.c: Add warning.
      32934a4f
    • GCC Administrator's avatar
      Daily bump. · d62586ee
      GCC Administrator authored
      d62586ee
  3. Nov 19, 2020
    • Jakub Jelinek's avatar
      ranger: Improve a % b operand ranges [PR91029] · d3f29334
      Jakub Jelinek authored
      As mentioned in the PR, the previous PR91029 patch was testing
      op2 >= 0 which is unnecessary, even negative op2 values will work the same,
      furthermore, from if a % b > 0 we can deduce a > 0 rather than just a >= 0
      (0 % b would be 0), and it actually valid even for other constants than 0,
      a % b > 5 means a > 5 (a % b has the same sign as a and a in [0, 5] would
      result in a % b in [0, 5].  Also, we can deduce a range for the other
      operand, if we know
      a % b >= 20, then b must be (in absolute value for signed modulo) > 20,
      for a % [0, 20] the result would be [0, 19].
      
      2020-11-19  Jakub Jelinek  <jakub@redhat.com>
      
      	PR tree-optimization/91029
      	* range-op.cc (operator_trunc_mod::op1_range): Don't require signed
      	types, nor require that op2 >= 0.  Implement (a % b) >= x && x > 0
      	implies a >= x and (a % b) <= x && x < 0 implies a <= x.
      	(operator_trunc_mod::op2_range): New method.
      
      	* gcc.dg/tree-ssa/pr91029-1.c: New test.
      	* gcc.dg/tree-ssa/pr91029-2.c: New test.
      d3f29334
    • Andrew MacLeod's avatar
      Process only valid shift ranges. · d0d8b5d8
      Andrew MacLeod authored
      When shifting outside the valid range of [0, precision-1], we can
      choose to process just the valid ones since the rest is undefined.
      this allows us to produce results for x << [0,2][+INF, +INF] by discarding
      the invalid ranges and processing just [0,2].
      
      	gcc/
      	PR tree-optimization/93781
      	* range-op.cc (get_shift_range): Rename from
      	undefined_shift_range_check and now return valid shift ranges.
      	(operator_lshift::fold_range): Use result from get_shift_range.
      	(operator_rshift::fold_range): Ditto.
      	gcc/testsuite/
      	* gcc.dg/tree-ssa/pr93781-1.c: New.
      	* gcc.dg/tree-ssa/pr93781-2.c: New.
      	* gcc.dg/tree-ssa/pr93781-3.c: New.
      d0d8b5d8
    • Nathan Sidwell's avatar
      c++: Template hash access · 5bba2215
      Nathan Sidwell authored
      This exposes the template specialization table, so the modules
      machinery may access it.  The hashed entity (tmpl, args & spec) is
      available, along with a hash table walker.  We also need a way of
      finding or inserting entries, along with some bookkeeping fns to deal
      with the instantiation and (partial) specialization lists.
      
      	gcc/cp/
      	* cp-tree.h (struct spec_entry): Moved from pt.c.
      	(walk_specializations, match_mergeable_specialization)
      	(get_mergeable_specialization_flags)
      	(add_mergeable_specialization): Declare.
      	* pt.c (struct spec_entry): Moved to cp-tree.h.
      	(walk_specializations, match_mergeable_specialization)
      	(get_mergeable_specialization_flags)
      	(add_mergeable_specialization): New.
      5bba2215
    • Jonathan Wakely's avatar
      libstdc++: Avoid calling undefined __gthread_self weak symbol [PR 95989] · 08b4d325
      Jonathan Wakely authored
      Since glibc 2.27 the pthread_self symbol has been defined in libc rather
      than libpthread. Because we only call pthread_self through a weak alias
      it's possible for statically linked executables to end up without a
      definition of pthread_self. This crashes when trying to call an
      undefined weak symbol.
      
      We can use the __GLIBC_PREREQ version check to detect the version of
      glibc where pthread_self is no longer in libpthread, and call it
      directly rather than through the weak reference.
      
      It would be better to check for pthread_self in libc during configure
      instead of hardcoding the __GLIBC_PREREQ check. That would be
      complicated by the fact that prior to glibc 2.27 libc.a didn't have the
      pthread_self symbol, but libc.so.6 did.  The configure checks would need
      to try to link both statically and dynamically, and the result would
      depend on whether the static libc.a happens to be installed during
      configure (which could vary between different systems using the same
      version of glibc). Doing it properly is left for a future date, as that
      will be needed anyway after glibc moves all pthread symbols from
      libpthread to libc. When that happens we should revisit the whole
      approach of using weak symbols for pthread symbols.
      
      For the purposes of std::this_thread::get_id() we call
      pthread_self() directly when using glibc 2.27 or later. Otherwise, if
      __gthread_active_p() is true then we know the libpthread symbol is
      available so we call that. Otherwise, we are single-threaded and just
      use ((__gthread_t)1) as the thread ID.
      
      An undesirable consequence of this change is that code compiled prior to
      the change might inline the old definition of this_thread::get_id()
      which always returns (__gthread_t)1 in a program that isn't linked to
      libpthread. Code compiled after the change will use pthread_self() and
      so get a real TID. That could result in the main thread having different
      thread::id values in different translation units. This seems acceptable,
      as there are not expected to be many uses of thread::id in programs
      that aren't linked to libpthread.
      
      An earlier version of this patch also changed __gthread_self() to use
      __GLIBC_PREREQ(2, 27) and only use the weak symbol for older glibc. Tha
      might still make sense to do, but isn't needed by libstdc++ now.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/95989
      	* config/os/gnu-linux/os_defines.h (_GLIBCXX_NATIVE_THREAD_ID):
      	Define new macro to get reliable thread ID.
      	* include/bits/std_thread.h: (this_thread::get_id): Use new
      	macro if it's defined.
      	* testsuite/30_threads/jthread/95989.cc: New test.
      	* testsuite/30_threads/this_thread/95989.cc: New test.
      08b4d325
Loading