Commit Graph

185176 Commits

Author SHA1 Message Date
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
Xionghu Luo
a87d7fbef5 rs6000: Expand fmod and remainder when built with fast-math [PR97142]
fmod/fmodf and remainder/remainderf could be expanded instead of library
call when fast-math build, which is much faster.

fmodf:
     fdivs   f0,f1,f2
     friz    f0,f0
     fnmsubs f1,f2,f0,f1

remainderf:
     fdivs   f0,f1,f2
     frin    f0,f0
     fnmsubs f1,f2,f0,f1

SPEC2017 Ofast P8LE: 511.povray_r +1.14%,  526.blender_r +1.72%

gcc/ChangeLog:

2021-09-07  Xionghu Luo  <luoxhu@linux.ibm.com>

	PR target/97142
	* config/rs6000/rs6000.md (fmod<mode>3): New define_expand.
	(remainder<mode>3): Likewise.

gcc/testsuite/ChangeLog:

2021-09-07  Xionghu Luo  <luoxhu@linux.ibm.com>

	PR target/97142
	* gcc.target/powerpc/pr97142.c: New test.

	(cherry-picked from 546ecb0054)
2021-09-14 00:32:56 -05:00
GCC Administrator
6dd2650f96 Daily bump. 2021-09-14 00:18:11 +00:00
GCC Administrator
b79f0b99fd Daily bump. 2021-09-13 00:18:13 +00:00
Iain Buclaw
09a2049123 d: Don't include terminating null pointer in string expression conversion (PR102185)
This gets re-added by the ExprVisitor when lowering StringExp back into a
STRING_CST during the code generator pass.

	PR d/102185

gcc/d/ChangeLog:

	* d-builtins.cc (d_eval_constant_expression): Don't include
	terminating null pointer in string expression conversion.

gcc/testsuite/ChangeLog:

	* gdc.dg/pr102185.d: New test.

(cherry picked from commit 53a4def0dc)
2021-09-12 17:46:53 +02:00
GCC Administrator
2ae73531d3 Daily bump. 2021-09-12 00:17:52 +00:00
Harald Anlauf
7ca5bcb0f1 Fortran - out of bounds in array constructor with implied do loop
gcc/fortran/ChangeLog:

	PR fortran/98490
	* trans-expr.c (gfc_conv_substring): Do not generate substring
	bounds check for implied do loop index variable before it actually
	becomes defined.

gcc/testsuite/ChangeLog:

	PR fortran/98490
	* gfortran.dg/bounds_check_23.f90: New test.

(cherry picked from commit 5fe0865ab7)
2021-09-11 21:02:13 +02:00
Harald Anlauf
0d09acc0d6 Fortran - improve error recovery determining array element from constructor
gcc/fortran/ChangeLog:

	PR fortran/101327
	* expr.c (find_array_element): When bounds cannot be determined as
	constant, return error instead of aborting.

gcc/testsuite/ChangeLog:

	PR fortran/101327
	* gfortran.dg/pr101327.f90: New test.

(cherry picked from commit 2a1537a19c)
2021-09-11 20:57:47 +02:00
GCC Administrator
a22c0458cb Daily bump. 2021-09-11 00:18:00 +00:00
Ian Lance Taylor
7edb992d81 compiler: correct condition for calling memclrHasPointers
When compiling append(s, make([]typ, ln)...), where typ has a pointer,
and the append fits within the existing capacity of s, the condition
used to clear out the new elements was reversed.

Fixes golang/go#47771

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/344189
2021-09-10 11:14:45 -07:00
GCC Administrator
3556ab610c Daily bump. 2021-09-10 00:17:54 +00:00
GCC Administrator
f459220912 Daily bump. 2021-09-09 00:18:03 +00:00