Commit Graph

190239 Commits

Author SHA1 Message Date
GCC Administrator
1f6b0003b6 Daily bump. 2021-12-08 00:16:23 +00:00
Harald Anlauf
9eec77c0df Fortran: perform array subscript checks only for valid INTEGER bounds
gcc/fortran/ChangeLog:

	PR fortran/103607
	* frontend-passes.c (do_subscript): Ensure that array bounds are
	of type INTEGER before performing checks on array subscripts.

gcc/testsuite/ChangeLog:

	PR fortran/103607
	* gfortran.dg/pr103607.f90: New test.
2021-12-07 23:16:18 +01:00
Marek Polacek
cf2cd61dce c++: Fix decltype-bitfield1.C on i?86
This test was failing on i?86 because of:

warning: width of 'A::l' exceeds its type

so change the type to 'long long' and make the test run only on arches
where sizeof(long long) == 8 to avoid failing like this again.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/decltype-bitfield1.C: Change a type to unsigned
	long long.  Only run on longlong64 targets.
2021-12-07 16:08:20 -05:00
Peter Bergner
4394fd6726 testsuite: Fix check_effective_target_rop_ok [PR103556, PR103586]
The new rop_ok effective target test doesn't correctly compute its expression
result because a new line starts a new statement.  Solution is to remove
the new line.

2021-12-07  Peter Bergner  <bergner@linux.ibm.com>

gcc/testsuite/
	PR testsuite/103556
	PR testsuite/103586
	* lib/target-supports.exp (check_effective_target_rop_ok): Remove '\n'.
2021-12-07 14:43:30 -06:00
Harald Anlauf
652c287362 Fortran: catch failed simplification of bad stride expression
gcc/fortran/ChangeLog:

	PR fortran/103588
	* array.c (gfc_ref_dimen_size): Do not generate internal error on
	failed simplification of stride expression; just return failure.

gcc/testsuite/ChangeLog:

	PR fortran/103588
	* gfortran.dg/pr103588.f90: New test.
2021-12-07 18:46:52 +01:00
Harald Anlauf
f47662204d Fortran: add check for type of upper bound in case range
gcc/fortran/ChangeLog:

	PR fortran/103591
	* match.c (match_case_selector): Check type of upper bound in case
	range.

gcc/testsuite/ChangeLog:

	PR fortran/103591
	* gfortran.dg/select_9.f90: New test.
2021-12-07 18:23:25 +01:00
Martin Liska
8e836af61b Fix --help -Q output
PR middle-end/103438

gcc/ChangeLog:

	* config/s390/s390.c (s390_valid_target_attribute_inner_p):
	Use new enum CLVC_INTEGER.
	* opt-functions.awk: Use new CLVC_INTEGER.
	* opts-common.c (set_option): Likewise.
	(option_enabled): Return -1,0,1 for CLVC_INTEGER.
	(get_option_state): Use new CLVC_INTEGER.
	(control_warning_option): Likewise.
	* opts.h (enum cl_var_type): Likewise.
2021-12-07 14:37:02 +01:00
Marek Polacek
3a2257e6b3 c++: Fix for decltype and bit-fields [PR95009]
Here, decltype deduces the wrong type for certain expressions involving
bit-fields.  Unlike in C, in C++ bit-field width is explicitly not part
of the type, so I think decltype should never deduce to 'int:N'.  The
problem isn't that we're not calling unlowered_expr_type--we are--it's
that is_bitfield_expr_with_lowered_type only handles certain codes, but
not others.  For example, += works fine but ++ does not.

This also fixes decltype-bitfield2.C where we were crashing (!), but
unfortunately it does not fix 84516 or 70733 where the problem is likely
a missing call to unlowered_expr_type.  It occurs to me now that typeof
likely has had the same issue, but this patch should fix that too.

	PR c++/95009

gcc/cp/ChangeLog:

	* typeck.c (is_bitfield_expr_with_lowered_type) <case MODIFY_EXPR>:
	Handle UNARY_PLUS_EXPR, NEGATE_EXPR, NON_LVALUE_EXPR, BIT_NOT_EXPR,
	P*CREMENT_EXPR too.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/decltype-bitfield1.C: New test.
	* g++.dg/cpp0x/decltype-bitfield2.C: New test.
2021-12-07 08:26:25 -05:00
H.J. Lu
7ef68c37b3 x86: Check FUNCTION_DECL before calling cgraph_node::get
gcc/

	PR target/103594
	* config/i386/i386.c (ix86_call_use_plt_p): Check FUNCTION_DECL
	before calling cgraph_node::get.

gcc/testsuite/

	PR target/103594
	* gcc.dg/pr103594.c: New test.
