Commit Graph

179244 Commits

Author SHA1 Message Date
GCC Administrator cf2bc8617a Daily bump. 2020-08-31 00:16:22 +00:00
Martin Sebor 6ccadc4c04 Use get_size_range instead of get_range to obtain range of valid sizes.
gcc/ChangeLog:

	* builtins.c (access_ref::access_ref): Call get_size_range instead
	of get_range.

gcc/testsuite/ChangeLog:

	* gcc.dg/Wstringop-overread-3.c: New test.
2020-08-30 15:11:48 -06:00
José Rui Faustino de Sousa a240e83ce9 2020-8-20 José Rui Faustino de Sousa <jrfsousa@gmail.com>
gcc/fortran/ChangeLog:

	PR fortran/96728
	* module.c (module_peek_char): Peek ahead function.
	(parse_integer): Add code for parsing signed integers.
	(parse_atom): Add code to handle signed integers.
	(peek_atom): Add code to handle signed integers.

gcc/testsuite/ChangeLog:

	PR fortran/96728
	* gfortran.dg/PR96728.f90: New test.
2020-08-30 18:10:15 +00:00
José Rui Faustino de Sousa 3a7a95a220 2020-8-20 José Rui Faustino de Sousa <jrfsousa@gmail.com>
gcc/fortran/ChangeLog:

	PR fortran/96727
	* expr.c (gfc_check_init_expr): Add default error message for the AS_ASSUMED_RANK case.

gcc/testsuite/ChangeLog:

	PR fortran/96727
	* gfortran.dg/PR96727.f90: New test.
2020-08-30 18:03:13 +00:00
José Rui Faustino de Sousa 8f7d99acf6 2020-8-20 José Rui Faustino de Sousa <jrfsousa@gmail.com>
gcc/fortran/ChangeLog:

	PR fortran/96726
	* expr.c (check_references): Change different relational operator
	to less-than operator to avoid infinite loop.

gcc/testsuite/ChangeLog:

	PR fortran/96726
	* gfortran.dg/PR96726.f90: New test.
2020-08-30 17:58:13 +00:00
Steve Kargl cd49b70678 2020-8-21 Steve Kargl <sgk@troutmask.apl.washington.edu>
gcc/fortran/ChangeLog:

	PR fortran/95352
	* simplify.c (simplify_bound_dim): Add check for NULL pointer
	before trying to access structure member.

	    José Rui Faustino de Sousa  <jrfsousa@gmail.com>

gcc/testsuite/ChangeLog:

	* gfortran.dg/PR95352.f90: New test.
2020-08-30 17:49:25 +00:00
José Rui Faustino de Sousa 8e1be7efcb 2020-8-20 José Rui Faustino de Sousa <jrfsousa@gmail.com>
gcc/fortran/ChangeLog:

	PR fortran/94110
	* interface.c (gfc_compare_actual_formal): Add code to also raise
	the actual argument cannot be an assumed-size array error when the
	dummy arguments are deferred-shape or assumed-rank pointer.

gcc/testsuite/ChangeLog:

	PR fortran/94110
	* gfortran.dg/PR94110.f90: New test.
2020-08-30 17:28:08 +00:00
Jakub Jelinek 44c677d1eb x86: Fix up ssse3_pshufbv8qi splitter
The constant pool size optimization I was testing resulted in various ICEs
in gcc.target/i386/ testsuite, the problem is that the ssse3_pshufbv8qi
splitter emits invalid RTL, in V4SImode 0xf7f7f7f7 CONST_INTs shouldn't
appear, instead they should have been -0x8080809 (0xf7f7f7f7 sign extended
into 64 bits).

2020-08-30  Jakub Jelinek  <jakub@redhat.com>

	* config/i386/sse.md (ssse3_pshufbv8qi): Use gen_int_mode instead of
	GEN_INT, and ix86_build_const_vector instead of gen_rtvec and
	gen_rtx_CONT_VECTOR.
2020-08-30 14:15:45 +02:00
GCC Administrator daba4a713e Daily bump. 2020-08-30 00:16:20 +00:00
Jonathan Wakely 0789600c59 libstdc++: Fix deleted overload of __absu(bool)
libstdc++-v3/ChangeLog:

	* include/std/numeric (__detail::__absu(bool)): Make deleted
	function a function template, so it will be chosen for calls
	with an explicit template argument list.
	* testsuite/26_numerics/gcd/gcd_neg.cc: Add dg-prune-output.
	* testsuite/26_numerics/lcm/lcm_neg.cc: Likewise.
2020-08-29 18:24:08 +01:00
Bill Schmidt cd0233527a rs6000: Remove ALTIVEC_BUILTIN_MASK_FOR_STORE
It turns out that the target hook that this is supposed to satisfy
disappeared in 2004.  Probably time to retire it.

2020-08-28  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-builtin.def (MASK_FOR_STORE): Remove.
	* config/rs6000/rs6000-call.c (rs6000_expand_builtin): Remove
	all logic for ALTIVEC_BUILTIN_MASK_FOR_STORE.
2020-08-28 20:05:58 -05:00
GCC Administrator 8f7ea26ae3 Daily bump. 2020-08-29 00:16:21 +00:00
Jonathan Wakely f2f48b68a6 libstdc++: Fix common_type specializations for duration
My recent change to implement P0548 ("common_type and duration") was not
correct. The result of common_type_t<duration<R,P>, duration<R,P>>
should be duration<common_type_t<R>, P::type>, not duration<R, P::type>.
The common_type specialization for two different duration types was
correct, but the specializations for a single duration type (which only
exist to optimize compilation time) were wrong.

This fixes the partial specializations of common_type for a single
duration type, and also the return types of duration::operator+ and
duration::operator- which are supposed to use common_type_t<duration>.

