Commit Graph

171114 Commits

Author SHA1 Message Date
Jonathan Wakely ad3ff6fd32 libstdc++: Fix incorrect IS number in doc comment
libstdc++-v3/ChangeLog:

	* doc/xml/manual/intro.xml: Fix comment.

(cherry picked from commit 832fcbbc73)
2022-05-09 17:37:20 +01:00
Jonathan Wakely 44afdb5f23 libstdc++: Deprecate __gnu_cxx::rope::erase(size_type) [PR102048]
This function is broken, and has been removed for GCC 11 and 12.
Deprecate it for GCC 10 and GCC 9.

libstdc++-v3/ChangeLog:

	PR libstdc++/102048
	* include/ext/rope (rope::erase(size_type)): Deprecate broken
	function.

(cherry picked from commit 05ad54a8e67b31126351b9f15e1e42ac67650d6d)
2022-05-09 17:37:08 +01:00
Mikael Morin 3a426e4741 fortran: Backport associate character length fixes [PR104228]
Backport commits:
r12-7217-g57da34939703a6e6d3267a0d25d1fb9369d3ac0e
r12-7726-g907811ddc35da6c1701ed22355ece63a8c3ed7fb

--

fortran: Unshare associate var charlen [PR104228]

PR104228 showed that character lengths were shared between associate
variable and associate targets.  This is problematic when the associate
target is itself a variable and gets a variable to hold the length, as
the length variable is added (and all the variables following it in the chain)
to both the associate variable scope and the target variable scope.
This caused an ICE when compiling with -O0 -fsanitize=address.

This change forces the creation of a separate character length for the
associate variable.  It also forces the initialization of the character
length variable to avoid regressing associate_32 and associate_47 tests.

--

fortran: Separate associate character lengths earlier [PR104570]

This change workarounds an ICE in the evaluation of the character length
of an array expression referencing an associate variable; the code is
not prepared to see a non-scalar expression as it doesn’t initialize the
scalarizer.

Before this change, associate length symbols get a new gfc_charlen at
resolution stage to unshare them from the associate expression, so that
at translation stage it is a decl specific to the associate symbol that
is initialized, not the decl of some other symbol.  This
reinitialization of gfc_charlen happens after expressions referencing
the associate symbol have been parsed, so that those expressions retain
the original gfc_charlen they have copied from the symbol.
At translation stage, the gfc_charlen for the associate symbol is setup
with the decl holding the actual length value, but the expressions have
retained the original gfc_charlen without any decl.  So they need to
evaluate the character length, and this is where the ICE happens.

This change moves the reinitialization of gfc_charlen earlier at parsing
stage, so that at resolution stage the gfc_charlen can be retained as
it’s already not shared with any other symbol, and the expressions which
now share their gfc_charlen with the symbol are automatically updated
when the length decl is setup at translation stage.  There is no need
any more to evaluate the character length as it has all the required
information, and the ICE doesn’t happen.

The first resolve.c hunk is necessary to avoid regressing on the
associate_35.f90 testcase.

--

	PR fortran/104228
	PR fortran/104570

gcc/fortran/ChangeLog:

	* parse.c (parse_associate): Use a new distinct gfc_charlen if
	the copied type has one whose length is not known to be
	constant.
	* resolve.c (resolve_assoc_var): Also create a new character
	length for non-dummy associate targets.  Reset charlen if it’s
	shared with the associate target regardless of the expression
	type.  Don’t reinitialize charlen if it’s deferred.
	* trans-stmt.c (trans_associate_var): Initialize character
	length even if no temporary is used for the associate variable.

gcc/testsuite/ChangeLog:

	* gfortran.dg/asan_associate_58.f90: New test.
	* gfortran.dg/asan_associate_59.f90: New test.
	* gfortran.dg/associate_58.f90: New test.

(cherry picked from commit 4c8e037d32)
2022-05-09 13:21:53 +02:00
GCC Administrator 5f9e48557e Daily bump. 2022-05-09 00:19:28 +00:00
GCC Administrator 2c8630567a Daily bump. 2022-05-08 00:20:07 +00:00
GCC Administrator c445c9da13 Daily bump. 2022-05-07 00:19:52 +00:00
Richard Biener 4be43dbbed tree-optimization/105070 - annotate bit cluster tests with locations
The following makes sure to annotate the tests generated by
switch lowering bit-clustering with locations which otherwise
can be completely lost even at -O0.

