181518 Commits

Author SHA1 Message Date
GCC Administrator
8e6198d0f8 Daily bump. 2020-11-24 00:16:44 +00:00
Joseph Myers
ed431431e0 c: Allow comparison of pointers to complete and incomplete types for C11 [PR95630]
As noted in bug 95630, C11 removed a restriction in C99 on comparing
pointers to compatible complete and incomplete types (this was one of
the changes in N1439, which was largely a terminological change to
make incomplete types a subset of object types rather than a different
kind of type).  Implement that change by using pedwarn_c99 with
OPT_Wpedantic for this diagnostic.

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

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

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

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

	PR c/95630
	* gcc.dg/c11-compare-incomplete-1.c,
	gcc.dg/c11-compare-incomplete-2.c,
	gcc.dg/c99-compare-incomplete-1.c,
	gcc.dg/c99-compare-incomplete-2.c: New tests.
2020-11-23 23:28:58 +00:00
Martin Jambor
f38a33a274 ipa: special pass-through op for Fortran strides
when Fortran functions pass array descriptors they receive as a
parameter to another function, they actually rebuild it.  Thanks to
work done mainly by Feng, IPA-CP can already handle the cases when
they pass directly the values loaded from the original descriptor.
Unfortunately, perhaps the most important one, stride, is first
checked against zero and is replaced with one in that case:

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

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

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

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

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

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

gcc/testsuite/
2020-06-12  Martin Jambor  <mjambor@suse.cz>
	* gfortran.dg/ipcp-array-2.f90: New test.
2020-11-23 23:52:29 +01:00
Jeff Law
f80565da33 Adjust rtx_costs for h8300
So the primary purpose of this patch is to make it easier to write tests for
removal of useless test/compare insns on the H8.

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

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

into:

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

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

gcc/
	* config/h8300/h8300.c (h8300_rtx_costs): Handle the various
	comparison rtx codes too.
2020-11-23 13:06:11 -07:00
Iain Sandoe
53a9065066 config.sub, config.guess : Import upstream 2020-11-07.
This imports from:

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

ChangeLog:

	* config.guess: Import latest upstream.
	* config.sub: Import latest upstream.
2020-11-23 19:30:01 +00:00
Nathan Sidwell
eae68c434f testsuite: Adjust pruning
Here is the patch to adjust the include-stack pruning messages to also
strip out c++ modules.  The ICE regexp was a little too strict such
that if someone overrides the bug-reporting URL it doesn't trigger.
May as well relax it too.

	gcc/testsuite/
	* lib/prune.exp (prune_gcc_output): Adjust include stack pruning
	for modules.
	(print_ices): Relax regexp.
2020-11-23 10:36:32 -08:00
Jonathan Wakely
1ccee0fbfa libstdc++: Fix variable declared with wrong type
libstdc++-v3/ChangeLog:

	* include/bits/semaphore_base.h
	(__platform_semaphore::_M_try_acquire_until): Fix type of
	variable.
2020-11-23 18:16:44 +00:00
Stephan Bergmann
0986d3bc62 libstdc++: Fix linker errors due to missing 'inline' keywords
libstdc++-v3/ChangeLog:

	* include/bits/atomic_wait.h (__thread_relax, __thread_yield):
	Add 'inline'.
2020-11-23 18:15:06 +00:00
Jonathan Wakely
92b47a321e libstdc++: Add configure checks for semaphores
This moves the checks for POSIX semaphores to configure time. As well as
requiring <semaphore.h> and SEM_VALUE_MAX, we also require the
sem_timedwait function. That was only optional in POSIX 2001 (and is
absent on Darwin).

libstdc++-v3/ChangeLog:

	* acinclude.m4 (GLIBCXX_CHECK_GTHREADS): Check for
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* include/bits/semaphore_base.h (_GLIBCXX_HAVE_POSIX_SEMAPHORE):
	Check autoconf macro instead of defining it here.
2020-11-23 18:12:39 +00:00
Jonathan Wakely
183ae52b22 libstdc++: make atomic waiting depend on gthreads or futexes
libstdc++-v3/ChangeLog:

	* include/bits/atomic_wait.h: Do not define anything unless
	gthreads or futexes are available.
	* include/bits/atomic_timed_wait.h: Likewise.
	* include/bits/semaphore_base.h: Likewise.
	* include/std/semaphore: Likewise.
	* include/bits/atomic_base.h (atomic_flag::wait)
	(atomic_flag::notify_one, atomic_flag::notify_all)
	(__atomic_base<I>::wait, __atomic_base<I>::notify_one)
	(__atomic_base<I>::notify_all, __atomic_base<P*>::wait)
	(__atomic_base<P*>::notify_one, __atomic_base<P*>::notify_all)
	(__atomic_impl::wait, __atomic_impl::notify_one)
	(__atomic_impl::notify_all, __atomic_float::wait)
	(__atomic_float::notify_one, __atomic_float::notify_all)
	(__atomic_ref::wait, __atomic_ref::notify_one)
	(__atomic_ref::notify_all): Only define if gthreads or futexes
	are available.
	* include/std/atomic (atomic::wait, atomic::notify_one)
	(atomic::notify_all): Likewise.
	* include/std/version (__cpp_lib_semaphore): Define
	conditionally.