libstdc++-v3/ChangeLog:

	* include/std/chrono (common_type): Fix partial specializations
	for a single duration type to use the common_type of the rep.
	(duration::operator+, duration::operator-): Fix return types
	to also use the common_type of the rep.
	* testsuite/20_util/duration/requirements/reduced_period.cc:
	Check duration using a rep that has common_type specialized.
2020-08-28 23:41:13 +01:00
Jonathan Wakely 82db1a42e9 libstdc++: Fix std::gcd and std::lcm for unsigned integers [PR 92978]
This fixes a bug with mixed signed and unsigned types, where converting
a negative value to the unsigned result type alters the value. The
solution is to obtain the absolute values of the arguments immediately
and to perform the actual GCD or LCM algorithm on two arguments of the
same type.

In order to operate on the most negative number without overflow when
taking its absolute, use an unsigned type for the result of the abs
operation. For example, -INT_MIN will overflow, but -(unsigned)INT_MIN
is (unsigned)INT_MAX+1U which is the correct value.

libstdc++-v3/ChangeLog:

	PR libstdc++/92978
	* include/std/numeric (__abs_integral): Replace with ...
	(__detail::__absu): New function template that returns an
	unsigned type, guaranteeing it can represent the most
	negative signed value.
	(__detail::__gcd, __detail::__lcm): Require arguments to
	be unsigned and therefore already non-negative.
	(gcd, lcm): Convert arguments to absolute value as unsigned
	type before calling __detail::__gcd or __detail::__lcm.
	* include/experimental/numeric (gcd, lcm): Likewise.
	* testsuite/26_numerics/gcd/gcd_neg.cc: Adjust expected
	errors.
	* testsuite/26_numerics/lcm/lcm_neg.cc: Likewise.
	* testsuite/26_numerics/gcd/92978.cc: New test.
	* testsuite/26_numerics/lcm/92978.cc: New test.
	* testsuite/experimental/numeric/92978.cc: New test.
2020-08-28 23:03:28 +01:00
Martin Sebor d14c547abd Add -Wstringop-overread for reading past the end by string functions.
gcc/ChangeLog:

	* attribs.c (init_attr_rdwr_indices): Use global access_mode.
	* attribs.h (struct attr_access): Same.
	* builtins.c (fold_builtin_strlen): Add argument.
	(compute_objsize): Declare.
	(get_range): Declare.
	(check_read_access): New function.
	(access_ref::access_ref): Define ctor.
	(warn_string_no_nul): Add arguments.  Handle -Wstrintop-overread.
	(check_nul_terminated_array): Handle source strings of different
	ranges of sizes.
	(expand_builtin_strlen): Remove warning code, call check_read_access
	instead.  Declare locals closer to their initialization.
	(expand_builtin_strnlen): Same.
	(maybe_warn_for_bound): New function.
	(warn_for_access): Remove argument.  Handle -Wstrintop-overread.
	(inform_access): Change argument type.
	(get_size_range): New function.
	(check_access): Remove unused arguments.  Add new arguments.  Handle
	-Wstrintop-overread.  Move warning code to helpers and call them.
	Call check_nul_terminated_array.
	(check_memop_access): Remove unnecessary and provide additional
	arguments in calls.
	(expand_builtin_memchr): Call check_read_access.
	(expand_builtin_strcat): Remove unnecessary and provide additional
	arguments in calls.
	(expand_builtin_strcpy): Same.
	(expand_builtin_strcpy_args): Same.  Avoid testing no-warning bit.
	(expand_builtin_stpcpy_1): Remove unnecessary and provide additional
	arguments in calls.
	(expand_builtin_stpncpy): Same.
	(check_strncat_sizes): Same.
	(expand_builtin_strncat): Remove unnecessary and provide additional
	arguments in calls.  Adjust comments.
	(expand_builtin_strncpy): Remove unnecessary and provide additional
	arguments in calls.
	(expand_builtin_memcmp): Remove warning code.  Call check_access.
	(expand_builtin_strcmp): Call check_access instead of
	check_nul_terminated_array.
	(expand_builtin_strncmp): Handle -Wstrintop-overread.
	(expand_builtin_fork_or_exec): Call check_access instead of
	check_nul_terminated_array.
	(expand_builtin): Same.
	(fold_builtin_1): Pass additional argument.
	(fold_builtin_n): Same.
	(fold_builtin_strpbrk): Remove calls to check_nul_terminated_array.
	(expand_builtin_memory_chk): Add comments.
	(maybe_emit_chk_warning): Remove unnecessary and provide additional
	arguments in calls.
	(maybe_emit_sprintf_chk_warning): Same.  Adjust comments.
	* builtins.h (warn_string_no_nul): Add arguments.
	(struct access_ref): Add member and ctor argument.
	(struct access_data): Add members and ctor.
	(check_access): Adjust signature.
	* calls.c (maybe_warn_nonstring_arg): Return an indication of
	whether a warning was issued.  Issue -Wstrintop-overread instead
	of -Wstringop-overflow.
	(append_attrname): Adjust to naming changes.
	(maybe_warn_rdwr_sizes): Same.  Remove unnecessary and provide
	additional arguments in calls.
	* calls.h (maybe_warn_nonstring_arg): Return bool.
	* doc/invoke.texi (-Wstringop-overread): Document new option.
	* gimple-fold.c (gimple_fold_builtin_strcpy): Provide an additional
	argument in call.
	(gimple_fold_builtin_stpcpy): Same.
	* tree-ssa-uninit.c (maybe_warn_pass_by_reference): Adjust to naming
	changes.
	* tree.h (enum access_mode): New type.

gcc/c-family/ChangeLog:

	* c.opt (Wstringop-overread): New option.

