]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
5 years agoc: Fix bogus vector initialisation error [PR96377]
Richard Sandiford [Mon, 3 Aug 2020 08:48:36 +0000 (09:48 +0100)] 
c: Fix bogus vector initialisation error [PR96377]

One of the problems in this PR was that if we had:

  vector_type1 array[] = { vector_value1 };

process_init_element would only treat vector_value1 as initialising
a vector_type1 if they had the same TYPE_MAIN_VARIANT.  This has
several problems:

(1) It gives confusing error messages if the vector types are
    incompatible.  (Tested by gcc.dg/pr96377-1.c.)

(2) It means that we reject code that should be valid with
    -flax-vector-conversions.  (Tested by gcc.dg/pr96377-2.c.)

(3) On arm and aarch64 targets, it means that we reject some
    initializers that mix Advanced SIMD and standard GNU vectors.
    These vectors have traditionally had different TYPE_MAIN_VARIANTs
    because they have different mangling schemes.  (Tested by
    gcc.dg/pr96377-[3-6].c.)

(4) It means that we reject SVE initializers that should be valid.
    (Tested by gcc.target/aarch64/sve/gnu_vectors_[34].c.)

(5) After r11-1741-g:31427b974ed7b7dd54e2 we reject:

      arm_neon_type1 array[] = { k ^ arm_neon_value1 };

    because applying the binary operator to arm_neon_value1 strips
    the "Advanced SIMD type" attributes that were added in that patch.
    Stripping the attributes is problematic for other reasons though,
    so that still needs to be fixed separately.

g++.target/aarch64/sve/gnu_vectors_[34].C already pass.

gcc/c/
PR c/96377
* c-typeck.c (process_init_element): Split test for whether to
recurse into a record, union or array into...
(initialize_elementwise_p): ...this new function.  Don't recurse
into a vector type if the initialization value is also a vector.

gcc/testsuite/
PR c/96377
* gcc.dg/pr96377-1.c: New test.
* gcc.dg/pr96377-2.c: Likewise.
* gcc.dg/pr96377-3.c: Likewise.
* gcc.dg/pr96377-4.c: Likewise.
* gcc.dg/pr96377-5.c: Likewise.
* gcc.dg/pr96377-6.c: Likewise.
* gcc.target/aarch64/pr96377-1.c: Likewise.
* gcc.target/aarch64/sve/acle/general-c/gnu_vectors_3.c: Likewise.
* gcc.target/aarch64/sve/acle/general-c/gnu_vectors_4.c: Likewise.
* g++.target/aarch64/sve/acle/general-c++/gnu_vectors_3.C: Likewise.
* g++.target/aarch64/sve/acle/general-c++/gnu_vectors_4.C: Likewise.

(cherry picked from commit 7d599ad27b9bcf5165f87710f1abc64bbabd06ae)

5 years agolibsanitizer: Fix GetPcSpBp determination of SP on 32-bit Solaris/x86
Rainer Orth [Mon, 3 Aug 2020 07:45:04 +0000 (09:45 +0200)] 
libsanitizer: Fix GetPcSpBp determination of SP on 32-bit Solaris/x86

The latest Solaris 11.4/x86 update uncovered a libsanitizer bug that
caused one test to FAIL for 32-bit:

+FAIL: c-c++-common/asan/null-deref-1.c   -O0  output pattern test
+FAIL: c-c++-common/asan/null-deref-1.c   -O1  output pattern test
+FAIL: c-c++-common/asan/null-deref-1.c   -O2  output pattern test
+FAIL: c-c++-common/asan/null-deref-1.c   -O2 -flto  output pattern test
+FAIL: c-c++-common/asan/null-deref-1.c -O2 -flto -flto-partition=none
output pattern test
+FAIL: c-c++-common/asan/null-deref-1.c   -O3 -g  output pattern test
+FAIL: c-c++-common/asan/null-deref-1.c   -Os  output pattern test

I've identified the problem and the fix has just landed in upstream
llvm-project:

https://reviews.llvm.org/D83664

Tested on i386-pc-solaris2.11 and x86_64-pc-linux.gnu.

libsanitizer:
* sanitizer_common/sanitizer_linux.cpp: Cherry-pick llvm-project
revision f0e9b76c3500496f8f3ea7abe6f4bf801e3b41e7.

5 years agoDaily bump.
GCC Administrator [Mon, 3 Aug 2020 00:16:52 +0000 (00:16 +0000)] 
Daily bump.

5 years agoDaily bump.
GCC Administrator [Sun, 2 Aug 2020 00:16:53 +0000 (00:16 +0000)] 
Daily bump.

5 years agod: Fix ICE in expand_intrinsic_vaarg
Iain Buclaw [Thu, 16 Jul 2020 16:34:18 +0000 (18:34 +0200)] 
d: Fix ICE in expand_intrinsic_vaarg

Both intrinsics did not handle the case where the va_list object comes
from a ref parameter.

gcc/d/ChangeLog:

PR d/96140
* intrinsics.cc (expand_intrinsic_vaarg): Handle ref parameters as
arguments to va_arg().
(expand_intrinsic_vastart): Handle ref parameters as arguments to
va_start().

gcc/testsuite/ChangeLog:

PR d/96140
* gdc.dg/pr96140.d: New test.

(cherry picked from commit dfc420f8d4492dbf5f45df4fecf93cb9645c0d7b)

5 years agoDaily bump.
GCC Administrator [Sat, 1 Aug 2020 00:16:58 +0000 (00:16 +0000)] 
Daily bump.

5 years agoDo not allocate huge array in output_in_order.
Martin Liska [Thu, 30 Jul 2020 07:24:40 +0000 (09:24 +0200)] 
Do not allocate huge array in output_in_order.

We noticed that when analyzing LTRANS memory peak that happens right
after the start:
https://gist.github.com/marxin/223890df4d8d8e490b6b2918b77dacad

In case of chrome, we have symtab->order == 200M, so we allocate
16B * 200M = 3.2GB.

gcc/ChangeLog:

* cgraph.h: Remove leading empty lines.
* cgraphunit.c (enum cgraph_order_sort_kind): Remove
ORDER_UNDEFINED.
(struct cgraph_order_sort): Add constructors.
(cgraph_order_sort::process): New.
(cgraph_order_cmp): New.
(output_in_order): Simplify and push nodes to vector.

(cherry picked from commit 8bd062e8ad44e70be04108232e1ef597fc3b3e3e)

5 years agoDaily bump.
GCC Administrator [Fri, 31 Jul 2020 00:16:58 +0000 (00:16 +0000)] 
Daily bump.

5 years agoTune memcpy and memset for Zen cores.
Martin Liska [Mon, 1 Jun 2020 11:21:40 +0000 (13:21 +0200)] 
Tune memcpy and memset for Zen cores.

Based on the collected numbers in PR95435, I suggest the following
tuning changes:

gcc/ChangeLog:

PR target/95435
* config/i386/x86-tune-costs.h: Use libcall for large sizes for
-m32. Start using libcall from 128+ bytes.

(cherry picked from commit dc65aba7a4725d1b464c8c64a5f739ee910e8943)

5 years agoRe-format zen memcpy/memset costs.
Martin Liska [Mon, 1 Jun 2020 09:21:33 +0000 (11:21 +0200)] 
Re-format zen memcpy/memset costs.

The patch improves readability of the memcpy and memset
expansion strategies.

gcc/ChangeLog:

* config/i386/x86-tune-costs.h: Change code formatting.

(cherry picked from commit da346efd27eca48a8fe2e07d7e18b2c77ead0e2d)

5 years agoDaily bump.
GCC Administrator [Thu, 30 Jul 2020 00:16:57 +0000 (00:16 +0000)] 
Daily bump.

5 years agoUpdate gcc ja.po, sv.po.
Joseph Myers [Wed, 29 Jul 2020 19:33:28 +0000 (19:33 +0000)] 
Update gcc ja.po, sv.po.

* ja.po, sv.po: Update.

5 years agopreprocessor: Teach traditional about has_include [PR95889]
Tiziano Müller [Wed, 29 Jul 2020 14:28:23 +0000 (07:28 -0700)] 
preprocessor: Teach traditional about has_include [PR95889]

Traditional cpp (used by fortran) didn;t know about the new
__has_include__ implementation.  Hey, since when did traditional cpp
grow __has_include__? That wasn't in knr!

libcpp/
* init.c (builtin_array): Add xref comment.
* traditional.c (fun_like_macro): Add HAS_INCLUDE codes.
gcc/testsuite/
* c-c++-common/cpp/has-include-1-traditional.c: New.

5 years agoFortran : Don't warn for LOGICAL kind conversion PR96319
Mark Eggleston [Mon, 27 Jul 2020 14:28:50 +0000 (15:28 +0100)] 
Fortran  : Don't warn for LOGICAL kind conversion PR96319

LOGICAL values will always fit regardless of kind so there
is no need for warnings.

2020-07-29  Mark Eggleston  <markeggleston@gcc.gnu.org>

gcc/fortran/

PR fortran/96319
* intrinsic.c (gfc_convert_type_warn):  Add check for
LOGICAL type so that warnings are not output.

