Skip to content
Snippets Groups Projects
  1. Nov 11, 2020
    • Patrick Palka's avatar
      c++: Correct the handling of alignof(expr) [PR88115] · 61827d5d
      Patrick Palka authored
      We're currently neglecting to set the ALIGNOF_EXPR_STD_P flag on an
      ALIGNOF_EXPR when its operand is an expression.  This leads to us
      handling alignof(expr) as if it were written __alignof__(expr), and
      returning the preferred alignment instead of the ABI alignment.  In the
      testcase below, this causes the first and third static_assert to fail on
      x86.
      
      gcc/cp/ChangeLog:
      
      	PR c++/88115
      	* cp-tree.h (cxx_sizeof_or_alignof_expr): Add bool parameter.
      	* decl.c (fold_sizeof_expr): Pass false to
      	cxx_sizeof_or_alignof_expr.
      	* parser.c (cp_parser_unary_expression): Pass std_alignof to
      	cxx_sizeof_or_alignof_expr.
      	* pt.c (tsubst_copy): Pass false to cxx_sizeof_or_alignof_expr.
      	(tsubst_copy_and_build): Pass std_alignof to
      	cxx_sizeof_or_alignof_expr.
      	* typeck.c (cxx_alignof_expr): Add std_alignof bool parameter
      	and pass it to cxx_sizeof_or_alignof_type.  Set ALIGNOF_EXPR_STD_P
      	appropriately.
      	(cxx_sizeof_or_alignof_expr): Add std_alignof bool parameter
      	and pass it to cxx_alignof_expr.  Assert op is either
      	SIZEOF_EXPR or ALIGNOF_EXPR.
      
      libcc1/ChangeLog:
      
      	PR c++/88115
      	* libcp1plugin.cc (plugin_build_unary_expr): Pass true to
      	cxx_sizeof_or_alignof_expr.
      
      gcc/testsuite/ChangeLog:
      
      	PR c++/88115
      	* g++.dg/cpp0x/alignof6.C: New test.
      61827d5d
    • Marek Polacek's avatar
      c++: Tweak tsubst_qualified_id location. · d6e5745a
      Marek Polacek authored
      Retain the location when tsubstituting a qualified-id so that our
      static_assert diagnostic can benefit.  Don't create useless location
      wrappers for temporary variables.
      
      gcc/ChangeLog:
      
      	PR c++/97518
      	* tree.c (maybe_wrap_with_location): Don't add a location
      	wrapper around an artificial and ignored decl.
      
      gcc/cp/ChangeLog:
      
      	PR c++/97518
      	* pt.c (tsubst_qualified_id): Use EXPR_LOCATION of the qualified-id.
      	Use it to maybe_wrap_with_location the final expression.
      
      gcc/testsuite/ChangeLog:
      
      	PR c++/97518
      	* g++.dg/diagnostic/static_assert3.C: New test.
      d6e5745a
    • Richard Biener's avatar
      Fix PRE NEW_SETS guarding · 2e8b368c
      Richard Biener authored
      Accesses to NEW_SETS should be properly guarded.  Committed
      as obvious.
      
      2020-11-11  Richard Biener  <rguenther@suse.de>
      
      	PR tree-optimization/97623
      	* tree-ssa-pre.c (create_expression_by_pieces): Guard
      	NEW_SETS access.
      	(insert_into_preds_of_block): Likewise.
      2e8b368c
    • Jonathan Yong's avatar
      libstdc++: Exclude cygwin and mingw from linker relro support · 505ea909
      Jonathan Yong authored
      PE format does not have ELF style relro linker support, exclude
      from checking. If the host linker supports ELF format, configure
      may get confused.
      
      libstdc++-v3/ChangeLog:
      
      	* acinclude.m4 (GLIBCXX_CHECK_LINKER_FEATURES): Exclude
      	cygwin and mingw from relro linker test.
      	* configure: Regenerate.
      505ea909
    • Richard Biener's avatar
      Fix PRE topological expression set sorting · 86cca5cc
      Richard Biener authored
      This fixes sorted_array_from_bitmap_set to do a topological sort
      as required by re-using what PHI-translation does, namely a DFS
      walk with the help of bitmap_find_leader.  The proper result
      is verified by extra checking in clean () (which would have tripped
      before) and for the testcase I'm working at during the last
      patches (PR97623) it is neutral in compile-time cost.
      
      2020-11-11  Richard Biener  <rguenther@suse.de>
      
      	* tree-ssa-pre.c (pre_expr_DFS): New function.
      	(sorted_array_from_bitmap_set): Use it to properly
      	topologically sort the expression set.
      	(clean): Verify we've cleaned everything we should.
      86cca5cc
    • Jakub Jelinek's avatar
      testsuite: Fix up scan-tree-dump-times regexps for 64-bit targets · 364ad1d4
      Jakub Jelinek authored
      The added (?:_ull) match on 32-bit targets, but are equivalent to just
      adding _ull into the strings, i.e. require the _ull substrings, while
      the intent is that they are optional, so we should use (?:_ull)? instead.
      
      2020-11-11  Jakub Jelinek  <jakub@redhat.com>
      
      	* gfortran.dg/gomp/workshare-reduction-3.f90: Use (?:_ull)? instead
      	of (?:_ull) in the scan-tree-dump-times directives.
      	* gfortran.dg/gomp/workshare-reduction-26.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-27.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-28.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-36.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-37.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-38.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-39.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-40.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-41.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-42.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-43.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-44.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-45.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-46.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-47.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-56.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-57.f90: Likewise.
      364ad1d4
    • Eric Botcazou's avatar
      Remove superfluous call to Base_Type · ce2d0ce2
      Eric Botcazou authored
      gcc/ada/ChangeLog:
      	* gcc-interface/gigi.h: Remove ^L characters throughout.
      	* gcc-interface/decl.c: Likewise.
      	* gcc-interface/utils.c: Likewise.
      	* gcc-interface/utils2.c: Likewise.
      	* gcc-interface/trans.c (gnat_to_gnu) <N_Allocator>: Do not explicitly
      	go to the base type for the Has_Constrained_Partial_View flag.
      ce2d0ce2
    • Eric Botcazou's avatar
      Fix biased integer arithmetic · 4e1a2158
      Eric Botcazou authored
      The Ada compiler uses a biased representation when a size clause reserves
      fewer bits than normal either for the lower or for the upper bound.
      
      gcc/ada/ChangeLog:
      	* gcc-interface/trans.c (build_binary_op_trapv): Convert operands
      	to the result type before doing generic overflow checking.
      
      gcc/testsuite/ChangeLog:
      	* gnat.dg/bias2.adb: New test.
      4e1a2158
    • Eric Botcazou's avatar
      Fix segfault on elaboration of empty 1-element array at -O · ec1b8711
      Eric Botcazou authored
      This is a rather obscure case where the elaboration of an empty array
      whose base type is an array type of length at most 1 goes awry when
      the code is compiled with optimization.
      
      gcc/ada/ChangeLog:
      	* gcc-interface/trans.c (can_be_lower_p): Remove.
      	(Regular_Loop_to_gnu): Add ENTRY_COND unconditionally if
      	BOTTOM_COND is non-zero.
      
      gcc/testsuite/ChangeLog:
      	* gnat.dg/opt89.adb: New test.
      ec1b8711
    • Eric Botcazou's avatar
      Fix internal error on chain of constants with -gnatc · 1c91516a
      Eric Botcazou authored
      gcc/ada/ChangeLog:
      	* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Constant>: In case
      	the constant is not being defined, get the expression in type
      	annotation mode only if its type is elementary.
      1c91516a
    • Eric Botcazou's avatar
      Fix internal error with Shift_Right operator on signed type · 1f8fc1f4
      Eric Botcazou authored
      This is a regression present on the mainline and 10 branch in the form
      of an ICE with a shift operator applied to a variable of a signed type,
      and which is caused by a type mismatch.
      
      gcc/ada/ChangeLog:
      	* gcc-interface/trans.c (gnat_to_gnu) <N_Op_Shift>: Also convert
      	GNU_MAX_SHIFT if the type of the operation has been changed.
      	* gcc-interface/utils.c (can_materialize_object_renaming_p): Add
      	pair of missing parentheses.
      
      gcc/testsuite/ChangeLog:
      	* gnat.dg/shift1.adb: New test.
      1f8fc1f4
    • Richard Biener's avatar
      testsuite/97797 - adjust GIMPLE tests for sizetype · 4ac93608
      Richard Biener authored
      Tested on x86_64-unknown-linux-gnu, pushed.
      
      2020-11-11  Richard Biener  <rguenther@suse.de>
      
      	PR testsuite/97797
      	* gcc.dg/torture/ssa-fre-5.c: Use __SIZETYPE__ where
      	appropriate.
      	* gcc.dg/torture/ssa-fre-6.c: Likewise.
      4ac93608
    • Richard Biener's avatar
      tree-optimization/97623 - Avoid PRE hoist insertion iteration · bd87cc14
      Richard Biener authored
      The recent previous change in this area limited hoist insertion
      iteration via a param but the following is IMHO better since
      we are not really interested in PRE opportunities exposed by
      hoisting but only the other way around.  So this moves hoist
      insertion after PRE iteration finished and removes hoist
      insertion iteration alltogether.
      
      2020-11-11  Richard Biener  <rguenther@suse.de>
      
      	PR tree-optimization/97623
      	* params.opt (-param=max-pre-hoist-insert-iterations): Remove
      	again.
      	* doc/invoke.texi (max-pre-hoist-insert-iterations): Likewise.
      	* tree-ssa-pre.c (insert): Move hoist insertion after PRE
      	insertion iteration and do not iterate it.
      
      	* gcc.dg/tree-ssa/ssa-hoist-3.c: Adjust.
      	* gcc.dg/tree-ssa/ssa-hoist-7.c: Likewise.
      	* gcc.dg/tree-ssa/ssa-pre-30.c: Likewise.
      bd87cc14
    • Richard Sandiford's avatar
      aarch64: Support SVE comparisons for unpacked integers · 46c705e7
      Richard Sandiford authored
      This patch adds support for comparing unpacked SVE integer vectors,
      such as byte elements stored in the bottom bytes of halfword
      containers.  It also adds support for selects between unpacked
      SVE vectors (both integer and floating-point), since selects and
      compares are closely tied via the vcond optab interface.
      
      gcc/
      	* config/aarch64/aarch64-sve.md (@vcond_mask_<mode><vpred>): Extend
      	from SVE_FULL to SVE_ALL.
      	(*vcond_mask_<mode><vpred>): Likewise.
      	(@aarch64_sel_dup<mode>): Likewise.
      	(vcond<SVE_FULL:mode><v_int_equiv>): Extend to...
      	(vcond<SVE_ALL:mode><SVE_I:mode>): ...this, but requiring the
      	sizes of the container modes to match.
      	(vcondu<SVE_FULL:mode><v_int_equiv>): Extend to...
      	(vcondu<SVE_ALL:mode><SVE_I:mode>): ...this.
      	(vec_cmp<SVE_FULL_I:mode><vpred>): Extend to...
      	(vec_cmp<SVE_I:mode><vpred>): ...this.
      	(vec_cmpu<SVE_FULL_I:mode><vpred>): Extend to...
      	(vec_cmpu<SVE_I:mode><vpred>): ...this.
      	(@aarch64_pred_cmp<cmp_op><SVE_FULL_I:mode>): Extend to...
      	(@aarch64_pred_cmp<cmp_op><SVE_I:mode>): ...this.
      	(*cmp<cmp_op><SVE_FULL_I:mode>_cc): Extend to...
      	(*cmp<cmp_op><SVE_I:mode>_cc): ...this.
      	(*cmp<cmp_op><SVE_FULL_I:mode>_ptest): Extend to...
      	(*cmp<cmp_op><SVE_I:mode>_ptest): ...this.
      	(*cmp<cmp_op><SVE_FULL_I:mode>_and): Extend to...
      	(*cmp<cmp_op><SVE_I:mode>_and): ...this.
      
      gcc/testsuite/
      	* gcc.target/aarch64/sve/cmp_1.c: New test.
      	* gcc.target/aarch64/sve/cmp_2.c: Likewise.
      	* gcc.target/aarch64/sve/cond_arith_1.c: Add --param
      	aarch64-sve-compare-costs=0
      	* gcc.target/aarch64/sve/cond_arith_1_run.c: Likewise.
      	* gcc.target/aarch64/sve/cond_arith_3.c: Likewise.
      	* gcc.target/aarch64/sve/cond_arith_3_run.c: Likewise.
      	* gcc.target/aarch64/sve/mask_gather_load_7.c: Likewise.
      	* gcc.target/aarch64/sve/mask_load_slp_1.c: Likewise.
      	* gcc.target/aarch64/sve/vcond_11.c: Likewise.
      	* gcc.target/aarch64/sve/vcond_11_run.c: Likewise.
      46c705e7
    • Richard Sandiford's avatar
      vect: Allow vconds between different vector sizes · e29dd0eb
      Richard Sandiford authored
      The vcond code requires the compared vectors and the selected
      vectors to have both the same size and the same number of elements
      as each other.  But the operation makes logical sense even for
      different vector sizes.  E.g. you could compare two V4SIs and
      use the result to select between two V4DIs.
      
      The underlying optab already allows the compared mode and the selected
      mode to be specified separately.  Since the vectoriser now also
      supports mixed vector sizes, I think we can simply remove the
      equal-size check and just keep the equal-lanes check.  It's then
      up to the target to decide which (if any) mixtures of sizes it
      supports.
      
      gcc/
      	* optabs-tree.c (expand_vec_cond_expr_p): Allow the compared values
      	and the selected values to have different mode sizes.
      	* gimple-isel.cc (gimple_expand_vec_cond_expr): Likewise.
      e29dd0eb
    • Paul Scharnofske's avatar
      libstdc++: Assigning to a joinable std::jthread calls std::terminate · 0ebaea3b
      Paul Scharnofske authored
      
      Move assigning to a std::jthread that represents a thread of execution
      needs to send a stop request and join that running thread. Otherwise the
      std::thread data member will terminate in its assignment operator.
      
      Co-authored-by: default avatarJonathan Wakely <jwakely@redhat.com>
      
      libstdc++-v3/ChangeLog:
      
      	* include/std/thread (jthread::operator=(jthread&&)): Transfer
      	any existing state to a temporary that will request a stop and
      	then join.
      	* testsuite/30_threads/jthread/jthread.cc: Test move assignment.
      0ebaea3b
    • Jonathan Wakely's avatar
      libstdc++: Use helper type for checking thread ID · 43f9e5af
      Jonathan Wakely authored
      This encapsulates the storing and checking of the thread ID into a class
      type, so that the macro _GLIBCXX_HAS_GTHREADS is only checked in one
      place. The code doing the checks just calls member functions of the new
      type, without caring whether that really does any work or not.
      
      libstdc++-v3/ChangeLog:
      
      	* include/std/stop_token (_Stop_state_t::_M_requester): Define
      	new struct with members to store and check the thread ID.
      	(_Stop_state_t::_M_request_stop()): Use _M_requester._M_set().
      	(_Stop_state_t::_M_remove_callback(_Stop_cb*)): Use
      	_M_requester._M_is_current_thread().
      43f9e5af
    • liuhongt's avatar
      Support Intel AVX VNNI · ca813880
      liuhongt authored
      2020-10-13  Hongtao Liu  <hongtao.liu@intel.com>
      	    Hongyu Wang  <hongyu.wang@intel.com>
      
      gcc/
      	* common/config/i386/cpuinfo.h (get_available_features):
      	Detect AVXVNNI.
      	* common/config/i386/i386-common.c
      	(OPTION_MASK_ISA2_AVXVNNI_SET,
      	OPTION_MASK_ISA2_AVXVNNI_UNSET): New.
      	(OPTION_MASK_ISA2_AVX2_UNSET): Add AVXVNNI.
      	(ix86_hanlde_option): Handle -mavxvnni, unset avxvnni when
      	avx2 is disabled.
      	* common/config/i386/i386-cpuinfo.h (enum processor_features):
      	Add FEATURE_AVXVNNI.
      	* common/config/i386/i386-isas.h: Add ISA_NAMES_TABLE_ENTRY
      	for avxvnni.
      	* config.gcc: Add avxvnniintrin.h.
      	* config/i386/avx512vnnivlintrin.h: Reimplement 128/256 bit non-mask
      	intrinsics with macros to support unified interface.
      	* config/i386/avxvnniintrin.h: New header file.
      	* config/i386/cpuid.h (bit_AVXVNNI): New.
      	* config/i386/i386-builtins.c (def_builtin): Handle AVXVNNI mask
      	for unified builtin.
      	* config/i386/i386-builtin.def (BDESC): Adjust AVX512VNNI
      	builtins for AVXVNNI.
      	* config/i386/i386-c.c (ix86_target_macros_internal): Define
      	__AVXVNNI__.
      	* config/i386/i386-expand.c (ix86_expand_builtin): Handle bisa
      	for AVXVNNI to support unified intrinsic name, since there is no
      	dependency between AVX512VNNI and AVXVNNI.
      	* config/i386/i386-options.c (isa2_opts): Add -mavxvnni.
      	(ix86_valid_target_attribute_inner_p): Handle avxnnni.
      	(ix86_option_override_internal): Ditto.
      	* config/i386/i386.h (TARGET_AVXVNNI, TARGET_AVXVNNI_P,
      	TARGET_AVXVNNI_P, PTA_AVXVNNI): New.
      	(PTA_SAPPHIRERAPIDS): Add AVX_VNNI.
      	(PTA_ALDERLAKE): Likewise.
      	* config/i386/i386.md ("isa"): Add avxvnni, avx512vnnivl.
      	("enabled"): Adjust for avxvnni and avx512vnnivl.
      	* config/i386/i386.opt: Add option -mavxvnni.
      	* config/i386/immintrin.h: Include avxvnniintrin.h.
      	* config/i386/sse.md (vpdpbusd_<mode>): Adjust for AVXVNNI.
      	(vpdpbusds_<mode>): Likewise.
      	(vpdpwssd_<mode>): Likewise.
      	(vpdpwssds_<mode>): Likewise.
      	(vpdpbusd_v16si): New.
      	(vpdpbusds_v16si): Likewise.
      	(vpdpwssd_v16si): Likewise.
      	(vpdpwssds_v16si): Likewise.
      	* doc/invoke.texi: Document -mavxvnni.
      	* doc/extend.texi: Document avxvnni.
      	* doc/sourcebuild.texi: Document target avxvnni.
      
      gcc/testsuite/
      
      	* gcc.target/i386/avx512vl-vnni-1.c: Rename..
      	* gcc.target/i386/avx512vl-vnni-1a.c: To This.
      	* gcc.target/i386/avx512vl-vnni-1b.c: New test.
      	* gcc.target/i386/avx512vl-vnni-2.c: Ditto.
      	* gcc.target/i386/avx512vl-vnni-3.c: Ditto.
      	* gcc.target/i386/avx-vnni-1.c: Ditto.
      	* gcc.target/i386/avx-vnni-2.c: Ditto.
      	* gcc.target/i386/avx-vnni-3.c: Ditto.
      	* gcc.target/i386/avx-vnni-4.c: Ditto.
      	* gcc.target/i386/avx-vnni-5.c: Ditto.
      	* gcc.target/i386/avx-vnni-6.c: Ditto.
      	* gcc.target/i386/avx-vpdpbusd-2.c: Ditto.
      	* gcc.target/i386/avx-vpdpbusds-2.c: Ditto.
      	* gcc.target/i386/avx-vpdpwssd-2.c: Ditto.
      	* gcc.target/i386/avx-vpdpwssds-2.c: Ditto.
      	* gcc.target/i386/vnni_inline_error.c: Ditto.
      	* gcc.target/i386/avx512vnnivl-builtin.c: Ditto.
      	* gcc.target/i386/avxvnni-builtin.c: Ditto.
      	* gcc.target/i386/funcspec-56.inc: Add new target attribute.
      	* gcc.target/i386/sse-12.c: Add -mavxvnni.
      	* gcc.target/i386/sse-13.c: Ditto.
      	* gcc.target/i386/sse-14.c: Ditto.
      	* gcc.target/i386/sse-22.c: Ditto.
      	* gcc.target/i386/sse-23.c: Ditto.
      	* g++.dg/other/i386-2.C: Ditto.
      	* g++.dg/other/i386-3.C: Ditto.
      	* lib/target-supports.exp (check_effective_target_avxvnni):
      	New proc.
      ca813880
    • Martin Liska's avatar
      Fix spelling. · fbb3e275
      Martin Liska authored
      gcc/ChangeLog:
      
      	* tree.c (copy_node): Fix spelling.
      fbb3e275
    • Richard Biener's avatar
      Drop topological sort for PRE phi-translation · 57f07665
      Richard Biener authored
      The topological sort sorted_array_from_bitmap_set is supposed to
      provide isn't one since quite some time since value_ids are
      assigned first to SSA names in the order of SSA_NAME_VERSION
      and then to hashtable entries in the order they appear in the
      table.  One can even argue that expression-ids provide a closer
      approximation of a topological sort since those are assigned
      during AVAIL_OUT computation which is done in a dominator walk.
      
      Now - phi-translation is not even depending on topological sorting
      but it essentially does a DFS walk, phi-translating expressions
      it depends on and relying on phi-translation caching to avoid
      doing redundant work.
      
      So this patch drops the use of sorted_array_from_bitmap_set from
      phi_translate_set because this function is quite expensive.
      
      2020-11-11  Richard Biener  <rguenther@suse.de>
      
      	* tree-ssa-pre.c (phi_translate_set): Do not sort the
      	expression set topologically.
      57f07665
    • Aldy Hernandez's avatar
      Early exit on VR_VARYING from irange::set. · c76c23a0
      Aldy Hernandez authored
      gcc/ChangeLog:
      
      	* value-range.cc (irange::set): Early exit on VR_VARYING.
      c76c23a0
    • zhengnannan's avatar
      AArch64: Add FLAG for arithmetic operation intrinsics [PR94442] · 7a9a5d1a
      zhengnannan authored
      2020-11-11  Zhiheng Xie  <xiezhiheng@huawei.com>
      	    Nannan Zheng  <zhengnannan@huawei.com>
      
      gcc/ChangeLog:
      
      	* config/aarch64/aarch64-simd-builtins.def: Add proper FLAG
      	for arithmetic operation intrinsics.
      7a9a5d1a
    • Tobias Burnus's avatar
      gfortran.dg/gomp/workshare-reduction-*.f90: Fix dumps for -m32 · 1644ab99
      Tobias Burnus authored
      gcc/testsuite/ChangeLog:
      
      	* gfortran.dg/gomp/workshare-reduction-26.f90: Add (?:_ull) to
      	scan-tree-dump-times regex for -m32.
      	* gfortran.dg/gomp/workshare-reduction-27.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-28.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-3.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-36.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-37.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-38.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-39.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-40.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-41.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-42.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-43.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-44.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-45.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-46.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-47.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-56.f90: Likewise.
      	* gfortran.dg/gomp/workshare-reduction-57.f90: Likewise.
      1644ab99
    • Jakub Jelinek's avatar
      fortran: Fix up gfc_typename CHARACTER length handling [PR97768] · 81372618
      Jakub Jelinek authored
      The first testcase below ICEs when f951 is 32-bit (or 64-bit big-endian).
      The problem is that ex->ts.u.cl && ex->ts.u.cl->length are both non-NULL,
      but ex->ts.u.cl->length->expr_type is not EXPR_CONSTANT, but EXPR_FUNCTION.
      value.function.actual and value.function.name are in that case pointers,
      but value._mp_alloc and value._mp_size are 4 byte integers no matter what.
      So, in 64-bit little-endian the function returns most of the time incorrect
      CHARACTER(0) because the most significant 32 bits of the
      value.function.actual pointer are likely 0.
      Anyway, the following patch is an attempt to get all the cases right.
      Uses ex->value.character.length only for ex->expr_type == EXPR_CONSTANT
      (i.e. CHARACTER literals), handles the deferred lengths, assumed lengths,
      known constant lengths and finally if the length is something other,
      just doesn't print it, i.e. prints just CHARACTER (for default kind)
      or CHARACTER(KIND=4) (for e.g. kind 4).
      
      2020-11-11  Jakub Jelinek  <jakub@redhat.com>
      
      	PR fortran/97768
      gcc/fortran/
      	* misc.c (gfc_typename): Use ex->value.character.length only if
      	ex->expr_type == EXPR_CONSTANT.  If ex->ts.deferred, print : instead
      	of length.  If ex->ts.u.cl && ex->ts.u.cl->length == NULL, print *
      	instead of length.  Otherwise if character length is non-constant,
      	print just CHARACTER or CHARACTER(KIND=N).
      gcc/testsuite/
      	* gfortran.dg/pr97768_1.f90: New test.
      	* gfortran.dg/pr97768_2.f90: New test.
      81372618
    • Alan Modra's avatar
      Re: Refactor copying decl section names · 693a79a3
      Alan Modra authored
      	* go-gcc.cc (Gcc_backend::global_variable_set_init): Cast NULL to
      	avoid ambiguous overloaded call.
      693a79a3
    • Strager Neds's avatar
      Improve efficiency of copying section from another tree · 46564615
      Strager Neds authored
      gcc/
      	* cgraph.h (symtab_node::set_section_for_node): Declare new
      	overload.
      	(symtab_node::set_section_from_string): Rename from set_section.
      	(symtab_node::set_section_from_node): Declare.
      	* symtab.c (symtab_node::set_section_for_node): Define new
      	overload.
      	(symtab_node::set_section_from_string): Rename from set_section.
      	(symtab_node::set_section_from_node): Define.
      	(symtab_node::set_section): Call renamed set_section_from_string.
      	(symtab_node::set_section): Call new set_section_from_node.
      46564615
    • Strager Neds's avatar
      Refactor section name ref counting · e79de068
      Strager Neds authored
      gcc/
      
      	* symtab.c (symtab_node::set_section_for_node): Extract reference
      	counting logic into ...
      	(retain_section_hash_entry): ... here (new function) and ...
      	(release_section_hash_entry): ... here (new function).
      e79de068
    • liuhongt's avatar
      Formatting, there should be a space between PTA_* and (. · 6b797b65
      liuhongt authored
      gcc/ChangeLog
      	* config/i386/i386.h (PTA_MOVDIRI, PTA_MOVDIR64B,
      	PTA_AMX_TILE, PTA_AMX_INT8, PTA_AMX_BF16, PTA_HRESET):
      	Formatting.
      6b797b65
    • Nagaraju Mekala's avatar
      Update MicroBlaze strings test · 9179d9da
      Nagaraju Mekala authored
      gcc/testsuite
      
      	* gcc.target/microblaze/others/strings1.c: Update
      	to include $LC label.
      9179d9da
    • David Edelsohn's avatar
      testsuite: skip zero-scratch-regs on powerpc. · 96fc9178
      David Edelsohn authored
      These tests are unsupported on PowerPC.
      
      gcc/testsuite/ChangeLog:
      
      	* c-c++-common/zero-scratch-regs-10.c: Skip on powerpc*-*-*.
      	* c-c++-common/zero-scratch-regs-11.c: Skip on powerpc*-*-*.
      	* c-c++-common/zero-scratch-regs-5.c: Skip on powerpc*-*-aix*.
      	* c-c++-common/zero-scratch-regs-8.c: Skip on powerpc*-*-*.
      	* c-c++-common/zero-scratch-regs-9.c: Skip on powerpc*-*-*.
      96fc9178
    • Jonathan Wakely's avatar
      libstdc++: Implement std::emit_on_flush etc. · ecba8547
      Jonathan Wakely authored
      This adds the manipulators for use with basic_osyncstream. In order to
      detect when an arbitrary basic_ostream<C,T> is the base class of a
      basic_syncbuf<C,T,A> object, introduce a new intermediate base class
      that stores the data members. The new base class stores a pointer and
      two bools, which wastes (sizeof(void*) - 2) bytes of padding. It would
      be possible to use the two least significant bits of the pointer for the
      two bools, at least for targets where alignof(basic_streambuf) > 2, but
      that's left as a possible change for a future date.
      
      Also define basic_syncbuf::overflow to override the virtual function in
      the base class, so that single characters can be inserted into the
      stream buffer. Previously the default basic_streambuf::overflow
      implementation was used, which drops the character on the floor.
      
      libstdc++-v3/ChangeLog:
      
      	* include/std/ostream (__syncbuf_base): New class template.
      	(emit_on_flush, noemit_on_flush, flush_emit): New manipulators.
      	* include/std/syncstream (basic_syncbuf): Derive from
      	__syncbuf_base instead of basic_streambuf.
      	(basic_syncbuf::operator=): Remove self-assignment check.
      	(basic_syncbuf::swap): Remove self-swap check.
      	(basic_syncbuf::emit): Do not skip pubsync() call if sequence
      	is empty.
      	(basic_syncbuf::sync): Remove no-op pubsync on stringbuf.
      	(basic_syncbuf::overflow): Define override.
      	* testsuite/27_io/basic_syncstream/basic_ops/1.cc: Test
      	basic_osyncstream::put(char_type).
      	* testsuite/27_io/basic_ostream/emit/1.cc: New test.
      ecba8547
    • GCC Administrator's avatar
      Daily bump. · bb622641
      GCC Administrator authored
      bb622641
    • Ilya Leoshkevich's avatar
      IBM Z: Fix bootstrap breakage due to HAVE_TF macro · 778087e0
      Ilya Leoshkevich authored
      Commit e627cda5 ("IBM Z: Store long doubles in vector registers
      when possible") introduced HAVE_TF macro which expands to a logical
      "or" of HAVE_ constants.  Not all of these constants are available in
      GENERATOR_FILE context, so a hack was used: simply expand to true in
      this case, because the actual value matters only during compiler
      runtime and not during generation.
      
      However, one aspect of this value matters during generation after all:
      whether or not it's a constant, which in this case it appears to be.
      This results in incorrect values in insn-flags.h and broken bootstrap
      for some configurations.
      
      Fix by using a dummy value that is not a constant.
      
      gcc/ChangeLog:
      
      2020-11-10  Ilya Leoshkevich  <iii@linux.ibm.com>
      
      	* config/s390/s390.h (HAVE_TF): Use opaque value when
      	GENERATOR_FILE is defined.
      778087e0
  2. Nov 10, 2020
    • Jonathan Wakely's avatar
      libstdc++: Avoid bad_alloc exceptions when changing locales · 5dfbc522
      Jonathan Wakely authored
      For the --enable-clocale=generic configuration, the current code can
      fail with a bad_alloc exception. This patch uses the nothrow version of
      operator new and reports allocation failures by setting failbit in the
      iostate variable.
      
      	* config/locale/generic/c_locale.cc (__set_C_locale()): New function
      	to set the "C" locale and return the name of the previous locale.
      	(__convert_to_v<float>, __convert_to_v<double>)
      	(__convert_to_v<long double>): Use __set_C_locale and set failbit on
      	error.
      5dfbc522
    • Marek Polacek's avatar
      c++: Improve static_assert diagnostic [PR97518] · 8c0c83fe
      Marek Polacek authored
      Currently, when a static_assert fails, we only say "static assertion failed".
      It would be more useful if we could also print the expression that
      evaluated to false; this is especially useful when the condition uses
      template parameters.  Consider the motivating example, in which we have
      this line:
      
        static_assert(is_same<X, Y>::value);
      
      if this fails, the user has to play dirty games to get the compiler to
      print the template arguments.  With this patch, we say:
      
        error: static assertion failed
        note: 'is_same<int*, int>::value' evaluates to false
      
      which I think is much better.  However, always printing the condition that
      evaluated to 'false' wouldn't be very useful: e.g. noexcept(fn) is
      always parsed to true/false, so we would say "'false' evaluates to false"
      which doesn't help.  So I wound up only printing the condition when it was
      instantiation-dependent, that is, we called finish_static_assert from
      tsubst_expr.
      
      Moreover, this patch also improves the diagnostic when the condition
      consists of a logical AND.  Say you have something like this:
      
        static_assert(fn1() && fn2() && fn3() && fn4() && fn5());
      
      where fn4() evaluates to false and the other ones to true.  Highlighting
      the whole thing is not that helpful because it won't say which clause
      evaluated to false.  With the find_failing_clause tweak in this patch
      we emit:
      
        error: static assertion failed
          6 | static_assert(fn1() && fn2() && fn3() && fn4() && fn5());
            |                                          ~~~^~
      
      so you know right away what's going on.  Unfortunately, when you combine
      both things, that is, have an instantiation-dependent expr and && in
      a static_assert, we can't yet quite point to the clause that failed.  It
      is because when we tsubstitute something like is_same<X, Y>::value, we
      generate a VAR_DECL that doesn't have any location.  It would be awesome
      if we could wrap it with a location wrapper, but I didn't see anything
      obvious.
      
      In passing, I've cleaned up some things:
      * use iloc_sentinel when appropriate,
      * it's nicer to call contextual_conv_bool instead of the rather verbose
        perform_implicit_conversion_flags,
      * no need to check for INTEGER_CST before calling integer_zerop.
      
      gcc/cp/ChangeLog:
      
      	PR c++/97518
      	* cp-tree.h (finish_static_assert): Adjust declaration.
      	* parser.c (cp_parser_static_assert): Pass false to
      	finish_static_assert.
      	* pt.c (tsubst_expr): Pass true to finish_static_assert.
      	* semantics.c (find_failing_clause_r): New function.
      	(find_failing_clause): New function.
      	(finish_static_assert): Add a bool parameter.  Use
      	iloc_sentinel.  Call contextual_conv_bool instead of
      	perform_implicit_conversion_flags.  Don't check for INTEGER_CST before
      	calling integer_zerop.  Call find_failing_clause and maybe use its
      	location.  Print the original condition or the failing clause if
      	SHOW_EXPR_P.
      
      gcc/testsuite/ChangeLog:
      
      	PR c++/97518
      	* g++.dg/diagnostic/pr87386.C: Adjust expected output.
      	* g++.dg/diagnostic/static_assert1.C: New test.
      	* g++.dg/diagnostic/static_assert2.C: New test.
      
      libcc1/ChangeLog:
      
      	PR c++/97518
      	* libcp1plugin.cc (plugin_add_static_assert): Pass false to
      	finish_static_assert.
      8c0c83fe
    • Marek Polacek's avatar
      c++: Add 5 unfixed tests. · a210d404
      Marek Polacek authored
      A couple of dg-ice tests.
      
      gcc/testsuite/ChangeLog:
      
      	PR c++/52830
      	PR c++/88982
      	PR c++/90799
      	PR c++/87765
      	PR c++/89565
      	* g++.dg/cpp0x/constexpr-52830.C: New test.
      	* g++.dg/cpp0x/vt-88982.C: New test.
      	* g++.dg/cpp1z/class-deduction76.C: New test.
      	* g++.dg/cpp1z/constexpr-lambda26.C: New test.
      	* g++.dg/cpp2a/nontype-class39.C: New test.
      a210d404
    • Jonathan Wakely's avatar
      libstdc++: Reorder constructors in <sstream> · f7c41c57
      Jonathan Wakely authored
      This groups all the constructors together, consistent with the synopses
      in the C++20 standard.
      
      libstdc++-v3/ChangeLog:
      
      	* include/std/sstream (basic_stringbug, basic_istringstream)
      	(basic_ostringstream, basic_stringstream): Reorder C++20
      	constructors to be declared next to other constructors.
      f7c41c57
    • Jonathan Wakely's avatar
      libstdc++: Add remaining C++20 additions to <sstream> [P0408R7] · 95cb0fc8
      Jonathan Wakely authored
      This adds the new overloads of basic_stringbuf::str, and the
      corresponding overloads to basic_istringstream, basic_ostringstream and
      basic_stringstream.
      
      libstdc++-v3/ChangeLog:
      
      	* config/abi/pre/gnu.ver (GLIBCXX_3.4.21): Tighten patterns.
      	(GLIBCXX_3.4.29): Export new symbols.
      	* include/bits/alloc_traits.h (__allocator_like): New concept.
      	* include/std/sstream (basic_stringbuf::swap): Add exception
      	specification.
      	(basic_stringbuf::str() const): Add ref-qualifier. Use new
      	_M_high_mark function.
      	(basic_stringbuf::str(const SAlloc&) const): Define new function.
      	(basic_stringbuf::str() &&): Likewise.
      	(basic_stringbuf::str(const basic_string<C,T,SAlloc>&)):
      	Likewise.
      	(basic_stringbuf::str(basic_string<C,T,Alloc>&&)): Likewise.
      	(basic_stringbuf::view() const): Use _M_high_mark.
      	(basic_istringstream::str, basic_ostringstream::str)
      	(basic_stringstream::str): Define new overloads.
      	* src/c++20/sstream-inst.cc (basic_stringbuf::str)
      	(basic_istringstream::str, basic_ostringstream::str)
      	(basic_stringstream::str): Explicit instantiation definitions
      	for new overloads.
      	* testsuite/27_io/basic_istringstream/view/char/1.cc: Add more
      	checks.
      	* testsuite/27_io/basic_istringstream/view/wchar_t/1.cc:
      	Likewise.
      	* testsuite/27_io/basic_ostringstream/view/char/1.cc:
      	Likewise.
      	* testsuite/27_io/basic_ostringstream/view/wchar_t/1.cc:
      	Likewise.
      	* testsuite/27_io/basic_stringstream/view/char/1.cc:
      	Likewise.
      	* testsuite/27_io/basic_stringstream/view/wchar_t/1.cc:
      	Likewise.
      	* testsuite/27_io/basic_istringstream/str/char/2.cc: New test.
      	* testsuite/27_io/basic_istringstream/str/wchar_t/2.cc: New test.
      	* testsuite/27_io/basic_ostringstream/str/char/3.cc: New test.
      	* testsuite/27_io/basic_ostringstream/str/wchar_t/3.cc: New test.
      	* testsuite/27_io/basic_stringbuf/str/char/4.cc: New test.
      	* testsuite/27_io/basic_stringbuf/str/wchar_t/4.cc: New test.
      	* testsuite/27_io/basic_stringstream/str/char/5.cc: New test.
      	* testsuite/27_io/basic_stringstream/str/wchar_t/5.cc.cc: New test.
      95cb0fc8
    • Jonathan Wakely's avatar
      libstdc++: Fix more unspecified comparisons to null pointer [PR 97415] · ced70eba
      Jonathan Wakely authored
      This adds some more null checks to avoid a relational comparison with a
      null pointer, similar to 78198b60.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/97415
      	* include/std/sstream (basic_stringbuf::_M_update_egptr)
      	(basic_stringbuf::__xfer_bufptrs::__xfer_bufptrs): Check for
      	null before comparing pointers.
      ced70eba
    • Strager Neds's avatar
      Refactor copying decl section names · 8b9a92f7
      Strager Neds authored
      gcc/
      
      	* cgraph.h (symtab_node::get_section): Constify.
      	(symtab_node::set_section): Declare new overload.
      	* symtab.c (symtab_node::set_section): Define new overload.
      	(symtab_node::copy_visibility_from): Use new overload of
      	symtab_node::set_section.
      	(symtab_node::resolve_alias): Same.
      	* tree.h (set_decl_section_name): Declare new overload.
      	* tree.c (set_decl_section_name): Define new overload.
      	* tree-emutls.c (get_emutls_init_templ_addr): Same.
      	* cgraphclones.c (cgraph_node::create_virtual_clone): Use new
      	overload of symtab_node::set_section.
      	(cgraph_node::create_version_clone_with_body): Same.
      	* trans-mem.c (ipa_tm_create_version): Same.
      
      gcc/c
      	* c-decl.c (merge_decls): Use new overload of
      	set_decl_section_name.
      
      gcc/cp
      	* decl.c (duplicate_decls): Use new overload of
      	set_decl_section_name.
      	* method.c (use_thunk): Same.
      	* optimize.c (maybe_clone_body): Same.
      	* coroutines.cc (act_des_fn): Same.
      
      gcc/d
      	* decl.cc (finish_thunk): Use new overload of
      	set_decl_section_name
      8b9a92f7
Loading