gcc/testsuite/ChangeLog:

	* c-c++-common/Warray-bounds-7.c: Adjust expected warnings.
	* c-c++-common/Wrestrict.c: Remove xfail.
	* c-c++-common/attr-nonstring-3.c: Adjust text of expected warnings.
	* c-c++-common/attr-nonstring-6.c: Suppress -Wstringop-overread
	instead of -Wstringop-overflow.
	* c-c++-common/attr-nonstring-8.c: Adjust text of expected warnings.
	* g++.dg/torture/Wsizeof-pointer-memaccess1.C: Also suppress
	 -Wstringop-overread.
	* g++.dg/torture/Wsizeof-pointer-memaccess2.C: Same.
	* gcc.dg/Warray-bounds-39.c: Adjust expected warnings.
	* gcc.dg/Warray-bounds-40.c: Also suppress -Wstringop-overread.
	* gcc.dg/Warray-bounds-58.c: Remove xfail.  Also expect
	-Wstringop-overread.  Adjust text of expected warnings.
	* gcc.dg/Wsizeof-pointer-memaccess1.c: Also suppress
	 -Wstringop-overread.
	* gcc.dg/Wstringop-overflow-22.c: Adjust text of expected warnings.
	* gcc.dg/Wstringop-overflow-33.c: Expect -Wstringop-overread.
	* gcc.dg/Wstringop-overflow-9.c: Expect -Wstringop-overread.
	* gcc.dg/attr-nonstring-2.c: Adjust text of expected warnings.
	* gcc.dg/attr-nonstring-3.c: Same.
	* gcc.dg/attr-nonstring-4.c: Same.
	* gcc.dg/attr-nonstring.c: Expect -Wstringop-overread.
	* gcc.dg/builtin-stringop-chk-5.c: Adjust comment.
	* gcc.dg/builtin-stringop-chk-8.c: Enable -Wstringop-overread instead
	of -Wstringop-overflow.
	* gcc.dg/pr78902.c: Also expect -Wstringop-overread.
	* gcc.dg/pr79214.c: Adjust text of expected warnings.
	* gcc.dg/strcmpopt_10.c: Suppress valid -Wno-stringop-overread.
	* gcc.dg/strlenopt-57.c: Also expect -Wstringop-overread.
	* gcc.dg/torture/Wsizeof-pointer-memaccess1.c: Also suppress valid
	-Wno-stringop-overread.
	* gcc.dg/tree-ssa/builtins-folding-gimple-ub.c: Same.
	* gcc.dg/uninit-33.c: Same.
	* gcc.dg/warn-strnlen-no-nul-2.c: Adjust text of expected warning.
	* gcc.dg/warn-strnlen-no-nul.c: Same.
	* gcc.target/i386/strcmpopt_6.c: Suppress -Wstringop-overread.
	* gcc.dg/Wstringop-overread-2.c: New test.
	* gcc.dg/Wstringop-overread.c: New test.
2020-08-28 13:18:28 -06:00
Bill Schmidt 26c24398d3 rs6000: r12 copy cleanup
Remove unnecessary tests before copying function address to r12.

2020-08-28  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000.c (rs6000_call_aix): Remove test for r12.
	(rs6000_sibcall_aix): Likewise.
2020-08-28 11:47:01 -05:00
Andrew Stubbs 1c1e41b065 amdgcn: Update vec_safe_grow_cleared usage
An API change broke the amdgcn build.

gcc/ChangeLog:

	* config/gcn/gcn-tree.c (gcn_goacc_get_worker_red_decl): Add "true"
	parameter to vec_safe_grow_cleared.
2020-08-28 15:43:06 +01:00
Martin Sebor 1ad755dcbb Correct calls to vec::safe_grow in conditionally compiled code.
gcc/ChangeLog:

	* ggc-common.c (gt_pch_save): Add argument to a call.

gcc/jit/ChangeLog:

	* jit-recording.c (recording::switch_::make_debug_string): Add argument
	to a call.
2020-08-28 08:31:50 -06:00
Martin Sebor ba6373a397 PR c/96596 - ICE in match_builtin_function_types on a declaration of a built-in with invalid array argument
gcc/c/ChangeLog:

	PR c/96596
	* c-decl.c (match_builtin_function_types): Avoid dealing with erroneous
	argument type.

gcc/testsuite/ChangeLog:

	PR c/96596
	* gcc.dg/Wbuiltin-declaration-mismatch-16.c: New test.
2020-08-28 08:26:32 -06:00
Tobias Burnus cb3c3d6331 Fortran: Fix absent-optional handling for nondescriptor arrays (PR94672)
gcc/fortran/ChangeLog:

	PR fortran/94672
	* trans-array.c (gfc_trans_g77_array): Check against the parm decl and
	set the nonparm decl used for the is-present check to NULL if absent.

gcc/testsuite/ChangeLog:

	PR fortran/94672
	* gfortran.dg/optional_assumed_charlen_2.f90: New test.
2020-08-28 13:54:10 +02:00
Przemyslaw Wirkus b648814c02 [PATCH PR96357][GCC][AArch64]: could not split insn UNSPEC_COND_FSUB with AArch64 SVE
Problem is related to that operand 4 (In original pattern
cond_sub<mode>_any_const) is no longer the same as operand 1, and so
the pattern doesn't match the split condition.

Pattern cond_sub<mode>_any_const is being split by this patch into two
separate patterns:
* Pattern cond_sub<mode>_relaxed_const now matches const_int
  SVE_RELAXED_GP operand.
* Pattern cond_sub<mode>_strict_const now matches const_int
  SVE_STRICT_GP operand.
* Remove aarch64_sve_pred_dominates_p condition from both patterns.

gcc/ChangeLog:

	PR target/96357
	* config/aarch64/aarch64-sve.md
	(cond_sub<mode>_relaxed_const): Updated and renamed from
	cond_sub<mode>_any_const pattern.
	(cond_sub<mode>_strict_const): New pattern.

