gcc.git
4 years agoUpdate gcc .po files.
Joseph Myers [Mon, 27 Jul 2020 22:51:58 +0000 (22:51 +0000)]
Update gcc .po files.

* be.po, da.po, de.po, el.po, es.po, fi.po, fr.po, hr.po, id.po,
ja.po, nl.po, ru.po, sr.po, sv.po, tr.po, uk.po, vi.po, zh_CN.po,
zh_TW.po: Update.

4 years agocommon: Use strcmp to compare location file names
Nathan Sidwell [Mon, 27 Jul 2020 20:05:28 +0000 (13:05 -0700)]
common: Use strcmp to compare location file names

The logic to figure out where a missing #include should be inserted
uses pointer equality to check filenames -- the routine even says so.
But cpplib makes no such guarantee.  It happens to be true for input
that it preprocesses[* see line zero below], but is not true for
source that has already been preprocessed -- all those '# ...' line
directives produce disctinct filename strings.  That renders using
-fdirectives-only as a prescanning stage (as I understand some people
do), broken.

This patch changes to string comparisons, and explicitly rejects any
line-zero location map that occurs at the beginning of a file.  The
very first map of a file has a different string to the remaining maps,
and we never tripped on that because of the pointer comparison.  The
second testcase deploys -save-temps to cause an intermediate
preprocessed output that is read back.

gcc/c-family/
* c-common.c (try_to_locate_new_include_insertion_point): Use
strcmp, not pointer equality.
gcc/testsuite/
* g++.dg/lookup/missing-std-include-10.h: New.
* g++.dg/lookup/missing-std-include-10.C: New.
* g++.dg/lookup/missing-std-include-11.C: New.

4 years agoc++: Name as_base type
Nathan Sidwell [Wed, 22 Jul 2020 19:00:02 +0000 (12:00 -0700)]
c++: Name as_base type