2020-11-23 18:12:39 +00:00
Ian Lance Taylor
bcbde431aa log/syslog: correct asm name for C function
Patch from Rainer Orth.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/272259
2020-11-23 08:14:20 -08:00
Jonathan Wakely
fd62daea40 libstdc++: Link tests to libatomic as required [PR 97948]
libstdc++-v3/ChangeLog:

	PR libstdc++/97948
	* testsuite/29_atomics/atomic_float/wait_notify.cc: Add options
	for libatomic.
	* testsuite/29_atomics/atomic_integral/wait_notify.cc: Likewise.
	* testsuite/29_atomics/atomic_ref/wait_notify.cc: Likewise.
2020-11-23 16:06:50 +00:00
Jan Hubicka
7ee0681e05 Release ipa-prop's agg.items and make alocation more careful
This saves about 316MB WPAing Firefox

	* ipa-prop.c (build_agg_jump_func_from_list,
	ipa_read_jump_function): Reserve agg.items precisely.
	* ipa-prop.h (ipa_node_params::~ipa_node_params): Release descriptors
	(ipa_edge_args::~ipa_edge_args): Release agg.items.
2020-11-23 16:58:23 +01:00
Jan Hubicka
54af3008b6 Do not leak SSANAMES in lto streamer
* lto-streamer-in.c (input_cfg): Do not init ssa operands.
	(input_function): Do not init tree_ssa and set in_ssa_p.
	(input_ssa_names): Do it here.
	* tree-ssa.c (init_tree_ssa): Add additional SIZE parameter, default
	to 0
	* tree-ssanames.c (init_ssanames): Do not round size up to 50, allocate
	precisely.
	* tree-ssa.h (init_tree_ssa): Update prototype.
2020-11-23 16:53:25 +01:00
Nathan Sidwell
204b61b906 Diagnostic for module importation
This tweaks the 'included from ...' printing to deal with imports in
the 'include' path.  One new thing is that there can now be two
'include' names on a single line.  For example 'in module X, included
at Y'.  This reads better than placing them on different lines.

	gcc/
	* diagnostic.c (diagnostic_report_current_module): Adjust for C++
	module importation.
2020-11-23 07:37:42 -08:00
Nathan Sidwell
ff1c10c1c5 c++: Add empty module.cc
This adds an empty module.cc file, along with make rules to build it.

	gcc/cp/
	* module.cc: New dummy file.
	* Make-lang.in: Add rules to build module.o
2020-11-23 07:37:41 -08:00
Jozef Lawrynowicz
77ee207e17 MSP430: Remove target-specific handling of the "persistent" attribute
The "persistent" attribute is now handled generically, and does not
need specific support in the MSP430 back end.

gcc/ChangeLog:

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

gcc/testsuite/ChangeLog:

	* g++.target/msp430/data-attributes.C: Remove expected warnings for
	"lower" attribute conflicts.
	Adjust expected wording for "persistent" attribute misuse.
	* gcc.target/msp430/data-attributes-2.c: Likewise.
	* gcc.target/msp430/pr78818-auto-warn.c: Likewise.
2020-11-23 14:29:41 +00:00
Richard Biener
692d3b7727 fix hybrid SLP discovery debug stmt issue
This properly skips debug USE_STMTs when looking for non-SLP sinks.

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

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

	* g++.dg/vect/simd-12.cc: New testcase.
2020-11-23 15:07:43 +01:00
Jozef Lawrynowicz
762ca20364 Implement the "persistent" attribute
The "persistent" attribute is used for variables that are initialized
by the program loader, but are not initialized by the runtime startup
code. "persistent" variables are placed in a non-volatile area of
memory, which allows their value to "persist" between processor resets.

gcc/c-family/ChangeLog:

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

gcc/ChangeLog:

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