2020-07-29  Mark Eggleston  <markeggleston@gcc.gnu.org>

gcc/testsuite/

PR fortran/96319
* gfortran.dg/pr96319.f90: New test.

(cherry picked from commit 6af8284719d151087a1c1e4da210cc5a9fa4a478)

5 years agogcc-changelog: fix combining of arguments.
Martin Liska [Wed, 29 Jul 2020 12:13:42 +0000 (14:13 +0200)] 
gcc-changelog: fix combining of arguments.

contrib/ChangeLog:

2020-07-29  Martin Liska  <mliska@suse.cz>

* git-backport.py: fix how are ChangeLog paths combined.

5 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>
(cherry picked from commit bc4ed079dc09a62168699227a794ac52a5b6f6a4)

5 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>
(cherry picked from commit 25bce75c77ec5617c78173d837d3b664c0f20968)

5 years agocoroutines: Correct frame capture of compiler temps [PR95591+4].
Iain Sandoe [Sun, 19 Jul 2020 17:39:21 +0000 (18:39 +0100)] 
coroutines: Correct frame capture of compiler temps [PR95591+4].

When a full expression contains a co_await (or co_yield), this means
that it might be suspended; which would destroy temporary variables
(on a stack for example).  However the language guarantees that such
temporaries are live until the end of the expression.

In order to preserve this, we 'promote' temporaries where necessary
so that they are saved in the coroutine frame (which allows them to
remain live potentially until the frame is destroyed).  In addition,
sub-expressions that produce control flow (such as TRUTH_AND/OR_IF
or COND_EXPR) must be handled specifically to ensure that await
expressions are properly expanded.

This patch corrects two mistakes in which we were (a) failing to
promote some temporaries and (b) we we failing to sequence DTORs for
the captures properly. This manifests in a number of related (but not
exact duplicate) PRs.

The revised code collects the actions into one place and maps all the
control flow into one form - a benefit of this is that co_returns are
now expanded earlier (which provides an opportunity to address PR95517
in some future patch).

We replace a statement that contains await expression(s) with a bind
scope that has a variable list describing the temporaries that have
been 'promoted' and a statement list that contains a series of cleanup
expressions for each of those.  Where we encounter nested conditional
expressions, these are wrapped in a try-finally block with a guard var
for each sub-expression variable that needs a DTOR.  The guards are all
declared and initialized to false before the first conditional sub-
expression.  The 'finally' block contains a series of if blocks (one
per guard variable) enclosing the relevant DTOR.

Variables listed in a bind scope in this manner are automatically moved
to a coroutine frame version by existing code (so we re-use that rather
than having a separate mechanism).

gcc/cp/ChangeLog:

PR c++/95591
PR c++/95599
PR c++/95823
PR c++/95824
PR c++/95895
* coroutines.cc (struct coro_ret_data): Delete.
(coro_maybe_expand_co_return): Delete.
(co_return_expander): Delete.
(expand_co_returns): Delete.
(co_await_find_in_subtree): Remove unused name.
(build_actor_fn): Remove unused parm, remove handling
for co_return expansion.
(register_await_info): Demote duplicate info message to a
warning.
(coro_make_frame_entry): Move closer to use site.
(struct susp_frame_data): Add fields for final suspend label
and a flag to indicate await expressions with initializers.
(captures_temporary): Delete.
(register_awaits): Remove unused code, update comments.
(find_any_await): New.
(tmp_target_expr_p): New.
(struct interesting): New.
(find_interesting_subtree): New.
(struct var_nest_node): New.
(flatten_await_stmt): New.
(handle_nested_conditionals): New.
(process_conditional): New.
(replace_statement_captures): Rename to...
(maybe_promote_temps): ... this.
(maybe_promote_captured_temps): Delete.
(analyze_expression_awaits): Check for await expressions with
initializers.  Simplify handling for truth-and/or-if.
(expand_one_truth_if): Simplify (map cases that need expansion
to COND_EXPR).
(await_statement_walker): Handle CO_RETURN_EXPR. Simplify the
handling for truth-and/or-if expressions.
(register_local_var_uses): Ensure that we create names in the
implementation namespace.
(morph_fn_to_coro): Add final suspend label to suspend frame
callback data and remove it from the build_actor_fn call.

gcc/testsuite/ChangeLog:

PR c++/95591
PR c++/95599
PR c++/95823
PR c++/95824
PR c++/95895
* g++.dg/coroutines/pr95591.C: New test.
* g++.dg/coroutines/pr95599.C: New test.
* g++.dg/coroutines/pr95823.C: New test.
* g++.dg/coroutines/pr95824.C: New test.

(cherry picked from commit 0f66b8486cea8668020e4bd48f261b760cb579be)

5 years agocoroutines: co_returns are statements, not expressions.
Iain Sandoe [Sun, 26 Jul 2020 14:09:39 +0000 (15:09 +0100)] 
coroutines: co_returns are statements, not expressions.

This corrects an error in the CO_RETURN_EXPR tree
class.

gcc/cp/ChangeLog:

* cp-tree.def (CO_RETURN_EXPR): Correct the class
to use tcc_statement.

(cherry picked from commit 608832716e27ca356ee38d14ae30b3ab525884ea)

5 years agoDaily bump.
GCC Administrator [Wed, 29 Jul 2020 00:16:54 +0000 (00:16 +0000)] 
Daily bump.

5 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.

(cherry picked from commit 7355a9408b990cdd20db91e2e1ba0b03e801d6a6)

5 years agoexpander: Fix ICE in maybe_warn_rdwr_sizes [PR96335]
Jakub Jelinek [Tue, 28 Jul 2020 09:08:29 +0000 (11:08 +0200)] 
expander: Fix ICE in maybe_warn_rdwr_sizes [PR96335]

