Commit Graph

185337 Commits

Author SHA1 Message Date
Jakub Jelinek
6de756d7a7 i386: Don't emit fldpi etc. if -frounding-math [PR102498]
i387 has instructions to store some transcedental numbers into the top of
stack.  The problem is that what exact bit in the last place one gets for
those depends on the current rounding mode, the CPU knows the number with
slightly higher precision.  The compiler assumes rounding to nearest when
comparing them against constants in the IL, but at runtime the rounding
can be different and so some of these depending on rounding mode and the
constant could be 1 ulp higher or smaller than expected.
We only support changing the rounding mode at runtime if the non-default
-frounding-mode option is used, so the following patch just disables
using those constants if that flag is on.

2021-09-28  Jakub Jelinek  <jakub@redhat.com>

	PR target/102498
	* config/i386/i386.c (standard_80387_constant_p): Don't recognize
	special 80387 instruction XFmode constants if flag_rounding_math.

	* gcc.target/i386/pr102498.c: New test.

(cherry picked from commit 3b7041e834)
2021-09-28 13:04:26 +02:00
GCC Administrator
e011caf5fe Daily bump. 2021-09-28 00:17:59 +00:00
GCC Administrator
654d1bd86a Daily bump. 2021-09-27 00:18:02 +00:00
GCC Administrator
b595583f3d Daily bump. 2021-09-26 00:17:55 +00:00
GCC Administrator
522509e764 Daily bump. 2021-09-25 00:18:05 +00:00
Feng Xue
210c390174 Fix value uninitialization in vn_reference_insert_pieces [PR102400]
2021-09-23  Feng Xue  <fxue@os.amperecomputing.com>

gcc/
	PR tree-optimization/102400
	* tree-ssa-sccvn.c (vn_reference_insert_pieces): Initialize
	result_vdef to zero value.
2021-09-24 11:32:56 +08:00
Feng Xue
03a8d9ab4c Fix null-pointer dereference in delete_dead_or_redundant_call [PR102451]
2021-09-23  Feng Xue  <fxue@os.amperecomputing.com>

gcc/
	PR tree-optimization/102451
	* tree-ssa-dse.c (delete_dead_or_redundant_call): Record bb of stmt
	before removal.
2021-09-24 11:30:40 +08:00
GCC Administrator
23f129487e Daily bump. 2021-09-24 00:18:01 +00:00
GCC Administrator
e89de59a4b Daily bump. 2021-09-23 00:18:03 +00:00
Andreas Krebbel
5acab453d4 IBM Z: TPF: Add cc clobber to profiling expanders
The code sequence emitted uses CC internally.

gcc/ChangeLog:

	* config/s390/tpf.md (prologue_tpf, epilogue_tpf): Add cc clobber.

(cherry picked from commit e1223ea2f4)
2021-09-22 12:20:30 +02:00
Andreas Krebbel
22b25535b8 IBM Z: Fix PR102222
Avoid emitting a strict low part move if the insv target actually
affects the whole target reg.

gcc/ChangeLog:

	PR target/102222
	* config/s390/s390.c (s390_expand_insv): Emit a normal move if it
	is actually a full copy of the source operand into the target.
	Don't emit a strict low part move if source and target mode match.

gcc/testsuite/ChangeLog:

	* gcc.target/s390/pr102222.c: New test.

(cherry picked from commit a9b3c451be)
2021-09-22 12:19:06 +02:00
Kewen Lin
cc11a171ee ipa-fnsummary: Remove inconsistent bp_pack_value
There is one inconsistent bit-field streaming out and in.
On the side of streaming in:

    bp_pack_value (&bp, info->inlinable, 1);
    bp_pack_value (&bp, false, 1);
    bp_pack_value (&bp, info->fp_expressions, 1);

while on the side of the streaming out:

    info->inlinable = bp_unpack_value (&bp, 1);
    info->fp_expressions = bp_unpack_value (&bp, 1)

The removal of Cilk Plus support r8-4956 missed to remove
the streaming out of the bit, instead just change the value
for streaming out to be always false.

By hacking fp_expression_p to always return true, I can see
it reads the wrong fp_expressions value (false) out in wpa.

GCC12 adopts commit 63c6446f77
which removes the inconsistent streaming out instead.