gcc/testsuite/ChangeLog:

	* gcc.c-torture/execute/noinit-attribute.c: Moved to...
	* c-c++-common/torture/attr-noinit-main.inc: ...here.
	* lib/target-supports.exp (check_effective_target_persistent): New.
	* c-c++-common/torture/attr-noinit-1.c: New test.
	* c-c++-common/torture/attr-noinit-2.c: New test.
	* c-c++-common/torture/attr-noinit-3.c: New test.
	* c-c++-common/torture/attr-noinit-invalid.c: New test.
	* c-c++-common/torture/attr-persistent-1.c: New test.
	* c-c++-common/torture/attr-persistent-2.c: New test.
	* c-c++-common/torture/attr-persistent-3.c: New test.
	* c-c++-common/torture/attr-persistent-invalid.c: New test.
	* c-c++-common/torture/attr-persistent-main.inc: New test.
2020-11-23 12:15:51 +00:00
Jozef Lawrynowicz
fb8309d4ab cp/decl.c: Set DECL_INITIAL before attribute processing
Attribute handlers may want to examine DECL_INITIAL for a decl, to
validate the attribute being applied. For C++, DECL_INITIAL is currently
not set until cp_finish_decl, by which time attribute validation has
already been performed.

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

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

gcc/cp/ChangeLog:

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

gcc/testsuite/ChangeLog:

	* gcc.target/msp430/data-attributes-2.c: Adjust test.
	* g++.target/msp430/data-attributes.C: New test.
	* g++.target/msp430/msp430.exp: New test.
2020-11-23 12:06:15 +00:00
Jozef Lawrynowicz
b510765ded Fix "noinit" attribute being ignored for -O0 and -fdata-sections
Variables with the "noinit" attribute are ignored at -O0 because they
are treated like a regular bss variable and placed in the .bss section.

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

gcc/ChangeLog:

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

gcc/testsuite/ChangeLog:

	* gcc.c-torture/execute/noinit-attribute.c: Don't override
	optimization options set by torture test harness.
	* lib/target-supports.exp (check_effective_target_noinit): Adjust
	comment formatting.
2020-11-23 11:43:39 +00:00
Matthew Malcomson
4a8c54359a Document bootstrap-asan configure option
Document how to configure using asan (bootstrap-asan option to the
--with-build-config configure argument).

gcc/ChangeLog:

	* doc/install.texi: Document bootstrap-asan option.
2020-11-23 11:26:49 +00:00
Christophe Lyon
771a4552b6 testsuite/arm: add missing -mthumb to several tests
Some tests force -mcpu=cortex-mXX but do not add -mthumb, causing
errors if GCC is not configured to default to Thumb code
(--with-mode=thumb):
cc1: error: target CPU does not support ARM mode

This patch adds -mthumb where relevant.

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

	gcc/testsuite/
	* gcc.target/arm/cortex-m55-nodsp-flag-hard.c: Add -mthumb.
	* gcc.target/arm/cortex-m55-nodsp-flag-softfp.c: Likewise.
	* gcc.target/arm/cortex-m55-nodsp-nofp-flag-softfp.c: Likewise.
	* gcc.target/arm/cortex-m55-nofp-flag-hard.c: Likewise.
	* gcc.target/arm/cortex-m55-nofp-flag-softfp.c: Likewise.
	* gcc.target/arm/cortex-m55-nofp-nomve-flag-softfp.c: Likewise.
	* gcc.target/arm/cortex-m55-nomve-flag-hard.c: Likewise.
	* gcc.target/arm/cortex-m55-nomve-flag-softfp.c: Likewise.
	* gcc.target/arm/cortex-m55-nomve.fp-flag-hard.c: Likewise.
	* gcc.target/arm/cortex-m55-nomve.fp-flag-softfp.c: Likewise.
	* gcc.target/arm/mve/intrinsics/pr97327.c: Likewise.
2020-11-23 09:59:23 +00:00
Richard Sandiford
d3585f5d0d c++: Add missing verify_type_context call [PR97904]
When adding the verify_type_context target hook, I'd missed
a site that needs to check an array element type.

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

gcc/testsuite/
	PR c++/97904
	* g++.dg/ext/sve-sizeless-1.C: Add more template tests.
	* g++.dg/ext/sve-sizeless-2.C: Likewise.
2020-11-23 09:06:59 +00:00
GCC Administrator
b1a5e1b2bc Daily bump. 2020-11-23 00:16:22 +00:00
Uros Bizjak
e23f47ec40 i386: Use SWI48DWI mode iterator for abs and maxmin [PR97873]
Generate special double mode sequence also for TImode on 64bit targets.

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

	PR target/97873

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

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

gcc/testsuite/
	* gcc.target/i386/pr97873-2.c: New test.
