gcc.git
4 years agoFix dump in clone materialization
Feng Xue [Tue, 3 Mar 2020 02:32:40 +0000 (10:32 +0800)]
Fix dump in clone materialization

2020-06-01  Feng Xue  <fxue@os.amperecomputing.com>

gcc/
* cgraphclones.c (materialize_all_clones): Adjust replace map dump.
* ipa-param-manipulation.c (ipa_dump_adjusted_parameters): Do not
dump infomation if there is no adjusted parameter.
* (ipa_param_adjustments::dump): Adjust prefix spaces for dump string.

4 years agoMove array bounds checking into its own file.
Aldy Hernandez [Sun, 17 May 2020 13:03:20 +0000 (15:03 +0200)]
Move array bounds checking into its own file.

gcc/
* Makefile.in (gimple-array-bounds.o): New.
* tree-vrp.c: Move array bounds code...
* gimple-array-bounds.cc: ...here...
* gimple-array-bounds.h: ...and here.

4 years agoMove value_range_equiv code to its own file.
Aldy Hernandez [Sun, 17 May 2020 12:55:51 +0000 (14:55 +0200)]
Move value_range_equiv code to its own file.

gcc/
* Makefile.in (OBJS): Add value-range-equiv.o.
* tree-vrp.c (*value_range_equiv*): Move to...
* value-range-equiv.cc: ...here.
* tree-vrp.h (class value_range_equiv): Move to...
* value-range-equiv.h: ...here.
* vr-values.h: Include value-range-equiv.h.

4 years agoFix missed IPA-CP on by-ref argument directly passed through (PR 93429)
Feng Xue [Fri, 24 Jan 2020 15:09:28 +0000 (23:09 +0800)]
Fix missed IPA-CP on by-ref argument directly passed through (PR 93429)

2020-06-01  Feng Xue  <fxue@os.amperecomputing.com>

gcc/
PR ipa/93429
* ipa-cp.c (propagate_aggs_across_jump_function): Check aggregate
lattice for simple pass-through by-ref argument.

gcc/testsuite/
PR ipa/93429
* gcc.dg/ipa/ipcp-agg-8.c: Change dump string.
* gcc.dg/ipa/ipcp-agg-13.c: New test.

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

4 years agolibstdc++: Remove stray change from previous commit
Gerald Pfeifer [Mon, 1 Jun 2020 00:10:24 +0000 (02:10 +0200)]
libstdc++: Remove stray change from previous commit

There is a stray change (introducing a bogus line at the top) that
came via 2babbb6760c43bcd803a5e168ef5ecb0be8a5121; remove that again.

* doc/xml/manual/policy_data_structures_biblio.xml: Remove
stray change.

4 years agolibstdc++: Switch www.cs.princeton.edu to https
Gerald Pfeifer [Mon, 1 Jun 2020 00:01:55 +0000 (02:01 +0200)]
libstdc++: Switch www.cs.princeton.edu to https

* doc/xml/manual/policy_data_structures_biblio.xml: Switch
www.cs.princeton.edu to https.
* doc/html/manual/policy_data_structures.html: Regenerate.

4 years agoCheck for more missing math decls on vxworks.
Douglas B Rupp [Sun, 31 May 2020 20:25:28 +0000 (13:25 -0700)]
Check for more missing math decls on vxworks.

Use the GLIBCXX_CHECK_MATH_DECL macro to check for the full list of
vxworks math decls.

libstdc++-v3/ChangeLog

* crossconfig.m4 (<*-vxworks>): Check for more math decls.
* configure: Rebuild.

4 years agocoroutines: Avoid functions with unlowered coroutine trees [PR95087].
Iain Sandoe [Sun, 31 May 2020 19:30:10 +0000 (20:30 +0100)]
coroutines: Avoid functions with unlowered coroutine trees [PR95087].

Diagnosing bad uses of 'return' in coroutines is somewhat
tricky, since the user can use the keyword before we know
that the function is a coroutine (where such returns are not
permitted).  At present, we are just doing a check for any
use of 'return' and erroring on that.  However, we can't then
pass the function body on, since it will contain unlowered
coroutine trees.

This avoids the issue by dropping the entire function body
under that circumstance.  We could do better (for 11) but
this is intended to allow back-port of other fixes to 10.

gcc/cp/ChangeLog:

PR c++/95087
* coroutines.cc (morph_fn_to_coro): If we see an
early fatal error, drop the erroneous function body.

gcc/testsuite/ChangeLog:

PR c++/95087
* g++.dg/coroutines/co-return-syntax-08-bad-return.C:
Adjust the testcase to do the compile (rather than an
-fsyntax-only parse).

4 years agocontrib: Add v850e1-elf to config-list.mk
Iain Buclaw [Sun, 31 May 2020 06:29:07 +0000 (08:29 +0200)]
contrib: Add v850e1-elf to config-list.mk

This comment was added in SVN r173410, v850e1-* was added to config.sub
in SVN r174691 (around 2011).  So it should no longer apply.

contrib/ChangeLog:

* config-list.mk (LIST): Add v850e1-elf.

4 years agocontrib: Add or1k-elf, or1k-linux-*, and or1k-rtems to config-list.mk
Iain Buclaw [Sun, 31 May 2020 05:53:27 +0000 (07:53 +0200)]
contrib: Add or1k-elf, or1k-linux-*, and or1k-rtems to config-list.mk

Support for OpenRISC target was added in SVN r265963.

contrib/ChangeLog:

* config-list.mk (LIST): Add or1k-elf, or1k-linux-*, and or1k-rtems.

4 years agocontrib: Remove arm-wrs-vxworks from config-list.mk
Iain Buclaw [Sun, 31 May 2020 05:39:17 +0000 (07:39 +0200)]
contrib: Remove arm-wrs-vxworks from config-list.mk

Support for arm-wrs-vxworks was removed in git r10-4684.

contrib/ChangeLog:

* config-list.mk (LIST): Remove arm-wrs-vxworks.

4 years agocontrib: Remove cris-linux and crisv32-* from config-list.mk
Iain Buclaw [Fri, 29 May 2020 16:12:55 +0000 (18:12 +0200)]
contrib: Remove cris-linux and crisv32-* from config-list.mk

Support for crisv32-*-* and cris-*-linux* was removed in git r11-214.

contrib/ChangeLog:

* config-list.mk (LIST): Remove cris-linux, crisv32-elf, and
crisv32-linux.

4 years agocoroutines: Remove up some unused values.
Iain Sandoe [Sun, 31 May 2020 18:20:43 +0000 (19:20 +0100)]
coroutines: Remove up some unused values.

The build_new_method_call allows us to inspect the
function decl used.  In most cases, this is not used
and we can just set the parm to NULL.

gcc/cp/ChangeLog:

* coroutines.cc (build_co_await): Remove unused
variable.
(finish_co_await_expr): Likewise.
(finish_co_yield_expr): Likewise; revise comment.

4 years agoFix execute/20071219-1.c regression on H8 due to loss of REG_INC notes in peephole2.
Jeff Law [Sun, 31 May 2020 17:16:37 +0000 (11:16 -0600)]
Fix execute/20071219-1.c regression on H8 due to loss of REG_INC notes in peephole2.

gcc/
* lra.c (add_auto_inc_notes): Remove function.
* reload1.c (add_auto_inc_notes): Similarly.  Move into...
* rtlanal.c (add_auto_inc_notes): New function.
* rtl.h (add_auto_inc_notes): Add prototype.
* recog.c (peep2_attempt): Scan and add REG_INC notes to new insns
as needed.

4 years agoCleanup indexable tree streaming.
Jan Hubicka [Sun, 31 May 2020 15:30:55 +0000 (17:30 +0200)]
Cleanup indexable tree streaming.

gcc/

* lto-section-out.c (lto_output_decl_index): Remove.
(lto_output_field_decl_index): Move to lto-streamer-out.c
(lto_output_fn_decl_index): Move to lto-streamer-out.c
(lto_output_namespace_decl_index): Remove.
(lto_output_var_decl_index): Remove.
(lto_output_type_decl_index): Remove.
(lto_output_type_ref_index): Remove.
* lto-streamer-out.c (output_type_ref): Remove.
(lto_get_index): New function.
(lto_output_tree_ref): Remove.
(lto_indexable_tree_ref): New function.
(lto_output_var_decl_index): Move here from lto-section-out.c; simplify.
(lto_output_fn_decl_index): Move here from lto-section-out.c; simplify.
(stream_write_tree_ref): Update.
(lto_output_tree): Update.
* lto-streamer.h (lto_output_decl_index): Remove prototype.
(lto_output_field_decl_index): Remove prototype.
(lto_output_namespace_decl_index): Remove prototype.
(lto_output_type_decl_index): Remove prototype.
(lto_output_type_ref_index): Remove prototype.
(lto_output_var_decl_index): Move.
(lto_output_fn_decl_index): Move

4 years agocontrib: Add pru-elf to config-list.mk
Iain Buclaw [Sun, 31 May 2020 05:42:47 +0000 (07:42 +0200)]
contrib: Add pru-elf to config-list.mk

Support for the TI PRU target was added in SVN r272202.

contrib/ChangeLog:

* config-list.mk (LIST): Add pru-elf.

4 years agoFinalization depends on the expression, not on the component.
Thomas Koenig [Sun, 31 May 2020 08:26:40 +0000 (10:26 +0200)]
Finalization depends on the expression, not on the component.

This patch fixes a 8/9/10/11 regression, where finalized types
were not finalized (and deallocated), which led to memory
leaks.

gcc/fortran/ChangeLog:

2020-05-24  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/94361
* class.c (finalize_component): Use expr->finalized instead of
comp->finalized.
* gfortran.h (gfc_component): Remove finalized member.
(gfc_expr): Add it here instead.

gcc/testsuite/ChangeLog:

2020-05-24  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/94361
* gfortran.dg/finalize_28.f90: Adjusted free counts.
* gfortran.dg/finalize_33.f90: Likewise.
* gfortran.dg/finalize_34.f90: Likewise.
* gfortran.dg/finalize_35.f90: New test.

4 years agoexpr: Fix fallout from optimize store_expr from STRING_CST [PR95052]
Jakub Jelinek [Sun, 31 May 2020 08:45:21 +0000 (10:45 +0200)]
expr: Fix fallout from optimize store_expr from STRING_CST [PR95052]

> Can't hurt, and debugging the assert tripping is likely a hell of a lot easier
> than debugging the resultant incorrect code.   So if it passes, then I'd say go
> for it.

Testing passed, so I've committed it with those asserts (and thankfully I've
added them!) but it apparently broke Linux kernel build on arm.

The problem is that if the STRING_CST is very short, while the full object
has BLKmode, the short string could very well have
QImode/HImode/SImode/DImode and in that case it wouldn't take the path that
copies the string and then clears the remaining space, but different paths
in which it will ICE because of those asserts and without those it would
just emit wrong-code.

The following patch fixes it by enforcing BLKmode for the string MEM, even
if it is short, so that we copy it and memset the rest.

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

PR middle-end/95052
* expr.c (store_expr): For shortedned_string_cst, ensure temp has
BLKmode.

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

4 years agoDisable brabc/brabs patterns as their length computation is horribly broken and leads...
Jeff Law [Sun, 31 May 2020 03:53:28 +0000 (21:53 -0600)]
Disable brabc/brabs patterns as their length computation is horribly broken and leads to incorrect code generation.

* config/h8300/jumpcall.md (brabs, brabc): Disable patterns.

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

4 years agoRISC-V: Optimize si to di zero-extend followed by left shift.
Jim Wilson [Sun, 31 May 2020 00:04:17 +0000 (17:04 -0700)]
RISC-V: Optimize si to di zero-extend followed by left shift.

This is potentially a sequence of 3 shifts, we which optimize to a sequence
of 2 shifts.  This can happen when unsigned int is used for array indexing.

gcc/
* config/riscv/riscv.md (zero_extendsidi2_shifted): New.

gcc/testsuite/
* gcc.target/riscv/zero-extend-5.c: New.

4 years agoAbility to build the GNAT runtime with project files
Arnaud Charlet [Sat, 30 May 2020 18:40:02 +0000 (14:40 -0400)]
Ability to build the GNAT runtime with project files

This change add project files to provide the ability to rebuild the
runtime with gprbuild after setup-rts is called.

gcc/ada/

* Makefile.rtl (ADA_INCLUDE_SRCS): Replace Makefile.adalib by
libada.gpr and associated project files.
(g-debpoo.o): Add missing rule to ensure subprograms are not reordered.
(setup-rts): Add generation of libgnat/libgnarl.lst.
(LIBGNAT_SRCS): Remove thread.c which is part of libgnarl.
* tracebak.c, tb-gcc.c: Merged the two files to simplify dependencies.
* libgnarl/libgnarl.gpr, libgnat/libada.gpr,
libgnat/libgnat.gpr, libgnat/libgnat_common.gpr: New files.
* doc/gnat_ugn/the_gnat_compilation_model.rst: Makefile.adalib
replaced by libada.gpr.
* libgnat/system-mingw.ads: Remove obsolete comment.
* gcc-interface/Makefile.in: Remove dependency on tb-gcc.c.

4 years agoPR fortran/95373 - ICE in build_reference_type, at tree.c:7942
Harald Anlauf [Sat, 30 May 2020 18:59:41 +0000 (20:59 +0200)]
PR fortran/95373 - ICE in build_reference_type, at tree.c:7942

The use of KIND, LEN, RE, and IM inquiry references for applicable intrinsic
types is valid only for suffienctly new Fortran standards.  Add appropriate
checks in the appropriate place.

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

gcc/fortran/
PR fortran/95373
* primary.c (is_inquiry_ref): Move validity check of inquiry
references against selected Fortran standard from here...
(gfc_match_varspec) ...to here.

gcc/testsuite/
PR fortran/95373
* gfortran.dg/pr95373_1.f90: Adjust error messages.
* gfortran.dg/pr95373_2.f90: Adjust error message.

4 years agoPR fortran/95090 - ICE: identifier overflow
Harald Anlauf [Sat, 30 May 2020 18:50:59 +0000 (20:50 +0200)]
PR fortran/95090 - ICE: identifier overflow

Implement buffer overrun check for temporary that holds mangled names.

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

gcc/fortran/
PR fortran/95090
* class.c (get_unique_type_string): Use buffer overrun check.

4 years agocoroutines: Fix unused value found by static analysis.
Iain Sandoe [Sat, 30 May 2020 16:03:40 +0000 (17:03 +0100)]
coroutines: Fix unused value found by static analysis.

This fixes up the zero-initialization of the coro frame pointer
to avoid an unused assigned value, spotted by Martin Liska with
static analysis.

gcc/cp/ChangeLog:

* coroutines.cc (morph_fn_to_coro): Revise initialization
of the frame pointer to avoid an unused value.

4 years agoopenmp: omp_alloc(0, ...) should return NULL.
Jakub Jelinek [Sat, 30 May 2020 12:02:56 +0000 (14:02 +0200)]
openmp: omp_alloc(0, ...) should return NULL.

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

* allocator.c (omp_alloc): For size == 0, return NULL early.

* testsuite/libgomp.c-c++-common/alloc-4.c: New test.

4 years agogcc/config/i386/mingw32.h: Ensure `-lmsvcrt` precede `-lkernel32`
Jonathan Yong [Sat, 30 May 2020 03:53:16 +0000 (03:53 +0000)]
gcc/config/i386/mingw32.h: Ensure `-lmsvcrt` precede `-lkernel32`

This is necessary as libmsvcrt.a is not a pure import library, but
also contains some functions that invoke others in KERNEL32.DLL.

gcc/
* config/i386/mingw32.h (REAL_LIBGCC_SPEC): Insert -lkernel32
after -lmsvcrt. This is necessary as libmsvcrt.a is not a pure
import library, but also contains some functions that invoke
others in KERNEL32.DLL.

Signed-off-by: Liu Hao <lh_mouse@126.com>
Signed-off-by: Jonathan Yong <10walls@gmail.com>
4 years agoc++: satisfaction value of type typedef to bool [PR95386]
Patrick Palka [Sat, 30 May 2020 01:12:21 +0000 (21:12 -0400)]
c++: satisfaction value of type typedef to bool [PR95386]

In the testcase below, the satisfaction value of fn1<int>'s constraint
is INTEGER_CST '1' of type BOOLEAN_TYPE value_type, which is a typedef
to the standard boolean_type_node.  But satisfaction_value expects to
see exactly boolean_true_node or integer_one_node, which this value is
neither, causing us to trip over the assert therein.

This patch changes satisfaction_value to accept INTEGER_CST of any
boolean type.

gcc/cp/ChangeLog:

PR c++/95386
* constraint.cc (satisfaction_value): Accept INTEGER_CST of any
boolean type.

gcc/testsuite/ChangeLog:

PR c++/95386
* g++.dg/concepts/pr95386.C: New test.

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

4 years agors6000: Prefer VSX insns over VMX ones (part 1: perm and mrg)
Segher Boessenkool [Fri, 29 May 2020 21:32:41 +0000 (21:32 +0000)]
rs6000: Prefer VSX insns over VMX ones (part 1: perm and mrg)

There are various VSX insns that do the same job as (older) AltiVec
insns, just with a wider range of possible registers.  Many patterns
for such insns have the "v" alternative before the "wa" alternative,
which makes the output less readable than possible (since vs32 is v0,
and most insns before or after this insn will be VSX as well).

This changes the define_insns for the mrg and perm machine instructions
to prefer the VSX form.  No behaviour change.  Only one testcase needed
a little adjustment as well.

2020-05-29  Segher Boessenkool  <segher@kernel.crashing.org>

* config/rs6000/altivec.md (altivec_vmrghw_direct): Prefer VSX form.
(altivec_vmrglw_direct): Ditto.
(altivec_vperm_<mode>_direct): Ditto.
(altivec_vperm_v8hiv16qi): Ditto.
(*altivec_vperm_<mode>_uns_internal): Ditto.
(*altivec_vpermr_<mode>_internal): Ditto.
(vperm_v8hiv4si): Ditto.
(vperm_v16qiv8hi): Ditto.

gcc/testsuite/
* gcc.target/powerpc/vsx-vector-6.p9.c: Allow xxperm as perm as well.

4 years agoc++: P0848R3 and member function templates [PR95181]
Patrick Palka [Fri, 22 May 2020 14:28:19 +0000 (10:28 -0400)]
c++: P0848R3 and member function templates [PR95181]

When comparing two special member function templates to see if one hides
the other (as per P0848R3), we need to check satisfaction which we can't
do on templates.  So this patch makes add_method skip the eligibility
test on member function templates and just lets them coexist.

gcc/cp/ChangeLog:

PR c++/95181
* class.c (add_method): Let special member function templates
coexist if they are not equivalently constrained, or in a class
template.

gcc/testsuite/ChangeLog:

PR c++/95181
* g++.dg/concepts/pr95181.C: New test.
* g++.dg/concepts/pr95181-2.C: New test.

Co-authored-by: Jason Merrill <jason@redhat.com>
4 years agoc++: Template template parameter in constraint [PR95371]
Jason Merrill [Fri, 29 May 2020 20:55:52 +0000 (16:55 -0400)]
c++: Template template parameter in constraint [PR95371]

any_template_parm_r was assuming that the DECL_TEMPLATE_RESULT of a template
will have a suitable TEMPLATE_INFO from which we can look at the generic
arguments for that template.  But that wasn't true for a template template
parameter; this patch makes it so.

gcc/cp/ChangeLog:

PR c++/95371
* pt.c (process_template_parm): Set DECL_TEMPLATE_INFO
on the DECL_TEMPLATE_RESULT.

gcc/testsuite/ChangeLog:

PR c++/95371
* g++.dg/cpp2a/concepts-ttp1.C: New test.

4 years agoSimplify tree streaming.
Jan Hubicka [Fri, 29 May 2020 20:41:11 +0000 (22:41 +0200)]
Simplify tree streaming.

this patch cleans up tree streaming.  The code is prepared to stream nested
trees, but we only handle flat trees. As a result we have quite heavy function
to stream in/out tree reference which is used many times and shows up in
profile.

This patch adds stream_write_tree_ref/stream_read_tree_ref which is used to
stream references to trees that are required to exist in the cache or be
indexable.

The actual implementation is just a first cut.  I would like to make it more
compact. We used to stream 2 byte tag (as UHWI) + UHWI representing the index.
Now we stream one UHWI that represent type of reference + index for references
to cache, but still two integers for references to global stream.  This is
becaue the abstraction is not very helpful here and I want to clean this up
incrementally.

I would also like to get rid of the ref_p parameters which seems unnecessary for
flat streams.

This reduces around 7% of global stream, 3% when compressed.
More reduction will happen once the format is sanitized a bit.

from
[WPA] read 4597161 unshared trees
[WPA] read 2937414 mergeable SCCs of average size 1.364280
[WPA] 8604617 tree bodies read in total
[WPA] tree SCC table: size 524287, 247507 elements, collision ratio: 0.377468
[WPA] tree SCC max chain length 2 (size 1)
[WPA] Compared 2689907 SCCs, 184 collisions (0.000068)
[WPA] Merged 2689890 SCCs
[WPA] Merged 3722677 tree bodies
[WPA] Merged 632040 types
...
[WPA] Compression: 88124141 input bytes, 234906430 uncompressed bytes (ratio: 2.665631)
[WPA] Size of mmap'd section decls: 88124141 bytes
...
[WPA] Compression: 113758813 input bytes, 316149514 uncompressed bytes (ratio: 2.779121)
[WPA] Size of mmap'd section decls: 88124141 bytes
[WPA] Size of mmap'd section function_body: 14485721 bytes

to

[WPA] read 4597174 unshared trees
[WPA] read 2937413 mergeable SCCs of average size 1.364280
[WPA] 8604629 tree bodies read in total
[WPA] tree SCC table: size 524287, 247509 elements, collision ratio: 0.377458
[WPA] tree SCC max chain length 2 (size 1)
[WPA] Compared 2689904 SCCs, 183 collisions (0.000068)
[WPA] Merged 2689888 SCCs
[WPA] Merged 3722675 tree bodies
[WPA] Merged 632041 types
....
[WPA] Size of mmap'd section decls: 86177293 bytes
[WPA] Compression: 86177293 input bytes, 217625095 uncompressed bytes (ratio: 2.525318)
....
[WPA] Compression: 111682269 input bytes, 297228756 uncompressed bytes (ratio: 2.661378)
[WPA] Size of mmap'd section decls: 86177293 bytes
[WPA] Size of mmap'd section function_body: 14349032 bytes

gcc/ChangeLog:

* lto-streamer-in.c (streamer_read_chain): Move here from
tree-streamer-in.c.
(stream_read_tree_ref): New.
(lto_input_tree_1): Simplify.
* lto-streamer-out.c (stream_write_tree_ref): New.
(lto_write_tree_1): Simplify.
(lto_output_tree_1): Simplify.
(DFS::DFS_write_tree): Simplify.
(streamer_write_chain): Move here from tree-stremaer-out.c.
* lto-streamer.h (lto_output_tree_ref): Update prototype.
(stream_read_tree_ref): Declare
(stream_write_tree_ref): Declare
* tree-streamer-in.c (streamer_read_chain): Update to use
stream_read_tree_ref.
(lto_input_ts_common_tree_pointers): Likewise.
(lto_input_ts_vector_tree_pointers): Likewise.
(lto_input_ts_poly_tree_pointers): Likewise.
(lto_input_ts_complex_tree_pointers): Likewise.
(lto_input_ts_decl_minimal_tree_pointers): Likewise.
(lto_input_ts_decl_common_tree_pointers): Likewise.
(lto_input_ts_decl_with_vis_tree_pointers): Likewise.
(lto_input_ts_field_decl_tree_pointers): Likewise.
(lto_input_ts_function_decl_tree_pointers): Likewise.
(lto_input_ts_type_common_tree_pointers): Likewise.
(lto_input_ts_type_non_common_tree_pointers): Likewise.
(lto_input_ts_list_tree_pointers): Likewise.
(lto_input_ts_vec_tree_pointers): Likewise.
(lto_input_ts_exp_tree_pointers): Likewise.
(lto_input_ts_block_tree_pointers): Likewise.
(lto_input_ts_binfo_tree_pointers): Likewise.
(lto_input_ts_constructor_tree_pointers): Likewise.
(lto_input_ts_omp_clause_tree_pointers): Likewise.
* tree-streamer-out.c (streamer_write_chain): Update to use
stream_write_tree_ref.
(write_ts_common_tree_pointers): Likewise.
(write_ts_vector_tree_pointers): Likewise.
(write_ts_poly_tree_pointers): Likewise.
(write_ts_complex_tree_pointers): Likewise.
(write_ts_decl_minimal_tree_pointers): Likewise.
(write_ts_decl_common_tree_pointers): Likewise.
(write_ts_decl_non_common_tree_pointers): Likewise.
(write_ts_decl_with_vis_tree_pointers): Likewise.
(write_ts_field_decl_tree_pointers): Likewise.
(write_ts_function_decl_tree_pointers): Likewise.
(write_ts_type_common_tree_pointers): Likewise.
(write_ts_type_non_common_tree_pointers): Likewise.
(write_ts_list_tree_pointers): Likewise.
(write_ts_vec_tree_pointers): Likewise.
(write_ts_exp_tree_pointers): Likewise.
(write_ts_block_tree_pointers): Likewise.
(write_ts_binfo_tree_pointers): Likewise.
(write_ts_constructor_tree_pointers): Likewise.
(write_ts_omp_clause_tree_pointers): Likewise.
(streamer_write_tree_body): Likewise.
(streamer_write_integer_cst): Likewise.
* tree-streamer.h (streamer_read_chain):Declare.
(streamer_write_chain):Declare.
(streamer_write_tree_body): Update prototype.
(streamer_write_integer_cst): Update prototype.

4 years agoAvoid nested save_CFLAGS and save_LDFLAGS
H.J. Lu [Fri, 29 May 2020 19:23:33 +0000 (12:23 -0700)]
Avoid nested save_CFLAGS and save_LDFLAGS

Avoid nested save_CFLAGS and save_LDFLAGS by replacing save_CFLAGS and
save_LDFLAGS with cet_save_CFLAGS and cet_save_LDFLAGS in cet.m4.

config/

PR bootstrap/95413
* cet.m4: Replace save_CFLAGS and save_LDFLAGS with
cet_save_CFLAGS and cet_save_LDFLAGS.

gcc/

PR bootstrap/95413
* configure: Regenerated.

libatomic/

PR bootstrap/95413
* configure: Regenerated.

libbacktrace/

PR bootstrap/95413
* configure: Regenerated.

libcc1/

PR bootstrap/95413
* configure: Regenerated.

libcpp/

PR bootstrap/95413
* configure: Regenerated.

libdecnumber/

PR bootstrap/95413
* configure: Regenerated.

libgcc/

PR bootstrap/95413
* configure: Regenerated.

libgfortran/

PR bootstrap/95413
* configure: Regenerated.

libgomp/

PR bootstrap/95413
* configure: Regenerated.

libiberty/

PR bootstrap/95413
* configure: Regenerated.

libitm/

PR bootstrap/95413
* configure: Regenerated.

libobjc/

PR bootstrap/95413
* configure: Regenerated.

libphobos/

PR bootstrap/95413
* configure: Regenerated.

libquadmath/

PR bootstrap/95413
* configure: Regenerated.

libsanitizer/

PR bootstrap/95413
* configure: Regenerated.

libssp/

PR bootstrap/95413
* configure: Regenerated.

libstdc++-v3/

PR bootstrap/95413
* configure: Regenerated.

libvtv/

PR bootstrap/95413
* configure: Regenerated.

lto-plugin/

PR bootstrap/95413
* configure: Regenerated.

zlib/

PR bootstrap/95413
* configure: Regenerated.

4 years agoPR fortran/95090 - ICE: identifier overflow
Harald Anlauf [Fri, 29 May 2020 19:19:31 +0000 (21:19 +0200)]
PR fortran/95090 - ICE: identifier overflow

The initial fix for this PR uncovered several latent issues with further
too small string buffers which showed up only when testing on i686.
Provide sufficiently large temporaries.

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

gcc/fortran/
PR fortran/95090
* class.c (get_unique_type_string): Enlarge temporary for
name-mangling.  Use strncpy to prevent buffer overrun.
(get_unique_hashed_string): Enlarge temporary.
(gfc_hash_value): Enlarge temporary for name-mangling.

4 years agolibgfortran: Export forgotten _gfortran_{,m,s}findloc{0,1}_c10 [PR95390]
Jakub Jelinek [Fri, 29 May 2020 17:01:50 +0000 (19:01 +0200)]
libgfortran: Export forgotten _gfortran_{,m,s}findloc{0,1}_c10 [PR95390]

I have noticed we don't export these 6 symbols and thus the testcase
below fails to link.

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

PR libfortran/95390
* gfortran.dg/findloc_8.f90: New test.

* Makefile.am (i_findloc0_c): Add findloc0_i10.c.
(i_findloc1_c): Add findloc1_i10.c.
* gfortran.map (GFORTRAN_10.2): New symbol version, export
_gfortran_{,m,s}findloc{0,1}_c10 symbols.
* Makefile.in: Regenerated.
* generated/findloc0_c10.c: Generated.
* generated/findloc1_c10.c: Generated.