gcc/ChangeLog:

	* ipa-fnsummary.c (inline_read_section): Unpack a dummy bit
	to keep consistent with the side of streaming out.
2021-09-21 21:07:06 -05:00
GCC Administrator
ae362db3e5 Daily bump. 2021-09-22 00:18:00 +00:00
Segher Boessenkool
da0a5628d4 rs6000: Fix ELFv2 r12 use in epilogue
We cannot use r12 here, it is already in use as the GEP (for sibling
calls).

2021-09-08  Segher Boessenkool  <segher@kernel.crashing.org>
	PR target/102107
	* config/rs6000/rs6000-logue.c (rs6000_emit_epilogue): For ELFv2 use
	r11 instead of r12 for restoring CR.

(cherry picked from commit 86e6268cff)
2021-09-21 23:22:44 +00:00
Segher Boessenkool
5210f05c6e rs6000: Don't use r12 for CR save on ELFv2 (PR102107)
CR is saved and/or restored on some paths where GPR12 is already live
since it has a meaning in the calling convention in the ELFv2 ABI.

It is not completely clear to me that we can always use r11 here, but
it does seem save, there is checking code (to detect conflicts here),
and it is stage 1.  So here goes.

2021-09-03  Segher Boessenkool <segher@kernel.crashing.org>

	PR target/102107
	* config/rs6000/rs6000-logue.c (rs6000_emit_prologue): On ELFv2 use r11
	instead of r12 for CR save, in all cases.

(cherry picked from commit 2484f7a4b0)
2021-09-21 23:21:49 +00:00
Harald Anlauf
7fbab3afca Fortran - (large) arrays in the main shall be static
gcc/fortran/ChangeLog:

	PR fortran/102366
	* trans-decl.c (gfc_finish_var_decl): Disable the warning message
	for variables moved from stack to static storange if they are
	declared in the main, but allow the move to happen.

gcc/testsuite/ChangeLog:

	PR fortran/102366
	* gfortran.dg/pr102366.f90: New test.

(cherry picked from commit 51166eb2c5)
2021-09-21 20:39:38 +02:00
Eric Botcazou
d891ef6ac4 Fix no_fsanitize_address effective target
The implementation of the no_fsanitize_address effective target was copied
from asan-dg.exp without realizing that it does not work outside of this
context (there is a comment explaining why).  As a consequence, it always
returns 0, so for example the directive in gnat.dg/asan1.adb:

{ dg-skip-if "no address sanitizer" { no_fsanitize_address } }

does not work.  This led some people to add the nonsensical:

{ dg-require-effective-target no_fsanitize_address }

to sanitizer tests, e.g. g++.dg/warn/uninit-pr93100.C, thus disabling them
everywhere instead of just for the problematic targets.

gcc/testsuite/
	* lib/target-supports.exp (no_fsanitize_address): Add missing bits.
	* gcc.dg/pr91441.c: Likewise.
	* gcc.dg/pr96260.c: Likewise.
	* gcc.dg/pr96307.c: Likewise.
	* gnat.dg/asan1.adb: Likewise.

	* g++.dg/abi/anon4.C: Likewise.
2021-09-21 09:32:37 +02:00
GCC Administrator
d4b84aefe6 Daily bump. 2021-09-21 00:17:57 +00:00
Tobias Burnus
b1dc26d354 GCC11 - Fortran: combined directives - order(concurrent) not on distribute
While OpenMP 5.1 and GCC 12 permits 'order(concurrent)' on distribute,
OpenMP 5.0 and GCC 11 don't. This patch for GCC 11 ensures the clause also
does not end up on 'distribute' when splitting combined directives.

gcc/fortran/ChangeLog:

	* trans-openmp.c (gfc_split_omp_clauses): Don't put 'order(concurrent)'
	on 'distribute' for combined directives, matching OpenMP 5.0

gcc/testsuite/ChangeLog:

	* gfortran.dg/gomp/distribute-order-concurrent.f90: New test.