2020-11-22 22:27:35 +01:00
Austin Law
f16897cb4b H8 cc0 conversion
gcc/
	* config/h8300/addsub.md: Turn existing patterns into
	define_insn_and_split style patterns where the splitter
	adds a clobber of the condition code register.  Drop "cc"
	attribute.  Add _clobber_flags patterns to match output of
	the splitters.
	(add<mod>3_incdec): Remove pattern
	(adds/subs splitter): Only run before reload.
	* config/h8300/bitfield.md: Turn existing patterns into
	define_insn_and_split style patterns where the splitter
	adds a clobber of the condition code register.  Drop "cc"
	attribute.  Add _clobber_flags patterns to match output
	of the splitters.
	(cstoreqi4, cstorehi4, cstoresi4): Comment out
	(*bstzhireg, *cmpstz, *bstz, *bistz, *cmpcondset): Likewise
	(*condbset, *cmpcondbclr, *condbclr): Likewise.
	(*cmpcondbsetreg, *condbsetreg, *cmpcondbclrreg): Likewise.
	(*condbclrreg): Likewise.
	* config/h8300/combiner.md: Turn existing patterns into
	define_insn_and_split style patterns where the splitter
	adds a clobber of the condition code register.  Drop "cc"
	attribute.  Add _clobber_flags patterns to match output of
	the splitters.  Add appropriate CC register clobbers to
	existing splitters.
	(*addsi3_and_r_1): Disable for now.
	(*addsi3_and_not_r_1, bit-test branches): Likewise.
	* config/h8300/divmod.md: Turn existing patterns into
	define_insn_and_split style patterns where the splitter
	adds a clobber of the condition code register.  Drop "cc"
	attribute.  Add _clobber_flags patterns to match output of
	the splitters.
	* config/h8300/extensions.md: Turn existing patterns into
	define_insn_and_split style patterns where the splitter
	adds a clobber of the condition code register.  Drop "cc"
	attribute.  Add _clobber_flags patterns to match output of
	the splitters.
	* config/h8300/genmova.sh: Drop "cc" attribute from patterns.
	* config/h8300/mova.md: Drop "cc" attribute from patterns.
	* config/h8300/h8300-modes.def: Add CCZN and CCZNV modes.
	* config/h8300/h8300-protos.h (output_plussi): Update prototype.
	(compute_plussi_length): Likewise.
	(h8300_select_cc_mode): Add prototype.
	(compute_a_shift_cc): Remove prototype
	(cmpute_logical_op_cc): Likewise.
	* config/h8300/h8300.c (names_big): Add "cc" register.
	(names_extended, names_upper_extended): Likewise.
	(h8300_emit_stack_adjustment): Be more selective about setting
	RTX_FRAME_RELATED_P.
	(h8300_print_operand): Handle CCZN mode
	(h8300_select_cc_mode): New function.
	(notice_update_cc): if-0 out.  Only kept for reference purposes.
	(h8300_expand_store): Likewise.
	(h8300_binary_length): Handle new insn forms.
	(output_plussi): Add argument for NEED_FLAGS and handle that case.
	(compute_plussi_length): Likewise.
	(compute_logical_op_cc): Return integer.
	(TARGET_FLAGS_REGNUM): Define.
	* config/h8300/h8300.h (FIRST_PSEUDO_REGISTER): Bump for cc register.
	(FIXED_REGISTERS, CALL_USED_REGISTERS): Handle cc register.
	(REG_ALLOC_ORDER, REGISTER_NAMES): Likewise.
	(SELECT_CC_MODE): Define.
	* config/h8300/h8300.md: Add CC_REG.
	Do not include peepholes.md for now.
	* config/h8300/jumpcall.md (cbranchqi4): Consolidate into
	cbranch<mode>4.
	(cbranchhi4, cbranchsi4): Likewise.
	(cbranch<mode>4): New expander.
	(branch): New define_insn_and_split for use before reload.
	(branch_1, branch_1_false): New patterns to match splitter output.
	Remove code to manage cc_status.flags.
	* config/h8300/logical.md: Turn existing patterns into
	define_insn_and_split style patterns where the splitter
	adds a clobber of the condition code register.  Drop "cc"
	attribute.  Add _clobber_flags patterns to match output of
	the splitters.  Move various peepholes into this file.
	* config/h8300/movepush.md: Turn existing patterns into
	define_insn_and_split style patterns where the splitter
	adds a clobber of the condition code register.  Drop "cc"
	attribute.  Add _clobber_flags patterns to match output of
	the splitters.
	* config/h8300/multiply.md: Turn existing patterns into
	define_insn_and_split style patterns where the splitter
	adds a clobber of the condition code register.  Drop "cc"
	attribute.  Add _clobber_flags patterns to match output of
	the splitters.
	* config/h8300/other.md: Turn existing patterns into
	define_insn_and_split style patterns where the splitter
	adds a clobber of the condition code register.  Drop "cc"
	attribute.  Add _clobber_flags patterns to match output of
	the splitters.
	* config/h8300/peepholes.md: Remove peepholes that were moved
	elsewhere.
	* config/h8300/predicates.md (simple_memory_operand): New.
	* config/h8300/proepi.md: Drop "cc" attribute setting.
	* config/h8300/shiftrotate.md: Turn existing patterns into
	define_insn_and_split style patterns where the splitter
	adds a clobber of the condition code register.  Drop "cc"
	attribute.  Add _clobber_flags patterns to match output of
	the splitters.
	* config/h8300/testcompare.md: Turn existing patterns into
	define_insn_and_split style patterns where the splitter
	adds a clobber of the condition code register.  Drop "cc"
	attribute.  Add _clobber_flags patterns to match output of
	the splitters.  Disable various patterns for now.
	Move some peepholes that were previously in peepholes.md here.
