gcc.git
3 years ago[Ada] Fix style and typos in code for expanding attribute references
Piotr Trojanek [Fri, 9 Oct 2020 11:59:04 +0000 (13:59 +0200)]
[Ada] Fix style and typos in code for expanding attribute references

gcc/ada/

* exp_attr.adb, exp_util.adb: Fix style and typos in comments.

3 years ago[Ada] Minor refine type of a counter variable
Piotr Trojanek [Fri, 9 Oct 2020 07:59:22 +0000 (09:59 +0200)]
[Ada] Minor refine type of a counter variable

gcc/ada/

* exp_attr.adb (Expand_N_Attribute_Reference): A variable that
is only incremented in the code has now type Nat; conversion is
now unnecessary.

3 years agoarm: Add test that was missing from old commit [PR91816]
Stam Markianos-Wright [Wed, 25 Nov 2020 12:50:06 +0000 (12:50 +0000)]
arm: Add test that was missing from old commit [PR91816]

A while back I submitted GCC10 commit:

 44f77a6dea2f312ee1743f3dde465c1b8453ee13

for PR91816.

Turns out I was an idiot and forgot to include the test in the actual git commit.

Tested that the test still passes on a cross arm-none-eabi and also in a
Cortex A-15 bootstrap with no regressions.

gcc/testsuite/ChangeLog:
PR target/91816
* gcc.target/arm/pr91816.c: New test.

3 years agolibstdc++: Fix silly typos [PR 97936]
Jonathan Wakely [Wed, 25 Nov 2020 12:16:07 +0000 (12:16 +0000)]
libstdc++: Fix silly typos [PR 97936]

libstdc++-v3/ChangeLog:

PR libstdc++/97936
* include/bits/atomic_wait.h (__platform_wait): Check errno,
not just the value of EAGAIN.
(__waiters::__waiters()): Fix name of data member.

3 years agolibstdc++: Fix handling of futex wake [PR 97936]
Jonathan Wakely [Wed, 25 Nov 2020 10:26:09 +0000 (10:26 +0000)]
libstdc++: Fix handling of futex wake [PR 97936]

The __platform_wait function is supposed to wait until *addr != old.
The futex syscall checks the initial value and returns EAGAIN if *addr
!= old is already true, which should cause __platform_wait to return.
Instead it loops and keeps doing a futex wait, which keeps returning
EAGAIN.

libstdc++-v3/ChangeLog:

PR libstdc++/97936
* include/bits/atomic_wait.h (__platform_wait): Return if futex
sets EAGAIN.
* testsuite/30_threads/latch/3.cc: Re-enable test.
* testsuite/30_threads/semaphore/try_acquire_until.cc: Likewise.

3 years agomiddle-end: Reject flexible array members in __builtin_clear_padding [PR97943]
Jakub Jelinek [Wed, 25 Nov 2020 09:37:58 +0000 (10:37 +0100)]
middle-end: Reject flexible array members in __builtin_clear_padding [PR97943]

As mentioned in the PR, we currently ICE on flexible array members in
structs and unions during __builtin_clear_padding processing.

Jason said in the PR he'd prefer an error in these cases over forcefully
handling it as [0] arrays (everything is padding then) or consider the
arrays to have as many whole elements as would fit into the tail padding.

So, this patch implements that.

2020-11-25  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/97943
* gimple-fold.c (clear_padding_union, clear_padding_type): Error on and
ignore flexible array member fields.  Ignore fields with
error_mark_node type.

* c-c++-common/builtin-clear-padding-2.c: New test.
* c-c++-common/builtin-clear-padding-3.c: New test.
* g++.dg/ext/builtin-clear-padding-1.C: New test.
* gcc.dg/builtin-clear-padding-2.c: New test.

3 years agoDaily bump.
GCC Administrator [Wed, 25 Nov 2020 09:34:01 +0000 (09:34 +0000)]
Daily bump.

3 years agochangelog: fix parsing of a revert commit
Martin Liska [Wed, 25 Nov 2020 06:56:57 +0000 (07:56 +0100)]
changelog: fix parsing of a revert commit

contrib/ChangeLog:

* gcc-changelog/git_commit.py: Use revert_regex instead
of string prefix.  Convert sets to literals.

3 years agolibstdc++: Disable failing tests [PR 97936]
Jonathan Wakely [Tue, 24 Nov 2020 23:22:01 +0000 (23:22 +0000)]
libstdc++: Disable failing tests [PR 97936]

These tests are unstable and causing failures due to timeouts. Disable
them until the cause can be found, so that testing doesn't have to wait
for them to timeout.

libstdc++-v3/ChangeLog:

PR libstdc++/97936
PR libstdc++/97944
* testsuite/29_atomics/atomic_integral/wait_notify.cc: Disable.
Do not require pthreads, but add -pthread when appropriate.
* testsuite/30_threads/jthread/95989.cc: Likewise.
* testsuite/30_threads/latch/3.cc: Likewise.
* testsuite/30_threads/semaphore/try_acquire_until.cc: Likewise.

3 years agoPR c/97955 - ICE in build_array_type_1 on invalid redeclaration of function with...
Martin Sebor [Tue, 24 Nov 2020 22:23:57 +0000 (15:23 -0700)]
PR c/97955 - ICE in build_array_type_1 on invalid redeclaration of function with VLA parameter

gcc/c-family/ChangeLog:

* c-warn.c (warn_parm_array_mismatch): Avoid invalid redeclarations.

gcc/testsuite/ChangeLog:

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

3 years agoAdd a note.
Martin Sebor [Tue, 24 Nov 2020 20:28:55 +0000 (13:28 -0700)]
Add a note.

gcc/testsuite/ChangeLog:
* gcc.dg/Wstringop-overflow-47.c: Add a note.

3 years agoc++: ICE with int{} in template. [PR97899]
Jason Merrill [Fri, 20 Nov 2020 21:50:20 +0000 (16:50 -0500)]
c++: ICE with int{} in template. [PR97899]

split_nonconstant_init_1 was confused by a CONSTRUCTOR with non-aggregate
type, which (with COMPOUND_LITERAL_P set) we use in a template to represent
a braced functional cast.  It seems to me that there's no good reason to do
split_nonconstant_init at all in a template.

gcc/cp/ChangeLog:

PR c++/97899
* typeck2.c (store_init_value): Don't split_nonconstant_init in a
template.

gcc/testsuite/ChangeLog:

PR c++/97899
* g++.dg/cpp0x/initlist-template3.C: New test.

3 years agoRevert: "Fix -ffast-math flags handling inconsistencies"
Ulrich Weigand [Tue, 24 Nov 2020 18:30:01 +0000 (19:30 +0100)]
Revert: "Fix -ffast-math flags handling inconsistencies"

This reverts commit c4fa3728ab4f78984a549894e0e8c4d6a253e540,
which caused a regression in the default for flag_excess_precision.

2020-11-24  Ulrich Weigand  <uweigand@de.ibm.com>

gcc/
PR tree-optimization/97970
* doc/invoke.texi (-ffast-math): Revert last change.
* opts.c: Revert last change.

3 years agoAdjust regex pattern to expect an additional attribute and function return type
Martin Sebor [Tue, 24 Nov 2020 16:57:40 +0000 (09:57 -0700)]
Adjust regex pattern to expect an additional attribute and function return type

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/declare-target-4.f90: Adjust pattern to expect
an additional attribute and function return type.

3 years ago[PR97933] LRA: find correctly last empty dest block.
Vladimir N. Makarov [Tue, 24 Nov 2020 16:25:16 +0000 (11:25 -0500)]
[PR97933] LRA: find correctly last empty dest block.

gcc/

2020-11-24  Vladimir Makarov  <vmakarov@redhat.com>

PR bootstrap/97933
* lra.c (lra_process_new_insns): Stop on the first real insn after
head of e->dest.

3 years agoarm: correctly handle negating INT_MIN in arm_split_atomic_op [PR97534]
Richard Earnshaw [Tue, 24 Nov 2020 16:21:17 +0000 (16:21 +0000)]
arm: correctly handle negating INT_MIN in arm_split_atomic_op [PR97534]

arm_split_atomic_op handles subtracting a constant by converting it
into addition of the negated constant.  But if the type of the operand
is int and the constant is -1 we currently end up generating invalid
RTL which can lead to an abort later on.

The problem is that in a HOST_WIDE_INT, INT_MIN is represented as
0xffffffff80000000 and the negation of this is 0x0000000080000000, but
that's not a valid constant for use in SImode operations.

The fix is straight-forward which is to use gen_int_mode rather than
simply GEN_INT.  This knows how to correctly sign-extend the negated
constant when this is needed.

gcc/
PR target/97534
* config/arm/arm.c (arm_split_atomic_op): Use gen_int_mode when
negating a const_int.
gcc/testsuite
* gcc.dg/pr97534.c: New test.

3 years agopreprocessor: Add deferred macros
Nathan Sidwell [Tue, 24 Nov 2020 16:23:55 +0000 (08:23 -0800)]
preprocessor: Add deferred macros

Deferred macros are needed for C++ modules.  Header units may export
macro definitions and undefinitions.  These are resolved lazily at the
point of (potential) use.  (The language specifies that, it's not just
a useful optimization.)  Thus, identifier nodes grow a 'deferred'
field, which fortunately doesn't expand the structure on 64-bit
systems as there was padding there.  This is non-zero on NT_MACRO
nodes, if the macro is deferred.  When such an identifier is lexed, it
is resolved via a callback that I added recently.  That will either
provide the macro definition, or discover it there was an overriding
undef.  Either way the identifier is no longer a deferred macro.
Notice it is now possible for NT_MACRO nodes to have a NULL macro
expansion.