2021-09-20 17:24:56 +02:00
GCC Administrator
79c523d40d Daily bump. 2021-09-20 00:17:58 +00:00
Harald Anlauf
6527feb07c Fortran - fix handling of optional allocatable DT arguments with INTENT(OUT)
gcc/fortran/ChangeLog:

	PR fortran/102287
	* trans-expr.c (gfc_conv_procedure_call): Wrap deallocation of
	allocatable components of optional allocatable derived type
	procedure arguments with INTENT(OUT) into a presence check.

gcc/testsuite/ChangeLog:

	PR fortran/102287
	* gfortran.dg/intent_out_14.f90: New test.

(cherry picked from commit cfea7b86f2)
2021-09-19 21:16:26 +02:00
Harald Anlauf
1ae01a88d3 Fortran - fix ICE during error recovery checking entry characteristics
gcc/fortran/ChangeLog:

	PR fortran/102311
	* resolve.c (resolve_entries): Attempt to recover cleanly after
	rejecting mismatched function entries.

gcc/testsuite/ChangeLog:

	PR fortran/102311
	* gfortran.dg/entry_25.f90: New test.

(cherry picked from commit b305ec979d)
2021-09-19 21:15:38 +02:00
GCC Administrator
0d2d24fbe3 Daily bump. 2021-09-19 00:17:58 +00:00
GCC Administrator
7026df8d25 Daily bump. 2021-09-18 00:18:17 +00:00
Eric Botcazou
469aad8b5d Fix PR rtl-optimization/102306
This is a duplication of volatile loads introduced during GCC 9 development
by the 2->2 mechanism of the RTL combiner.  There is already a substantial
checking for volatile references in can_combine_p but it implicitly assumes
that the combination reduces the number of instructions, which is of course
not the case here.  So the fix teaches try_combine to abort the combination
when it is about to make a copy of volatile references to preserve them.

gcc/
	PR rtl-optimization/102306
	* combine.c (try_combine): Abort the combination if we are about to
	duplicate volatile references.

gcc/testsuite/
	* gcc.target/sparc/20210917-1.c: New test.
2021-09-17 10:19:19 +02:00
GCC Administrator
a6aa2458a9 Daily bump. 2021-09-17 00:18:02 +00:00
Harald Anlauf
3bc4ed0851 Fortran - fix handling of substring start and end indices
gcc/fortran/ChangeLog:

	PR fortran/85130
	* expr.c (find_substring_ref): Handle given substring start and
	end indices as signed integers, not unsigned.

gcc/testsuite/ChangeLog:

	PR fortran/85130
	* gfortran.dg/substr_6.f90: Revert commit r8-7574, adding again
	test that was erroneously considered as illegal.

(cherry picked from commit 8d93ba93d3)
2021-09-16 20:19:02 +02:00
Harald Anlauf
58c76fb477 Fortran - ensure simplification of bounds of array-valued named constants
gcc/fortran/ChangeLog:

	PR fortran/82314
	* decl.c (add_init_expr_to_sym): For proper initialization of
	array-valued named constants the array bounds need to be
	simplified before adding the initializer.

gcc/testsuite/ChangeLog:

	PR fortran/82314
	* gfortran.dg/pr82314.f90: New test.

(cherry picked from commit 104c05c528)
2021-09-16 20:17:06 +02:00
Daniel Cederman
c503f416f2 sparc: Add scheduling information for LEON5
The LEON5 can often dual issue instructions from the same 64-bit aligned
double word if there are no data dependencies. Add scheduling information
to avoid scheduling unpairable instructions back-to-back.

gcc/ChangeLog:

	* config/sparc/sparc-opts.h (enum sparc_processor_type): Add LEON5
	* config/sparc/sparc.c (struct processor_costs): Add LEON5 costs
	(leon5_adjust_cost): Increase cost of store with data dependency
	on ALU instruction and FPU anti-dependencies.
	(sparc_option_override): Add LEON5 costs
	(sparc_adjust_cost): Add LEON5 cost adjustments
	* config/sparc/sparc.h: Add LEON5
	* config/sparc/sparc.md: Include LEON5 scheduling information
	* config/sparc/sparc.opt: Add LEON5
	* doc/invoke.texi: Add LEON5
	* config/sparc/leon5.md: New file.
2021-09-16 13:40:53 +02:00
Daniel Cederman
3fd9656951 sparc: Add NOP in stack_protect_setsi if sparc_fix_b2bst enabled
This is needed to prevent the Store -> (Non-store or load) -> Store
sequence.