2020-11-22 12:28:58 -07:00
Iain Buclaw
23045f8b06 d: Fix OutOfMemoryError thrown when appending to an array with a side effect
When appending a character to an array, the result of that concat
assignment was not the new value of the array, similarly, when appending
an array to another array, side effects were evaluated in reverse to the
expected order of evaluation.

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

gcc/d/ChangeLog:

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

gcc/testsuite/ChangeLog:

	PR d/97889
	* gdc.dg/torture/pr97889.d: New test.
2020-11-22 19:39:26 +01:00
Jakub Jelinek
c1fb592f2c widening_mul: pattern recognize further forms of __builtin_add_overflow [PR95853]
The following patch recognizes some further forms of additions with overflow
checks as shown in the testcase, in particular where the unsigned addition is
performed in a wider mode just to catch overflow with a > narrower_utype_max
check.

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

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

	* gcc.dg/pr95853.c: New test.
2020-11-22 19:16:34 +01:00
Jeff Law
fdd2fb1729 Partially revert recent H8 patch for conditional branches
So I'd forgotten an important tidbit on the H8 port.  Specifically
for a branch instruction, the target label must be operand 0 for
the length computations.

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

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

gcc/

	* config/h8300/jumpcall.md (branch_true, branch_false): Revert
	recent change.  Ensure operand[0] is always the target label.
2020-11-22 10:57:20 -07:00
Iain Sandoe
3c52cd517a Darwin : Avoid a C++ ODR violation seen with LTO.
We have a similar code pattern in darwin-c.c to one in c-pragmas
(most likely a cut & paste) with a struct type used locally to the
TU.  With C++ we need to rename the type to avoid an ODR violation.

gcc/ChangeLog:

	* config/darwin-c.c (struct f_align_stack): Rename
	to type from align_stack to f_align_stack.
	(push_field_alignment): Likewise.
	(pop_field_alignment): Likewise.
2020-11-22 12:56:20 +00:00
GCC Administrator
7a97e2fcf7 Daily bump. 2020-11-22 00:16:24 +00:00
Marek Polacek
c51e31a06f c++: Extend -Wrange-loop-construct for binding-to-temp [PR94695]
This patch finishes the second half of -Wrange-loop-construct I promised
to implement: it warns when a loop variable in a range-based for-loop is
initialized with a value of a different type resulting in a copy.  For
instance:

  int arr[10];
  for (const double &x : arr) { ... }

where in every iteration we have to create and destroy a temporary value
of type double, to which we bind the reference.  This could negatively
impact performance.

As per Clang, this doesn't warn when the range returns a copy, hence the
glvalue_p check.

gcc/ChangeLog:

	PR c++/94695
	* doc/invoke.texi: Update the -Wrange-loop-construct description.

gcc/cp/ChangeLog:

	PR c++/94695
	* parser.c (warn_for_range_copy): Warn when the loop variable is
	initialized with a value of a different type resulting in a copy.

gcc/testsuite/ChangeLog:

	PR c++/94695
	* g++.dg/warn/Wrange-loop-construct2.C: New test.
2020-11-21 16:20:16 -05:00
Marek Polacek
6f20c42cc1 c++: Reject identifier label in constexpr [PR97846]
[dcl.constexpr]/3 says that the function-body of a constexpr function
shall not contain an identifier label, but we aren't enforcing that.