2022-03-28  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/105070
	* tree-switch-conversion.h
	(bit_test_cluster::hoist_edge_and_branch_if_true): Add location
	argument.
	* tree-switch-conversion.c
	(bit_test_cluster::hoist_edge_and_branch_if_true): Annotate
	cond with location.
	(bit_test_cluster::emit): Annotate all generated expressions
	with location.

(cherry picked from commit b285999440)
2022-05-06 11:55:23 +02:00
Tom de Vries 05639c8bcc debug: fix switch lowering debug info
gcc/ChangeLog:

	PR debug/98656
	* tree-switch-conversion.c (jump_table_cluster::emit): Add loc
	argument.
	(bit_test_cluster::emit): Reuse location_t for newly created
	gswitch statement.
	(switch_decision_tree::try_switch_expansion): Preserve
	location_t.
	* tree-switch-conversion.h: Change function signatures.

(cherry picked from commit 4ede02a5f2)
2022-05-06 11:55:23 +02:00
Richard Biener 4ebdbc7660 middle-end/104786 - ICE with asm and VLA
The following fixes an ICE observed with a MEM_REF allows_mem asm
operand referencing a VLA.  The following makes sure to not attempt
to go the temporary creation way when we cannot.

2022-03-09  Richard Biener  <rguenther@suse.de>

	PR middle-end/104786
	* cfgexpand.c (expand_asm_stmt): Do not generate a copy
	for VLAs without an upper size bound.

	* gcc.dg/pr104786.c: New testcase.

(cherry picked from commit ba3ff5e351)
2022-05-06 11:55:18 +02:00
Richard Biener d55db847de tree-optimization/103361 - fix unroll-and-jam direction vector handling
This properly uses lambda_int instead of truncating the direction
vector to int which leads to false unexpected negative values.

2021-11-23  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/103361
	* gimple-loop-jam.c (adjust_unroll_factor): Use lambda_int
	for the dependence distance.
	* tree-data-ref.c (print_lambda_vector): Properly print a lambda_int.

	* g++.dg/torture/pr103361.C: New testcase.

(cherry picked from commit 6cd4406700)
2022-05-06 11:55:16 +02:00
Richard Biener fba3068ec1 middle-end/100786 - constant folding from incompatible alias
The following avoids us ICEing doing constant folding from variables
with aliases of different types.  The issue appears both in
folding and CCP and FRE can do more fancy stuff to still constant
fold cases where the load is smaller than the initializer so
defer it to there.

2022-01-20  Richard Biener  <rguenther@suse.de>

	PR middle-end/100786
	* gimple-fold.c (get_symbol_constant_value): Only return
	values of compatible type to the symbol.

	* gcc.dg/torture/pr100786.c: New testcase.

(cherry picked from commit 5c12507f5d)
2022-05-06 11:55:11 +02:00
GCC Administrator 4aae279dc7 Daily bump. 2022-05-06 00:20:03 +00:00
GCC Administrator 5a4beef5df Daily bump. 2022-05-05 00:19:32 +00:00
GCC Administrator a6a1339ce7 Daily bump. 2022-05-04 00:20:17 +00:00
GCC Administrator adc123e885 Daily bump. 2022-05-03 00:19:33 +00:00
GCC Administrator 7d3e7178e4 Daily bump. 2022-05-02 00:19:47 +00:00
GCC Administrator 51f6a2ac6c Daily bump. 2022-05-01 00:19:33 +00:00
GCC Administrator a9a8a98d4f Daily bump. 2022-04-30 00:20:14 +00:00
GCC Administrator e629bc8169 Daily bump. 2022-04-29 00:19:51 +00:00
GCC Administrator aa0354ccae Daily bump. 2022-04-28 00:19:13 +00:00
Hongyu Wang 18bee83150 AVX512F: Add missing macro for mask(z?)_scalf_s[sd] [PR 105339]
Add missing macro under O0 and adjust macro format for scalf
intrinsics.

