Commit Graph

177785 Commits

Author SHA1 Message Date
Piotr Trojanek
a9fb2055f3 [Ada] Fix failed assertion on a slice indexed by a subtype_indication
2020-06-18  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

	* checks.adb (Generate_Index_Checks): Handle
	N_Subtype_Indication returned from Scalar_Range.
2020-06-18 05:08:22 -04:00
Piotr Trojanek
c94bbfbe57 [Ada] Cleanups in code related to static expressions
2020-06-18  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

	* checks.adb, sem_ch3.adb: Minor refactorings.
	* sem_eval.adb (Eval_Qualified_Expression): Fix reference to RM
	rule in comment; only set a local variable Hex in the branch
	where it is used.
2020-06-18 05:08:22 -04:00
Piotr Trojanek
0f7b6a2eb3 [Ada] Avoid forced loading of System.Priority in CodePeer mode
2020-06-18  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

	* sem_eval.adb (Check_Non_Static_Context): Use Is_RTE.
2020-06-18 05:08:20 -04:00
Arnaud Charlet
606e70fd3d [Ada] ACATS 4.1L - B452002 - Wrong universal access "=" rules
2020-06-18  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

	* sem_ch4.adb (Find_Equality_Types.Check_Access_Object_Types):
	New function, used to implement RM 4.5.2 (9.6/2).
	(Find_Equality_Types.Check_Compatible_Profiles): New function,
	used to implement RM 4.5.2(9.7/2).
	(Find_Equality_Types.Reference_Anonymous_Access_Type): New
	function.
	(Find_Equality_Types.Try_One_Interp): Fix handling of anonymous
	access types which was accepting both too much and too little.
	Remove accumulated special and incomplete cases for
	instantiations, replaced by Has_Compatible_Type.
	(Analyze_Overloaded_Selected_Component): Use
	Is_Anonymous_Access_Type instead of Ekind_In.
	* sem_res.adb: Code cleanup and bug fix: use
	Is_Anonymous_Access_Type instead of Ekind_In.  Relax checking of
	anonymous access parameter when universal_access "=" is
	involved.
	* sem_type.adb: Likewise.
	(Find_Unique_Type): Move code from here...
	(Specific_Type): ...to here. Also add missing handling of access
	to class wide types.
	* einfo.ads, einfo.adb (Is_Access_Object_Type): New.
2020-06-18 05:08:20 -04:00
Bob Duff
41e52aa585 [Ada] AI12-0293-1 Implement storage streams
2020-06-18  Bob Duff  <duff@adacore.com>

gcc/ada/

	* libgnat/a-strsto.ads, libgnat/a-ststbo.adb,
	libgnat/a-ststbo.ads, libgnat/a-ststun.adb,
	libgnat/a-ststun.ads: New files, containing packages
	Ada.Streams.Storage, Ada.Streams.Storage.Bounded, and
	Ada.Streams.Storage.Unbounded.
	* impunit.adb, Makefile.rtl: Add new file names.
2020-06-18 05:08:19 -04:00
Javier Miranda
02bf80a34e [Ada] Missing error on aspects Input and Output
2020-06-18  Javier Miranda  <miranda@adacore.com>

gcc/ada/

	* sem_ch13.adb (Has_Good_Profile): Enforce strictness in the
	check. Required to detect wrong profiles for Input and Output.
	(Analyze_Stream_TSS_Definition): Minor enhancement in the text
	of the error for class-wide attributes.
2020-06-18 05:08:18 -04:00
Eric Botcazou
25a11453ca [Ada] Small adjustment to Get_Integer_Type function
2020-06-18  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* exp_attr.adb (Get_Integer_Type): Pick an unsigned type based
	on the Esize of the base type of the input type.
2020-06-18 05:08:17 -04:00
Eric Botcazou
2e64cf0552 [Ada] Fix invalid expression sharing in Expand_Array_Equality
2020-06-18  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* exp_ch4.adb (Expand_Array_Equality): For the optimization of
	the 2-element case, build new expression lists for the indices.
2020-06-18 05:08:16 -04:00
Richard Kenner
e49f6ee11d [Ada] Properly test for Protected_Body_Subprogram
2020-06-18  Richard Kenner  <kenner@adacore.com>

gcc/ada/

	* sem_util.adb (Enclosing_Subprogram): No longer need
	Convention_Protected.
2020-06-18 05:08:15 -04:00
Claire Dross
3e395e356e [Ada] The definition of constants in declare expressions is an interfering context
2020-06-18  Claire Dross  <dross@adacore.com>

gcc/ada/

	* sem_util.adb (Is_OK_Volatile_Context): Return False on
	definitions of constants declared in declare expressions.
2020-06-18 05:08:15 -04:00
Piotr Trojanek
6ba3247dc7 [Ada] List aspect Relaxed_Initialization in GNAT RM
2020-06-18  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

	* doc/gnat_rm/implementation_defined_aspects.rst
	(Relaxed_Initialization): New implementation-defined aspect.
	* doc/gnat_rm/implementation_defined_attributes.rst
	(Initialized): New implementation-defined attribute.
	* gnat_rm.texi: Regenerate.