gcc/testsuite/ChangeLog:

	PR target/96357
	* gcc.target/aarch64/sve/pr96357.c: New test.
2020-08-28 11:34:03 +01:00
Wei Wentao 3b062fc43e fix a typo in rtl.texi
gcc/
	* doc/rtl.texi: Fix typo.
2020-08-28 10:43:56 +01:00
Alex Coplan 43f3e69569 aarch64: Disable mem-shift-canonical test on ILP32
This test fails on ILP32 since we're looking for a pattern that could
only be hit on LP64. Disabling the test on ILP32 since the problematic
mult pattern was never hit there, so there's nothing to test.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/mem-shift-canonical.c: Skip on ILP32.
2020-08-28 10:31:08 +01:00
Paul Thomas 9d463ce7f9 This patch fixes PR96624.
2020-08-28  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
	PR fortran/96624
	* simplify.c (gfc_simplify_reshape): Detect zero shape and
	clear index if found.

gcc/testsuite/
	PR fortran/96624
	* gfortran.dg/reshape_8.f90 : New test.
2020-08-28 09:02:58 +01:00
Christophe Lyon 3ba43155d2 testsuite: Run gcc.dg/pr96579.c only on targets with dfp support.
gcc.dg/pr96579.c includes gcc.dg/pr96370.c which needs target dfp.

2020-08-28  Christophe Lyon  <christophe.lyon@linaro.org>

	gcc/testsuite/
	* gcc.dg/pr96579.c: Compile only with target dfp.
2020-08-28 07:59:50 +00:00
liuhongt 58d6eea0e0 Add expander for movp2hi and movp2qi.
2020-08-30  Uros Bizjak    <ubizjak@gmail.com>

gcc/ChangeLog:
	PR target/96744
	* config/i386/i386-expand.c (split_double_mode): Also handle
	E_P2HImode and E_P2QImode.
	* config/i386/sse.md (MASK_DWI): New define_mode_iterator.
	(mov<mode>): New expander for P2HI,P2QI.
	(*mov<mode>_internal): New define_insn_and_split to split
	movement of P2QI/P2HI to 2 movqi/movhi patterns after reload.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/double_mask_reg-1.c: New test.
2020-08-28 15:45:00 +08:00
liuhongt 6ba0973037 Fix: AVX512VP2INTERSECT should imply AVX512DQ.
gcc/ChangeLog

	* common/config/i386/i386-common.c (ix86_handle_option): Set
	AVX512DQ when AVX512VP2INTERSECT exists.
2020-08-28 15:44:54 +08:00
GCC Administrator 8b394f011a Daily bump. 2020-08-28 00:16:24 +00:00
Maciej W. Rozycki cad843c7e7 gotest: use a space rather than a middle dot in target lists
Replace the U+00B7 middle dot character, placed after "mips64p32le"
in the target lists, with a space.  The U+00B7 character may not be
considered whitespace by Bourne shell and any non-ASCII character
may render incorrectly in some terminal devices.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/251177
2020-08-27 16:18:01 -07:00
Jonathan Wakely 82030d5101 libstdc++: Make std::chrono::duration use reduced ratio for period
This implements the changes from P0548 "common_type and duration". That
was a change for C++17, but as it corrects some issues introduced by DRs
I'm also treating it as a DR and changing it for all modes from C++11
up.

The main change is that duration<R,P>::period no longer denotes P, but
rather P::type, the reduced ratio. The unary operator+ and operator-
members of duration should now return a duration using that reduced
ratio.

The requirement that common_type<T>::type is the same type as
common_type<T, T>::type (rather than simply T) was already implemented
for PR 89102.

The standard says that duration::operator+() and duration::operator-()
should return common_type_t<duration>, but that seems unnecessarily
expensive to compute. This change just uses duration<rep, period> which
is the same type, so we don't need to instantiate common_type.

As an optimization, this also adds partial specializations of
common_type for two durations of the same type, a single duration, two
time_points of the same type, and a single time_point. These
specializations avoid instantiating other specializations of common_type
and one or both of __duration_common_type or __timepoint_common_type for
the cases where the answer is trivial to obtain.

libstdc++-v3/ChangeLog:

	* include/std/chrono (__duration_common_type): Ensure the
	reduced ratio is used. Remove unused partial specialization
	using __failure_type.
	(common_type): Pass reduced ratios to __duration_common_type.
	Add partial specializations for simple cases involving a single
	duration or time_point type.
	(duration::period): Use reduced ratio.
	(duration::operator+(), duration::operator-()): Return duration
	type using the reduced ratio.
	* testsuite/20_util/duration/requirements/typedefs_neg2.cc:
	Adjust expected errors.
	* testsuite/20_util/duration/requirements/reduced_period.cc: New test.
2020-08-27 22:36:03 +01:00
John David Anglin 33a55fdb1e Fix shadd-2.c scan assembler count.
2020-08-27  John David Anglin  <danglin@gcc.gnu.org>

gcc/testsuite/
	* gcc.target/hppa/shadd-2.c: Adjust times to 4.
2020-08-27 19:21:22 +00:00
Patrick Palka 71e9716137 libstdc++: Fix arithmetic bug in chrono::year_month::operator+
This fixes the months-based addition for year_month when the
year_month's month component is 0.

libstdc++-v3/ChangeLog:

	* include/std/chrono (year_month::operator+): Properly handle a
	month value of 0 by casting the month value to int before
	subtracting 1 from it so that the difference is sign-extended in
	the subsequent addition.
	* testsuite/std/time/year_month/1.cc: Test adding months to a
	year_month whose month component is below or above the
	normalized range of [1,12].