The as-base type never got a name.  For modules I needed to give it a
name to serialize properly, and it's useful when debugging the
compiler, so we may as well have it on trunk.  There's also a bug
where its fields can have NSDMIs from the main class.  This happens to
be silent on trunk, but can be a GC leak where we retain a deferred
parse node there. (On modules it blows up, because we're not prepared
to serialize deferred parse nodes, as they should never survive
parsing.

gcc/cp/
* cp-tree.h (enum cp_tree_index): Add CPTI_AS_BASE_IDENTIFIER.
(as_base_identifier): Define.
* decl.c (initialize_predifined_identifiers): Initialize as_base
identifier.
* class.c (layout_class_type): Name the as-base type.  Zap
NSDMI its fields may have.

4 years agoDiagnose just-past-the-end references for minor array bounds.
Martin Sebor [Mon, 27 Jul 2020 19:54:50 +0000 (13:54 -0600)]
Diagnose just-past-the-end references for minor array bounds.

Resolves:
PR tree-optimization/84079 - missing -Warray-bounds taking the address of past-the-end element of a multidimensional array

gcc/ChangeLog:

PR tree-optimization/84079
* gimple-array-bounds.cc (array_bounds_checker::check_addr_expr):
Only allow just-past-the-end references for the most significant
array bound.

gcc/testsuite/ChangeLog:

PR tree-optimization/84079
* gcc.dg/Warray-bounds-62.c: New test.

4 years agolibstdc++: Review _Hashtable count, equal_range _M_erase(false_type,) code
François Dumont [Mon, 20 Jan 2020 07:24:47 +0000 (08:24 +0100)]
libstdc++: Review _Hashtable count, equal_range _M_erase(false_type,) code

Simplify operator[] implementation using find method. Review several
_Hashtable method implementations to limit the computation of bucket index.
Introduce _M_update_bbegin to simplify code.

libstdc++-v3/ChangeLog:

* include/bits/hashtable_policy.h (_Map_base<>::at): Use
_Hashtable<>::find.
(_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals):New.
(_Hashtable_base<>::_M_node_equals): New, use latter.
(_Equality<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash,
_RehashPolicy, false>::_M_equal): Adapt to use latter.
* include/bits/hashtable.h (_Hashtable<>::_M_update_bbegin): New.
(_Hashtable<>::_M_assign): Use latter.
(_Hashtable<>::_M_move_assign): Likewise.
(_Hashtable<>(_Hashtable<>&&)): Likewise.
(_Hashtable<>(_Hashtable<>&&, const allocator_type&)): Likewise.
(_Hashtable<>::swap): Likewise.
(_Hashtable<>::find): Build iterator directly from _M_find_node result.
(_Hashtable<>::count): Use _Hashtable<>::find.
(_Hashtable<>::equal_range): Likewise.
(_Hashtable<>::_M_erase(false_type, const key_type&)): Use
_M_node_equals.

4 years agodriver: fix a problem with implementation of -falign-foo=0 [PR96247]
Hu Jiangping [Mon, 27 Jul 2020 17:22:23 +0000 (18:22 +0100)]
driver: fix a problem with implementation of -falign-foo=0 [PR96247]

This patch makes the -falign-foo=0 work as described in the
documentation. Thanks for all the suggestions.

Changelog:
2020-07-27  Hu Jiangping  <hujiangping@cn.fujitsu.com>

PR driver/96247
* opts.c (check_alignment_argument): Set the -falign-Name
on/off flag on and set the -falign-Name string value null,
when the command-line specified argument is zero.

4 years agocompiler: scan all function literals for escape analysis
Ian Lance Taylor [Sun, 26 Jul 2020 18:08:13 +0000 (11:08 -0700)]
compiler: scan all function literals for escape analysis

We were scanning only function literals with closures, but not all
function literals have closures.

Discovered because compiler failed building 1.15rc1, as there is a
function literal in the runtime package (p1 in hexdumpWords) that has
no closure and, without escape analysis, was forcing a variable to the
heap which is not permitted in the runtime.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/244802

4 years agoopenacc: Deep copy attach/detach should not affect reference counts
Julian Brown [Thu, 18 Jun 2020 12:11:08 +0000 (05:11 -0700)]
openacc: Deep copy attach/detach should not affect reference counts

Attach and detach operations are not supposed to affect structural or
dynamic reference counts for OpenACC. Previously they did so, which led to
subtle problems in some circumstances. We can avoid reference-counting
attach/detach operations by extending and slightly repurposing the
do_detach field in target_var_desc. It is now called is_attach to better
reflect its new role.

2020-07-27  Julian Brown  <julian@codesourcery.com>
    Thomas Schwinge  <thomas@codesourcery.com>

libgomp/
* libgomp.h (struct target_var_desc): Rename do_detach field to
is_attach.
* oacc-mem.c (goacc_exit_datum_1): Add assert.  Don't set finalize for
GOMP_MAP_FORCE_DETACH. Update checking to use is_attach field.
(goacc_enter_data_internal): Don't affect reference counts
for attach mappings.
(goacc_exit_data_internal): Don't affect reference counts for detach
mappings.
* target.c (gomp_map_vars_existing): Don't affect reference counts for
attach mappings.
(gomp_map_vars_internal): Set renamed is_attach flag unconditionally to
mark attach mappings.
(gomp_unmap_vars_internal): Use is_attach flag to prevent affecting
reference count for attach mappings.
* testsuite/libgomp.oacc-c-c++-common/mdc-refcount-1.c: New test.
* testsuite/libgomp.oacc-c-c++-common/mdc-refcount-2.c: New test.
* testsuite/libgomp.oacc-c-c++-common/mdc-refcount-2.c: New test.
* testsuite/libgomp.oacc-fortran/deep-copy-6-no_finalize.F90: Mark
test as shouldfail.
* testsuite/libgomp.oacc-fortran/deep-copy-6.f90: Adjust to fail
gracefully in no-finalize mode.

Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
4 years agolibstdc++: Make std::from_chars always round to nearest
Jonathan Wakely [Mon, 27 Jul 2020 14:51:16 +0000 (15:51 +0100)]
libstdc++: Make std::from_chars always round to nearest

Also fix the tests that fail on targets without uselocale.

libstdc++-v3/ChangeLog:

* src/c++17/floating_from_chars.cc (from_chars_impl): Ensure
that FE_NEAREST is used.
* testsuite/20_util/from_chars/4.cc: Do not use if constexpr in
a { target c++14 } test.
[!_GLIBCXX_HAVE_USELOCALE]: Disable all tests.
* testsuite/20_util/from_chars/5.cc [!_GLIBCXX_HAVE_USELOCALE]:
Likewise.
* testsuite/20_util/from_chars/6.cc: New test.

4 years agoexpr: build string_constant only for a char type
Martin Liska [Mon, 27 Jul 2020 10:30:24 +0000 (12:30 +0200)]
expr: build string_constant only for a char type

gcc/ChangeLog:

PR tree-optimization/96058
* expr.c (string_constant): Build string_constant only
for a type that has same precision as char_type_node
and is an integral type.

4 years agoRemove useless backedge marking
Richard Biener [Fri, 24 Jul 2020 14:50:59 +0000 (16:50 +0200)]
Remove useless backedge marking

I didn't find anything using EDGE_DFS_BACK in RTL infrastructure
used by var-tracking or var-tracking itself, the following removes
this computation.

2020-07-24  Richard Biener  <rguenther@suse.de>

* var-tracking.c (variable_tracking_main_1): Remove call
to mark_dfs_back_edges.

4 years agoDo not expand vector comparison with VEC_COND_EXPR.
Martin Liska [Mon, 27 Jul 2020 11:55:38 +0000 (13:55 +0200)]
Do not expand vector comparison with VEC_COND_EXPR.

gcc/ChangeLog:

PR tree-optimization/96128
* tree-vect-generic.c (expand_vector_comparison): Do not expand
vector comparison with VEC_COND_EXPR.

gcc/testsuite/ChangeLog:

PR tree-optimization/96128
* gcc.target/s390/vector/pr96128.c: New test.

4 years agoLTO: Add -fcf-protection=check
H.J. Lu [Thu, 16 Jul 2020 14:03:27 +0000 (07:03 -0700)]
LTO: Add -fcf-protection=check

Mixing -fcf-protection and -fcf-protection=none objects are allowed.
Linker just merges -fcf-protection values from all input objects.

Add -fcf-protection=check for the final link with LTO.  An error is
issued if LTO object files are compiled with different -fcf-protection
values.  Otherwise, -fcf-protection=check is ignored at the compile
time.  Without explicit -fcf-protection at link time, -fcf-protection
values from LTO object files are merged at the final link.

gcc/

PR bootstrap/96203
* common.opt: Add -fcf-protection=check.
* flag-types.h (cf_protection_level): Add CF_CHECK.
* lto-wrapper.c (merge_and_complain): Issue an error for
mismatching -fcf-protection values with -fcf-protection=check.
Otherwise, merge -fcf-protection values.
* doc/invoke.texi: Document -fcf-protection=check.

gcc/testsuite/

PR bootstrap/96203
* gcc.target/i386/pr96203-1.c: New test.
* gcc.target/i386/pr96203-2.c: Likewise.

4 years ago[Ada] Revert "Revamp dump and aux output names"
Alexandre Oliva [Thu, 2 Jul 2020 07:25:26 +0000 (03:25 -0400)]
[Ada] Revert "Revamp dump and aux output names"

gcc/ada/

* switch.adb (Is_Internal_GCC_Switch): Revert accidental
reintroduction of auxbase and auxbase-strip.

4 years ago[Ada] Ada2020: AI12-0027 Access values and unaliased component
Javier Miranda [Thu, 18 Jun 2020 20:07:52 +0000 (16:07 -0400)]
[Ada] Ada2020: AI12-0027 Access values and unaliased component

gcc/ada/

* sem_res.adb (Resolve_Actuals): Restrict the check on matching
aliased components to view conversions of array types that are
not placed in an instance. In such case at runtime an object is
created.
* sem_util.ads (Is_Actual_In_Out_Parameter, Is_View_Conversion):
New subprograms.
* sem_util.adb (Is_Actual_In_Out_Parameter, Is_View_Conversion):
New subprograms.

4 years ago[Ada] Assert failure on incorrect code
Arnaud Charlet [Fri, 19 Jun 2020 13:50:34 +0000 (09:50 -0400)]
[Ada] Assert failure on incorrect code

gcc/ada/

* lib-xref.adb (Generate_Reference): Protect against malformed
tree in case of severe errors.
* sem_ch8.adb (Add_Implicit_Operator): Ditto.

4 years ago[Ada] Switch Ada_Version_Runtime to Ada 2020
Arnaud Charlet [Thu, 18 Jun 2020 09:34:17 +0000 (05:34 -0400)]
[Ada] Switch Ada_Version_Runtime to Ada 2020

gcc/ada/

* opt.ads (Ada_Version_Runtime): Set to Ada_2020.
* sem_ch3.adb (Analyze_Subtype_Declaration): Propagate
Is_Independent flag to subtypes.
* libgnarl/s-taprop__linux.adb: Adapt to Ada 2020 warning.
* libgnat/a-nbnbin.adb, libgnat/a-nbnbin.ads,
libgnat/a-nbnbin__gmp.adb, libgnat/a-nbnbre.adb,
libgnat/a-nbnbre.ads, libgnat/a-stobbu.adb,
libgnat/a-stobbu.ads, libgnat/a-stobfi.adb,
libgnat/a-stobfi.ads, libgnat/a-stoubu.adb,
libgnat/a-stoubu.ads, libgnat/a-stoufi.adb,
libgnat/a-stoufi.ads, libgnat/a-stoufo.adb,
libgnat/a-stoufo.ads, libgnat/a-stouut.adb,
libgnat/a-stouut.ads, libgnat/a-strsto.ads,
libgnat/a-ststbo.adb, libgnat/a-ststbo.ads,
libgnat/a-ststun.adb, libgnat/a-ststun.ads,
libgnat/a-stteou.ads, libgnat/s-aoinar.ads,
libgnat/s-aomoar.ads, libgnat/s-atopex.ads,
libgnat/s-putaim.adb, libgnat/s-putaim.ads,
libgnat/s-putima.adb, libgnat/s-putima.ads: Remove pragma
Ada_2020, now redundant.

4 years ago[Ada] Wrong accessibility on 'Access of formal in call
Justin Squirek [Thu, 18 Jun 2020 18:15:47 +0000 (14:15 -0400)]
[Ada] Wrong accessibility on 'Access of formal in call

gcc/ada/

* exp_ch6.adb (Expand_Call_Helper): Modify addition of the extra
accessibility parameter to take into account the extra
accessibility of formals within the calling subprogram.

4 years ago[Ada] Bug in Enum_Subtype'Image in Ada 2020 mode
Bob Duff [Thu, 18 Jun 2020 13:10:33 +0000 (09:10 -0400)]
[Ada] Bug in Enum_Subtype'Image in Ada 2020 mode

gcc/ada/

* exp_imgv.adb (Expand_Image_Attribute): Add Root_Type, so
constrained subtypes work.

4 years ago[Ada] Refactor pragma argument getters
Ghjuvan Lacambre [Thu, 18 Jun 2020 08:29:35 +0000 (10:29 +0200)]
[Ada] Refactor pragma argument getters

gcc/ada/

* exp_prag.adb (Arg1, Arg2, Arg3): Removed.
(Arg_N): New function.

4 years ago[Ada] AI12-0383 Renaming values
Arnaud Charlet [Mon, 15 Jun 2020 07:51:52 +0000 (03:51 -0400)]
[Ada] AI12-0383 Renaming values

gcc/ada/

* sem_ch8.adb (Analyze_Object_Renaming): Allow values in Ada
2020 mode.

4 years ago[Ada] AI12-0377 View conversions and out parameters revisited
Arnaud Charlet [Wed, 17 Jun 2020 08:00:47 +0000 (04:00 -0400)]
[Ada] AI12-0377 View conversions and out parameters revisited

gcc/ada/

* sem_res.adb (Resolve_Actuals): Refine 6.4.1 rules as per
AI12-0377.

4 years ago[Ada] Ada2020: wording of 'Image messages
Bob Duff [Sat, 13 Jun 2020 16:38:00 +0000 (12:38 -0400)]
[Ada] Ada2020: wording of 'Image messages

gcc/ada/

* errout.ads, errout.adb (Error_Msg_Ada_2020_Feature): New
procedure analogous to Error_Msg_Ada_2012_Feature.
* sem_attr.adb (Analyze_Image_Attribute): Use
Error_Msg_Ada_2012_Feature and Error_Msg_Ada_2020_Feature to
indicate that Object'Image is allowed in Ada 2012, and that
'Image is allowed for any type in Ada 2020.

4 years ago[Ada] Unbounded string overriding control
Dmitriy Anisimkov [Thu, 21 May 2020 12:15:40 +0000 (18:15 +0600)]
[Ada] Unbounded string overriding control

gcc/ada/

* libgnat/a-strunb.adb (Sum, Mul, Saturated_Sum, Saturated_Mul):
New routines.  Use them when resulting string size more that
length of the strings in parameters.
(Unbounded_Slice): Use "- 1" instead of "+ 1" in opposite side
of condition to avoid overflow.
* libgnat/a-strunb__shared.adb (Sum, Mul): New routines.
(Allocate): New routine with 2 parameters.  Use routine above
when resulting string size more that length of the strings in
parameters.
(Aligned_Max_Length): Do not try to align to more than Natural'Last.
(Unbounded_Slice): Use "- 1" instead of "+ 1" in opposite side
of condition to avoid overflow.

4 years ago[Ada] Remove disabled code
Arnaud Charlet [Wed, 17 Jun 2020 08:41:44 +0000 (10:41 +0200)]
[Ada] Remove disabled code

gcc/ada/

* sem_attr.adb (Resolve_Attribute): Remove dead code.

4 years ago[Ada] Use membership tests in front-end
Arnaud Charlet [Sat, 13 Jun 2020 15:33:04 +0000 (11:33 -0400)]
[Ada] Use membership tests in front-end

gcc/ada/

* aspects.adb, atree.adb, atree.ads, checks.adb, contracts.adb,
einfo.adb, errout.adb, exp_aggr.adb, exp_attr.adb, exp_cg.adb,
exp_ch11.adb, exp_ch2.adb, exp_ch3.adb, exp_ch4.adb,
exp_ch5.adb, exp_ch6.adb, exp_ch7.adb, exp_ch8.adb, exp_ch9.adb,
exp_dbug.adb, exp_disp.adb, exp_intr.adb, exp_pakd.adb,
exp_prag.adb, exp_put_image.adb, exp_smem.adb, exp_tss.adb,
exp_unst.adb, exp_util.adb, freeze.adb, ghost.adb, gnat1drv.adb,
inline.adb, lib-writ.adb, lib-xref-spark_specific.adb,
lib-xref.adb, namet.adb, namet.ads, nlists.adb, par-ch10.adb,
par-ch2.adb, par-ch3.adb, par-ch4.adb, par-ch5.adb, par-ch6.adb,
par-prag.adb, par-util.adb, par_sco.adb, pprint.adb,
repinfo.adb, restrict.adb, rtsfind.adb, scil_ll.adb, sem.adb,
sem_aggr.adb, sem_attr.adb, sem_aux.adb, sem_cat.adb,
sem_ch10.adb, sem_ch11.adb, sem_ch12.adb, sem_ch13.adb,
sem_ch3.adb, sem_ch4.adb, sem_ch5.adb, sem_ch6.adb, sem_ch7.adb,
sem_ch8.adb, sem_ch9.adb, sem_dim.adb, sem_disp.adb,
sem_dist.adb, sem_elab.adb, sem_elim.adb, sem_eval.adb,
sem_intr.adb, sem_mech.adb, sem_prag.adb, sem_res.adb,
sem_scil.adb, sem_type.adb, sem_util.adb, sem_warn.adb,
sinfo.adb, sinfo.ads, sprint.adb, styleg.adb, tbuild.adb,
treepr.adb (Nkind_In, Nam_In, Ekind_In): Removed, replaced by
membership tests.

4 years ago[Ada] AI12-0194: Language-defined aspects and entry bodies
Gary Dismukes [Tue, 16 Jun 2020 20:08:34 +0000 (16:08 -0400)]
[Ada] AI12-0194: Language-defined aspects and entry bodies

gcc/ada/

* sem_prag.adb (Analyze_Pragma, Pragma_Max_Entry_Queue_Length):
Refine error message to indicate that the pragma must apply to
an entry declaration, not just an entry.

4 years ago[Ada] Spurious error in generic dispatching constructor
Javier Miranda [Tue, 16 Jun 2020 17:49:04 +0000 (13:49 -0400)]
[Ada] Spurious error in generic dispatching constructor

gcc/ada/

* exp_ch6.adb (Make_Build_In_Place_Iface_Call_In_Allocator):
Revert previous patch, and add a missing type conversion to
displace the pointer to the allocated object to reference the
target dispatch table.

4 years ago[Ada] Ada2020: AI12-0027 Access values and unaliased component
Javier Miranda [Tue, 16 Jun 2020 09:28:54 +0000 (05:28 -0400)]
[Ada] Ada2020: AI12-0027 Access values and unaliased component

gcc/ada/

* sem_res.adb (Resolve_Actuals): Restore restrictive check on
view conversions which required matching value of
Has_Aliased_Components of formals and actuals. Required to avoid
the regression of ACATS b460005.

4 years ago[Ada] Remove obsolete special case in Switch_View
Eric Botcazou [Tue, 16 Jun 2020 07:58:09 +0000 (09:58 +0200)]
[Ada] Remove obsolete special case in Switch_View

gcc/ada/

* sem_ch12.adb (Instantiate_Package_Body): Add commentary for a
nesting issue with parent handling and private view switching.
(Switch_View): Do not skip specific private-dependent subtypes.

4 years ago[Ada] x86-lynx178elf: use a-numaux.ads instead of a-numaux__libc-x86.ads
Patrick Bernardi [Tue, 16 Jun 2020 00:42:31 +0000 (20:42 -0400)]
[Ada] x86-lynx178elf: use a-numaux.ads instead of a-numaux__libc-x86.ads

gcc/ada/

* Makefile.rtl: Remove X86_TARGET_PAIRS for x86-lynx178elf.

4 years ago[Ada] Warnings on overloays involving generic In_Parameters
Ed Schonberg [Mon, 15 Jun 2020 21:40:26 +0000 (17:40 -0400)]
[Ada] Warnings on overloays involving generic In_Parameters

gcc/ada/

* sem_ch13.adb (Analyze_Address_Specification_Clause): Do not
emit a warning when a constant declaration in a generic unit
overlays a generic In_Parameter.

4 years ago[Ada] AI12-0382: Loosen type-invariant overriding requirement of AI12-0042
Gary Dismukes [Mon, 15 Jun 2020 21:14:14 +0000 (17:14 -0400)]
[Ada] AI12-0382: Loosen type-invariant overriding requirement of AI12-0042

gcc/ada/

* sem_ch3.adb (Check_Abstract_Overriding): Remove Scope
comparison test from test related to initial implementation of
AI12-0042, plus remove the related ??? comment.
(Derive_Subprogram): Add test requiring that the type extension
appear in the visible part of its enclosing package when
checking the overriding requirement of 7.3.2(6.1/4), as
clarified by AI12-0382.

4 years ago[Ada] Add range check for GNATprove on 'Pos to Long_Integer conversion
Piotr Trojanek [Fri, 12 Jun 2020 17:06:51 +0000 (19:06 +0200)]
[Ada] Add range check for GNATprove on 'Pos to Long_Integer conversion

gcc/ada/

* exp_spark.adb (Expand_SPARK_N_Attribute_Reference) Extend
existing workaround to 'Pos.

4 years ago[Ada] Ada2020: AI12-0304 Put_Image attrs of lang-def types
Bob Duff [Fri, 12 Jun 2020 22:24:52 +0000 (18:24 -0400)]
[Ada] Ada2020: AI12-0304 Put_Image attrs of lang-def types

gcc/ada/

* libgnat/s-rannum.ads, libgnat/s-rannum.adb: Add Put_Image.
This will be inherited by the language-defined packages
Ada.Numerics.Discrete_Random and Ada.Numerics.Float_Random.
* libgnat/a-convec.ads, libgnat/a-convec.adb: Add Put_Image.
* libgnat/s-putima.ads: Add pragma Preelaborate, so this can be
imported into containers packages.
* libgnat/s-putima.adb: Move Digit to private part; otherwise
reference to Base is illegal in Preelaborate generic.
* exp_put_image.adb (Build_Record_Put_Image_Procedure): Use the
base type.

4 years agoUse vec::reserve before vec_safe_grow_cleared is called
Martin Liska [Fri, 24 Jul 2020 12:33:27 +0000 (14:33 +0200)]
Use vec::reserve before vec_safe_grow_cleared is called

gcc/ChangeLog:

PR lto/45375
* symbol-summary.h: Call vec_safe_reserve before grow is called
in order to grow to a reasonable size.
* vec.h (vec_safe_reserve): Add missing function for vl_ptr
type.

4 years agofortran/openmp.c - silence static analyzer warning
Tobias Burnus [Mon, 27 Jul 2020 07:12:15 +0000 (09:12 +0200)]
fortran/openmp.c - silence static analyzer warning

gcc/fortran/ChangeLog:

* openmp.c (gfc_resolve_omp_directive): Remove NULL check
for clauses in EXEC_OMP_CRITICAL as it no longer can be NULL.

4 years agogcc.dg/tree-ssa/vector-4.c: Adjust for mmix.
Hans-Peter Nilsson [Mon, 27 Jul 2020 01:39:16 +0000 (03:39 +0200)]
gcc.dg/tree-ssa/vector-4.c: Adjust for mmix.

Again, the variables are "privatized" using ASM_PN_FORMAT for MMIX (but
apparently not for other targets) and the line to match looks like:
  D.1427 = VEC_PERM_EXPR <a::0, b::1, { 0, 4, 1, 5 }>;

gcc/testsuite:
* gcc.dg/tree-ssa/vector-4.c: Adjust for mmix.

4 years agogcc.dg/tree-ssa/ssa-dse-26.c: Adjust for mmix.
Hans-Peter Nilsson [Mon, 27 Jul 2020 01:11:46 +0000 (03:11 +0200)]
gcc.dg/tree-ssa/ssa-dse-26.c: Adjust for mmix.

The variables are "localized" using ASM_PN_FORMAT for MMIX and the
lines to match look like:
  Deleted dead store: y::4 = y;
  Deleted dead store: x::3 = x;

gcc/testsuite:
* gcc.dg/tree-ssa/ssa-dse-26.c: Adjust for mmix.

4 years agogcc.dg/tree-ssa/ssa-dom-cse-2.c: xfail scan for mmix.
Hans-Peter Nilsson [Mon, 27 Jul 2020 00:39:34 +0000 (02:39 +0200)]
gcc.dg/tree-ssa/ssa-dom-cse-2.c: xfail scan for mmix.

Looking at the dump and the test, I guess all "64-bit targets" fail
the test for the reasons seen in the comment just above the dg-final,
whose last two lines make it to the patch context.  Maybe the xfail
target list can be shortened by removing most targets and use just
"lp64".  That doesn't cover it passing on x86_64 and s390x-zarch
though.

gcc/testsuite:
* gcc.dg/tree-ssa/ssa-dom-cse-2.c: xfail scan for mmix.

4 years agoDaily bump.
GCC Administrator [Mon, 27 Jul 2020 00:16:20 +0000 (00:16 +0000)]
Daily bump.

4 years agogcc.dg/tree-ssa/reassoc-20.c: Adjust for mmix.
Hans-Peter Nilsson [Mon, 27 Jul 2020 00:07:20 +0000 (02:07 +0200)]
gcc.dg/tree-ssa/reassoc-20.c: Adjust for mmix.

The expression of interest looks like "e_5 = a::0_1 + b::1_2;" for
mmix-knuth-mmixware, while other targets have a "." instead of the
"::".  ISTM the most useful change here is not to disable the test,
but to add an optional character in the matched expression to match
the "extra" ":".  Also checked cris-elf to assert that the expression
still passes for an "ordinary" ELF target.

gcc/testsuite:
* gcc.dg/tree-ssa/reassoc-20.c: Adjust for mmix.

4 years agommix: Don't turn off .hidden support.
Hans-Peter Nilsson [Sun, 26 Jul 2020 22:08:54 +0000 (00:08 +0200)]
mmix: Don't turn off .hidden support.

In 2012 e2769e908a915ebbc/r192344, I added the following lines, that I
now delete.  I've changed my mind: ELF-related targets based on gas,
that support only static linking, have .hidden "for free", regardless
of the visibility of the hidden object in the linked executable.  No
regressions for mmix-knuth-mmixware and "fixes":

FAIL: gcc.dg/torture/pr94947-1.c   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  (test for excess errors)
Excess errors:
lto1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]