2021-12-07 05:24:47 -08:00
Richard Biener
6e8a31275f tree-optimization/103596 - fix missed propagation into switches
may_propagate_copy unnecessarily restricts propagating non-abnormals
into places that currently contain an abnormal SSA name but are
not the PHI argument for an abnormal edge.  This causes VN to
not elide a CFG path that it assumes is elided, resulting in
released SSA names in the IL.

The fix is to enhance the may_propagate_copy API to specify the
destination is _not_ a PHI argument.  I chose to not update only
the relevant caller in VN and the may_propagate_copy_into_stmt API
at this point because this is a regression and needs backporting.

2021-12-07  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/103596
	* tree-ssa-sccvn.c (eliminate_dom_walker::eliminate_stmt):
	Note we are not propagating into a PHI argument to may_propagate_copy.
	* tree-ssa-propagate.h (may_propagate_copy): Add
	argument specifying whether we propagate into a PHI arg.
	* tree-ssa-propagate.c (may_propagate_copy): Likewise.
	When not doing so we can replace an abnormal with
	something else.
	(may_propagate_into_stmt): Update may_propagate_copy calls.
	(replace_exp_1): Move propagation checking code to
	propagate_value and rename to ...
	(replace_exp): ... this and elide previous wrapper.
	(propagate_value): Perform checking with adjusted
	may_propagate_copy call and dispatch to replace_exp.

	* gcc.dg/torture/pr103596.c: New testcase.
2021-12-07 14:07:40 +01:00
Matthias Kretz
c93e704b9e Fix hash_map::traverse overload
The hash_map::traverse overload taking a non-const Value pointer breaks
if the callback returns false. The other overload should behave the
same.

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

gcc/ChangeLog:

	* hash-map.h (hash_map::traverse): Let both overloads behave the
	same.
	* predict.c (assert_is_empty): Return true, thus not changing
	behavior.
2021-12-07 13:11:47 +01:00
Tamar Christina
ba6bb287f0 Revert "libstdc++: Fix ctype changed after newlib update."
Newlib has reverted the commit that caused us to require a
workaround.  As such we can now revert the workaround.

This reverts commit 0e510ab534.

libstdc++-v3/ChangeLog:

	PR libstdc++/103305
	* config/os/newlib/ctype_base.h (upper, lower, alpha, digit, xdigit,
	space, print, graph, cntrl, punct, alnum, blank): Revert.
2021-12-07 10:37:30 +00:00
YunQiang Su
30a08286e6 MIPS: R6: load/store can process unaligned address
MIPS release 6 requires the lw/ld/sw/sd can work with
unaligned address, while it can be implemented by
full hardware or trap&emulate.

Since it doesn't have to be fully done by hardware, we add a
pair of options -m(no-)unaligned-access. Kernels may need them.

gcc/ChangeLog:

	* config/mips/mips.h (ISA_HAS_UNALIGNED_ACCESS, STRICT_ALIGNMENT):
		R6 can unaligned access.
	* config/mips/mips.md (movmisalign<mode>): Likewise.
	* config/mips/mips.opt: add -m(no-)unaligned-access
	* doc/invoke.texi: Likewise.

gcc/testsuite/ChangeLog:

	* gcc.target/mips/mips.exp: add unaligned-access
	* gcc.target/mips/unaligned-2.c: New test.
	* gcc.target/mips/unaligned-3.c: New test.
2021-12-07 10:01:23 +08:00
Eugene Rozenfeld
3d9e676793 Improve AutoFDO count propagation algorithm
When a basic block A has been annotated with a count and it has only one
successor (or predecessor) B, we can propagate the A's count to B.
The algoritm without this change could leave B without an annotation if B had
other unannotated predecessors (or successors). For example, in the test case I added,
the loop header block was left unannotated, which prevented loop unrolling.

gcc/ChangeLog:
	* auto-profile.c (afdo_propagate_edge): Improve count propagation algorithm.

gcc/testsuite/ChangeLog:
	* gcc.dg/tree-prof/init-array.c: New test for unrolling inner loops.
2021-12-06 16:59:31 -08:00
GCC Administrator
3a580f967e Daily bump. 2021-12-07 00:16:23 +00:00
David Malcolm
c9543403c1 analyzer: fix equivalence class state purging [PR103533]
Whilst debugging state explosions seen when enabling taint detection
with -fanalyzer (PR analyzer/103533), I noticed that constraint
manager instances could contain stray, redundant constants, such
as this instance:

constraint_manager:
  equiv classes:
    ec0: {(int)0 == [m_constant]‘0’}
    ec1: {(size_t)4 == [m_constant]‘4’}
  constraints:

where there are two equivalence classes, each just containing a
constant, with no constraints using them.

