gcc.git
4 years agoRemove accidental testcase commit
Nathan Sidwell [Thu, 21 May 2020 12:07:23 +0000 (05:07 -0700)]
Remove accidental testcase commit

* c-c++-common/cpp/cmd-1.c: Delete.
* c-c++-common/cpp/cmd-1.h: Delete.

4 years agolibgfortran: Use __builtin_cpu_is/__builtin_cpu_supports
H.J. Lu [Thu, 21 May 2020 10:54:32 +0000 (03:54 -0700)]
libgfortran: Use __builtin_cpu_is/__builtin_cpu_supports

* m4/matmul.m4: Don't include <config/i386/cpuinfo.h>.  Use
__builtin_cpu_is/__builtin_cpu_supports
* generated/matmul_c10.c: Regenerated.
* generated/matmul_c16.c: Likewise.
* generated/matmul_c4.c: Likewise.
* generated/matmul_c8.c: Likewise.
* generated/matmul_i1.c: Likewise.
* generated/matmul_i16.c: Likewise.
* generated/matmul_i2.c: Likewise.
* generated/matmul_i4.c: Likewise.
* generated/matmul_i8.c: Likewise.
* generated/matmul_r10.c: Likewise.
* generated/matmul_r16.c: Likewise.
* generated/matmul_r4.c: Likewise.
* generated/matmul_r8.c: Likewise.

4 years agoAdd outline-atomics to target attribute.
Martin Liska [Thu, 21 May 2020 10:45:47 +0000 (12:45 +0200)]
Add outline-atomics to target attribute.

* common/config/aarch64/aarch64-common.c (aarch64_handle_option):
Handle OPT_moutline_atomics.
* config/aarch64/aarch64.c: Add outline-atomics to
aarch64_attributes.

* doc/extend.texi: Document the newly added target attribute.

* gcc.target/aarch64/target_attr_20.c: New test.
* gcc.target/aarch64/target_attr_21.c: New test.

4 years agoPrepare git_update_version.py for real usage.
Martin Liska [Thu, 21 May 2020 09:51:32 +0000 (11:51 +0200)]
Prepare git_update_version.py for real usage.

* gcc-changelog/git_update_version.py: Prepare the script, the
only missing piece is pushing of the updated branches.

4 years agoSupport DR entries for gcc-changelog.
Martin Liska [Thu, 21 May 2020 08:23:50 +0000 (10:23 +0200)]
Support DR entries for gcc-changelog.

* gcc-changelog/git_commit.py: Support DR entries/
* gcc-changelog/test_email.py: New test for it.
* gcc-changelog/test_patches.txt: New patch for it.

4 years agomklog: support parsing of DR.
Martin Liska [Thu, 21 May 2020 08:14:56 +0000 (10:14 +0200)]
mklog: support parsing of DR.

* mklog.py: Support DR parsing.
* test_mklog.py: New test for DR parsing.

4 years agolibstdc++: Avoid constraint recursion with iterator_traits (PR 93983)
Jonathan Wakely [Thu, 21 May 2020 06:32:15 +0000 (07:32 +0100)]
libstdc++: Avoid constraint recursion with iterator_traits (PR 93983)

Checking whether a filesystem::path constructor argument is an iterator
requires instantiating std::iterator_traits. In C++20 that checks for
satisfaction of std::iterator_traits constraints, which checks if the
type is copyable, which can end up recursing back to the path
constructor. The fix in LWG 3420 is to reorder the cpp17-iterator
concept's constraints to check if the type looks vaguely like an
iterator before checking copyable. That avoids the recursion for types
which definitely aren't iterators, but isn't foolproof.

PR libstdc++/93983
* include/bits/iterator_concepts.h (__detail::__cpp17_iterator):
Reorder constraints to avoid recursion when constructors use
iterator_traits (LWG 3420).
* testsuite/24_iterators/customization_points/lwg3420.cc: New test.

4 years agoDaily bump.
GCC Administrator [Thu, 21 May 2020 00:16:29 +0000 (00:16 +0000)]
Daily bump.

4 years agolibstdc++: Use macro for nodiscard attribute
Jonathan Wakely [Thu, 21 May 2020 00:03:27 +0000 (01:03 +0100)]
libstdc++: Use macro for nodiscard attribute