...a warning which is emitted for "all" LTO tests (of which most have
warnings filtered out); LTO "thinks" all supported targets have
.hidden support.

gcc:
* configure.ac (out-of-tree linker .hidden support): Don't turn off
for mmix-knuth-mmixware.
* configure: Regenerate.

4 years agoc++: Add testcase for [PR79504]
Patrick Palka [Sun, 26 Jul 2020 17:37:26 +0000 (13:37 -0400)]
c++: Add testcase for [PR79504]

We successfully compile this testcase ever since r8-5270.

gcc/testsuite/ChangeLog:

PR c++/79504
* g++.dg/cpp0x/decltype79.C: New test.

4 years agors6000: add option -mblock-ops-unaligned-vsx
Aaron Sawdey [Fri, 24 Jul 2020 19:13:48 +0000 (14:13 -0500)]
rs6000: add option -mblock-ops-unaligned-vsx

This option is mostly being added to provide -mno-block-ops-unaligned-vsx.
The default is set the same as -mefficient-unaligned-vsx. This option will
control the use of unaligned VSX loads/stores in the inline expansion
of memcpy() and memmove(). The use case for this would be if you're
compiling code that is doing a memcpy to memory mapped device memory
that is cache-inhibited. On some powerpc processors this requires the
unaligned vsx ops to be emulated by the kernel which is very slow.