This patch implements that.  Of course, we can't reject artificial
labels.

gcc/cp/ChangeLog:

	PR c++/97846
	* constexpr.c (potential_constant_expression_1): Reject
	LABEL_EXPRs that use non-artifical LABEL_DECLs.

gcc/testsuite/ChangeLog:

	PR c++/97846
	* g++.dg/cpp1y/constexpr-label.C: New test.
2020-11-21 16:08:33 -05:00
Marek Polacek
0999f26098 c++: Fix ICE-on-invalid with -Wvexing-parse [PR97881]
This invalid (?) code broke my assumption that if decl_specifiers->type
is null, there must be any type-specifiers.  Turn the assert into an if
to fix this crash.

gcc/cp/ChangeLog:

	PR c++/97881
	* parser.c (warn_about_ambiguous_parse): Only assume "int" if we
	actually saw any type-specifiers.

gcc/testsuite/ChangeLog:

	PR c++/97881
	* g++.dg/warn/Wvexing-parse9.C: New test.
2020-11-21 15:48:15 -05:00
David Edelsohn
1cb50c0a0e testsuite: localclass2 require LTO
The testcase uses LTO but does not include the dg-require LTO.

gcc/testsuite/ChangeLog:

	* g++.dg/debug/localclass2.C: Require LTO.
2020-11-21 15:47:19 -05:00
Marek Polacek
78cd6a63ee c++: Allow template lambdas without lambda-declarator [PR97839]
Our implementation of template lambdas incorrectly requires the optional
lambda-declarator.  This was probably required by an early draft of
generic lambdas, but now the production is [expr.prim.lambda.general]:

 lambda-expression:
    lambda-introducer lambda-declarator [opt] compound-statement
    lambda-introducer < template-parameter-list > requires-clause [opt]
	  lambda-declarator [opt] compound-statement

Therefore, we should accept the following test.

gcc/cp/ChangeLog:

	PR c++/97839
	* parser.c (cp_parser_lambda_declarator_opt): Don't require ().

gcc/testsuite/ChangeLog:

	PR c++/97839
	* g++.dg/cpp2a/lambda-generic8.C: New test.
2020-11-21 15:35:14 -05:00
Jan Hubicka
ddaad23e2f Use OEP_MATCH_SIDE_EFFECTS in compare_ao_refs
* tree-ssa-alias.c (ao_compare::compare_ao_refs,
	ao_compare::hash_ao_ref): Use OEP_MATCH_SIDE_EFFECTS.
2020-11-21 21:34:02 +01:00
Marek Polacek
caf17f3afa c++: Fix wrong error with constexpr destructor [PR97427]
When I implemented the code to detect modifying const objects in
constexpr contexts, we couldn't have constexpr destructors, so I didn't
consider them.  But now we can and that caused a bogus error in this
testcase: [class.dtor]p5 says that "const and volatile semantics are not
applied on an object under destruction.  They stop being in effect when
the destructor for the most derived object starts." so we have to clear
the TREE_READONLY flag we set on the object after the constructors have
been called to mark it as no-longer-under-construction.  In the ~Foo
call it's now an object under destruction, so don't report those errors.

gcc/cp/ChangeLog:

	PR c++/97427
	* constexpr.c (cxx_set_object_constness): New function.
	(cxx_eval_call_expression): Set new_obj for destructors too.
	Call cxx_set_object_constness to set/unset TREE_READONLY of
	the object under construction/destruction.

gcc/testsuite/ChangeLog:

	PR c++/97427
	* g++.dg/cpp2a/constexpr-dtor10.C: New test.
2020-11-21 15:27:25 -05:00
Jonathan Wakely
62d19588b9 libstdc++: Fix atomic waiting for non-linux targets
This fixes some UNRESOLVED tests on (at least) Solaris and Darwin, and
disables some tests that hang forever on Solaris. A proper fix is still
needed.

libstdc++-v3/ChangeLog:

	* include/bits/atomic_base.h (atomic_flag::wait): Use correct
	type for __atomic_wait call.
	* include/bits/atomic_timed_wait.h (__atomic_wait_until): Check
	_GLIBCXX_HAVE_LINUX_FUTEX.
	* include/bits/atomic_wait.h (__atomic_notify): Likewise.
	* include/bits/semaphore_base.h (_GLIBCXX_HAVE_POSIX_SEMAPHORE):
	Only define if SEM_VALUE_MAX or _POSIX_SEM_VALUE_MAX is defined.
	* testsuite/29_atomics/atomic/wait_notify/bool.cc: Disable on
	non-linux targes.
	* testsuite/29_atomics/atomic/wait_notify/generic.cc: Likewise.
	* testsuite/29_atomics/atomic/wait_notify/pointers.cc: Likewise.
	* testsuite/29_atomics/atomic_flag/wait_notify/1.cc: Likewise.
	* testsuite/29_atomics/atomic_float/wait_notify.cc: Likewise.