* include/experimental/socket (basic_socket::is_open()
(basic_socket_acceptor::is_open()): Use _GLIBCXX_NODISCARD macro.

4 years agolibstdc++: Better requirements checking in Networking TS
Jonathan Wakely [Wed, 20 May 2020 23:59:55 +0000 (00:59 +0100)]
libstdc++: Better requirements checking in Networking TS

Define concepts and traits for checking type requirements.

* include/experimental/bits/net.h (__endpoint, __protocol)
(__acceptable_protocol, __inet_protocol): New concepts.
(__detail::__is_endpoint): Move trait from <experimental/socket>.
(__is_protocol, __is_acceptable_protocol, __is_inet_protocol): New
traits.
(__endpoint, __protocol, __acceptable_protocol): New variable
templates.
* include/experimental/socket (__is_endpoint): Move to net.h header.
(basic_socket, basic_socket_acceptor): Check requirements.

4 years agolibstdc++: Fix net::basic_socket::close(error_code&)
Jonathan Wakely [Wed, 20 May 2020 23:59:55 +0000 (00:59 +0100)]
libstdc++: Fix net::basic_socket::close(error_code&)

Also add some missing member functions, nodiscard attributes, and
noexcept-specifiers.

* include/experimental/executor (use_future_t::use_future_t()): Fix
incorrect noexcept-specifier.
* include/experimental/internet (basic_resolver_results): Adjust
whitespace.
* include/experimental/socket (__basic_socket_impl::release): Add
member function.
(basic_socket(io_context&, const endpoint_type&)): Fix argument to
target constructor.
(basic_socket::release(), basic_socket::release(error_code&)): Add
missing member functions.
(basic_socket::is_open()): Add nodiscard attribute.
(basic_socket::close(error_code&)): Pass argument to base function.
(basic_socket_acceptor::release())
(basic_socket_acceptor::release(error_code&)): Add missing member
functions.
(basic_socket_acceptor::is_open()): Add nodiscard attribute.
(basic_socket_streambuf::error()): Add noexcept.
(basic_socket_iostream::error()): Likewise.
* testsuite/experimental/net/socket/basic_socket.cc: New test.

4 years agolibstdc++: Use 'using' for types in Networking TS headers
Jonathan Wakely [Wed, 20 May 2020 23:59:55 +0000 (00:59 +0100)]
libstdc++: Use 'using' for types in Networking TS headers

* include/experimental/buffer: Replace typedefs with
alias-declarations.
* include/experimental/executor: Likewise.
* include/experimental/internet: Likewise.
* include/experimental/socket: Likewise.
* include/experimental/timer: Likewise.

4 years agoi386: Do not use commutative operands with (use) RTX [PR95238]
Uros Bizjak [Wed, 20 May 2020 23:53:09 +0000 (01:53 +0200)]
i386: Do not use commutative operands with (use) RTX [PR95238]

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

gcc/ChangeLog:
PR target/95218

* config/i386/mmx.md (*mmx_<code>v2sf): Do not mark
operands 1 and 2 commutative.  Manually swap operands.
(*mmx_nabsv2sf2): Ditto.

Partially revert:

* config/i386/i386.md (*<code>tf2_1):
Mark operands 1 and 2 commutative.
(*nabstf2_1): Ditto.
* config/i386/sse.md (*<code><mode>2): Mark operands 1 and 2
commutative.  Do not swap operands.
(*nabs<mode>2): Ditto.

4 years agoFix premature omission of ChangeLog entry in ChangeLog file..
Jozef Lawrynowicz [Wed, 20 May 2020 21:40:10 +0000 (22:40 +0100)]
Fix premature omission of ChangeLog entry in ChangeLog file..

* g++.dg/warn/Wconversion-null-2.C: Add explicit declarations for l()
and g() with int, long, long long and __int20 arguments.
* g++.dg/warn/Wconversion-null.C: Likewise.

4 years agoTESTSUITE: Fix Wconversion-null*.C tests for aarch64 -mabi=ilp32
Jozef Lawrynowicz [Wed, 20 May 2020 21:15:18 +0000 (22:15 +0100)]
TESTSUITE: Fix Wconversion-null*.C tests for aarch64 -mabi=ilp32

This fixes regressions for aarch64 with -mabi=ilp32 of the
Wconversion-null*.C tests, introduced by 92ea8e1bccc.

The "g (int)" declaration is required for that target where
sizeof(int) == sizeof(long) == sizeof(void *).

To handle the msp430/-mlarge case, an explicit declaration of
"g (__int20)" is required.

gcc/testsuite/ChangeLog:

* g++.dg/warn/Wconversion-null-2.C: Add explicit declarations for l()
and g() with int, long, long long and __int20 arguments.
* g++.dg/warn/Wconversion-null.C: Likewise.

4 years agoc++: C++20 DR 2237, disallow simple-template-id in cdtor.
Marek Polacek [Sat, 4 Apr 2020 22:09:53 +0000 (18:09 -0400)]
c++: C++20 DR 2237, disallow simple-template-id in cdtor.

This patch implements DR 2237 which says that a simple-template-id is
no longer valid as the declarator-id of a constructor or destructor;
see [diff.cpp17.class]#2.  It is not explicitly stated but out-of-line
destructors with a simple-template-id are also meant to be ill-formed
now.  (Out-of-line constructors like that are invalid since DR1435 I
think.)  This change only applies to C++20; it is not a DR against C++17.

I'm not crazy about the diagnostic in constructors but ISTM that
cp_parser_constructor_declarator_p shouldn't print errors.

DR 2237
* parser.c (cp_parser_unqualified_id): Reject simple-template-id as
the declarator-id of a destructor.
(cp_parser_constructor_declarator_p): Reject simple-template-id as
the declarator-id of a constructor.

* g++.dg/DRs/dr2237.C: New test.
* g++.dg/parse/constructor2.C: Add dg-error for C++20.
* g++.dg/parse/dtor12.C: Likewise.
* g++.dg/parse/dtor4.C: Likewise.
* g++.dg/template/dtor4.C: Adjust dg-error.
* g++.dg/template/error34.C: Likewise.
* g++.old-deja/g++.other/inline15.C: Only run for C++17 and lesses.
* g++.old-deja/g++.pt/ctor2.C: Add dg-error for C++20.

4 years agopreprocessor: Revert premature change
Nathan Sidwell [Wed, 20 May 2020 20:43:11 +0000 (13:43 -0700)]
preprocessor:  Revert premature change

This part of the cleanup patch turns out to require more pieces to
function correctly.  I must have got confused over which tree I was
testing.  The very first map has a different pointer to the file name,
so doesn't match with a pointer compare. We were relying on that.

* c-common.c (try_to_locate_new_include_insertion_point): Revert change.

4 years agopreprocessor: cleanups in c-common handling
Nathan Sidwell [Wed, 20 May 2020 18:15:34 +0000 (11:15 -0700)]
preprocessor: cleanups in c-common handling

* c-common.c (try_to_locate_new_include_insertion_point): Use
strcmp to compare filenames.
* c-lex.c (init_c_lex): Move declaration to initialization.
* c-opts.c (handle_deferred_opts): Move cpp_get_deps call into
deferred count loop.

4 years agoc++: Implement DR 2289, Uniqueness of structured binding names [PR94553]
Marek Polacek [Wed, 20 May 2020 03:53:28 +0000 (23:53 -0400)]
c++: Implement DR 2289, Uniqueness of structured binding names [PR94553]

DR 2289 clarified that since structured bindings have no C compatibility
implications, they should be unique in their declarative region, see
[basic.scope.declarative]/4.2.

The duplicate_decls hunk is the gist of the patch, but that alone would
not be enough to detect the 'A' case: cp_parser_decomposition_declaration
uses

13968       tree decl2 = start_decl (declarator, &decl_specs, SD_INITIALIZED,
13969                                NULL_TREE, NULL_TREE, &elt_pushed_scope);

to create the 'A' VAR_DECL but in this start_decl's grokdeclarator we
don't do fit_decomposition_lang_decl because the declarator kind is not
cdk_decomp, so then when start_decl calls maybe_push_decl, the decl 'A'
isn't DECL_DECOMPOSITION_P and we don't detect this case.  So I needed a
way to signal to start_decl that it should fit_decomposition_lang_decl.
In this patch, I'm adding SD_DECOMPOSITION flag to say that the variable
is initialized and it should also be marked as DECL_DECOMPOSITION_P.

DR 2289
PR c++/94553
* cp-tree.h (SD_DECOMPOSITION): New flag.
* decl.c (duplicate_decls): Make sure a structured binding is unique
in its declarative region.
(start_decl): If INITIALIZED is SD_DECOMPOSITION, call
fit_decomposition_lang_decl.
(grokdeclarator): Compare INITIALIZED directly to SD_* flags.
* parser.c (cp_parser_decomposition_declaration): Pass SD_DECOMPOSITION
to start_decl.

* g++.dg/cpp1z/decomp52.C: New test.

4 years agoi386: Fix zero/sign extend expanders [PR95229]
Uros Bizjak [Wed, 20 May 2020 17:00:39 +0000 (19:00 +0200)]
i386: Fix zero/sign extend expanders [PR95229]

2020-05-20  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:
PR target/95229
* config/i386/sse.md (<code>v8qiv8hi2): Use
simplify_gen_subreg instead of simplify_subreg.
(<code>v8qiv8si2): Ditto.
(<code>v4qiv4si2): Ditto.
(<code>v4hiv4si2): Ditto.
(<code>v8qiv8di2): Ditto.
(<code>v4qiv4di2): Ditto.
(<code>v2qiv2di2): Ditto.
(<code>v4hiv4di2): Ditto.
(<code>v2hiv2di2): Ditto.
(<code>v2siv2di2): Ditto.

gcc/testsuite/ChangeLog:
PR target/95229
* g++.target/i386/pr95229.C: New test.

4 years agoi386: Fix *pushsi2_rex64 constraints [PR95238]
Uros Bizjak [Wed, 20 May 2020 16:57:32 +0000 (18:57 +0200)]
i386: Fix *pushsi2_rex64 constraints [PR95238]

2020-05-20  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:
PR target/95238
* config/i386/i386.md (*pushsi2_rex64):
Use "e" constraint instead of "i".

4 years agogit_email.py: fix duplicate author_lines.
Martin Liska [Wed, 20 May 2020 14:10:02 +0000 (16:10 +0200)]
git_email.py: fix duplicate author_lines.

* gcc-changelog/git_commit.py: Add author_tuple
only if not present in author_lines.
* gcc-changelog/test_email.py: New test.
* gcc-changelog/test_patches.txt: Add new patch.

4 years agoAvoid SCC hashing on unmergeable trees
Jan Hubicka [Wed, 20 May 2020 13:58:22 +0000 (15:58 +0200)]
Avoid SCC hashing on unmergeable trees

This is new incarantion of patch to identify unmergeable tree at streaming out
time rather than streaming in and to avoid pickling them to sccs with with hash
codes.

Building cc1 plus this patch reduces:

[WPA] read 4452927 SCCs of average size 1.986030
[WPA] 8843646 tree bodies read in total
[WPA] tree SCC table: size 524287, 205158 elements, collision ratio: 0.505204
[WPA] tree SCC max chain length 43 (size 1)
[WPA] Compared 947551 SCCs, 780270 collisions (0.823460)
[WPA] Merged 944038 SCCs
[WPA] Merged 5253521 tree bodies
[WPA] Merged 590027 types
...
[WPA] Size of mmap'd section decls: 99229066 bytes
[WPA] Size of mmap'd section function_body: 18398837 bytes
[WPA] Size of mmap'd section refs: 733678 bytes
[WPA] Size of mmap'd section jmpfuncs: 2965981 bytes
[WPA] Size of mmap'd section pureconst: 170248 bytes
[WPA] Size of mmap'd section profile: 17985 bytes
[WPA] Size of mmap'd section symbol_nodes: 3392736 bytes
[WPA] Size of mmap'd section inline: 2693920 bytes
[WPA] Size of mmap'd section icf: 435557 bytes
[WPA] Size of mmap'd section offload_table: 0 bytes
[WPA] Size of mmap'd section lto: 4320 bytes
[WPA] Size of mmap'd section ipa_sra: 651660 bytes

... to ...

[WPA] read 3312246 unshared trees
[WPA] read 1144381 mergeable SCCs of average size 4.833785
[WPA] 8843938 tree bodies read in total
[WPA] tree SCC table: size 524287, 197767 elements, collision ratio: 0.506446
[WPA] tree SCC max chain length 43 (size 1)
[WPA] Compared 946614 SCCs, 775077 collisions (0.818789)
[WPA] Merged 943798 SCCs
[WPA] Merged 5253336 tree bodies
[WPA] Merged 590105 types
....
[WPA] Size of mmap'd section decls: 81262144 bytes
[WPA] Size of mmap'd section function_body: 14702611 bytes
[WPA] Size of mmap'd section ext_symtab: 0 bytes
[WPA] Size of mmap'd section refs: 733695 bytes
[WPA] Size of mmap'd section jmpfuncs: 2332150 bytes
[WPA] Size of mmap'd section pureconst: 170292 bytes
[WPA] Size of mmap'd section profile: 17986 bytes
[WPA] Size of mmap'd section symbol_nodes: 3393358 bytes
[WPA] Size of mmap'd section inline: 2567939 bytes
[WPA] Size of mmap'd section icf: 435633 bytes
[WPA] Size of mmap'd section lto: 4320 bytes
[WPA] Size of mmap'd section ipa_sra: 651824 bytes

so results in about 22% reduction in global decl stream and 24% reduction on
function bodies stream (which is read mostly by ICF)

Martin, the zstd compression breaks the compression statistics (it works when
GCC is configured for zlib)

At first ltrans I get:

[LTRANS] Size of mmap'd section decls: 3734248 bytes
[LTRANS] Size of mmap'd section function_body: 4895962 bytes

... to ...

[LTRANS] Size of mmap'd section decls: 3479850 bytes
[LTRANS] Size of mmap'd section function_body: 3722935 bytes

So 7% reduction of global stream and 31% reduction of function bodies.

Stream in seems to get about 3% faster and stream out about 5% but it is
close to noise factor of my experiment.  I expect bigger speedups on
Firefox but I did not test it today since my Firefox setup broke again.
GCC is not very good example on the problem with anonymous namespace
types since we do not have so many of them.

Sice of object files in gcc directory is reduced by 11% (because hash
numbers do not compress well I guess).

The patch makes DFS walk to recognize trees that are not merged (anonymous
namespace, local function/variable decls, anonymous types etc).  As discussed
on IRC this is now done during the SCC walk rather than during the hash
computation.  When local tree is discovered we know that SCC components of everything that is on
the stack reffers to it and thus is also local. Moreover we mark trees into hash set in output block
so if we get a cross edge referring to local tree it gets marked too.

Patch also takes care of avoiding SCC wrappers around some trees. In particular
 1) singleton unmergeable SCCs are now streamed inline in global decl stream
    This includes INTEGER_CSTs and IDENTIFIER_NODEs that are shared by different
    code than rest of tree merging.
 2) We use LTO_trees instead of LTO_tree_scc to wrap unmergeable SCC components.
    It is still necessary to mark them because of forward references.  LTO_trees
    has simple header with number of trees and then things are streamed same way
    as for LTO_tree_scc. That is tree headers first followed by pickled references
    so things may point to future.

    Of course it is not necessary for LTO_tree_scc to be single component and
    streamer out may group more components together, but I decided to not snowball
    the patch even more
 3) In local streams when lto_output_tree is called and the topmost SCC components
    turns out to be singleton we stream the tree directly
    instead of LTO_tree_scc, hash code, pickled tree, reference to just stremaed tree.

    LTO_trees is used to wrap all trees needed to represent tree being streamed.
    It would make sense again to use only one LTO_trees rather than one per SCC
    but I think this can be done incrementally.

In general local trees are now recognized by new predicate local_tree_p

Bit subtle is handing of TRANLSATION_UNIT_DECL, INTEGER_CST and
IDENTIFIER_NODE.

TRANSLATION_UNIT_DECL a local tree but references to it does not make
other trees local (because we also understand local decls now).
So I check for it later after localness propagation is done.

INTEGER_CST and IDENTIFIER_NODEs are merged but not via the tree merging
machinery. So it makes sense to stream them as unmergeable trees but we
still need to compute their hashes so SCCs referring them do not get too
large collision chains.  For this reason they are checked just prior
stream out.

lto-bootstrapped/regteted x86_64-linux, OK?

gcc/ChangeLog:

2020-05-19  Jan Hubicka  <hubicka@ucw.cz>

* lto-streamer-in.c (lto_input_scc): Add SHARED_SCC parameter.
(lto_input_tree_1): Strenghten sanity check.
(lto_input_tree): Update call of lto_input_scc.
* lto-streamer-out.c: Include ipa-utils.h
(create_output_block): Initialize local_trees if merigng is going
to happen.
(destroy_output_block): Destroy local_trees.
(DFS): Add max_local_entry.
(local_tree_p): New function.
(DFS::DFS): Initialize and maintain it.
(DFS::DFS_write_tree): Decide on streaming format.
(lto_output_tree): Stream inline singleton SCCs
* lto-streamer.h (enum LTO_tags): Add LTO_trees.
(struct output_block): Add local_trees.
(lto_input_scc): Update prototype.

gcc/lto/ChangeLog:

2020-05-19  Jan Hubicka  <hubicka@ucw.cz>

* lto-common.c (compare_tree_sccs_1): Sanity check that we never
read TRANSLATION_UNIT_DECL.
(process_dref): Break out from ...
(unify_scc): ... here.
(process_new_tree): Break out from ...
(lto_read_decls): ... here; handle streaming of singleton trees.
(print_lto_report_1): Update statistics.

4 years agoFortran : ProcPtr function results: 'ppr@' in error message PR39695
Mark Eggleston [Thu, 7 May 2020 07:02:02 +0000 (08:02 +0100)]
Fortran  : ProcPtr function results: 'ppr@' in error message PR39695

The value 'ppr@' is set in the name of result symbol, the actual
name of the symbol is in the procedure name symbol pointed
to by the result symbol's namespace (ns). When reporting errors for
symbols that have the proc_pointer attribute check whether the
result attribute is set and set the name accordingly.

2020-05-20  Mark Eggleston  <markeggleston@gcc.gnu.org>

gcc/fortran/