2020-08-27 14:11:24 -04:00
Patrick Palka 7b743c67f0 libstdc++: Fix operator overload ambiguity with calendar types
We currently don't enforce a constraint on some of the calendar types'
addition/subtraction operator overloads that take a 'months' arguments:

  Constraints: If the argument supplied by the caller for the months
  parameter is convertible to years, its implicit conversion sequence to
  years is worse than its implicit conversion sequence to months.

This constraint is relevant when adding/subtracting a duration to/from,
say, a year_month where the given duration is convertible to both
'months' and to 'years' (as in the new testcases below).  The correct
behavior here in light of this constraint is to perform the operation
through the (more efficient) 'years'-based overload, but we currently
emit an ambiguous overload error.

This patch templatizes the 'months'-based addition/subtraction operator
overloads so that in the event of an implicit-conversion tie, we select
the non-template 'years'-based overload.  This is the same approach
that the date library takes for enforcing this constraint.

libstdc++-v3/ChangeLog:

	* include/std/chrono
	(__detail::__months_years_conversion_disambiguator): Define.
	(year_month::operator+=): Templatize the 'months'-based overload
	so that the 'years'-based overload is selected in case of
	equally-ranked implicit conversion sequences to both 'months'
	and 'years' from the supplied argument.
	(year_month::operator-=): Likewise.
	(year_month::operator+): Likewise.
	(year_month::operator-): Likewise.
	(year_month_day::operator+=): Likewise.
	(year_month_day::operator-=): Likewise.
	(year_month_day::operator+): Likewise.
	(year_month_day::operator-): Likewise.
	(year_month_day_last::operator+=): Likewise.
	(year_month_day_last::operator-=): Likewise.
	(year_month_day_last::operator+): Likewise
	(year_month_day_last::operator-): Likewise.
	(year_month_day_weekday::operator+=): Likewise
	(year_month_day_weekday::operator-=): Likewise.
	(year_month_day_weekday::operator+): Likewise.
	(year_month_day_weekday::operator-): Likewise.
	(year_month_day_weekday_last::operator+=): Likewise
	(year_month_day_weekday_last::operator-=): Likewise.
	(year_month_day_weekday_last::operator+): Likewise.
	(year_month_day_weekday_last::operator-): Likewise.
	(testsuite/std/time/year_month/2.cc): New test.
	(testsuite/std/time/year_month_day/2.cc): New test.
	(testsuite/std/time/year_month_day_last/2.cc): New test.
	(testsuite/std/time/year_month_weekday/2.cc): New test.
	(testsuite/std/time/year_month_weekday_last/2.cc): New test.
2020-08-27 14:09:52 -04:00
Jakub Jelinek 04df5e7de2 ia32: Fix alignment of _Atomic fields [PR65146]
For _Atomic fields, lowering the alignment of long long or double etc.
fields on ia32 is undesirable, because then one really can't perform atomic
operations on those using cmpxchg8b.

The following patch stops lowering the alignment in fields for _Atomic
types (the x86_field_alignment change) and for -mpreferred-stack-boundary=2
also ensures we don't misalign _Atomic long long etc. automatic variables
(the ix86_{local,minimum}_alignment changes).
Not sure about iamcu_alignment change, I know next to nothing about IA MCU,
but unless it doesn't have cmpxchg8b instruction, it would surprise me if we
don't want to do it as well.
clang apparently doesn't lower the field alignment for _Atomic.

2020-08-27  Jakub Jelinek  <jakub@redhat.com>

	PR target/65146
	* config/i386/i386.c (iamcu_alignment): Don't decrease alignment
	for TYPE_ATOMIC types.
	(ix86_local_alignment): Likewise.
	(ix86_minimum_alignment): Likewise.
	(x86_field_alignment): Likewise, and emit a -Wpsabi diagnostic
	for it.

	* gcc.target/i386/pr65146.c: New test.
2020-08-27 18:44:40 +02:00
Bill Schmidt abca87c578 rs6000: Support ELFv2 sibcall for indirect calls [PR96787]
Prior to P10, ELFv2 hasn't implemented nonlocal sibcalls.  Now that we do,
we need to be sure that r12 is set up prior to such a call.

2020-08-27  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	PR target/96787
	* config/rs6000/rs6000.c (rs6000_sibcall_aix): Support
	indirect call for ELFv2.

gcc/testsuite/

	PR target/96787
	* gcc.target/powerpc/pr96787-1.c: New.
	* gcc.target/powerpc/pr96787-2.c: New.
2020-08-27 11:18:33 -05:00
Mark Eggleston c336eda750 Fortran : ICE for division by zero in declaration PR95882
A length expression containing a divide by zero in a character
declaration will result in an ICE if the constant is anymore
complicated that a contant divided by a constant.

The cause was that char_len_param_value can return MATCH_YES
even if a divide by zero was seen.  Prior to returning check
whether a divide by zero was seen and if so set it to MATCH_ERROR.

2020-08-27  Mark Eggleston  <markeggleston@gcc.gnu.org>

gcc/fortran

	PR fortran/95882
	* decl.c (char_len_param_value): Check gfc_seen_div0 and
	if it is set return MATCH_ERROR.

2020-08-27  Mark Eggleston  <markeggleston@gcc.gnu.org>

gcc/testsuite/

	PR fortran/95882
	* gfortran.dg/pr95882_1.f90: New test.
	* gfortran.dg/pr95882_2.f90: New test.
	* gfortran.dg/pr95882_3.f90: New test.
	* gfortran.dg/pr95882_4.f90: New test.
	* gfortran.dg/pr95882_5.f90: New test.
2020-08-27 15:12:10 +01:00
Richard Biener eb68d9d828 tree-optimization/96522 - transfer of flow-sensitive info in copy_ref_info
This removes the bogus tranfer of flow-sensitive info in copy_ref_info
plus fixes one oversight in FRE when flow-sensitive non-NULLness was added to
points-to info.