gcc/ChangeLog:

* config/rs6000/rs6000.c (rs6000_option_override_internal):
Set the default value for -mblock-ops-unaligned-vsx.
* config/rs6000/rs6000.opt: Add -mblock-ops-unaligned-vsx.
* doc/invoke.texi: Document -mblock-ops-unaligned-vsx.

4 years agolibgfortran: Skip integer-kind=16 check for amdgcn
Tobias Burnus [Sun, 26 Jul 2020 05:20:24 +0000 (07:20 +0200)]
libgfortran: Skip integer-kind=16 check for amdgcn

libgfortran/ChangeLog:

PR target/96306
* configure.ac: Add LIBGOMP_CHECKED_INT_KINDS and
LIBGOMP_CHECKED_REAL_KINDS and use it for to skip
integer kind=16 checks for amdgcn.
* Makefile.am (kinds.h, selected_int_kind.inc,
selected_real_kind.inc): Pass them on.
* mk-kinds-h.sh: Takes to-be-check kinds as argument.
* mk-sik-inc.sh: Likewise.
* mk-srk-inc.sh: Likewise.
* Makefile.in: Regenerate.
* configure: Regenerate.

4 years agogcc.dg/tree-ssa/forwprop-36.c: Adjust for mmix
Hans-Peter Nilsson [Sun, 26 Jul 2020 01:33:15 +0000 (03:33 +0200)]
gcc.dg/tree-ssa/forwprop-36.c: Adjust for mmix

The label of interest here is "b.0_2" for
e.g. x86_64-pc-linux-gnu but "b::1_2" for mmix-knuth-mmixware.
The test seems to be of some interest for mmix (hey, gcc
open-coded 128-bit integer support behind my back!) so I didn't
want to just disable it.  I also didn't want to obscure the
matching pattern by generalizing it, so instead I added a
separate matching pattern.

gcc/testsuite:
* gcc.dg/tree-ssa/forwprop-36.c: Adjust for mmix.

4 years agogcc.dg/torture/pr59330.c: Disable for mmix
Hans-Peter Nilsson [Sun, 26 Jul 2020 00:44:02 +0000 (02:44 +0200)]
gcc.dg/torture/pr59330.c: Disable for mmix

With the dejagnu status-wrapper, there's a reference to write in
each executable, which for mmix in newlib has a reference to a
variable defined in open, which for mmix in newlib has a
reference to sprintf (oops!) and the dependency-chain goes on;
ad finitum there's a reference to malloc, which in default
newlib is colocated with free; the same file
newlib/libc/stdlib/malloc.c.

Not being compiled with -ffunction-sections, they're emitted in
the same section (.text) and thus inseparable: you can't
override just one of them as in this test, or else you'll get:

<X>/pre/mmix/bin/ld: <X>/gccobj/mmix/./newlib/libc.a(lib_a-malloc.o): in function `free':
<X>/gcc/newlib/libc/stdlib/malloc.c:169: multiple definition of `free'; /tmp/ccvRA0zb.o:(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
compiler exited with status 1
FAIL: gcc.dg/torture/pr59330.c   -O0  (test for excess errors)

I'm using a dg-skip-if here instead of starting a hardly
scalable dg-do target selector.  I'm not keying on
effective-target unwrapped because the dependency-chain is
target-specific rather than dejagnu status-wrapper-specific.

gcc/testsuite:
* gcc.dg/torture/pr59330.c: Disable for mmix.

4 years agoDaily bump.
GCC Administrator [Sun, 26 Jul 2020 00:16:21 +0000 (00:16 +0000)]
Daily bump.

4 years agoconfig/mmix/mmix.c (TARGET_ASM_OUTPUT_IDENT): Override.
Hans-Peter Nilsson [Sat, 25 Jul 2020 21:25:09 +0000 (23:25 +0200)]
config/mmix/mmix.c (TARGET_ASM_OUTPUT_IDENT): Override.

Funny that default_asm_output_ident_directive isn't the default...
Anyway, since dot-pseudos like .ident are treated as comments by
mmixal, there's nothing lost compatibilitywise by supporting it.
If mmix-knuth-mmixware had included elfos.h this'd have been the
default.  There might be enough reason to do that; relocatable objects
are ELF but (by default) links to produce mmo.  Fixes
c-c++-common/ident-1b.c and 2b in C and C++ testing.  Committed.

gcc:
* config/mmix/mmix.c (TARGET_ASM_OUTPUT_IDENT): Override the default
with default_asm_output_ident_directive.

4 years agoC++, testsuite: Adjust pure-virtual1.C options for Darwin.
Iain Sandoe [Sat, 25 Jul 2020 20:42:55 +0000 (21:42 +0100)]
C++, testsuite: Adjust pure-virtual1.C options for Darwin.