This patch makes constraint_manager::canonicalize more aggressive
about purging state, handling the case of purging a redundant
EC containing just a constant.

gcc/analyzer/ChangeLog:
	PR analyzer/103533
	* constraint-manager.cc (equiv_class::contains_non_constant_p):
	New.
	(constraint_manager::canonicalize): Call it when determining
	redundant ECs.
	(selftest::test_purging): New selftest.
	(selftest::run_constraint_manager_tests): Likewise.
	* constraint-manager.h (equiv_class::contains_non_constant_p):
	New decl.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2021-12-06 18:36:33 -05:00
Paul A. Clarke
325c6163a3 rs6000: Fix errant "vector" instead of "__vector"
Fixes 85289ba36c.

2021-12-06  Paul A. Clarke  <pc@us.ibm.com>

gcc
	PR target/103545
	* config/rs6000/xmmintrin.h (_mm_movemask_ps): Replace "vector" with
	"__vector".
2021-12-06 16:17:16 -06:00
Navid Rahimi
7754fddd01 MAINTAINERS: Add myself to write after approval and DCO sections.
* MAINTAINERS: Adding myself.
2021-12-06 13:57:54 -08:00
Jose E. Marchesi
bd0a61befc bpf: mark/remove unused arguments and remove an unused function
This patch does a little bit of cleanup by removing some unused
arguments, or marking them as unused.  It also removes the function
ctfc_debuginfo_early_finish_p and the corresponding hook macro
definition, which are not used by GCC.