The following testcase ICEs in maybe_warn_rdwr_sizes.  The problem is that
the caller uses its fndecl and fntype variables to fill up rdwr_map, and
the fntype in that case is a prototype with the access attribute and all
the checks needed for that performed.  But the maybe_warn_rdwr_sizes
function tries to rediscover fndecl/fntype itself and does it differently
from how the caller did (for fndecl get_callee_fndecl and fntype from that
FUNCTION_DECL, otherwise sets fntype to CALL_EXPR_FN's type).

On the testcase, get_callee_fndecl does find a FUNCTION_DECL because
it does STRIP_NOPS in between.

Instead of trying to rediscover those, this patch just passes them down,
like is done in several other functions.

2020-07-28  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/96335
* calls.c (maybe_warn_rdwr_sizes): Add FNDECL and FNTYPE arguments,
instead of trying to rediscover them in the body.
(initialize_argument_information): Adjust caller.

* gcc.dg/pr96335.c: New test.

(cherry picked from commit f9264b9008386ac3b5c795472c222fa524b127b0)

5 years agoDaily bump.
GCC Administrator [Tue, 28 Jul 2020 00:17:01 +0000 (00:17 +0000)] 
Daily bump.

5 years agoUpdate gcc .po files.
Joseph Myers [Mon, 27 Jul 2020 22:53:40 +0000 (22:53 +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.

5 years agoAllow --with-cpu=power10
Aaron Sawdey [Tue, 23 Jun 2020 18:12:52 +0000 (13:12 -0500)] 
Allow --with-cpu=power10

Update config.gcc so that we can use --with-cpu=power10.
Also remove "future" from the 64-bit check as Segher suggests.

* config.gcc: Identify power10 as a 64-bit processor and as valid
for --with-cpu and --with-tune.

(cherry picked from commit 71237df0a0b7f0f10cebedcd114fae7ad2aaebcb)

5 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.

(cherry picked from commit 7f5c0f328eced560a204bb8e3eae0d45795dd235)

5 years agoFortran : ICE in gfc_check_pointer_assign PR95612
Mark Eggleston [Thu, 11 Jun 2020 10:05:40 +0000 (11:05 +0100)] 
Fortran  : ICE in gfc_check_pointer_assign PR95612

Output an error if the right hand value is a zero sized array or
does not have a symbol tree otherwise continue checking.

2020-07-27  Steven G. Kargl  <kargl@gcc.gnu.org>

gcc/fortran/

PR fortran/95612
* expr.c (gfc_check_pointer_assigb): Output an error if
rvalue is a zero sized array or output an error if rvalue
doesn't have a symbol tree.

2020-07-27  Mark Eggleston  <markeggleston@gcc.gnu.org>

gcc/testsuite/

PR fortran/95612
* gfortran.dg/pr95612.f90: New test.

(cherry picked from commit 81072bab8d1e48ee83d9711dcb559ea1e019b351)

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

5 years agoFortran : ICE in gfc_check_reshape PR95585
Mark Eggleston [Thu, 11 Jun 2020 05:42:36 +0000 (06:42 +0100)] 
Fortran  : ICE in gfc_check_reshape PR95585

Issue an error where an array is used before its definition
instead of an ICE.

2020-07-26  Steven G. Kargl  <kargl@gcc.gnu.org>

gcc/fortran/

PR fortran/95585
* check.c (gfc_check_reshape): Add check for a value when
the symbol has an attribute flavor FL_PARAMETER.

2020-07-26  Mark Eggleston  <markeggleston@gcc.gnu.org>

gcc/testsuite/

PR fortran/95585
* gfortran.dg/pr95585.f90: New test.

(cherry picked from commit d9aed5f1ccffc019ddf980e349caa3d092755cb4)

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

5 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.

(cherry picked from commit aa7e7eff5ec165dc8463a0e74309801b15d1feda)

5 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.

(cherry picked from commit 05e0971bcf94a481cbfa2731484f024a67dbd4a5)

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

5 years agolibgo: update to Go 1.14.6 release
Ian Lance Taylor [Fri, 17 Jul 2020 19:30:51 +0000 (12:30 -0700)] 
libgo: update to Go 1.14.6 release

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

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

5 years agosparc/sparc64: use crtendS.o for default-pie executables [PR96190]
Sergei Trofimovich [Thu, 23 Jul 2020 22:58:35 +0000 (23:58 +0100)] 
sparc/sparc64: use crtendS.o for default-pie executables [PR96190]

In --enable-default-pie mode compiler should switch from
using crtend.o to crtendS.o. On sparc it is especially important
because crtend.o contains PIC-unfriendly code.

We use GNU_USER_TARGET_ENDFILE_SPEC as a baseline spec to get
crtendS.o instead of crtend.o in !no-pie mode.

gcc:

2020-07-14  Sergei Trofimovich  <siarheit@google.com>

PR target/96190
* config/sparc/linux.h (ENDFILE_SPEC): Use GNU_USER_TARGET_ENDFILE_SPEC
to get crtendS.o for !no-pie mode.
* config/sparc/linux64.h (ENDFILE_SPEC): Ditto.

(cherry picked from commit 87891d5eafe8d1de90b9d9b056eca81c508d1c77)

5 years agoPR fortran/95980 - ICE in get_unique_type_string, at fortran/class.c:485
Harald Anlauf [Fri, 10 Jul 2020 19:35:35 +0000 (21:35 +0200)] 
PR fortran/95980 - ICE in get_unique_type_string, at fortran/class.c:485

In SELECT TYPE, the argument may be an incorrectly specified unlimited
CLASS variable.  Avoid NULL pointer dereferences for clean error
recovery.

gcc/fortran/
PR fortran/95980
* class.c (gfc_add_component_ref, gfc_build_class_symbol):
Add checks for NULL pointer dereference.
* primary.c (gfc_variable_attr): Likewise.
* resolve.c (resolve_variable, resolve_assoc_var)
(resolve_fl_var_and_proc, resolve_fl_variable_derived)
(resolve_symbol): Likewise.

(cherry picked from commit 70c884a4b82733027ac0e2620d09169b177080d7)

5 years agoPR fortran/95980 - ICE on using sync images with -fcheck=bounds
Harald Anlauf [Mon, 6 Jul 2020 16:58:23 +0000 (18:58 +0200)] 
PR fortran/95980 - ICE on using sync images with -fcheck=bounds

In SELECT TYPE, the argument may be an incorrectly specified unlimited
polymorphic variable.  Avoid a NULL pointer dereference for clean error
recovery.

gcc/fortran/
PR fortran/95980
* match.c (copy_ts_from_selector_to_associate, build_class_sym):
Distinguish between unlimited polymorphic and ordinary variables
to avoid NULL pointer dereference.
* resolve.c (resolve_select_type):
Distinguish between unlimited polymorphic and ordinary variables
to avoid NULL pointer dereference.

(cherry picked from commit f2151227dfe90a5fe73297c370786be98b0b090f)

5 years agoPR fortran/96086 - ICE in gfc_match_select_rank, at fortran/match.c:6645
Harald Anlauf [Fri, 10 Jul 2020 19:00:13 +0000 (21:00 +0200)] 
PR fortran/96086 - ICE in gfc_match_select_rank, at fortran/match.c:6645

Handle NULL pointer dereference on SELECT RANK with an invalid
assumed-rank array declaration.

gcc/fortran/
PR fortran/96086
* match.c (gfc_match_select_rank): Catch NULL pointer
dereference.
* resolve.c (resolve_assoc_var): Catch NULL pointer dereference
that may occur after an illegal declaration.

(cherry picked from commit 8a0b69f0b089c05d233b8e1a941825b1ceac93bd)

5 years agoPR fortran/89574 - ICE in conv_function_val, at fortran/trans-expr.c:3792
Harald Anlauf [Tue, 21 Jul 2020 19:37:30 +0000 (21:37 +0200)] 
PR fortran/89574 - ICE in conv_function_val, at fortran/trans-expr.c:3792

When checking for an external procedure from the same file, do not
consider symbols from different modules.

gcc/fortran/
PR fortran/89574
* trans-decl.c (gfc_get_extern_function_decl): Check whether a
symbol belongs to a different module.

(cherry picked from commit 28f2a080cc27531a8c78aec9f44aeff4961c2a4c)

5 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.

(cherry picked from commit ae575662833d70cb7d74b9538096c7becc79af14)

5 years agoAlways use name from c_interop_kinds_table for -fc-prototypes.
Thomas Koenig [Sun, 19 Jul 2020 15:27:45 +0000 (17:27 +0200)] 
Always use name from c_interop_kinds_table for -fc-prototypes.

When a user specified a KIND that was a parameter taking the value
of an iso_c_binding KIND, the code used the name of that parameter
to look up the type name.  Corrected by always looking it up in
the table of C interop kinds (which was previously done for
non-C-interop types, anyway).

gcc/fortran/ChangeLog:

PR fortran/96220
* dump-parse-tree.c (get_c_type_name): Always use the entries from
c_interop_kinds_table to find the correct C type.

(cherry picked from commit 2e1b25350aa96b3f5678a056d0b55bb323c452d9)

5 years agoFix handling of implicit_pure by checking if non-pure procedures are called.
Thomas Koenig [Thu, 23 Jul 2020 15:56:09 +0000 (17:56 +0200)] 
Fix handling of implicit_pure by checking if non-pure procedures are called.

Procedures are marked as implicit_pure if they fulfill the criteria of
pure procedures.  In this case, a procedure was not marked as not being
implicit_pure which called another procedure, which had not yet been
marked as not being implicit_impure.

Fixed by iterating over all procedures, setting callers of procedures
which are non-pure and non-implicit_pure as non-implicit_pure and
doing this until no more procedure has been changed.

Backport from trunk r11-2215-g3055d879edb1bc2a3923f92a5e681c8f6774fbc3 .

gcc/fortran/ChangeLog:

2020-07-10  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/96018
* frontend-passes.c (gfc_check_externals): Adjust formatting.
(implicit_pure_call): New function.
(implicit_pure_expr): New function.
(gfc_fix_implicit_pure): New function.
* gfortran.h (gfc_fix_implicit_pure): New prototype.
* parse.c (translate_all_program_units): Call gfc_fix_implicit_pure.

5 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.

(cherry picked from commit 02cada26e4783b4bfeaf6512a6c22df24d7a25fc)

5 years agogcc-changelog: Fix typo in output
Jonathan Wakely [Fri, 17 Jul 2020 08:53:19 +0000 (09:53 +0100)] 
gcc-changelog: Fix typo in output

contrib/ChangeLog:

* gcc-changelog/git_update_version.py: Fix typo.

(cherry picked from commit 0c1d1c01039a96c191a7aded40e5df40b14d387a)

5 years agoFix ChangeLog entry: reverted backport commit.
Martin Liska [Thu, 23 Jul 2020 08:45:47 +0000 (10:45 +0200)] 
Fix ChangeLog entry: reverted backport commit.

5 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.

(cherry picked from commit 2ca1b6d009b194286c3ec91f9c51cc6b0a475458)

5 years agoUpdate BASE-VER after GCC 10.2 release
Richard Biener [Thu, 23 Jul 2020 06:42:42 +0000 (08:42 +0200)] 
Update BASE-VER after GCC 10.2 release

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

* BASE-VER: Set to 10.2.1.

5 years agoUpdate ChangeLog and version files for release releases/gcc-10.2.0
Richard Biener [Thu, 23 Jul 2020 06:35:38 +0000 (06:35 +0000)] 
Update ChangeLog and version files for release

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

5 years agoDaily bump.
GCC Administrator [Wed, 22 Jul 2020 00:16:59 +0000 (00:16 +0000)] 
Daily bump.

5 years agoi386: Rename TARGET_USE_XCHG_FOR_ATOMIC_STORE to TARGET_AVOID_MFENCE.
Uros Bizjak [Tue, 21 Jul 2020 18:30:15 +0000 (20:30 +0200)] 
i386: Rename TARGET_USE_XCHG_FOR_ATOMIC_STORE to TARGET_AVOID_MFENCE.

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

gcc/ChangeLog:

* config/i386/i386.h (TARGET_AVOID_MFENCE):
Rename from TARGET_USE_XCHG_FOR_ATOMIC_STORE.
* config/i386/sync.md (atomic_store<mode>): Update for rename.
* config/i386/x86-tune.def (X86_TUNE_AVOID_MFENCE):
Rename from X86_TUNE_USE_XCHG_FOR_ATOMIC_STORE.

5 years agoDaily bump.
GCC Administrator [Tue, 21 Jul 2020 00:17:01 +0000 (00:17 +0000)] 
Daily bump.

5 years agoRegenerate gcc.pot.
Joseph Myers [Mon, 20 Jul 2020 18:08:57 +0000 (18:08 +0000)] 
Regenerate gcc.pot.

* gcc.pot: Regenerate.

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

5 years agoDaily bump.
GCC Administrator [Sun, 19 Jul 2020 00:16:55 +0000 (00:16 +0000)] 
Daily bump.

5 years agoDaily bump.
GCC Administrator [Sat, 18 Jul 2020 00:16:56 +0000 (00:16 +0000)] 
Daily bump.

5 years agoFix missing dependencies for selftests which occasionally causes failed builds.
Romain Naour [Wed, 3 Jun 2020 18:30:57 +0000 (12:30 -0600)] 
Fix missing dependencies for selftests which occasionally causes failed builds.

gcc/

* Makefile.in (SELFTEST_DEPS): Move before including language makefile
fragments.

(cherry picked from commit b19d8aac15649f31a7588b2634411a1922906ea8)

5 years agoDaily bump.
GCC Administrator [Fri, 17 Jul 2020 00:17:00 +0000 (00:17 +0000)] 
Daily bump.

5 years agoS/390: Emit vector alignment hints for z13 if AS accepts them
Stefan Schulze Frielinghaus [Tue, 26 May 2020 16:21:52 +0000 (18:21 +0200)] 
S/390: Emit vector alignment hints for z13 if AS accepts them

Squashed with commit f842bdd7a97e9fef7513a266d641cac72d5f97cc

gcc/ChangeLog:

* config.in: Regenerate.
* config/s390/s390.c (print_operand): Emit vector alignment hints
for target z13, if AS accepts them.  For other targets the logic
stays the same.
* config/s390/s390.h (TARGET_VECTOR_LOADSTORE_ALIGNMENT_HINTS): Define
macro.
* configure: Regenerate.
* configure.ac: Check HAVE_AS_VECTOR_LOADSTORE_ALIGNMENT_HINTS_ON_Z13.

gcc/testsuite/ChangeLog:

* gcc.target/s390/vector/align-1.c: Change target architecture
to z13.
* gcc.target/s390/vector/align-2.c: Change target architecture
to z13.

(cherry picked from commit 929fd91ba975eebf9e57f7f092041271dcaf0c34)

5 years agoDaily bump.
GCC Administrator [Thu, 16 Jul 2020 00:17:11 +0000 (00:17 +0000)] 
Daily bump.

5 years agoc++: Treat GNU and Advanced SIMD vectors as distinct [PR95726]
Richard Sandiford [Wed, 15 Jul 2020 10:58:04 +0000 (11:58 +0100)] 
c++: Treat GNU and Advanced SIMD vectors as distinct [PR95726]

This is a release branch version of
r11-1741-g:31427b974ed7b7dd54e28fec595e731bf6eea8ba and
r11-2022-g:efe99cca78215e339ba79f0a900a896b4c0a3d36.

The trunk versions of the patch made GNU and Advanced SIMD vectors
distinct (but inter-convertible) in all cases.  However, the
traditional behaviour is that the types are distinct in template
arguments but not otherwise.

Following a suggestion from Jason, this patch puts the check
for different vector types under comparing_specializations.
In order to keep the backport as simple as possible, the patch
hard-codes the name of the attribute in the frontend rather than
adding a new branch-only target hook.

I didn't find a test that tripped the assert on the branch,
even with the --param in the PR, so instead I tested this by
forcing the hash function to only hash the tree code.  That made
the static assertion in the test fail without the patch but pass
with it.

This means that the tests pass for unmodified sources even
without the patch (unless you're very unlucky).

gcc/
PR target/95726
* config/aarch64/aarch64.c (aarch64_attribute_table): Add
"Advanced SIMD type".
* config/aarch64/aarch64-builtins.c: Include stringpool.h and
attribs.h.
(aarch64_init_simd_builtin_types): Add an "Advanced SIMD type"
attribute to each Advanced SIMD type.
* config/arm/arm.c (arm_attribute_table): Add "Advanced SIMD type".
* config/arm/arm-builtins.c: Include stringpool.h and attribs.h.
(arm_init_simd_builtin_types): Add an "Advanced SIMD type"
attribute to each Advanced SIMD type.

gcc/cp/
PR target/95726
* typeck.c (structural_comptypes): When comparing template
specializations, differentiate between vectors that have and
do not have an "Advanced SIMD type" attribute.

gcc/testsuite/
PR target/95726
* g++.target/aarch64/pr95726.C: New test.
* g++.target/arm/pr95726.C: Likewise.

5 years agofix _mm512_{,mask_}cmp*_p[ds]_mask at -O0 [PR96174]
Jakub Jelinek [Wed, 15 Jul 2020 09:34:44 +0000 (11:34 +0200)] 
fix _mm512_{,mask_}cmp*_p[ds]_mask at -O0 [PR96174]

The _mm512_{,mask_}cmp_p[ds]_mask and also _mm_{,mask_}cmp_s[ds]_mask
intrinsics have an argument which must have a constant passed to it
and so use an inline version only for ifdef __OPTIMIZE__ and have
a #define for -O0.  But the _mm512_{,mask_}cmp*_p[ds]_mask intrinsics
don't need a constant argument, they are essentially the first
set with the constant added to them implicitly based on the comparison
name, and so there is no #define version for them (correctly).
But their inline versions are defined in between the first and s[ds]
set and so inside of ifdef __OPTIMIZE__, which means that with -O0
they aren't defined at all.

This patch fixes that by moving those after the #ifdef __OPTIMIZE #else
use #define #endif block.

2020-07-15  Jakub Jelinek  <jakub@redhat.com>

PR target/96174
* config/i386/avx512fintrin.h (_mm512_cmpeq_pd_mask,
_mm512_mask_cmpeq_pd_mask, _mm512_cmplt_pd_mask,
_mm512_mask_cmplt_pd_mask, _mm512_cmple_pd_mask,
_mm512_mask_cmple_pd_mask, _mm512_cmpunord_pd_mask,
_mm512_mask_cmpunord_pd_mask, _mm512_cmpneq_pd_mask,
_mm512_mask_cmpneq_pd_mask, _mm512_cmpnlt_pd_mask,
_mm512_mask_cmpnlt_pd_mask, _mm512_cmpnle_pd_mask,
_mm512_mask_cmpnle_pd_mask, _mm512_cmpord_pd_mask,
_mm512_mask_cmpord_pd_mask, _mm512_cmpeq_ps_mask,
_mm512_mask_cmpeq_ps_mask, _mm512_cmplt_ps_mask,
_mm512_mask_cmplt_ps_mask, _mm512_cmple_ps_mask,
_mm512_mask_cmple_ps_mask, _mm512_cmpunord_ps_mask,
_mm512_mask_cmpunord_ps_mask, _mm512_cmpneq_ps_mask,
_mm512_mask_cmpneq_ps_mask, _mm512_cmpnlt_ps_mask,
_mm512_mask_cmpnlt_ps_mask, _mm512_cmpnle_ps_mask,
_mm512_mask_cmpnle_ps_mask, _mm512_cmpord_ps_mask,
_mm512_mask_cmpord_ps_mask): Move outside of __OPTIMIZE__ guarded
section.

* gcc.target/i386/avx512f-vcmppd-3.c: New test.
* gcc.target/i386/avx512f-vcmpps-3.c: New test.

(cherry picked from commit 12d69dbfff9dd5ad4a30b20d1636f5cab6425e8c)

5 years agoRevert "LTO: pick up -fcf-protection flag for the link step"
Richard Biener [Wed, 15 Jul 2020 07:26:08 +0000 (09:26 +0200)] 
Revert "LTO: pick up -fcf-protection flag for the link step"

This reverts commit 8147c741df97ee02aa64c099c6b360e6a93384e1.

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

PR bootstrap/96203
* lto-opts.c: Revert changes.
* lto-wrapper.c: Likewise.

5 years agoDaily bump.
GCC Administrator [Wed, 15 Jul 2020 00:17:09 +0000 (00:17 +0000)] 
Daily bump.

5 years agoc++: Make convert_like complain about bad ck_ref_bind again [PR95789]
Marek Polacek [Tue, 23 Jun 2020 01:26:49 +0000 (21:26 -0400)] 
c++: Make convert_like complain about bad ck_ref_bind again [PR95789]

convert_like issues errors about bad_p conversions at the beginning
of the function, but in the ck_ref_bind case, it only issues them
after we've called convert_like on the next conversion.

This doesn't work as expected since r10-7096 because when we see
a conversion from/to class type in a template, we return early, thereby
missing the error, and a bad_p conversion goes by undetected.  That
made the attached test to compile even though it should not.

I had thought that I could just move the ck_ref_bind/bad_p errors
above to the rest of them, but that regressed diagnostics because
expr then wasn't converted yet by the nested convert_like_real call.

So, for bad_p conversions, do the normal processing, but still return
the IMPLICIT_CONV_EXPR to avoid introducing trees that the template
processing can't handle well.  This I achieved by adding a wrapper
function.

gcc/cp/ChangeLog:

PR c++/95789
PR c++/96104
PR c++/96179
* call.c (convert_like_real_1): Renamed from convert_like_real.
(convert_like_real): New wrapper for convert_like_real_1.

gcc/testsuite/ChangeLog:

PR c++/95789
PR c++/96104
PR c++/96179
* g++.dg/conversion/ref4.C: New test.
* g++.dg/conversion/ref5.C: New test.
* g++.dg/conversion/ref6.C: New test.

(cherry picked from commit 8e64d182850560dbedfabb88aac90d4fc6155067)

5 years agolibgomp: Fix hang when profiling OpenACC programs with CUDA 9.0 nvprof
Kwok Cheung Yeung [Tue, 14 Jul 2020 17:31:35 +0000 (10:31 -0700)] 
libgomp: Fix hang when profiling OpenACC programs with CUDA 9.0 nvprof

The version of nvprof in CUDA 9.0 causes a hang when used to profile an
OpenACC program.  This is because it calls acc_get_device_type from
a callback called during device initialization, which then attempts
to acquire acc_device_lock while it is already taken, resulting in
deadlock.  This works around the issue by returning acc_device_none
from acc_get_device_type without attempting to acquire the lock when
initialization has not completed yet.

2020-07-14  Tom de Vries  <tom@codesourcery.com>
    Cesar Philippidis  <cesar@codesourcery.com>
    Thomas Schwinge  <thomas@codesourcery.com>
    Kwok Cheung Yeung  <kcy@codesourcery.com>

libgomp/
* oacc-init.c (acc_init_state_lock, acc_init_state, acc_init_thread):
New variable.
(acc_init_1): Set acc_init_thread to pthread_self ().  Set
acc_init_state to initializing at the start, and to initialized at the
end.
(self_initializing_p): New function.
(acc_get_device_type): Return acc_device_none if called by thread that
is currently executing acc_init_1.
* libgomp.texi (acc_get_device_type): Update documentation.
(Implementation Status and Implementation-Defined Behavior): Likewise.
* testsuite/libgomp.oacc-c-c++-common/acc_prof-init-2.c: New.

(cherry picked from commit b52643ab9004ba8ecea06a399885fe1e04183eda)

5 years agoipa-devirt: Fix crash in obj_type_ref_class [PR95114]
Richard Sandiford [Tue, 14 Jul 2020 18:24:57 +0000 (19:24 +0100)] 
ipa-devirt: Fix crash in obj_type_ref_class [PR95114]

The testcase has failed since r9-5035, because obj_type_ref_class
tries to look up an ODR type when no ODR type information is
available.  (The information was available earlier in the
compilation, but was freed during pass_ipa_free_lang_data.)
We then crash dereferencing the null get_odr_type result.

The test passes with -O2.  However, it fails again if -fdump-tree-all
is used, since obj_type_ref_class is called indirectly from the
dump routines.

Other code creates ODR type entries on the fly by passing “true”
as the insert parameter.  But obj_type_ref_class can't do that
unconditionally, since it should have no side-effects when used
from the dumping code.

Following a suggestion from Honza, this patch adds parameters
to say whether the routines are being called from dump routines
and uses those to derive the insert parameter.

gcc/
PR middle-end/95114
* tree.h (virtual_method_call_p): Add a default-false parameter
that indicates whether the function is being called from dump
routines.
(obj_type_ref_class): Likewise.
* tree.c (virtual_method_call_p): Likewise.
* ipa-devirt.c (obj_type_ref_class): Likewise.  Lazily add ODR
type information for the type when the parameter is false.
* tree-pretty-print.c (dump_generic_node): Update calls to
virtual_method_call_p and obj_type_ref_class accordingly.

gcc/testsuite/
PR middle-end/95114
* g++.target/aarch64/pr95114.C: New test.

5 years agovalue-range: Fix handling of POLY_INT_CST anti-ranges [PR96146]
Richard Sandiford [Tue, 14 Jul 2020 18:24:56 +0000 (19:24 +0100)] 
value-range: Fix handling of POLY_INT_CST anti-ranges [PR96146]

The range infrastructure has code to decompose POLY_INT_CST ranges
to worst-case integer bounds.  However, it had the fundamental flaw
(obvious in hindsight) that it applied to anti-ranges too, meaning
that a range 2+2X would end up with a range of ~[2, +INF], i.e.
[-INF, 1].  This patch decays to varying in that case instead.

I'm still a bit uneasy about this.  ISTM that in terms of
generality:

  SSA_NAME => POLY_INT_CST => INTEGER_CST
           => ADDR_EXPR

I.e. an SSA_NAME could store a POLY_INT_CST and a POLY_INT_CST
could store an INTEGER_CST (before canonicalisation).  POLY_INT_CST
is also “as constant as” ADDR_EXPR (well, OK, only some ADDR_EXPRs
are run-time rather than link-time constants, whereas all POLY_INT_CSTs
are, but still).  So it seems like we should at least be able to treat
POLY_INT_CST as symbolic.  On the other hand, I don't have any examples
in which that would be useful.

gcc/
PR tree-optimization/96146
* value-range.cc (value_range::set): Only decompose POLY_INT_CST
bounds to integers for VR_RANGE.  Decay to VR_VARYING for anti-ranges
involving POLY_INT_CSTs.

gcc/testsuite/
PR tree-optimization/96146
* gcc.target/aarch64/sve/acle/general/pr96146.c: New test.

5 years agoexpr: Unbreak build of mesa [PR96194]
Jakub Jelinek [Tue, 14 Jul 2020 14:01:11 +0000 (16:01 +0200)] 
expr: Unbreak build of mesa [PR96194]

> > The store to the whole of each volatile object was picked apart
> > like there had been an individual assignment to each of the
> > fields.  Reads were added as part of that; see PR for details.
> > The reads from volatile memory were a clear bug; individual
> > stores questionable.  A separate patch clarifies the docs.

This breaks building of mesa on both the trunk and 10 branch.

The problem is that the middle-end may never create temporaries of non-POD
(TREE_ADDRESSABLE) types, those can be only created when the language says
so and thus only the FE is allowed to create those.

This patch just reverts the behavior to what we used to do before for the
stores to volatile non-PODs.  Perhaps we want to do something else, but
definitely we can't create temporaries of the non-POD type.  It is up to
discussions on what should happen in those cases.

2020-07-14  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/96194
* expr.c (expand_constructor): Don't create temporary for store to
volatile MEM if exp has an addressable type.

* g++.dg/opt/pr96194.C: New test.

(cherry picked from commit b1d389d60d1929c7528ef984925ea010e3bf2c1a)

5 years agoLTO: pick up -fcf-protection flag for the link step
Matthias Klose [Tue, 14 Jul 2020 08:23:47 +0000 (10:23 +0200)] 
LTO: pick up -fcf-protection flag for the link step

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

PR lto/95604
* lto-wrapper.c (merge_and_complain): Add decoded options as parameter,
error on different values for -fcf-protection.
(append_compiler_options): Pass -fcf-protection option.
(find_and_merge_options): Add decoded options as parameter,
pass decoded_options to merge_and_complain.
(run_gcc): Pass decoded options to find_and_merge_options.
* lto-opts.c (lto_write_options): Pass -fcf-protection option.

(cherry picked from commit 6a48d12475cdb7375b98277f8bc089715feeeafe)

5 years agoDaily bump.
GCC Administrator [Tue, 14 Jul 2020 00:17:08 +0000 (00:17 +0000)] 
Daily bump.

5 years agors6000: clean up testsuite power10_hw check
Aaron Sawdey [Mon, 13 Jul 2020 21:19:33 +0000 (16:19 -0500)] 
rs6000: clean up testsuite power10_hw check

Because the check for power10_hw is not called
check_effective_target_power10_hw, it needs to be looked
for by is-effective-target-keyword. Also reorder things
in is-effective-target to put power10_hw with the other
ppc stuff.

2020-07-13  Aaron Sawdey  <acsawdey@linux.ibm.com>

gcc/testsuite/

* lib/target-supports.exp (is-effective-target):
Reorder to put powerpc stuff together.
(is-effective-target-keyword): Add power10_hw.

(cherry picked from commit 94c7c67b82dd7255fde0d7ae42d483336ea1b60b)

5 years agors6000: add effective-target test ppc_mma_hw
Aaron Sawdey [Fri, 10 Jul 2020 22:46:17 +0000 (17:46 -0500)] 
rs6000: add effective-target test ppc_mma_hw

Add a test for dejagnu to determine if execution of MMA instructions is
supported in the test environment. Add an execution test to make sure
that __builtin_cpu_supports("mma") is true if we can execute MMA
instructions.

2020-07-13  Aaron Sawdey  <acsawdey@linux.ibm.com>

gcc/testsuite/

* lib/target-supports.exp (check_ppc_mma_hw_available):
New function.
(is-effective-target): Add ppc_mma_hw.
(is-effective-target-keyword): Add ppc_mma_hw.
* gcc.target/powerpc/mma-supported.c: New file.
* gcc.target/powerpc/mma-single-test.c: Require ppc_mma_hw.
* gcc.target/powerpc/mma-double-test.c: Require ppc_mma_hw.

(cherry picked from commit 305ab735bd40b52a451851fa6e2177f184eb05d4)

5 years agoaarch64: Add missing ACLE support for PAC-RET
Szabolcs Nagy [Thu, 2 Jul 2020 15:11:04 +0000 (16:11 +0100)] 
aarch64: Add missing ACLE support for PAC-RET

Define the __ARM_FEATURE_PAC_DEFAULT feature test
macro when PAC-RET branch protection is enabled.

2020-07-13  Szabolcs Nagy  <szabolcs.nagy@arm.com>

gcc/ChangeLog:

* config/aarch64/aarch64-c.c (aarch64_update_cpp_builtins): Add
__ARM_FEATURE_PAC_DEFAULT support.

(cherry picked from commit a1faa8e2470b33e92f6274804bf7941fbb6e2d38)

5 years agodoc: Clarify __builtin_return_address [PR94891]
Szabolcs Nagy [Thu, 28 May 2020 09:28:30 +0000 (10:28 +0100)] 
doc: Clarify __builtin_return_address [PR94891]

The expected semantics and valid usage of __builtin_return_address is
not clear since it exposes implementation internals that are normally
not meaningful to portable c code.

This documentation change tries to clarify the semantics in case the
return address is stored in a mangled form. This affects AArch64 when
pointer authentication is used for the return address signing (i.e.
-mbranch-protection=pac-ret).

2020-07-13  Szabolcs Nagy  <szabolcs.nagy@arm.com>

gcc/ChangeLog:

PR target/94891
* doc/extend.texi: Update the text for  __builtin_return_address.

(cherry picked from commit 6a391e06f953c3390b14020d8cacb6d55f81b2b9)

5 years agolibgcc: fix the handling of return address mangling [PR94891]
Szabolcs Nagy [Thu, 4 Jun 2020 08:33:35 +0000 (09:33 +0100)] 
libgcc: fix the handling of return address mangling [PR94891]

Mangling, currently only used on AArch64 for return address signing,
is an internal representation that should not be exposed via

  __builtin_return_address return value,
  __builtin_eh_return handler argument,
  _Unwind_DebugHook handler argument.

Note that a mangled address might not even fit into a void *, e.g.
with AArch64 ilp32 ABI the return address is stored as 64bit, so
the mangled return address cannot be accessed via _Unwind_GetPtr.

This patch changes the unwinder hooks as follows:

MD_POST_EXTRACT_ROOT_ADDR is removed: root address comes from
__builtin_return_address which is not mangled.

MD_POST_EXTRACT_FRAME_ADDR is renamed to MD_DEMANGLE_RETURN_ADDR,
it now operates on _Unwind_Word instead of void *, so the hook
should work when return address signing is enabled on AArch64 ilp32.
(But for that __builtin_aarch64_autia1716 should be fixed to operate
on 64bit input instead of a void *.)

MD_POST_FROB_EH_HANDLER_ADDR is removed: it is the responsibility of
__builtin_eh_return to do the mangling if necessary.

2020-07-13  Szabolcs Nagy  <szabolcs.nagy@arm.com>

libgcc/ChangeLog:

PR target/94891
* config/aarch64/aarch64-unwind.h (MD_POST_EXTRACT_ROOT_ADDR): Remove.
(MD_POST_FROB_EH_HANDLER_ADDR): Remove.
(MD_POST_EXTRACT_FRAME_ADDR): Rename to ...
(MD_DEMANGLE_RETURN_ADDR): This.
(aarch64_post_extract_frame_addr): Rename to ...
(aarch64_demangle_return_addr): This.
(aarch64_post_frob_eh_handler_addr): Remove.
* unwind-dw2.c (uw_update_context): Demangle return address.
(uw_frob_return_addr): Remove.

(cherry picked from commit b097c7a27fb0796b2653a1d003cbf6b7a69d8961)

5 years agoaarch64: fix __builtin_eh_return with pac-ret [PR94891]
Szabolcs Nagy [Thu, 4 Jun 2020 12:42:16 +0000 (13:42 +0100)] 
aarch64: fix __builtin_eh_return with pac-ret [PR94891]

Currently __builtin_eh_return takes a signed return address, which can
cause ABI and API issues: 1) pointer representation problems if the
address is passed around before eh return, 2) the source code needs
pac-ret specific changes and needs to know if pac-ret is used in the
current frame, 3) signed address may not be representible as void *
(with ilp32 abi).

Using address signing to protect eh return is ineffective because the
instruction sequence in the unwinder that starts from the address
signing and ends with a ret can be used as a return to anywhere gadget.
Using indirect branch istead of ret with bti j landing pads at the
target can reduce the potential of such gadget, which also implies
that __builtin_eh_return should not take a signed address.

This is a big hammer fix to the ABI and API issues: it turns pac-ret
off for the caller completely (not just on the eh return path).  To
harden the caller against ROP attacks, it should use indirect branch
instead of ret, this is not attempted so the patch remains small and
backportable.

2020-07-13  Szabolcs Nagy  <szabolcs.nagy@arm.com>

gcc/ChangeLog:

PR target/94891
* config/aarch64/aarch64.c (aarch64_return_address_signing_enabled):
Disable return address signing if __builtin_eh_return is used.

gcc/testsuite/ChangeLog:

PR target/94891
* gcc.target/aarch64/return_address_sign_1.c: Update test.
* gcc.target/aarch64/return_address_sign_b_1.c: Likewise.

(cherry picked from commit 2bc95be3bb8c8138e2e87c1c11c84bfede989d61)

5 years agoaarch64: fix return address access with pac [PR94891][PR94791]
Szabolcs Nagy [Tue, 2 Jun 2020 15:44:41 +0000 (16:44 +0100)] 
aarch64: fix return address access with pac [PR94891][PR94791]

This is a big hammer fix for __builtin_return_address (PR target/94891)
returning signed addresses (sometimes, depending on wether lr happens
to be signed or not at the time of call which depends on optimizations),
and similarly -pg may pass signed return address to _mcount
(PR target/94791).

At the time of return address expansion we don't know if it's signed or
not so it is done unconditionally.

2020-07-13  Szabolcs Nagy  <szabolcs.nagy@arm.com>

gcc/ChangeLog:

PR target/94891
PR target/94791
* config/aarch64/aarch64-protos.h (aarch64_return_addr_rtx): Declare.
* config/aarch64/aarch64.c (aarch64_return_addr_rtx): New.
(aarch64_return_addr): Use aarch64_return_addr_rtx.
* config/aarch64/aarch64.h (PROFILE_HOOK): Likewise.

(cherry picked from commit 463a54e5d4956143f81c1f23b91cbd2d93855741)

5 years agoaarch64: Fix BTI support in libitm
Szabolcs Nagy [Thu, 2 Jul 2020 16:12:05 +0000 (17:12 +0100)] 
aarch64: Fix BTI support in libitm

sjlj.S did not have the GNU property note markup and the BTI c
instructions that are necessary when it is built with branch
protection.

The notes are only added when libitm is built with branch
protection, because old linkers mishandle the note (merge
them incorrectly or emit warnings), the BTI instructions
are added unconditionally.

2020-07-09  Szabolcs Nagy  <szabolcs.nagy@arm.com>

libitm/ChangeLog:

* config/aarch64/sjlj.S: Add BTI marking and related definitions,
and add BTI c to function entries.

(cherry picked from commit 319078dad62eba942d33c8975bdcbb09d1c68ba6)

5 years agoaarch64: Fix BTI support in libgcc [PR96001]
Szabolcs Nagy [Thu, 2 Jul 2020 16:11:56 +0000 (17:11 +0100)] 
aarch64: Fix BTI support in libgcc [PR96001]

lse.S did not have the GNU property note markup and the BTI c
instructions that are necessary when it is built with branch
protection.

The notes are only added when libgcc is built with branch
protection, because old linkers mishandle the note (merge
them incorrectly or emit warnings), the BTI instructions
are added unconditionally.

Note: BTI c is only necessary at function entry if the function
may be called indirectly, currently lse functions are not called
indirectly, but BTI is added for ABI reasons e.g. to allow
linkers later to emit stub code with indirect jump.

2020-07-09  Szabolcs Nagy  <szabolcs.nagy@arm.com>

libgcc/ChangeLog:

PR target/96001
* config/aarch64/lse.S: Add BTI marking and related definitions,
and add BTI c to function entries.

(cherry picked from commit f0f62fa0320762119446893c67cb52934bc5a05e)

5 years agoaarch64: Fix noexecstack note in libgcc
Szabolcs Nagy [Fri, 3 Jul 2020 13:11:49 +0000 (14:11 +0100)] 
aarch64: Fix noexecstack note in libgcc

lse.S did not have GNU stack note, this may cause missing
PT_GNU_STACK in binaries on Linux and FreeBSD.

2020-07-09  Szabolcs Nagy  <szabolcs.nagy@arm.com>

libgcc/ChangeLog:

* config/aarch64/lse.S: Add stack note.

(cherry picked from commit e73ec755489afc9fcc75dfac6f06ac73e243e72a)

5 years agoaarch64: Fix noexecstack note in libitm
Szabolcs Nagy [Fri, 3 Jul 2020 13:09:25 +0000 (14:09 +0100)] 
aarch64: Fix noexecstack note in libitm

sjlj.S only had the note on Linux, but it is supposed
to have it on FreeBSD too.

2020-07-09  Szabolcs Nagy  <szabolcs.nagy@arm.com>

libitm/ChangeLog:

* config/aarch64/sjlj.S: Add stack note if __FreeBSD__ is defined.

(cherry picked from commit 463ba375f7b857995068403a4c63690d03162c00)

5 years agoaarch64: Add missing ACLE support for BTI
Szabolcs Nagy [Thu, 2 Jul 2020 15:04:51 +0000 (16:04 +0100)] 
aarch64: Add missing ACLE support for BTI

Define the __ARM_FEATURE_BTI_DEFAULT feature test
macro when BTI branch protection is enabled.

2020-07-09  Szabolcs Nagy  <szabolcs.nagy@arm.com>

gcc/ChangeLog:

* config/aarch64/aarch64-c.c (aarch64_update_cpp_builtins): Add
__ARM_FEATURE_BTI_DEFAULT support.

(cherry picked from commit 63b6808e69699ba576492efa29d92b626cc26eba)

5 years agoopenacc: Don't strip TO_PSET/POINTER for enter/exit data
Julian Brown [Fri, 5 Jun 2020 21:46:41 +0000 (14:46 -0700)] 
openacc: Don't strip TO_PSET/POINTER for enter/exit data

OpenACC 2.6 specifies that the array descriptor (when present) must be
copied to the target before attaching pointers in Fortran. This patch
reverses the stripping of GOMP_MAP_TO_PSET and GOMP_MAP_POINTER that
was introduced by the "OpenACC reference count overhaul" patch.

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

gcc/
* gimplify.c (gimplify_scan_omp_clauses): Do not strip
GOMP_MAP_TO_PSET/GOMP_MAP_POINTER for OpenACC enter/exit data
directives (see also PR92929).

gcc/testsuite/
* gfortran.dg/goacc/finalize-1.f: Update expected dump output.

libgomp/
* testsuite/libgomp.oacc-fortran/dynamic-pointer-1.f90: New test.

Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
(cherry picked from commit b20097c65d2e74b1901fba1c55c77f0407e542d2)

5 years agoopenacc: Adjust dynamic reference count semantics
Julian Brown [Fri, 22 May 2020 11:06:10 +0000 (04:06 -0700)] 
openacc: Adjust dynamic reference count semantics

This patch adjusts how dynamic reference counts work so that they match
the semantics of the source program more closely, instead of representing
"excess" reference counts beyond those that represent pointers in the
internal libgomp splay-tree data structure. This allows some corner
cases to be handled more gracefully.

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

libgomp/
* libgomp.h (struct splay_tree_key_s): Change virtual_refcount to
dynamic_refcount.
(struct gomp_device_descr): Remove GOMP_MAP_VARS_OPENACC_ENTER_DATA.
* oacc-mem.c (acc_map_data): Substitute virtual_refcount for
dynamic_refcount.
(acc_unmap_data): Update comment.
(goacc_map_var_existing, goacc_enter_datum): Adjust for
dynamic_refcount semantics.
(goacc_exit_datum_1, goacc_exit_datum): Re-add some error checking.
Adjust for dynamic_refcount semantics.
(goacc_enter_data_internal): Implement "present" case of dynamic
memory-map handling here.  Update "non-present" case for
dynamic_refcount semantics.
(goacc_exit_data_internal): Use goacc_exit_datum_1.
* target.c (gomp_map_vars_internal): Remove
GOMP_MAP_VARS_OPENACC_ENTER_DATA handling.  Update for dynamic_refcount
handling.
(gomp_unmap_vars_internal): Remove virtual_refcount handling.
(gomp_load_image_to_device): Substitute dynamic_refcount for
virtual_refcount.
* testsuite/libgomp.oacc-c-c++-common/pr92843-1.c: Remove XFAILs.
* testsuite/libgomp.oacc-c-c++-common/refcounting-1.c: New test.
* testsuite/libgomp.oacc-c-c++-common/refcounting-2.c: New test.
* testsuite/libgomp.oacc-c-c++-common/struct-3-1-1.c: New test.
* testsuite/libgomp.oacc-fortran/deep-copy-6.f90: Remove XFAILs and
trace output.
* testsuite/libgomp.oacc-fortran/deep-copy-6-no_finalize.F90: Remove
trace output.
* testsuite/libgomp.oacc-fortran/dynamic-incr-structural-1.f90: New
test.
* testsuite/libgomp.oacc-c-c++-common/structured-dynamic-lifetimes-4.c:
Remove stale comment.
* testsuite/libgomp.oacc-fortran/mdc-refcount-1-1-1.f90: Remove XFAILs.
* testsuite/libgomp.oacc-fortran/mdc-refcount-1-1-2.F90: Likewise.
* testsuite/libgomp.oacc-fortran/mdc-refcount-1-2-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/mdc-refcount-1-2-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/mdc-refcount-1-3-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/mdc-refcount-1-4-1.f90: Adjust XFAIL.

Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
(cherry picked from commit 6f5b4b64d25a36f085ab90efc3d54c025a7fff49)

5 years agoopenacc: Helper functions for enter/exit data using single mapping
Julian Brown [Tue, 30 Jun 2020 09:15:56 +0000 (02:15 -0700)] 
openacc: Helper functions for enter/exit data using single mapping

This patch factors out the parts of goacc_enter_datum and
goacc_exit_datum that can be shared with goacc_enter_data_internal
and goacc_exit_data_internal respectively (in the next patch),
without overloading function return values or complicating code paths
unnecessarily.

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

libgomp/
* oacc-mem.c (goacc_map_var_existing): New function.
(goacc_enter_datum): Use above function.
(goacc_exit_datum_1): New function.
(goacc_exit_datum): Use above function.

Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
(cherry picked from commit cb7effde6f36b43d50c8cd7f86eaa05937da7205)

5 years agoopenacc: Set bias to zero for explicit attach/detach clauses in C and C++
Julian Brown [Tue, 9 Jun 2020 13:21:34 +0000 (06:21 -0700)] 
openacc: Set bias to zero for explicit attach/detach clauses in C and C++

This is a fix for the pointer (or array) size inadvertently being used
for the bias with attach and detach mapping kinds, for both C and C++.

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

gcc/c/
PR middle-end/95270
* c-typeck.c (c_finish_omp_clauses): Set OMP_CLAUSE_SIZE (bias) to zero
for standalone attach/detach clauses.

gcc/cp/
PR middle-end/95270
* semantics.c (finish_omp_clauses): Likewise.

include/
PR middle-end/95270
* gomp-constants.h (gomp_map_kind): Expand comment for attach/detach
mapping kinds.

gcc/testsuite/
PR middle-end/95270
* c-c++-common/goacc/mdc-1.c: Update expected dump output for zero
bias.

libgomp/
PR middle-end/95270
* testsuite/libgomp.oacc-c-c++-common/pr95270-1.c: New test.
* testsuite/libgomp.oacc-c-c++-common/pr95270-2.c: New test.

(cherry picked from commit 0d00fe404c162ad0cf922ca8455aa23a74042b63)

5 years agoopenacc: GOMP_MAP_ATTACH handling in find_group_last
Julian Brown [Thu, 11 Jun 2020 13:43:59 +0000 (06:43 -0700)] 
openacc: GOMP_MAP_ATTACH handling in find_group_last

Arrange for GOMP_MAP_ATTACH to be grouped together with a preceding
GOMP_MAP_TO_PSET or other "to" data movement clause, except in cases
where an explicit "attach" clause is used.

2020-07-09  Julian Brown  <julian@codesourcery.com>

include/
* gomp-constants.h (gomp_map_kind): Update comment for GOMP_MAP_TO_PSET.

libgomp/
* oacc-mem.c (find_group_last): Group data-movement clauses
(GOMP_MAP_TO_PSET, GOMP_MAP_TO, etc.) together with a subsequent
GOMP_MAP_ATTACH.  Allow standalone GOMP_MAP_ATTACH also.

(cherry picked from commit 8d2e5026d22b3f30e7df7adfd4ebf4ebc1e77e2d)

5 years agoopenacc: Fortran derived-type mapping fix
Julian Brown [Wed, 3 Jun 2020 21:25:19 +0000 (14:25 -0700)] 
openacc: Fortran derived-type mapping fix

Fix a bug with mapping Fortran components which themselves have derived
types in the OpenACC 2.5+ manual deep-copy support.

2020-07-09  Julian Brown  <julian@codesourcery.com>

gcc/fortran/
* trans-openmp.c (gfc_trans_omp_clauses): Use 'inner' not 'decl' for
derived type members which themselves have derived types.

gcc/testsuite/
* gfortran.dg/goacc/mapping-tests-3.f90: New test.
* gfortran.dg/goacc/mapping-tests-4.f90: New test.

(cherry picked from commit ac8996edb14eef0a15cd0ce850fde2be5e227e69)

5 years agoipa-fnsummary: Fix ICE with switch predicates [PR96130]
Jakub Jelinek [Mon, 13 Jul 2020 16:25:53 +0000 (18:25 +0200)] 
ipa-fnsummary: Fix ICE with switch predicates [PR96130]

The following testcase ICEs since r10-3199.
There is a switch with default label, where the controlling expression has
range just 0..7 and there are case labels for all those 8 values, but
nothing has yet optimized away the default.
Since r10-3199, set_switch_stmt_execution_predicate sets the switch to
default label's edge's predicate to a false predicate and then
compute_bb_predicates propagates the predicates through the cfg, but false
predicates aren't really added.  The caller of compute_bb_predicates
in one place handles NULL bb->aux as false predicate:
      if (fbi.info)
{
  if (bb->aux)
    bb_predicate = *(predicate *) bb->aux;
  else
    bb_predicate = false;
}
      else
bb_predicate = true;
but then in two further spots that the patch below is changing
it assumes bb->aux must be non-NULL.  Those two spots are guarded by a
condition that is only true if fbi.info is non-NULL, so I think the right
fix is to treat NULL aux as false predicate in those spots too.

2020-07-13  Jakub Jelinek  <jakub@redhat.com>

PR ipa/96130
* ipa-fnsummary.c (analyze_function_body): Treat NULL bb->aux
as false predicate.

* gcc.dg/torture/pr96130.c: New test.

(cherry picked from commit 776e48e0931db69f158f40e5cb8e15463d879a42)

5 years agoAvoid printing informational notes when -Wmismatched-tags is suppressed in system...
Martin Sebor [Mon, 13 Jul 2020 15:32:40 +0000 (09:32 -0600)] 
Avoid printing informational notes when -Wmismatched-tags is suppressed in system headers (PR c++/96063)

Related:
PR c++/96063 - mismatched-tags warnings in stdlib headers

gcc/cp/ChangeLog:

PR c++/96063
* parser.c (class_decl_loc_t::diag_mismatched_tags): Print notes only
if warning_at returns nonzero.

gcc/testsuite/ChangeLog:

PR c++/96063
* g++.dg/warn/Wmismatched-tags-7.C: New test.
* g++.dg/warn/Wmismatched-tags-8.C: New test.

5 years agoc++: Fix tentative parsing of enum-specifier [PR96077]
Marek Polacek [Fri, 10 Jul 2020 00:44:05 +0000 (20:44 -0400)] 
c++: Fix tentative parsing of enum-specifier [PR96077]

Here's an interesting issue: in this code a ) is missing:

  enum { E = (2 } e;

but we compile the code anyway, and E is set to 0 in build_enumerator,
which is sneaky.

The problem is that cp_parser_enum_specifier parses tentatively, because
when we see the enum keyword, we don't know yet if we'll find an
enum-specifier, opaque-enum-declaration, or elaborated-enum-specifier.

In this test when we call cp_parser_enumerator_list we're still parsing
tentatively, and as a consequence, parens.require_close (parser) in
cp_parser_primary_expression doesn't report any errors.  But we only go
on to parse the enumerator-list after we've seen a {, at which point we
might as well commit -- we know we're dealing with an enum-specifier.

gcc/cp/ChangeLog:

PR c++/96077
* parser.c (cp_parser_enum_specifier): Commit to tentative parse
after we've seen an opening brace.

gcc/testsuite/ChangeLog:

PR c++/96077
* g++.dg/parse/enum14.C: New test.

(cherry picked from commit 4fd124a23664c712f1bb1a7e91fa23fe83d72c0b)

5 years agofix global variable alignment for testcase gcc.dg/torture/pr96133.c
Richard Biener [Mon, 13 Jul 2020 09:41:16 +0000 (11:41 +0200)] 
fix global variable alignment for testcase gcc.dg/torture/pr96133.c

The testcase was errorneously accessing the global variable via a
type that might require bigger alignment than provided.  Fix that
via an appropriate attribute.

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

PR testsuite/96180
* gcc.dg/torture/pr96133.c: Align global variable.

(cherry picked from commit 7a4770f0394751860ee54520b23007938907ac33)

5 years agoPR94600: fix volatile access to the whole of a compound object.
Hans-Peter Nilsson [Sun, 5 Jul 2020 18:50:52 +0000 (20:50 +0200)] 
PR94600: fix volatile access to the whole of a compound object.

The store to the whole of each volatile object was picked apart
like there had been an individual assignment to each of the
fields.  Reads were added as part of that; see PR for details.
The reads from volatile memory were a clear bug; individual
stores questionable.  A separate patch clarifies the docs.

gcc:

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

PR middle-end/94600
* expr.c (expand_constructor): Make a temporary also if we're
storing to volatile memory.

gcc/testsuite:

2020-07-09  Hans-Peter Nilsson  <hp@axis.com>

PR middle-end/94600
* gcc.dg/pr94600-1.c, gcc.dg/pr94600-2.c, gcc.dg/pr94600-3.c,
gcc.dg/pr94600-4.c, gcc.dg/pr94600-5.c, gcc.dg/pr94600-6.c,
gcc.dg/pr94600-7.c, gcc.dg/pr94600-8.c: New tests.

(cherry picked from commit a4aca1edaf37d43b2b7e9111825837a7a317b1b0)

5 years agoDaily bump.
GCC Administrator [Mon, 13 Jul 2020 00:16:52 +0000 (00:16 +0000)] 
Daily bump.

5 years agotree-cfg: Fix ICE with switch stmt to unreachable opt and forced labels [PR95857]
Jakub Jelinek [Thu, 2 Jul 2020 09:38:20 +0000 (11:38 +0200)] 
tree-cfg: Fix ICE with switch stmt to unreachable opt and forced labels [PR95857]

The following testcase ICEs, because during the cfg cleanup, we see:
  switch (i$e_11) <default: <L12> [33.33%], case -3: <lab2> [33.33%], case 0: <L10> [33.33%], case 2: <lab2> [33.33%]>
...
lab2:
  __builtin_unreachable ();
where lab2 is FORCED_LABEL.  The way it works, we go through the case labels
and when we reach the first one that points to gimple_seq_unreachable*
basic block, we remove the edge (if any) from the switch bb to the bb
containing the label and bbs reachable only through that edge we've just
removed.  Once we do that, we must throw away all other cases that use
the same label (or some other labels from the same bb we've removed the edge
to and the bb).  To avoid quadratic behavior, this is not done by walking
all remaining cases immediately before removing, but only when processing
them later.
For normal labels this works, fine, if the label is in a deleted bb, it will
have NULL label_to_block and we handle that case, or, if the unreachable bb
has some other edge to it, only the edge will be removed and not the bb,
and again, find_edge will not find the edge and we only remove the case.
And if a label would be to some other block, that other block wouldn't have
been removed earlier because there would be still an edge from the switch
block.
Now, FORCED_LABEL (and I think DECL_NONLOCAL too) break this, because
those labels aren't removed, but instead moved to some surrounding basic
block.  So, when we later process those, when their gimple_seq_unreachable*
basic block is removed, label_to_block will return some unrelated block
(in the testcase the switch bb), so we decide to keep the case which doesn't
seem to be unreachable, but we don't really have an edge from the switch
block to the block the label got moved to.

I thought first about punting in gimple_seq_unreachable* on
FORCED_LABEL/DECL_NONLOCAL labels, but that might penalize even code that
doesn't care, so this instead just makes sure that for
FORCED_LABEL/DECL_NONLOCAL labels that are being removed (and thus moved
randomly) we remember in a hash_set the fact that those labels should be
treated as removed for the purpose of the optimization, and later on
handle those labels that way.

2020-07-02  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/95857
* tree-cfg.c (group_case_labels_stmt): When removing an unreachable
base_bb, remember all forced and non-local labels on it and later
treat those as if they have NULL label_to_block.  Formatting fix.
Fix a comment typo.

* gcc.dg/pr95857.c: New test.

(cherry picked from commit 00f24f56732861d09a9716fa5b6b8a96c2289143)

5 years agoDaily bump.
GCC Administrator [Sun, 12 Jul 2020 00:16:53 +0000 (00:16 +0000)] 
Daily bump.

5 years agoDaily bump.
GCC Administrator [Sat, 11 Jul 2020 00:17:06 +0000 (00:17 +0000)] 
Daily bump.

5 years agors6000: Fix __builtin_altivec_mask_for_load to use correct type
Bill Seurer [Fri, 10 Jul 2020 22:30:26 +0000 (17:30 -0500)] 
rs6000: Fix __builtin_altivec_mask_for_load to use correct type

gcc/ChangeLog:

PR target/95581
* config/rs6000/rs6000-call.c: Add new type v16qi_ftype_pcvoid.
(altivec_init_builtins) Change __builtin_altivec_mask_for_load to use
v16qi_ftype_pcvoid with correct number of parameters.

(cherry picked from commit c6b7ba5de624f2a17d799bac5ff017cd065ce035)