2020-11-21 17:50:13 +00:00
Jan Hubicka
d4a20f9059 Update vec-35.c and vect-35-big-array.c
We now determine depnedencies across union fields correctly.

	* gcc.dg/vect/vect-35-big-array.c: Excpect 2 loops to be vectorized.
	* gcc.dg/vect/vect-35.c: Excpect 2 loops to be vectorized.
2020-11-21 18:07:49 +01:00
Jan Hubicka
8ee8afa3a5 Improve hasing of anonymous namespace types
* ipa-icf.c (sem_function::equals_wpa): Do not compare ODR type with
	-fno-devirtualize.
	(sem_item_optimizer::update_hash_by_addr_refs): Hash anonymous ODR
	types by TYPE_UID of their main variant.
2020-11-21 17:41:45 +01:00
Aaron Sawdey
c84add5c13 Re-enable vector pair memcpy/memmove expansion
After the MMA opaque mode patch goes in, we can re-enable
use of vector pair in the inline expansion of memcpy/memmove.

gcc/
	* config/rs6000/rs6000.c (rs6000_option_override_internal):
	Enable vector pair memcpy/memmove expansion.
2020-11-21 07:43:25 -06:00
Aaron Sawdey
f8f8909af1 Make MMA builtins use opaque modes
This patch changes powerpc MMA builtins to use the new opaque
mode class and use modes OO (32 bytes) and XO (64 bytes)
instead of POI/PXI. Using the opaque modes prevents
optimization from trying to do anything with vector
pair/quad, which was the problem we were seeing with the
partial integer modes.

gcc/
	* config/rs6000/mma.md (unspec): Add assemble/extract UNSPECs.
	(movoi): Change to movoo.
	(*movpoi): Change to *movoo.
	(movxi): Change to movxo.
	(*movpxi): Change to *movxo.
	(mma_assemble_pair): Change to OO mode.
	(*mma_assemble_pair): New define_insn_and_split.
	(mma_disassemble_pair): New define_expand.
	(*mma_disassemble_pair): New define_insn_and_split.
	(mma_assemble_acc): Change to XO mode.
	(*mma_assemble_acc): Change to XO mode.
	(mma_disassemble_acc): New define_expand.
	(*mma_disassemble_acc): New define_insn_and_split.
	(mma_<acc>): Change to XO mode.
	(mma_<vv>): Change to XO mode.
	(mma_<avv>): Change to XO mode.
	(mma_<pv>): Change to OO mode.
	(mma_<apv>): Change to XO/OO mode.
	(mma_<vvi4i4i8>): Change to XO mode.
	(mma_<avvi4i4i8>): Change to XO mode.
	(mma_<vvi4i4i2>): Change to XO mode.
	(mma_<avvi4i4i2>): Change to XO mode.
	(mma_<vvi4i4>): Change to XO mode.
	(mma_<avvi4i4>): Change to XO mode.
	(mma_<pvi4i2>): Change to XO/OO mode.
	(mma_<apvi4i2>): Change to XO/OO mode.
	(mma_<vvi4i4i4>): Change to XO mode.
	(mma_<avvi4i4i4>): Change to XO mode.
	* config/rs6000/predicates.md (input_operand): Allow opaque.
	(mma_disassemble_output_operand): New predicate.
	* config/rs6000/rs6000-builtin.def:
	Changes to disassemble builtins.
	* config/rs6000/rs6000-call.c (rs6000_return_in_memory):
	Disallow __vector_pair/__vector_quad as return types.
	(rs6000_promote_function_mode): Remove function return type
	check because we can't test it here any more.
	(rs6000_function_arg): Do not allow __vector_pair/__vector_quad
	as as function arguments.
	(rs6000_gimple_fold_mma_builtin):
	Handle mma_disassemble_* builtins.
	(rs6000_init_builtins): Create types for XO/OO modes.
	* config/rs6000/rs6000-modes.def: DElete OI, XI,
	POI, and PXI modes, and create XO and OO modes.
	* config/rs6000/rs6000-string.c (expand_block_move):
	Update to OO mode.
	* config/rs6000/rs6000.c (rs6000_hard_regno_mode_ok_uncached):
	Update for XO/OO modes.
	(rs6000_rtx_costs): Make UNSPEC_MMA_XXSETACCZ cost 0.
	(rs6000_modes_tieable_p): Update for XO/OO modes.
	(rs6000_debug_reg_global): Update for XO/OO modes.
	(rs6000_setup_reg_addr_masks): Update for XO/OO modes.
	(rs6000_init_hard_regno_mode_ok): Update for XO/OO modes.
	(reg_offset_addressing_ok_p): Update for XO/OO modes.
	(rs6000_emit_move): Update for XO/OO modes.
	(rs6000_preferred_reload_class): Update for XO/OO modes.
	(rs6000_split_multireg_move): Update for XO/OO modes.
	(rs6000_mangle_type): Update for opaque types.
	(rs6000_invalid_conversion): Update for XO/OO modes.
	* config/rs6000/rs6000.h (VECTOR_ALIGNMENT_P):
	Update for XO/OO modes.
	* config/rs6000/rs6000.md (RELOAD): Update for XO/OO modes.