PR fortran/39695
* resolve.c (resolve_fl_procedure): Set name depending on
whether the result attribute is set.  For PROCEDURE/RESULT
conflict use the name in sym->ns->proc_name->name.
* symbol.c (gfc_add_type): Add check for function and result
attributes use sym->ns->proc_name->name if both are set.
Where the symbol cannot have a type use the name in
sym->ns->proc_name->name.

2020-05-20  Mark Eggleston  <markeggleston@gcc.gnu.org>

gcc/testsuite/

PR fortran/39695
* gfortran.dg/pr39695_1.f90: New test.
* gfortran.dg/pr39695_2.f90: New test.
* gfortran.dg/pr39695_3.f90: New test.
* gfortran.dg/pr39695_4.f90: New test.

4 years agopreprocessor: Replace some flags with a single enum
Nathan Sidwell [Wed, 20 May 2020 13:21:10 +0000 (06:21 -0700)]
preprocessor:  Replace some flags with a single enum

_cpp_find_file has 3 bool arguments, at most one of which is ever set.
Ripe for replacing with a 4-state enum.  Also, this is C++, so
'typedef struct Foo Foo' is unnecessary.

* internal.h (typedef _cpp_file): Delete, unnecessary in C++.
(enum _cpp_find_file_kind): New.
(_cpp_find_file): Use it, not 3 bools.
* files.c (_cpp_find_file): Use _cpp_find_file_kind enum, not
bools.
(cpp_make_system_header): Break overly long line.
(_cpp_stack_include, _cpp_fake_include)
(_cpp_do_file_change, _cpp_compare_file_date, _cpp_has_header): Adjust.
* init.c (cpp_read_main): Adjust _cpp_find_file call.

4 years agoc++: spec_hasher and TYPENAME_TYPE resolution [PR95223]
Patrick Palka [Wed, 20 May 2020 13:15:48 +0000 (09:15 -0400)]
c++: spec_hasher and TYPENAME_TYPE resolution [PR95223]

After enabling sanitization of the specialization tables, we are
triggering one of the hash table sanity checks in the below testcase.

The reason is that when looking up the specialization j<int> in the
type_specializations table, the sanity check finds that the existing
entry j<n<t>::m> compares equal to j<int> but hashes differently.

The discrepancy is due to structural_comptypes looking through
TYPENAME_TYPEs (via resolve_typename_type), something which
iterative_hash_template_arg doesn't do.  So the TYPENAME_TYPE n<t>::m is
considered equal to int, but the hashes of these two template arguments
are different.

It seems wrong for the result of a specialization table lookup to depend
on the current scope, so this patch makes structural_comptypes avoid
calling resolve_typename_type when comparing_specializations.

In order for the below testcase to deterministically trigger the
sanitization error without this patch, we also need to fix the location
of the call to hash_table::verify within hash_table::find_with_hash.

gcc/ChangeLog:

PR c++/95223
* hash-table.h (hash_table::find_with_hash): Move up the call to
hash_table::verify.

gcc/cp/ChangeLog:

PR c++/95223
* typeck.c (structural_comptypes): Don't perform
context-dependent resolution of TYPENAME_TYPEs when
comparing_specializations.

gcc/testsuite/ChangeLog:

PR c++/95223
* g++.dg/template/typename23.C: New test.

4 years agoFill up {,un}compression stats for ZSTD in LTO.
Martin Liska [Wed, 20 May 2020 12:39:21 +0000 (14:39 +0200)]
Fill up {,un}compression stats for ZSTD in LTO.

* lto-compress.c (lto_compression_zstd): Fill up
num_compressed_il_bytes.
(lto_uncompression_zstd): Likewise for num_uncompressed_il_bytes here.

4 years agoAdd missing testsuite/Changelog for PR94595 bug fix.
Srinath Parvathaneni [Wed, 20 May 2020 12:20:55 +0000 (13:20 +0100)]
Add missing testsuite/Changelog for PR94595 bug fix.

4 years agotree-optimization/95219 - improve IV selection for induction
Richard Biener [Wed, 20 May 2020 07:22:58 +0000 (09:22 +0200)]
tree-optimization/95219 - improve IV selection for induction

This improves code generation with SSE2 for the testcase by
making sure to only generate a single IV when the group size
is a multiple of the vector size.  It also adjusts the testcase
which was passing before.

2020-05-20  Richard Biener  <rguenther@suse.de>

PR tree-optimization/95219
* tree-vect-loop.c (vectorizable_induction): Reduce
group_size before computing the number of required IVs.

* gcc.dg/vect/costmodel/x86_64/costmodel-pr30843.c: Adjust.

4 years agomiddle-end/95231 - revert parts of PR95171
Richard Biener [Wed, 20 May 2020 09:00:57 +0000 (11:00 +0200)]
middle-end/95231 - revert parts of PR95171

I mistook the opportunity to also "fix" the [VEC_]COND_EXPR case
for PR95171 but I was wrong in that it doesn't need the fix and
in the actual fix as well.  The following just reverts that part.

2020-05-20  Richard Biener  <rguenther@suse.de>

PR middle-end/95231
* tree-inline.c (remap_gimple_stmt): Revert adjusting
COND_EXPR and VEC_COND_EXPR for a -fnon-call-exception boundary.

* g++.dg/other/pr95231.C: New testcase.

4 years agoAdd missing ChangeLog entry for r11-516
H.J. Lu [Wed, 20 May 2020 11:23:38 +0000 (04:23 -0700)]
Add missing ChangeLog entry for r11-516

4 years agox86: Update VPCLMULQDQ check
H.J. Lu [Wed, 20 May 2020 01:55:08 +0000 (18:55 -0700)]
x86: Update VPCLMULQDQ check

Update VPCLMULQDQ check to support processors with AVX version of
VPCLMULQDQ.

PR target/91695
* config/i386/cpuinfo.c (get_available_features): Fix VPCLMULQDQ
check.

4 years agoRemove dangling line from gcc/ChangeLog.
Martin Liska [Wed, 20 May 2020 10:52:39 +0000 (12:52 +0200)]
Remove dangling line from gcc/ChangeLog.

4 years ago[ARM]: Fix the wrong code-gen generated by MVE vector load/store intrinsics (PR94959).
Srinath Parvathaneni [Wed, 20 May 2020 09:17:22 +0000 (10:17 +0100)]
[ARM]: Fix the wrong code-gen generated by MVE vector load/store intrinsics (PR94959).

Few MVE intrinsics like vldrbq_s32, vldrhq_s32 etc., the assembler instructions
generated by current compiler are wrong.
eg: vldrbq_s32 generates an assembly instructions `vldrb.s32 q0,[ip]`.
But as per Arm-arm second argument in above instructions must also be a low
register (<= r7). This patch fixes this issue by creating a new predicate
"mve_memory_operand" and constraint "Ux" which allows low registers as arguments
to the generated instructions depending on the mode of the argument. A new constraint
"Ul" is created to handle loading to PC-relative addressing modes for vector
store/load intrinsiscs.
All the corresponding MVE intrinsic generating wrong code-gen as vldrbq_s32
are modified in this patch.

gcc/ChangeLog:

2020-05-20  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>
    Andre Vieira  <andre.simoesdiasvieira@arm.com>

PR target/94959
* config/arm/arm-protos.h (arm_mode_base_reg_class): Function
declaration.
(mve_vector_mem_operand): Likewise.
* config/arm/arm.c (thumb2_legitimate_address_p): For MVE target check
the load from memory to a core register is legitimate for give mode.
(mve_vector_mem_operand): Define function.
(arm_print_operand): Modify comment.
(arm_mode_base_reg_class): Define.
* config/arm/arm.h (MODE_BASE_REG_CLASS): Modify to add check for
TARGET_HAVE_MVE and expand to arm_mode_base_reg_class on TRUE.
* config/arm/constraints.md (Ux): Likewise.
(Ul): Likewise.
* config/arm/mve.md (mve_mov): Replace constraint Us with Ux and also
add support for missing Vector Store Register and Vector Load Register.
Add a new alternative to support load from memory to PC (or label) in
vector store/load.
(mve_vstrbq_<supf><mode>): Modify constraint Us to Ux.
(mve_vldrbq_<supf><mode>): Modify constriant Us to Ux, predicate to
mve_memory_operand and also modify the MVE instructions to emit.
(mve_vldrbq_z_<supf><mode>): Modify constraint Us to Ux.
(mve_vldrhq_fv8hf): Modify constriant Us to Ux, predicate to
mve_memory_operand and also modify the MVE instructions to emit.
(mve_vldrhq_<supf><mode>): Modify constriant Us to Ux, predicate to
mve_memory_operand and also modify the MVE instructions to emit.
(mve_vldrhq_z_fv8hf): Likewise.
(mve_vldrhq_z_<supf><mode>): Likewise.
(mve_vldrwq_fv4sf): Likewise.
(mve_vldrwq_<supf>v4si): Likewise.
(mve_vldrwq_z_fv4sf): Likewise.
(mve_vldrwq_z_<supf>v4si): Likewise.
(mve_vld1q_f<mode>): Modify constriant Us to Ux.
(mve_vld1q_<supf><mode>): Likewise.
(mve_vstrhq_fv8hf): Modify constriant Us to Ux, predicate to
mve_memory_operand.
(mve_vstrhq_p_fv8hf): Modify constriant Us to Ux, predicate to
mve_memory_operand and also modify the MVE instructions to emit.
(mve_vstrhq_p_<supf><mode>): Likewise.
(mve_vstrhq_<supf><mode>): Modify constriant Us to Ux, predicate to
mve_memory_operand.
(mve_vstrwq_fv4sf): Modify constriant Us to Ux.
(mve_vstrwq_p_fv4sf): Modify constriant Us to Ux and also modify the MVE
instructions to emit.
(mve_vstrwq_p_<supf>v4si): Likewise.
(mve_vstrwq_<supf>v4si): Likewise.Modify constriant Us to Ux.
* config/arm/predicates.md (mve_memory_operand): Define.

gcc/testsuite/ChangeLog:

2020-05-20  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>

PR target/94959
* gcc.target/arm/mve/intrinsics/mve_vector_float2.c: Modify.
* gcc.target/arm/mve/intrinsics/mve_vldr.c: New test.
* gcc.target/arm/mve/intrinsics/mve_vldr_z.c: Likewise.
* gcc.target/arm/mve/intrinsics/mve_vstr.c: Likewise.
* gcc.target/arm/mve/intrinsics/mve_vstr_p.c: Likewise.
* gcc.target/arm/mve/intrinsics/vld1q_f16.c: Modify.
* gcc.target/arm/mve/intrinsics/vld1q_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vld1q_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vld1q_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vld1q_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vld1q_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vld1q_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vld1q_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vld1q_z_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vld1q_z_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vld1q_z_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vld1q_z_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vld1q_z_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vld1q_z_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vld1q_z_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vld1q_z_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vldrbq_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vldrbq_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vldrbq_z_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vldrbq_z_u8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_s64.c: Likewise.
* gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_u64.c: Likewise.
* gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_s64.c: Likewise.
* gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_u64.c: Likewise.
* gcc.target/arm/mve/intrinsics/vldrhq_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vldrhq_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vldrhq_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vldrhq_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vldrhq_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vldrhq_z_f16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vldrhq_z_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vldrhq_z_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vldrhq_z_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vldrhq_z_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vldrwq_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vldrwq_gather_base_wb_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vldrwq_gather_base_wb_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vldrwq_gather_base_wb_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vldrwq_gather_base_wb_z_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vldrwq_gather_base_wb_z_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vldrwq_gather_base_wb_z_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vldrwq_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vldrwq_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vldrwq_z_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vldrwq_z_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vldrwq_z_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vuninitializedq_float.c: Likewise.
* gcc.target/arm/mve/intrinsics/vuninitializedq_float1.c: Likewise.
* gcc.target/arm/mve/intrinsics/vuninitializedq_int.c: Likewise.
* gcc.target/arm/mve/intrinsics/vuninitializedq_int1.c: Likewise.