libcpp/
* include/cpplib.h (struct cpp_hashnode): Add deferred field.
(cpp_set_deferred_macro): Define.
(cpp_get_deferred_macro): Declare.
(cpp_macro_definition): Reformat, add overload.
(cpp_macro_definition_location): Deal with deferred macro.
(cpp_alloc_token_string, cpp_compare_macro): Declare.
* internal.h (_cpp_notify_macro_use): Return bool
(_cpp_maybe_notify_macro_use): Likewise.
* directives.c (do_undef): Check macro is not undef before
warning.
(do_ifdef, do_ifndef): Deal with deferred macro.
* expr.c (parse_defined): Likewise.
* lex.c (cpp_allocate_token_string): Break out of ...
(create_literal): ... here.  Call it.
(cpp_maybe_module_directive): Deal with deferred macro.
* macro.c (cpp_get_token_1): Deal with deferred macro.
(warn_of_redefinition): Deal with deferred macro.
(compare_macros): Rename to ...
(cpp_compare_macro): ... here.  Make extern.
(cpp_get_deferred_macro): New.
(_cpp_notify_macro_use): Deal with deferred macro, return bool
indicating definedness.
(cpp_macro_definition): Deal with deferred macro.

3 years agoaarch64: Fix aapcs64 testsuite failures
Richard Sandiford [Tue, 24 Nov 2020 15:01:45 +0000 (15:01 +0000)]
aarch64: Fix aapcs64 testsuite failures

Various aapcs64 tests were failing at -O1 and above because
the assignments to testfunc_ptr were being deleted as dead.
That in turn happened because FUNC_VAL_CHECK hid the tail call
to myfunc using an LR asm trick:

    asm volatile ("mov %0, x30" : "=r" (saved_return_address));
    asm volatile ("mov x30, %0" : : "r" ((unsigned long long) myfunc));

and so the compiler couldn't see any calls that might read
testfunc_ptr.

That in itself could be fixed by adding a memory clobber to the
second asm above, forcing the compiler to keep both the testfunc_ptr
and the saved_return_address assignments.  But since this is an ABI
test, it seems better to make sure that we don't do any IPA at all.
The fact that doing IPA caused a problem was kind-of helpful and
so it might be better to avoid making the test “work” in the
presence of IPA.

The patch therefore just replaced “noinline” with “noipa”.

gcc/testsuite/
* gcc.target/aarch64/aapcs64/abitest.h (FUNC_VAL_CHECK): Use
noipa rather than noinline.
* gcc.target/aarch64/aapcs64/abitest-2.h (FUNC_VAL_CHECK): Likewise.

3 years agolibstdc++: Run all tests in file
Jonathan Wakely [Tue, 24 Nov 2020 13:11:13 +0000 (13:11 +0000)]
libstdc++: Run all tests in file

libstdc++-v3/ChangeLog:

* testsuite/30_threads/jthread/95989.cc: Run all three test
functions, not just the first one twice.

3 years agolibstdc++: Throw instead of segfaulting in std::thread constructor [PR 67791]
Jonathan Wakely [Tue, 24 Nov 2020 12:48:31 +0000 (12:48 +0000)]
libstdc++: Throw instead of segfaulting in std::thread constructor [PR 67791]

This turns a mysterious segfault into an exception with a more useful
message. If the exception isn't caught, the user sees this instead of
just a segfault:

terminate called after throwing an instance of 'std::system_error'
  what():  Enable multithreading to use std::thread: Operation not permitted
Aborted (core dumped)

libstdc++-v3/ChangeLog:

PR libstdc++/67791
* src/c++11/thread.cc (thread::_M_start_thread(_State_ptr, void (*)())):
Check that gthreads is available before calling __gthread_create.

3 years agolibstdc++: Use __libc_single_threaded for locale initialization
Jonathan Wakely [Tue, 24 Nov 2020 12:29:30 +0000 (12:29 +0000)]
libstdc++: Use __libc_single_threaded for locale initialization

Most initialization of locales and facets happens before main() during
startup, when the program is likely to only have one thread. By using
the new __gnu_cxx::__is_single_threaded() function instead of checking
__gthread_active_p() we can avoid using pthread_once or atomics for the
common case.

That said, I'm not sure why we don't just use a local static variable
instead, as __cxa_guard_acquire() already optimizes for the
single-threaded case:

  static const bool init = (_S_initialize_once(), true);

I'll revisit that for GCC 12.

libstdc++-v3/ChangeLog:

* src/c++98/locale.cc (locale::facet::_S_get_c_locale())
(locale::id::_M_id() const): Use __is_single_threaded.
* src/c++98/locale_init.cc (locale::_S_initialize()):
Likewise.

3 years agoTweak plugin-gcn.c defines
Andrew Stubbs [Mon, 23 Nov 2020 17:18:27 +0000 (17:18 +0000)]
Tweak plugin-gcn.c defines

Ensure the code will continue to compile when elf.h gets these definitions.

libgomp/ChangeLog:

* plugin/plugin-gcn.c: Don't redefine relocations if elf.h has them.
(reserved): Delete unused define.

3 years agoIBM Z: Restrict vec_cmp<m><n> on z13
Ilya Leoshkevich [Mon, 23 Nov 2020 23:22:52 +0000 (00:22 +0100)]
IBM Z: Restrict vec_cmp<m><n> on z13