Darwin's static linker expects, by default, that all linkage will
be satisfied (even for weak items).  This allows the two-level
namespace to work even for weak cases.

However, there's an option to make it behave in a similar manner
to ELF.  This is needed for the pure-virtual1.C testcase to pass
on Darwin.

gcc/testsuite/ChangeLog:

* g++.dg/abi/pure-virtual1.C: Add dynamic_lookup option
for Darwin.

4 years agoFix PR c++/96310 - Ignoring -Wnonnull via pragma gcc diagnostics still produces an...
Martin Sebor [Sat, 25 Jul 2020 20:21:47 +0000 (14:21 -0600)]
Fix PR c++/96310 - Ignoring -Wnonnull via pragma gcc diagnostics still produces an unwanted note.

gcc/c-family/ChangeLog:
PR c++/96310
* c-common.c (check_nonnull_arg): Print note only when warning was
issued.

4 years agoamdgcn: Enable TImode
Andrew Stubbs [Sat, 25 Jul 2020 14:02:52 +0000 (15:02 +0100)]
amdgcn: Enable TImode

This enables types __int128 et al for move, add, subtract, and logical
operations.  At least shift, rotate, multiple, divide, and modulus are broken
so we can expect some test failures.

This is required now because libgomp no longer builds without __int128.

An additional patch will be required to unbreak the libgfortran build.

gcc/ChangeLog:

* config/gcn/gcn.c (gcn_scalar_mode_supported_p): New function.
(TARGET_SCALAR_MODE_SUPPORTED_P): New define.

4 years agoDaily bump.
GCC Administrator [Sat, 25 Jul 2020 00:16:22 +0000 (00:16 +0000)]
Daily bump.

4 years agoaix: Support GCC64 for AIX 7.1.
David Edelsohn [Fri, 24 Jul 2020 19:05:42 +0000 (15:05 -0400)]
aix: Support GCC64 for AIX 7.1.

gcc/ChangeLog:

2020-07-24  David Edelsohn  <dje.gcc@gmail.com>
    Clement Chigot  <clement.chigot@atos.net>

* config.gcc (powerpc-ibm-aix7.1): Use t-aix64 and biarch64 for
cpu_is_64bit.
* config/rs6000/aix71.h (ASM_SPEC): Remove aix64 option.
(ASM_SPEC32): New.
(ASM_SPEC64): New.
(ASM_CPU_SPEC): Remove vsx and altivec options.
(CPP_SPEC_COMMON): Rename from CPP_SPEC.
(CPP_SPEC32): New.
(CPP_SPEC64): New.
(CPLUSPLUS_CPP_SPEC): Rename to CPLUSPLUS_CPP_SPEC_COMMON..
(TARGET_DEFAULT): Use 64 bit mask if BIARCH.
(LIB_SPEC_COMMON): Rename from LIB_SPEC.
(LIB_SPEC32): New.
(LIB_SPEC64): New.
(LINK_SPEC_COMMON): Rename from LINK_SPEC.
(LINK_SPEC32): New.
(LINK_SPEC64): New.
(STARTFILE_SPEC): Add 64 bit version of crtcxa and crtdbase.
(ASM_SPEC): Define 32 and 64 bit alternatives using DEFAULT_ARCH64_P.
(CPP_SPEC): Same.
(CPLUSPLUS_CPP_SPEC): Same.
(LIB_SPEC): Same.
(LINK_SPEC): Same.
(SUBTARGET_EXTRA_SPECS): Add new 32/64 specs.
* config/rs6000/aix72.h (TARGET_DEFAULT): Use 64 bit mask if BIARCH.
* config/rs6000/defaultaix64.h: Delete.

4 years agors6000: Remove -mpower10 option (PR95907)
Segher Boessenkool [Fri, 24 Jul 2020 23:12:08 +0000 (23:12 +0000)]
rs6000: Remove -mpower10 option (PR95907)

The only way to enable or disable Power10 insns (ISA 3.1 insns) should
be via the -mcpu= switch.  This patch disables the -mpower10 options the
same way the -mdirect-move switch is neutered already.  That is not an
ideal way, but it works, it is not the first, and doing it properly is
more work, and will happen later.

2020-07-24  Segher Boessenkool  <segher@kernel.crashing.org>

* config/rs6000/rs6000.opt: Delete -mpower10.

gcc/testsuite/
* gcc.target/powerpc/pr95907.c: New.

4 years agoc-c++-common/pr56493.c: Allow ":" in label, for mmix.
Hans-Peter Nilsson [Fri, 24 Jul 2020 22:05:42 +0000 (00:05 +0200)]
c-c++-common/pr56493.c: Allow ":" in label, for mmix.

No dots in labels for MMIX: internal labels instead contain ":".

gcc/testsuite:

* c-c++-common/pr56493.c: Allow ":" in label, for mmix.

4 years agotestsuite: Adjust patchable_function tests for mmix.
Hans-Peter Nilsson [Fri, 24 Jul 2020 21:50:05 +0000 (23:50 +0200)]
testsuite: Adjust patchable_function tests for mmix.

There's no reason anyone would want to use the "patchable function"
feature for MMIX and also no reason to exclude those tests.  For MMIX,
the NOP equivalent is SWYM ("swymming" is a healthy exercise).
Text-wise, making the tests pass by adjusting the regexp, is shorter,
and it seems unlikely to both appear as a mnemonic for other targets
*and* being emitted in uppercase.

gcc/testsuite:

* c-c++-common/patchable_function_entry-decl.c,
c-c++-common/patchable_function_entry-default.c,
c-c++-common/patchable_function_entry-definition.c: Adjust for mmix.

4 years agoAdd testcase to show kernel issue got fixed by pr95237 [PR96192]
Sunil K Pandey [Fri, 24 Jul 2020 21:08:41 +0000 (14:08 -0700)]
Add testcase to show kernel issue got fixed by pr95237 [PR96192]

This test case, extracted from PR 95645, was failing because alignment
of local long long variable got lowered from 8 bytes to 4 bytes in
adjust alignment pass, which triggered assert failure.

This test case passes now because PR 95237 fix only allows lowering of
alignment of local variables in the front end.  As a result, alignment
of local long long variable no longer gets lowered in adjust alignment
pass.

gcc/testsuite/ChangeLog:

PR target/96192
* c-c++-common/pr96192-1.c: New test.

4 years agoadd offload target to testname for pass/fail message
Alexandre Oliva [Fri, 24 Jul 2020 18:38:42 +0000 (15:38 -0300)]
add offload target to testname for pass/fail message

Offload tests that scan dump files may run multiple times, once per
offload target, but the test result messages do not mention the
offload target, so we may seem to have repeated results.  Fixed by
modifying the test name so that it contains the offload target name.

Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
for  gcc/testsuite/ChangeLog

* lib/scanoffload.exp (scoff-testname, scoff-adjust): New.
(scoff): Call them.

4 years agorevamp intelmic-mkoffload aux dump names
Alexandre Oliva [Fri, 24 Jul 2020 18:38:40 +0000 (15:38 -0300)]
revamp intelmic-mkoffload aux dump names

Rework intelmic-mkoffload into the new aux and dump file naming
semantics.  Obey -save-temps.

Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
for  gcc/ChangeLog

* config/i386/intelmic-mkoffload.c
(generate_target_descr_file): Use dumppfx for save_temps
files.  Pass -dumpbase et al down to the compiler.
(generate_target_offloadend_file): Likewise.
(generate_host_descr_file): Likewise.
(prepare_target_image): Likewise.  Move out_obj_filename
setting...
(main): ... here.  Detect -dumpbase, set dumppfx too.

4 years ago[PR96230] some -dumpbase-ext fixes
Alexandre Oliva [Fri, 24 Jul 2020 18:38:38 +0000 (15:38 -0300)]
[PR96230] some -dumpbase-ext fixes

The initial bug report was that compiling (-c) with -dumpbase ""
-dumpbase-ext .<ext> crashes the driver.

The verification of -dumpbase-ext against -dumpbase doesn't cover the
case in which -dumpbase activates backward-compatibility mode.

I added a test for that, and for -dumpbase-ext without -dumpbase,
trying to make it work in a sensible way, as if applied to the default
-dumpbase for each file.  It turned out that this made for too much
complexity in dealing with suffixes derived from input filenames, so I
gave that up and returned to discarding -dumpbase-ext as documented,
ending up with a change identical to that in the original bug report.

I also thought I caught an off-by-one error in the initial
verification, that caused dumpbase_ext to be discarded if it was
identical to the specified dumpbase, but that turned out to be
intentional as well, so I put in comments and a test to reflect it.

Finally, an earlier version of the newly-added tests used "$var.ext"
in an expected output list, which showed me the handling of string
expansion was incorrect.  Reworked the expr into an eval to make that
work, and, absent any reliance on post-eval adjustments to so-expanded
output names, I arranged for the adjustments to be skipped after eval.