2020-08-27  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/96522
	* tree-ssa-address.c (copy_ref_info): Reset flow-sensitive
	info of the copied points-to.  Transfer bigger alignment
	via the access type.
	* tree-ssa-sccvn.c (eliminate_dom_walker::eliminate_stmt):
	Reset all flow-sensitive info.

	* gcc.dg/torture/pr96522.c: New testcase.
2020-08-27 14:25:55 +02:00
Martin Liska cb3874dcf8 vec: add exact argument for various grow functions.
gcc/ada/ChangeLog:

	* gcc-interface/trans.c (gigi): Set exact argument of a vector
	growth function to true.
	(Attribute_to_gnu): Likewise.

gcc/ChangeLog:

	* alias.c (init_alias_analysis): Set exact argument of a vector
	growth function to true.
	* calls.c (internal_arg_pointer_based_exp_scan): Likewise.
	* cfgbuild.c (find_many_sub_basic_blocks): Likewise.
	* cfgexpand.c (expand_asm_stmt): Likewise.
	* cfgrtl.c (rtl_create_basic_block): Likewise.
	* combine.c (combine_split_insns): Likewise.
	(combine_instructions): Likewise.
	* config/aarch64/aarch64-sve-builtins.cc (function_expander::add_output_operand): Likewise.
	(function_expander::add_input_operand): Likewise.
	(function_expander::add_integer_operand): Likewise.
	(function_expander::add_address_operand): Likewise.
	(function_expander::add_fixed_operand): Likewise.
	* df-core.c (df_worklist_dataflow_doublequeue): Likewise.
	* dwarf2cfi.c (update_row_reg_save): Likewise.
	* early-remat.c (early_remat::init_block_info): Likewise.
	(early_remat::finalize_candidate_indices): Likewise.
	* except.c (sjlj_build_landing_pads): Likewise.
	* final.c (compute_alignments): Likewise.
	(grow_label_align): Likewise.
	* function.c (temp_slots_at_level): Likewise.
	* fwprop.c (build_single_def_use_links): Likewise.
	(update_uses): Likewise.
	* gcc.c (insert_wrapper): Likewise.
	* genautomata.c (create_state_ainsn_table): Likewise.
	(add_vect): Likewise.
	(output_dead_lock_vect): Likewise.
	* genmatch.c (capture_info::capture_info): Likewise.
	(parser::finish_match_operand): Likewise.
	* genrecog.c (optimize_subroutine_group): Likewise.
	(merge_pattern_info::merge_pattern_info): Likewise.
	(merge_into_decision): Likewise.
	(print_subroutine_start): Likewise.
	(main): Likewise.
	* gimple-loop-versioning.cc (loop_versioning::loop_versioning): Likewise.
	* gimple.c (gimple_set_bb): Likewise.
	* graphite-isl-ast-to-gimple.c (translate_isl_ast_node_user): Likewise.
	* haifa-sched.c (sched_extend_luids): Likewise.
	(extend_h_i_d): Likewise.
	* insn-addr.h (insn_addresses_new): Likewise.
	* ipa-cp.c (gather_context_independent_values): Likewise.
	(find_more_contexts_for_caller_subset): Likewise.
	* ipa-devirt.c (final_warning_record::grow_type_warnings): Likewise.
	(ipa_odr_read_section): Likewise.
	* ipa-fnsummary.c (evaluate_properties_for_edge): Likewise.
	(ipa_fn_summary_t::duplicate): Likewise.
	(analyze_function_body): Likewise.
	(ipa_merge_fn_summary_after_inlining): Likewise.
	(read_ipa_call_summary): Likewise.
	* ipa-icf.c (sem_function::bb_dict_test): Likewise.
	* ipa-prop.c (ipa_alloc_node_params): Likewise.
	(parm_bb_aa_status_for_bb): Likewise.
	(ipa_compute_jump_functions_for_edge): Likewise.
	(ipa_analyze_node): Likewise.
	(update_jump_functions_after_inlining): Likewise.
	(ipa_read_edge_info): Likewise.
	(read_ipcp_transformation_info): Likewise.
	(ipcp_transform_function): Likewise.
	* ipa-reference.c (ipa_reference_write_optimization_summary): Likewise.
	* ipa-split.c (execute_split_functions): Likewise.
	* ira.c (find_moveable_pseudos): Likewise.
	* lower-subreg.c (decompose_multiword_subregs): Likewise.
	* lto-streamer-in.c (input_eh_regions): Likewise.
	(input_cfg): Likewise.
	(input_struct_function_base): Likewise.
	(input_function): Likewise.
	* modulo-sched.c (set_node_sched_params): Likewise.
	(extend_node_sched_params): Likewise.
	(schedule_reg_moves): Likewise.
	* omp-general.c (omp_construct_simd_compare): Likewise.
	* passes.c (pass_manager::create_pass_tab): Likewise.
	(enable_disable_pass): Likewise.
	* predict.c (determine_unlikely_bbs): Likewise.
	* profile.c (compute_branch_probabilities): Likewise.
	* read-rtl-function.c (function_reader::parse_block): Likewise.
	* read-rtl.c (rtx_reader::read_rtx_code): Likewise.
	* reg-stack.c (stack_regs_mentioned): Likewise.
	* regrename.c (regrename_init): Likewise.
	* rtlanal.c (T>::add_single_to_queue): Likewise.
	* sched-deps.c (init_deps_data_vector): Likewise.
	* sel-sched-ir.c (sel_extend_global_bb_info): Likewise.
	(extend_region_bb_info): Likewise.
	(extend_insn_data): Likewise.
	* symtab.c (symtab_node::create_reference): Likewise.
	* tracer.c (tail_duplicate): Likewise.
	* trans-mem.c (tm_region_init): Likewise.
	(get_bb_regions_instrumented): Likewise.
	* tree-cfg.c (init_empty_tree_cfg_for_function): Likewise.
	(build_gimple_cfg): Likewise.
	(create_bb): Likewise.
	(move_block_to_fn): Likewise.
	* tree-complex.c (tree_lower_complex): Likewise.
	* tree-if-conv.c (predicate_rhs_code): Likewise.
	* tree-inline.c (copy_bb): Likewise.
	* tree-into-ssa.c (get_ssa_name_ann): Likewise.
	(mark_phi_for_rewrite): Likewise.
	* tree-object-size.c (compute_builtin_object_size): Likewise.
	(init_object_sizes): Likewise.
	* tree-predcom.c (initialize_root_vars_store_elim_1): Likewise.
	(initialize_root_vars_store_elim_2): Likewise.
	(prepare_initializers_chain_store_elim): Likewise.
	* tree-ssa-address.c (addr_for_mem_ref): Likewise.
	(multiplier_allowed_in_address_p): Likewise.
	* tree-ssa-coalesce.c (ssa_conflicts_new): Likewise.
	* tree-ssa-forwprop.c (simplify_vector_constructor): Likewise.
	* tree-ssa-loop-ivopts.c (addr_offset_valid_p): Likewise.
	(get_address_cost_ainc): Likewise.
	* tree-ssa-loop-niter.c (discover_iteration_bound_by_body_walk): Likewise.
	* tree-ssa-pre.c (add_to_value): Likewise.
	(phi_translate_1): Likewise.
	(do_pre_regular_insertion): Likewise.
	(do_pre_partial_partial_insertion): Likewise.
	(init_pre): Likewise.
	* tree-ssa-propagate.c (ssa_prop_init): Likewise.
	(update_call_from_tree): Likewise.
	* tree-ssa-reassoc.c (optimize_range_tests_cmp_bitwise): Likewise.
	* tree-ssa-sccvn.c (vn_reference_lookup_3): Likewise.
	(vn_reference_lookup_pieces): Likewise.
	(eliminate_dom_walker::eliminate_push_avail): Likewise.
	* tree-ssa-strlen.c (set_strinfo): Likewise.
	(get_stridx_plus_constant): Likewise.
	(zero_length_string): Likewise.
	(find_equal_ptrs): Likewise.
	(printf_strlen_execute): Likewise.
	* tree-ssa-threadedge.c (set_ssa_name_value): Likewise.
	* tree-ssanames.c (make_ssa_name_fn): Likewise.
	* tree-streamer-in.c (streamer_read_tree_bitfields): Likewise.
	* tree-vect-loop.c (vect_record_loop_mask): Likewise.
	(vect_get_loop_mask): Likewise.
	(vect_record_loop_len): Likewise.
	(vect_get_loop_len): Likewise.
	* tree-vect-patterns.c (vect_recog_mask_conversion_pattern): Likewise.
	* tree-vect-slp.c (vect_slp_convert_to_external): Likewise.
	(vect_bb_slp_scalar_cost): Likewise.
	(vect_bb_vectorization_profitable_p): Likewise.
	(vectorizable_slp_permutation): Likewise.
	* tree-vect-stmts.c (vectorizable_call): Likewise.
	(vectorizable_simd_clone_call): Likewise.
	(scan_store_can_perm_p): Likewise.
	(vectorizable_store): Likewise.
	* expr.c: Likewise.
	* vec.c (test_safe_grow_cleared): Likewise.
	* vec.h (vec_safe_grow): Likewise.
	(vec_safe_grow_cleared): Likewise.
	(vl_ptr>::safe_grow): Likewise.
	(vl_ptr>::safe_grow_cleared): Likewise.
	* config/c6x/c6x.c (insn_set_clock): Likewise.