gcc/
	* config/bpf/bpf.c (bpf_handle_preserve_access_index_attribute):
	Mark arguments `args' and flags' as unused.
	(bpf_core_newdecl): Remove unused local `newdecl'.
	(bpf_core_newdecl): Remove unused argument `loc'.
	(ctfc_debuginfo_early_finish_p): Remove unused function.
	(TARGET_CTFC_DEBUGINFO_EARLY_FINISH_P): Remove definition.
	(bpf_core_walk): Do not pass a location to bpf_core_newdecl.
2021-12-06 21:57:53 +01:00
Richard Sandiford
63c59f054a ranger: Add shortcuts for single-successor blocks
When compiling an optabs.ii at -O2 with a release-checking build,
there were 6,643,575 calls to gimple_outgoing_range_stmt_p.  96.8% of
them were for blocks with a single successor, which never have a control
statement that generates new range info.  This patch therefore adds a
shortcut for that case.

This gives a ~1% compile-time improvement for the test.

I tried making the function inline (in the header) so that the
single_succ_p didn't need to be repeated, but it seemed to make things
slightly worse.

gcc/
	* gimple-range-edge.cc (gimple_outgoing_range::edge_range_p): Add
	a shortcut for blocks with single successors.
	* gimple-range-gori.cc (gori_map::calculate_gori): Likewise.
2021-12-06 18:29:31 +00:00
Richard Sandiford
d27b7e6987 ranger: Optimise irange_union
When compiling an optabs.ii at -O2 with a release-checking build,
the hottest function in the profile was irange_union.  This patch
tries to optimise it a bit.  The specific changes are:

- Use quick_push rather than safe_push, since the final number
  of entries is known in advance.

- Avoid assigning wi::to_wide & co. to a temporary wide_int,
  such as in:

    wide_int val_j = wi::to_wide (res[j]);

  wi::to_wide returns a wide_int "view" of the in-place INTEGER_CST
  storage.  Assigning the result to wide_int forces an unnecessary
  copy to temporary storage.

  This is one area where "auto" helps a lot.  In the end though,
  it seemed more readable to inline the wi::to_*s rather than
  use auto.

- Use to_widest_int rather than to_wide_int.  Both are functionally
  correct, but to_widest_int is more efficient, for three reasons:

  - to_wide returns a wide-int representation in which the most
    significant element might not be canonically sign-extended.
    This is because we want to allow the storage of an INTEGER_CST
    like 0x1U << 31 to be accessed directly with both a wide_int view
    (where only 32 bits matter) and a widest_int view (where many more
    bits matter, and where the 32 bits are zero-extended to match the
    unsigned type).  However, operating on uncanonicalised wide_int
    forms is less efficient than operating on canonicalised forms.

  - to_widest_int has a constant rather than variable precision and
    there are never any redundant upper bits to worry about.

  - Using widest_int avoids the need for an overflow check, since
    there is enough precision to add 1 to any IL constant without
    wrap-around.

This gives a ~2% compile-time speed up with the test above.

I also tried adding a path for two single-pair ranges, but it
wasn't a win.

gcc/
	* value-range.cc (irange::irange_union): Use quick_push rather
	than safe_push.  Use widest_int rather than wide_int.  Avoid
	assigning wi::to_* results to wide*_int temporaries.
2021-12-06 18:29:30 +00:00
Andrew MacLeod
14dc5b71d7 Use dominators to reduce cache-flling.
Before walking the CFG and filling all cache entries, check if the
same information is available in a dominator.

	* gimple-range-cache.cc (ranger_cache::fill_block_cache): Check for
	a range from dominators before filling the cache.
	(ranger_cache::range_from_dom): New.
	* gimple-range-cache.h (ranger_cache::range_from_dom): Add prototype.
2021-12-06 13:27:10 -05:00
Andrew MacLeod
ed4a5f571b Add BB option for outgoing_edge_range_p and may_reocmpute_p.
There are times we only need to know if any edge from a block can calculate
a range.

	* gimple-range-gori.h (class gori_compute):: Add prototypes.
	* gimple-range-gori.cc (gori_compute::has_edge_range_p): Add alternate
	API for basic block.  Call for edge alterantive.
	(gori_compute::may_recompute_p): Ditto.
2021-12-06 13:14:53 -05:00
H.J. Lu
2a20407bac libsanitizer: Update LOCAL_PATCHES
Add

commit 70b043845d
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Nov 30 05:31:26 2021 -0800

    libsanitizer: Use SSE to save and restore XMM registers

to LOCAL_PATCHES.

	* LOCAL_PATCHES: Add commit 70b043845d.
2021-12-06 08:17:49 -08:00
H.J. Lu
70b043845d libsanitizer: Use SSE to save and restore XMM registers
Use SSE, instead of AVX, to save and restore XMM registers to support
processors without AVX.  The affected codes are unused in upstream since

https://github.com/llvm/llvm-project/commit/66d4ce7e26a5

and will be removed in

https://reviews.llvm.org/D112604

This fixed

FAIL: g++.dg/tsan/pthread_cond_clockwait.C   -O0  execution test
FAIL: g++.dg/tsan/pthread_cond_clockwait.C   -O2  execution test

on machines without AVX.

	PR sanitizer/103466
	* tsan/tsan_rtl_amd64.S (__tsan_trace_switch_thunk): Replace
	vmovdqu with movdqu.
	(__tsan_report_race_thunk): Likewise.
2021-12-06 08:16:49 -08:00
Richard Biener
0dc77a0c49 tree-optimization/103581 - fix masked gather on x86
The recent fix to PR103527 exposed an issue with how the various
special casing for AVX512 masks in vect_build_gather_load_calls
are handled.  The following makes that more obvious, fixing the
miscompile of 403.gcc.

2021-12-06  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/103581
	* tree-vect-stmts.c (vect_build_gather_load_calls): Properly
	guard all the AVX512 mask cases.

	* gcc.dg/vect/pr103581.c: New testcase.
2021-12-06 16:17:05 +01:00
Martin Liska
11013814fc contrib: Filter out -Wreturn-type in fold-const-call.c.
contrib/ChangeLog:

	* filter-clang-warnings.py: Filter out one warning.
2021-12-06 14:09:22 +01:00
Richard Biener
ee01694151 tree-optimization/103544 - SLP reduction chain as SLP reduction issue
When SLP reduction chain vectorization support added handling of
an outer conversion in the chain picking a failed reduction up
as SLP reduction that broke the invariant that the whole reduction
was forward reachable.  The following plugs that hole noting
a future enhancement possibility.

2021-12-06  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/103544
	* tree-vect-slp.c (vect_analyze_slp): Only add a SLP reduction
	opportunity if the stmt in question is the reduction root.
	(dot_slp_tree): Add missing check for NULL child.

	* gcc.dg/vect/pr103544.c: New testcase.
2021-12-06 12:53:43 +01:00
Jakub Jelinek
4dc6d19222 avr: Fix AVR build [PR71934]
On Mon, Dec 06, 2021 at 11:00:30AM +0100, Martin Liška wrote:
> Jakub, I think the patch broke avr-linux target:
>
> g++  -fno-PIE -c   -g   -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE   -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-erro
> /home/marxin/Programming/gcc/gcc/config/avr/avr.c: In function ‘void avr_output_data_section_asm_op(const void*)’:
> /home/marxin/Programming/gcc/gcc/config/avr/avr.c:10097:26: error: invalid conversion from ‘const void*’ to ‘const char*’ [-fpermissive]

This patch fixes that.

2021-12-06  Jakub Jelinek  <jakub@redhat.com>

	PR pch/71934
	* config/avr/avr.c (avr_output_data_section_asm_op,
	avr_output_bss_section_asm_op): Change argument type from const void *
	to const char *.
2021-12-06 11:20:59 +01:00
Tamar Christina
c2c843849a cse: Make sure duplicate elements are not entered into the equivalence set [PR103404]
CSE uses equivalence classes to keep track of expressions that all have the same
values at the current point in the program.

Normal equivalences through SETs only insert and perform lookups in this set but
equivalence determined from comparisons, e.g.

(insn 46 44 47 7 (set (reg:CCZ 17 flags)
        (compare:CCZ (reg:SI 105 [ iD.2893 ])
            (const_int 0 [0]))) "cse.c":18:22 7 {*cmpsi_ccno_1}
     (expr_list:REG_DEAD (reg:SI 105 [ iD.2893 ])
        (nil)))

creates the equivalence EQ on (reg:SI 105 [ iD.2893 ]) and (const_int 0 [0]).

This causes a merge to happen between the two equivalence sets denoted by
(const_int 0 [0]) and (reg:SI 105 [ iD.2893 ]) respectively.

The operation happens through merge_equiv_classes however this function has an
invariant that the classes to be merge not contain any duplicates.  This is
because it frees entries before merging.

The given testcase when using the supplied flags trigger an ICE due to the
equivalence set being

(rr) p dump_class (class1)
Equivalence chain for (reg:SI 105 [ iD.2893 ]):
(reg:SI 105 [ iD.2893 ])
$3 = void

(rr) p dump_class (class2)
Equivalence chain for (const_int 0 [0]):
(const_int 0 [0])
(reg:SI 97 [ _10 ])
(reg:SI 97 [ _10 ])
$4 = void

This happens because the original INSN being recorded is

(insn 18 17 24 2 (set (subreg:V1SI (reg:SI 97 [ _10 ]) 0)
        (const_vector:V1SI [
                (const_int 0 [0])
            ])) "cse.c":11:9 1363 {*movv1si_internal}
     (expr_list:REG_UNUSED (reg:SI 97 [ _10 ])
        (nil)))

and we end up generating two equivalences. the first one is simply that
reg:SI 97 is 0.  The second one is that 0 can be extracted from the V1SI, so
subreg (subreg:V1SI (reg:SI 97) 0) 0 == 0.  This nested subreg gets folded away
to just reg:SI 97 and we re-insert the same equivalence.

This patch changes it so that if the nunits of a subreg is 1 then don't generate
a vec_select from the subreg as the subreg will be folded away and we get a dup.

gcc/ChangeLog:

	PR rtl-optimization/103404
	* cse.c (find_sets_in_insn): Don't select elements out of a V1 mode
	subreg.

gcc/testsuite/ChangeLog:

	PR rtl-optimization/103404
	* gcc.target/i386/pr103404.c: New test.
2021-12-06 10:16:22 +00:00
liuhongt
d1011a41ef Prefer INT_SSE_REGS for SSE_FLOAT_MODE_P in preferred_reload_class.
When moves between integer and sse registers are cheap.

2021-12-06  Hongtao Liu  <Hongtao.liu@intel.com>
	    Uroš Bizjak  <ubizjak@gmail.com>
gcc/ChangeLog:

	PR target/95740
	* config/i386/i386.c (ix86_preferred_reload_class): Allow
	integer regs when moves between register units are cheap.
	* config/i386/i386.h (INT_SSE_CLASS_P): New.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr95740.c: New test.
2021-12-06 18:15:42 +08:00
Nelson Chu
45116f3420 RISC-V: jal cannot refer to a default visibility symbol for shared object.
This is the original binutils bugzilla report,
https://sourceware.org/bugzilla/show_bug.cgi?id=28509

And this is the first version of the proposed binutils patch,
https://sourceware.org/pipermail/binutils/2021-November/118398.html

After applying the binutils patch, I get the the unexpected error when
building libgcc,

/scratch/nelsonc/riscv-gnu-toolchain/riscv-gcc/libgcc/config/riscv/div.S:42:
/scratch/nelsonc/build-upstream/rv64gc-linux/build-install/riscv64-unknown-linux-gnu/bin/ld: relocation R_RISCV_JAL against `__udivdi3' which may bind externally can not be used when making a shared object; recompile with -fPIC