gcc/ChangeLog:

	PR target/105339
	* config/i386/avx512fintrin.h (_mm512_scalef_round_pd):
	Add parentheses for parameters and djust format.
	(_mm512_mask_scalef_round_pd): Ditto.
	(_mm512_maskz_scalef_round_pd): Ditto.
	(_mm512_scalef_round_ps): Ditto.
	(_mm512_mask_scalef_round_ps): Ditto.
	(_mm512_maskz_scalef_round_ps): Ditto.
	(_mm_scalef_round_sd): Use _mm_undefined_pd.
	(_mm_scalef_round_ss): Use _mm_undefined_ps.
	(_mm_mask_scalef_round_sd): New macro.
	(_mm_mask_scalef_round_ss): Ditto.
	(_mm_maskz_scalef_round_sd): Ditto.
	(_mm_maskz_scalef_round_ss): Ditto.

gcc/testsuite/ChangeLog:

	PR target/105339
	* gcc.target/i386/sse-14.c: Add tests for new macro.

(cherry picked from commit 3c940d4270)
2022-04-27 15:13:41 +08:00
GCC Administrator 93e59846f2 Daily bump. 2022-04-27 00:19:24 +00:00
Iain Buclaw 0ef78377cb libphobos: Give _Unwind_Exception an alignment that best resembles __attribute__((aligned))
For interoperability with C++ EH, the alignment should match, otherwise
D may not be able to intercept exceptions thrown from C++.

libphobos/ChangeLog:

	* libdruntime/gcc/unwind/generic.d (__aligned__): Define.
	(_Unwind_Exception): Align struct to __aligned__.

(cherry picked from commit efa5449a09)
2022-04-26 16:17:40 +01:00
Iain Buclaw 90d877c783 libphobos: Don't call free on the TLS array in the emutls destroy function.
Fixes a segfault seen on Darwin when a GC scan is ran after a thread has
been destroyed.  As the global emutlsArrays hash still has a reference
to the array itself, and tries to iterate all elements.

Setting the length to zero frees all allocated elements in the array,
and ensures that it is skipped when the _d_emutls_scan is called.

libphobos/ChangeLog:

	* libdruntime/gcc/emutls.d (emutlsDestroyThread): Clear the per-thread
	TLS array, don't call free().

(cherry picked from commit 796b7cbac3)
2022-04-26 14:35:30 +01:00
GCC Administrator ec84dc14ac Daily bump. 2022-04-26 00:19:35 +00:00
GCC Administrator c77c0ab384 Daily bump. 2022-04-25 00:19:23 +00:00
GCC Administrator 90fd26d0b9 Daily bump. 2022-04-24 00:19:17 +00:00
GCC Administrator 92baac643d Daily bump. 2022-04-23 00:19:30 +00:00
GCC Administrator 973a5c6e57 Daily bump. 2022-04-22 00:19:51 +00:00
Fritz Reese 30e6e43f0b fortran: Fix conv of UNION constructors [PR105310]
This fixes an ICE when a UNION is the (1+8*2^n)-th field in a DEC
STRUCTURE when compiled with -finit-derived -finit-local-zero.
The problem was CONSTRUCTOR_APPEND_ELT from within gfc_conv_union_initializer
modified the vector pointer, but the pointer was passed by-value,
so the old pointer from the caller (gfc_conv_structure) pointed to freed
memory.

	PR fortran/105310

gcc/fortran/ChangeLog:

	* trans-expr.c (gfc_conv_union_initializer): Pass vec* by reference.

gcc/testsuite/ChangeLog:

	* gfortran.dg/dec_union_12.f90: New test.