2020-06-18 05:08:14 -04:00
Javier Miranda
01264f72d9 [Ada] Crash in tagged type constructor with task components
2020-06-18  Javier Miranda  <miranda@adacore.com>

gcc/ada/

	* exp_disp.adb (Expand_Dispatching_Call): Add missing decoration
	of attribute Extra_Accessibility_Of_Result.
	* freeze.adb (Check_Extra_Formals): No check required if
	expansion is disabled; Adding check on
	Extra_Accessibilty_Of_Result.
	(Freeze_Subprogram): Fix decoration of
	Extra_Accessibility_Of_Result.
	* sem_ch3.adb (Derive_Subprogram): Fix decoration of
	Extra_Accessibility_Of_Result
2020-06-18 05:08:13 -04:00
Eric Botcazou
52531a6203 [Ada] Small improvement to Optimize_Length_Comparison
2020-06-18  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* exp_ch4.adb (Optimize_Length_Comparison): Accept 32-bit values
	in the full unsigned range.
2020-06-18 05:08:12 -04:00
Martin Liska
d11c9841d5
Add missing check for gassign.
gcc/ChangeLog:

	* tree-vect-generic.c (expand_vector_condition): Check
	for gassign before inspecting RHS.
2020-06-18 10:09:40 +02:00
Martin Liska
09f9c1eefb
gcc-changelog: fix Backported from timestamp.
contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Fix Backported from timestamp when
	use_commit_ts=True is used.
2020-06-18 10:07:59 +02:00
GCC Administrator
aff95ee7cc Daily bump. 2020-06-18 00:16:37 +00:00
Thomas Schwinge
4f2ab6b89e [OpenMP, gimplifier] 'inform' after 'error' diagnostic
This is not a thorough review of the code, just a few cases I noticed while
scanning 'gcc/gimplify.c' for "enclosing".

	gcc/
	* gimplify.c (omp_notice_threadprivate_variable)
	(omp_default_clause, omp_notice_variable): 'inform' after 'error'
	diagnostic.  Adjust all users.
	gcc/testsuite/
	* c-c++-common/gomp/default-1.c: Update.
	* c-c++-common/gomp/defaultmap-3.c: Likewise.
	* c-c++-common/gomp/order-4.c: Likewise.
	* g++.dg/gomp/parallel-2.C: Likewise.
	* g++.dg/gomp/predetermined-1.C: Likewise.
	* g++.dg/gomp/sharing-1.C: Likewise.
	* gcc.dg/gomp/appendix-a/a.24.1.c: Likewise.
	* gcc.dg/gomp/parallel-2.c: Likewise.
	* gcc.dg/gomp/pr44085.c: Likewise.
	* gcc.dg/gomp/sharing-1.c: Likewise.
	* gcc.dg/gomp/vla-1.c: Likewise.
	* gfortran.dg/gomp/appendix-a/a.24.1.f90: Likewise.
	* gfortran.dg/gomp/crayptr3.f90: Likewise.
	* gfortran.dg/gomp/pr33439.f90: Likewise.
	* gfortran.dg/gomp/pr44036-1.f90: Likewise.
	* gfortran.dg/gomp/pr44085.f90: Likewise.
	* gfortran.dg/gomp/pr44536.f90: Likewise.
	* gfortran.dg/gomp/pr94672.f90: Likewise.
	* gfortran.dg/gomp/sharing-1.f90: Likewise.
	* gfortran.dg/gomp/sharing-2.f90: Likewise.
	* gfortran.dg/gomp/sharing-3.f90: Likewise.
2020-06-18 00:15:24 +02:00
Thomas Schwinge
5864930754 Add 'dg-do run' to 'libgomp.fortran/use_device_ptr-optional-3.f90' [PR94848]
Fix-up for r279858/commit f760c0c77f "Fortran]
OpenMP/OpenACC – fix more issues with OPTIONAL".