gcc/testsuite/
	* gcc.target/powerpc/mma-double-test.c (main): Call abort for failure.
	* gcc.target/powerpc/mma-single-test.c (main): Call abort for failure.
	* gcc.target/powerpc/pr96506.c: Rename to pr96506-1.c.
	* gcc.target/powerpc/pr96506-2.c: New test.
2020-11-21 07:42:03 -06:00
Aaron Sawdey
1e2d8575ac Additional small changes to support opaque modes
After building some larger codes using opaque types and some c++ codes
using opaque types it became clear I needed to go through and look for
places where opaque types and modes needed to be handled. A whole pile
of one-liners.

gcc/
	* typeclass.h: Add opaque_type_class.
	* builtins.c (type_to_class): Identify opaque type class.
	* dwarf2out.c (is_base_type): Handle opaque types.
	(gen_type_die_with_usage): Handle opaque types.
	* expr.c (count_type_elements): Opaque types should
	never have initializers.
	* ipa-devirt.c (odr_types_equivalent_p): No type-specific handling
	for opaque types is needed as it eventually checks the underlying
	mode which is what is important.
	* tree-streamer.c (record_common_node): Handle opaque types.
	* tree.c (type_contains_placeholder_1): Handle opaque types.
	(type_cache_hasher::equal): No additional comparison needed for
	opaque types.
gcc/c-family
	* c-pretty-print.c (c_pretty_printer::simple_type_specifier):
	Treat opaque types like other types.
	(c_pretty_printer::direct_abstract_declarator): Opaque types are
	supported types.
gcc/c
	* c-aux-info.c (gen_type): Support opaque types.
gcc/cp
	* error.c (dump_type): Handle opaque types.
	(dump_type_prefix): Handle opaque types.
	(dump_type_suffix): Handle opaque types.
	(dump_expr): Handle opaque types.
	* pt.c (tsubst): Allow opaque types in templates.
	(unify): Allow opaque types in templates.
	* typeck.c (structural_comptypes): Handle comparison
	of opaque types.
2020-11-21 07:37:06 -06:00
Iain Sandoe
a345413076 Darwin, libgfortran : Do not use environ directly from the library.
On macOS / Darwin, the environ variable can be used directly in the
code of an executable, but cannot be used in the code of a shared
library (i.e. libgfortran.dylib), in this case.

In such cases, the  function _NSGetEnviron should be called to get
the address of 'environ'.

libgfortran/ChangeLog:

	* intrinsics/execute_command_line.c (environ): Use
	_NSGetEnviron to get the environment pointer on Darwin.
2020-11-21 09:06:49 +00:00
Iain Sandoe
93f1186f7d Darwin, libsanitizer : Support libsanitizer for x86_64-darwin20.
The sanitizer is supported for at least x86_64 and Darwin20.

libsanitizer/ChangeLog:

	* configure.tgt: Allow x86_64 Darwin2x.
2020-11-21 08:56:41 +00:00
Ian Lance Taylor
dec42fe4e3 libgo: update to Go 1.15.5 release
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/272146
2020-11-20 17:09:30 -08:00
GCC Administrator
82e5048e70 Daily bump. 2020-11-21 00:16:29 +00:00
Michael Meissner
81a3f3d1b6 Include math.h in nextafter-2.c test.
Since the test is compiled with -fno-builtin, include math.h to allow for
implementations (like the PowerPC) that have multiple versions of long double
that are selectable by switch.  Math.h could possibly switch what function
nextafterl points to.

gcc/testsuite/
2020-11-17  Michael Meissner  <meissner@linux.ibm.com>

	* gcc.dg/nextafter-2.c: Include math.h.
2020-11-20 18:34:24 -05:00