Therefore, this patch add an extra hidden alias symbol for __udivdi3, and
then use HIDDEN_JUMPTARGET to target a non-preemptible symbol instead.
The solution is similar to glibc as follows,
https://sourceware.org/git/?p=glibc.git;a=commit;h=68389203832ab39dd0dbaabbc4059e7fff51c29b

libgcc/ChangeLog:

	* config/riscv/div.S: Add the hidden alias symbol for __udivdi3, and
	then use HIDDEN_JUMPTARGET to target it since it is non-preemptible.
	* config/riscv/riscv-asm.h: Added new macros HIDDEN_JUMPTARGET and
	HIDDEN_DEF.
2021-12-06 10:55:01 +08:00
GCC Administrator
b880d1514c Daily bump. 2021-12-06 00:16:21 +00:00
Iain Sandoe
c9419faef0 Objective-C, NeXT: Reorganise meta-data declarations.
This moves the GTY declaration of the meta-data indentifier
array into the header that enumerates these and provides
shorthand defines for them.  This avoids a problem seen with
a relocatable PCH implementation.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

gcc/objc/ChangeLog:

	* objc-next-metadata-tags.h (objc_rt_trees): Declare here.
	* objc-next-runtime-abi-01.c: Remove from here.
	* objc-next-runtime-abi-02.c: Likewise.
	* objc-runtime-shared-support.c: Reorder headers, provide
	a GTY declaration the definition of objc_rt_trees.