gcc/ChangeLog:

	* config/sparc/sparc.md (stack_protect_setsi): Add NOP to prevent
	sensitive sequence for B2BST errata workaround.
2021-09-16 13:40:50 +02:00
Daniel Cederman
7b30a12edf sparc: Prevent atomic instructions in beginning of functions for UT700
A call to the function might have a load instruction in the delay slot
and a load followed by an atomic function could cause a deadlock.

gcc/ChangeLog:

	* config/sparc/sparc.c (sparc_do_work_around_errata): Do not begin
	functions with atomic instruction in the UT700 errata workaround.
2021-09-16 13:40:49 +02:00
Daniel Cederman
f5b008faf0 sparc: Skip all empty assembly statements
This version detects multiple empty assembly statements in a row and also
detects non-memory barrier empty assembly statements (__asm__("")). It
can be used instead of next_active_insn().

gcc/ChangeLog:

	* config/sparc/sparc.c (next_active_non_empty_insn): New function
	that returns next active non empty assembly instruction.
	(sparc_do_work_around_errata): Use new function.
2021-09-16 13:40:48 +02:00
Daniel Cederman
807c7e1248 sparc: Treat more instructions as load or store in errata workarounds
Check the attribute of instruction to determine if it performs a store
or load operation. This more generic approach sees the last instruction
in the GOTdata_op model as a potential load and treats the memory barrier
as a potential store instruction.

gcc/ChangeLog:

	* config/sparc/sparc.c (store_insn_p): Add predicate for store
	attributes.
	(load_insn_p): Add predicate for load attributes.
	(sparc_do_work_around_errata): Use new predicates.
2021-09-16 13:40:47 +02:00
Andreas Larsson
b602b667c0 sparc: Print out bit names for LEON and LEON3 with -mdebug
gcc/ChangeLog:

	* config/sparc/sparc.c (dump_target_flag_bits): Print bit names for
	LEON and LEON3.
2021-09-16 13:40:45 +02:00
Andrew Pinski
f00530266f Fix target/101934: aarch64 memset code creates unaligned stores for -mstrict-align
The problem here is the aarch64_expand_setmem code did not check
STRICT_ALIGNMENT if it is creating an overlapping store.
This patch adds that check and the testcase works.

gcc/ChangeLog:

	PR target/101934
	* config/aarch64/aarch64.c (aarch64_expand_setmem):
	Check STRICT_ALIGNMENT before creating an overlapping
	store.

gcc/testsuite/ChangeLog:

	PR target/101934
	* gcc.target/aarch64/memset-strict-align-1.c: New test.

(cherry picked from commit a45786e9a3)
2021-09-16 07:28:53 +00:00
GCC Administrator
0287b697b0 Daily bump. 2021-09-16 00:17:54 +00:00
Jakub Jelinek
352c0b2668 c++: Fix handling of decls with flexible array members initialized with side-effects [PR88578]
> > Note, if the flexible array member is initialized only with non-constant
> > initializers, we have a worse bug that this patch doesn't solve, the
> > splitting of initializers into constant and dynamic initialization removes
> > the initializer and we don't have just wrong DECL_*SIZE, but nothing is
> > emitted when emitting those vars into assembly either and so the dynamic
> > initialization clobbers other vars that may overlap the variable.
> > I think we need keep an empty CONSTRUCTOR elt in DECL_INITIAL for the
> > flexible array member in that case.
>
> Makes sense.

So, the following patch fixes that.

The typeck2.c change makes sure we keep those CONSTRUCTORs around (although
they should be empty because all their elts had side-effects/was
non-constant if it was removed earlier), and the varasm.c change is to avoid
ICEs on those as well as ICEs on other flex array members that had some
initializers without side-effects, but not on the last array element.

The code was already asserting that the (index of the last elt in the
CONSTRUCTOR + 1) times elt size is equal to TYPE_SIZE_UNIT of the local->val
type, which is true for C flex arrays or for C++ if they don't have any
side-effects or the last elt doesn't have side-effects, this patch changes
that to assertion that the TYPE_SIZE_UNIT is greater than equal to the
offset of the end of last element in the CONSTRUCTOR and uses TYPE_SIZE_UNIT
(int_size_in_bytes) in the code later on.