4 years agogit_commit.py: Add tests for signatures.
Martin Liska [Wed, 20 May 2020 09:05:23 +0000 (11:05 +0200)]
git_commit.py: Add tests for signatures.

* gcc-changelog/git_commit.py: Refactor to make flake8 happy.
* gcc-changelog/test_email.py: Add new test.
* gcc-changelog/test_patches.txt: Add new patch.

4 years agocontrib/gcc-changelog: Skip over review lines
Frederik Harwath [Tue, 19 May 2020 09:15:28 +0000 (11:15 +0200)]
contrib/gcc-changelog: Skip over review lines

git-check-commit.py does not know about "Reviewed-by",
"Reviewed-on", and "Signed-off-by" lines and hence it
expects those lines which follow the ChangeLog entries
to be indented by a tab.

This commit makes the script skip those lines.  No further
processing is attempted because the review information
is not part of the ChangeLogs.

contrib/

2020-05-20  Frederik Harwath  <frederik@codesourcery.com>

* gcc-changelog/git_commit.py: Skip over lines starting
with "Reviewed-by: ", "Reviewed-on: ", or "Signed-off-by: "

4 years agogit_check_commit: shorted option name
Martin Liska [Wed, 20 May 2020 08:05:05 +0000 (10:05 +0200)]
git_check_commit: shorted option name

* gcc-changelog/git_check_commit.py: Change
--allow-non-strict-mode to --non-strict-mode.

4 years agoAdd gcc-backport and support git cherry pick.
Martin Liska [Wed, 20 May 2020 07:57:05 +0000 (09:57 +0200)]
Add gcc-backport and support git cherry pick.

* gcc-changelog/git_commit.py: Support cherry pick
prefix.
* gcc-changelog/test_email.py: Test it.
* gcc-changelog/test_patches.txt: Add new patch.
* gcc-git-customization.sh: Add gcc-backport.

4 years agoc/95141 - fix bogus integer overflow warning
Richard Biener [Tue, 19 May 2020 05:58:33 +0000 (07:58 +0200)]
c/95141 - fix bogus integer overflow warning

This fixes an integer overflow warning that ultimatively happens because
of TREE_OVERFLOW propagating through transforms and the existing guard
against this,