Commit 5d9ade39b872 ("IBM Z: Fix PR97326: Enable fp compares in
vec_cmp") made it possible to create rtxes that describe signaling
comparisons on z13, which are not supported by the hardware.  Restrict
this by using vcond_comparison_operator predicate.

gcc/ChangeLog:

2020-11-24  Ilya Leoshkevich  <iii@linux.ibm.com>

* config/s390/vector.md: Use vcond_comparison_operator
predicate.

3 years agoIBM Z: Update autovec-*-quiet-uneq expectations
Ilya Leoshkevich [Mon, 23 Nov 2020 20:13:40 +0000 (21:13 +0100)]
IBM Z: Update autovec-*-quiet-uneq expectations

Commit 229752afe315 ("VEC_COND_EXPR optimizations") has improved code
generation: we no longer need "vx x,x,-1", which turned out to be
superfluous.  Instead, we simply swap 0 and -1 arguments of the
preceding "vsel".

gcc/testsuite/ChangeLog:

2020-11-23  Ilya Leoshkevich  <iii@linux.ibm.com>

* gcc.target/s390/zvector/autovec-double-quiet-uneq.c: Expect
that "vx" is not emitted.
* gcc.target/s390/zvector/autovec-float-quiet-uneq.c: Likewise.

3 years agoFix -ffast-math flags handling inconsistencies
Ulrich Weigand [Tue, 24 Nov 2020 09:32:20 +0000 (10:32 +0100)]
Fix -ffast-math flags handling inconsistencies

This patch implements the following set of changes:

1. If a component flag of -ffast-math (or -funsafe-math-optimizations)
   is explicitly set (or reset) on the command line, this should override
   any implicit change due to -f(no-)fast-math, no matter in which order
   the flags come on the command line.  This change affects all flags.

2. Any component flag modified from its default by -ffast-math should
   be reset to the default by -fno-fast-math.  This was previously
   not done for the following flags:
      -fcx-limited-range
      -fexcess-precision=

3. Once -ffinite-math-only is true, the -f(no-)signaling-nans flag has
   no meaning (if we have no NaNs at all, it does not matter whether
   there is a difference between quiet and signaling NaNs).  Therefore,
   it does not make sense for -ffast-math to imply -fno-signaling-nans.
   (This is also a documentation change.)

4. -ffast-math is documented to imply -fno-rounding-math, however the
   latter setting is the default anyway; therefore it does not make
   sense to try to modify it from its default setting.

5. The __FAST_MATH__ preprocessor macro should be defined if and only
   if all the component flags of -ffast-math are set to the value that
   is documented as the effect of -ffast-math.  The following flags
   were currently *not* so tested:
     -fcx-limited-range
     -fassociative-math
     -freciprocal-math
     -frounding-math
   (Note that we should still *test* for -fno-rounding-math here even
   though it is not set as to 4.  -ffast-math -frounding-math should
   not set the __FAST_MATH__ macro.)
   This is also a documentation change.

2020-11-24  Ulrich Weigand  <uweigand@de.ibm.com>

gcc/

* doc/invoke.texi (-ffast-math): Remove mention of -fno-signaling-nans.
Clarify conditions when __FAST_MATH__ preprocessor macro is defined.

* opts.c (common_handle_option): Pass OPTS_SET to set_fast_math_flags
and set_unsafe_math_optimizations_flags.
(set_fast_math_flags): Add OPTS_SET argument, and use it to avoid
setting flags already explicitly set on the command line.  In the !set
case, also reset x_flag_cx_limited_range and x_flag_excess_precision.
Never reset x_flag_signaling_nans or x_flag_rounding_math.
(set_unsafe_math_optimizations_flags): Add OPTS_SET argument, and use
it to avoid setting flags already explicitly set on the command line.
(fast_math_flags_set_p): Also test x_flag_cx_limited_range,
x_flag_associative_math, x_flag_reciprocal_math, and
x_flag_rounding_math.

3 years ago[Ada] Fix inconsistent parameter of SPARK_Msg_NE
Piotr Trojanek [Fri, 9 Oct 2020 12:27:08 +0000 (14:27 +0200)]
[Ada] Fix inconsistent parameter of SPARK_Msg_NE

gcc/ada/

* sem_prag.adb (Analyze_Global_Item): Call SPARK_Msg_NE with the
entity, not with its identifier.

3 years ago[Ada] Cannot process -S -o with GNAT LLVM
Arnaud Charlet [Fri, 9 Oct 2020 07:49:57 +0000 (09:49 +0200)]
[Ada] Cannot process -S -o with GNAT LLVM

gcc/ada/

* opt.ads (Generate_Asm): New flag.
* osint-c.adb (Set_Output_Object_File_Name): Accept any
extension when generating assembly.
* adabkend.adb (Scan_Compiler_Args): Recognize -S.

3 years ago[Ada] Reuse Is_Packed_Array where possible
Piotr Trojanek [Thu, 8 Oct 2020 21:55:49 +0000 (23:55 +0200)]
[Ada] Reuse Is_Packed_Array where possible

gcc/ada/

* exp_attr.adb, exp_ch4.adb, exp_intr.adb, sem_ch8.adb,
sem_res.adb, sem_type.adb, sem_util.adb: Reuse Is_Packed_Array.

3 years ago[Ada] Fix minor typos in comments
Piotr Trojanek [Thu, 8 Oct 2020 21:39:07 +0000 (23:39 +0200)]
[Ada] Fix minor typos in comments

gcc/ada/

* checks.adb (Apply_Access_Check): Remove unbalanced paren.
* exp_attr.adb (Expand_N_Attribute_Reference): Fix typo in
comment.

3 years ago[Ada] Compiler crash on assertion pragma in ghost region
Justin Squirek [Tue, 6 Oct 2020 19:01:15 +0000 (15:01 -0400)]
[Ada] Compiler crash on assertion pragma in ghost region

gcc/ada/

* sem_prag.adb (Analyze_Pragma): Mark relevant pragmas as ghost
when they are within a ghost region.

3 years ago[Ada] Reuse In_Same_List where possible
Piotr Trojanek [Wed, 7 Oct 2020 20:27:46 +0000 (22:27 +0200)]
[Ada] Reuse In_Same_List where possible

gcc/ada/

* contracts.adb, freeze.adb, sem_ch12.adb, sem_prag.adb: Reuse
In_Same_List.

3 years ago[Ada] Simplify Is_Loop_Pragma
Piotr Trojanek [Wed, 7 Oct 2020 20:12:45 +0000 (22:12 +0200)]
[Ada] Simplify Is_Loop_Pragma

gcc/ada/

* sem_prag.adb (Is_Loop_Pragma): Avoid repeated calls to
Original_Node; remove unnecessary IF statement.

3 years ago[Ada] Replace chained if-then-elsif with case stmt for attribute ids
Piotr Trojanek [Tue, 6 Oct 2020 10:12:28 +0000 (12:12 +0200)]
[Ada] Replace chained if-then-elsif with case stmt for attribute ids

gcc/ada/

* exp_spark.adb (Expand_SPARK_N_Attribute_Reference): Rewrite
with a CASE statement.

3 years ago[Ada] Cleanup expansion of attribute Constrained
Piotr Trojanek [Tue, 6 Oct 2020 09:58:45 +0000 (11:58 +0200)]
[Ada] Cleanup expansion of attribute Constrained

gcc/ada/

* exp_attr.adb (Expand_N_Attribute_Reference): Replace calls to
Sloc with a local constant Loc; remove call to
Analyze_And_Resolve and return, which is exactly what happens
anyway (and other branches in the Constrained declare block
appear to rely on analysis, resolution and returning happening
in all cases).
* sem_util.adb: Remove useless parens.

3 years ago[Ada] Recognize delta and extension aggregates as objects
Piotr Trojanek [Thu, 1 Oct 2020 20:23:24 +0000 (22:23 +0200)]
[Ada] Recognize delta and extension aggregates as objects

gcc/ada/

* sem_util.adb (Is_Object_Reference): Delta and extension
aggregates are objects.

3 years ago[Ada] Implement No_Unrecognized_{Aspects,Pragmas} restrictions
Ghjuvan Lacambre [Wed, 30 Sep 2020 08:50:47 +0000 (10:50 +0200)]
[Ada] Implement No_Unrecognized_{Aspects,Pragmas} restrictions

gcc/ada/

* libgnat/s-rident.ads (System.Rident): Register new restriction
IDs.
* par-ch13.adb (Get_Aspect_Specifications): Add restriction check.
* par-prag.adb (Process_Restrictions_Or_Restriction_Warnings):
Register No_Unrecognized_Aspects restriction.
* sem_prag.adb (Analyze_Pragma): Add restriction check.
* snames.ads-tmpl: Create restriction names.

3 years ago[Ada] Accept local objects in the prefix of attribute Loop_Entry
Piotr Trojanek [Wed, 7 Oct 2020 21:19:28 +0000 (23:19 +0200)]
[Ada] Accept local objects in the prefix of attribute Loop_Entry

gcc/ada/

* sem_attr.adb (Declared_Within): Return True for objects
declared within the attribute Loop_Entry prefix itself.

3 years ago[Ada] Fix crash in GNATprove on inlined subprogram in default expression
Yannick Moy [Mon, 5 Oct 2020 07:05:06 +0000 (09:05 +0200)]
[Ada] Fix crash in GNATprove on inlined subprogram in default expression

gcc/ada/

* sem_ch3.adb (Process_Discriminants): Correctly set right
context for analyzing default value of discriminant.

3 years ago[Ada] Wrong resolution of universal_access = operators
Arnaud Charlet [Fri, 2 Oct 2020 15:20:23 +0000 (11:20 -0400)]
[Ada] Wrong resolution of universal_access = operators

gcc/ada/

* sem_type.adb (Add_One_Interp.Is_Universal_Operation): Account
for universal_access = operator.
(Disambiguate): Take into account preference on universal_access
= operator when relevant.
(Disambiguate.Is_User_Defined_Anonymous_Access_Equality): New.

3 years ago[Ada] Premature finalization on build in place return and case expression
Arnaud Charlet [Sat, 19 Sep 2020 08:02:00 +0000 (04:02 -0400)]
[Ada] Premature finalization on build in place return and case expression

gcc/ada/

* exp_util.adb (Is_Finalizable_Transient): Take into account return
statements containing N_Expression_With_Actions. Also clean up a
condition to make it more readable.
* exp_ch6.adb: Fix typo.

3 years ago[Ada] Small cleanup in the Ada.Text_IO hierarchy
Eric Botcazou [Tue, 6 Oct 2020 19:14:01 +0000 (21:14 +0200)]
[Ada] Small cleanup in the Ada.Text_IO hierarchy

gcc/ada/

* libgnat/a-wtdeio.adb (TFT): Delete and adjust throughout.
* libgnat/a-wtenau.adb (TFT): Likewise.
* libgnat/a-wtfiio.adb (TFT): Likewise.
* libgnat/a-wtflio.adb (TFT): Likewise.
* libgnat/a-wtinio.adb (TFT): Likewise.
* libgnat/a-wtinio__128.adb (TFT): Likewise.
* libgnat/a-wtmoio.adb (TFT): Likewise.
* libgnat/a-wtmoio__128.adb (TFT): Likewise.
* libgnat/a-ztdeio.adb (TFT): Likewise.
* libgnat/a-ztenau.adb (TFT): Likewise.
* libgnat/a-ztfiio.adb (TFT): Likewise.
* libgnat/a-ztflio.adb (TFT): Likewise.
* libgnat/a-ztinio.adb (TFT): Likewise.
* libgnat/a-ztinio__128.adb (TFT): Likewise.
* libgnat/a-ztmoio.adb (TFT): Likewise.
* libgnat/a-ztmoio__128.adb (TFT): Likewise.

3 years ago[Ada] AI12-0394 Named Numbers and User-Defined Numeric Literals
Arnaud Charlet [Wed, 30 Sep 2020 12:34:57 +0000 (08:34 -0400)]
[Ada] AI12-0394 Named Numbers and User-Defined Numeric Literals

gcc/ada/

* sem_ch13.adb (Validate_Literal_Aspect): Add support for named
numbers and in particular overload of the Real_Literal function.
* sem_res.adb (Resolve): Add support for named numbers in
Real_Literal and Integer_Literal resolution.
* einfo.adb, einfo.ads (Related_Expression,
Set_Related_Expression): Allow E_Function.
* uintp.ads (UI_Image_Max): Bump size of buffer to avoid loosing
precision.
* sem_eval.adb: Fix typo in comment.
* libgnat/a-nbnbin.adb, libgnat/a-nbnbin.ads (From_String):
Return a Valid_Big_Integer.
* libgnat/a-nbnbre.adb, libgnat/a-nbnbre.ads (From_String): New
variant taking two strings. Return a Valid_Big_Real.

3 years ago[Ada] Fix internal error on multiple nested instantiations
Eric Botcazou [Fri, 2 Oct 2020 17:15:05 +0000 (19:15 +0200)]
[Ada] Fix internal error on multiple nested instantiations

gcc/ada/

* sem_ch12.adb (Analyze_Associations) <Explicit_Freeze_Check>: Test
that the instance is in a statement sequence instead of local scope.
(Freeze_Subprogram_Body): Use the special delayed placement with
regard to the parent instance only if its Sloc is strictly greater.
(Install_Body): Likewise.

3 years ago[Ada] Fix String_Literal aspect spec checking problem for scalars.
Steve Baird [Thu, 1 Oct 2020 23:56:50 +0000 (16:56 -0700)]
[Ada] Fix String_Literal aspect spec checking problem for scalars.

gcc/ada/

* sem_ch13.adb (Validate_Literal_Aspect): Call to Base_Type
needed in order to correctly check result type of String_Literal
function when the first named subtype differs from the base
type (e.g.:
type T is range 1 .. 10 with String_Literal => ... ;
).

3 years ago[Ada] Handle correctly current instance of PO in local subprogram Global
Yannick Moy [Wed, 30 Sep 2020 08:50:24 +0000 (10:50 +0200)]
[Ada] Handle correctly current instance of PO in local subprogram Global

gcc/ada/

* sem_prag.adb (Analyze_Global_Item): Handle specially the
current instance of a PO.
* sem_util.ads (Is_Effectively_Volatile,
Is_Effectively_Volatile_For_Reading): Add parameter
Ignore_Protected.
* sem_util.adb (Is_Effectively_Volatile,
Is_Effectively_Volatile_For_Reading): Add parameter
Ignore_Protected to compute the query results ignoring protected
objects/types.
(Is_Effectively_Volatile_Object,
Is_Effectively_Volatile_Object_For_Reading): Adapt to new
signature.

3 years ago[Ada] Documentation: update -gnatyk description
Ghjuvan Lacambre [Thu, 1 Oct 2020 09:38:36 +0000 (11:38 +0200)]
[Ada] Documentation: update -gnatyk description

gcc/ada/

* doc/gnat_ugn/building_executable_programs_with_gnat.rst:
Update documentation on -gnatyk.
* gnat_ugn.texi: Regenerate.

3 years ago[Ada] Fix spurious error on child library-level subprogram with aspects
Yannick Moy [Tue, 29 Sep 2020 07:03:18 +0000 (09:03 +0200)]
[Ada] Fix spurious error on child library-level subprogram with aspects

gcc/ada/

* sem_ch10.adb (Analyze_Compilation_Unit): Move aspects from
body to the newly created spec.

3 years ago[Ada] Wrong finalization in call with if expression
Arnaud Charlet [Tue, 29 Sep 2020 13:52:03 +0000 (09:52 -0400)]
[Ada] Wrong finalization in call with if expression

gcc/ada/

* exp_ch6.adb (Add_Cond_Expression_Extra_Actual): Simplify
handling of function calls and remove bug in handling of
transient objects.  Minor reformatting along the way.

3 years ago[Ada] Implement Big_Integer.From_String fully
Arnaud Charlet [Mon, 28 Sep 2020 09:16:44 +0000 (05:16 -0400)]
[Ada] Implement Big_Integer.From_String fully

gcc/ada/

* libgnat/a-nbnbin.adb (From_String): Implement fully.

3 years ago[Ada] Fix resolution of subtype_indication in delta aggregates
Piotr Trojanek [Mon, 28 Sep 2020 13:05:38 +0000 (15:05 +0200)]
[Ada] Fix resolution of subtype_indication in delta aggregates

gcc/ada/

* sem_aggr.adb (Resolve_Delta_Array_Aggregate): If the choice is
a subtype_indication then call
Resolve_Discrete_Subtype_Indication; both for choices
immediately inside array delta aggregates and inside
iterated_component_association within array delta aggregates.

3 years ago[Ada] Use high-level Present instead of low-level equality test
Piotr Trojanek [Tue, 29 Sep 2020 09:09:06 +0000 (11:09 +0200)]
[Ada] Use high-level Present instead of low-level equality test

gcc/ada/

* lib-load.adb, lib-writ.adb, lib.adb, par-load.adb,
rtsfind.adb, sem_ch10.adb: Use Present where possible.

3 years ago[Ada] Reject Global/Depends contracts on null procedures
Yannick Moy [Mon, 28 Sep 2020 15:58:31 +0000 (17:58 +0200)]
[Ada] Reject Global/Depends contracts on null procedures

gcc/ada/

* sem_prag.adb (Analyze_Depends_Global): Reject Global and
Depends on null procedure.

3 years ago[Ada] Wrong handling of _ in Big_Reals.From_String
Arnaud Charlet [Mon, 28 Sep 2020 09:52:09 +0000 (05:52 -0400)]
[Ada] Wrong handling of _ in Big_Reals.From_String

gcc/ada/

* libgnat/a-nbnbre.adb (From_String): Handle properly '_'
characters.

3 years ago[Ada] Remove SPARK-specific expansion of array aggregates
Piotr Trojanek [Thu, 24 Sep 2020 20:25:18 +0000 (22:25 +0200)]
[Ada] Remove SPARK-specific expansion of array aggregates

gcc/ada/

* exp_spark.adb (Expand_SPARK_Array_Aggregate,
Expand_SPARK_N_Aggregate): Remove, no longer needed.
* sem_aggr.adb (Resolve_Iterated_Component_Association): Only
remove references in the analyzed expression when generating
code and the expression needs to be analyzed anew after being
rewritten into a loop.

3 years ago[Ada] Document characteristics of decimal fixed point types
Eric Botcazou [Thu, 24 Sep 2020 17:54:16 +0000 (19:54 +0200)]
[Ada] Document characteristics of decimal fixed point types

gcc/ada/

* doc/gnat_rm/implementation_defined_characteristics.rst: Complete
entry of 3.5.9(10).
* gnat_rm.texi: Regenerate.

3 years agoi386: Add *setcc_hi_1* define_insn_and_split [PR97950]
Jakub Jelinek [Tue, 24 Nov 2020 09:45:40 +0000 (10:45 +0100)]
i386: Add *setcc_hi_1* define_insn_and_split [PR97950]

As the following testcase shows, unlike char, int or long long sized
__builtin_*_overflow{,_p}, for short sized one in most cases the ce1 pass
doesn't optimize the jo/jno or jc/jnc jumps with setting of a pseudo to 0/1
into seto/setc.  The reason is missing *setcc_hi_1* pattern.  The following
patch implements it using mode iterators so that on i486 and pentium?
one can get the zero extension through and instead of movzbw.

2020-11-24  Jakub Jelinek  <jakub@redhat.com>

PR target/97950
* config/i386/i386.md (*setcc_si_1_and): Macroize into...
(*setcc_<mode>_1_and): New define_insn_and_split with SWI24 iterator.
(*setcc_si_1_movzbl): Macroize into...
(*setcc_<mode>_1_movzbl): New define_insn_and_split with SWI24
iterator.

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

3 years agomiddle-end: Prefer no RMW in __builtin_clear_padding implementation where possible
Jakub Jelinek [Tue, 24 Nov 2020 09:44:32 +0000 (10:44 +0100)]
middle-end: Prefer no RMW in __builtin_clear_padding implementation where possible

Currently the __builtin_clear_padding expansion code emits no code for
full words that don't have any padding bits, and most of the time if
the only padding bytes are from the start of the word it attempts to merge
them with previous padding store (via {}) or if the only padding bytes are
from the end of the word, it attempts to merge it with following padding
bytes.  For everything else it was using a RMW, except when it found
an aligned char/short/int covering all the padding bytes and all those
padding bytes were all ones in that store.

The following patch changes it, such that we only use RMW if the padding has
any bytes which have some padding and some non-padding bits (i.e. bitfields
are involved), often it is the same amount of instructions in the end and
avoids being thread-unsafe unless necessary (and avoids having to wait for
the reads to make it into the CPU).  So, if there are no bitfields,
the function will just store some zero bytes, shorts, ints, long longs etc.
where needed.

2020-11-24  Jakub Jelinek  <jakub@redhat.com>

* gimple-fold.c (clear_padding_flush): If a word contains only 0
or 0xff bytes of padding other than all set, all clear, all set
followed by all clear or all clear followed by all set, don't emit
a RMW operation on the whole word or parts of it, but instead
clear the individual bytes of padding.  For paddings of one byte
size, don't use char[1] and {}, but instead just char and 0.

3 years agotestsuite: Add testcase for already fixed bug [PR97964]
Jakub Jelinek [Tue, 24 Nov 2020 09:42:56 +0000 (10:42 +0100)]
testsuite: Add testcase for already fixed bug [PR97964]

This testcase started failing with r8-2090 and works again starting
with r11-4755.

2020-11-24  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/97964
* gcc.dg/tree-ssa/pr97964.c: New test.

3 years agoMore explicit checking of which OMP constructs we're expecting, part II
Thomas Schwinge [Fri, 20 Nov 2020 09:41:46 +0000 (10:41 +0100)]
More explicit checking of which OMP constructs we're expecting, part II

In particular, more precisely highlight what applies generally vs. the special
handling for the current 'parloops'-based OpenACC 'kernels' implementation.

gcc/
* omp-expand.c (expand_oacc_for): More explicit checking of which
OMP constructs we're expecting.

3 years ago[testsuite] Avoid Tcl 8.5-specific behavior
Thomas Schwinge [Mon, 16 Nov 2020 16:37:06 +0000 (17:37 +0100)]
[testsuite] Avoid Tcl 8.5-specific behavior

gcc/
* doc/install.texi (Prerequisites) <Tcl>: Add comment.
gcc/testsuite/
* c-c++-common/goacc/kernels-decompose-1.c: Avoid Tcl 8.5-specific
behavior.
* c-c++-common/goacc/kernels-decompose-2.c: Likewise.
* gfortran.dg/goacc/kernels-decompose-1.f95: Likewise.
* gfortran.dg/goacc/kernels-decompose-2.f95: Likewise.
libgomp/
* testsuite/libgomp.oacc-c-c++-common/kernels-decompose-1.c: Avoid
Tcl 8.5-specific behavior.
* testsuite/libgomp.oacc-fortran/pr94358-1.f90: Likewise.

Reported-by: David Edelsohn <dje.gcc@gmail.com>
3 years ago[testsuite] Emit 'warning' instead of 'error' diagnostics for 'dg-optimized', 'dg...
Thomas Schwinge [Fri, 6 Nov 2020 08:51:16 +0000 (09:51 +0100)]
[testsuite] Emit 'warning' instead of 'error' diagnostics for 'dg-optimized', 'dg-missed'

The diagnostics produced by 'dg-optimized', 'dg-missed' aren't error
diagnostics (fatal, meaning: causes compilation to fail) but rather warning
diagnostics (non-fatal, doesn't cause compilation to fail).  Thus, same as
'dg-message', these should use 'saved-dg-warning' instead of 'saved-dg-error',
which then prints: "(test for *warnings*, line [...]) instead of currently:
"(test for *errors*, line [...])".

This is a small bug-fix for commit ed2d9d3720adef3a260b8a55e17e744352a901fc
"dumpfile.c: use prefixes other than 'note: ' for
MSG_{OPTIMIZED_LOCATIONS|MISSED_OPTIMIZATION}", which added 'dg-optimized',
'dg-missed'.

gcc/testsuite/
* lib/gcc-dg.exp (dg-optimized, dg-missed): Use 'saved-dg-warning'
instead of 'saved-dg-error'.

3 years ago[testsuite] Enable column location checking for 'dg-optimized', 'dg-missed'
Thomas Schwinge [Fri, 6 Nov 2020 08:18:06 +0000 (09:18 +0100)]
[testsuite] Enable column location checking for 'dg-optimized', 'dg-missed'

'process-message' would like the 'msgprefix' argument without trailing space.

This is a small bug-fix for commit ed2d9d3720adef3a260b8a55e17e744352a901fc
"dumpfile.c: use prefixes other than 'note: ' for
MSG_{OPTIMIZED_LOCATIONS|MISSED_OPTIMIZATION}", which added 'dg-optimized',
'dg-missed'.

gcc/testsuite/
* lib/gcc-dg.exp (dg-optimized, dg-missed): Fix 'process-message'
call.
* gcc.dg/vect/nodump-vect-opt-info-1.c: Demonstrate.
* gcc.dg/vect/nodump-vect-opt-info-2.c: Likewise.

3 years agoopenmp: Fix C ICE on OpenMP atomics
Jakub Jelinek [Tue, 24 Nov 2020 08:04:28 +0000 (09:04 +0100)]
openmp: Fix C ICE on OpenMP atomics

c_parser_binary_expression was using build2 to create a temporary holder
for binary expression that c_parser_atomic and c_finish_omp_atomic can then
handle.  The latter performs then all the needed checking.

Unfortunately, build2 performs some checking too, e.g. PLUS_EXPR vs.
POINTER_PLUS_EXPR or matching types of the arguments, nothing we can guarantee
at the parsing time.  So we need something like C++ build_min_nt*.  This
patch implements that inline.

2020-11-24  Jakub Jelinek  <jakub@redhat.com>

PR c/97958
* c-parser.c (c_parser_binary_expression): For omp atomic binary
expressions, use make_node instead of build2 to avoid checking build2
performs.

* c-c++-common/gomp/pr97958.c: New test.

3 years agomiddle-end, c++: Treat shifts by negative as undefined [PR96929]
Jakub Jelinek [Tue, 24 Nov 2020 08:03:17 +0000 (09:03 +0100)]
middle-end, c++: Treat shifts by negative as undefined [PR96929]

The PR38359 change made the -1 >> x to -1 optimization less useful by
requiring that the x must be non-negative.
Shifts by negative amount are UB, but we for historic reasons had in some
(but not all) places some hack to treat shifts by negative value as the
other direction shifts by the negated amount.

The following patch just removes that special handling, instead we punt on
optimizing those (and ideally path isolation should catch that up and turn
those into __builtin_unreachable, perhaps with __builtin_warning next to
it).  Folding the shifts in some places as if they were rotates and in other
as if they were saturating just leads to inconsistencies.

For C++ constexpr diagnostics and -fpermissive, I've added code to pretend
fold-const.c has not changed, without -fpermissive it will be an error
anyway and I think it is better not to change all the diagnostics.

During x86_64-linux and i686-linux bootstrap/regtest, my statistics
gathering patch noted 185 unique -m32/-m64 x TU x function_name x shift_kind
x fold-const/tree-ssa-ccp cases.  I have investigated the
64 ../../gcc/config/i386/i386.c x86_output_aligned_bss LSHIFT_EXPR wide_int_bitop
64 ../../gcc/config/i386/i386-expand.c emit_memmov LSHIFT_EXPR wide_int_bitop
64 ../../gcc/config/i386/i386-expand.c ix86_expand_carry_flag_compare LSHIFT_EXPR wide_int_bitop
64 ../../gcc/expmed.c expand_divmod LSHIFT_EXPR wide_int_bitop
64 ../../gcc/lra-lives.c process_bb_lives LSHIFT_EXPR wide_int_bitop
64 ../../gcc/rtlanal.c nonzero_bits1 LSHIFT_EXPR wide_int_bitop
64 ../../gcc/varasm.c optimize_constant_pool.isra LSHIFT_EXPR wide_int_bitop
cases and all of them are either during jump threading (dom) or during PRE.
For jump threading, the most common case is 1 << floor_log2 (whatever) where
floor_log2 is return HOST_BITS_PER_WIDE_INT - 1 - clz_hwi (x);
and clz_hwi is if (x == 0) return HOST_BITS_PER_WIDE_INT; return __builtin_clz* (x);
and so has range [-1, 63] and a comparison against == 0 which makes the
threader think it might be nice to jump thread the case leading to 1 << -1.
I think it is better to keep the 1 << -1 s in the IL for this and let path
isolation turn that into __builtin_unreachable () if the user wishes so.

2020-11-24  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/96929
* fold-const.c (wide_int_binop) <case LSHIFT_EXPR, case RSHIFT_EXPR>:
Return false on negative second argument rather than trying to handle
it as shift in the other direction.
* tree-ssa-ccp.c (bit_value_binop) <case LSHIFT_EXPR,
case RSHIFT_EXPR>: Punt on negative shift count rather than trying
to handle it as shift in the other direction.
* match.pd (-1 >> x to -1): Remove tree_expr_nonnegative_p check.

* constexpr.c (cxx_eval_binary_expression): For shifts by constant
with MSB set, emulate older wide_int_binop behavior to preserve
diagnostics and -fpermissive behavior.

* gcc.dg/tree-ssa/pr96929.c: New test.

3 years agoFix expected output after recent changes
Jeff Law [Tue, 24 Nov 2020 04:34:24 +0000 (21:34 -0700)]
Fix expected output after recent changes

gcc/testsuite
* gcc.dg/tree-ssa/pr23401.c: Update expected output.
* gcc.dg/tree-ssa/pr27810.c: Update expected output.
* gcc.dg/tree-ssa/slsr-8.c: Update expected output.

4 years agotest: Update some cases for vect_partial_vectors_usage_1
Kewen Lin [Tue, 24 Nov 2020 02:33:17 +0000 (20:33 -0600)]
test: Update some cases for vect_partial_vectors_usage_1

Commit r11-3393 improved the epilogue loop handling of partial
vectors and we won't use partial vectors to vectorize a single
iteration scalar loop any more.

The affected test cases have only one single iteration in their
epilogues, so we shouldn't expect the vectorization with
partial vector there.

Tested with explicit --param=vect-partial-vector-usage=1 and
default enablement.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/slp-perm-1.c: Adjust for partial vectors.
* gcc.dg/vect/slp-perm-5.c: Likewise.
* gcc.dg/vect/slp-perm-6.c: Likewise.
* gcc.dg/vect/slp-perm-7.c: Likewise.

4 years agotree-opt: Fix segfault in tree-if-conv.c with -march=armv8.2-a+sve [PR97849]
Prathamesh Kulkarni [Tue, 24 Nov 2020 01:20:53 +0000 (06:50 +0530)]
tree-opt: Fix segfault in tree-if-conv.c with -march=armv8.2-a+sve [PR97849]

The issue here is that rpo vn may eliminate target ssa_name referred to in
redundant_ssa_names, and thus ifcvt_local_dce may replace candidate
ssa_name with invalid ssa_name resulting in incorrect IR. The patch simply
does ssa_name replacement before calling do_rpo_vn, which fixes the issue.

gcc/
2020-11-24  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>

PR tree-optimization/97849
* tree-if-conv.c (tree_if_conversion): Move ssa_name
replacement code from ifcvt_local_dce to this function
before calling do_rpo_vn.

gcc/testsuite/
2020-11-24  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>

PR tree-optimization/97849
* gcc.dg/tree-ssa/pr97849.c: New test.

4 years agoDump type attributes in dump_function_to_file.
Martin Sebor [Tue, 24 Nov 2020 00:15:54 +0000 (17:15 -0700)]
Dump type attributes in dump_function_to_file.

gcc/ChangeLog:

* tree-cfg.c (dump_function_to_file): Print type attributes
and return type.

gcc/testsuite/ChangeLog:
* gcc.dg/attr-access-5.c: New test.

4 years agoDaily bump.
GCC Administrator [Tue, 24 Nov 2020 00:16:44 +0000 (00:16 +0000)]
Daily bump.

4 years agoc: Allow comparison of pointers to complete and incomplete types for C11 [PR95630]
Joseph Myers [Mon, 23 Nov 2020 23:28:58 +0000 (23:28 +0000)]
c: Allow comparison of pointers to complete and incomplete types for C11 [PR95630]

As noted in bug 95630, C11 removed a restriction in C99 on comparing
pointers to compatible complete and incomplete types (this was one of
the changes in N1439, which was largely a terminological change to
make incomplete types a subset of object types rather than a different
kind of type).  Implement that change by using pedwarn_c99 with
OPT_Wpedantic for this diagnostic.

Bootstrapped with no regressions for x86_64-pc-linux-gnu.

gcc/c/
2020-11-23  Joseph Myers  <joseph@codesourcery.com>

PR c/95630
* c-typeck.c (build_binary_op): Use pedwarn_c99 with OPT_Wpedantic
for comparisons of complete and incomplete pointers.

gcc/testsuite/
2020-11-23  Joseph Myers  <joseph@codesourcery.com>

PR c/95630
* gcc.dg/c11-compare-incomplete-1.c,
gcc.dg/c11-compare-incomplete-2.c,
gcc.dg/c99-compare-incomplete-1.c,
gcc.dg/c99-compare-incomplete-2.c: New tests.

4 years agoipa: special pass-through op for Fortran strides
Martin Jambor [Tue, 16 Jun 2020 17:26:32 +0000 (19:26 +0200)]
ipa: special pass-through op for Fortran strides

when Fortran functions pass array descriptors they receive as a
parameter to another function, they actually rebuild it.  Thanks to
work done mainly by Feng, IPA-CP can already handle the cases when
they pass directly the values loaded from the original descriptor.
Unfortunately, perhaps the most important one, stride, is first
checked against zero and is replaced with one in that case:

  _12 = *a_11(D).dim[0].stride;
  if (_12 != 0)
    goto <bb 4>; [50.00%]
  else
    goto <bb 3>; [50.00%]

  <bb 3>
    // empty BB
  <bb 4>
  # iftmp.22_9 = PHI <_12(2), 1(3)>
   ...
   parm.6.dim[0].stride = iftmp.22_9;
   ...
   __x_MOD_foo (&parm.6, b_31(D));

in the most important and hopefully common cases, the incoming value
is already 1 and we fail to propagate it.

I would therefore like to propose the following way of encoding this
situation in pass-through jump functions using using ASSERTT_EXPR
operation code meaning that if the incoming value is the same as the
"operand" in the jump function, it is passed on, otherwise the result
is unknown.  This of course captures only the single (but most
important) case but is an improvement and does not need enlarging the
jump function structure and is simple to pattern match.  Encoding that
zero needs to be changed to one would need another field and matching
it would be slightly more complicated too.

gcc/
2020-06-12  Martin Jambor  <mjambor@suse.cz>

* ipa-prop.h (ipa_pass_through_data): Expand comment describing
operation.
* ipa-prop.c (analyze_agg_content_value): Detect new special case and
encode it as ASSERT_EXPR.
* ipa-cp.c (values_equal_for_ipcp_p): Move before
ipa_get_jf_arith_result.
(ipa_get_jf_arith_result): Special case ASSERT_EXPR.

gcc/testsuite/
2020-06-12  Martin Jambor  <mjambor@suse.cz>
* gfortran.dg/ipcp-array-2.f90: New test.

4 years agoAdjust rtx_costs for h8300
Jeff Law [Mon, 23 Nov 2020 20:06:11 +0000 (13:06 -0700)]
Adjust rtx_costs for h8300

So the primary purpose of this patch is to make it easier to write tests for
removal of useless test/compare insns on the H8.

In simplest terms the costing model in the H8 port tends to encourage changing
something like:

  x = y + 4;
  if (x == 0)

into:

  x = y + 4;
  if (y == -4)

This is a marginal de-optimization on the H8.  So fixing it makes the code
ever-so-slightly better in isolation.   Fixing this also improves redundant
test/compare elimination and makes writing tests for redundant test/compare
elimination far easier.

gcc/
* config/h8300/h8300.c (h8300_rtx_costs): Handle the various
comparison rtx codes too.

4 years agoconfig.sub, config.guess : Import upstream 2020-11-07.
Iain Sandoe [Sun, 15 Nov 2020 09:52:26 +0000 (09:52 +0000)]
config.sub, config.guess : Import upstream 2020-11-07.

This imports from:

sha1 77632d92f25e26b95c64afd3700d51bd03587613
Date:   2020-11-07 04:46:23 +0000

ChangeLog:

* config.guess: Import latest upstream.
* config.sub: Import latest upstream.

4 years agotestsuite: Adjust pruning
Nathan Sidwell [Mon, 23 Nov 2020 18:34:22 +0000 (10:34 -0800)]
testsuite: Adjust pruning

Here is the patch to adjust the include-stack pruning messages to also
strip out c++ modules.  The ICE regexp was a little too strict such
that if someone overrides the bug-reporting URL it doesn't trigger.
May as well relax it too.

gcc/testsuite/
* lib/prune.exp (prune_gcc_output): Adjust include stack pruning
for modules.
(print_ices): Relax regexp.

4 years agolibstdc++: Fix variable declared with wrong type
Jonathan Wakely [Mon, 23 Nov 2020 18:16:44 +0000 (18:16 +0000)]
libstdc++: Fix variable declared with wrong type

libstdc++-v3/ChangeLog:

* include/bits/semaphore_base.h
(__platform_semaphore::_M_try_acquire_until): Fix type of
variable.

4 years agolibstdc++: Fix linker errors due to missing 'inline' keywords
Stephan Bergmann [Mon, 23 Nov 2020 18:14:44 +0000 (18:14 +0000)]
libstdc++: Fix linker errors due to missing 'inline' keywords

libstdc++-v3/ChangeLog:

* include/bits/atomic_wait.h (__thread_relax, __thread_yield):
Add 'inline'.

4 years agolibstdc++: Add configure checks for semaphores
Jonathan Wakely [Mon, 23 Nov 2020 17:17:09 +0000 (17:17 +0000)]
libstdc++: Add configure checks for semaphores

This moves the checks for POSIX semaphores to configure time. As well as
requiring <semaphore.h> and SEM_VALUE_MAX, we also require the
sem_timedwait function. That was only optional in POSIX 2001 (and is
absent on Darwin).

libstdc++-v3/ChangeLog:

* acinclude.m4 (GLIBCXX_CHECK_GTHREADS): Check for
* config.h.in: Regenerate.
* configure: Regenerate.
* include/bits/semaphore_base.h (_GLIBCXX_HAVE_POSIX_SEMAPHORE):
Check autoconf macro instead of defining it here.

4 years agolibstdc++: make atomic waiting depend on gthreads or futexes
Jonathan Wakely [Sun, 22 Nov 2020 01:00:46 +0000 (01:00 +0000)]
libstdc++: make atomic waiting depend on gthreads or futexes

libstdc++-v3/ChangeLog:

* include/bits/atomic_wait.h: Do not define anything unless
gthreads or futexes are available.
* include/bits/atomic_timed_wait.h: Likewise.
* include/bits/semaphore_base.h: Likewise.
* include/std/semaphore: Likewise.
* include/bits/atomic_base.h (atomic_flag::wait)
(atomic_flag::notify_one, atomic_flag::notify_all)
(__atomic_base<I>::wait, __atomic_base<I>::notify_one)
(__atomic_base<I>::notify_all, __atomic_base<P*>::wait)
(__atomic_base<P*>::notify_one, __atomic_base<P*>::notify_all)
(__atomic_impl::wait, __atomic_impl::notify_one)
(__atomic_impl::notify_all, __atomic_float::wait)
(__atomic_float::notify_one, __atomic_float::notify_all)
(__atomic_ref::wait, __atomic_ref::notify_one)
(__atomic_ref::notify_all): Only define if gthreads or futexes
are available.
* include/std/atomic (atomic::wait, atomic::notify_one)
(atomic::notify_all): Likewise.
* include/std/version (__cpp_lib_semaphore): Define
conditionally.

4 years agolog/syslog: correct asm name for C function
Ian Lance Taylor [Mon, 23 Nov 2020 00:01:14 +0000 (16:01 -0800)]
log/syslog: correct asm name for C function

Patch from Rainer Orth.

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

4 years agolibstdc++: Link tests to libatomic as required [PR 97948]
Jonathan Wakely [Mon, 23 Nov 2020 15:46:24 +0000 (15:46 +0000)]
libstdc++: Link tests to libatomic as required [PR 97948]

libstdc++-v3/ChangeLog:

PR libstdc++/97948
* testsuite/29_atomics/atomic_float/wait_notify.cc: Add options
for libatomic.
* testsuite/29_atomics/atomic_integral/wait_notify.cc: Likewise.
* testsuite/29_atomics/atomic_ref/wait_notify.cc: Likewise.

4 years agoRelease ipa-prop's agg.items and make alocation more careful
Jan Hubicka [Mon, 23 Nov 2020 15:58:23 +0000 (16:58 +0100)]
Release ipa-prop's agg.items and make alocation more careful

This saves about 316MB WPAing Firefox

* ipa-prop.c (build_agg_jump_func_from_list,
ipa_read_jump_function): Reserve agg.items precisely.
* ipa-prop.h (ipa_node_params::~ipa_node_params): Release descriptors
(ipa_edge_args::~ipa_edge_args): Release agg.items.

4 years agoDo not leak SSANAMES in lto streamer
Jan Hubicka [Mon, 23 Nov 2020 15:52:36 +0000 (16:52 +0100)]
Do not leak SSANAMES in lto streamer

* lto-streamer-in.c (input_cfg): Do not init ssa operands.
(input_function): Do not init tree_ssa and set in_ssa_p.
(input_ssa_names): Do it here.
* tree-ssa.c (init_tree_ssa): Add additional SIZE parameter, default
to 0
* tree-ssanames.c (init_ssanames): Do not round size up to 50, allocate
precisely.
* tree-ssa.h (init_tree_ssa): Update prototype.

4 years agoDiagnostic for module importation
Nathan Sidwell [Mon, 23 Nov 2020 15:34:17 +0000 (07:34 -0800)]
Diagnostic for module importation

This tweaks the 'included from ...' printing to deal with imports in
the 'include' path.  One new thing is that there can now be two
'include' names on a single line.  For example 'in module X, included
at Y'.  This reads better than placing them on different lines.

gcc/
* diagnostic.c (diagnostic_report_current_module): Adjust for C++
module importation.

4 years agoc++: Add empty module.cc
Nathan Sidwell [Mon, 23 Nov 2020 15:27:21 +0000 (07:27 -0800)]
c++: Add empty module.cc

This adds an empty module.cc file, along with make rules to build it.

gcc/cp/
* module.cc: New dummy file.
* Make-lang.in: Add rules to build module.o

4 years agoMSP430: Remove target-specific handling of the "persistent" attribute
Jozef Lawrynowicz [Mon, 23 Nov 2020 14:24:43 +0000 (14:24 +0000)]
MSP430: Remove target-specific handling of the "persistent" attribute

The "persistent" attribute is now handled generically, and does not
need specific support in the MSP430 back end.

gcc/ChangeLog:

* config/msp430/msp430.c (msp430_section_attr): Don't warn for "lower"
attribute used with "noinit" or "persistent" attributes.
(msp430_persist_attr): Remove.
(attr_lower_exclusions): Remove ATTR_PERSIST exclusion.
(attr_upper_exclusions): Likewise.
(attr_either_exclusions): Likewise.
(attr_persist_exclusions): Remove.
(msp430_attribute_table): Remove ATTR_PERSIST handling.
(msp430_handle_generic_attribute): Remove ATTR_PERSIST section conflict
handling.
(TARGET_ASM_INIT_SECTIONS): Remove.
(msp430_init_sections): Remove.
(msp430_select_section): Use default_elf_select_section for decls with
the "persistent" attribute.
(msp430_section_type_flags): Remove ".persistent" section handling.
* doc/extend.texi (MSP430 Variable Attributes): Remove "noinit" and
"persistent" documentation.

gcc/testsuite/ChangeLog:

* g++.target/msp430/data-attributes.C: Remove expected warnings for
"lower" attribute conflicts.
Adjust expected wording for "persistent" attribute misuse.
* gcc.target/msp430/data-attributes-2.c: Likewise.
* gcc.target/msp430/pr78818-auto-warn.c: Likewise.

4 years agofix hybrid SLP discovery debug stmt issue
Richard Biener [Mon, 23 Nov 2020 12:46:35 +0000 (13:46 +0100)]
fix hybrid SLP discovery debug stmt issue

This properly skips debug USE_STMTs when looking for non-SLP sinks.

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

* tree-vect-slp.c (maybe_push_to_hybrid_worklist): Skip
debug stmts.

* g++.dg/vect/simd-12.cc: New testcase.

4 years agoImplement the "persistent" attribute
Jozef Lawrynowicz [Mon, 23 Nov 2020 12:06:39 +0000 (12:06 +0000)]
Implement the "persistent" attribute

The "persistent" attribute is used for variables that are initialized
by the program loader, but are not initialized by the runtime startup
code. "persistent" variables are placed in a non-volatile area of
memory, which allows their value to "persist" between processor resets.

gcc/c-family/ChangeLog:

* c-attribs.c (handle_special_var_sec_attribute): New.
(handle_noinit_attribute): Remove.
(attr_noinit_exclusions): Rename to...
(attr_section_exclusions): ...this, and add "persistent" attribute
exclusion.
(c_common_attribute_table): Add "persistent" attribute.

gcc/ChangeLog:

* doc/extend.texi (Common Variable Attributes): Document the
"persistent" variable attribute.
* doc/sourcebuild.texi (Effective-Target Keywords): Document
the "persistent" effective target keyword.
* tree.h (DECL_PERSISTENT_P): Define.
* varasm.c (bss_initializer_p): Return false for a
DECL_PERSISTENT_P decl initialized to zero.
(default_section_type_flags): Handle the ".persistent" section.
(default_elf_select_section): Likewise.
(default_unique_section): Likewise.

gcc/testsuite/ChangeLog:

* gcc.c-torture/execute/noinit-attribute.c: Moved to...
* c-c++-common/torture/attr-noinit-main.inc: ...here.
* lib/target-supports.exp (check_effective_target_persistent): New.
* c-c++-common/torture/attr-noinit-1.c: New test.
* c-c++-common/torture/attr-noinit-2.c: New test.
* c-c++-common/torture/attr-noinit-3.c: New test.
* c-c++-common/torture/attr-noinit-invalid.c: New test.
* c-c++-common/torture/attr-persistent-1.c: New test.
* c-c++-common/torture/attr-persistent-2.c: New test.
* c-c++-common/torture/attr-persistent-3.c: New test.
* c-c++-common/torture/attr-persistent-invalid.c: New test.
* c-c++-common/torture/attr-persistent-main.inc: New test.

4 years agocp/decl.c: Set DECL_INITIAL before attribute processing
Jozef Lawrynowicz [Mon, 23 Nov 2020 12:06:15 +0000 (12:06 +0000)]
cp/decl.c: Set DECL_INITIAL before attribute processing

Attribute handlers may want to examine DECL_INITIAL for a decl, to
validate the attribute being applied. For C++, DECL_INITIAL is currently
not set until cp_finish_decl, by which time attribute validation has
already been performed.

For msp430-elf this causes the "persistent" attribute to always be
rejected for C++, since DECL_INITIAL must be non-null for the
attribute to be applied to a decl.

This patch ensures DECL_INITIAL is set for initialized decls early in
start_decl, before attribute handlers run. This allows the
initialization status of the decl to be examined by the handlers.
DECL_INITIAL must be restored to it's initial value after attribute
validation is performed, so as to not interfere with later decl
processing.

gcc/cp/ChangeLog:

* decl.c (start_decl): Set DECL_INITIAL for initialized decls
before attribute processing.

gcc/testsuite/ChangeLog:

* gcc.target/msp430/data-attributes-2.c: Adjust test.
* g++.target/msp430/data-attributes.C: New test.
* g++.target/msp430/msp430.exp: New test.

4 years agoFix "noinit" attribute being ignored for -O0 and -fdata-sections
Jozef Lawrynowicz [Mon, 23 Nov 2020 11:43:39 +0000 (11:43 +0000)]
Fix "noinit" attribute being ignored for -O0 and -fdata-sections

Variables with the "noinit" attribute are ignored at -O0 because they
are treated like a regular bss variable and placed in the .bss section.

With -fdata-sections they are ignored because they are not handled in
resolve_unique_section.

gcc/ChangeLog:

* tree.h (DECL_NOINIT_P): Define.
* varasm.c (DECL_NOINIT_P): Check DECL_NOINIT_P before using
unnamed bss/lcomm sections for bss_initializer variables.
(default_elf_select_section): Use DECL_NOINIT_P instead of
looking up attribute for .noinit section selection.
(default_unique_section): Check DECL_NOINIT_P for .noinit
section selection.

gcc/testsuite/ChangeLog:

* gcc.c-torture/execute/noinit-attribute.c: Don't override
optimization options set by torture test harness.
* lib/target-supports.exp (check_effective_target_noinit): Adjust
comment formatting.

4 years agoDocument bootstrap-asan configure option
Matthew Malcomson [Fri, 20 Nov 2020 18:03:59 +0000 (18:03 +0000)]
Document bootstrap-asan configure option

Document how to configure using asan (bootstrap-asan option to the
--with-build-config configure argument).

gcc/ChangeLog:

* doc/install.texi: Document bootstrap-asan option.

4 years agotestsuite/arm: add missing -mthumb to several tests
Christophe Lyon [Mon, 23 Nov 2020 09:58:43 +0000 (09:58 +0000)]
testsuite/arm: add missing -mthumb to several tests

Some tests force -mcpu=cortex-mXX but do not add -mthumb, causing
errors if GCC is not configured to default to Thumb code
(--with-mode=thumb):
cc1: error: target CPU does not support ARM mode

This patch adds -mthumb where relevant.

2020-11-23  Christophe Lyon  <christophe.lyon@linaro.org>

gcc/testsuite/
* gcc.target/arm/cortex-m55-nodsp-flag-hard.c: Add -mthumb.
* gcc.target/arm/cortex-m55-nodsp-flag-softfp.c: Likewise.
* gcc.target/arm/cortex-m55-nodsp-nofp-flag-softfp.c: Likewise.
* gcc.target/arm/cortex-m55-nofp-flag-hard.c: Likewise.
* gcc.target/arm/cortex-m55-nofp-flag-softfp.c: Likewise.
* gcc.target/arm/cortex-m55-nofp-nomve-flag-softfp.c: Likewise.
* gcc.target/arm/cortex-m55-nomve-flag-hard.c: Likewise.
* gcc.target/arm/cortex-m55-nomve-flag-softfp.c: Likewise.
* gcc.target/arm/cortex-m55-nomve.fp-flag-hard.c: Likewise.
* gcc.target/arm/cortex-m55-nomve.fp-flag-softfp.c: Likewise.
* gcc.target/arm/mve/intrinsics/pr97327.c: Likewise.

4 years agoc++: Add missing verify_type_context call [PR97904]
Richard Sandiford [Mon, 23 Nov 2020 09:06:59 +0000 (09:06 +0000)]
c++: Add missing verify_type_context call [PR97904]

When adding the verify_type_context target hook, I'd missed
a site that needs to check an array element type.

gcc/cp/
PR c++/97904
* pt.c (tsubst): Use verify_type_context to check the type
of an array element.

gcc/testsuite/
PR c++/97904
* g++.dg/ext/sve-sizeless-1.C: Add more template tests.
* g++.dg/ext/sve-sizeless-2.C: Likewise.

4 years agoDaily bump.
GCC Administrator [Mon, 23 Nov 2020 00:16:22 +0000 (00:16 +0000)]
Daily bump.

4 years agoi386: Use SWI48DWI mode iterator for abs and maxmin [PR97873]
Uros Bizjak [Sun, 22 Nov 2020 21:26:48 +0000 (22:26 +0100)]
i386: Use SWI48DWI mode iterator for abs and maxmin [PR97873]

Generate special double mode sequence also for TImode on 64bit targets.

2020-11-22  Uroš Bizjak  <ubizjak@gmail.com>

PR target/97873

gcc/
* config/i386/i386.md (abs<mode>2): Use SWI48DWI mode iterator.
(*abs<dwi>2_doubleword): Use DWIH mode iterator.

(<maxmin:code><mode>3): Use SWI48DWI mode iterator.
(*<maxmin:code><dwi>3_doubleword): Use DWIH mode iterator.

gcc/testsuite/
* gcc.target/i386/pr97873-2.c: New test.

4 years agoH8 cc0 conversion
Austin Law [Sun, 22 Nov 2020 19:26:48 +0000 (12:26 -0700)]
H8 cc0 conversion

gcc/
* config/h8300/addsub.md: Turn existing patterns into
define_insn_and_split style patterns where the splitter
adds a clobber of the condition code register.  Drop "cc"
attribute.  Add _clobber_flags patterns to match output of
the splitters.
(add<mod>3_incdec): Remove pattern
(adds/subs splitter): Only run before reload.
* config/h8300/bitfield.md: Turn existing patterns into
define_insn_and_split style patterns where the splitter
adds a clobber of the condition code register.  Drop "cc"
attribute.  Add _clobber_flags patterns to match output
of the splitters.
(cstoreqi4, cstorehi4, cstoresi4): Comment out
(*bstzhireg, *cmpstz, *bstz, *bistz, *cmpcondset): Likewise
(*condbset, *cmpcondbclr, *condbclr): Likewise.
(*cmpcondbsetreg, *condbsetreg, *cmpcondbclrreg): Likewise.
(*condbclrreg): Likewise.
* config/h8300/combiner.md: Turn existing patterns into
define_insn_and_split style patterns where the splitter
adds a clobber of the condition code register.  Drop "cc"
attribute.  Add _clobber_flags patterns to match output of
the splitters.  Add appropriate CC register clobbers to
existing splitters.
(*addsi3_and_r_1): Disable for now.
(*addsi3_and_not_r_1, bit-test branches): Likewise.
* config/h8300/divmod.md: Turn existing patterns into
define_insn_and_split style patterns where the splitter
adds a clobber of the condition code register.  Drop "cc"
attribute.  Add _clobber_flags patterns to match output of
the splitters.
* config/h8300/extensions.md: Turn existing patterns into
define_insn_and_split style patterns where the splitter
adds a clobber of the condition code register.  Drop "cc"
attribute.  Add _clobber_flags patterns to match output of
the splitters.
* config/h8300/genmova.sh: Drop "cc" attribute from patterns.
* config/h8300/mova.md: Drop "cc" attribute from patterns.
* config/h8300/h8300-modes.def: Add CCZN and CCZNV modes.
* config/h8300/h8300-protos.h (output_plussi): Update prototype.
(compute_plussi_length): Likewise.
(h8300_select_cc_mode): Add prototype.
(compute_a_shift_cc): Remove prototype
(cmpute_logical_op_cc): Likewise.
* config/h8300/h8300.c (names_big): Add "cc" register.
(names_extended, names_upper_extended): Likewise.
(h8300_emit_stack_adjustment): Be more selective about setting
RTX_FRAME_RELATED_P.
(h8300_print_operand): Handle CCZN mode
(h8300_select_cc_mode): New function.
(notice_update_cc): if-0 out.  Only kept for reference purposes.
(h8300_expand_store): Likewise.
(h8300_binary_length): Handle new insn forms.
(output_plussi): Add argument for NEED_FLAGS and handle that case.
(compute_plussi_length): Likewise.
(compute_logical_op_cc): Return integer.
(TARGET_FLAGS_REGNUM): Define.
* config/h8300/h8300.h (FIRST_PSEUDO_REGISTER): Bump for cc register.
(FIXED_REGISTERS, CALL_USED_REGISTERS): Handle cc register.
(REG_ALLOC_ORDER, REGISTER_NAMES): Likewise.
(SELECT_CC_MODE): Define.
* config/h8300/h8300.md: Add CC_REG.
Do not include peepholes.md for now.
* config/h8300/jumpcall.md (cbranchqi4): Consolidate into
cbranch<mode>4.
(cbranchhi4, cbranchsi4): Likewise.
(cbranch<mode>4): New expander.
(branch): New define_insn_and_split for use before reload.
(branch_1, branch_1_false): New patterns to match splitter output.
Remove code to manage cc_status.flags.
* config/h8300/logical.md: Turn existing patterns into
define_insn_and_split style patterns where the splitter
adds a clobber of the condition code register.  Drop "cc"
attribute.  Add _clobber_flags patterns to match output of
the splitters.  Move various peepholes into this file.
* config/h8300/movepush.md: Turn existing patterns into
define_insn_and_split style patterns where the splitter
adds a clobber of the condition code register.  Drop "cc"
attribute.  Add _clobber_flags patterns to match output of
the splitters.
* config/h8300/multiply.md: Turn existing patterns into
define_insn_and_split style patterns where the splitter
adds a clobber of the condition code register.  Drop "cc"
attribute.  Add _clobber_flags patterns to match output of
the splitters.
* config/h8300/other.md: Turn existing patterns into
define_insn_and_split style patterns where the splitter
adds a clobber of the condition code register.  Drop "cc"
attribute.  Add _clobber_flags patterns to match output of
the splitters.
* config/h8300/peepholes.md: Remove peepholes that were moved
elsewhere.
* config/h8300/predicates.md (simple_memory_operand): New.
* config/h8300/proepi.md: Drop "cc" attribute setting.
* config/h8300/shiftrotate.md: Turn existing patterns into
define_insn_and_split style patterns where the splitter
adds a clobber of the condition code register.  Drop "cc"
attribute.  Add _clobber_flags patterns to match output of
the splitters.
* config/h8300/testcompare.md: Turn existing patterns into
define_insn_and_split style patterns where the splitter
adds a clobber of the condition code register.  Drop "cc"
attribute.  Add _clobber_flags patterns to match output of
the splitters.  Disable various patterns for now.
Move some peepholes that were previously in peepholes.md here.

4 years agod: Fix OutOfMemoryError thrown when appending to an array with a side effect
Iain Buclaw [Sun, 22 Nov 2020 13:29:54 +0000 (14:29 +0100)]
d: Fix OutOfMemoryError thrown when appending to an array with a side effect

When appending a character to an array, the result of that concat
assignment was not the new value of the array, similarly, when appending
an array to another array, side effects were evaluated in reverse to the
expected order of evaluation.

As of this change, the address of the left-hand side expression is
saved and re-used as the result.  Its evaluation is now also forced to
occur before the concat operation itself is called.

gcc/d/ChangeLog:

PR d/97889
* expr.cc (ExprVisitor::visit (CatAssignExp *)): Enforce LTR order of
evaluation on left and right hand side expressions.

gcc/testsuite/ChangeLog:

PR d/97889
* gdc.dg/torture/pr97889.d: New test.

4 years agowidening_mul: pattern recognize further forms of __builtin_add_overflow [PR95853]
Jakub Jelinek [Sun, 22 Nov 2020 18:16:34 +0000 (19:16 +0100)]
widening_mul: pattern recognize further forms of __builtin_add_overflow [PR95853]

The following patch recognizes some further forms of additions with overflow
checks as shown in the testcase, in particular where the unsigned addition is
performed in a wider mode just to catch overflow with a > narrower_utype_max
check.

2020-11-22  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/95853
* tree-ssa-math-opts.c (uaddsub_overflow_check_p): Add maxval
argument, if non-NULL, instead look for r > maxval or r <= maxval
comparisons.
(match_uaddsub_overflow): Pattern recognize even other forms of
__builtin_add_overflow, in particular when addition is performed
in a wider type and result compared to maximum of the narrower
type.

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

4 years agoPartially revert recent H8 patch for conditional branches
Jeff Law [Sun, 22 Nov 2020 17:53:14 +0000 (10:53 -0700)]
Partially revert recent H8 patch for conditional branches

So I'd forgotten an important tidbit on the H8 port.  Specifically
for a branch instruction, the target label must be operand 0 for
the length computations.

This really only affects the main conditional branch pattern.
The other conditional branch patterns are split and ultimately
funnel into the main pattern.  This patch fixes the issue by
partially reverting an earlier change.  This issue didn't show up
until late in the optimization work on cc0 removal of the H8 port,
but was caught by the testsuite.  So there's no new test.

Built and regression tested H8 with this change, with and without
the cc0 removal patches.

gcc/

* config/h8300/jumpcall.md (branch_true, branch_false): Revert
recent change.  Ensure operand[0] is always the target label.

4 years agoDarwin : Avoid a C++ ODR violation seen with LTO.
Iain Sandoe [Sun, 22 Nov 2020 11:19:32 +0000 (11:19 +0000)]
Darwin : Avoid a C++ ODR violation seen with LTO.

We have a similar code pattern in darwin-c.c to one in c-pragmas
(most likely a cut & paste) with a struct type used locally to the
TU.  With C++ we need to rename the type to avoid an ODR violation.

gcc/ChangeLog:

* config/darwin-c.c (struct f_align_stack): Rename
to type from align_stack to f_align_stack.
(push_field_alignment): Likewise.
(pop_field_alignment): Likewise.

4 years agoDaily bump.
GCC Administrator [Sun, 22 Nov 2020 00:16:24 +0000 (00:16 +0000)]
Daily bump.