2021-09-15  Jakub Jelinek  <jakub@redhat.com>

	PR c++/88578
	PR c++/102295
gcc/
	* varasm.c (output_constructor_regular_field): Instead of assertion
	that array_size_for_constructor result is equal to size of
	TREE_TYPE (local->val) in bytes, assert that the type size is greater
	or equal to array_size_for_constructor result and use type size as
	fieldsize.
gcc/cp/
	* typeck2.c (split_nonconstant_init_1): Don't throw away empty
	initializers of flexible array members if they have non-zero type
	size.
gcc/testsuite/
	* g++.dg/ext/flexary39.C: New test.
	* g++.dg/ext/flexary40.C: New test.

(cherry picked from commit e5d1af8a07)
2021-09-16 01:05:02 +02:00
Jakub Jelinek
6550198bd8 c++: Update DECL_*SIZE for objects with flexible array members with initializers [PR102295]
The C FE updates DECL_*SIZE for vars which have initializers for flexible
array members for many years, but C++ FE kept DECL_*SIZE the same as the
type size (i.e. as if there were zero elements in the flexible array
member).  This results e.g. in ELF symbol sizes being too small.

Note, if the flexible array member is initialized only with non-constant
initializers, we have a worse bug that this patch doesn't solve, the
splitting of initializers into constant and dynamic initialization removes
the initializer and we don't have just wrong DECL_*SIZE, but nothing is
emitted when emitting those vars into assembly either and so the dynamic
initialization clobbers other vars that may overlap the variable.
I think we need keep an empty CONSTRUCTOR elt in DECL_INITIAL for the
flexible array member in that case.

2021-09-14  Jakub Jelinek  <jakub@redhat.com>

	PR c++/102295
	* decl.c (layout_var_decl): For aggregates ending with a flexible
	array member, add the size of the initializer for that member to
	DECL_SIZE and DECL_SIZE_UNIT.

	* g++.target/i386/pr102295.C: New test.

(cherry picked from commit 818c505188)
2021-09-16 01:05:02 +02:00
Jakub Jelinek
6f61195e04 c++: Fix __is_*constructible/assignable for templates [PR102305]
is_xible_helper returns error_mark_node (i.e. false from the traits)
for abstract classes by testing ABSTRACT_CLASS_TYPE_P (to) early.
Unfortunately, as the testcase shows, that doesn't work on class templates
that haven't been instantiated yet, ABSTRACT_CLASS_TYPE_P for them is false
until it is instantiated, which is done when the routine later constructs
a dummy object with that type.

The following patch fixes this by calling complete_type first, so that
ABSTRACT_CLASS_TYPE_P test will work properly, while keeping the handling
of arrays with unknown bounds, or incomplete types where it is done
currently.

2021-09-14  Jakub Jelinek  <jakub@redhat.com>

	PR c++/102305
	* method.c (is_xible_helper): Call complete_type on to.

	* g++.dg/cpp0x/pr102305.C: New test.

(cherry picked from commit f008fd3a48)
2021-09-16 01:05:02 +02:00
Pat Haugen
b429c81170 Enable store fusion on Power10.
gcc/ChangeLog:

	* config/rs6000/rs6000-cpus.def (ISA_3_1_MASKS_SERVER): Add
	OPTION_MASK_P10_FUSION_2STORE.
	(POWERPC_MASKS): Likewise.
	* config/rs6000/rs6000.c (rs6000_option_override_internal): Enable
	store fusion for Power10.
	(is_fusable_store): New.
	(power10_sched_reorder): Likewise.
	(rs6000_sched_reorder): Do Power10 specific reordering.
	(rs6000_sched_reorder2): Likewise.
	* config/rs6000/rs6000.opt: Add new option.

gcc/testsuite/ChangeLog:

	* gcc.target/powerpc/fusion-p10-stst.c: New test.
	* gcc.target/powerpc/fusion-p10-stst2.c: New test.