375           if (TREE_OVERFLOW_P (ret)
376               && !TREE_OVERFLOW_P (op0)
377               && !TREE_OVERFLOW_P (op1))
378             overflow_warning (EXPR_LOC_OR_LOC (expr, input_location,

being insufficient.  Rather than trying to use sth like walk_tree to
exhaustively walk operands (with the possibility of introducing
quadraticness when folding larger expressions recursively) the
following amends the above with an ad-hoc test for a binary op0
with a possibly constant op1.

2020-05-30  Richard Biener  <rguenther@suse.de>

PR c/95141
gcc/c
* c-fold.c (c_fully_fold_internal): Enhance guard on
overflow_warning.

gcc/testsuite
* gcc.dg/pr95141.c: New testcase.

4 years agoFix alignment for local variable [PR90811]
Kito Cheng [Tue, 14 Apr 2020 06:53:19 +0000 (14:53 +0800)]
Fix alignment for local variable [PR90811]

 - The alignment for local variable was adjust during estimate_stack_frame_size,
   however it seems wrong spot to adjust that, expand phase will adjust that
   but it little too late to some gimple optimization, which rely on certain
   target hooks need to check alignment, forwprop is an example for
   that, result of simplify_builtin_call rely on the alignment on some
   target like ARM or RISC-V.

 - Exclude static local var and hard register var in the process of
   alignment adjustment.

 - This patch fix gfortran.dg/pr45636.f90 for arm and riscv.

 - Regression test on riscv32/riscv64 and x86_64-linux-gnu, no new fail
   introduced.

gcc/ChangeLog

PR target/90811
* Makefile.in (OBJS): Add adjust-alignment.o.
* adjust-alignment.c (pass_data_adjust_alignment): New.
(pass_adjust_alignment): New.
(pass_adjust_alignment::execute): New.
(make_pass_adjust_alignment): New.
* tree-pass.h (make_pass_adjust_alignment): New.
* passes.def: Add pass_adjust_alignment.

4 years agoDaily bump.
GCC Administrator [Wed, 20 May 2020 00:16:23 +0000 (00:16 +0000)]
Daily bump.

4 years agolibstdc++: Use RDRAND as fallback if RDSEED keeps failing (PR 94087)
Jonathan Wakely [Tue, 19 May 2020 15:49:21 +0000 (16:49 +0100)]
libstdc++: Use RDRAND as fallback if RDSEED keeps failing (PR 94087)

It's not difficult for multiple threads to drain the entropy available
to the RDSEED instruction, at which point we throw an exception. This
change will try to use RDRAND after RDSEED fails repeatedly, and only
throw if RDRAND also fails repeatedly. This doesn't guarantee a random
value can always be read, but reduces the likelihood of failure when
using the RDSEED instruction.

PR libstdc++/94087
* src/c++11/random.cc (__x86_rdseed): Allow fallback function to be
passed in.
(__x86_rdseed_rdrand): New function that uses rdseed with rdrand
fallback.
(random_device::_M_init): Use __x86_rdseed_rdrand when both
instructions are available.
* testsuite/26_numerics/random/random_device/94087.cc: New test.

4 years agox86: Add FEATURE_AVX512VP2INTERSECT and update GFNI check
H.J. Lu [Tue, 19 May 2020 21:42:12 +0000 (14:42 -0700)]
x86: Add FEATURE_AVX512VP2INTERSECT and update GFNI check

Add FEATURE_AVX512VP2INTERSECT to libgcc so that enum processor_features
in libgcc matches enum processor_features in i386-builtins.c.  Update
GFNI check to support processors with SSE and AVX versions of GFNI.

PR target/95212
PR target/95220
* config/i386/cpuinfo.c (get_available_features): Fix
FEATURE_GFNI check.  Also check FEATURE_AVX512VP2INTERSECT.
* config/i386/cpuinfo.h (processor_features): Add
FEATURE_AVX512VP2INTERSECT.

4 years agoc++: Alias template instantiation template info
Nathan Sidwell [Tue, 19 May 2020 20:29:19 +0000 (13:29 -0700)]
c++: Alias template instantiation template info

I discovered that the alias instantiation machinery would setup
template_info, and then sometime later overwrite that with equivalent
info.  This broke modules, because the template info, once set, is
logically immutable.  Let's just not do that.

* pt.c (lookup_template_class_1): Do not reinit template_info of an
alias here.

4 years agopreprocessor: Random cleanups
Nathan Sidwell [Tue, 19 May 2020 20:20:32 +0000 (13:20 -0700)]
preprocessor: Random cleanups

This fixes a bunch of poorly formatted decls, marks some getters as
PURE, deletes some C-relevant bool hackery, and finally uses a
passed-in location rather than deducing a closely-related but not
necessarily the same location.

* include/cpplib.h (cpp_get_otions, cpp_get_callbacks)
(cpp_get_deps): Mark as PURE.
* include/line-map.h (get_combined_adhoc_loc)
(get_location_from_adhoc_loc, get_pure_location): Reformat decls.
* internal.h (struct lexer_state): Clarify comment.
* system.h: Remove now-unneeded bool hackery.
* files.c (_cpp_find_file): Store LOC not highest_location.

4 years ago[aarch64] PR target/94591: Don't generate invalid REV64 insns
Alex Coplan [Tue, 19 May 2020 19:33:20 +0000 (20:33 +0100)]
[aarch64] PR target/94591: Don't generate invalid REV64 insns

This fixes PR94591. The problem was the function aarch64_evpc_rev_local()
matching vector permutations that were not reversals. In particular, prior to
this patch, this function matched the identity permutation which led to
generating bogus REV64 insns which were rejected by the assembler.

gcc/
PR target/94591
* config/aarch64/aarch64.c (aarch64_evpc_rev_local): Don't match
identity permutation.

gcc/testsuite/
PR target/94591
* gcc.c-torture/execute/pr94591.c: New test.

4 years agoUse REST API for bug titles in mklog.
Martin Liska [Tue, 19 May 2020 19:16:27 +0000 (21:16 +0200)]
Use REST API for bug titles in mklog.

* mklog.py: Use REST API for bug title downloading.

4 years agoUse commit timestamp in git_update_version.py.
Martin Liska [Tue, 19 May 2020 19:16:10 +0000 (21:16 +0200)]
Use commit timestamp in git_update_version.py.

* gcc-changelog/git_commit.py: Add param use_commit_ts
for to_changelog_entries.
* gcc-changelog/git_update_version.py: Se use_commit_ts to True.

4 years agoPR c++/94923 - False positive -Wclass-memaccess with trivially copyable std::optional
Martin Sebor [Tue, 19 May 2020 18:46:37 +0000 (12:46 -0600)]
PR c++/94923 - False positive -Wclass-memaccess with trivially copyable std::optional

gcc/cp/ChangeLog:

PR c++/94923
* call.c ((maybe_warn_class_memaccess): Use is_byte_access_type.
* cp-tree.h (is_dummy_object): Return bool.
(is_byte_access_type): Declare new function.
* tree.c (is_dummy_object): Return bool.
(is_byte_access_type): Define new function.

gcc/testsuite/ChangeLog:

PR c++/94923
* g++.dg/Wclass-memaccess.C: Add tests for std::byte.

4 years agopreprocessor: Reimplement raw string lexing [pr95149]
Nathan Sidwell [Tue, 19 May 2020 18:28:05 +0000 (11:28 -0700)]
preprocessor: Reimplement raw string lexing [pr95149]

pr95149 is a false positive static analysis checker.  But it
encouranged me to fix raw string lexing, which does contain a
complicated macro and pointers to local variables.  The
reimplementation does away with that macro.  Part of the complication
is we need to undo some of the fresh line processing -- trigraph notes
and escaped line continuations.  But the undone characters need to go
through the raw string processing, as they can legitimately be part of
the prefix marker.  however, in this reformulation we only process one
line marker at a time[*], so there's a limited number of undone
characters.  We can arrange the buffering to make sure we don't split
such an append sequence, and then simply take the characters from the
append buffer.

The prefix scanner had a switch statement, which I discovered was not
optimized as well as an if of a bunch of explicit comparisons (pr
95208 filed).

Finally I adjusted the failure mode.  When we get a bad prefix, we lex
up until the next '"', thus often swallowing the whole raw string.
Previously we'd bail and then the lexer would usually generate stupid
tokens, particularly when meeting the ending '"'.

libcpp/
* lex.c (struct lit_accum): New.
(bufring_append): Replace by lit_accum::append.
(lex_raw_string): Reimplement, using fragments of the old version.
(lex_string): Adjust lex_raw_string call.

gcc/testsuite/
* c-c++-common/raw-string-14.c: Adjust errors.
* c-c++-common/raw-string-16.c: Likewise.
* c-c++-common/raw-string-5.c: Likewise.

4 years agoFix FAIL: gcc.target/i386/pr92645-4.c
Richard Biener [Tue, 19 May 2020 18:30:40 +0000 (20:30 +0200)]
Fix FAIL: gcc.target/i386/pr92645-4.c

This adjusts the testcase for the introduced vector promotion/demotion
support.

2020-05-19  Richard Biener  <rguenther@suse.de>

* gcc.target/i386/pr92645-4.c: Adjust expected pattern.

4 years agopreprocessor: Fix ICE with EOF in macro args [pr95182]
Nathan Sidwell [Tue, 19 May 2020 13:11:22 +0000 (06:11 -0700)]
preprocessor: Fix ICE with EOF in macro args [pr95182]

This was another latent case of us losing an EOF token, but succeeding
anyway.  Since my patch to make us pay more attention to EOFs it came
to light.  We also need to keep the EOF if we fall off the end of the
main file.  Forced includes look like regular nested includes at this
point.

PR preprocessor/95182
libcpp/
* macro.c (collect_args): Preserve EOFif we fell out of the main
file.
(cpp_get_token_1): Reformat a couple of short lines.

4 years agoTESTSUITE: Fix tests for 16-bit targets
Jozef Lawrynowicz [Tue, 19 May 2020 11:46:17 +0000 (12:46 +0100)]
TESTSUITE: Fix tests for 16-bit targets

gcc/ChangeLog:

2020-05-19  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

* doc/sourcebuild.texi: Document new short_eq_int, ptr_eq_short,
msp430_small, msp430_large and size24plus DejaGNU effective
targets.
Improve grammar in descriptions for size20plus and size32plus effective
targets.

gcc/testsuite/ChangeLog:

2020-05-19  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

* c-c++-common/builtin-has-attribute-7.c: Require size24plus.
* c-c++-common/cpp/pr63831-1.c: Store result in _has_cpp_attribute in a
long.
* c-c++-common/pr81376.c: Skip scan-tree-dump for short_eq_int. Extend
test for short_eq_int.
* g++.dg/abi/scoped1.C: Skip dg-warning tests for short_eq_int.
* g++.dg/cpp0x/constexpr-70001-1.C: Require size24plus.
* g++.dg/cpp0x/constexpr-bitfield3.C: Require int32plus.
* g++.dg/cpp0x/enum13.C: Skip dg-warning for short_eq_int.
* g++.dg/cpp0x/initlist5.C: Add dg-error for short_eq_int.
* g++.dg/cpp0x/initlist7.C: Add dg-warning for !int32plus.
* g++.dg/cpp0x/nullptr04.C: Skip dg-error for ptr_eq_short.
* g++.dg/cpp0x/variadic-value1.C: Add typedef for int32_t.
* g++.dg/cpp1y/constexpr-arith-overflow.C: Fix test for
sizeof(int) == sizeof(short).
* g++.dg/cpp1y/digit-sep-neg.C: Add typedef for int32_t.
* g++.dg/cpp1y/pr57644.C: Add typedef for uint32_t.
* g++.dg/cpp1y/pr77321.C: Require size24plus.
* g++.dg/cpp1y/var-templ4.C: Add typedef for int32_t.
* g++.dg/cpp1z/direct-enum-init1.C: Skip dg-error for short_eq_int.
* g++.dg/delayedfold/fwrapv1.C: Skip for int16.
* g++.dg/expr/bitfield9.C: Add typedef for int32_t.
* g++.dg/ext/attribute-test-1.C: Add typedef for uint32_t.
* g++.dg/ext/bitfield1.C: Add typedef for int32_t.
* g++.dg/ext/flexary13.C: Add typedef for int32_t.
* g++.dg/ext/utf-cvt.C: Adjust dg-warning for int16.
* g++.dg/ext/vector28.C: Add typedef for int32_t.
* g++.dg/ext/vla15.C: Add typedef for int32_t.
* g++.dg/init/array11.C: Require size32plus.
* g++.dg/init/array15.C: Require size24plus.
* g++.dg/init/array4.C: Require size20plus.
* g++.dg/init/const7.C: Skip dg-message for ptr_eq_short.
* g++.dg/init/new38.C: Relax regex in dg-error.
* g++.dg/init/new44.C: Skip dg-error for msp430_small.
Adjust test for 16-bit size_t.
Add special case for msp430 -mlarge.
* g++.dg/init/value9.C: Add typedef for int32_t.
* g++.dg/ipa/pr77333.C: Add typedef for int32_t.
* g++.dg/lto/20080908-1_0.C: Add typedef for int32_t.
* g++.dg/opt/pr55717.C: Add typedef for uint32_t.
* g++.dg/opt/pr60597.C: Add typedef for int32_t.
* g++.dg/opt/pr81715.C: Require size20plus.
* g++.dg/opt/reload3.C: Add typedef for uint32_t.
* g++.dg/opt/temp2.C: Require size20plus.
* g++.dg/opt/thunk1.C: Likewise.
* g++.dg/other/error23.C: Dont assume __SIZEOF_INT__ == 4.
* g++.dg/other/pr31078.C: Adjust typedef for 32-bit int.
* g++.dg/parse/concat1.C: Skip dg-error for size20plus.
* g++.dg/parse/defarg5.C: Add typedef for int32_t and uint32_t.
* g++.dg/pr48484.C: Add typedef for int32_t.
* g++.dg/pr53037-2.C: Likewise.
* g++.dg/pr53037-3.C: Likewise.
* g++.dg/pr66655.C: Use int32_t.
* g++.dg/pr66655.h: Add typedef for int32_t.
* g++.dg/pr66655_1.cc: Use int32_t.
* g++.dg/pr67351.C: Define 32-bit uint.
* g++.dg/template/array30.C: Add typedef for int32_t.
* g++.dg/template/constant1.C: Extend test for 8-bit and 16-bit int.
* g++.dg/template/constant2.C: Likewise.
* g++.dg/template/friend18.C: Add typedef for int32_t.
* g++.dg/template/pr68978.C: Likewise.
* g++.dg/torture/pr37421.C: Require int_eq_float.
* g++.dg/torture/pr88861.C: Handle 16-bit int.
* g++.dg/tree-ssa/pr19807.C: Likewise.
* g++.dg/tree-ssa/pr27291.C: Fix typedef for uint32_t.
* g++.dg/tree-ssa/pr49516.C: Fix typedefs for int{16,32}_t and
uint{32,64}_t.
* g++.dg/warn/Wconversion-integer.C: Add typedefs for {u,}int32_t.
* g++.dg/warn/Wconversion-null-2.C: Adjust g() declaration.
* g++.dg/warn/Wconversion-null.C: Likewise.
* g++.dg/warn/Wconversion3.C: Skip dg-warning for short_eq_int.
* g++.dg/warn/Wduplicated-branches1.C: Add dg-warning for short_eq_int.
* g++.dg/warn/Wplacement-new-size-5.C: Add typedef for int32_t.
* g++.dg/warn/Wplacement-new-size.C: Likewise.
* g++.dg/warn/Wstrict-aliasing-5.C: Add typedef for uint32_t.
* g++.dg/warn/Wstrict-aliasing-bogus-signed-unsigned.C: Add typedef for
{u,}int32_t.
* g++.dg/warn/Wtype-limits-Wextra.C: Adjust dg-warning for
short_eq_int.
* g++.dg/warn/Wtype-limits.C: Likewise.
* g++.old-deja/g++.brendan/enum11.C: Add typedef for uint32_t.
* g++.old-deja/g++.bugs/900227_01.C: Skip dg-error for ptr_eq_short.
* g++.old-deja/g++.mike/ns15.C: Require size20plus.
* g++.old-deja/g++.other/exprstmt1.C: Add typedef for uint32_t.
* g++.old-deja/g++.other/inline12.C: Adjust udword typedef.
* g++.old-deja/g++.other/new6.C: Add typedef for int32_t.
* g++.old-deja/g++.pt/crash16.C: Skip for int16.
* g++.old-deja/g++.robertl/eb76.C: Likewise.
* g++.old-deja/g++.warn/flow1.C: Add typedef for int32_t.
* gcc.dg/Walloca-14.c: Adjust -Walloca-larger-than= parameter for
!ptr32plus.
* gcc.dg/Warray-bounds-32.c: Adjust dg-warning for size20plus.
* gcc.dg/Wbuiltin-declaration-mismatch-4.c: Adjust dg-warning for
short_eq_int.
Handle case where ptrdiff_t/size_t is __int20.
* gcc.dg/concat2.c: Skip dg-error for size20plus.
* gcc.dg/fold-convmaxconv-1.c: Add typedef for {u,}int32_t.
* gcc.dg/fold-convminconv-1.c: Likewise.
* gcc.dg/graphite/scop-4.c: Require size20plus.
* gcc.dg/loop-versioning-1.c: Adjust test for small size_t.
* gcc.dg/loop-versioning-2.c: Require size20plus.
* gcc.dg/lto/20081210-1_0.c: Adjust typedef for uintptr_t.
* gcc.dg/lto/pr85870_0.c: Add typedef for uint32_t.
* gcc.dg/lto/pr85870_1.c: Likewise.
* gcc.dg/pr36227.c: Adjust typedef for ptrcast.
* gcc.dg/pr42611.c: First check for size_t equality with void *
before trying other types.
* gcc.dg/pr59963-2.c: Skip dg-warning for int16 instead of
xfail.
* gcc.dg/pr68317.c: Add typedef for int32_t.
* gcc.dg/pr78973.c: Adjust dg-warning for int16.
* gcc.dg/pr85859.c: Cast using __INTPTR_TYPE__ instead of long.
* gcc.dg/pr86179.c: Add typedef for {u,}int32_t.
* gcc.dg/torture/20181024-1.c: Require size32plus.
* gcc.dg/torture/pr71598-2.c: Skip for short_eq_int.
* gcc.dg/torture/pr86034.c: Add typedef for int32_t.
* gcc.dg/tree-ssa/builtin-sprintf-warn-3.c: Adjust dg-warning
for int16 and msp430 -mlarge.
* gcc.dg/tree-ssa/integer-addr.c: Use __INTPTR_MAX__ for a large
constant that is a valid address.
* gcc.dg/tree-ssa/loop-interchange-10.c: Add typedef for
int32_t.
* gcc.dg/tree-ssa/pr84436-3.c: Adjust dg-final for int16.
* gcc.dg/tree-ssa/pr84648.c: Add typedef for uint32_t.
* gcc.dg/tree-ssa/scev-8.c: Cast to char if sizeof(int) ==
sizeof(short).
* gcc.dg/tree-ssa/ssa-dom-thread-8.c: Adjust test for msp430 -mlarge.
* lib/target-supports.exp (check_effective_target_size24plus): New.
(check_effective_target_short_eq_int): New.
(check_effective_target_ptr_eq_short): New.
(check_effective_target_msp430_small): New.
(check_effective_target_msp430_large): New.

4 years agoopenmp: Add basic library allocator support.
Jakub Jelinek [Tue, 19 May 2020 12:02:04 +0000 (14:02 +0200)]
openmp: Add basic library allocator support.

This patch adds very basic allocator support (omp_{init,destroy}_allocator,
omp_{alloc,free}, omp_[sg]et_default_allocator).
The plan is to use memkind (likely dlopened) for high bandwidth memory, but
that part isn't implemented yet, probably mlock for pinned memory and see
what other options there are for other kinds of memory.
For offloading targets, we need to decide if we want to support the
dynamic allocators (and on which targets), or if e.g. all we do is at compile
time replace omp_alloc/omp_free calls with constexpr predefined allocators
with something special.

And allocate directive and allocator/uses_allocators clauses are future work
too.

2020-05-19  Jakub Jelinek  <jakub@redhat.com>

* allocator.c: New file.

4 years agomklog.py: improve parsing of struct names (ignore GTY).
Martin Liska [Tue, 19 May 2020 10:33:46 +0000 (12:33 +0200)]
mklog.py: improve parsing of struct names (ignore GTY).

* mklog.py: Skip GTY for struct names.  Make flake8 happy.
* test_mklog.py: Add test for GTY.

4 years agoAdd missing changelog entry.
Martin Liska [Tue, 19 May 2020 10:03:42 +0000 (12:03 +0200)]
Add missing changelog entry.

4 years agoFill up entries in reverse order.
Martin Liska [Tue, 19 May 2020 10:01:41 +0000 (12:01 +0200)]
Fill up entries in reverse order.

contrib/ChangeLog:

* gcc-changelog/git_update_version.py:
Fill up entries in reverse order.

4 years agobpf: do not save/restore callee-saved registers in function prolog/epilog
Jose E. Marchesi [Tue, 19 May 2020 09:46:40 +0000 (11:46 +0200)]
bpf: do not save/restore callee-saved registers in function prolog/epilog

BPF considers that every call to a function allocates a fresh set of
registers that are available to the callee, of which the first five
may have bee initialized with the function arguments.  This is
implemented by both interpreter and JIT in the Linux kernel.

This is enforced by the kernel BPF verifier, which will reject any
code in which non-initialized registers are accessed before being
written.  Consequently, the spill instructions generated in function
prologue were causing the verifier to reject our compiled programs.

This patch makes GCC to not save/restore callee-saved registers in
function prologue/epilogue, unless xBPF mode is enabled.

2020-05-19  Jose E. Marchesi  <jose.marchesi@oracle.com>

gcc/
* config/bpf/bpf.c (bpf_compute_frame_layout): Include space for
callee saved registers only in xBPF.
(bpf_expand_prologue): Save callee saved registers only in xBPF.
(bpf_expand_epilogue): Likewise for restoring.
* doc/invoke.texi (eBPF Options): Document this is activated by
-mxbpf.

gcc/testsuite/
* gcc.target/bpf/xbpf-callee-saved-regs-1.c: New test.
* gcc.target/bpf/xbpf-callee-saved-regs-2.c: Likewise.

4 years agobpf: add support for the -mxbpf option
Jose E. Marchesi [Tue, 19 May 2020 09:46:06 +0000 (11:46 +0200)]
bpf: add support for the -mxbpf option

This patch adds support for a new option -mxbpf.  This tells GCC to
generate code for an expanded version of BPF that relaxes some of the
restrictions imposed by BPF.

2020-05-19  Jose E. Marchesi  <jose.marchesi@oracle.com>

gcc/
* config/bpf/bpf.opt (mxbpf): New option.
* doc/invoke.texi (Option Summary): Add -mxbpf.
(eBPF Options): Document -mxbbpf.

4 years agoNew mklog script.
Martin Liska [Thu, 14 May 2020 22:44:07 +0000 (00:44 +0200)]
New mklog script.

contrib/ChangeLog:

2020-05-15  Martin Liska  <mliska@suse.cz>

* gcc-git-customization.sh: Add
alias.gcc-mklog new hook.
* mklog.py: New file.
* test_mklog.py: New file.

4 years agoMove 2 mklog scripts to legacy subfolder.
Martin Liska [Tue, 19 May 2020 09:02:03 +0000 (11:02 +0200)]
Move 2 mklog scripts to legacy subfolder.

contrib/ChangeLog:

* legacy/mklog: Moved from mklog.
* legacy/mklog.pl: Moved from mklog.pl.

4 years agoAdd missing ChangeLog entries.
Uros Bizjak [Tue, 19 May 2020 09:28:42 +0000 (11:28 +0200)]
Add missing ChangeLog entries.

4 years agoi386: Add missing vector zero/sign extend expanders [PR92658]
Uros Bizjak [Tue, 19 May 2020 09:25:46 +0000 (11:25 +0200)]
i386: Add missing vector zero/sign extend expanders [PR92658]

2020-05-19  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:
PR target/92658
* config/i386/sse.md (<code>v16qiv16hi2): New expander.
(<code>v32qiv32hi2): Ditto.
(<code>v8qiv8hi2): Ditto.
(<code>v16qiv16si2): Ditto.
(<code>v8qiv8si2): Ditto.
(<code>v4qiv4si2): Ditto.
(<code>v16hiv16si2): Ditto.
(<code>v8hiv8si2): Ditto.
(<code>v4hiv4si2): Ditto.
(<code>v8qiv8di2): Ditto.
(<code>v4qiv4di2): Ditto.
(<code>v2qiv2di2): Ditto.
(<code>v8hiv8di2): Ditto.
(<code>v4hiv4di2): Ditto.
(<code>v2hiv2di2): Ditto.
(<code>v8siv8di2): Ditto.
(<code>v4siv4di2): Ditto.
(<code>v2siv2di2): Ditto.

gcc/testsuite/ChangeLog:
PR target/92658
* gcc.target/i386/pr92658-sse4.c: New test.
* gcc.target/i386/pr92658-avx2.c: New test.
* gcc.target/i386/pr92658-avx512bw.c: New test.

4 years agoAdd missing ChangeLog entry.
Martin Liska [Tue, 19 May 2020 09:12:52 +0000 (11:12 +0200)]
Add missing ChangeLog entry.

4 years agoFix typo in c-parser.c.
Martin Liska [Tue, 19 May 2020 08:39:30 +0000 (10:39 +0200)]
Fix typo in c-parser.c.

gcc/c/ChangeLog:

* c-parser.c: Fix typo.

4 years agoopenmp: Add basic library allocator support.
Jakub Jelinek [Tue, 19 May 2020 08:11:01 +0000 (10:11 +0200)]
openmp: Add basic library allocator support.

This patch adds very basic allocator support (omp_{init,destroy}_allocator,
omp_{alloc,free}, omp_[sg]et_default_allocator).
The plan is to use memkind (likely dlopened) for high bandwidth memory, but
that part isn't implemented yet, probably mlock for pinned memory and see
what other options there are for other kinds of memory.
For offloading targets, we need to decide if we want to support the
dynamic allocators (and on which targets), or if e.g. all we do is at compile
time replace omp_alloc/omp_free calls with constexpr predefined allocators
with something special.

And allocate directive and allocator/uses_allocators clauses are future work
too.

2020-05-19  Jakub Jelinek  <jakub@redhat.com>

* omp.h.in (omp_uintptr_t): New typedef.
(__GOMP_UINTPTR_T_ENUM): Define.
(omp_memspace_handle_t, omp_allocator_handle_t, omp_alloctrait_key_t,
omp_alloctrait_value_t, omp_alloctrait_t): New typedefs.
(__GOMP_DEFAULT_NULL_ALLOCATOR): Define.
(omp_init_allocator, omp_destroy_allocator, omp_set_default_allocator,
omp_get_default_allocator, omp_alloc, omp_free): Declare.
* libgomp.h (struct gomp_team_state): Add def_allocator field.
(gomp_def_allocator): Declare.
* libgomp.map (OMP_5.0.1): Export omp_set_default_allocator,
omp_get_default_allocator, omp_init_allocator, omp_destroy_allocator,
omp_alloc and omp_free.
* team.c (gomp_team_start): Copy over ts.def_allocator.
* env.c (gomp_def_allocator): New variable.
(parse_wait_policy): Adjust function comment.
(parse_allocator): New function.
(handle_omp_display_env): Print OMP_ALLOCATOR.
(initialize_env): Call parse_allocator.
* Makefile.am (libgomp_la_SOURCES): Add allocator.c.
* allocator.c: New file.
* icv.c (omp_set_default_allocator, omp_get_default_allocator): New
functions.
* testsuite/libgomp.c-c++-common/alloc-1.c: New test.
* testsuite/libgomp.c-c++-common/alloc-2.c: New test.
* testsuite/libgomp.c-c++-common/alloc-3.c: New test.
* Makefile.in: Regenerated.

4 years agoAdd gcc-verify alias.
Martin Liska [Tue, 19 May 2020 07:19:18 +0000 (09:19 +0200)]
Add gcc-verify alias.

* gcc-git-customization.sh: Add gcc-verify alias
that uses contrib/gcc-changelog/git_check_commit.py.

4 years agoRISC-V: Handle implied extension for -march parser.
Kito Cheng [Fri, 10 Apr 2020 09:20:19 +0000 (17:20 +0800)]
RISC-V: Handle implied extension for -march parser.

  - Implied rule are introduced into latest RISC-V ISA spec.

  - Only implemented D implied F-extension. Zicsr and Zifence are not
    implement yet, so the rule not included in this patch.

  - Pass preprocessed arch string to arch.

  - Verified with binutils 2.30 and 2.34.

gcc/ChangeLog

* common/config/riscv/riscv-common.c (riscv_implied_info_t): New.
(riscv_implied_info): New.
(riscv_subset_list): Add handle_implied_ext.
(riscv_subset_list::to_string): New parameter version_p to
control output format.
(riscv_subset_list::handle_implied_ext): New.
(riscv_subset_list::parse_std_ext): Call handle_implied_ext.
(riscv_arch_str): New parameter version_p to control output format.
(riscv_expand_arch): New.
* config/riscv/riscv-protos.h (riscv_arch_str): New parameter,
version_p.
* config/riscv/riscv.h (riscv_expand_arch): New,
(EXTRA_SPEC_FUNCTIONS): Define.
(ASM_SPEC): Transform -march= via riscv_expand_arch.

gcc/testsuite/ChangeLog

* gcc.target/riscv/arch-6.c: New.
* gcc.target/riscv/attribute-11.c: New.
* gcc.target/riscv/attribute-12.c: New.

4 years agoRISC-V: Update march parser
Kito Cheng [Fri, 10 Apr 2020 09:20:18 +0000 (17:20 +0800)]
RISC-V: Update march parser

 - The arch string rule has changed in latest spec, it introduced new
   multi-letter extension prefix with 'h' and 'z', and drop `sx`. also
   adjust parsing order for 's' and 'x'.

gcc/ChangeLog

* riscv-common.c (parse_sv_or_non_std_ext): Rename to
parse_multiletter_ext.
(parse_multiletter_ext): Add parsing `h` and `z`, drop `sx`,
adjust parsing order for 's' and 'x'.

gcc/testsuite/ChangeLog

* gcc.target/riscv/arch-3.c: Adjust option.
* gcc.target/riscv/arch-5.c: New.
* gcc.target/riscv/attribute-9.c: Adjust option and test
condition.

4 years agocost invariant nodes from vect_slp_analyze_node_operations SLP walk
Richard Biener [Mon, 18 May 2020 14:05:00 +0000 (16:05 +0200)]
cost invariant nodes from vect_slp_analyze_node_operations SLP walk

2020-05-19  Richard Biener  <rguenther@suse.de>

* tree-vectorizer.h (_slp_tree::vectype): Add field.
(SLP_TREE_VECTYPE): New.
* tree-vect-slp.c (vect_create_new_slp_node): Initialize
SLP_TREE_VECTYPE.
(vect_create_new_slp_node): Likewise.
(vect_prologue_cost_for_slp): Move here from tree-vect-stmts.c
and simplify.
(vect_slp_analyze_node_operations): Walk nodes children for
invariant costing.
(vect_get_constant_vectors): Use local scope op variable.
* tree-vect-stmts.c (vect_prologue_cost_for_slp_op): Remove here.
(vect_model_simple_cost): Adjust.
(vect_model_store_cost): Likewise.
(vectorizable_store): Likewise.

4 years agoc++: Enable spec_hasher table sanitization [PR87847]
Patrick Palka [Tue, 19 May 2020 03:50:32 +0000 (23:50 -0400)]
c++: Enable spec_hasher table sanitization [PR87847]

It looks like hash table sanitization is now safe to enable for the
decl_specializations and type_specializations tables, probably ever
since PR94454 was fixed.

gcc/cp/ChangeLog:

PR c++/87847
* pt.c (init_template_processing): Enable sanitization for
decl_specializations and type_specializations.

4 years agoc++: Explain fn template argument type/value mismatches [PR66439]
Patrick Palka [Tue, 19 May 2020 03:50:14 +0000 (23:50 -0400)]
c++: Explain fn template argument type/value mismatches [PR66439]

In fn_type_unifcation, we are passing NULL_TREE as the 'in_decl'
parameter to coerce_template_parms, and this is causing template
type/value mismatch error messages to get suppressed regardless of the
value of 'complain'.

This means that when substitution into a function template fails due to
a type/value mismatch between a template parameter and the provided
template argument, we just say "template argument deduction/substitution
failed:" without a followup explanation of the failure.

Fix this by passing 'fn' instead of NULL_TREE to coerce_template_parms.

gcc/cp/ChangeLog:

PR c++/66439
* pt.c (fn_type_unification): Pass 'fn' instead of NULL_TREE as
the 'in_decl' parameter to coerce_template_parms.

gcc/testsuite/ChangeLog:

PR c++/66439
* g++.dg/cpp2a/concepts-ts4.C: Expect a "type/value mismatch"
diagnostic.
* g++.dg/cpp2a/concepts-ts6.C: Likewise.
* g++.dg/template/error56.C: Likewise.
* g++.dg/template/error59.C: New test.

libstdc++-v3/ChangeLog:

PR c++/66439
* testsuite/20_util/pair/astuple/get_neg.cc: Prune "type/value
mismatch" messages.
* testsuite/20_util/tuple/element_access/get_neg.cc: Likewise.

4 years agoDaily bump.
GCC Administrator [Tue, 19 May 2020 00:16:28 +0000 (00:16 +0000)]
Daily bump.

4 years agoc++: ICE when shortening right shift [PR94955]
Marek Polacek [Wed, 6 May 2020 19:53:33 +0000 (15:53 -0400)]
c++: ICE when shortening right shift [PR94955]

Since r10-6527 fold_for_warn calls maybe_constant_value, which means it
can fold more than it previously could.  In this testcase it means that
cp_build_binary_op/RSHIFT_EXPR set short_shift because now we were able
to fold op1 to an INTEGER_CST.  But then when actually performing the
shortening we crashed because cp_fold_rvalue wasn't able to fold as much
as f_f_w and so tree_int_cst_sgn crashed on a NOP_EXPR.  Therefore the
calls should probably match.

PR c++/94955
* typeck.c (cp_build_binary_op): Use fold_for_warn instead of
cp_fold_rvalue.

* g++.dg/cpp0x/constexpr-shift2.C: New test.

4 years agoc++: ICE with -Wall and constexpr if [PR94937]
Marek Polacek [Wed, 6 May 2020 23:24:58 +0000 (19:24 -0400)]
c++: ICE with -Wall and constexpr if [PR94937]

An ICE arises here because we call cp_get_callee_fndecl_nofold in a
template, and we've got a CALL_EXPR whose CALL_EXPR_FN is a BASELINK.
This tickles the INDIRECT_TYPE_P assert in cp_get_fndecl_from_callee.

Fixed by turning the assert into a condition and returning NULL_TREE
in that case.

PR c++/94937
* cvt.c (cp_get_fndecl_from_callee): Return NULL_TREE if the function
type is not INDIRECT_TYPE_P.
* decl.c (omp_declare_variant_finalize_one): Call
cp_get_callee_fndecl_nofold instead of looking for the function decl
manually.

* g++.dg/cpp1z/constexpr-if34.C: New test.
* g++.dg/cpp2a/is-constant-evaluated10.C: New test.

4 years agoPR middle-end/92815 - spurious -Wstringop-overflow writing into a flexible array...
Martin Sebor [Mon, 18 May 2020 22:31:13 +0000 (16:31 -0600)]
PR middle-end/92815 - spurious -Wstringop-overflow writing into a flexible array of an extern struct

Adjust test to avoid failures in ILP32 mode.

gcc/testsuite/ChangeLog:

PR middle-end/92815
* gcc.dg/builtin-object-size-20.c: Adjust to avoid failures in
ILP32 mode.

4 years agoc++: Sorry about type-dependent arg for __builtin_has_attribute [PR90915]
Marek Polacek [Fri, 8 May 2020 01:10:42 +0000 (21:10 -0400)]
c++: Sorry about type-dependent arg for __builtin_has_attribute [PR90915]

Until 92104 is fixed, let's sorry rather than crash.

PR c++/90915
* parser.c (cp_parser_has_attribute_expression): Sorry on a
type-dependent argument.

* g++.dg/ext/builtin-has-attribute.C: New test.

4 years agoPR middle-end/92815 - spurious -Wstringop-overflow writing into a flexible array...
Martin Sebor [Mon, 18 May 2020 21:24:12 +0000 (15:24 -0600)]
PR middle-end/92815 - spurious -Wstringop-overflow writing into a flexible array of an extern struct

gcc/ChangeLog:

PR middle-end/92815
* tree-object-size.c (decl_init_size): New function.
(addr_object_size): Call it.
* tree.h (last_field): Declare.
(first_field): Add attribute nonnull.

gcc/testsuite/ChangeLog:

PR middle-end/92815
* gcc.dg/Warray-bounds-56.c: Remove xfails.
* gcc.dg/builtin-object-size-20.c: New test.
* gcc.dg/builtin-object-size-21.c: New test.

4 years agoPR middle-end/94940 - spurious -Warray-bounds for a zero length array member of union
Martin Sebor [Mon, 18 May 2020 21:07:48 +0000 (15:07 -0600)]
PR middle-end/94940 - spurious -Warray-bounds for a zero length array member of union

gcc/testsuite/ChangeLog:

PR middle-end/94940
* gcc.dg/Warray-bounds-61.c: New test.

gcc/ChangeLog:

PR middle-end/94940
* tree-vrp.c (vrp_prop::check_mem_ref): Remove unreachable code.
* tree.c (component_ref_size): Correct the handling or array members
of unions.
Drop a pointless test.
Rename a local variable.

4 years agoUpdate gcc sv.po.
Joseph Myers [Mon, 18 May 2020 20:50:35 +0000 (20:50 +0000)]
Update gcc sv.po.

* sv.po: Update.

4 years agoc++: Implement DR 1512, Pointer comparison vs qual convs [PR87699]
Marek Polacek [Wed, 13 May 2020 19:52:42 +0000 (15:52 -0400)]
c++: Implement DR 1512, Pointer comparison vs qual convs [PR87699]

This patch resolves DR 1512 (and, by turn, DR 583).  This entails:

1) Relational pointer comparisons against null pointer constants have
   been made ill-formed:

   void f(char *p) {
      if (p > 0)
// ...
   }

   was always invalid in C but was -- accidentally -- allowed in C++.

2) This was ill-formed:

   bool foo(int** x, const int** y) {
     return x < y;
   }

   because 'int**' couldn't be converted to 'const int**'.  This was
   fixed by re-defining a generic composite pointer type.  The composite
   type of these two pointers will be 'const int *const *', to which
   both pointers can be converted.

3) The overload descriptions for built-in operators were adjusted,
   because objects of type std::nullptr_t cannot be used with relational
   operators any more.