gcc/c/ChangeLog:

	* gimple-parser.c (c_parser_gimple_compound_statement): Set exact argument of a vector
	growth function to true.

gcc/cp/ChangeLog:

	* class.c (build_vtbl_initializer): Set exact argument of a vector
	growth function to true.
	* constraint.cc (get_mapped_args): Likewise.
	* decl.c (cp_maybe_mangle_decomp): Likewise.
	(cp_finish_decomp): Likewise.
	* parser.c (cp_parser_omp_for_loop): Likewise.
	* pt.c (canonical_type_parameter): Likewise.
	* rtti.c (get_pseudo_ti_init): Likewise.

gcc/fortran/ChangeLog:

	* trans-openmp.c (gfc_trans_omp_do): Set exact argument of a vector
	growth function to true.

gcc/lto/ChangeLog:

	* lto-common.c (lto_file_finalize): Set exact argument of a vector
	growth function to true.
2020-08-27 13:29:43 +02:00
Richard Biener 9ceb3b8d8f streamline TARGET_MEM_REF dumping
The following streamlines TARGET_MEM_REF dumping building
on what we do for MEM_REF and thus dumping things like
access type, TBAA type and base/clique.  I've changed it
to do semantic dumping aka base + offset + step * index
rather than the odd base: A, step: way.

2020-08-27  Richard Biener  <rguenther@suse.de>

	* tree-pretty-print.c (dump_mem_ref): Handle TARGET_MEM_REFs.
	(dump_generic_node): Use dump_mem_ref also for TARGET_MEM_REF.

	* gcc.dg/tree-ssa/loop-19.c: Adjust.
	* gcc.dg/tree-ssa/loop-2.c: Likewise.
	* gcc.dg/tree-ssa/loop-3.c: Likewise.
2020-08-27 13:08:13 +02:00
Alex Coplan 6b3034eaba lra: Canonicalize mult to shift in address reloads
Inside a (mem) RTX, it is canonical to write multiplications by powers
of two using a (mult) [0]. Outside of a (mem), the canonical way to
write multiplications by powers of two is using (ashift).

Now I observed that LRA does not quite respect this RTL canonicalization
rule.  When compiling gcc/testsuite/gcc.dg/torture/pr34330.c with -Os
-ftree-vectorize, the RTL in the dump "281r.ira" has the insn:

(set (reg:SI 111)
     (mem:SI (plus:DI (mult:DI (reg:DI 101 [ ivtmp.9 ])
                 (const_int 4 [0x4]))
             (reg/v/f:DI 105 [ b ]))))

but LRA then proceeds to generate a reload, and we get the following
non-canonical insn in "282r.reload":

(set (reg:DI 7 x7 [121])
     (plus:DI (mult:DI (reg:DI 5 x5 [orig:101 ivtmp.9 ] [101])
             (const_int 4 [0x4]))
         (reg/v/f:DI 1 x1 [orig:105 b ] [105])))

This patch fixes LRA to ensure that we generate canonical RTL in this
case. After the patch, we get the following insn in "282r.reload":

(set (reg:DI 7 x7 [121])
        (plus:DI (ashift:DI (reg:DI 5 x5 [orig:101 ivtmp.9 ] [101])
                (const_int 2 [0x2]))
            (reg/v/f:DI 1 x1 [orig:105 b ] [105])))

[0] : https://gcc.gnu.org/onlinedocs/gccint/Insn-Canonicalizations.html

gcc/ChangeLog:

	* lra-constraints.c (canonicalize_reload_addr): New.
	(curr_insn_transform): Use canonicalize_reload_addr to ensure we
	generate canonical RTL for an address reload.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/mem-shift-canonical.c: New test.
2020-08-27 09:49:57 +01:00
xiezhiheng 795944c456 AArch64: Add FLAG for rounding intrinsics [PR94442]
2020-08-27  Zhiheng Xie  <xiezhiheng@huawei.com>

gcc/ChangeLog:

	* config/aarch64/aarch64-simd-builtins.def: Add proper FLAG
	for rounding intrinsics.
2020-08-27 09:07:26 +01:00
xiezhiheng d7738d4fde AArch64: Add FLAG for min/max intrinsics [PR94442]
2020-08-27  Zhiheng Xie  <xiezhiheng@huawei.com>

gcc/ChangeLog:

	* config/aarch64/aarch64-simd-builtins.def: Add proper FLAG
	for min/max intrinsics.
2020-08-27 09:07:26 +01:00
Richard Biener ff7463172e tree-optimization/96579 - another special-operands fix in reassoc
This makes sure to put special-ops expanded rhs left where
expression rewrite expects it.

2020-08-27  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/96579
	* tree-ssa-reassoc.c (linearize_expr_tree): If we expand
	rhs via special ops make sure to swap operands.

	* gcc.dg/pr96579.c: New testcase.
2020-08-27 10:02:22 +02:00
Richard Biener 989bc4ca2f tree-optimization/96565 - improve DSE with paths ending in noreturn
This improves DSEs stmt walking by not considering a DEF without
uses for further processing (and thus giving up when there's two
paths to follow).

2020-08-26  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/96565
	* tree-ssa-dse.c (dse_classify_store): Remove defs with
	no uses from further processing.

	* gcc.dg/tree-ssa/ssa-dse-40.c: New testcase.
	* gcc.dg/builtin-object-size-4.c: Adjust.
2020-08-27 08:07:34 +02:00
Patrick Palka 3ae0cd94ab libstdc++: Implement remaining piece of LWG 3448
Almost all of the proposed resolution for LWG 3448 is already
implemented; the only part left is to adjust the return type of
transform_view::sentinel::operator-.

libstdc++-v3/ChangeLog:

	PR libstdc++/95322
	* include/std/ranges (transform_view::sentinel::__distance_from):
	Give this a deduced return type.
	(transform_view::sentinel::operator-): Adjust the return type so
	that it's based on the constness of the iterator rather than
	that of the sentinel.
	* testsuite/std/ranges/adaptors/95322.cc: Refer to LWG 3488.
2020-08-26 21:53:04 -04:00
Patrick Palka 4be16d1c1c libstdc++: elements_view's sentinel and iterator not comparable [LWG 3406]
This implements the proposed resolution for LWG 3406, and adds a
testcase for the example from P1994R1.

libstdc++-v3/ChangeLog:

	* include/std/ranges (elements_view::begin): Adjust constraints.
	(elements_view::end): Likewise.
	(elements_view::_Sentinel::operator==): Templatize to take both
	_Iterator<true> and _Iterator<false>.
	(elements_view::_Sentinel::operator-): Likewise.
	* testsuite/std/ranges/adaptors/elements.cc: Add testcase for
	the example from P1994R1.
	* testsuite/std/ranges/adaptors/lwg3406.cc: New test.
2020-08-26 21:52:58 -04:00
Patrick Palka 97ab5daa6c libstdc++: Implement P1994R1 changes to ranges::elements_view
The example from the paper doesn't compile without the proposed
resolution for LWG 3406, so we'll add a testcase for this once the
proposed resolution is implemented.

libstdc++-v3/ChangeLog:

	* include/std/ranges (elements_view::end): Replace these two
	overloads with four new overloads.
	(elements_view::_Iterator::operator==): Remove.
	(elements_view::_Iterator::operator-): Likewise.
	(elements_view::_Sentinel): Define.
2020-08-26 21:49:51 -04:00
GCC Administrator 57ea089421 Daily bump. 2020-08-27 00:16:27 +00:00
Clément Chigot 0c223b02b6 cmd: add -maix32 to gcc calls for aix/ppc
As gcc might now be compiled in 64bit, -maix32 must always be added
to ensure that created objects will be 32bit.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/250778
2020-08-26 16:29:03 -07:00
Clément Chigot 6b0b6a3868 libgo: add FAT library support for static libraries on AIX
Like shared libraries, AIX static libraries must also have both 32 and
64 bit objects.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/250777
2020-08-26 16:18:06 -07:00