Co-Authored-By: "Zhanghaijian (A)" <z.zhanghaijian@huawei.com>
for  gcc/ChangeLog

PR driver/96230
* gcc.c (process_command): Adjust and document conditions to
reset dumpbase_ext.

for  gcc/testsuite/ChangeLog

PR driver/96230
* gcc.misc-tests/outputs.exp: Add tests with -dumpbase-ext,
with identical -dumpbase, with -dumpbase "", and without any
-dumpbase.
(outest): Fix "" expansion in expected outputs, skip
adjustments.

4 years ago[PR95720] protect gluefile and wrap_flags with -Wl too
Alexandre Oliva [Fri, 24 Jul 2020 18:38:35 +0000 (15:38 -0300)]
[PR95720] protect gluefile and wrap_flags with -Wl too

The testglue object file gets interpreted as another input file,
changing the dump and aux output names in GCC unless it is protected
by -Wl, like board file-named extra inputs.

Refactor the code that modifies the board settings so that it can be
used to modify regular variables as well, and do so.

for  gcc/testsuite/ChangeLog

PR testsuite/95720
* lib/gcc-defs.exp (gcc_adjust_linker_flags_list): Split out of...
(gcc_adjust_linker_flags): ... this.  Protect gluefile and
wrap_flags.
* gcc.misc-tests/outputs.exp: Use gcc_adjust_linker_flags_list.

4 years agoPR 93567, G edit descriptor uses E instead of F editing in rounding mode UP.
Dominique d'Humieres [Fri, 24 Jul 2020 18:27:53 +0000 (20:27 +0200)]
PR 93567, G edit descriptor uses E instead of F editing in rounding mode UP.

The switch between FMT_E and FMT_F is based on the absolute value.
Set r=0 for rounding toward zero and r = 1 otherwise.
If (exp_d - m) == 1 there is no rounding needed.

libgfortran/ChangeLog:

PR fortran/93567
* io/write_float.def (determine_en_precision): Fix switch between
FMT_E and FMT_F.

gcc/testsuite/ChangeLog:

PR fortran/93567
* gfortran.dg/round_3.f08: Add test cases.

4 years agoPR 93592 - Invalid UP/DOWN rounding with EN descriptor.
Dominique d'Humieres [Fri, 24 Jul 2020 18:07:12 +0000 (20:07 +0200)]
PR 93592 - Invalid UP/DOWN rounding with EN descriptor.

The fix is obvious (I have added a comment). The tests are probably
an overkill, but it does not hurt.

libgfortran/ChangeLog:

PR fortran/93592
* io/write_float.def (build_float_string): Do not reset
  nbefore for FMT_F and FMT_EN.

gcc/testsuite/ChangeLog:

PR fortran/93592
* gfortran.dg/fmt_en.f90: Adjust test.
* gfortran.dg/fmt_en_rd.f90: New test.
* gfortran.dg/fmt_en_rn.f90: New test.
* gfortran.dg/fmt_en_ru.f90: New test.
* gfortran.dg/fmt_en_rz.f90: New test.

4 years agoc++: Add testcase for [PR81339]
Patrick Palka [Fri, 24 Jul 2020 18:31:36 +0000 (14:31 -0400)]
c++: Add testcase for [PR81339]

We correctly reject this testcase since r11-434, i.e. since the fix for
PR c++/57943.

gcc/testsuite/ChangeLog:

PR c++/81339
* g++.dg/cpp0x/decltype78.C: New test.

4 years agoiDefine TARGET_OFFLOAD_OPTIONS for AArch64
Matthias Klose [Fri, 24 Jul 2020 14:17:44 +0000 (16:17 +0200)]
iDefine TARGET_OFFLOAD_OPTIONS for AArch64

2020-07-24  Matthias Klose  <doko@ubuntu.com>

* config/aarch64/aarch64.c (+aarch64_offload_options,
TARGET_OFFLOAD_OPTIONS): New.

4 years agoi386: Emit mfence_sse2 for -Os [PR95750]
Uros Bizjak [Fri, 24 Jul 2020 13:59:38 +0000 (15:59 +0200)]
i386: Emit mfence_sse2 for -Os [PR95750]

2020-07-24  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:
PR target/95750
* config/i386/sync.md (mmem_thread_fence): Emit mfence_sse2 for -Os.

4 years ago[testsuite] Unset 'offload_target' after use
Thomas Schwinge [Wed, 1 Jul 2020 10:33:59 +0000 (12:33 +0200)]
[testsuite] Unset 'offload_target' after use

..., so that we don't leak this into '*.exp' files running later.

This is relevant after commit efc16503ca10bc0e934e0bace5777500e4dc757a "handle
dumpbase in offloading, adjust testsuite" -- I was confused why in a
(simplified) testing sequence as follows:

  default 'libgomp.c/c.exp'
  default 'libgomp.oacc-c/c.exp'
  '-m32' 'libgomp.c/c.exp'
  '-m32' 'libgomp.oacc-c/c.exp'

..., the "'-m32' 'libgomp.c/c.exp'" variant would not execute any offloading
dump scanning.  The reason is that the "default 'libgomp.oacc-c/c.exp'" variant
ends with 'offload_target=disable' set, so that's what the "'-m32'
'libgomp.c/c.exp'" variant would then see, in particular
'gcc/testsuite/lib/scanoffload.exp:scoff'.

libgomp/
* testsuite/libgomp.oacc-c++/c++.exp: Unset 'offload_target' after
use.
* testsuite/libgomp.oacc-c/c.exp: Likewise.
* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.

4 years ago[testsuite] Fix TCL syntax error in 'scan-dump-dem-not'
Thomas Schwinge [Tue, 30 Jun 2020 05:18:19 +0000 (07:18 +0200)]
[testsuite] Fix TCL syntax error in 'scan-dump-dem-not'

    ERROR: [...]: error executing dg-final: missing close-bracket

Bug introduced in commit 2ef1bce664881cd59dac7db6c3f3b5709d858bfe (r188996),
long ago.

gcc/testsuite/
* lib/scandump.exp (scan-dump-dem-not): Fix TCL syntax error.

4 years agoaarch64: add PAC-RET protection to libitm sjlj.S
Szabolcs Nagy [Thu, 16 Jul 2020 15:39:23 +0000 (16:39 +0100)]
aarch64: add PAC-RET protection to libitm sjlj.S

_ITM_beginTransaction is a 'returns_twice' function that saves x30
on the stack as part of gtm_jmpbuf (that is passed down to
GTM_begin_transaction), but the saved x30 is also used for return.

The return path should be protected so we don't leave an
  ldp x29, x30, [sp]
  ret
gadget in the code, so x30 is signed on function entry. This
exposes the signed address in the gtm_jmpbuf too. The jmpbuf does
not need a signed address since GTM_longjmp uses
  ldp x29, x30, [x1]
  br x30
and with BTI there is a BTI j at the _ITM_beginTransaction call site
where this jump returns. Using PAC does not hurt: the gtm_jmpbuf is
internal to libitm and its layout is only used by sjlj.S so the
signed address does not escape. Saving signed x30 into gtm_jmpbuf
provides a bit of extra protection, but more importantly it allows
adding the PAC-RET support without changing the existing code much.

In theory bti and pac-ret protection can be added unconditionally
since the instructions are in the nop space, in practice they
can cause trouble if some tooling does not understand the gnu
property note (e.g. old binutils) or some unwinder or debugger
does not understand the new dwarf op code used for pac-ret (e.g
old gdb). So the code is written to only support branch-protection
according to the code generation options.

libitm/ChangeLog:

* config/aarch64/sjlj.S: Add conditional pac-ret protection.

4 years agoaarch64: add PAC GNU property note to libgcc lse.S
Szabolcs Nagy [Thu, 16 Jul 2020 15:26:10 +0000 (16:26 +0100)]
aarch64: add PAC GNU property note to libgcc lse.S

This note is not used anywhere currently but it is supposed to mark
objects if the return address is protected with PAC on the stack.
Since lse.S only has leaf functions the return address is never
saved on the stack so we can add the note.

The note is only added if pac-ret is enabled because it can cause
problems with old linkers and we don't have checks for that. This
can be changed later to be unconditional, for now it is consistent
with how gcc generates the notes.

libgcc/ChangeLog:

* config/aarch64/lse.S: Add PAC property note.

4 years agoRestrict PR middle-end/95886 x86 test to !ia32
H.J. Lu [Fri, 24 Jul 2020 02:14:06 +0000 (19:14 -0700)]
Restrict PR middle-end/95886 x86 test to !ia32

Since gcc.target/i386/memcpy-pr95886.c requires 64-bit register, restrict
it to !ia32.

PR middle-end/95886
* gcc.target/i386/memcpy-pr95886.c: Restrict test to !ia32.