2021-09-15 18:02:55 -05:00
Peter Bergner
ed9006264f rs6000: Generate an lxvp instead of two adjacent lxv instructions
The MMA build built-ins currently use individual lxv instructions to
load up the registers of a __vector_pair or __vector_quad.  If the
memory addresses of the built-in operands are to adjacent locations,
then we can use an lxvp in some cases to load up two registers at once.
The patch below adds support for checking whether memory addresses are
adjacent and emitting an lxvp instead of two lxv instructions.

2021-07-14  Peter Bergner  <bergner@linux.ibm.com>

gcc/
	* config/rs6000/rs6000.c (adjacent_mem_locations): Return the lower
	addressed memory rtx, if any.
	(rs6000_split_multireg_move): Fix code formatting.
	Handle MMA build built-ins with operands in adjacent memory locations.

gcc/testsuite/
	* gcc.target/powerpc/mma-builtin-9.c: New test.

(cherry picked from commit 69feb7601e)
2021-09-15 12:18:24 -05:00
Peter Bergner
819e7784a0 rs6000: Move rs6000_split_multireg_move to later in file
An upcoming change to rs6000_split_multireg_move requires it to be
moved later in the file to fix a declaration issue.

2021-07-14  Peter Bergner  <bergner@linux.ibm.com>

gcc/
	* config/rs6000/rs6000.c (rs6000_split_multireg_move): Move to later
	in the file.

(cherry picked from commit 7d914777fc)
2021-09-15 12:18:24 -05:00
GCC Administrator
e9a6a10004 Daily bump. 2021-09-15 00:18:10 +00:00
Pat Haugen
4bcb3213f7 Verify destination[source] of a load[store] instruction is a register.
Backported from master:
	2021-08-09  Pat Haugen  <pthaugen@linux.ibm.com>

gcc/ChangeLog:

	* config/rs6000/rs6000.c (is_load_insn1): Verify destination is a
	register.
	(is_store_insn1): Verify source is a register.
2021-09-14 15:02:09 -05:00
Eric Botcazou
40c0122a1c Fix PR ada/101970
This is a regression present on the mainline and 11 branch in the form of an
ICE for an enumeration type with a full signed representation for its size.

gcc/ada/
	PR ada/101970
	* exp_attr.adb (Expand_N_Attribute_Reference) <Attribute_Enum_Rep>:
	Use an unchecked conversion instead of a regular conversion in the
	enumeration case and remove Conversion_OK flag in the integer case.
	<Attribute_Pos>: Remove superfluous test.

gcc/testsuite/
	* gnat.dg/enum_rep2.adb: New test.
2021-09-14 11:36:02 +02:00
Eric Botcazou
82a95c08c0 Do not issue size error for too large array type
The error is to be issued when objects of the type are declared instead.

gcc/ada/
	* gcc-interface/decl.c (validate_size): Do not issue an error if the
	old size has overflowed.
2021-09-14 11:17:40 +02:00
Eric Botcazou
1355ea5049 Fix inaccurate bounds in debug info for vector array types
They should not be 0-based, unless the array type itself is.

gcc/ada/
	* gcc-interface/decl.c (gnat_to_gnu_entity): For vector types, make
	the representative array the debug type.
2021-09-14 11:12:09 +02:00
Eric Botcazou
e94730e51a Fix internal error on pointer-to-pointer binding in LTO mode
gcc/ada/
	* gcc-interface/utils.c (update_pointer_to): Set TYPE_CANONICAL on
	pointer and reference types.
2021-09-14 10:46:12 +02:00
Eric Botcazou
df2f733cd9 Remove superfluous call to UI_Is_In_Int_Range
gcc/ada/
	* gcc-interface/utils.c (can_materialize_object_renaming_p): Do not
	call UI_Is_In_Int_Range on the result of Normalized_First_Bit.
2021-09-14 10:23:57 +02:00
Eric Botcazou
4fc907e18d Give more informative error message for by-reference types
Recent compilers enforce more strictly the RM C.6(18) clause, which says
that volatile record types are by-reference types.  This changes the typical
error message now given in these cases.

gcc/ada/
	* gcc-interface/decl.c (gnat_to_gnu_entity) <is_type>: Declare new
	constant.  Adjust error message issued by validate_size in the case
	of by-reference types.
	(validate_size): Always use the error strings passed by the caller.
2021-09-14 09:44:10 +02:00