gcc.git
3 years agoif-to-switch: Support chain with 2 BBs.
Martin Liska [Tue, 1 Dec 2020 11:18:46 +0000 (12:18 +0100)]
if-to-switch: Support chain with 2 BBs.

As seen in the test-case, even 2 BBs can handle interesting
cases covered by a jump table or a bit-test.

gcc/ChangeLog:

PR tree-optimization/88702
* gimple-if-to-switch.cc (pass_if_to_switch::execute):
Require at least 2 BBs.
* gimple-if-to-switch.cc (find_conditions): Require
equal precision for low and high of a range.

gcc/testsuite/ChangeLog:

PR tree-optimization/88702
* gcc.dg/tree-ssa/if-to-switch-9.c: New test.

3 years agoif-to-switch: consider only integral types
Martin Liska [Tue, 1 Dec 2020 16:25:36 +0000 (17:25 +0100)]
if-to-switch: consider only integral types

gcc/ChangeLog:

PR tree-optimization/98084
* gimple-if-to-switch.cc (find_conditions): Consider only
integral types.

gcc/testsuite/ChangeLog:

PR tree-optimization/98084
* gcc.dg/tree-ssa/pr98084.c: New test.

3 years agoUse add/sub/neg insns to eliminate compare/test insns on H8
Jeff Law [Wed, 2 Dec 2020 04:48:10 +0000 (21:48 -0700)]
Use add/sub/neg insns to eliminate compare/test insns on H8

gcc/

* config/h8300/addsub.md (addqi3_clobber_flags): Rename to
addqi3_flags and annotate with a <cczn> for define_subst.
(addhi3_h8sx_clobber_flags): Likewise.
(subqi3_clobber_flags, sub<mode>3_clobber_flags): Likewise.
(neg<mode2>_clobber_flags): Similarly.
(addsi3_clobber_flags): Similarly.  Update last argument to
output_plussi to distinguish when we need flags or do not need
flags.
(addhi3_clobber_flags): Similarly.  Twiddle code for cases
+-1, +-2 and +-4.
* config/h8300/h8300.md: Define iterators, mode attributes and
substitutions for use in compare/test elimination.
* config/h8300/jumpcall.md (branch, branch_1): Use H8cc mode
iterator to cover the different modes for the CC register.
(branch_1_false): Likewise.

gcc/testsuite
* gcc.target/h8300/add.c: New test.
* gcc.target/h8300/add-2.c: New test.
* gcc.target/h8300/add-3.c: New test.
* gcc.target/h8300/sub.c: New test.
* gcc.target/h8300/sub-2.c: New test.
* gcc.target/h8300/sub-3.c: New test.

3 years agoloop-iv: Fix typo in `iv_analyze_expr' description
Maciej W. Rozycki [Wed, 2 Dec 2020 04:28:26 +0000 (04:28 +0000)]
loop-iv: Fix typo in `iv_analyze_expr' description