(cherry picked from commit c049f638da)
2022-04-21 10:51:04 -04:00
GCC Administrator 2bc68e34a6 Daily bump. 2022-04-21 00:19:14 +00:00
GCC Administrator dfc61094cf Daily bump. 2022-04-20 00:19:11 +00:00
GCC Administrator 9ba7b1f744 Daily bump. 2022-04-19 00:19:21 +00:00
GCC Administrator 22831591ca Daily bump. 2022-04-18 00:19:24 +00:00
GCC Administrator 90d85bc74a Daily bump. 2022-04-17 00:19:23 +00:00
GCC Administrator 99dd1a907b Daily bump. 2022-04-16 00:19:32 +00:00
GCC Administrator 8226c512a8 Daily bump. 2022-04-15 00:19:39 +00:00
GCC Administrator 6e6e09a143 Daily bump. 2022-04-14 00:20:05 +00:00
GCC Administrator 9784dbfd36 Daily bump. 2022-04-13 00:19:21 +00:00
GCC Administrator 90504bd942 Daily bump. 2022-04-12 00:19:27 +00:00
GCC Administrator 2381c8ea80 Daily bump. 2022-04-11 00:19:09 +00:00
GCC Administrator d7c4ca15f6 Daily bump. 2022-04-10 00:19:16 +00:00
GCC Administrator 206bb45eee Daily bump. 2022-04-09 00:19:35 +00:00
GCC Administrator a2de6711ac Daily bump. 2022-04-08 00:19:31 +00:00
GCC Administrator 0d1834bf3b Daily bump. 2022-04-07 00:19:42 +00:00
Alex Coplan f037a81fcd arm: Fix ICEs with compare-and-swap and -march=armv8-m.base [PR99977]
The PR shows two ICEs with __sync_bool_compare_and_swap and
-mcpu=cortex-m23 (equivalently, -march=armv8-m.base): one in LRA and one
later on, after the CAS insn is split.

The LRA ICE occurs because the
@atomic_compare_and_swap<CCSI:arch><SIDI:mode>_1 pattern attempts to tie
two output operands together (operands 0 and 1 in the third
alternative). LRA can't handle this, since it doesn't make sense for an
insn to assign to the same operand twice.

The later (post-splitting) ICE occurs because the expansion of the
cbranchsi4_scratch insn doesn't quite go according to plan. As it
stands, arm_split_compare_and_swap calls gen_cbranchsi4_scratch,
attempting to pass a register (neg_bval) to use as a scratch register.
However, since the RTL template has a match_scratch here,
gen_cbranchsi4_scratch ignores this argument and produces a scratch rtx.
Since this is all happening after RA, this is doomed to fail (and we get
an ICE about the insn not matching its constraints).

It seems that the motivation for the choice of constraints in the
atomic_compare_and_swap pattern comes from an attempt to satisfy the
constraints of the cbranchsi4_scratch insn. This insn requires the
scratch register to be the same as the input register in the case that
we use a larger negative immediate (one that satisfies J, but not L).

Of course, as noted above, LRA refuses to assign two output operands to
the same register, so this was never going to work.

The solution I'm proposing here is to collapse the alternatives to the
CAS insn (allowing the two output register operands to be matched to
different registers) and to ensure that the constraints for
cbranchsi4_scratch are met in arm_split_compare_and_swap. We do this by
inserting a move to ensure the source and destination registers match if
necessary (i.e. in the case of large negative immediates).

Another notable change here is that we only do:

  emit_move_insn (neg_bval, const1_rtx);

for non-negative immediates. This is because the ADDS instruction used in
the negative case suffices to leave a suitable value in neg_bval: if the
operands compare equal, we don't take the branch (so neg_bval will be
set by the load exclusive). Otherwise, the ADDS will leave a nonzero
value in neg_bval, which will correctly signal that the CAS has failed
when it is later negated.

gcc/ChangeLog:

	PR target/99977
	* config/arm/arm.c (arm_split_compare_and_swap): Fix up codegen
	with negative immediates: ensure we expand cbranchsi4_scratch
	correctly and ensure we satisfy its constraints.
	* config/arm/sync.md
	(@atomic_compare_and_swap<CCSI:arch><NARROW:mode>_1): Don't
	attempt to tie two output operands together with constraints;
	collapse two alternatives.
	(@atomic_compare_and_swap<CCSI:arch><SIDI:mode>_1): Likewise.
	* config/arm/thumb1.md (cbranchsi4_neg_late): New.

gcc/testsuite/ChangeLog:

	PR target/99977
	* gcc.target/arm/pr99977.c: New test.
2022-04-06 11:18:05 +01:00
GCC Administrator 7f22f78103 Daily bump. 2022-04-06 00:19:30 +00:00
GCC Administrator 944923b3d5 Daily bump. 2022-04-05 00:19:29 +00:00
GCC Administrator ee03ed1a8d Daily bump. 2022-04-04 08:04:11 +00:00
GCC Administrator f9824339ec Daily bump. 2022-04-01 00:19:47 +00:00