I fixed 1) by adjusting cp_build_binary_op; we already had a warning
for it so made it a hard error now.

Then 2) required tweaking composite_pointer_type_r.  [expr.type] defines
the composite pointer type by using the "cv-combined type."  We didn't
implement the [conv.qual]/3.3 part; previously the composite type of
'int**' and 'const int**' was 'const int**', so this didn't compile:

    void f(const int **p, int **q) {
      true ? p : q;
    }

I wrote a more extensive test for this which uses decltype and some
template magic to check the composite type, see composite-ptr-type.C.
We still don't handle everything that [expr.type] requires us to,
but it's pretty close.

And finally 3) was handled in add_builtin_candidate.  Turned out we
weren't creating built-in operator candidates when the type was
std::nullptr_t at all.  We should, for == and !=.  Tested in builtin4.C.
In passing, I'm fixing some of the comments too.

DR 1512
PR c++/87699
* call.c (add_builtin_candidate) <case EQ_EXPR>: Create candidate
operator functions when type is std::nullptr_t for ==/!=.
* typeck.c (composite_pointer_type_r): Add bool a * parameter.  Use it
to maybe add "const" to the pointer type.
(composite_pointer_type): Update the call to composite_pointer_type_r.
(cp_build_binary_op): Turn two warning_at into error_at.  Print the
types.