2021-12-05 20:22:16 +00:00
David Edelsohn
8d4ef2299c aix: Move AIX math builtins before new builtin machinery.
The new builtin machinery has an early exit, so move the AIX-specific
builtins before the new machinery.

gcc/ChangeLog:

	* config/rs6000/rs6000-call.c (rs6000_init_builtins): Move
	AIX math builtin initialization before new_builtins_are_live.
2021-12-04 20:28:17 -05:00
GCC Administrator
70e4cb66c1 Daily bump. 2021-12-05 00:16:28 +00:00
Marek Polacek
066b3258bb c++: Add fixed test [PR93614]
This was fixed by r11-86.

	PR c++/93614

gcc/testsuite/ChangeLog:

	* g++.dg/template/lookup18.C: New test.
2021-12-04 15:29:46 -05:00
Tobias Burnus
689407ef91 Fortran/OpenMP: Support most of 5.1 atomic extensions
Implements moste of OpenMP 5.1 atomic extensions,
except that 'compare' is parsed but rejected during
resolution. (As the trans-openmp.c handling is missing.)

gcc/fortran/ChangeLog:

	* dump-parse-tree.c (show_omp_clauses): Handle
	weak/compare/fail clause.
	* gfortran.h (gfc_omp_clauses): Add weak, compare, fail.
	* openmp.c (enum omp_mask1, gfc_match_omp_clauses,
	OMP_ATOMIC_CLAUSES): Update for new clauses.
	(gfc_match_omp_atomic): Update for 5.1 atomic changes.
	(is_conversion): Support widening in one go.
	(is_scalar_intrinsic_expr): New.
	(resolve_omp_atomic): Update for 5.1 atomic changes.
	* parse.c (parse_omp_oacc_atomic): Update for compare.
	* resolve.c (gfc_resolve_blocks): Update asserts.
	* trans-openmp.c (gfc_trans_omp_atomic): Handle new clauses.

gcc/testsuite/ChangeLog:

	* gfortran.dg/gomp/atomic-2.f90: Move now supported code to ...
	* gfortran.dg/gomp/atomic.f90: here.
	* gfortran.dg/gomp/atomic-10.f90: New test.
	* gfortran.dg/gomp/atomic-12.f90: New test.
	* gfortran.dg/gomp/atomic-15.f90: New test.
	* gfortran.dg/gomp/atomic-16.f90: New test.
	* gfortran.dg/gomp/atomic-17.f90: New test.
	* gfortran.dg/gomp/atomic-18.f90: New test.
	* gfortran.dg/gomp/atomic-19.f90: New test.
	* gfortran.dg/gomp/atomic-20.f90: New test.
	* gfortran.dg/gomp/atomic-22.f90: New test.
	* gfortran.dg/gomp/atomic-24.f90: New test.
	* gfortran.dg/gomp/atomic-25.f90: New test.
	* gfortran.dg/gomp/atomic-26.f90: New test.

libgomp/ChangeLog

	* libgomp.texi (OpenMP 5.1): Update status.
2021-12-04 19:43:46 +01:00
Jonathan Wakely
87710ec7b2 libstdc++: Initialize member in std::match_results [PR103549]
This fixes a -Wuninitialized warning for std::cmatch m1, m2; m1=m2;

Also name the template parameters in the forward declaration, to get rid
of the <template-parameter-1-1> noise in diagnostics.

libstdc++-v3/ChangeLog:

	PR libstdc++/103549
	* include/bits/regex.h (match_results): Give names to template
	parameters in first declaration.
	(match_results::_M_begin): Add default member-initializer.
2021-12-04 15:55:01 +00:00
Tobias Burnus
b09af56214 libgomp.texi: Update OMP_PLACES
libgomp/ChangeLog:

	* libgomp.texi (OMP_PLACES): Extend description for OMP 5.1 changes.