4 years agoc++: Fix bogus -Wparentheses warning [PR95344]
Marek Polacek [Tue, 26 May 2020 23:59:26 +0000 (19:59 -0400)]
c++: Fix bogus -Wparentheses warning [PR95344]

Since r267272, which added location wrappers, cp_fold loses
TREE_NO_WARNING on a MODIFY_EXPR that finish_parenthesized_expr set, and
that results in a bogus -Wparentheses warning.

I.e., previously we had "b = 1" but now we have "VIEW_CONVERT_EXPR<bool>(b) = 1"
and cp_fold_maybe_rvalue folds away the location wrapper and so we do
2718             x = fold_build2_loc (loc, code, TREE_TYPE (x), op0, op1);
in cp_fold and the flag is lost.

PR c++/95344
* cp-gimplify.c (cp_fold) <case MODIFY_EXPR>: Don't set
TREE_THIS_VOLATILE here.
(cp_fold): Set it here along with TREE_NO_WARNING.

* c-c++-common/Wparentheses-2.c: New test.

4 years agoc++: vptr ubsan and derived class [PR95311].
Jason Merrill [Fri, 29 May 2020 15:59:33 +0000 (11:59 -0400)]
c++: vptr ubsan and derived class [PR95311].

We weren't able to find OBJ_TYPE_REF_OBJECT walking through
OBJ_TYPE_REF_EXPR because we had folded away the ADDR_EXPR.

gcc/cp/ChangeLog:

PR c++/95311
PR c++/95221
* class.c (build_vfn_ref): Don't fold the INDIRECT_REF.

gcc/testsuite/ChangeLog:

PR c++/95311
* g++.dg/ubsan/vptr-16.C: New test.

4 years agocontrib: Remove rs6000-ibm-aix5.3.0 from config-list.mk
Iain Buclaw [Fri, 29 May 2020 15:38:10 +0000 (17:38 +0200)]
contrib: Remove rs6000-ibm-aix5.3.0 from config-list.mk

contrib/ChangeLog:

* config-list.mk (LIST): Remove rs6000-ibm-aix5.3.0.

4 years agoError for missing change description in git_commit.py.
Martin Liska [Fri, 29 May 2020 11:55:35 +0000 (13:55 +0200)]
Error for missing change description in git_commit.py.

contrib/ChangeLog:

* gcc-changelog/git_commit.py: Find empty change descriptions.
* gcc-changelog/test_email.py: New test.
* gcc-changelog/test_patches.txt: New patch that tests that.

4 years agobugzilla-close-candidate.py: Fix sorting of branches.
Martin Liska [Fri, 29 May 2020 14:37:48 +0000 (16:37 +0200)]
bugzilla-close-candidate.py: Fix sorting of branches.

Pushed to master.

maintainer-scripts/ChangeLog:

* bugzilla-close-candidate.py: Fix sorting of branches.

4 years agoFix parsing of SVN commits in PRs.
Martin Liska [Fri, 29 May 2020 14:03:21 +0000 (16:03 +0200)]
Fix parsing of SVN commits in PRs.

Tested and pushed to master.

maintainer-scripts/ChangeLog:

* bugzilla-close-candidate.py: Fix parsing of SVN revisions.
Fix skipping of PRs that contain Can be closed message.

4 years agoc++: lambdas inside constraints [PR92652]
Patrick Palka [Fri, 29 May 2020 13:40:40 +0000 (09:40 -0400)]
c++: lambdas inside constraints [PR92652]

When parsing a constraint-expression, a requires-clause or a
requires-expression, we temporarily increment processing_template_decl
so that we always obtain template trees which we could later reduce via
substitution even when not inside a template.

But incrementing processing_template_decl when we're already inside a
template has the unintended side effect of shifting up the template
parameter levels of a lambda defined inside one of these constructs,
which leads to confusion later during substitution into the lambda.

This patch fixes this issue by incrementing processing_template_decl
during parsing of these constructs only if it is 0.

Passes 'make check-c++', and also tested by building cmcstl2, does this
look OK to commit after a full bootstrap/regtest?

gcc/cp/ChangeLog:

PR c++/92652
PR c++/93698
PR c++/94128
* parser.c (cp_parser_requires_clause_expression): Temporarily
increment processing_template_decl only if it is 0.
(cp_parser_constraint_expression): Likewise.
(cp_parser_requires_expression): Likewise.

gcc/testsuite/ChangeLog:

PR c++/92652
PR c++/93698
PR c++/94128
* g++.dg/cpp2a/concepts-lambda8.C: New test.
* g++.dg/cpp2a/concepts-lambda9.C: New test.
* g++.dg/cpp2a/concepts-lambda10.C: New test.

4 years agoc++: constexpr ctor with RANGE_EXPR index [PR95241]
Patrick Palka [Fri, 29 May 2020 13:44:09 +0000 (09:44 -0400)]
c++: constexpr ctor with RANGE_EXPR index [PR95241]

In the testcase below, the CONSTRUCTOR for 'field' contains a RANGE_EXPR
index:

  {{aggr_init_expr<...>, [1...2]={.off=1}}}

but get_or_insert_ctor_field isn't prepared to handle looking up a
RANGE_EXPR index.

This patch adds limited support to get_or_insert_ctor_field for looking
up a RANGE_EXPR index.  The limited scope of this patch should make it
more suitable for backporting, and more extensive support would be
needed only to handle self-modifying CONSTRUCTORs that contain a
RANGE_EXPR index, but I haven't yet been able to come up with a testcase
that actually creates such a CONSTRUCTOR.

gcc/cp/ChangeLog:

PR c++/95241
* constexpr.c (get_or_insert_ctor_field): Add limited support
for RANGE_EXPR index lookups.

gcc/testsuite/ChangeLog:

PR c++/95241
* g++.dg/cpp0x/constexpr-array25.C: New test.

4 years agoPort bugzilla-close-candidate script to git.
Martin Liska [Fri, 29 May 2020 11:21:41 +0000 (13:21 +0200)]
Port bugzilla-close-candidate script to git.

maintainer-scripts/ChangeLog:

* bugzilla-close-candidate.py: Support both SVN and GIT messages
in PRs. Remove need of usage of the bugzilla API key.

4 years agoamdgcn: Fix VCC early clobber
Andrew Stubbs [Mon, 18 May 2020 13:05:02 +0000 (14:05 +0100)]
amdgcn: Fix VCC early clobber

gcc/ChangeLog:

2020-05-28  Andrew Stubbs  <ams@codesourcery.com>

* config/gcn/gcn-valu.md (add<mode>3_vcc_zext_dup): Add early clobber.
(add<mode>3_vcc_zext_dup_exec): Likewise.
(add<mode>3_vcc_zext_dup2): Likewise.
(add<mode>3_vcc_zext_dup2_exec): Likewise.

4 years agolibstdc++: Review unordered_map insert_or_assign/try_emplace (PR 95079)
François Dumont [Sun, 24 May 2020 10:04:38 +0000 (12:04 +0200)]
libstdc++: Review unordered_map insert_or_assign/try_emplace (PR 95079)

Those methods are making a double lookup in case of insertion, they can
perform only one.

PR libstdc++/95079
* include/bits/hashtable_policy.h (_Insert_base<>::try_emplace): New.
* include/bits/unordered_map.h (unordered_map<>::try_emplace): Adapt.
(unordered_map<>::insert_or_assign): Adapt.

4 years agotree-optimization/95272 - add SLP_TREE_REPRESENTATIVE
Richard Biener [Fri, 29 May 2020 10:00:00 +0000 (12:00 +0200)]
tree-optimization/95272 - add SLP_TREE_REPRESENTATIVE

This adds SLP_TREE_REPRESENTATIVE - a representative stmt-info that
is used by SLP analysis and code generation.  This avoids the need
for the hack in vect_slp_rearrange_stmts which previously avoided
to re-arrange stmts that might not have been isomorphic because
of operand swapping.  It also plays nice with future directions of SLP
and for the forseeable future is easier than replicating more and
more info in the SLP node as long as non-SLP is in-tree.

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

PR tree-optimization/95272
* tree-vectorizer.h (_slp_tree::representative): Add.
(SLP_TREE_REPRESENTATIVE): Likewise.
* tree-vect-loop.c (vectorizable_reduction): Adjust SLP
node gathering.
(vectorizable_live_operation): Use the representative to
attach the reduction info to.
* tree-vect-slp.c (_slp_tree::_slp_tree): Initialize
SLP_TREE_REPRESENTATIVE.
(vect_create_new_slp_node): Likewise.
(slp_copy_subtree): Copy it.
(vect_slp_rearrange_stmts): Re-arrange even COND_EXPR stmts.
(vect_slp_analyze_node_operations_1): Pass the representative
to vect_analyze_stmt.
(vect_schedule_slp_instance): Pass the representative to
vect_transform_stmt.

* gcc.dg/vect/pr95272.c: New testcase.

4 years agotree-optimization/95356 - more vectorizable_shift massaging
Richard Biener [Fri, 29 May 2020 08:46:06 +0000 (10:46 +0200)]
tree-optimization/95356 - more vectorizable_shift massaging

The previous fix clashed with the rewrite to emit SLP invariants
during the SLP walk.  Thus the following adjusts the SLP tree
hacking vectorizable_shift does appropriately.

Still resisting the attempt of a rewrite of vectorizable_shift ...

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

PR tree-optimization/95356
* tree-vect-stmts.c (vectorizable_shift): Do in-place SLP
node hacking during analysis.

4 years agoFix streamer desynchornization caused by streamer debugging patch
Jan Hubicka [Fri, 29 May 2020 10:25:48 +0000 (12:25 +0200)]
Fix streamer desynchornization caused by streamer debugging patch