4 years agoDaily bump.
GCC Administrator [Fri, 24 Jul 2020 00:16:20 +0000 (00:16 +0000)]
Daily bump.

4 years agolibgo: add AIX FAT libraries support
Clément Chigot [Thu, 16 Jul 2020 09:29:49 +0000 (11:29 +0200)]
libgo: add AIX FAT libraries support

AIX-style libraries contains both 32 and 64 bit shared objects.
This patch follows the adding of FAT libraries support in other gcc
libraries (libgcc, listdc++, etc).

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/242957

4 years agoRestrict test to LP64.
Martin Sebor [Thu, 23 Jul 2020 20:08:22 +0000 (14:08 -0600)]
Restrict test to LP64.

gcc/testsuite/ChangeLog:

PR testsuite/95886
* gcc.target/i386/memcpy-pr95886.c: Restrict test to LP64.

4 years agoopenacc: Remove unnecessary detach finalization
Julian Brown [Thu, 2 Jul 2020 21:18:20 +0000 (14:18 -0700)]
openacc: Remove unnecessary detach finalization

The call to gomp_detach_pointer in gomp_unmap_vars_internal does not
need to force finalization, and doing so may mask mismatched pointer
attachments/detachments. This patch removes the forcing.

2020-07-16  Julian Brown  <julian@codesourcery.com>
    Thomas Schwinge  <thomas@codesourcery.com>

libgomp/
* target.c (gomp_unmap_vars_internal): Remove unnecessary forcing of
finalization for detach operation.
* testsuite/libgomp.oacc-c-c++-common/structured-detach-underflow.c:
New test.

Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
4 years agoResolve regression rtl-optimization/96298. Sorry for the breakage.
Roger Sayle [Thu, 23 Jul 2020 17:48:54 +0000 (18:48 +0100)]
Resolve regression rtl-optimization/96298.  Sorry for the breakage.

2020-07-23  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
PR rtl-optimization/96298
* simplify-rtx.c (simplify_binary_operation_1) [XOR]: Xor doesn't
distribute over xor, so (a^b)^(c^b) is not the same as (a^c)^b.

4 years agocontrib/vimrc: detect more C-like files
Patrick Palka [Thu, 23 Jul 2020 14:38:58 +0000 (10:38 -0400)]
contrib/vimrc: detect more C-like files

Currently this script doesn't set the indentation style for the standard
library headers under libstdc++/ because they lack a file extension.
But they do have a modeline, so the file type is still set appropriately
by Vim.  So by inspecting &filetype, we can also detect these standard
library headers as C-like files.

contrib/ChangeLog:

* vimrc (SetStyle): Also inspect &filetype to determine whether
a file is C-like.

4 years agoOpenMP: Support 'lastprivate (conditional:' in Fortran
Tobias Burnus [Thu, 23 Jul 2020 15:36:41 +0000 (17:36 +0200)]
OpenMP: Support 'lastprivate (conditional:' in Fortran

gcc/fortran/ChangeLog:

* gfortran.h (gfc_omp_namelist): Add lastprivate_conditional.
* openmp.c (gfc_match_omp_clauses): Handle 'conditional:'
modifier of 'lastprivate'.
* trans-openmp.c (gfc_omp_clause_default_ctor): Don't assert
on OMP_CLAUSE__CONDTEMP_ and other OMP_*TEMP_.
(gfc_trans_omp_variable_list): Handle lastprivate_conditional.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/lastprivate-conditional-1.f90: New test.
* gfortran.dg/gomp/lastprivate-conditional-2.f90: New test.
* gfortran.dg/gomp/lastprivate-conditional-3.f90: New test.
* gfortran.dg/gomp/lastprivate-conditional-4.f90: New test.
* gfortran.dg/gomp/lastprivate-conditional-5.f90: New test.

4 years ago[Ada] Stub CUDA_Execute and CUDA_Global pragmas
Arnaud Charlet [Thu, 23 Jul 2020 13:54:45 +0000 (09:54 -0400)]
[Ada] Stub CUDA_Execute and CUDA_Global pragmas

This commit adds CUDA_Execute and CUDA_Global to the list of allowed
pragmas. It also implements basic validation of said pragmas.

gcc/ada/

* aspects.ads: Declare CUDA_Global as aspect.
* einfo.ads: Use Flag118 for the Is_CUDA_Kernel flag.
(Set_Is_CUDA_Kernel): New function.
(Is_CUDA_Kernel): New function.
* einfo.adb (Set_Is_CUDA_Kernel): New function.
(Is_CUDA_Kernel): New function.
* par-prag.adb (Prag): Ignore Pragma_CUDA_Execute and
Pragma_CUDA_global.
* rtsfind.ads: Define CUDA.Driver_Types.Stream_T and
CUDA.Vector_Types.Dim3 entities
* rtsfind.adb: Define CUDA_Descendant subtype.
(Get_Unit_Name): Handle CUDA_Descendant packages.
* sem_prag.ads: Mark CUDA_Global as aspect-specifying pragma.
* sem_prag.adb (Analyze_Pragma): Validate Pragma_CUDA_Execute and
Pragma_CUDA_Global.
* snames.ads-tmpl: Define Name_CUDA_Execute and Name_CUDA_Global.

4 years ago[Ada] Ada2020: AI12-0027 Access values and unaliased component
Arnaud Charlet [Thu, 23 Jul 2020 13:11:56 +0000 (09:11 -0400)]
[Ada] Ada2020: AI12-0027 Access values and unaliased component

Access values should never designate unaliased components.
This new feature is documented in AI12-0027-1.

gcc/ada/

* sem_ch13.ads (Same_Representation): Renamed as
Has_Compatible_Representation because now the order of the arguments
are taken into account; its formals are also renamed as Target_Type
and Operand_Type.
* sem_ch13.adb (Same_Representation): Renamed and moved to place the
routine in alphabetic order.
* sem_attr.adb (Prefix_With_Safe_Accessibility_Level): New subprogram.
(Resolve_Attribute): Check that the prefix of attribute Access
does not have a value conversion of an array type.
* sem_res.adb (Resolve_Actuals): Remove restrictive check on view
conversions which required matching value of Has_Aliased_Components of
formals and actuals.
* exp_ch4.adb (Handle_Changed_Representation): Update call to
Same_Representation.
(Expand_N_Type_Conversion): Update call to Same_Representation.
* exp_ch5.adb (Change_Of_Representation): Update call to
Same_Representation.
* exp_ch6.adb (Add_Call_By_Copy_Code): Update call to
Same_Representation.
(Expand_Actuals): Update call to Same_Representation.
(Expand_Call_Helper): Update call to Same_Representation.

4 years agogcov-tool: Fix merging of different endian coverage data [PR96267]
Dong JianQiang [Tue, 21 Jul 2020 17:24:52 +0000 (01:24 +0800)]
gcov-tool: Fix merging of different endian coverage data [PR96267]

2020-07-21  Dong JianQiang  <dongjianqiang2@huawei.com>

gcc/ChangeLog:

PR gcov-profile/96267
* gcov-io.c (gcov_open): enable if IN_GCOV_TOOL.

4 years agolibomp: Add omp_depend_kind to omp_lib.{f90,h}
Tobias Burnus [Thu, 23 Jul 2020 13:02:15 +0000 (15:02 +0200)]
libomp: Add omp_depend_kind to omp_lib.{f90,h}

gcc/fortran/ChangeLog:

* intrinsic.texi (OMP_LIB_KINDS): Add omp_depend_kind.

libgomp/ChangeLog:

* configure.ac: Add OMP_DEPEND_KIND and OMP_INT128_SIZE.
* libgomp_f.h.in (omp_check_defines): Check whether
sizeof of determined Fortran kind and C typedef match.
* omp_lib.f90.in: Add omp_depened_kind.
* omp_lib.h.in: Likewise; fix omp_alloctrait_key_kind.
* configure: Regenerate.
* Makefile.in: Regenerate.
* testsuite/Makefile.in: Regenerate.

4 years ago[Ada] Add push/pop capability in Output
Arnaud Charlet [Thu, 23 Jul 2020 12:57:22 +0000 (08:57 -0400)]
[Ada] Add push/pop capability in Output

Add the capability to use the Write_* procedures in an environment where
you want to write debugging info but still use them to write to other
files (such a C source files).

gcc/ada/

* output.ads (Push_Output, Pop_Output): New procedures.
* output.adb (FD_Array, FD_Stack, FD_Stack_Idx): New type and vars.
(Push_Output, Pop_Output): New procedures.

4 years agors6000: Rename function adjust_vectorization_cost
Kewen Lin [Thu, 23 Jul 2020 10:01:36 +0000 (05:01 -0500)]
rs6000: Rename function adjust_vectorization_cost

This patch is to rename the existing function adjust_vectorization_cost
to rs6000_adjust_vect_cost_per_stmt, to avoid some confusion.