gcc/
* loop-iv.c: Fix a typo, s/bu/by/, in the `iv_analyze_expr'
description in the introduction.

3 years agogo-test.exp: permit trailing */ on ERROR line
Ian Lance Taylor [Wed, 2 Dec 2020 02:18:34 +0000 (18:18 -0800)]
go-test.exp: permit trailing */ on ERROR line

* go.test/go-test.exp (errchk): Permit trailing */ on ERROR line.

3 years agoUse SHF_GNU_RETAIN to preserve symbol definitions
H.J. Lu [Mon, 3 Feb 2020 19:55:43 +0000 (11:55 -0800)]
Use SHF_GNU_RETAIN to preserve symbol definitions

In assemly code, the section flag 'R' sets the SHF_GNU_RETAIN flag to
indicate that the section must be preserved by the linker.

Add SECTION_RETAIN to indicate a section should be retained by the linker
and set SECTION_RETAIN on section for the preserved symbol if assembler
supports SHF_GNU_RETAIN.  All retained symbols are placed in separate
sections with

.section .data.rel.local.preserved_symbol,"awR"
preserved_symbol:
...
.section .data.rel.local,"aw"
not_preserved_symbol:
...

to avoid

.section .data.rel.local,"awR"
preserved_symbol:
...
not_preserved_symbol:
...

which places not_preserved_symbol definition in the SHF_GNU_RETAIN
section.

gcc/

2020-12-01  H.J. Lu  <hjl.tools@gmail.com>

* configure.ac (HAVE_GAS_SHF_GNU_RETAIN): New.  Define 1 if
the assembler supports marking sections with SHF_GNU_RETAIN flag.
* output.h (SECTION_RETAIN): New.  Defined as 0x4000000.
(SECTION_MACH_DEP): Changed from 0x4000000 to 0x8000000.
(default_unique_section): Add a bool argument.
* varasm.c (get_section): Set SECTION_RETAIN for the preserved
symbol with HAVE_GAS_SHF_GNU_RETAIN.
(resolve_unique_section): Used named section for the preserved
symbol if assembler supports SHF_GNU_RETAIN.
(get_variable_section): Handle the preserved common symbol with
HAVE_GAS_SHF_GNU_RETAIN.
(default_elf_asm_named_section): Require the full declaration and
use the 'R' flag for SECTION_RETAIN.
* config.in: Regenerated.
* configure: Likewise.
* doc/sourcebuild.texi: Document R_flag_in_section.

gcc/testsuite/

2020-12-01  H.J. Lu  <hjl.tools@gmail.com>
    Jozef Lawrynowicz  <jozef.l@mittosystems.com>

* c-c++-common/attr-used.c: Check the 'R' flag.
* c-c++-common/attr-used-2.c: Likewise.
* c-c++-common/attr-used-3.c: New test.
* c-c++-common/attr-used-4.c: Likewise.
* gcc.c-torture/compile/attr-used-retain-1.c: Likewise.
* gcc.c-torture/compile/attr-used-retain-2.c: Likewise.
* lib/target-supports.exp
(check_effective_target_R_flag_in_section): New proc.

3 years agolibstdc++: Make preprocessor checks for __cpp_lib_atomic_wait consistent
Jonathan Wakely [Wed, 2 Dec 2020 00:39:22 +0000 (00:39 +0000)]
libstdc++: Make preprocessor checks for __cpp_lib_atomic_wait consistent

This changes some #ifdef checks to use #if instead.

libstdc++-v3/ChangeLog:

* include/bits/atomic_timed_wait.h: Use #if instead of #ifdef.
* include/bits/semaphore_base.h: Likewise.
* include/std/version: Remove trailing whitespace.

3 years agolibstdc++: Fix filesystem::path pretty printer test failure
Jonathan Wakely [Wed, 2 Dec 2020 00:39:21 +0000 (00:39 +0000)]
libstdc++: Fix filesystem::path pretty printer test failure

On some systems libstdc++-prettyprinters/cxx17.cc FAILs with this error:

skipping: Python Exception <type 'exceptions.AttributeError'> 'gdb.Type' object has no attribute 'name': ^M
got: $27 = filesystem::path "/dir/."^M
FAIL: libstdc++-prettyprinters/cxx17.cc print path2

The gdb.Type.name attribute isn't present in GDB 7.6, so we get an
exception from StdPathPrinter._iterator.__next__ trying to use it.
The StdPathPrinter._iterator is already passed the type's name in its
constructor, so we can just store that and use it instead of
gdb.Type.name.

libstdc++-v3/ChangeLog:

* python/libstdcxx/v6/printers.py (StdExpPathPrinter): Store the
name of the type and pass it to the iterator.
(StdPathPrinter): Likewise.
* testsuite/libstdc++-prettyprinters/filesystem-ts.cc: New test.

3 years agox86: Add -mneeded for GNU_PROPERTY_X86_ISA_1_V[234] marker
H.J. Lu [Mon, 9 Nov 2020 17:29:23 +0000 (09:29 -0800)]
x86: Add -mneeded for GNU_PROPERTY_X86_ISA_1_V[234] marker

GCC 11 supports -march=x86-64-v[234] to enable x86 micro-architecture ISA
levels:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97250

Binutils has been updated to support GNU_PROPERTY_X86_ISA_1_V[234] marker:

https://gitlab.com/x86-psABIs/x86-64-ABI/-/merge_requests/13

with

commit b0ab06937385e0ae25cebf1991787d64f439bf12
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Oct 30 06:49:57 2020 -0700

    x86: Support GNU_PROPERTY_X86_ISA_1_BASELINE marker

and

commit 32930e4edbc06bc6f10c435dbcc63131715df678
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Oct 9 05:05:57 2020 -0700

    x86: Support GNU_PROPERTY_X86_ISA_1_V[234] marker

in x86 ELF binaries.

Add -mneeded to emit GNU_PROPERTY_X86_ISA_1_NEEDED property to indicate
the micro-architecture ISA level required to execute the binary.

gcc/

* config.gcc: Replace cet.o with gnu-property.o.  Replace
i386/t-cet with i386/t-gnu-property.
* config/i386/cet.c: Renamed to ...
* config/i386/gnu-property.c: This.
(emit_gnu_property): New function.
(file_end_indicate_exec_stack_and_cet): Renamed to ...
(file_end_indicate_exec_stack_and_gnu_property): This.  Call
emit_gnu_property to generate GNU_PROPERTY_X86_FEATURE_1_AND and
GNU_PROPERTY_X86_ISA_1_NEEDED properties.
* config/i386/i386.opt (mneeded): New.
* config/i386/linux-common.h (file_end_indicate_exec_stack_and_cet):
Renamed to ...
(file_end_indicate_exec_stack_and_gnu_property): This.
(TARGET_ASM_FILE_END): Updated.
* config/i386/t-cet: Renamed to ...
* config/i386/t-gnu-property: This.
(cet.o): Renamed to ...
(gnu-property.o): This.
* doc/invoke.texi: Document -mneeded.

gcc/testsuite/

* gcc.target/i386/x86-needed-1.c: New test.
* gcc.target/i386/x86-needed-2.c: Likewise.
* gcc.target/i386/x86-needed-3.c: Likewise.

3 years agoDaily bump.
GCC Administrator [Wed, 2 Dec 2020 00:16:41 +0000 (00:16 +0000)]
Daily bump.

3 years agoAdd feature test macro for atomic<T>::wait
Thomas Rodgers [Tue, 1 Dec 2020 23:41:08 +0000 (15:41 -0800)]
Add feature test macro for atomic<T>::wait

Adds __cpp_lib_atomic_wait feature test macro which was overlooked in
the initial commit of this feature. Replaces uses of
_GLIBCXX_HAVE_ATOMIC_WAIT.

libstdc++-v3/ChangeLog:

* include/bits/atomic_base.h: Replace usage of
_GLIBCXX_HAVE_ATOMIC_WAIT with __cpp_lib_atomic_wait.
* include/bits/atomic_timed_wait.h: Likewise.
* include/bits/atomic_wait.h: Define __cpp_lib_atomic_wait
feature test macro.
* include/bits/semaphore_base.h: Replace usage of
_GLIBCXX_HAVE_ATOMIC_WAIT with __cpp_lib_atomic_wait.
* include/std/atomic: Likewise.
* include/std/latch: Likewise.
* include/std/semaphore: Likewise.
* include/std/version: Define __cpp_lib_atomic wait
feature test macro and replace usage of
_GLIBCXX_HAVE_ATOMIC_WAIT.
* testsuite/29_atomics/atomic/wait_notify/1.cc: New test.
* testsuite/29_atomics/atomic/wait_notify/2.cc: Likewise.

3 years agoOptimize max/min pattern with comparison
Eugene Rozenfeld [Tue, 1 Dec 2020 23:26:59 +0000 (16:26 -0700)]
Optimize max/min pattern with comparison

gcc/
PR tree-optimization/96708
* match.pd: New pattern for comparing X with MAX (X, Y)
or MIN (X, y).

gcc/testsuite
* gcc.dg/pr96708-negative.c: New test.
* gcc.dg/pr96708-positive.c: New test.

3 years agoFix mcore multilib specification
Jeff Law [Tue, 1 Dec 2020 23:23:05 +0000 (16:23 -0700)]
Fix mcore multilib specification

gcc
* config/mcore/t-mcore (MULTILIB_EXCEPTIONS): Define.

3 years agoAdd pretty-printing support for __is_nothrow_{assignable,constructible}.
Ville Voutilainen [Tue, 1 Dec 2020 22:20:46 +0000 (00:20 +0200)]
Add pretty-printing support for __is_nothrow_{assignable,constructible}.

gcc/cp/ChangeLog:

PR c++/98054
* cxx-pretty-print.c (pp_cxx_trait_expression):
Add support for __is_nothrow_{assignable,constructible}.

3 years agoPR middle-end/97595 - bogus -Wstringop-overflow due to DECL_SIZE_UNIT underreporting...
Martin Sebor [Tue, 1 Dec 2020 22:10:30 +0000 (15:10 -0700)]
PR middle-end/97595 - bogus -Wstringop-overflow due to DECL_SIZE_UNIT underreporting field size

gcc/ChangeLog:

PR middle-end/97595
* tree.c (component_ref_size): Fail when DECL_SIZE != TYPE_SIZE.
* tree.h (DECL_SIZE, TYPE_SIZE): Update comment.

gcc/testsuite/ChangeLog:

PR middle-end/97595
* g++.dg/warn/Warray-bounds-14.C: New test.
* g++.dg/warn/Wstringop-overflow-6.C: New test.

3 years agoFix more minor testsuite fallout from improved switch optimization
Jeff Law [Tue, 1 Dec 2020 22:06:48 +0000 (15:06 -0700)]
Fix more minor testsuite fallout from improved switch optimization

gcc/testsuite
* gcc.dg/tree-ssa/pr96480.c: Disable jump table optimization

3 years agoFeature: Macros for identifying the wide and narrow execution string literal encoding
JeanHeyd Meneide [Tue, 1 Dec 2020 21:39:47 +0000 (14:39 -0700)]
Feature: Macros for identifying the wide and narrow execution string literal encoding

gcc/c-family
* c-cppbuiltin.c (c_cpp_builtins): Add predefined
{__GNUC_EXECUTION_CHARSET_NAME} and
_WIDE_EXECUTION_CHARSET_NAME} macros.

gcc/
* doc/cpp.texi: Document new macros.

gcc/testsuite/
* c-c++-common/cpp/wide-narrow-predef-macros.c: New test.

libcpp/
* charset.c (init_iconv_desc): Initialize "to" and "from" fields.
* directives.c (cpp_get_narrow_charset_name): New function.
(cpp_get_wide_charset_name): Likewise.
* include/cpplib.h (cpp_get_narrow_charset_name): Prototype.
(cpp_get_wide_charset_name): Likewise.
* internal.h (cset_converter): Add "to" and "from" fields.

3 years agolibstdc++: Pretty printers for _Bit_reference and _Bit_iterator
Michael Weghorn [Tue, 1 Dec 2020 21:19:20 +0000 (21:19 +0000)]
libstdc++: Pretty printers for _Bit_reference and _Bit_iterator

'std::_Bit_iterator' and 'std::_Bit_const_iterator' are the iterators
used by 'std::vector<bool>'.
'std::_Bit_reference' is e.g. used in range-based for loops over
'std::vector<bool>'  like

    std::vector<bool> vb {true, false, false};
    for (auto b : vb) {
        // b is of type std::_Bit_reference here
        // ...
    }

Like iterators of vectors for other types, the actual value is printed.

libstdc++-v3/ChangeLog:

* python/libstdcxx/v6/printers.py (StdBitIteratorPrinter)
(StdBitReferencePrinter): Add pretty-printers for
_Bit_reference, _Bit_iterator and _Bit_const_iterator.
* testsuite/libstdc++-prettyprinters/simple.cc: Test
std::_Bit_reference, std::_Bit_iterator and
std::_Bit_const_iterator.
* testsuite/libstdc++-prettyprinters/simple11.cc: Likewise.

3 years agoFix compromised tests after recent switch table improvements
Jeff Law [Tue, 1 Dec 2020 21:27:38 +0000 (14:27 -0700)]
Fix compromised tests after recent switch table improvements

gcc/testsuite
* gcc.dg/pr46309-2.c: Add -fno-bit-tests and -fno-jump-tables
to avoid compromising the test.

3 years agoopenmp: Avoid ICE on depend clause on depobj OpenMP construct [PR98072]
Jakub Jelinek [Tue, 1 Dec 2020 20:41:44 +0000 (21:41 +0100)]
openmp: Avoid ICE on depend clause on depobj OpenMP construct [PR98072]

Since r11-5430 we ICE on the following testcase.  When parsing the depobj
directive we don't really use cp_parser_omp_all_clauses routine which ATM
disables generation of location wrappers and the newly added assertion
that there are no location wrappers thus triggers.

Fixed by adding the location wrappers suppression sentinel.

Longer term, we should handle location wrappers inside of OpenMP clauses.

2020-12-01  Jakub Jelinek  <jakub@redhat.com>

PR c++/98072
* parser.c (cp_parser_omp_depobj): Suppress location wrappers when
parsing depend clause.

* c-c++-common/gomp/depobj-2.c: New test.

3 years agoPR middle-end/97373 - missing warning on sprintf into allocated destination
Martin Sebor [Tue, 1 Dec 2020 20:38:08 +0000 (13:38 -0700)]
PR middle-end/97373 - missing warning on sprintf into allocated destination

gcc/ChangeLog:

PR middle-end/97373
* builtins.c (compute_objsize): Rename...
(compute_objsize_r): to this.  Change order and types of arguments.
Use new argument.  Adjust calls to self.
(access_ref::get_ref): New member function.
(pointer_query::pointer_query): New member function.
(pointer_query::get_ref): Same.
(pointer_query::put_ref): Same.
(handle_min_max_size): Change order and types of arguments.
(maybe_emit_free_warning): Add a test.
* builtins.h (class pointer_query): New class.
(compute_objsize): Declare an overload.
* gimple-ssa-sprintf.c (get_destination_size): Add argument.
(handle_printf_call): Change argument type.
* tree-ssa-strlen.c (adjust_last_stmt): Add an argument and use it.
(maybe_warn_overflow): Same.
(handle_builtin_strcpy): Same.
(maybe_diag_stxncpy_trunc): Same.
(handle_builtin_memcpy): Change argument type.  Adjust calls.
(handle_builtin_strcat): Same.
(handle_builtin_memset): Same.
(handle_store): Same.
(strlen_check_and_optimize_call): Same.
(check_and_optimize_stmt): Same.
(strlen_dom_walker): Add new data members.
(strlen_dom_walker::before_dom_children): Use new member.
(printf_strlen_execute): Dump cache performance counters.  Remove
objsize pass cleanup.
* tree-ssa-strlen.h (maybe_diag_stxncpy_trunc): Add argument.
(handle_printf_call): Change argument type.

gcc/testsuite/ChangeLog:

PR middle-end/97373
* gcc.dg/tree-ssa/builtin-sprintf-warn-25.c: New test.

3 years agoMake -fzero-call-used-regs work on the SPARC
Eric Botcazou [Tue, 1 Dec 2020 20:12:54 +0000 (21:12 +0100)]
Make -fzero-call-used-regs work on the SPARC

This contains both a generic fixlet for targets implementing the leaf
register optimization (SPARC and Xtensa) and the implementation of the
target hook TARGET_ZERO_CALL_USED_REGS which is needed to make this work
on the SPARC.

gcc/ChangeLog:
* function.c (gen_call_used_regs_seq): In a function subject to the
leaf register optimization, skip registers that are not present.
* config/sparc/sparc.c (TARGET_ZERO_CALL_USED_REGS): Define to...
(sparc_zero_call_used_regs): ...this.  New function.

3 years agotestsuite: replace .* with a better regex
Martin Liska [Tue, 1 Dec 2020 20:02:15 +0000 (21:02 +0100)]
testsuite: replace .* with a better regex

gcc/testsuite/ChangeLog:

* g++.dg/tree-ssa/if-to-switch-1.C: Do not allow newlines
in .* pattern.
* gcc.dg/tree-ssa/if-to-switch-1.c: Likewise.
* gcc.dg/tree-ssa/if-to-switch-2.c: Likewise.
* gcc.dg/tree-ssa/if-to-switch-3.c: Likewise.
* gcc.dg/tree-ssa/if-to-switch-5.c: Likewise.

3 years agoDarwin, D : Adjust the X spec to cater for duplicate use.
Iain Sandoe [Tue, 1 Dec 2020 15:34:11 +0000 (15:34 +0000)]
Darwin, D : Adjust the X spec to cater for duplicate use.

The '-X' flag is an obsolete spelling for a command to tell the
linker to 'strip local symbols'.  This has been the default action
for a long time - but, as per the usual GCC approach, although the
flag is retired, we have not removed it; rather, we just delete it
in the driver self-spec.

The D language adds this flag as a front end option (to emit json)
which means that deleting it in the driver disables that function
in D.

This patch works around the duplication by removing the unused flag
in the link_spec instead of the driver self-spec.

gcc/ChangeLog:

* config/darwin.h: Remove unused 'X' specs in the link spec
rather than driver self-specs.

3 years agoif-to-switch: Fix test-suite patterns.
Martin Liska [Tue, 1 Dec 2020 19:38:40 +0000 (20:38 +0100)]
if-to-switch: Fix test-suite patterns.

gcc/testsuite/ChangeLog:

PR testsuite/98085
* g++.dg/tree-ssa/if-to-switch-1.C: Do not expect precise number
of BBs.
* gcc.dg/tree-ssa/if-to-switch-1.c: Likewise.
* gcc.dg/tree-ssa/if-to-switch-2.c: Likewise. Find better name
for the function.
* gcc.dg/tree-ssa/if-to-switch-3.c: Likewise. Find better name
for the function.
* gcc.dg/tree-ssa/if-to-switch-5.c: Likewise.

3 years agoC++ Module keywords
Nathan Sidwell [Tue, 1 Dec 2020 19:44:34 +0000 (11:44 -0800)]
C++ Module keywords

This adds the module keywords.  These are special internal tokens
generated by the preprocessor's module-control-line token peeking
logic.  Spelling them with a space means that they turn back into
regular tokens in preprocessor output (but do skew the column
numbering :()

gcc/c-family/
* c-common.c (module, import, export): New internal tokens (with
trailing space).
* c-common.h (RID__MODULE, RID__IMPORT & RID__EXPORT): Enumerate
them.
(D_CXX_MODULES, D_CXX_MODULES_FLAGS): Enable them.
* c-cppbuiltin.c (c_cpp_builtins): Feature macro.
gcc/cp/
* lex.c (init_reswords): Maybe enable module keywords.

3 years agoC++ Module parameters & timers
Nathan Sidwell [Tue, 1 Dec 2020 19:39:38 +0000 (11:39 -0800)]
C++ Module parameters & timers

Here is the new parameter and instrumentation timers for modules.

gcc/
* params.opt (lazy-modules): New.
* timevar.def (TV_MODULE_IMPORT, TV_MODULE_EXPORT)
(TV_MODULE_MAPPER): New.

3 years agoC++ Module options
Nathan Sidwell [Tue, 1 Dec 2020 18:28:15 +0000 (10:28 -0800)]
C++ Module options

This adds the C++ module options, and wires them into lang-specs.  The
options are not connected to any machinery.  The options! They do
nothing!

gcc/c-family/
* c-opts.c (c_common_init_options): Ask for module dependencies.
(c_common_handle_option): Handle -Mmodules -Mno-modules.
* c-pch.c (c_common_valid_pch): ... does not play with C++
modules.
* c.opt (Mmodules, Mno-modules): New preprocessor dependency
options.
(fmodules-ts, fmodule-header, fmodule-implicit-inline)
(fmodule-only, fmodule-mapper, fmodule-lazy)
(fmodule-version-ignore, Winvalid-imported-macros)
(flang-info-include-translate, flang-info-include-translate-not):
New options
gcc/cp/
* lang-specs.h: Add module-related options.

3 years agoImprove double-word mod even on powerpc [PR97459]
Jakub Jelinek [Tue, 1 Dec 2020 15:25:06 +0000 (16:25 +0100)]
Improve double-word mod even on powerpc [PR97459]

I have noticed that while my (already committed, thanks for review)
patch works on x86, it doesn't work on powerpc*.  The problem is that
we don't have lshr double-word optab (neither TImode nor for -m32 DImode),
but as expander has code for double-word shift, that doesn't really matter.
As the implementation is prepared to punt whenever something can't be
expanded with OPTAB_DIRECT and in the end also punts if any library calls
would be emitted, the optab_handler checks were just to save compile time.

On the other side, for even divisors, we know that (1 << bit) % (2 * x)
for bit > 0 will never be equal to 1, because both dividend and divisor
are even and so remainder will be even too, so we can save some compile time
by adding an early exit.

The even divisors can be handled with the approach Thomas wrote about
(perhaps generalized into divisors equal to what expand_doubleword_mod
can handle times some power of two where we can handle power of two modulo
cheaply), but that would be done in a different function...
And we could use ctz to find the power of two...

2020-12-01  Jakub Jelinek  <jakub@redhat.com>

PR rtl-optimization/97459
* optabs.c (expand_doubleword_mod): Punt early for even op1.
(expand_binop): Don't require lshr_optab double-word handler.

3 years agoloop-invariant: JUMP_INSNs aren't loop invariant [PR97954]
Jakub Jelinek [Tue, 1 Dec 2020 15:23:59 +0000 (16:23 +0100)]
loop-invariant: JUMP_INSNs aren't loop invariant [PR97954]

The following testcase ICEs because loop invariant motion moves asm goto
with a single output as invariant.
Normally, jumps aren't really moved, because if they are single set,
they have their SET_DEST (pc) and pc_rtx has VOIDmode on which one of the
functions find_invariant_insn calls bails out.  The code already punts on
insns that can throw or trap.  And for asm goto without outputs, it isn't
single set, or asm goto with two or more outputs it isn't single set either.

2020-12-01  Jakub Jelinek  <jakub@redhat.com>

PR rtl-optimization/97954
* loop-invariant.c (find_invariant_insn): Punt on JUMP_P insns.

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

3 years agoconfigury : Fix LEB128 support for non-GNU assemblers.
Iain Sandoe [Sat, 25 Aug 2018 12:58:02 +0000 (13:58 +0100)]
configury : Fix LEB128 support for non-GNU assemblers.

The current configuration test for LEB128 support in the assembler is
(a) specific to GNU assemblers and (b) only checks that the directives
are accepted, not that they give correct output.

The patch extends the asm test to cover one failure case present in
assemblers based off an older version of GAS (where a 64 bit value with
the MSB set presented to a .uleb128 directive causes a fail).

The test is now generalized such that it does not make use of any
specific test for assembler source/version, but checks that the output
is as expected.  We cater for scanning the object with objdump (either
binutils or LLVM) or Darwin otool.

gcc/ChangeLog:

* configure.ac (check leb128 support): Check that assemblers both
accept the LEB128 directives and also give the expected output.
Add a test for uleb128 with the MSB set for a 64 bit value.
* configure: Regenerated.

3 years agolibstdc++: Simplify detection of built-in functions
Jonathan Wakely [Tue, 1 Dec 2020 14:14:18 +0000 (14:14 +0000)]
libstdc++: Simplify detection of built-in functions

This fixes a regression affecting the Intel compiler. Because that
compiler defines __GNUC__ to match whatever version of GCC it finds on
the host system, it might claim to be a brand new GCC despite not
actually supporting all the built-ins that the latest GCC supports. This
means the config checks for __GNUC__ don't work. Most recently this
broke when r11-3569-g73ae6eb572515ad627b575a7fbdfdd47a4368e1c switched
us from using __is_same_as to __is_same when __GNUC__ >= 11.

Because __has_builtin is supported by all of GCC, Clang, and Intel we can
use that to reliably detect whether a given built-in is supported,
instead of hardcoding anything based on __GNUC__. The big caveat is
that for versions of Clang <= 9.0.0 and for (as far as I can tell) all
released versions of Intel icc, __has_builtin only evaluates to true for
built-ins with a name starting "__builtin_". For __is_aggregate,
__is_same, and __has_unique_object_representations it's necessary to use
__is_identifier to check if it's a valid identifeir token instead.

The solution used in this patch is to define _GLIBCXX_HAS_BUILTIN and
use that instead of using __has_builtin directly. For compilers that
define __is_identifier as well as __has_builtin we use both, so that if
__has_builtin evaluates to false we try again using !__is_identifier.

libstdc++-v3/ChangeLog:

* include/bits/c++config (_GLIBCXX_HAS_BUILTIN): Define macro to
work around different implementations of __has_builtin.
(_GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP)
(_GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE)
(_GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED)
(_GLIBCXX_HAVE_BUILTIN_IS_SAME, _GLIBCXX_HAVE_BUILTIN_LAUNDER):
Define using _GLIBCXX_HAS_BUILTIN.

3 years agoRegenerate a configure script omitted in r11-5520.
Iain Sandoe [Tue, 1 Dec 2020 13:52:28 +0000 (13:52 +0000)]
Regenerate a configure script omitted in r11-5520.

Additional change for : hppa64-hpux11 build to remove source paths
from embedded path.

gcc/ChangeLog:

* configure: Regnerated.

3 years agotestsuite: Correct check_effective_target_hwaddress_exec
Matthew Malcomson [Tue, 1 Dec 2020 11:40:18 +0000 (11:40 +0000)]
testsuite: Correct check_effective_target_hwaddress_exec

This test should ensure that we can compile with hwasan, that such a compiled
binary runs as expected, *and* that we're running on a kernel which implements
the capability to ignore the top bytes of pointers in syscalls.

It was expected that a basic test of `int main(void) { return 0; }` would check
this, since there is a check called during `__hwasan_init` in libhwasan to
ensure that the kernel we're running on provides a `prctl` to request the
relaxed ABI.

Unfortunately, the check in libhwasan has a bug in it, and does not correctly
fail when the kernel feature is not around.  This means that check is not
automatically provided by the runtime.

The sanitizer runtime will be fixed but would like to install this fix here in
case fixing the library is not quick enough for the release (and so that people
running the testsuite do not see spurious errors in the meantime).

Tested by running testsuite on an AArch64 machine with and without the required
kernel.
Observed that the test does indeed fail when the kernel feature is unavailable
and pass when the feature is available.

Note that this test is directly targetting AArch64 by using `prctl` numbers
specific to it.  That's unfortunate, but once the runtime fix has gone in we
will be able to remove that requirement.

Ok for trunk?

gcc/testsuite/ChangeLog:

* lib/hwasan-dg.exp (check_effective_target_hwaddress_exec): Fix
check for correct kernel version.

3 years agoC++ : Adjust warning for misplaced attributes.
Iain Sandoe [Fri, 27 Nov 2020 23:02:45 +0000 (23:02 +0000)]
C++ : Adjust warning for misplaced attributes.

This removes the reference to Objective-C++ for the warning that
attributes may not be placed before linkage specifications.  It also
adds a note that they may be placed after that.

gcc/cp/ChangeLog:

* parser.c (cp_parser_declaration): Add a not about where
attributes may be placed.

3 years agoIntroduce can_vec_cmp_compare_p
Ilya Leoshkevich [Tue, 24 Nov 2020 22:45:59 +0000 (23:45 +0100)]
Introduce can_vec_cmp_compare_p

This is the same as dcd2ca63ec5c ("Introduce can_vcond_compare_p
function"), but for vec_cmp.  The reason it's needed is that since
5d9ade39b872 ("IBM Z: Fix PR97326: Enable fp compares in vec_cmp")
and 4acba4859013 ("IBM Z: Restrict vec_cmp<m><n> on z13") s390's vec_cmp
expander advertises that it supports floating point comparisons except
signaling ones on z13, but the common code ignores the latter
restriction.

gcc/ChangeLog:

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

* optabs-tree.c (vec_cmp_icode_p): New function.
(vec_cmp_eq_icode_p): New function.
(expand_vec_cmp_expr_p): Use vec_cmp_icode_p and
vec_cmp_eq_icode_p.
(vcond_icode_p): Use get_rtx_code_1, just to be uniform with
vec_cmp_icode_p.
* optabs.c (unsigned_optab_p): New function.
(insn_predicate_matches_p): New function.
(can_vec_cmp_compare_p): New function.
(can_vcond_compare_p): Use unsigned_optab_p and
insn_predicate_matches_p.
(get_rtx_code): Use get_rtx_code_1.
(get_rtx_code_1): Version of get_rtx_code that returns UNKNOWN
instead of asserting.
* optabs.h (can_vec_cmp_compare_p): New function.
(get_rtx_code_1): New function.

3 years agolibstdc++: Use longer timeout for slow running tests
Jonathan Wakely [Tue, 1 Dec 2020 10:51:25 +0000 (10:51 +0000)]
libstdc++: Use longer timeout for slow running tests

libstdc++-v3/ChangeLog:

* testsuite/27_io/basic_istream/get/char/lwg3464.cc: Add
dg-timeout-factor directive.
* testsuite/27_io/basic_istream/get/wchar_t/lwg3464.cc:
Likewise.

3 years agoAdd if-chain to switch conversion pass.
Martin Liska [Fri, 28 Aug 2020 08:26:13 +0000 (10:26 +0200)]
Add if-chain to switch conversion pass.

gcc/ChangeLog:

PR tree-optimization/14799
PR ipa/88702
* Makefile.in: Add gimple-if-to-switch.o.
* dbgcnt.def (DEBUG_COUNTER): Add new debug counter.
* passes.def: Include new pass_if_to_switch pass.
* timevar.def (TV_TREE_IF_TO_SWITCH): New timevar.
* tree-pass.h (make_pass_if_to_switch): New.
* tree-ssa-reassoc.c (struct operand_entry): Move to the header.
(dump_range_entry): Move to header file.
(debug_range_entry): Likewise.
(no_side_effect_bb): Make it global.
* tree-switch-conversion.h (simple_cluster::simple_cluster):
Add inline for couple of functions in order to prevent error
about multiple defined symbols.
* gimple-if-to-switch.cc: New file.
* tree-ssa-reassoc.h: New file.

gcc/testsuite/ChangeLog:

PR tree-optimization/14799
PR ipa/88702
* gcc.dg/tree-ssa/pr96480.c: Disable if-to-switch conversion.
* gcc.dg/tree-ssa/reassoc-32.c: Likewise.
* g++.dg/tree-ssa/if-to-switch-1.C: New test.
* gcc.dg/tree-ssa/if-to-switch-1.c: New test.
* gcc.dg/tree-ssa/if-to-switch-2.c: New test.
* gcc.dg/tree-ssa/if-to-switch-3.c: New test.
* gcc.dg/tree-ssa/if-to-switch-4.c: New test.
* gcc.dg/tree-ssa/if-to-switch-5.c: New test.
* gcc.dg/tree-ssa/if-to-switch-6.c: New test.
* gcc.dg/tree-ssa/if-to-switch-7.c: New test.
* gcc.dg/tree-ssa/if-to-switch-8.c: New test.

3 years agolibstdc++: Link test with libatomic if needed [PR 98003]
Jonathan Wakely [Tue, 1 Dec 2020 10:36:09 +0000 (10:36 +0000)]
libstdc++: Link test with libatomic if needed [PR 98003]

libstdc++-v3/ChangeLog:

PR libstdc++/98003
* testsuite/27_io/basic_syncbuf/sync_ops/1.cc: Add options for
libatomic.

3 years agogcc/testsuite/s390: Add test cases for float_t
Marius Hillenbrand [Tue, 1 Dec 2020 10:05:42 +0000 (11:05 +0100)]
gcc/testsuite/s390: Add test cases for float_t

Add two test cases that check for acceptable combinations of float_t and
FLT_EVAL_METHOD on s390x.

Tested against an as-is glibc and one modified so that it derives
float_t from FLT_EVAL_METHOD.

gcc/testsuite/ChangeLog:

2020-12-01  Marius Hillenbrand  <mhillen@linux.ibm.com>

* gcc.target/s390/float_t-1.c: New test.
* gcc.target/s390/float_t-2.c: New test.

3 years agoIBM Z: Configure excess precision for float at compile-time
Marius Hillenbrand [Tue, 1 Dec 2020 10:02:27 +0000 (11:02 +0100)]
IBM Z: Configure excess precision for float at compile-time

Historically, float_t has been defined as double on s390 and gcc would
emit double precision insns for evaluating float expressions when in
standard-compliant mode. Configure that behavior at compile-time as prep
for changes in glibc: When glibc ties float_t to double, keep the old
behavior; when glibc derives float_t from FLT_EVAL_METHOD (as on most
other archs), revert to the default behavior (i.e.,
FLT_EVAL_METHOD_PROMOTE_TO_FLOAT). Provide a configure option
--enable-s390-excess-float-precision to override the check.

gcc/ChangeLog:

2020-12-01  Marius Hillenbrand  <mhillen@linux.ibm.com>

* configure.ac: Add configure option
--enable-s390-excess-float-precision and check to derive default
from glibc.
* config/s390/s390.c: Guard s390_excess_precision with an ifdef
for ENABLE_S390_EXCESS_FLOAT_PRECISION.
* doc/install.texi: Document --enable-s390-excess-float-precision.
* configure: Regenerate.
* config.in: Regenerate.

3 years agotestsuite: remove LIT annotation and reduce
Martin Liska [Mon, 30 Nov 2020 14:00:28 +0000 (15:00 +0100)]
testsuite: remove LIT annotation and reduce

I noticed the test-case contains LIT annotation and
it is possible to reduce. I did that with compiler that
was affected by the PR.

gcc/testsuite/ChangeLog:

* g++.dg/torture/pr93347.C: Reduce and remove LIT keywords.

3 years agoIPA: drop implicit_section again
Martin Liska [Mon, 30 Nov 2020 12:07:27 +0000 (13:07 +0100)]
IPA: drop implicit_section again

As mentioned in the PR, since 4656461585bfd0b9 implicit_section
was not set to false when set_section was called with the argument
equal to NULL.

gcc/ChangeLog:

PR ipa/98057
* symtab.c (symtab_node::set_section_for_node): Drop
implicit_section if x_section is NULL.

gcc/testsuite/ChangeLog:

PR ipa/98057
* g++.dg/ipa/pr98057.C: New test.

3 years agox86_64: Fix up -fpic -mcmodel=large -fno-plt [PR98063]
Jakub Jelinek [Tue, 1 Dec 2020 09:44:40 +0000 (10:44 +0100)]
x86_64: Fix up -fpic -mcmodel=large -fno-plt [PR98063]

On the following testcase with -fpic -mcmodel=large -fno-plt we emit
call puts@GOTPCREL(%rip)
but that is not really appropriate for CM_LARGE_PIC, the .text can be larger
than 2GB in that case and the .got slot further away from %rip than what can
fit into the signed 32-bit immediate.

The following patch computes the address of the .got slot the way it is
computed for that model for function pointer loads, and calls that.

2020-12-01  Jakub Jelinek  <jakub@redhat.com>

PR target/98063
* config/i386/i386-expand.c (ix86_expand_call): Handle non-plt
CM_LARGE_PIC calls.

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

3 years agomiddle-end/98070 - fix realloc builtin fnspec
Richard Biener [Tue, 1 Dec 2020 08:19:52 +0000 (09:19 +0100)]
middle-end/98070 - fix realloc builtin fnspec

realloc clobbers errno, note that.

2020-12-01  Richard Biener  <rguenther@suse.de>

PR middle-end/98070
* builtins.c (builtin_fnspec): realloc is ".Cw ".

3 years agoc++, debug: Treat -std=c++20 -gdwarf-5 like C++14 rather than C++98
Jakub Jelinek [Tue, 1 Dec 2020 08:41:16 +0000 (09:41 +0100)]
c++, debug: Treat -std=c++20 -gdwarf-5 like C++14 rather than C++98

I have noticed that while we use DW_LANG_C_plus_plus_14 for -std=c++17 -gdwarf-5,
we use DW_LANG_C_plus_plus (aka C++98) for -std=c++20 -gdwarf-5.  The
following patch makes those two match.

2020-12-01  Jakub Jelinek  <jakub@redhat.com>

* dwarf2out.c (gen_compile_unit_die): Treat GNU C++20
like C++14 for -gdwarf-5.

* g++.dg/debug/dwarf2/lang-cpp17.C: New test.
* g++.dg/debug/dwarf2/lang-cpp20.C: New test.

3 years agodriver: Don't imply -dD for -g3 -g0 [PR97989]
Jakub Jelinek [Tue, 1 Dec 2020 08:39:04 +0000 (09:39 +0100)]
driver: Don't imply -dD for -g3 -g0 [PR97989]

The driver enables -dD when preprocessing when -g3 is specified, for obvious reasons
that we need the macros to be preserved somewhere for them to make up the debug
info.  But it enables it even if -g3 is later overridden to -g2, -g1 or -g0,
where we in the end don't emit .debug_mac{ros,info}.

The following patch passes -dD only if we'll need it.

2020-12-01  Jakub Jelinek  <jakub@redhat.com>

PR debug/97989
* gcc.c (cpp_unique_options): Add -dD if %:debug-level-gt(2)
rather than g3|ggdb3|gstabs3|gxcoff3|gvms3.

* gcc.dg/cpp/pr97989-1.c: New test.
* gcc.dg/cpp/pr97989-2.c: New test.

3 years agoRISC-V: Drop some commited accidentally code.
Kito Cheng [Tue, 1 Dec 2020 07:39:09 +0000 (15:39 +0800)]
RISC-V: Drop some commited accidentally code.

gcc/ChangeLog:

* config.gcc (riscv*-*-*): Drop some commited accidentally code.

3 years agoDaily bump.
GCC Administrator [Tue, 1 Dec 2020 00:16:38 +0000 (00:16 +0000)]
Daily bump.

3 years agoUnbreak build with --disable-analyzer
David Malcolm [Mon, 30 Nov 2020 22:37:50 +0000 (17:37 -0500)]
Unbreak build with --disable-analyzer

I broke the build with --disable-analyzer with
g:66dde7bc64b75d4a338266333c9c490b12d49825, due to:

../../src/gcc/analyzer/analyzer-pass.cc: In member function â€˜virtual unsigned int {anonymous}::pass_analyzer::execute(function*)’:
../../src/gcc/analyzer/analyzer-pass.cc:86:3: error: â€˜sorry_no_analyzer’ was not declared in this scope
   86 |   sorry_no_analyzer ();
      |   ^~~~~~~~~~~~~~~~~

Fixed by including the relevant header file.
Sorry about the breakage.

gcc/analyzer/ChangeLog:
* analyzer-pass.cc: Include "analyzer/analyzer.h" for the
declaration of sorry_no_analyzer; include "tree.h" and
"function.h" as these are needed by it.

3 years agoAdd function comments for recently added member functions.
Jeff Law [Mon, 30 Nov 2020 22:21:38 +0000 (15:21 -0700)]
Add function comments for recently added member functions.

gcc/
* symtab.c (set_section_for_node): Add function comment.
(set_section_from_node): Likewise.

3 years agointernal/cpu: don't define CacheLinePadSize for mips64x
Ian Lance Taylor [Sat, 28 Nov 2020 19:29:25 +0000 (11:29 -0800)]
internal/cpu: don't define CacheLinePadSize for mips64x

For libgo the definition comes from the generated file cpugen.go.

Fixes PR go/98041

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

3 years agocompiler, runtime: check len/cap for append(s, make(T, l)...)
Ian Lance Taylor [Sat, 28 Nov 2020 14:48:54 +0000 (06:48 -0800)]
compiler, runtime: check len/cap for append(s, make(T, l)...)

The overflow checks done in growslice always reported an error for the
capacity argument, even if it was the length argument that overflowed.
This change lets the code pass the current issue4085b.go test.

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

3 years agolibgo: define SO_RCVTIMEO on 32-bit GNU/Linux
Ian Lance Taylor [Sun, 29 Nov 2020 18:16:27 +0000 (10:16 -0800)]
libgo: define SO_RCVTIMEO on 32-bit GNU/Linux

Fixes golang/go#42872

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

3 years agocompiler: improve error messages for expected curly brace
Ian Lance Taylor [Sun, 29 Nov 2020 02:51:05 +0000 (18:51 -0800)]
compiler: improve error messages for expected curly brace

For golang/go#17328

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

3 years agocompiler: use correct assignment order for type assertions
Ian Lance Taylor [Sun, 29 Nov 2020 02:47:42 +0000 (18:47 -0800)]
compiler: use correct assignment order for type assertions

For "a, b := v.(T)" we must set a before b.

For golang/go#13433

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

3 years agocompiler: always use int context for index values
Ian Lance Taylor [Sun, 29 Nov 2020 02:22:45 +0000 (18:22 -0800)]
compiler: always use int context for index values

For golang/go#14844

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

3 years agocompiler: better error messages for missing interface method
Ian Lance Taylor [Sat, 28 Nov 2020 20:41:06 +0000 (12:41 -0800)]
compiler: better error messages for missing interface method

For golang/go#10700

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

3 years agocompiler: improve error for import of non-string
Ian Lance Taylor [Sat, 28 Nov 2020 20:14:40 +0000 (12:14 -0800)]
compiler: improve error for import of non-string

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

3 years agoAdd analyzer plugin support and CPython GIL example
David Malcolm [Mon, 30 Nov 2020 19:32:28 +0000 (14:32 -0500)]
Add analyzer plugin support and CPython GIL example

This patch adds a new GCC plugin event: PLUGIN_ANALYZER_INIT, called
when -fanalyzer is starting, allowing for GCC plugins to register
additional state-machine-based checks within -fanalyzer.  The idea
is that 3rd-party code might want to add domain-specific checks for
its own APIs - with the caveat that the analyzer is itself still
rather experimental.

As an example, the patch adds a proof-of-concept plugin to the testsuite
for checking CPython code: verifying that code that relinquishes
CPython's global interpreter lock doesn't attempt to do anything with
PyObjects in the sections where the lock isn't held.  It also adds a
warning about nested releases of the lock, which is forbidden.
For example:

demo.c: In function 'foo':
demo.c:11:3: warning: use of PyObject '*(obj)' without the GIL
   11 |   Py_INCREF (obj);
      |   ^~~~~~~~~
  'test': events 1-3
    |
    |   15 | void test (PyObject *obj)
    |      |      ^~~~
    |      |      |
    |      |      (1) entry to 'test'
    |   16 | {
    |   17 |   Py_BEGIN_ALLOW_THREADS
    |      |   ~~~~~~~~~~~~~~~~~~~~~~
    |      |   |
    |      |   (2) releasing the GIL here
    |   18 |   foo (obj);
    |      |   ~~~~~~~~~
    |      |   |
    |      |   (3) calling 'foo' from 'test'
    |
    +--> 'foo': events 4-5
           |
           |    9 | foo (PyObject *obj)
           |      | ^~~
           |      | |
           |      | (4) entry to 'foo'
           |   10 | {
           |   11 |   Py_INCREF (obj);
           |      |   ~~~~~~~~~
           |      |   |
           |      |   (5) PyObject '*(obj)' used here without the GIL
           |

Doing so requires adding some logic for ignoring macro expansions in
analyzer diagnostics, since the insides of Py_INCREF and
Py_BEGIN_ALLOW_THREADS are not of interest to the user for these cases.

gcc/analyzer/ChangeLog:
* analyzer-pass.cc (pass_analyzer::execute): Move sorry call to...
(sorry_no_analyzer): New.
* analyzer.h (class state_machine): New forward decl.
(class logger): New forward decl.
(class plugin_analyzer_init_iface): New.
(sorry_no_analyzer): New decl.
* checker-path.cc (checker_path::fixup_locations): New.
* checker-path.h (checker_event::set_location): New.
(checker_path::fixup_locations): New decl.
* diagnostic-manager.cc
(diagnostic_manager::emit_saved_diagnostic): Call
checker_path::fixup_locations, and call fixup_location
on the primary location.
* engine.cc: Include "plugin.h".
(class plugin_analyzer_init_impl): New.
(impl_run_checkers): Invoke PLUGIN_ANALYZER_INIT callbacks.
* pending-diagnostic.h (pending_diagnostic::fixup_location): New
vfunc.

gcc/ChangeLog:
* doc/plugins.texi (Plugin callbacks): Add PLUGIN_ANALYZER_INIT.
* plugin.c (register_callback): Likewise.
(invoke_plugin_callbacks_full): Likewise.
* plugin.def (PLUGIN_ANALYZER_INIT): New event.

gcc/testsuite/ChangeLog:
* gcc.dg/plugin/analyzer_gil_plugin.c: New test.
* gcc.dg/plugin/gil-1.c: New test.
* gcc.dg/plugin/gil.h: New header.
* gcc.dg/plugin/plugin.exp (plugin_test_list): Add the new plugin
and test.

3 years agoRemove dead cc0 code from H8 port
Jeff Law [Mon, 30 Nov 2020 19:11:34 +0000 (12:11 -0700)]
Remove dead cc0 code from H8 port

gcc/
* config/h8300/bitfield.md: Remove "cc" attribute on any
insns where it remained.
* config/h8300/combiner.md: Likewise.
* config/h8300/jumpcall.md: Likewise.
* config/h8300/logical.md: Likewise.
* config/h8300/testcompare.md: Likewise.
* config/h8300/h8300.md (old_cc attr): Renamed from cc attr.
* config/h8300/h8300.c (notice_update_cc): Remove.
(compute_plussi_cc): Change references to CC_* to OLD_CC_.
(compute_logical_op_cc): Likewise.
(shift_one, shift_two): Likewise.
(compute_a_shift_cc): Likewise.
(get_shift_alg): Likewise.
(struct shift_insn): Change type of cc_valid field.
(struct shift_info): Likewise.
* config/h8300/save.md: Remove accidentially created file.

3 years agoprofopt-execute: unset testname_with_flags if create_gcov fails
Ilya Leoshkevich [Thu, 26 Nov 2020 12:24:23 +0000 (13:24 +0100)]
profopt-execute: unset testname_with_flags if create_gcov fails

When diffing test results, there sometimes occur spurious "New tests
that PASS" / "Old tests that passed, that have disappeared" messages.
The reason is that if create_gcov is not installed, then the cached
testname_with_flags is not cleared and is carried over to the next
test.

gcc/testsuite/ChangeLog:

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

* lib/profopt.exp: Unset testname_with_flags if create_gcov
fails.

3 years agodse: Cope with bigger-than-integer modes [PR98037]
Richard Sandiford [Mon, 30 Nov 2020 17:15:47 +0000 (17:15 +0000)]
dse: Cope with bigger-than-integer modes [PR98037]

dse.c:find_shift_sequence tries to represent a store and load
back as a shift right followed by a truncation.  It therefore
needs to find an integer mode in which to do the shift right.
The loop it uses has the form:

  FOR_EACH_MODE_FROM (new_mode_iter,
      smallest_int_mode_for_size (GET_MODE_BITSIZE (read_mode)))

which implicitly assumes that read_mode has an equivalent integer mode.
As shown in the testcase, not all modes have such an integer mode.

This patch just makes the code start from the smallest integer mode and
skip modes that are too small.  The loop already breaks at the first
mode wider than word_mode.

gcc/
PR rtl-optimization/98037
* dse.c (find_shift_sequence): Iterate over all integers and
skip modes that are too small.

gcc/testsuite/
PR rtl-optimization/98037
* gcc.target/aarch64/sve/acle/general/pr98037.c: New test.

3 years agoOptimize or+and+or pattern to and+or
Eugene Rozenfeld [Mon, 30 Nov 2020 16:48:58 +0000 (09:48 -0700)]
Optimize or+and+or pattern to and+or

gcc/
PR tree-optimization/96679
* match.pd (((b | c) & a) | b -> (a & c) | b): New pattern.

3 years agoipa: dump symtab to emergency dump file
Martin Liska [Mon, 30 Nov 2020 14:02:57 +0000 (15:02 +0100)]
ipa: dump symtab to emergency dump file

gcc/ChangeLog:

* passes.c (emergency_dump_function): Dump symtab when
we are in an IPA pass.

3 years agochangelog: add hint for a file mismatch
Martin Liska [Mon, 30 Nov 2020 16:19:41 +0000 (17:19 +0100)]
changelog: add hint for a file mismatch

contrib/ChangeLog:

* gcc-changelog/git_commit.py: Suggest close file for
'unchanged file mentioned in a ChangeLog' error.
* gcc-changelog/test_email.py: Test it.

3 years agoFix non-unique testnames
Jeff Law [Mon, 30 Nov 2020 15:59:23 +0000 (08:59 -0700)]
Fix non-unique testnames

gcc/testsuite

* g++.dg/warn/Wnonnull5.C: Fix non-unique testnames.
* g++.dg/warn/Wplacement-new-size-8.C: Likewise.

3 years agolibstdc++: Add new C++20 headers to Doxygen settings
Jonathan Wakely [Mon, 30 Nov 2020 15:02:03 +0000 (15:02 +0000)]
libstdc++: Add new C++20 headers to Doxygen settings

This doesn't actually have any effect unless you also change the
predefined value of __cplusplus, as it's currently 201703L. But if
somebody does want to do that, the new headers will get processed now.

libstdc++-v3/ChangeLog:

* doc/doxygen/user.cfg.in (INPUT): Add <latch> and <semaphore>.

3 years agolibstdc++: Reduce default test timeout to 360 seconds
Jonathan Wakely [Mon, 30 Nov 2020 14:39:54 +0000 (14:39 +0000)]
libstdc++: Reduce default test timeout to 360 seconds

The current default of 10 minutes is much longer than most tests need on
common hardware. The slow tests all now have a dg-timeout-factor
directive that gives them more time to run relative to the default. The
default can also be overridden in ~/.dejagnurc or DEJAGNU=site.exp, so
it seems unnecessary to have such a large default.

This reduces the default from 10 minutes to 6 minutes, which still seems
more than enough.

libstdc++-v3/ChangeLog:

* testsuite/lib/libstdc++.exp (libstdc++_init): Reduce
default tool_timeout to 360.

3 years agolibstdc++: Set dg-timeout-factor for more slow tests
Jonathan Wakely [Mon, 30 Nov 2020 14:39:54 +0000 (14:39 +0000)]
libstdc++: Set dg-timeout-factor for more slow tests

As in r11-5449, this adds a muliplier to the timeout for slow tests.
This covers the majority of the <regex> and PSTL tests.

libstdc++-v3/ChangeLog:

* testsuite/20_util/specialized_algorithms/pstl/*: Add
dg-timeout-factor.
* testsuite/25_algorithms/pstl/*: Likewise.
* testsuite/26_numerics/pstl/*: Likewise.
* testsuite/28_regex/*: Likewise.

3 years agoFortran: With OpenACC, ignore OpenMP's cond comp sentinels
Tobias Burnus [Mon, 30 Nov 2020 14:30:51 +0000 (15:30 +0100)]
Fortran: With OpenACC, ignore OpenMP's cond comp sentinels

gcc/fortran/ChangeLog:

PR fortran/98011
* scanner.c (skip_free_comments, skip_fixed_comments): If only
-fopenacc but not -fopenmp is used, ignore OpenMP's conditional
compilation sentinels. Fix indentation, use 'else if' for readability.

gcc/testsuite/ChangeLog:

PR fortran/98011
* gfortran.dg/goacc/sentinel-free-form.f95:
* gfortran.dg/goacc-gomp/fixed-1.f: New test.
* gfortran.dg/goacc-gomp/free-1.f90: New test.
* gfortran.dg/goacc/fixed-5.f: New test.

3 years agoFortran: -fno-automatic and -fopenacc / recusion check cleanup
Tobias Burnus [Mon, 30 Nov 2020 14:27:44 +0000 (15:27 +0100)]
Fortran: -fno-automatic and -fopenacc / recusion check cleanup

Options: -fopenmp and -fopenacc imply concurrent calls to a
procedure; now also -fopenacc implies -frecursive, disabling
that larger local const-size array variables use static memory.

Run-time recursion check: Always reset the check variable at the
end of the procedure; this avoids a bogus error with -fopenmp
when called twice nonconcurrently/nonrecursively. (Issue requires
using -fno-automatic or -fmax-stack-var-size= to trigger.)

gcc/fortran/ChangeLog:

PR fortran/98010
PR fortran/98013
* options.c (gfc_post_options): Also imply recursive with
-fopenacc.
* trans-decl.c (gfc_generate_function_code): Simplify condition.

3 years agoFortran's dump-parse-tree.c: Use '==' not '=' for '.eq.'.
Tobias Burnus [Mon, 30 Nov 2020 14:19:39 +0000 (15:19 +0100)]
Fortran's dump-parse-tree.c: Use '==' not '=' for '.eq.'.

gcc/fortran/
* dump-parse-tree.c (show_expr): Use '==' not '=' for '.eq.'.

3 years ago[Ada] s-trasym.ads: update the list of supported platforms
Pierre-Marie de Rodat [Tue, 24 Nov 2020 06:29:50 +0000 (01:29 -0500)]
[Ada] s-trasym.ads: update the list of supported platforms

gcc/ada/

* libgnat/s-trasym.ads: Update the list of supported platforms.

3 years ago[Ada] Remove all ^L characters
Arnaud Charlet [Sat, 24 Oct 2020 11:14:15 +0000 (11:14 +0000)]
[Ada] Remove all ^L characters

gcc/ada/

* gcc-interface/Makefile.in, gcc-interface/trans.c: Remove ^L
characters.

3 years ago[Ada] Enable checks on runtime by default
Arnaud Charlet [Mon, 2 Nov 2020 17:27:55 +0000 (12:27 -0500)]
[Ada] Enable checks on runtime by default

gcc/ada/

* gcc-interface/Makefile.in (GNATLIBFLAGS): Enable checks by
default.
* libgnat/s-bitfie.ads: Suppress alignment checks.
* libgnat/s-bituti.adb: Minor reformatting.
* libgnat/s-secsta.adb (SS_Allocate): Support Size = 0.

3 years ago[Ada] Wrong replacement of Component.Discriminant
Arnaud Charlet [Sun, 15 Nov 2020 16:20:42 +0000 (11:20 -0500)]
[Ada] Wrong replacement of Component.Discriminant

gcc/ada/

* exp_ch3.adb (Replace_Discr_Ref): Removed, no longer needed.

3 years ago[Ada] Minor reuse Is_Assignable
Piotr Trojanek [Sun, 15 Nov 2020 11:03:30 +0000 (12:03 +0100)]
[Ada] Minor reuse Is_Assignable

gcc/ada/

* sem_ch5.adb (Process_Statements): Replace low-level membership
test with a high-level wrapper.

3 years ago[Ada] Simplify analysis of assignment statements
Piotr Trojanek [Sun, 15 Nov 2020 00:21:41 +0000 (01:21 +0100)]
[Ada] Simplify analysis of assignment statements

gcc/ada/

* sem_ch5.adb (Set_Assignment_Type): Combine calls to Ekind
using membership test.
(Should_Transform_BIP_Assignment): Replace assignment to a
"Result" variable with simple return statements; avoid repeated
calls to Unqual_Conv by declaring a local constant.

3 years ago[Ada] Minor reuse Is_Protected_Component
Piotr Trojanek [Sat, 14 Nov 2020 22:26:05 +0000 (23:26 +0100)]
[Ada] Minor reuse Is_Protected_Component

gcc/ada/

* lib-xref.adb (Generate_Reference): Fix reference to
Analyze_Assignment.
* sem_ch5.adb (Diagnose_Non_Variable_Lhs): Reuse existing
utility function.

3 years ago[Ada] Fix internal error on extended return and fixed-point result
Eric Botcazou [Sat, 14 Nov 2020 15:12:04 +0000 (16:12 +0100)]
[Ada] Fix internal error on extended return and fixed-point result

gcc/ada/

* contracts.adb (Check_Type_Or_Object_External_Properties): Make
sure to exclude all return objects from the SPARK legality rule
on effectively volatile variables.
* exp_ch6.adb (Expand_N_Extended_Return_Statement): Use the fast
track only when the declaration of the return object can be
dropped.

3 years ago[Ada] Implement inheritance for Default_Initial_Condition and address other gaps
Gary Dismukes [Mon, 2 Nov 2020 06:21:09 +0000 (01:21 -0500)]
[Ada] Implement inheritance for Default_Initial_Condition and address other gaps

gcc/ada/

* einfo.ads (Is_Partial_DIC_Procedure): New function.
(Partial_DIC_Procedure): New procedure.
* einfo.adb (Is_Partial_DIC_Procedure): New function to return
whether a subprogram is a partial Default_Initial_Condition
procedure by checking the name (to avoid adding a new field).
(DIC_Procedure): Add a test that excludes partial DIC procedures
from being returned.
(Partial_DIC_Procedure): New procedure to return the partial DIC
procedure of a type, if it has one (otherwise returns Empty).
(Set_DIC_Procedure): Remove check for duplicate DIC procedures.
* exp_aggr.adb (Gen_Assign): Generate a call to the type's DIC
procedure in the case where an array component is default
initialized (due to an association with a box).
(Build_Record_Aggr_Code): For an extension aggregate, generate a
call to the ancestor type's DIC procedure (if any) when the
ancestor part is a subtype mark. For a record component
association that was specified with a box (tested for by
checking the new flag Was_Default_Init_Box_Association),
generate a call to the component type's DIC procedure (if it has
one).
* exp_ch4.adb (Expand_N_Allocator): When the allocated object is
default initialized and the designated type has a DIC aspect,
generate a call to the DIC procedure.
* exp_util.ads (Build_DIC_Call): Change the formal Obj_Id to
name Obj_Name, and change its type from Entity_Id to Node_Id
(and update comment).
(Build_DIC_Procedure_Body): Add formal Partial_DIC, remove
formal For_Freeze, and update comment accordingly.
(Build_DIC_Procedure_Declaration): Add formal Partial_DIC and
update comment.
* exp_util.adb
(Build_DIC_Call): Revised to use its Obj_Name (formerly Obj_Id)
formal directly rather than calling New_Occurrence_Of on it, to
allow arbitrary names to be passed rather than being limited to
Entity_Ids.
(Build_DIC_Procedure_Body): Call Add_Parent_DICs to generate
checks for DICs associated with any parent types, implementing
the required "additive" semantics for DICs. When building a DIC
procedure body for a partial view (when Partial_DIC is True),
call Add_Own_DIC when the type has its own DIC.  In the case of
"full" DIC procedures, a call is generated to any partial DIC
procedure of the type (unless the procedure has a null body),
along with checks for any DICs inherited by the full view.
(Build_DIC_Procedure_Declaration): Add handling for partial DIC
procedures.  For the suffix of a regular DIC procedure's name,
use "DIC" (instead of "Default_Initial_Condition"), and for the
suffix of a partial DIC procedure's name, use "Partial_DIC".
(Add_DIC_Check): Add the DIC pragma to the list of seen pragmas
(Pragmas_Seen).
(Add_Inherited_Tagged_DIC): Remove the formals Par_Typ,
Deriv_Typ, and Obj_Id, and add formal Expr, which denotes DIC's
expression. Remove the call to Replace_References (which is now
done in Add_Inherited_DICs).
(Add_Inherited_DICs): New procedure to locate a DIC pragma
associated with a parent type, replace its references
appropriately (such as any current instance references), and add
a check for the DIC.
(Add_Own_DIC): Add an Obj_Id formal to allow caller to pass the
_init formal of the generated DIC procedure.
(Add_Parent_DICs): New procedure to traverse a type's parents,
looking for DICs associated with those and calling
Add_Inherited_DICs to apply the appropriate DIC checks.
(Is_Verifiable_DIC_Pragma): Treat pragmas that have an Empty
first argument the same as a pragma without any arguments
(returning False for that case).
* exp_ch3.adb (Init_One_Dimension): Generate calls to the
component's DIC procedure when needed.
(Possible_DIC_Call): New function nested in Init_One_Dimension
to build a call to the array component type's DIC-checking
function when appropriate.
(Build_Array_Init_Proc): The presence of a DIC on the component
type is an additional condition for generating an init proc for
an array type.
(Build_Init_Statements): When the record component's type has a
DIC, and the component declaration does not have an
initialization expression, generate a call to the component
type's DIC procedure.
(Expand_N_Object_Declaration): Modify the call to Build_DIC_Call
to pass a new occurrence of the object's defining id rather than
the id itself.
(Freeze_Type): Only build a type's DIC procedure (if it has one)
for types that are not interfaces.
* exp_spark.adb (Expand_SPARK_N_Freeze_Type): Remove From_Freeze
actual and add a ??? comment.
(Expand_SPARK_N_Object_Declaration): Modify call to
Build_DIC_Call to pass a new occurrence of the object id rather
than the object id itself.
* sem_aggr.adb (Resolve_Record_Aggregate): Declare local flag
Is_Box_Init_By_Default and set it in cases where the component
association has a box and the component is being initialized by
default (as opposed to initialized by an initialization
expression associated with the component's declaration).
(Add_Association): If the association has a box for a component
initialized by default, the flag
Was_Default_Init_Box_Association is set on the new component
association (for later testing during expansion).
(Get_Value): Reset Is_Box_Init_By_Default to False.
* sem_ch3.adb (Build_Assertion_Bodies_For_Type): Rearrange code
to build DIC procedure bodies for a (noninterface) type that
Has_Own_DIC (for partial type views) or Has_DIC (for full type
views) as appropriate.
* sem_ch13.adb (Analyze_Aspect_Specifications,
Aspect_Default_Initial_Condition): Add an extra argument to the
DIC pragma to denote the type associated with the pragma (for
use in Build_DIC_Procedure_Body).
* sem_prag.adb (Analyze_Pragma): Allow two arguments for pragma
Default_Initial_Condition.  If not already present, add an extra
argument denoting the type that the pragma is associated with.
* sem_util.adb (Propagate_DIC_Attributes): Retrieve any partial
DIC procedure associated with the type and add it to the type's
list of subprograms (Subprograms_For_Type).
* sinfo.ads (Was_Default_Init_Box_Association): New flag on
N_Component_Association nodes.  Add subprograms to get and set
flag, as well as updating the documentation.
* sinfo.adb (Was_Default_Init_Box_Association): New function to
retrieve the corresponding flag (Flag14).
(Set_Was_Default_Init_Box_Association): New procedure to set the
corresponding flag (Flag14).

3 years ago[Ada] Improve error recovery
Arnaud Charlet [Fri, 13 Nov 2020 14:56:14 +0000 (09:56 -0500)]
[Ada] Improve error recovery

gcc/ada/

* par-ch6.adb (P_Formal_Part): Remove extra call to Scan.
* par-tchk.adb: Minor reformatting.

3 years ago[Ada] Reimplement Ada.Numerics.Big_Numbers.Big_Reals.Fixed_Conversions
Eric Botcazou [Thu, 12 Nov 2020 14:56:00 +0000 (15:56 +0100)]
[Ada] Reimplement Ada.Numerics.Big_Numbers.Big_Reals.Fixed_Conversions

gcc/ada/

* libgnat/a-nbnbre.adb (Float_Conversions): Instantiate Conv
package only once in the body.
(Fixed_Conversions.Float_Aux): New instance.
(Fixed_Conversions.Conv_I): Likewise.
(Fixed_Conversions.Conv_U): Likewise.
(Fixed_Conversions.LLLI): New subtype.
(Fixed_Conversions.LLLU): Likewise.
(Fixed_Conversions.Too_Large): New constant.
(Fixed_Conversions.To_Big_Real): Reimplement.
(Fixed_Conversions.From_Big_Real): Likewise.

3 years ago[Ada] Compiler crash on limited conditional expressions
Bob Duff [Thu, 12 Nov 2020 19:40:39 +0000 (14:40 -0500)]
[Ada] Compiler crash on limited conditional expressions

gcc/ada/

* exp_ch3.adb (Expand_N_Object_Declaration): Avoid crash in case
of conditional expression.

3 years ago[Ada] Expand integer-only implementation of ordinary fixed-point types
Eric Botcazou [Tue, 10 Nov 2020 11:14:56 +0000 (12:14 +0100)]
[Ada] Expand integer-only implementation of ordinary fixed-point types

gcc/ada/

* doc/gnat_rm/implementation_defined_attributes.rst (Pool_Address):
Fix pasto.
(Small_Denominator): New entry.
(Small_Numerator): Likewise.
* doc/gnat_rm/implementation_defined_characteristics.rst (3.5.9):
Relax conditions on 128-bit smalls and integer-only implementation.
* gnat_rm.texi: Regenerate.
* exp_attr.adb (Expand_N_Attribute_Reference) <Attribute_Fore>:
Relax conditions on integer implementation for ordinary fixed-point
types and pass a third parameter to the routine.
<Attribute_Small_Denominator>: Raise Program_Error.
<Attribute_Small_Numerator>: Likewise.
* exp_fixd.adb (Expand_Convert_Fixed_To_Fixed): Use a scaled divide
if the numerator and denominator of the small ratio are sufficiently
small integers.
(Expand_Convert_Fixed_To_Integer): Use a scaled divide if numerator
and denominator of the small value are sufficiently small integers.
(Expand_Convert_Integer_To_Fixed): Likewise.
* exp_imgv.adb (Expand_Image_Attribute): Relax the conditions on the
integer implementation for ordinary fixed-point types.
(Expand_Value_Attribute): Likewise.
* freeze.adb (Freeze_Fixed_Point_Type): Relax conditions on 128-bit
smalls.
* sem_attr.adb (Analyze_Attribute) <Attribute_Small_Denominator>:
Check no arguments, fixed-point and set type to Universal_Integer.
<Attribute_Small_Numerator>: Likewise.
(Eval_Attribute) <Attribute_Small_Denominator>: Fold statically.
<Attribute_Small_Numerator>: Likewise.
* snames.ads-tmpl (Name_Small_Denominator): New attribute name.
(Name_Small_Numerator): Likewise.
(Attribute_Id): Add Attribute_Small_{Denominator,Numerator}.
* libgnat/a-tifiio.adb (Exact): Delete.
(Need_64): Likewise.
(OK_Get_32): New boolean constant.
(OK_Put_32): Likewise.
(OK_Get_64): Likewise.
(OK_Put_64): Likewise.
(E): Adjust.
(Get procedures): Likewise.
(Put procedures): Likewise.
* libgnat/a-tifiio__128.adb (Exact): Delete.
(Need_64): Likewise.
(Need_128): Likewise.
(OK_Get_32): New boolean constant.
(OK_Put_32): Likewise.
(OK_Get_64): Likewise.
(OK_Put_64): Likewise.
(OK_Get_128): Likewise.
(OK_Put_128): Likewise.
(E): Adjust.
(Get procedures): Likewise.
(Put procedures): Likewise.
* libgnat/a-wtfiio.adb (Exact): Delete.
(Need_64): Likewise.
(OK_Get_32): New boolean constant.
(OK_Put_32): Likewise.
(OK_Get_64): Likewise.
(OK_Put_64): Likewise.
(E): Adjust.
(Get procedures): Likewise.
(Put procedures): Likewise.
* libgnat/a-wtfiio__128.adb (Exact): Delete.
(Need_64): Likewise.
(Need_128): Likewise.
(OK_Get_32): New boolean constant.
(OK_Put_32): Likewise.
(OK_Get_64): Likewise.
(OK_Put_64): Likewise.
(OK_Get_128): Likewise.
(OK_Put_128): Likewise.
(E): Adjust.
(Get procedures): Likewise.
(Put procedures): Likewise.
* libgnat/a-ztfiio.adb (Exact): Delete.
(Need_64): Likewise.
(OK_Get_32): New boolean constant.
(OK_Put_32): Likewise.
(OK_Get_64): Likewise.
(OK_Put_64): Likewise.
(E): Adjust.
(Get procedures): Likewise.
(Put procedures): Likewise.
* libgnat/a-ztfiio__128.adb (Exact): Delete.
(Need_64): Likewise.
(Need_128): Likewise.
(OK_Get_32): New boolean constant.
(OK_Put_32): Likewise.
(OK_Get_64): Likewise.
(OK_Put_64): Likewise.
(OK_Get_128): Likewise.
(OK_Put_128): Likewise.
(E): Adjust.
(Get procedures): Likewise.
(Put procedures): Likewise.
* libgnat/s-fore_f.ads (Fore_Fixed): Adjust signature.
* libgnat/s-fore_f.adb (Fore_Fixed): Reimplement.
* libgnat/s-fofi32.ads (Fore_Fixed32): Adjust signature.
* libgnat/s-fofi64.ads (Fore_Fixed64): Likewise.
* libgnat/s-fofi128.ads (Fore_Fixed128): Likewise.
* libgnat/s-imagef.ads: Adjust description.
* libgnat/s-imagef.adb (Maxdigs): Move around.
(Set_Image_Integer): Remove assertion.
* libgnat/s-valuef.ads: Adjust description.
* libgnat/s-valuef.adb (Integer_To_Fixed): Minor tweak.

3 years ago[Ada] Implement -gnateb switch
Ghjuvan Lacambre [Thu, 12 Nov 2020 08:38:58 +0000 (09:38 +0100)]
[Ada] Implement -gnateb switch

gcc/ada/

* doc/gnat_ugn/building_executable_programs_with_gnat.rst:
Describe -gnateb switch.
* doc/gnat_ugn/the_gnat_compilation_model.rst: Mention -gnateb
switch in configuration pragma files section.
* gnat_ugn.texi: Regenerate.
* lib-writ.adb (Write_ALI): Strip directories from configuration
files path if needed.
* opt.ads: Declare Config_Files_Store_Basename option.
* par.adb (Par): Save configuration file checksum.
* switch-c.adb (Scan_Front_End_Switches): Set
Config_Files_Store_Basename true if -gnateb is present.

3 years ago[Ada] Potential read of uninitialized variable in exp_dist.adb
Arnaud Charlet [Wed, 11 Nov 2020 16:32:34 +0000 (11:32 -0500)]
[Ada] Potential read of uninitialized variable in exp_dist.adb

gcc/ada/

* exp_dist.adb (RCI_Cache): Initialize.

3 years ago[Ada] Address warning compiling terminals.c
Arnaud Charlet [Wed, 11 Nov 2020 16:31:27 +0000 (11:31 -0500)]
[Ada] Address warning compiling terminals.c

gcc/ada/

* terminals.c (allocate_pty_desc): Copy one less byte since the
last byte will always be set to 0.

3 years ago[Ada] Add stream-oriented attributes support for 128-bit integer types
Eric Botcazou [Tue, 10 Nov 2020 17:43:52 +0000 (18:43 +0100)]
[Ada] Add stream-oriented attributes support for 128-bit integer types

gcc/ada/

* doc/gnat_ugn/building_executable_programs_with_gnat.rst (-xdr):
Document that XDR is not supported for 128-bit integer types.
* gnat_ugn.texi: Regenerate.
* exp_strm.adb (Build_Elementary_Input_Call): Deal with types
larger than Long_Long_Integer.
(Build_Elementary_Write_Call): Likewise.
* rtsfind.ads (RE_Id): Add RE_I_LLL{I,U] and RE_W_LLL{I,U}.
(RE_Unit_Table): Add entries for them.
* libgnat/s-stratt.ads (I_LLLI): New inline function.
(I_LLLU): Likewise.
(W_LLLI): New inline procedure.
(W_LLLU): Likewise.
* libgnat/s-stratt.adb (S_LLLI): New subtype of SEA.
(S_LLLU): Likewise.
(From_LLLI): New instance of Unchecked_Conversion.
(From_LLLU): Likewise.
(To_LLLI): Likewise.
(To_LLLU): Likewise.
(I_LLLI): Implement.
(I_LLLU): Likewise.
(W_LLLI): Likewise.
(W_LLLU): Likewise.

3 years ago[Ada] Spurious error on iterator over container with modified private part
Ed Schonberg [Tue, 10 Nov 2020 15:16:49 +0000 (10:16 -0500)]
[Ada] Spurious error on iterator over container with modified private part

gcc/ada/

* exp_ch5.adb (Expand_Iterator_Loop_Over_Container): Check the
signature of the private operation Get_Element_Access to prevent
accidental use of a user-defined homonym subprogram.

3 years ago[Ada] Add comment on special Heap variable used in GNATprove
Yannick Moy [Tue, 10 Nov 2020 13:30:03 +0000 (14:30 +0100)]
[Ada] Add comment on special Heap variable used in GNATprove

gcc/ada/

* spark_xrefs.ads: Add comment for Heap that it may remain
Empty.

3 years ago[Ada] Fix serial port control setting on GNU/Linux
Pascal Obry [Sat, 7 Nov 2020 09:31:43 +0000 (10:31 +0100)]
[Ada] Fix serial port control setting on GNU/Linux

gcc/ada/

* libgnat/g-sercom__linux.adb (Set): Fix control flags of the
serial port setting.

3 years ago[Ada] Minor style fixes
Pascal Obry [Sat, 7 Nov 2020 09:30:09 +0000 (10:30 +0100)]
[Ada] Minor style fixes

gcc/ada/

* libgnat/g-sercom__linux.adb: Minor style fixes.

3 years ago[Ada] Fix folding of comparison operators in GNATprove mode
Piotr Trojanek [Mon, 9 Nov 2020 13:13:58 +0000 (14:13 +0100)]
[Ada] Fix folding of comparison operators in GNATprove mode

gcc/ada/

* exp_util.adb (Get_Current_Value_Condition): Don't use current
value tracking in GNATprove mode.
* sem_res.adb (Resolve_Comparison_Op): Remove incomplete
special-casing for folding in GNATprove mode.

3 years ago[Ada] Crash on ghost assignment check for illegal code
Bob Duff [Sun, 8 Nov 2020 21:54:56 +0000 (16:54 -0500)]
[Ada] Crash on ghost assignment check for illegal code

gcc/ada/

* errout.adb (Error_Msg_NEL): Do not call Set_Posted if errors
are being ignored.
(Error_Msg): Change Errors_Must_Be_Ignored to use the getter.
* sem_ch8.adb (Find_Direct_Name): Do not skip all the error
checks when ignoring errors, but instead do not add an entry to
the Urefs table if errors are being ignored.
* exp_ch5.adb: Minor comment fix.

3 years ago[Ada] Add continuation message when others choice not allowed
Yannick Moy [Fri, 6 Nov 2020 17:09:44 +0000 (18:09 +0100)]
[Ada] Add continuation message when others choice not allowed

gcc/ada/

* sem_aggr.adb (Resolve_Array_Aggregate): Improve error message.

3 years ago[Ada] Small cleanup in System.Value_F
Eric Botcazou [Sun, 8 Nov 2020 11:34:28 +0000 (12:34 +0100)]
[Ada] Small cleanup in System.Value_F

gcc/ada/

* libgnat/s-valuef.adb (Integer_To_Fixed): Do not modify numerator
or denominator in order to reduce the exponent.

3 years ago[Ada] Confusion in Transform_Function_Array and internal subprograms
Arnaud Charlet [Sat, 7 Nov 2020 18:53:05 +0000 (19:53 +0100)]
[Ada] Confusion in Transform_Function_Array and internal subprograms

gcc/ada/

* ali-util.adb (Get_File_Checksum): Remove dead code.
* exp_ch4.adb (Expand_Boolean_Operator, Expand_N_Op_Not,
Make_Boolean_Array_Op): Take Transform_Function_Array into
account.
* exp_ch6.adb (Expand_Call_Helper): Update comment. Code
cleanup.
* exp_util.adb (Build_Procedure_Form): Use new predefined name
Name_UP_RESULT.
* snames.ads-tmpl (Name_UP_RESULT): New predefined name.  Code
cleanup: remove unused names from the project parser, moved to
gprbuild sources.
* xsnamest.adb: Add support for uppercase names.

3 years ago[Ada] Spurious visibility error in subprogram body in with_clause
Ed Schonberg [Fri, 6 Nov 2020 15:21:06 +0000 (10:21 -0500)]
[Ada] Spurious visibility error in subprogram body in with_clause

gcc/ada/

* sem_util.adb (Enter_Name): When an inherited operation for a
local derived type is hidden by an explicit declaration of a
non-overloadable entity in the same scope, make the inherited
operation non-visible to prevent its accidental use elsewhere.