it turns out I lost one hunk in the patch disabling extra streaming
which causes streamer to go out of sync in the case non-trivial scc
containing the node being streamed appears in local stream (which seems
quite rare since it does not happen during bootstrap).

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

PR lto/95362
* lto-streamer-out.c (lto_output_tree): Disable redundant streaming.

4 years agoRemove references to SVN in libsanitizer.
Martin Liska [Fri, 29 May 2020 09:50:54 +0000 (11:50 +0200)]
Remove references to SVN in libsanitizer.

Simple documentation update based on usage of GIT by both
LLVM and GCC.

libsanitizer/ChangeLog:

* HOWTO_MERGE: Do not mention not existing argument.
* README.gcc: Update LLVM repository location.

4 years agoFix various limitations of git-backport.py.
Martin Liska [Fri, 29 May 2020 09:29:25 +0000 (11:29 +0200)]
Fix various limitations of git-backport.py.

I've just tested the script and I'm going to install the patch
to all active branches.

contrib/ChangeLog:

* git-backport.py: The script did 'git co HEAD~' when
there was no modified ChangeLog file in a successful
git cherry pick.
Run cherry-pick --continue without editor.

4 years agotree-optimization/95403 - guard vect_init_vector_1 against NULL stmt_info
Richard Biener [Fri, 29 May 2020 08:16:38 +0000 (10:16 +0200)]
tree-optimization/95403 - guard vect_init_vector_1 against NULL stmt_info

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

PR tree-optimization/95403
* tree-vect-stmts.c (vect_init_vector_1): Guard against NULL
stmt_vinfo.

* gfortran.dg/vect/pr95403.f: New testcase.

4 years agoopenmp: One omp_resolve_declare_variant followup
Jakub Jelinek [Fri, 29 May 2020 08:48:40 +0000 (10:48 +0200)]
openmp: One omp_resolve_declare_variant followup

As noticed by Arseny, I got the condition when to call the add removal hook
wrong wrong.  Fixed thusly.

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

PR middle-end/95315
* omp-general.c (omp_resolve_declare_variant): Fix up addition of
declare variant cgraph node removal callback.

* gcc.dg/gomp/pr95315-2.c: New test.

4 years agoexpander: Optimize store_expr from STRING_CST [PR95052]
Jakub Jelinek [Fri, 29 May 2020 08:42:50 +0000 (10:42 +0200)]
expander: Optimize store_expr from STRING_CST [PR95052]

In the following testcase, store_expr of e.g. 97 bytes long string literal
into 1MB long array is implemented by copying the 97 bytes from .rodata
section, followed by clearing the remaining bytes.  But, as the STRING_CST
has type char[1024*1024], we actually allocate whole 1MB in .rodata section
for it, even when we only use the first 97 bytes from that.

The following patch tweaks it so that if we are going to initialize only the
small part from it, we don't emit all the zeros that we never use after it.

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

PR middle-end/95052
* expr.c (store_expr): If expr_size is constant and significantly
larger than TREE_STRING_LENGTH, set temp to just the
TREE_STRING_LENGTH portion of the STRING_CST.

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

4 years agotree-optimization/95393 - fold MIN/MAX_EXPR generated by phiopt
Richard Biener [Fri, 29 May 2020 07:25:53 +0000 (09:25 +0200)]
tree-optimization/95393 - fold MIN/MAX_EXPR generated by phiopt

This makes sure to fold generated stmts so they do not survive
until RTL expansion and cause awkward code generation.

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

PR tree-optimization/95393
* tree-ssa-phiopt.c (minmax_replacement): Use gimple_build
to build the min/max expression so we simplify cases like
MAX(0, s) immediately.

* gcc.dg/tree-ssa/phi-opt-21.c: New testcase.
* g++.dg/vect/slp-pr87105.cc: Adjust.

4 years agoaarch64: add support for unpacked EOR, ORR and AND
Joe Ramsay [Fri, 29 May 2020 07:44:37 +0000 (08:44 +0100)]
aarch64: add support for unpacked EOR, ORR and AND

Extended patterns for these instructions to support unpacked vectors.
BIC will have to wait, as there is not currently support for unpacked
NOT.

2020-05-29  Joe Ramsay  <joe.ramsay@arm.com>

gcc/
* config/aarch64/aarch64-sve.md (<LOGICAL:optab><mode>3): Add support
for unpacked EOR, ORR, AND.

gcc/testsuite/
* gcc.target/aarch64/sve/load_const_offset_2.c: Force using packed
vectors.
* gcc.target/aarch64/sve/logical_unpacked_and_1.c: New test.
* gcc.target/aarch64/sve/logical_unpacked_and_2.c: New test.
* gcc.target/aarch64/sve/logical_unpacked_and_3.c: New test.
* gcc.target/aarch64/sve/logical_unpacked_and_4.c: New test.
* gcc.target/aarch64/sve/logical_unpacked_and_5.c: New test.
* gcc.target/aarch64/sve/logical_unpacked_and_6.c: New test.
* gcc.target/aarch64/sve/logical_unpacked_and_7.c: New test.
* gcc.target/aarch64/sve/logical_unpacked_eor_1.c: New test.
* gcc.target/aarch64/sve/logical_unpacked_eor_2.c: New test.
* gcc.target/aarch64/sve/logical_unpacked_eor_3.c: New test.
* gcc.target/aarch64/sve/logical_unpacked_eor_4.c: New test.
* gcc.target/aarch64/sve/logical_unpacked_eor_5.c: New test.
* gcc.target/aarch64/sve/logical_unpacked_eor_6.c: New test.
* gcc.target/aarch64/sve/logical_unpacked_eor_7.c: New test.
* gcc.target/aarch64/sve/logical_unpacked_orr_1.c: New test.
* gcc.target/aarch64/sve/logical_unpacked_orr_2.c: New test.
* gcc.target/aarch64/sve/logical_unpacked_orr_3.c: New test.
* gcc.target/aarch64/sve/logical_unpacked_orr_4.c: New test.
* gcc.target/aarch64/sve/logical_unpacked_orr_5.c: New test.
* gcc.target/aarch64/sve/logical_unpacked_orr_6.c: New test.
* gcc.target/aarch64/sve/logical_unpacked_orr_7.c: New test.
* gcc.target/aarch64/sve/scatter_store_6.c: Force using packed vectors.
* gcc.target/aarch64/sve/scatter_store_7.c: Force using packed vectors.
* gcc.target/aarch64/sve/strided_load_3.c: Force using packed vectors.
* gcc.target/aarch64/sve/strided_store_3.c: Force using packed vectors.
* gcc.target/aarch64/sve/unpack_signed_1.c: Force using packed vectors.

4 years agogit_commit: fix duplicite email address.
Martin Liska [Fri, 29 May 2020 06:59:04 +0000 (08:59 +0200)]
git_commit: fix duplicite email address.

The patch is about to handle situations like seen
in 3ea6977d0f1813d982743a09660eec1760e981ec.

contrib/ChangeLog:

* gcc-changelog/git_commit.py: Properly
handle duplicite authors.
* gcc-changelog/test_email.py: New test.
* gcc-changelog/test_patches.txt: New patch.

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

4 years agoc++: Try to complete decomp types [PR95328]
Jakub Jelinek [Thu, 28 May 2020 21:40:54 +0000 (23:40 +0200)]
c++: Try to complete decomp types [PR95328]

Two years ago Paolo has added the
  else if (processing_template_decl && !COMPLETE_TYPE_P (type))
    pedwarn (...);