gcc/ChangeLog:

* config/rs6000/rs6000.c (adjust_vectorization_cost): Renamed to ...
(rs6000_adjust_vect_cost_per_stmt): ... here.
(rs6000_add_stmt_cost): Rename adjust_vectorization_cost to
rs6000_adjust_vect_cost_per_stmt.

4 years agoivopts: Handle vector with length IFNs
Kewen Lin [Thu, 23 Jul 2020 09:27:50 +0000 (04:27 -0500)]
ivopts: Handle vector with length IFNs

This patch is to handle vector with length internal functions
IFN_LEN_LOAD and IFN_LEN_STORE in IVOPTS.

gcc/ChangeLog:

* tree-ssa-loop-ivopts.c (get_mem_type_for_internal_fn): Handle
IFN_LEN_LOAD and IFN_LEN_STORE.
(get_alias_ptr_type_for_ptr_address): Likewise.

4 years agoOpenMP: Update gcc/fortran/*.texi
Tobias Burnus [Thu, 23 Jul 2020 10:55:53 +0000 (12:55 +0200)]
OpenMP: Update gcc/fortran/*.texi

gcc/fortran/ChangeLog:

* gfortran.texi (Standards): Update URL; state that OpenMP 4.5
is supported and 5.0 is partially.
* intrinsic.texi (OpenMP Modules): Refer also to OpenMP 5.0;
(OMP_LIB): Add missing derived type and new named constants.

4 years agogcov: create folders with 0777.
Martin Liska [Fri, 10 Jul 2020 08:56:34 +0000 (10:56 +0200)]
gcov: create folders with 0777.

libgcc/ChangeLog:

PR gcov-profile/96035
* libgcov-driver-system.c: Create gcov folders with 0777
so that it respects a system umask.

4 years agogcc-changelog: fix when somebody reverts a backport
Martin Liska [Thu, 23 Jul 2020 08:39:00 +0000 (10:39 +0200)]
gcc-changelog: fix when somebody reverts a backport

contrib/ChangeLog:

* gcc-changelog/git_commit.py: When reverting a backport,
we should print only Revert header.

4 years agoPR target/96260 - KASAN should work even back-end not porting anything.
Kito Cheng [Wed, 22 Jul 2020 06:50:40 +0000 (14:50 +0800)]
PR target/96260 - KASAN should work even back-end not porting anything.

 - Most KASAN function don't need any porting anything in back-end
   except asan stack protection.

 - However kernel will given shadow offset when enable asan stack
   protection, so eveything in KASAN can work if shadow offset is given.

 - Verified with x86 and risc-v.

 - Verified with RISC-V linux kernel.

gcc/ChangeLog:

PR target/96260
* asan.c (asan_shadow_offset_set_p): New.
* asan.h (asan_shadow_offset_set_p): Ditto.
* toplev.c (process_options): Allow -fsanitize=kernel-address
even TARGET_ASAN_SHADOW_OFFSET not implemented, only check when
asan stack protection is enabled.

gcc/testsuite/ChangeLog:

PR target/96260
* gcc.target/riscv/pr91441.c: Update warning message.
* gcc.target/riscv/pr96260.c: New.

4 years agoc-c++-common/builtin-has-attribute-4.c: Require visibility.
Hans-Peter Nilsson [Thu, 23 Jul 2020 02:27:25 +0000 (04:27 +0200)]
c-c++-common/builtin-has-attribute-4.c: Require visibility.

Another missed attribute-visibility-requirement, causing a failure for
e.g. mmix-knuth-mmixware.  Committed as obvious.

gcc/testsuite:
* c-c++-common/builtin-has-attribute-4.c: Require visibility.

4 years agoDaily bump.
GCC Administrator [Thu, 23 Jul 2020 00:16:28 +0000 (00:16 +0000)]
Daily bump.

4 years agolibstdc++: Add static assertions to futures and promises [LWG 3458]
Jonathan Wakely [Wed, 22 Jul 2020 19:10:38 +0000 (20:10 +0100)]
libstdc++: Add static assertions to futures and promises [LWG 3458]

LWG recently decided it should be ill-formed to instantiate std::future
and std::shared_future for types that can't be returned from a function.
This adds static assertions to enforce it (std::future already failed,
but this makes the error more understandable).

LWG 3466 extends that to std::promise. The actual constraint is that
t.~T() is well-formed for the primary template, but rejecting arrays and
functions as done for futures matches that condition.

libstdc++-v3/ChangeLog:

* include/std/future (future, shared_future, promise): Add
static assertions to the primary template to reject array and
function types.
* testsuite/30_threads/future/requirements/lwg3458.cc: New test.
* testsuite/30_threads/promise/requirements/lwg3466.cc: New test.
* testsuite/30_threads/shared_future/requirements/lwg3458.cc: New test.

4 years agoOpenMP: Support 'if (simd:/cancel:' in Fortran
Tobias Burnus [Wed, 22 Jul 2020 19:02:01 +0000 (21:02 +0200)]
OpenMP: Support 'if (simd:/cancel:' in Fortran

gcc/fortran/ChangeLog:

* gfortran.h (enum gfc_omp_if_kind): Add OMP_IF_CANCEL and OMP_IF_SIMD.
* openmp.c (OMP_SIMD_CLAUSES): Add OMP_CLAUSE_IF.
(gfc_match_omp_clauses, resolve_omp_clauses): Handle 'if (simd/cancel:'.
* dump-parse-tree.c (show_omp_clauses): Likewise.
* trans-openmp.c (gfc_trans_omp_clauses, gfc_trans_omp_cancel,
(gfc_split_omp_clauses): Likewise.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/cancel-2.f90: New test.
* gfortran.dg/gomp/cancel-3.f90: New test.
* gfortran.dg/gomp/if-1.f90: New test.

4 years agors6000: __builtin_mma_disassemble_acc() doesn't store elements correctly in LE mode
Peter Bergner [Wed, 22 Jul 2020 16:44:35 +0000 (11:44 -0500)]
rs6000: __builtin_mma_disassemble_acc() doesn't store elements correctly in LE mode

PR96236 shows a problem where we don't correctly store our 512-bit accumulators
correctly in little-endian mode.  The patch below detects when we're doing a
little-endian memory access and stores to the correct memory locations.

2020-07-22  Peter Bergner  <bergner@linux.ibm.com>

gcc/
PR target/96236
* config/rs6000/rs6000-call.c (rs6000_gimple_fold_mma_builtin): Handle
little-endian memory ordering.

gcc/testsuite/
PR target/96236
* gcc.target/powerpc/mma-double-test.c: Update storing results for
correct little-endian ordering.
* gcc.target/powerpc/mma-single-test.c: Likewise.

4 years agoc++: Don't add enums to class's decl_list
Nathan Sidwell [Wed, 22 Jul 2020 15:38:58 +0000 (08:38 -0700)]
c++: Don't add enums to class's decl_list

We don't need to add CONST_DECLs to a template decl's decl list.  Also made the
code flow a bit clearer.

gcc/cp/
* class.c (maybe_add_class_template_decl_list): Don't add CONST_DECLs.

4 years agodump: filenames containing -
Nathan Sidwell [Wed, 22 Jul 2020 15:34:22 +0000 (08:34 -0700)]
dump: filenames containing -

I discovered the dump machinery would get confused by filenames containing '-'.
Fixed thusly.

gcc/
* dumpfile.c (parse_dump_option): Deal with filenames
containing '-'

4 years agoc++: structural_comptypes addition
Nathan Sidwell [Wed, 22 Jul 2020 15:27:30 +0000 (08:27 -0700)]
c++: structural_comptypes addition

I had to debug structural_comptypes, and its complex if conditions and
tail calling of same_type_p made that hard.  I'd hope we can turn the
eqivalent of return boolean_fn () ? true : false; into a tail call of
the boolean.  We also were not dealing with TYPEOF_TYPE.

gcc/cp/
* typeck.c (structural_comptypes): [DECLTYPE_TYPE] break
apart complex if.
[UNDERLYING_TYPE]: Use an if.
[TYPEOF_TYPE]: New.

4 years agoc++: More cleanups for modern C++
Nathan Sidwell [Wed, 22 Jul 2020 15:20:31 +0000 (08:20 -0700)]
c++: More cleanups for modern C++

Here are some more places where we can declare variables at the
assignment point, rather than use C89.  Also, let's name our variables
by what they contain -- the register allocator is perfectly able to
track liveness for us.

gcc/cp/
* decl.c (decls_match): Move variables into scopes
they're needed in.
(duplicate_decls): Use STRIP_TEMPLATE.
(build_typename_type): Move var decls to their assignments.
(begin_function_body): Likewise.
* decl2.c (get_guard): Likewise.
(mark_used): Use true for truthiness.
* error.c (dump_aggr_type): Hold the decl in a var called
'decl', not 'name'.