* g++.dg/cpp0x/constexpr-array-ptr10.C: Change dg-warning to dg-error
and adjust the expected messages in dg-error.
* g++.dg/expr/composite-ptr-type.C: New test.
* g++.dg/expr/ptr-comp1.C: New test.
* g++.dg/expr/ptr-comp2.C: New test.
* g++.dg/expr/ptr-comp3.C: New test.
* g++.dg/overload/builtin4.C: New test.
* g++.dg/warn/Wextra-3.C: Change dg-warning to dg-error.

4 years agoc++: Create fewer SAVE_EXPR.
Jason Merrill [Wed, 15 Jan 2020 03:55:59 +0000 (22:55 -0500)]
c++: Create fewer SAVE_EXPR.

In a couple of places in build_over_call we were calling
cp_stabilize_reference but only using the result once, so it isn't needed.

gcc/cp/ChangeLog
2020-05-18  Jason Merrill  <jason@redhat.com>

* call.c (build_over_call): Remove unnecessary
cp_stabilize_reference.

4 years agoc++: Don't add built-in operator for ++ on bool.
Marek Polacek [Fri, 15 May 2020 14:59:01 +0000 (10:59 -0400)]
c++: Don't add built-in operator for ++ on bool.

This feels extremely obscure but at least it's an opportunity to fix the
comments.  P0002R1 removed deprecated operator++(bool) in C++17 so let's
avoid adding a builtin overload candidate for ++ when the type is bool.

* call.c (add_builtin_candidate): Don't create a builtin overload
candidate for ++ when type is bool in C++17.

* g++.dg/overload/builtin5.C: New test.

4 years agoc++: Regenerate cp/cfns.h.
Marek Polacek [Fri, 15 May 2020 21:54:05 +0000 (17:54 -0400)]
c++: Regenerate cp/cfns.h.

Current cfns.h includes register-qualified variables and that wouldn't
play well when bootstrapping with GCC that uses the C++17 dialect,
because 'register' was removed in C++17.  Regenerating it using the
command specified in cfns.h luckily cleaned this up.

* cfns.h: Regenerated.