2021-12-04 13:28:03 +01:00
Jakub Jelinek
c060e5c49c i386, ipa-modref: Comment spelling fix
This patch fixes spelling of prefer (misspelled as preffer).

2021-12-04  Jakub Jelinek  <jakub@redhat.com>

	* config/i386/x86-tune.def (X86_TUNE_PARTIAL_REG_DEPENDENCY): Fix
	comment typo, Preffer -> prefer.
	* ipa-modref-tree.c (modref_access_node::closer_pair_p): Likewise.
2021-12-04 11:09:33 +01:00
Jakub Jelinek
c57c910c94 c++: Allow indeterminate unsigned char or std::byte in bit_cast - P1272R4
P1272R4 has added to the std::byteswap new stuff to me quite unrelated
clarification for std::bit_cast.
The patch treats it as DR, applying to all languages.
We no longer diagnose if padding bits are stored into unsigned char
or std::byte result, fields or bitfields, instead arrange for that result,
those fields or bitfields to get indeterminate value (empty
CONSTRUCTOR with CONSTRUCTOR_NO_ZEROING or just leaving the member's
initializer out and setting CONSTRUCTOR_NO_ZEROING on parent).

We still have a bug that we don't diagnose in lots of places lvalue-to-rvalue
conversions of indeterminate values or class objects with some indeterminate
members.

2021-12-04  Jakub Jelinek <jakub@redhat.com>

	* cp-tree.h (is_byte_access_type_not_plain_char): Declare.
	* tree.c (is_byte_access_type_not_plain_char): New function.
	* constexpr.c (clear_uchar_or_std_byte_in_mask): New function.
	(cxx_eval_bit_cast): Don't error about padding bits if target
	type is unsigned char or std::byte, instead return no clearing
	ctor.  Use clear_uchar_or_std_byte_in_mask.

	* g++.dg/cpp2a/bit-cast11.C: New test.
	* g++.dg/cpp2a/bit-cast12.C: New test.
	* g++.dg/cpp2a/bit-cast13.C: New test.
	* g++.dg/cpp2a/bit-cast14.C: New test.
2021-12-04 11:02:15 +01:00
Jakub Jelinek
55dfce4d5c libcpp: Fix up handling of deferred pragmas [PR102432]
The https://gcc.gnu.org/pipermail/gcc-patches/2020-November/557903.html
change broke the following testcases.  The problem is when a pragma
namespace allows expansion (i.e. p->is_nspace && p->allow_expansion),
e.g. the omp or acc namespaces do, then when parsing the second pragma
token we do it with pfile->state.in_directive set,
pfile->state.prevent_expansion clear and pfile->state.in_deferred_pragma
clear (the last one because we don't know yet if it will be a deferred
pragma or not).  If the pragma line only contains a single name
and newline after it, and there exists a function-like macro with the
same name, the preprocessor needs to peek in funlike_invocation_p
the next token whether it isn't ( but in this case it will see a newline.
As pfile->state.in_directive is set, we don't read anything after the
newline, pfile->buffer->need_line is set and CPP_EOF is lexed, which
funlike_invocation_p doesn't push back.  Because name is a function-like
macro and on the pragma line there is no ( after the name, it isn't
expanded, and control flow returns to do_pragma.  If name is valid
deferred pragma, we set pfile->state.in_deferred_pragma (and really
need it set so that e.g. end_directive later on doesn't eat all the
tokens from the pragma line).

Before Nathan's change (which unfortunately didn't contain rationale
on why it is better to do it like that), this wasn't a problem,
next _cpp_lex_direct called when we want next token would return
CPP_PRAGMA_EOF when it saw buffer->need_line, which would turn off
pfile->state.in_deferred_pragma and following get token would already
read the next line.  But Nathan's patch replaced it with an assertion
failure that now triggers and CPP_PRAGMA_EOL is done only when lexing
the '\n'.  Except for this special case that works fine, but in
this case it doesn't because when peeking the token we still didn't know
that it will be a deferred pragma.
I've tried to fix that up in do_pragma by detecting this and pushing
CPP_PRAGMA_EOL as lookahead, but that doesn't work because end_directive
still needs to see pfile->state.in_deferred_pragma set.

So, this patch affectively reverts part of Nathan's change, CPP_PRAGMA_EOL
addition isn't done only when parsing the '\n', but is now done in both
places, in the first one instead of the assertion failure.

2021-12-04  Jakub Jelinek  <jakub@redhat.com>

	PR preprocessor/102432
	* lex.c (_cpp_lex_direct): If buffer->need_line while
	pfile->state.in_deferred_pragma, return CPP_PRAGMA_EOL token instead
	of assertion failure.

	* c-c++-common/gomp/pr102432.c: New test.
	* c-c++-common/goacc/pr102432.c: New test.