With offloading enabled, we then saw:

    PASS: libgomp.fortran/use_device_ptr-optional-3.f90   -O0  (test for excess errors)
    PASS: libgomp.fortran/use_device_ptr-optional-3.f90   -O0  execution test
    PASS: libgomp.fortran/use_device_ptr-optional-3.f90   -O1  (test for excess errors)
    PASS: libgomp.fortran/use_device_ptr-optional-3.f90   -O1  execution test
    FAIL: libgomp.fortran/use_device_ptr-optional-3.f90   -O2  (test for excess errors)
    UNRESOLVED: libgomp.fortran/use_device_ptr-optional-3.f90   -O2  compilation failed to produce executable
    FAIL: libgomp.fortran/use_device_ptr-optional-3.f90   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  (test for excess errors)
    UNRESOLVED: libgomp.fortran/use_device_ptr-optional-3.f90   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  compilation failed to produce executable
    FAIL: libgomp.fortran/use_device_ptr-optional-3.f90   -O3 -g  (test for excess errors)
    UNRESOLVED: libgomp.fortran/use_device_ptr-optional-3.f90   -O3 -g  compilation failed to produce executable
    FAIL: libgomp.fortran/use_device_ptr-optional-3.f90   -Os  (test for excess errors)
    UNRESOLVED: libgomp.fortran/use_device_ptr-optional-3.f90   -Os  compilation failed to produce executable

 ... due to:

    /tmp/cciVc43I.o:(.gnu.offload_vars+0x10): undefined reference to `A.12.4064'
    [...]

..., but after the recent PR94848, PR95551 changes, that problem is now gone.

	libgomp/
	PR lto/94848
	* testsuite/libgomp.fortran/use_device_ptr-optional-3.f90: Add
	'dg-do run'.
2020-06-18 00:14:46 +02:00
Samuel Thibault
5e2eebc80d hurd: libgcc unwinding support over signal trampolines
libgcc/
	* config.host (md_unwind_header) <i[34567]86-*-gnu*>: Set to
	'i386/gnu-unwind.h'
	* config/i386/gnu-unwind.h: New file.

Signed-off-by: Thomas Schwinge <thomas@codesourcery.com>
2020-06-18 00:01:27 +02:00
Jonathan Wakely
632183ddcc libstdc++: Avoid stack overflow in std::vector (PR 94540)
The std::__uninitialized_default_n algorithm used by std::vector creates
an initial object as a local variable then copies that into the
destination range. If the object is too large for the stack this
crashes. We should create the first object directly into the
destination and then copy it from there.

This doesn't fix the bug for C++98, because in that case the initial
value is created as a default argument of the vector constructor i.e. in
the user's code, not inside libstdc++. We can't prevent that.

	PR libstdc++/94540
	* include/bits/stl_uninitialized.h (__uninitialized_default_1<true>):
	Construct the first value at *__first instead of on the stack.
	(__uninitialized_default_n_1<true>): Likewise.
	Improve comments on several of the non-standard algorithms.
	* testsuite/20_util/specialized_algorithms/uninitialized_default/94540.cc:
	New test.
	* testsuite/20_util/specialized_algorithms/uninitialized_default_n/94540.cc:
	New test.
	* testsuite/20_util/specialized_algorithms/uninitialized_value_construct/94540.cc:
	New test.
	* testsuite/20_util/specialized_algorithms/uninitialized_value_construct_n/94540.cc:
	New test.
	* testsuite/23_containers/vector/cons/94540.cc: New test.
2020-06-17 22:49:06 +01:00
Thomas Schwinge
973bce0fb5 [HSA] Avoid ICE when "HSA does not implement indirect calls"
Made apparent by recent commit dc703151d4
"openmp: Implement discovery of implicit declare target to clauses":

    +FAIL: libgomp.c/target-39.c (internal compiler error)
    +FAIL: libgomp.c/target-39.c (test for excess errors)
    +UNRESOLVED: libgomp.c/target-39.c compilation failed to produce executable

This is in a '--enable-offload-targets=[...],hsa' build, with '-foffload=hsa'
enabled (by default).

    during GIMPLE pass: hsagen
    source-gcc/libgomp/testsuite/libgomp.c/target-39.c: In function ‘main._omp_fn.0.hsa.0’:
    source-gcc/libgomp/testsuite/libgomp.c/target-39.c:23:11: internal compiler error: Segmentation fault
       23 |   #pragma omp target map(from:err)
          |           ^~~
    [...]

GDB:

    Program received signal SIGSEGV, Segmentation fault.
    fndecl_built_in_p (node=0x0, name=BUILT_IN_PREFETCH) at [...]/source-gcc/gcc/tree.h:6267
    6267      return (fndecl_built_in_p (node, BUILT_IN_NORMAL)
    (gdb) bt
    #0  fndecl_built_in_p (node=0x0, name=BUILT_IN_PREFETCH) at [...]/source-gcc/gcc/tree.h:6267
    #1  0x0000000000b19739 in gen_hsa_insns_for_call (stmt=stmt@entry=0x7ffff693b200, hbb=hbb@entry=0x2b152c0) at [...]/source-gcc/gcc/hsa-gen.c:5304
    #2  0x0000000000b1aca7 in gen_hsa_insns_for_gimple_stmt (stmt=0x7ffff693b200, hbb=hbb@entry=0x2b152c0) at [...]/source-gcc/gcc/hsa-gen.c:5770
    #3  0x0000000000b1bd21 in gen_body_from_gimple () at [...]/source-gcc/gcc/hsa-gen.c:5999
    #4  0x0000000000b1dbd2 in generate_hsa (kernel=<optimized out>) at [...]/source-gcc/gcc/hsa-gen.c:6596
    #5  0x0000000000b1de66 in (anonymous namespace)::pass_gen_hsail::execute (this=0x2a2aac0) at [...]/source-gcc/gcc/hsa-gen.c:6680
    #6  0x0000000000d06f90 in execute_one_pass (pass=pass@entry=0x2a2aac0) at [...]/source-gcc/gcc/passes.c:2502
    [...]
    (gdb) up
    #1  0x0000000000b19739 in gen_hsa_insns_for_call (stmt=stmt@entry=0x7ffff693b200, hbb=hbb@entry=0x2b152c0) at /home/thomas/tmp/source/gcc/build/track-slim-omp/source-gcc/gcc/hsa-gen.c:5304
    5304          if (fndecl_built_in_p (function_decl, BUILT_IN_PREFETCH))
    (gdb) print function_decl
    $1 = (tree) 0x0
    (gdb) list
    5299      if (!gimple_call_builtin_p (stmt, BUILT_IN_NORMAL))
    5300        {
    5301          tree function_decl = gimple_call_fndecl (stmt);
    5302          /* Prefetch pass can create type-mismatching prefetch builtin calls which
    5303             fail the gimple_call_builtin_p test above.  Handle them here.  */
    5304          if (fndecl_built_in_p (function_decl, BUILT_IN_PREFETCH))
    5305            return;
    5306
    5307          if (function_decl == NULL_TREE)
    5308            {

The problem is present already since 2016-11-23 commit
56b1c60e41 (r242761) "Merge from HSA branch to
trunk", and the fix obvious enough.

	gcc/
	* hsa-gen.c (gen_hsa_insns_for_call): Move 'function_decl ==
	NULL_TREE' check earlier.
	gcc/testsuite/
	* c-c++-common/gomp/hsa-indirect-call-1.c: New file.
2020-06-17 23:46:15 +02:00
Forrest Timour
a4df94a033 Fix typo in attribute access example.
Fix typo in documentation example of access function attribute where the ref-indices should be one-indexed instead of zero-indexed.

gcc/ChangeLog:
	* doc/extend.texi (attribute access): Fix a typo.
2020-06-17 14:34:52 -06:00
Jonathan Wakely
94b94c0bb1 libstdc++: Fix tests for uninitialized_value_construct_n
In my recent r11-1460 commit the tests had been "improved" before
commit, and no longer exercised the code paths changed by the patch.

This restores what I originally tested, so that the tests fail before
the r11-1460 change and pass after it.

	* testsuite/20_util/specialized_algorithms/uninitialized_default_n/sizes.cc:
	Replace Value type with int so trivial code path is used.
	* testsuite/20_util/specialized_algorithms/uninitialized_value_construct_n/sizes.cc:
	Likewise.
2020-06-17 21:23:35 +01:00
Jonathan Wakely
c9dce3b15e libstdc++: Handle non-integral sizes in std::uninitialized_fill_n
The std::uninitialized_fill_n algorithm uses sd::fill_n for trivial
types, but that algorithm has a stronger requirement that the Size
parameter is convertible to an integral type. As the new test shows,
there are types which are valid for std::uninitialized_fill_n but which
produce a different result when converted to an integral type, or cannot
be converted at all. Only use the std::fill_n optimization when the Size
type is already an integral type.

The std::__uninitialized_default_n extension has the same problem, and
so does C++17's std::uninitialized_value_construct_n which uses it.

	* include/bits/stl_uninitialized.h (uninitialized_fill_n): Only
	use std::fill_n when the size is an integral type.
	(__uninitialized_default_n): Likewise.
	* testsuite/20_util/specialized_algorithms/uninitialized_default_n/sizes.cc:
	New test.
	* testsuite/20_util/specialized_algorithms/uninitialized_fill_n/sizes.cc:
	New test.
	* testsuite/20_util/specialized_algorithms/uninitialized_value_construct_n/sizes.cc:
	New test.
2020-06-17 20:55:06 +01:00
Jonathan Wakely
d392babbeb c++: Fix bogus "does not declare anything" warning (PR 66159)
G++ gives a bogus warning for 'struct A; using B = struct ::A;'
complaining that the elaborated-type-specifier doesn't declare anything.
That's true, but it's not trying to declare struct ::A, just refer to it
unambiguously. Do not emit the warning unless we're actually parsing a
declaration.

gcc/cp/ChangeLog:

	PR c++/66159
	* parser.c (cp_parser_elaborated_type_specifier): Do not warn
	unless in a declaration.

gcc/testsuite/ChangeLog:

	PR c++/66159
	* g++.dg/warn/forward-inner.C: Check alias-declaration using
	elaborated-type-specifier.
2020-06-17 20:26:13 +01:00
Kaipeng Zhou
4a31a8add5 vect: CSE for bump and offset in strided load/store operations.
Every time "vect_get_strided_load_store_ops" is called, new bump and offset
variables and a series of stmts are created.  And IVOPTs is not able to
eliminate them.  The patch use "cse_and_gimplify_to_preheader" to CSE them.

2020-06-17  Bin Cheng  <bin.cheng@linux.alibaba.com>
	    Kaipeng Zhou  <zhoukaipeng3@huawei.com>

	PR tree-optimization/95199
	* tree-vect-stmts.c: Eliminate common stmts for bump and offset in
	strided load/store operations and remove redundant code.

2020-06-17  Bin Cheng  <bin.cheng@linux.alibaba.com>
	    Kaipeng Zhou  <zhoukaipeng3@huawei.com>

	PR tree-optimization/95199
	* gcc.target/aarch64/sve/pr95199.c: New test.
2020-06-17 20:19:16 +01:00
Jason Merrill
44492e248c c++: implicit operator== adjustments from P2002.
P2002R1, adopted at the February C++ meeting, made several refinements to
the wording for operator<=>.  This implements clarifications in how the
implicit operator== is declared: as a duplicate of the operator<=>, with
only the return type and name changed.  To that end I factored out the
declaration copying from build_clone.

gcc/cp/ChangeLog:

	* cp-tree.h (copy_fndecl_with_name): Declare.
	* class.c (copy_fndecl_with_name): Split out from...
	(build_clone): ...here.
	(add_implicitly_declared_members): Add op== to TYPE_FIELDS.
	* method.c (implicitly_declare_fn): Use copy_fndecl_with_name.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/spaceship-synth9.C: New test.
2020-06-17 15:08:42 -04:00
Jason Merrill
68df8e8c34 c++: Add test for C++20 NB comment CA107.
We already implemented this, but it's good to have a test.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/concepts-ca107.C: New test.
2020-06-17 15:08:42 -04:00
Jason Merrill
14c831f5ef c++: Fix consteval operator handling.
We were crashing trying to find the CALL_EXPR in the result of a call to a
consteval operator.

gcc/cp/ChangeLog:

	* call.c (build_new_op_1): Don't look for a CALL_EXPR when
	calling a consteval function.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/consteval17.C: New test.
2020-06-17 15:08:42 -04:00
Jason Merrill
da2c9054f1 c++: Treat in-class default/delete as definitions.
We were complaining about a constrained defaulted non-template friend in a
template class because funcdef_flag wasn't set.  grokdeclarator would set it
for default/delete, but grokfield wasn't passing the 'initialized' values
needed.  Fixing that revealed some errors in existing tests that we weren't
diagnosing.  Since we accepted them for so long, I'm reducing the error to a
pedwarn to ease compiler upgrade.

gcc/cp/ChangeLog:

	* decl2.c (grokfield): Pass SD_DEFAULTED and SD_DELETED.
	* decl.c (duplicate_decls): Reduce error for delete
	after earlier declaration to pedwarn.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/pr62101.C: Expect error.
	* g++.dg/cpp0x/pr80259.C: Expect error.
	* g++.dg/cpp2a/concepts-friend8.C: New test.
2020-06-17 15:08:42 -04:00
Jonathan Wakely
d2384b7b24 c-family: check qualifiers of arguments to __atomic built-ins (PR 95378)
Currently the __atomic_{load,store,exchange,compare_exchange} built-ins
will happily store values through pointers to const, or use pointers to
volatile as the input and output arguments. This patch ensures that any
pointer that will be written through does not point to a const object,
and only the pointer to the atomic variable can be volatile.

This differs slightly from Clang, which allows the third argument to
__atomic_exchange (the one that is used to return the old value) to be
volatile if and only if the first argument is volatile. That doesn't
seem useful.

For C++ emit errors, but for C use pedwarns that are controlled by
-Wincompatible-pointer-types.

gcc/c-family/ChangeLog:

	* c-common.c (get_atomic_generic_size): Check cv-qualifiers in
	pointer arguments.

gcc/testsuite/ChangeLog:

	* c-c++-common/pr95378.c: New test.
2020-06-17 20:02:53 +01:00
Richard Sandiford
4e49b994de recog: Tweak insn_gen_fn::operator() definition
Fixes a “left operand of comma has no effect” warning that some were
seeing.  Also fixes a spurious ellipsis that Jonathan Wakely pointed
out.

2020-06-17  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* coretypes.h (first_type): New alias template.
	* recog.h (insn_gen_fn::operator()): Use it instead of a decltype.
	Remove spurious “...” and split the function type out into a typedef.
2020-06-17 17:45:29 +01:00
Andreas Krebbel
914eadfe86 IBM Z: Prevent mach optimization on doloop patterns
s390_fix_long_loop_prediction is used in machine dependent
reorg. There we use single_set to distingiush between conditional
jumps and branch on count patterns.  However, single_set returns a
non-NULL value also for PARALLELs in case one of the SETs is dead.

2020-06-17  Andreas Krebbel  <krebbel@linux.ibm.com>

gcc/
	* config/s390/s390.c (s390_fix_long_loop_prediction): Exit early
	for PARALLELs.

gcc/testsuite/
	* gcc.target/s390/20200617.c: New test.
2020-06-17 17:11:45 +02:00
Richard Biener
8a9e230f41 Use SLP_TREE_VECTYPE consistently
This assigns SLP_TREE_VECTYPE to all SLP nodes and uses it when
analyzing def operands.  It does not deal with mismatches between
SLP_TREE_VECTYPE and STMT_VINFO_VECTYPE yet - those cases are
still rejected until I get to clean up the interaction with data
reference groups.

2020-06-17  Richard Biener  <rguenther@suse.de>

	* tree-vect-slp.c (vect_build_slp_tree_1): Set the passed
	in *vectype parameter.
	(vect_build_slp_tree_2): Set SLP_TREE_VECTYPE from what
	vect_build_slp_tree_1 computed.
	(vect_analyze_slp_instance): Set SLP_TREE_VECTYPE.
	(vect_slp_analyze_node_operations_1): Use the SLP node vector type.
	(vect_schedule_slp_instance): Likewise.
	* tree-vect-stmts.c (vect_is_simple_use): Take the vector type
	from SLP_TREE_VECTYPE.
2020-06-17 16:30:21 +02:00
Marek Polacek
ae2ebf011f c++: ICE with IMPLICIT_CONV_EXPR in array subscript [PR95508]
Since r10-7096 convert_like, when called in a template, creates an
IMPLICIT_CONV_EXPR when we're converting to/from array type.

In this test, we have e[f], and we're converting f (of type class A) to
int, so convert_like in build_new_op_1 created the IMPLICIT_CONV_EXPR
that got into cp_build_array_ref which calls maybe_constant_value.  My
patch above failed to adjust this spot to call fold_non_dependent_expr
instead, which can handle codes like I_C_E in a template.  Fixed by
using a new function maybe_fold_non_dependent_expr, which, if the expr
can't be evaluated to a constant, returns the original expression.

gcc/cp/ChangeLog:

	PR c++/95508
	* constexpr.c (maybe_fold_non_dependent_expr): New.
	* cp-tree.h (maybe_fold_non_dependent_expr): Declare.
	* typeck.c (cp_build_array_ref): Call maybe_fold_non_dependent_expr
	instead of maybe_constant_value.

gcc/testsuite/ChangeLog:

	PR c++/95508
	* g++.dg/template/conv16.C: New test.
2020-06-17 09:19:02 -04:00
Patrick Palka
4d2b0866d7 Fix use of inaccessible member in pr85503.C [PR95716]
The recent PR41437 fix exposed a latent use of an inaccessible member in
the below testcase.

gcc/testsuite/ChangeLog:

	PR testsuite/95716
	* g++.dg/ext/pr85503.C: Give ai::cv public access.
2020-06-17 09:09:53 -04:00
Richard Biener
d0909f5858 tree-optimization/95717 - fix SSA update for vectorizer epilogue
This fixes yet another issue with the custom SSA updating in the
vectorizer when we copy from the non-if-converted loop.  We must
not mess with current defs before we updated the BB copies.

2020-06-17  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/95717
	* tree-vect-loop-manip.c (slpeel_tree_duplicate_loop_to_edge_cfg):
	Move BB SSA updating before exit/latch PHI current def copying.

	* g++.dg/torture/pr95717.C: New testcase.
2020-06-17 15:01:25 +02:00
Martin Liska
9efbb03616
testsuite: clean up .gcov files in test-suite.
gcc/testsuite/ChangeLog:

	PR testsuite/95720
	* gcc.misc-tests/gcov-pr94029.c: Remove not needed remove-gcda.
	* lib/gcov.exp: Delete properly .gcov files.
2020-06-17 13:42:20 +02:00
Martin Liska
502d63b6d6
Lower VEC_COND_EXPR into internal functions.
gcc/ChangeLog:

	* Makefile.in: Add new file.
	* expr.c (expand_expr_real_2): Add gcc_unreachable as we should
	not meet this condition.
	(do_store_flag): Likewise.
	* gimplify.c (gimplify_expr): Gimplify first argument of
	VEC_COND_EXPR to be a SSA name.
	* internal-fn.c (vec_cond_mask_direct): New.
	(vec_cond_direct): Likewise.
	(vec_condu_direct): Likewise.
	(vec_condeq_direct): Likewise.
	(expand_vect_cond_optab_fn):  New.
	(expand_vec_cond_optab_fn): Likewise.
	(expand_vec_condu_optab_fn): Likewise.
	(expand_vec_condeq_optab_fn): Likewise.
	(expand_vect_cond_mask_optab_fn): Likewise.
	(expand_vec_cond_mask_optab_fn): Likewise.
	(direct_vec_cond_mask_optab_supported_p): Likewise.
	(direct_vec_cond_optab_supported_p): Likewise.
	(direct_vec_condu_optab_supported_p): Likewise.
	(direct_vec_condeq_optab_supported_p): Likewise.
	* internal-fn.def (VCOND): New OPTAB.
	(VCONDU): Likewise.
	(VCONDEQ): Likewise.
	(VCOND_MASK): Likewise.
	* optabs.c (get_rtx_code): Make it global.
	(expand_vec_cond_mask_expr): Removed.
	(expand_vec_cond_expr): Removed.
	* optabs.h (expand_vec_cond_expr): Likewise.
	(vector_compare_rtx): Make it global.
	* passes.def: Add new pass_gimple_isel pass.
	* tree-cfg.c (verify_gimple_assign_ternary): Add check
	for VEC_COND_EXPR about first argument.
	* tree-pass.h (make_pass_gimple_isel): New.
	* tree-ssa-forwprop.c (pass_forwprop::execute): Prevent
	propagation of the first argument of a VEC_COND_EXPR.
	* tree-ssa-reassoc.c (ovce_extract_ops): Support SSA_NAME as
	first argument of a VEC_COND_EXPR.
	(optimize_vec_cond_expr): Likewise.
	* tree-vect-generic.c (expand_vector_divmod): Make SSA_NAME
	for a first argument of created VEC_COND_EXPR.
	(expand_vector_condition): Fix coding style.
	* tree-vect-stmts.c (vectorizable_condition): Gimplify
	first argument.
	* gimple-isel.cc: New file.

gcc/testsuite/ChangeLog:

	* g++.dg/vect/vec-cond-expr-eh.C: New test.
2020-06-17 12:04:22 +02:00
Martin Liska
2021af0c23
gcc-changelog: Support 'Backported from master'.
contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Print 'Backported from master'
	heading to backported commits.
	* gcc-changelog/test_email.py: Test it.
	* gcc-changelog/test_patches.txt: Add new patch.
	* gcc-changelog/git_repository.py: Add commit_to_date hook.
	* gcc-changelog/git_email.py: Add fuzzy implementation
	of commit_to_date_hook.
2020-06-17 11:37:34 +02:00
Andrew Stubbs
f062c3f115 amdgcn: Switch to HSACO v3 binary format
This upgrades the compiler to emit HSA Code Object v3 binaries.  This means
changing the assembler directives, and linker command line options.

The gcn-run and libgomp loaders need corresponding alterations.  The
relocations no longer need to be fixed up manually, and the kernel symbol
names have changed slightly.

This move makes the binaries compatible with the new rocgdb from ROCm 3.5.

2020-06-17  Andrew Stubbs  <ams@codesourcery.com>

	gcc/
	* config/gcn/gcn-hsa.h (TEXT_SECTION_ASM_OP): Use ".text".
	(BSS_SECTION_ASM_OP): Use ".bss".
	(ASM_SPEC): Remove "-mattr=-code-object-v3".
	(LINK_SPEC): Add "--export-dynamic".
	* config/gcn/gcn-opts.h (processor_type): Replace PROCESSOR_VEGA with
	PROCESSOR_VEGA10 and PROCESSOR_VEGA20.
	* config/gcn/gcn-run.c (HSA_RUNTIME_LIB): Use ".so.1" variant.
	(load_image): Remove obsolete relocation handling.
	Add ".kd" suffix to the symbol names.
	* config/gcn/gcn.c (MAX_NORMAL_SGPR_COUNT): Set to 62.
	(gcn_option_override): Update gcn_isa test.
	(gcn_kernel_arg_types): Update all the assembler directives.
	Remove the obsolete options.
	(gcn_conditional_register_usage): Update MAX_NORMAL_SGPR_COUNT usage.
	(gcn_omp_device_kind_arch_isa): Handle PROCESSOR_VEGA10 and
	PROCESSOR_VEGA20.
	(output_file_start): Rework assembler file header.
	(gcn_hsa_declare_function_name): Rework kernel metadata.
	* config/gcn/gcn.h (GCN_KERNEL_ARG_TYPES): Set to 16.
	* config/gcn/gcn.opt (PROCESSOR_VEGA): Remove enum.
	(PROCESSOR_VEGA10): New enum value.
	(PROCESSOR_VEGA20): New enum value.

	libgomp/
	* plugin/plugin-gcn.c (init_environment_variables): Use ".so.1"
	variant for HSA_RUNTIME_LIB name.
	(find_executable_symbol_1): Delete.
	(find_executable_symbol): Delete.
	(init_kernel_properties): Add ".kd" suffix to symbol names.
	(find_load_offset): Delete.
	(create_and_finalize_hsa_program): Remove relocation handling.
2020-06-17 10:06:21 +01:00
Martin Liska
8ad4fc26dc
gcov*: collapse lisence header to 2 lines in --version.
gcc/ChangeLog:

	* gcov-dump.c (print_version): Collapse lisence header to 2 lines
	in --version.
	* gcov-tool.c (print_version): Likewise.
	* gcov.c (print_version): Likewise.
2020-06-17 10:58:04 +02:00
Eric Botcazou
48b6386f5d [Ada] Add early return to Apply_Universal_Integer_Attribute_Checks
2020-06-17  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* checks.adb (Apply_Universal_Integer_Attribute_Checks): Do not do
	anything when the type of the node is already Universal_Integer.
2020-06-17 04:14:23 -04:00
Arnaud Charlet
86f8060436 [Ada] ACATS 4.1H - BA12018 - Missed errors for private with
2020-06-17  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

	* sem_ch10.adb (Expand_With_Clause): Add missing handling of
	N_Generic_Subprogram_Declaration, N_Subprogram_Declaration,
	N_Subprogram_Body.
2020-06-17 04:14:23 -04:00
Ed Schonberg
a5c11aa2d5 [Ada] Additional legality rule for indexing operation for derived type
2020-06-17  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

	* sem_ch13.adb: (Check_Inherited_Indexing): Check that a type
	derived from an indexable container type cannot specify an
	indexing aspect if the same aspect is not specified for the
	parent type (RM 4.1.6 (6/5), AI12-160). Add a check that a
	specified indexing aspect for a derived type is confirming.
2020-06-17 04:14:22 -04:00
Gary Dismukes
89d9bab0aa [Ada] Nested subprograms in protected subprograms improperly handled in GNAT-LLVM
2020-06-17  Gary Dismukes  <dismukes@adacore.com>

gcc/ada/

	* exp_ch9.adb (Build_Protected_Subp_Specification): Add ???
	comment about the flag Has_Nested_Subprogram not being set here.
	(Expand_N_Protected_Body): If the original body for a protected
	subprogram has the flag Has_Nested_Subprogram set, then set that
	flag on the new unprotected subprogram body that's created for
	it, and reset the Scope fields of its top level declarations,
	which have been effectively taken from the original protected
	subprogram body. Add ??? comment about unclear testing of
	Corresponding_Spec.
2020-06-17 04:14:21 -04:00
Javier Miranda
8afbdb8a64 [Ada] Ada2020: AI12-0279 more dispatching points with aspect Yield
2020-06-17  Javier Miranda  <miranda@adacore.com>

gcc/ada/

	* aspects.ads (type Aspect_Id): Add Aspect_Yield as a Boolean
	aspect, and update the Is_Representation_Aspect, Aspect_Names,
	and Aspect_Delay arrays.
	* einfo.ads, einfo.adb (Has_Yield_Aspect, Yield_Aspect): New
	subprograms.
	* exp_ch6.adb (Add_Return, Expand_Non_Function_Return,
	Expand_Simple_Function_Return): Add calls to Yield.
	* exp_ch9.adb (Build_Accept_Body, Expand_N_Accept_Statement):
	Add calls to Yield.
	* rtsfind.ads (RE_Yield): Adding support to generate calls to
	the runtime service Ada.Dispatching.Yield
	* sem_ch13.adb (Analyze_Aspect_Yield): New subprogram.
	* sem_ch3.adb (Derive_Subprogram): Inherit attribute
	Has_Yield_Aspect.
	* sem_ch8.adb (Analyze_Subprogram_Renaming): Check consistency
	of Has_Yield in the actual subprogram of a generic
	instantiation.
	* sem_disp.adb (Check_Dispatching_Operation): Check that if the
	Yield aspect is specified for a dispatching subprogram that
	inherits the aspect, the specified value shall be confirming.
	* sem_prag.adb (Analyze_Pragma [Pragma_Implemented]): Check that
	the implementation kind By_Protected_Procedure cannot be applied
	to a procedure that has aspect Yield.
2020-06-17 04:14:20 -04:00
Eric Botcazou
67b2ed8e56 [Ada] Fix incorrect operand sharing after expansion
2020-06-17  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* exp_ch4.adb (Expand_N_Op_Expon): Replace all occurrences of
	the original right operand with the relocated version.
2020-06-17 04:14:19 -04:00
Javier Miranda
765005dd67 [Ada] Crash in tagged type constructor with task components
2020-06-17  Javier Miranda  <miranda@adacore.com>

gcc/ada/

	* exp_ch6.adb (Has_BIP_Extra_Formal): New subprogram.
	(Needs_BIP_Task_Actuals): Add support for the subprogram type
	internally generated for dispatching calls.
	* exp_disp.adb (Expand_Dispatching_Call): Adding code to
	explicitly duplicate the extra formals of the target subprogram.
	* freeze.adb (Check_Extra_Formals): New subprogram.
	(Freeze_Subprogram): Fix decoration of Extra_Formals.
	* sem_ch3.adb (Derive_Subprogram): Fix decoration of
	Extra_Formals.
2020-06-17 04:14:18 -04:00
Bob Duff
da901811dc [Ada] Do not give "bad indentation" error inside a declare_expression
2020-06-17  Bob Duff  <duff@adacore.com>

gcc/ada/

	* par.adb (P_Basic_Declarative_Items): Update comment about
	Declare_Expression.
	* par-ch3.adb (P_Declarative_Items): Pass in Declare_Expression
	flag, and if True, skip the call to Style.Check_Indentation.
	* par-ch4.adb (P_Declare_Expression): Fix incorrect comment.
2020-06-17 04:14:17 -04:00