4 years agoRequire powerpc_vsx_ok in gcc.target/powerpc/pr71763.c
Douglas Rupp [Mon, 18 May 2020 18:43:48 +0000 (11:43 -0700)]
Require powerpc_vsx_ok in gcc.target/powerpc/pr71763.c

We're getting an error when running this test on PowerPC VxWorks 7,
due to an unexpected warning:

    | Excess errors:
    | cc1: warning: '-mvsx' and '-mno-altivec' are incompatible

The warning comes from a combination of factors:
  - The test itself uses -mvsx explicitly via the following directive:
       // { dg-options "-O1 -mvsx" }
  - Our toolchain was configured so as to make -mno-altivec
    the default;
  - These two options are mutually exclusive.

This commit adds a powerpc_vsx_ok dg-require-effective-target directive
to that test, and thus making it UNSUPPORTED instead.

Tested on PowerPC VxWorks 7. Also tested on PowerPC ELF as well,
a platform where we do not make -mno-altivec the default, to verify
that the test continues to run as usual in that case.

gcc/testsuite/

        * gcc.target/powerpc/pr71763.c: Require powerpc_vsx_ok.

4 years agobootstrap: Update requirement to C++11.
Jason Merrill [Mon, 18 May 2020 18:28:16 +0000 (14:28 -0400)]
bootstrap: Update requirement to C++11.

There was general agreement last November that we would move to allowing
C++11 features to be used in GCC 11; this patch implements that direction.

ChangeLog
2020-05-18  Jason Merrill  <jason@redhat.com>

* configure.ac: Update bootstrap dialect to -std=c++11.

config/ChangeLog
2020-05-18  Jason Merrill  <jason@redhat.com>

* ax_cxx_compile_stdcxx.m4: Import from autoconf archive with
an adjustment to try the default mode.

gcc/ChangeLog
2020-05-18  Jason Merrill  <jason@redhat.com>

* aclocal.m4: Add ax_cxx_compile_stdcxx.m4.
* configure.ac: Use AX_CXX_COMPILE_STDCXX(11).

4 years agoPR fortran/95053 - division by zero constants
Harald Anlauf [Mon, 18 May 2020 18:27:29 +0000 (20:27 +0200)]
PR fortran/95053 - division by zero constants

Partially revert the fix for PR93499.  Replace by checks for valid
expressions in the declaration of array shape and PDT KIND and LEN
expressions at a later stage.

gcc/fortran/

2020-05-18  Harald Anlauf  <anlauf@gmx.de>

PR fortran/95053
* arith.c (gfc_divide): Revert hunk introduced by patch for
PR93499.
* decl.c (variable_decl): Generate error for array shape not being
an INTEGER constant.
(gfc_get_pdt_instance): Generate error if KIND or LEN expressions
in declaration of a PDT instance do not simplify to INTEGER
constants.

gcc/testsuite/

2020-05-18  Harald Anlauf  <anlauf@gmx.de>

PR fortran/95053
* gfortran.dg/dec_structure_23.f90: Adjust to new error messages.
* gfortran.dg/pr93499.f90: Adjust to new error messages.
* gfortran.dg/pr95053_2.f90: New test.
* gfortran.dg/pr95053_3.f90: New test.

4 years agotree-optimization: Fix use of uninitialized variables warnings [PR94952]
Stefan Schulze Frielinghaus [Tue, 5 May 2020 17:44:19 +0000 (19:44 +0200)]
tree-optimization: Fix use of uninitialized variables warnings [PR94952]

While bootstrapping GCC on S/390 with --enable-checking=release several
warnings about use of uninitialized variables bitpos, bitregion_start, and
bitregion_end of function pass_store_merging::process_store are raised.
According to PR94952 these seem to be false positives which are silenced by
initialising the mentioned variables.

Bootstrapped on S/390.  Ok for master and releases/gcc-10 assuming that
regtest succeeds (still running but I don't see a reason why it
should fail)?

gcc/ChangeLog:

2020-05-18  Stefan Schulze Frielinghaus  <stefansf@linux.ibm.com>

PR tree-optimization/94952
* gimple-ssa-store-merging.c (pass_store_merging::process_store):
Initialize variables bitpos, bitregion_start, and bitregion_end in
order to silence warnings about use of uninitialized variables.

4 years agoc++: Add test for c++/95143
Marek Polacek [Mon, 18 May 2020 17:50:39 +0000 (13:50 -0400)]
c++: Add test for c++/95143

Already fixed by r10-8124-gceae6a13366d9646e172fc943fe8e221b70f0920.

PR c++/95143
* g++.dg/cpp0x/sfinae66.C: New test.

4 years agopr94833, fix vec_first_match_index for nulls
Carl Love [Wed, 29 Apr 2020 15:23:11 +0000 (10:23 -0500)]
pr94833, fix vec_first_match_index for nulls

gcc/ChangeLog

2020-04-30  Carl Love  <cel@us.ibm.com>

PR target/94833
* config/rs6000/vsx.md (define_expand): Fix instruction generation for
first_match_index_<mode>.
* testsuite/gcc.target/powerpc/builtins-8-p9-runnable.c (main): Add
additional test cases with zero vector elements.

4 years agoi386: Avoid reversing a non-trapping comparison to a trapping one [PR95169]
Uros Bizjak [Mon, 18 May 2020 15:52:14 +0000 (17:52 +0200)]
i386: Avoid reversing a non-trapping comparison to a trapping one [PR95169]

gcc/ChangeLog:

PR target/95169
* config/i386/i386-expand.c (ix86_expand_int_movcc):
 Avoid reversing a non-trapping comparison to a trapping one.

testsuite/ChangeLog:

PR target/95169
* gcc.target/i386/pr95169.c: New test.

4 years ago[arm] Don't generate invalid LDRD insns
Alex Coplan [Mon, 18 May 2020 15:29:04 +0000 (16:29 +0100)]
[arm] Don't generate invalid LDRD insns

This fixes a bug in the arm backend where GCC generates invalid LDRD
instructions. The LDRD instruction requires the first transfer register to be
even, but GCC attempts to use odd registers here. For example, with the
following C code:

    struct c {
      double a;
    } __attribute((aligned)) __attribute((packed));
    struct c d;
    struct c f(struct c);
    void e() { f(d); }

The struct d is passed in registers r1 and r2 to the function f, and GCC
attempted to do this with a LDRD instruction when compiling with -march=armv7-a
on a soft float toolchain.

The fix is analogous to the corresponding one for STRD in the same function:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=52057dc4ac5295caebf83147f688d769c93cbc8d

2020-05-18  Alex Coplan  <alex.coplan@arm.com>

gcc/:
* config/arm/arm.c (output_move_double): Fix codegen when loading into
a register pair with an odd base register.

gcc/testsuite/:
* gcc.c-torture/compile/packed-aligned-1.c: New test.
* gcc.c-torture/execute/packed-aligned.c: New test.

4 years agoi386: Improve vector mode and TFmode ABS and NEG patterns
Uros Bizjak [Mon, 18 May 2020 15:25:39 +0000 (17:25 +0200)]
i386: Improve vector mode and TFmode ABS and NEG patterns

gcc/ChangeLog:

2020-05-18  Uroš Bizjak  <ubizjak@gmail.com>

* config/i386/i386-expand.c (ix86_expand_fp_absneg_operator):
Do not emit FLAGS_REG clobber for TFmode.
* config/i386/i386.md (*<code>tf2_1): Rewrite as
define_insn_and_split.  Mark operands 1 and 2 commutative.
(*nabstf2_1): Ditto.
(absneg SSE splitter): Use MODEF mode iterator instead of SSEMODEF.
Do not swap memory operands.  Simplify RTX generation.
(neg abs SSE splitter): Ditto.
* config/i386/sse.md (*<code><mode>2): Mark operands 1 and 2
commutative.  Do not swap operands.  Simplify RTX generation.
(*nabs<mode>2): Ditto.

4 years agofixup BB vectorization constant generation place
Richard Biener [Fri, 15 May 2020 11:13:38 +0000 (13:13 +0200)]
fixup BB vectorization constant generation place

This adjusts the way we compute the stmt insert location for
invariants in BB vectorization context to deal with eventually
sharing invariant SLP nodes for multiple uses.  We can no longer
use a single use stmt location then but there's a simple way out.

2020-05-18  Richard Biener  <rguenther@suse.de>

* tree-vect-slp.c (vect_slp_bb): Start after labels.
(vect_get_constant_vectors): Really place init stmt after scalar defs.
* tree-vect-stmts.c (vect_init_vector_1): Insert before
region begin.

4 years agox86: Update Intel processor detection
H.J. Lu [Mon, 18 May 2020 12:35:27 +0000 (05:35 -0700)]
x86: Update Intel processor detection

Add cpu model numbers for Intel Airmont, Tremont, Comet Lake, Ice Lake
and Tiger Lake processor families.

* config/i386/driver-i386.c (host_detect_local_cpu): Support
Intel Airmont, Tremont, Comet Lake, Ice Lake and Tiger Lake
processor families.

4 years agoMAINTAINERS: Add myself for write after approval.
Alex Coplan [Mon, 18 May 2020 11:21:17 +0000 (12:21 +0100)]
MAINTAINERS: Add myself for write after approval.

2020-05-18  Alex Coplan  <alex.coplan@arm.com>

* MAINTAINERS (Write After Approval): Add myself.

4 years agomiddle-end/95171 - inlining of trapping compare into non-call EH fn
Richard Biener [Mon, 18 May 2020 06:51:23 +0000 (08:51 +0200)]
middle-end/95171 - inlining of trapping compare into non-call EH fn

This fixes always-inlining across -fnon-call-exception boundaries
for conditions which we do not allow to throw.

2020-05-18  Richard Biener  <rguenther@suse.de>

PR middle-end/95171
* tree-inline.c (remap_gimple_stmt): Split out trapping compares
when inlining into a non-call EH function.

* gcc.dg/pr95171.c: New testcase.

4 years agotree-optimization/95172 - avoid mixing conditionalized and ordered SM
Richard Biener [Mon, 18 May 2020 07:17:24 +0000 (09:17 +0200)]
tree-optimization/95172 - avoid mixing conditionalized and ordered SM

The following testcase shows a missed optimization that then leads to
wrong-code when issueing SMed stores on exits.  When we were able to
compute an ordered sequence of stores for an exit we need to emit
that in the correct order and we can emit it disregarding to any
conditional for whether a store actually happened (we know it did).
We can also improve detection as of whether we need conditional
processing at all.  Both parts fix the testcase.

2020-05-18  Richard Biener  <rguenther@suse.de>

PR tree-optimization/95172
* tree-ssa-loop-im.c (execute_sm): Get flag whether we
eventually need the conditional processing.
(execute_sm_exit): When processing an orderd sequence
avoid doing any conditional processing.
(hoist_memory_references): Pass down whether all edges
have ordered processing for a ref to execute_sm.

* gcc.dg/torture/pr95172.c: New testcase.

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

4 years agocoroutines: Avoid a maybe used uninitialized warning. NFC.
Iain Sandoe [Sun, 17 May 2020 11:26:19 +0000 (12:26 +0100)]
coroutines: Avoid a maybe used uninitialized warning. NFC.

This avoids a (bogus) warning that occurs with some bootstrap
compilers.

gcc/cp/ChangeLog:

2020-05-17  Iain Sandoe  <iain@sandoe.co.uk>

* coroutines.cc (morph_fn_to_coro): Initialize the
gro variable.