2021-12-04 11:00:09 +01:00
Alexandre Oliva
daca416fc2 [PR103028] test ifcvt trap_if seq more strictly after reload
When -fif-conversion2 is enabled, we attempt to replace conditional
branches around unconditional traps with conditional traps.  That
canonicalizes compares, which may change an immediate that barely fits
into one that doesn't.

The compare for the trap is first checked using the predicates of
cbranch predicates, and then, compare and conditional trap insns are
emitted and recognized.

In the failing s390x testcase, i <=u 0xffff_ffff is canonicalized into
i <u 0x1_0000_0000, and the latter immediate doesn't fit.  The insn
predicates (both cbranch and cmpdi_ccu) happily accept it, since the
register allocator has no trouble getting them into registers.  The
problem is that ifcvt2 runs after reload, so we recognize the compare
insn successfully, but later on we barf when we find that none of the
constraints fit.

This patch arranges for the trap_if-issuing bits in ifcvt to validate
post-reload insns using a stricter test that also checks that operands
fit the constraints.


for  gcc/ChangeLog

	PR rtl-optimization/103028
	* ifcvt.c (find_cond_trap): Validate new insns more strictly
	after reload.

for  gcc/testsuite/ChangeLog

	PR rtl-optimization/103028
	* gcc.dg/pr103028.c: New.
2021-12-04 00:17:16 -03:00
David Edelsohn
e096e2cfe9 testsuite: powerpc/vec_reve_1.c requires VSX.
vector long long int and vector double require VSX not just Altivec.

gcc/testsuite/ChangeLog:

	* gcc.target/powerpc/vec_reve_1.c: Require VSX.
2021-12-03 20:11:59 -05:00
GCC Administrator
03a9bd059b Daily bump. 2021-12-04 00:16:46 +00:00
Jonathan Wakely
bf548ce3e6 libstdc++: Simplify emplace member functions in _Rb_tree
This introduces a new RAII type to simplify the emplace members which
currently use try-catch blocks to deallocate a node if an exception is
thrown by the comparisons done during insertion. The new type is created
on the stack and manages the allocation of a new node and deallocates it
in the destructor if it wasn't inserted into the tree. It also provides
helper functions for doing the insertion, releasing ownership of the
node to the tree.

Also, we don't need to use long qualified names if we put the return
type after the nested-name-specifier.

libstdc++-v3/ChangeLog:

	* include/bits/stl_tree.h (_Rb_tree::_Auto_node): Define new
	RAII helper for creating and inserting new nodes.
	(_Rb_tree::_M_insert_node): Use trailing-return-type to simplify
	out-of-line definition.
	(_Rb_tree::_M_insert_lower_node): Likewise.
	(_Rb_tree::_M_insert_equal_lower_node): Likewise.
	(_Rb_tree::_M_emplace_unique): Likewise. Use _Auto_node.
	(_Rb_tree::_M_emplace_equal): Likewise.
	(_Rb_tree::_M_emplace_hint_unique): Likewise.
	(_Rb_tree::_M_emplace_hint_equal): Likewise.
2021-12-03 22:52:27 +00:00
Jason Merrill
f78eaffd15 c++: avoid redundant scope in diagnostics
We can make some function signatures shorter to print by omitting redundant
nested-name-specifiers in the rest of the declarator.

gcc/cp/ChangeLog:

	* error.c (current_dump_scope): New variable.
	(dump_scope): Check it.
	(dump_function_decl): Set it.

gcc/testsuite/ChangeLog:

	* g++.dg/diagnostic/scope1.C: New test.
2021-12-03 17:21:12 -05:00
Jonathan Wakely
7bfe82e5a8 Fix typos in libstdc++-v3/ChangeLog 2021-12-03 21:34:18 +00:00
Martin Liska
cff7879a38 rs6000: Fix up flag_shrink_wrap handling in presence of -mrop-protect [PR101324]
PR101324 shows a problem in disabling shrink-wrapping when using -mrop-protect
when there is a attribute optimize/pragma.  The fix envolves moving the handling
of flag_shrink_wrap so it gets re-disbled when we change or add options.

2021-12-03  Martin Liska  <mliska@suse.cz>

gcc/
	PR target/101324
	* config/rs6000/rs6000.c (rs6000_option_override_internal): Move the
	disabling of shrink-wrapping when using -mrop-protect from here...
	(rs6000_override_options_after_change): ...to here.

2021-12-03  Peter Bergner  <bergner@linux.ibm.com>

gcc/testsuite/
	PR target/101324
	* gcc.target/powerpc/pr101324.c: New test.
2021-12-03 14:32:13 -06:00