lines into cp_finish_decomp.  For type dependent decl we punt much earlier,
but even for types which aren't type dependent COMPLETE_TYPE_P might be
false as this testcase shows, so this patch tries to complete_type first
(the reason for writing it that way is that it is then followed by another
else if and if complete_type returns error_mark_node, we shouldn't report
anything, as a bug should have been reported already.

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

PR c++/95328
* decl.c (cp_finish_decomp): Call complete_type before checking
COMPLETE_TYPE_P.

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

4 years agoPR fortran/95373 - ICE in build_reference_type, at tree.c:7942
Harald Anlauf [Thu, 28 May 2020 20:28:08 +0000 (22:28 +0200)]
PR fortran/95373 - ICE in build_reference_type, at tree.c:7942

The use of KIND, LEN, RE, and IM inquiry references for applicable intrinsic
types is valid only for suffienctly new Fortran standards.  Add appropriate
check.

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

gcc/fortran/
PR fortran/95373
* primary.c (is_inquiry_ref): Check validity of inquiry
references against selected Fortran standard.

gcc/testsuite/
PR fortran/95373
* gfortran.dg/pr95373_1.f90: New test.
* gfortran.dg/pr95373_2.f90: New test.

4 years agoPR fortran/95104 - Segfault on a legal WAIT statement
Harald Anlauf [Thu, 28 May 2020 19:53:17 +0000 (21:53 +0200)]
PR fortran/95104 - Segfault on a legal WAIT statement

The initial commit for this PR uncovered a latent issue with unit locking
in the Fortran run-time library.  Add check for valid unit.

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

libgfortran/
PR libfortran/95104
* io/unit.c (unlock_unit): Guard by check for NULL pointer.

4 years agoc++: Immediately deduce auto member [PR94926].
Jason Merrill [Thu, 28 May 2020 04:35:56 +0000 (00:35 -0400)]
c++: Immediately deduce auto member [PR94926].

In r9-297 I was trying to be more flexible and treat static data members of
class templates more like variable templates, where the type need not be
determined until the variable is instantiated, but I suppose that in a class
the types of all the non-template members need to be determined at the time
of class instantiation.

gcc/cp/ChangeLog:

PR c++/94926
* decl.c (cp_finish_decl): Revert r9-297 change.
(check_static_variable_definition): Likewise.
* constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
* pt.c (instantiate_decl): Return early on type error.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1z/pr86648.C: Expect error.
* g++.dg/cpp1z/static2.C: Expect error.
* g++.dg/cpp0x/nsdmi16.C: New test.

4 years agojit: port libgccjit to Windows
Nicolás Bértolo [Fri, 22 May 2020 20:54:41 +0000 (17:54 -0300)]
jit: port libgccjit to Windows

2020-05-28  Nicolas Bértolo  <nicolasbertolo@gmail.com>

/ChangeLog:
* configure.ac: Don't require --enable-host-shared when building
for Mingw.
* configure: Regenerate.

2020-05-28  Nicolas Bértolo  <nicolasbertolo@gmail.com>

gcc/ChangeLog:
* Makefile.in: don't look for libiberty in the "pic" subdirectory
when building for Mingw. Add dependency on xgcc with the proper
extension.

2020-05-28  Nicolas Bértolo  <nicolasbertolo@gmail.com>

gcc/c/ChangeLog:
* Make-lang.in: Remove extra slash.

2020-05-28  Nicolas Bértolo  <nicolasbertolo@gmail.com>

gcc/jit/ChangeLog:
* Make-lang.in: Remove extra slash. Build libgccjit.dll and its
import library in Windows.
* config-lang.in: Update comment about --enable-host-shared.
* jit-w32.h: New file.
* jit-w32.c: New file.
(print_last_error): New function that prints the error
string corresponding to GetLastError().
(get_TOKEN_USER_current_user): Helper function used for getting
the SID belonging to the current user.
(create_directory_for_current_user): Helper function to create
a directory with permissions such that only the current user can
access it.
(win_mkdtemp): Create a temporary directory using Windows APIs.
* jit-playback.c: Do not chmod files in Windows. Use LoadLibrary,
FreeLibrary and GetProcAddress instead of libdl.
* jit-result.h, jit-result.c: Introduce result::handle_t to
abstract over the types used for dynamic library handles.
* jit-tempdir.c: Do not use mkdtemp() in Windows, use
win_mkdtemp().

4 years agoFinish prior patch
Jeff Law [Thu, 28 May 2020 18:37:08 +0000 (12:37 -0600)]
Finish prior patch

* config/h8300/logical.md (bclrhi_msx): Remove pattern.

4 years agoFix incorrect code generation with bit insns on H8/SX.
Jeff Law [Thu, 28 May 2020 18:28:56 +0000 (12:28 -0600)]
Fix incorrect code generation with bit insns on H8/SX.

* config/h8300/logical.md (HImode H8/SX bit-and splitter): Don't
make a nonzero adjustment to the memory offset.
(b<ior,xor>hi_msx): Turn into a splitter.

4 years agoFix off-by-one error in previous commit
Eric Botcazou [Thu, 28 May 2020 17:29:42 +0000 (19:29 +0200)]
Fix off-by-one error in previous commit

The bitregion_end field points to the next bit after the region.

gcc/ChangeLog
* gimple-ssa-store-merging.c (merged_store_group::can_be_merged_into):
Fix off-by-one error.

4 years agoc++: Fix initlist-array12.C
Marek Polacek [Thu, 28 May 2020 13:54:41 +0000 (09:54 -0400)]
c++: Fix initlist-array12.C

* g++.dg/cpp0x/initlist-array12.C: Fix the definition of
initializer_list for ilp32 target.

4 years agoc++: Fix tmplattr10.C
Marek Polacek [Thu, 28 May 2020 14:13:16 +0000 (10:13 -0400)]
c++: Fix tmplattr10.C

This test uses C++11 features so should only run in c++11.

* g++.dg/ext/tmplattr10.C: Only run in c++11.

4 years agoRevert "Add missing ChangeLog entry for r11-694"
H.J. Lu [Thu, 28 May 2020 14:36:15 +0000 (07:36 -0700)]
Revert "Add missing ChangeLog entry for r11-694"

This reverts commit 7e58fe0e4c2b79a1cf5c93161856e27e1c830162.

4 years agoAdd missing ChangeLog entry for r11-694
H.J. Lu [Thu, 28 May 2020 14:13:46 +0000 (07:13 -0700)]
Add missing ChangeLog entry for r11-694

4 years agogcc.dg/builtin-bswap-10.c: Check "! int128"
H.J. Lu [Thu, 28 May 2020 14:07:13 +0000 (07:07 -0700)]
gcc.dg/builtin-bswap-10.c: Check "! int128"

Check "! int128" instead of ilp32 since ILP32 targets can support int128.

gcc/testsuite/

* gcc.dg/builtin-bswap-10.c: Check "! int128" instead of ilp32

4 years agoFortran : "type is( real(kind(1.)) )" spurious syntax error PR94397
Mark Eggleston [Wed, 1 Apr 2020 08:52:41 +0000 (09:52 +0100)]
Fortran  : "type is( real(kind(1.)) )" spurious syntax error PR94397

Based on a patch in the comments of the PR. That patch fixed this
problem but caused the test cases for PR93484 to fail. It has been
changed to reduce initialisation expressions if the expression is
not EXPR_VARIABLE and not EXPR_CONSTANT.

2020-05-28  Steven G. Kargl  <kargl@gcc.gnu.org>
    Mark Eggleston  <markeggleston@gcc.gnu.org>

gcc/fortran/

PR fortran/94397
* match.c (gfc_match_type_spec): New variable ok initialised
to true. Set ok with the return value of gfc_reduce_init_expr
called only if the expression is not EXPR_CONSTANT and is not
EXPR_VARIABLE. Add !ok to the check for type not being integer
or the rank being greater than zero.

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

gcc/testsuite/

PR fortran/94397
* gfortran.dg/pr94397.F90: New test.

4 years agoaarch64: Fix missed shrink-wrapping opportunity
Richard Sandiford [Thu, 28 May 2020 12:18:13 +0000 (13:18 +0100)]
aarch64: Fix missed shrink-wrapping opportunity

wb_candidate1 and wb_candidate2 exist for two overlapping cases:
when we use an STR or STP with writeback to allocate the frame,
and when we set up a frame chain record (either using writeback
allocation or not).

However, aarch64_layout_frame was leaving these fields with
legitimate register numbers even if we decided to do neither
of those things.  This prevented those registers from being
shrink-wrapped, even though we were otherwise treating them
as normal saves and restores.

The case this patch handles isn't the common case, so it might
not be worth going out of our way to optimise it.  But I think
the patch actually makes the output of aarch64_layout_frame more
consistent.

2020-05-28  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* config/aarch64/aarch64.h (aarch64_frame): Add a comment above
wb_candidate1 and wb_candidate2.
* config/aarch64/aarch64.c (aarch64_layout_frame): Invalidate
wb_candidate1 and wb_candidate2 if we decided not to use them.

gcc/testsuite/
* gcc.target/aarch64/shrink_wrap_1.c: New test.

4 years agoaarch64: Fix segfault in aarch64_expand_epilogue [PR95361]
Richard Sandiford [Thu, 28 May 2020 12:18:12 +0000 (13:18 +0100)]
aarch64: Fix segfault in aarch64_expand_epilogue [PR95361]

The stack frame for the function in the testcase consisted of two
SVE save slots.  Both saves had been shrink-wrapped, but for different
blocks, meaning that the stack allocation and deallocation were
separate from the saves themselves.  Before emitting the deallocation,
we tried to attach a REG_CFA_DEF_CFA note to the preceding instruction,
to redefine the CFA in terms of the stack pointer.  But in this case
there was no preceding instruction.

This in practice only happens for SVE because:

(a) We don't try to shrink-wrap wb_candidate* registers even when
    we've decided to treat them as normal saves and restores.
    I have a fix for that.

(b) Even with (a) fixed, we're (almost?) guaranteed to emit
    a stack tie for frames that are 64k or larger, so we end
    up hanging the REG_CFA_DEF_CFA note on that instead.

We should only need to redefine the CFA if it was previously
defined in terms of the frame pointer.  In other cases the CFA
should already be defined in terms of the stack pointer,
so redefining it is unnecessary but usually harmless.

2020-05-28  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
PR testsuite/95361
* config/aarch64/aarch64.c (aarch64_expand_epilogue): Assert that
we have at least some CFI operations when using a frame pointer.
Only redefine the CFA if we have CFI operations.

gcc/testsuite/
PR testsuite/95361
* gcc.target/aarch64/sve/pr95361.c: New test.

4 years agoremove obsolete code from SLP invariant costing
Richard Biener [Thu, 28 May 2020 10:26:21 +0000 (12:26 +0200)]
remove obsolete code from SLP invariant costing

This removes handling of !SLP_TREE_VECTYPE from invariant costing.
The single caller guards against this case already.

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

* tree-vect-slp.c (vect_prologue_cost_for_slp): Remove
case for !SLP_TREE_VECTYPE.
(vect_slp_analyze_node_operations): Adjust.

4 years agoCode generate externals/invariants during the SLP graph walk
Richard Biener [Wed, 27 May 2020 13:38:20 +0000 (15:38 +0200)]
Code generate externals/invariants during the SLP graph walk

This generates vector defs for externals and invariants during the SLP
walk rather than as part of getting vectorized defs when vectorizing
the users.  This is a requirement to make sharing of external/invariant
nodes be reflected in actual code generation.

This temporarily adds a SLP_TREE_VEC_DEFS vector alongside the
SLP_TREE_VEC_STMTS one.  Eventually the latter can go away.

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

* tree-vectorizer.h (_slp_tree::vec_defs): Add.
(SLP_TREE_VEC_DEFS): Likewise.
* tree-vect-slp.c (_slp_tree::_slp_tree): Adjust.
(_slp_tree::~_slp_tree): Likewise.
(vect_mask_constant_operand_p): Remove unused function.
(vect_get_constant_vectors): Rename to...
(vect_create_constant_vectors): ... this.  Take the
invariant node as argument and code generate it.  Remove
dead code, remove temporary asserts.  Pass a NULL stmt_info
to vect_init_vector.
(vect_get_slp_defs): Simplify.
(vect_schedule_slp_instance): Code-generate externals and
invariants using vect_create_constant_vectors.

4 years agomake vect_finish_stmt_generation work w/o stmt_vec_info
Richard Biener [Mon, 18 May 2020 14:01:08 +0000 (16:01 +0200)]
make vect_finish_stmt_generation work w/o stmt_vec_info

This makes the call chain below vec_init_vector happy with a NULL
stmt_vec_info which is used as "context".

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

* tree-vect-stmts.c (vect_finish_stmt_generation_1):
Conditionalize stmt_info use, assert the new stmt cannot throw
when not specified.
(vect_finish_stmt_generation): Adjust assert.

4 years agotree-optimization/95273 - more vectorizable_shift massaging
Richard Biener [Thu, 28 May 2020 08:27:48 +0000 (10:27 +0200)]
tree-optimization/95273 - more vectorizable_shift massaging

Covering all bases in vectorizable_shift is hard - this makes sure
to appropriately handle the case of PR95356 without breaking others.

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

PR tree-optimization/95273
PR tree-optimization/95356
* tree-vect-stmts.c (vectorizable_shift): Adjust when and to
what we set the vector type of the shift operand SLP node
again.

* gcc.target/i386/pr95356.c: New testcase.

4 years agoarm: Fix unwanted fall-throughs in arm.c
Andrea Corallo [Wed, 27 May 2020 16:43:48 +0000 (17:43 +0100)]
arm: Fix unwanted fall-throughs in arm.c

gcc/ChangeLog

2020-05-28  Andrea Corallo  <andrea.corallo@arm.com>

* config/arm/arm.c (mve_vector_mem_operand): Fix unwanted
fall-throughs.

4 years agogcc-changelog: enhance handling of renamings
Pierre-Marie de Rodat [Wed, 27 May 2020 13:25:18 +0000 (15:25 +0200)]
gcc-changelog: enhance handling of renamings

So far, we expect from a commit that renames a file to contain a
changelog entry only for the new name. For example, after the following
commit:

   $ git move foo bar
   $ git commit

We expect the following changelog:

   * bar: Renamed from foo.

Git does not keep track of renamings, only file deletions and additions.
The display of patches then uses heuristics (with config-dependent
parameters) to try to match deleted and added files in the same commit.
It is thus brittle to rely on this information.

This commit modifies changelog processing so that renames are considered
as a deletion of a file plus an addition of another file. The following
changelog is now expected for the above example:

   * foo: Move...
   * bar: Here.

contrib/

* gcc-changelog/git_email.py (GitEmail.__init__): Interpret file
renamings as a file deletion plus a file addition.
* gcc-changelog/git_repository.py (parse_git_revisions):
Likewise.
* gcc-changelog/test_email.py: New testcase.
* gcc-changelog/test_patches.txt: New testcase.

4 years agoAdd documentation for missing params.
Martin Liska [Thu, 28 May 2020 08:49:49 +0000 (10:49 +0200)]
Add documentation for missing params.

The patch fixes various issues spotted by check-params-in-docs.py
script. I'm going to install the patch.

gcc/ChangeLog:

PR web/95380
* doc/invoke.texi: Add missing params, remove max-once-peeled-insns and
rename ipcp-unit-growth to ipa-cp-unit-growth.

4 years agoFix check-params-in-docs.py for --help=param.
Martin Liska [Thu, 28 May 2020 08:36:48 +0000 (10:36 +0200)]
Fix check-params-in-docs.py for --help=param.

contrib/ChangeLog:

* check-params-in-docs.py: Update to new format
of help.  Apply flake8 corrections.

4 years agomklog: support renaming of files
Martin Liska [Wed, 27 May 2020 18:03:50 +0000 (20:03 +0200)]
mklog: support renaming of files

contrib/ChangeLog:

* mklog.py: Support renaming of files.
One needs unidiff 0.6.0+.
* test_mklog.py: Test it.

4 years agoFix nonconforming memory_operand for vpmovq{d,w,b}/vpmovd{w,b}/vpmovwb.
liuhongt [Mon, 25 May 2020 08:10:06 +0000 (16:10 +0800)]
Fix nonconforming memory_operand for vpmovq{d,w,b}/vpmovd{w,b}/vpmovwb.

According to Intel SDM, VPMOVQB xmm1/m16 {k1}{z}, xmm2 has 16-bit
memory_operand instead of 128-bit one which existed in current
implementation. Also for other vpmov instructions which have
memory_operand narrower than 128bits.

2020-05-25  Hongtao Liu  <hongtao.liu@intel.com>

gcc/ChangeLog

* config/i386/sse.md (*avx512vl_<code>v2div2qi2_store_1): Rename
from *avx512vl_<code>v2div2qi_store and refine memory size of
the pattern.
(*avx512vl_<code>v2div2qi2_mask_store_1): Ditto.
(*avx512vl_<code><mode>v4qi2_store_1): Ditto.
(*avx512vl_<code><mode>v4qi2_mask_store_1): Ditto.
(*avx512vl_<code><mode>v8qi2_store_1): Ditto.
(*avx512vl_<code><mode>v8qi2_mask_store_1): Ditto.
(*avx512vl_<code><mode>v4hi2_store_1): Ditto.
(*avx512vl_<code><mode>v4hi2_mask_store_1): Ditto.
(*avx512vl_<code>v2div2hi2_store_1): Ditto.
(*avx512vl_<code>v2div2hi2_mask_store_1): Ditto.
(*avx512vl_<code>v2div2si2_store_1): Ditto.
(*avx512vl_<code>v2div2si2_mask_store_1): Ditto.
(*avx512f_<code>v8div16qi2_store_1): Ditto.
(*avx512f_<code>v8div16qi2_mask_store_1): Ditto.
(*avx512vl_<code>v2div2qi2_store_2): New define_insn_and_split.
(*avx512vl_<code>v2div2qi2_mask_store_2): Ditto.
(*avx512vl_<code><mode>v4qi2_store_2): Ditto.
(*avx512vl_<code><mode>v4qi2_mask_store_2): Ditto.
(*avx512vl_<code><mode>v8qi2_store_2): Ditto.
(*avx512vl_<code><mode>v8qi2_mask_store_2): Ditto.
(*avx512vl_<code><mode>v4hi2_store_2): Ditto.
(*avx512vl_<code><mode>v4hi2_mask_store_2): Ditto.
(*avx512vl_<code>v2div2hi2_store_2): Ditto.
(*avx512vl_<code>v2div2hi2_mask_store_2): Ditto.
(*avx512vl_<code>v2div2si2_store_2): Ditto.
(*avx512vl_<code>v2div2si2_mask_store_2): Ditto.
(*avx512f_<code>v8div16qi2_store_2): Ditto.
(*avx512f_<code>v8div16qi2_mask_store_2): Ditto.
* config/i386/i386-builtin-types.def: Adjust builtin type.
* config/i386/i386-expand.c: Ditto.
* config/i386/i386-builtin.def: Adjust builtin.
* config/i386/avx512fintrin.h: Ditto.
* config/i386/avx512vlbwintrin.h: Ditto.
* config/i386/avx512vlintrin.h: Ditto.

4 years agotestsuite/95363 - fix gcc.dg/vect/bb-slp-pr95271.c for ilp32
Richard Biener [Thu, 28 May 2020 07:44:32 +0000 (09:44 +0200)]
testsuite/95363 - fix gcc.dg/vect/bb-slp-pr95271.c for ilp32

This fixes the testcase to avoid out of bound shifts on ilp32 targets.

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

PR testsuite/95363
* gcc.dg/vect/bb-slp-pr95271.c: Fix on ilp32 targets.

4 years agogcov-tool: Flexible endian adjustment for merging coverage data
Martin Liska [Thu, 28 May 2020 06:16:58 +0000 (08:16 +0200)]
gcov-tool: Flexible endian adjustment for merging coverage data

gcc/ChangeLog:
2020-05-27  Dong JianQiang  <dongjianqiang2@huawei.com>

PR gcov-profile/95332
* gcov-io.c (gcov_var::endian): Move field.
(from_file): Add IN_GCOV_TOOL check.
* gcov-io.h (gcov_magic): Ditto.

libgcc/ChangeLog:
2020-05-27  Dong JianQiang  <dongjianqiang2@huawei.com>

PR gcov-profile/95332
* libgcov-util.c (read_gcda_file): Call gcov_magic.
* libgcov.h (gcov_magic): Disable GCC poison.

4 years agoDaily bump.
GCC Administrator [Thu, 28 May 2020 04:23:50 +0000 (04:23 +0000)]
Daily bump.

4 years agooutputs.exp: no lto, linker default output, cdtor temps, empty args
Alexandre Oliva [Thu, 28 May 2020 02:16:52 +0000 (23:16 -0300)]
outputs.exp: no lto, linker default output, cdtor temps, empty args

This patch fixes various issues in the testsuite that came up after
the dump/aux output revamp, namely:

- many outputs.exp tests used -flto without checking that LTO was
supported, getting lots of failures.  With this patch, we test for LTO
support, and skip -flto tests on platforms that do not support it.

- some linkers error out if an output file is not named, and the
a.{out,exe} construct that we used throughout outputs.exp to match the
default linker output would trigger a bug in tcl globbing.  With this
patch, we detect the default linker output early.  If none is found,
we arrange to pass -o a.out explicitly in tests that used to test the
default linker output.  We now look for the detected default, or for
explicitly-specified output.

- collect2 will leave <execname>.cdtor.* files behind in -save-temps
tests.  Ignore them.

- The prepending of -Wl, to file names in ldflags et al was done in a
way that introduced empty arguments when consecutive blanks appeared
in these board configuration knobs.  Skip the empty strings between
consecutive blanks to avoid this problem.

gcc/testsuite/ChangeLog:

* lib/gcc-defs.exp: Avoid introducing empty arguments between
consecutive blanks in board linking options.
* gcc.misc-tests/outputs.exp: Likewise.  Document
-gsplit-dwarf testing, skip LTO tests if -flto is not
supported, detect the default linker output name, cope with
the need for an explicit executable output.

4 years agogcc: xtensa: delegitimize UNSPEC_PLT
Max Filippov [Mon, 25 May 2020 02:41:13 +0000 (19:41 -0700)]
gcc: xtensa: delegitimize UNSPEC_PLT

This fixes 'non-delegitimized UNSPEC 3 found in variable location' notes
issued when building libraries which interferes with running tests.

2020-05-27  Max Filippov  <jcmvbkbc@gmail.com>
gcc/
* config/xtensa/xtensa.c (xtensa_delegitimize_address): New
function.
(TARGET_DELEGITIMIZE_ADDRESS): New macro.

4 years agoAdd support for __builtin_bswap128
Eric Botcazou [Wed, 27 May 2020 22:31:15 +0000 (00:31 +0200)]
Add support for __builtin_bswap128

This patch introduces a new builtin named __builtin_bswap128 on targets
where TImode is supported, i.e. 64-bit targets only in practice.  The
implementation simply reuses the existing double word path in optab, so
no routine is added to libgcc (which means that you get two calls to
_bswapdi2 in the worst case).

gcc/ChangeLog:

* builtin-types.def (BT_UINT128): New primitive type.
(BT_FN_UINT128_UINT128): New function type.
* builtins.def (BUILT_IN_BSWAP128): New GCC builtin.
* doc/extend.texi (__builtin_bswap128): Document it.
* builtins.c (expand_builtin): Deal with BUILT_IN_BSWAP128.
(is_inexpensive_builtin): Likewise.
* fold-const-call.c (fold_const_call_ss): Likewise.
* fold-const.c (tree_call_nonnegative_warnv_p): Likewise.
* tree-ssa-ccp.c (evaluate_stmt): Likewise.
* tree-vect-stmts.c (vect_get_data_ptr_increment): Likewise.
(vectorizable_call): Likewise.
* optabs.c (expand_unop): Always use the double word path for it.
* tree-core.h (enum tree_index): Add TI_UINT128_TYPE.
* tree.h (uint128_type_node): New global type.
* tree.c (build_common_tree_nodes): Build it if TImode is supported.

gcc/testsuite/ChangeLog:

* gcc.dg/builtin-bswap-10.c: New test.
* gcc.dg/builtin-bswap-11.c: Likewise.
* gcc.dg/builtin-bswap-12.c: Likewise.
* gcc.target/i386/builtin-bswap-5.c: Likewise.

4 years agolibstdc++: Fix atomic<FP>::load (PR 95282)
Jonathan Wakely [Wed, 27 May 2020 21:55:21 +0000 (22:55 +0100)]
libstdc++: Fix atomic<FP>::load (PR 95282)

PR libstdc++/95282
* include/bits/atomic_base.h (__atomic_impl::load): Add
cv-qualifiers to parameter so that _Tp is deduced as the
unqualified type.
* testsuite/29_atomics/atomic_float/95282.cc: New test.

4 years agolibstdc++: Fix view adaptors for mixed-const sentinels and iterators (PR 95322)
Jonathan Wakely [Wed, 27 May 2020 21:08:15 +0000 (22:08 +0100)]
libstdc++: Fix view adaptors for mixed-const sentinels and iterators (PR 95322)

The bug report is that transform_view's sentinel<false> cannot be
compared to its iterator<true>.  The comparison is supposed to use
operator==(iterator<Const>, sentinel<Const>) after converting
sentinel<false> to sentinel<true>. However, the operator== is a hidden
friend so is not a candidate when comparing iterator<true> with
sentinel<false>. The required conversion would only happen if we'd found
the operator, but we can't find the operator until after the conversion
happens.

A new LWG issue has been reported, but not yet assigned a number.  The
solution suggested by Casey Carter is to make the hidden friends of the
sentinel types work with iterators of any const-ness, so that no
conversions are required.

Patrick Palka observed that join_view has a similar problem and a
similar fix is used for its sentinel.

PR libstdc++/95322
* include/std/ranges (transform_view::_Sentinel): Allow hidden
friends to work with _Iterator<true> and _Iterator<false>.
(join_view::_Sentinel): Likewise.
* testsuite/std/ranges/adaptors/95322.cc: New test.

4 years agolibstdc++: Fix std::reverse_iterator comparisons (PR 94354)
Jonathan Wakely [Wed, 27 May 2020 20:58:56 +0000 (21:58 +0100)]
libstdc++: Fix std::reverse_iterator comparisons (PR 94354)

The std::reverse_iterator comparisons have always been implemented only
in terms of equality and less than. In C++98 that made no difference for
reasonable code, because when the underlying operators are the same type
they are required to support all comparisons anyway.

But since LWG 280 it's possible to compare reverse_iterator<X> and
reverse_iterator<Y>, and comparisons between X and Y might not support
the full set of equality and relational operators. This means that it
matters whether we implement operator!= as x.base() != y.base() or
!(x.base() == y.base()), and the current implementation is
non-conforming.

This was already fixed in GCC 10.1 for C++20, this change also fixes it
for all other -std modes.

PR libstdc++/94354
* include/bits/stl_iterator.h (reverse_iterator): Fix comparison
operators to use the correct operations on the underlying
iterators.
* testsuite/24_iterators/reverse_iterator/rel_ops.cc: New test.

4 years agoi386: Fix V2SF horizontal add/subtract insns
Uros Bizjak [Wed, 27 May 2020 19:46:49 +0000 (21:46 +0200)]
i386: Fix V2SF horizontal add/subtract insns

PFPNACC insn is incorrectly modelled to perform addition and subtraction
of two operands, but in reality it performs horizontal addition and
subtraction:

Instruction: PFPNACC dest,src

Description:
dest[31:0] <- dest[31:0] - dest[63:32];
dest[63:32] <- src[31:0] + src[63:32];

Also, it is not possible to directly replace PFACC with HADDPS and PFNACC
with HSUBPS, because operands in the second word do not match.

PFACC does:

dest[31..0] <- dest[31..0] + dest[63..32];
dest[63..32] <- src[31..0] + src [63..32];

while HADDPS does:

dest[31..0] <-  dest[31..0]  +  dest[63..32];
dest[63..32] <- dest[127..96] + dest[95..64];
dest[95..64] <- src [31..0]  +  src [64..32];
dest[127:96] <- src [127..96] + src [95..64];

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

gcc/ChangeLog:
* config/i386/mmx.md (*mmx_haddv2sf3): Remove SSE alternatives.
(mmx_hsubv2sf3): Ditto.
(mmx_haddsubv2sf3): New expander.
(*mmx_haddsubv2sf3): Rename from mmx_addsubv2sf3. Correct
RTL template to model horizontal subtraction and addition.
* config/i386/i386-builtin.def (IX86_BUILTIN_PFPNACC):
Update for rename.

4 years agoPR fortran/95090 - ICE: identifier overflow
Harald Anlauf [Wed, 27 May 2020 19:20:24 +0000 (21:20 +0200)]
PR fortran/95090 - ICE: identifier overflow

For long module name, derive type and component name, the generated
name-mangled symbol did not fit into a buffer when coarrays were
enabled.  Provide sufficiently large temporary.

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

gcc/fortran/
PR fortran/95090
* iresolve.c (gfc_get_string): Enlarge temporary for
name-mangling.

gcc/testsuite/
PR fortran/95090
* gfortran.dg/pr95090.f90: New test.

4 years agoi386: Remove %q modifier from two pmov insn templates [PR95355]
Uros Bizjak [Wed, 27 May 2020 19:02:51 +0000 (21:02 +0200)]
i386: Remove %q modifier from two pmov insn templates [PR95355]

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

gcc/ChangeLog:
PR target/95355
* config/i386/sse.md
(<mask_codefor>avx512f_<code>v16qiv16si2<mask_name>):
Remove %q operand modifier from insn template.
(avx512f_<code>v8hiv8di2<mask_name>): Ditto.

gcc/testsuite/ChangeLog:
PR target/95355
* gcc.target/i386/pr95355.c: New test.

4 years agojit: use deep unsharing of trees [PR 95314]
David Malcolm [Wed, 27 May 2020 13:44:07 +0000 (09:44 -0400)]
jit: use deep unsharing of trees [PR 95314]

PR jit/95314 reports a internal error inside verify_gimple, which
turned out to be due to reusing the result of
gcc_jit_lvalue_get_address in several functions, leading to tree nodes
shared between multiple function bodies.

This patch fixes the issue by adopting the "Deep unsharing" strategy
described in the comment in gimplify.c preceding mostly_copy_tree_r:
to mark all of the jit "frontend"'s expression tree nodes with
TREE_VISITED, and to set LANG_HOOKS_DEEP_UNSHARING, so that "they are
unshared on the first reference within functions when the regular
unsharing algorithm runs".

gcc/jit/ChangeLog:
PR jit/95314
* dummy-frontend.c (LANG_HOOKS_DEEP_UNSHARING): Define to be true.
* jit-playback.h (gcc::jit::playback::rvalue): Mark tree node with
TREE_VISITED.

gcc/testsuite/ChangeLog:
PR jit/95314
* jit.dg/all-non-failing-tests.h: Add test-pr95314-rvalue-reuse.c.
* jit.dg/test-pr95314-rvalue-reuse.c: New test.

4 years agojit: fix libgccjit.info entry [PR 91330]
David Malcolm [Wed, 27 May 2020 08:04:58 +0000 (04:04 -0400)]
jit: fix libgccjit.info entry [PR 91330]

2020-05-27  Tom Tromey  <tromey@gcc.gnu.org>

gcc/jit/ChangeLog:
PR jit/91330
* docs/conf.py (texinfo_documents): Set description.
* docs/_build/texinfo/libgccjit.texi: Regenerate.