Jonathan Wakely [Wed, 17 Nov 2021 20:14:52 +0000 (20:14 +0000)]
libstdc++: Replace AC_CACHE_VAL with AC_CACHE_CHECK
This replaces most uses of AC_CACHE_VAL with AC_CACHE_CHECK, which means
we don't need separate AC_MSG_CHECKING and AC_MSG_RESULT macros.
There are a few trivial bugs fixed as a side effect, where an
AC_MSG_RESULT was printed out even if the actual checks hadn't been
done. That didn't affect the results, only the content of config.log.
libstdc++-v3/ChangeLog:
* acinclude.m4: Replace AC_CACHE_VAL with AC_CACHE_CHECK.
* configure: Regenerate.
Tamar Christina [Thu, 18 Nov 2021 11:22:11 +0000 (11:22 +0000)]
middle-end: Fix FMA detection when inspecting gimple which have no LHS.
convert_mult_to_fma assumes that all gimple_assigns have a LHS set. This
assumption is however not true when an IFN is kept around just for the
side-effects. In those situations you have just the IFN and lhs will be null.
Since there's no LHS, there also can't be any ADD and such it can't be an FMA
so it's correct to just return early if no LHS.
gcc/ChangeLog:
PR tree-optimization/103253
* tree-ssa-math-opts.c (convert_mult_to_fma): Check for LHS.
gcc/testsuite/ChangeLog:
PR tree-optimization/103253
* gcc.dg/vect/pr103253.c: New test.
Matthias Kretz [Fri, 16 Jul 2021 08:46:24 +0000 (10:46 +0200)]
c-family: Add __builtin_assoc_barrier
New builtin to enable explicit use of PAREN_EXPR in C & C++ code.
Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
gcc/testsuite/ChangeLog:
* c-c++-common/builtin-assoc-barrier-1.c: New test.
gcc/cp/ChangeLog:
* constexpr.c (cxx_eval_constant_expression): Handle PAREN_EXPR
via cxx_eval_constant_expression.
* cp-objcp-common.c (names_builtin_p): Handle
RID_BUILTIN_ASSOC_BARRIER.
* cp-tree.h: Adjust TREE_LANG_FLAG documentation to include
PAREN_EXPR in REF_PARENTHESIZED_P.
(REF_PARENTHESIZED_P): Add PAREN_EXPR.
* parser.c (cp_parser_postfix_expression): Handle
RID_BUILTIN_ASSOC_BARRIER.
* pt.c (tsubst_copy_and_build): If the PAREN_EXPR is not a
parenthesized initializer, build a new PAREN_EXPR.
* semantics.c (force_paren_expr): Simplify conditionals. Set
REF_PARENTHESIZED_P on PAREN_EXPR.
(maybe_undo_parenthesized_ref): Test PAREN_EXPR for
REF_PARENTHESIZED_P.
gcc/c-family/ChangeLog:
* c-common.c (c_common_reswords): Add __builtin_assoc_barrier.
* c-common.h (enum rid): Add RID_BUILTIN_ASSOC_BARRIER.
gcc/c/ChangeLog:
* c-decl.c (names_builtin_p): Handle RID_BUILTIN_ASSOC_BARRIER.
* c-parser.c (c_parser_postfix_expression): Likewise.
gcc/ChangeLog:
* doc/extend.texi: Document __builtin_assoc_barrier.
Jakub Jelinek [Thu, 18 Nov 2021 09:06:01 +0000 (10:06 +0100)]
libsanitizer: Fix bootstrap on FreeBSD [PR102675]
Here is an alternative to the patch changing a file imported from
compiler-rt upstream, so that we don't need to cary a local patch for that
particular problem.
2021-11-18 Jakub Jelinek <jakub@redhat.com>
PR bootstrap/102675
* sanitizer_common/Makefile.am: Use -DUSE_SYSTEM_MD5 in AM_CXXFLAGS
of sanitizer_platform_limits_freebsd.cpp.
* sanitizer_common/Makefile.in: Regenerated.
Martin Liska [Fri, 15 Oct 2021 14:34:34 +0000 (16:34 +0200)]
Remove MAY_HAVE_DEBUG_MARKER_STMTS and MAY_HAVE_DEBUG_BIND_STMTS.
The macros correspond 1:1 to an option flags and make it harder
to find all usages of the flags.
gcc/c-family/ChangeLog:
* c-gimplify.c (genericize_c_loop): Use option directly.
gcc/c/ChangeLog:
* c-parser.c (add_debug_begin_stmt): Use option directly.
gcc/ChangeLog:
* cfgexpand.c (pass_expand::execute): Use option directly.
* function.c (allocate_struct_function): Likewise.
* gimple-low.c (lower_function_body): Likewise.
(lower_stmt): Likewise.
* gimple-ssa-backprop.c (backprop::prepare_change): Likewise.
* ipa-param-manipulation.c (ipa_param_adjustments::modify_call): Likewise.
* ipa-split.c (split_function): Likewise.
* lto-streamer-in.c (input_function): Likewise.
* sese.c (sese_insert_phis_for_liveouts): Likewise.
* ssa-iterators.h (num_imm_uses): Likewise.
* tree-cfg.c (make_blocks): Likewise.
(gimple_merge_blocks): Likewise.
* tree-inline.c (tree_function_versioning): Likewise.
* tree-loop-distribution.c (generate_loops_for_partition): Likewise.
* tree-sra.c (analyze_access_subtree): Likewise.
* tree-ssa-dce.c (remove_dead_stmt): Likewise.
* tree-ssa-loop-ivopts.c (remove_unused_ivs): Likewise.
* tree-ssa-phiopt.c (spaceship_replacement): Likewise.
* tree-ssa-reassoc.c (reassoc_remove_stmt): Likewise.
* tree-ssa-tail-merge.c (tail_merge_optimize): Likewise.
* tree-ssa-threadedge.c (propagate_threaded_block_debug_into): Likewise.
* tree-ssa.c (gimple_replace_ssa_lhs): Likewise.
(target_for_debug_bind): Likewise.
(insert_debug_temp_for_var_def): Likewise.
(insert_debug_temps_for_defs): Likewise.
(reset_debug_uses): Likewise.
* tree-ssanames.c (release_ssa_name_fn): Likewise.
* tree-vect-loop-manip.c (adjust_vec_debug_stmts): Likewise.
(adjust_debug_stmts): Likewise.
(adjust_phi_and_debug_stmts): Likewise.
(vect_do_peeling): Likewise.
* tree-vect-loop.c (vect_transform_loop_stmt): Likewise.
(vect_transform_loop): Likewise.
* tree.h (MAY_HAVE_DEBUG_MARKER_STMTS): Remove
(MAY_HAVE_DEBUG_BIND_STMTS): Remove.
(MAY_HAVE_DEBUG_STMTS): Use options directly.
gcc/cp/ChangeLog:
* parser.c (add_debug_begin_stmt): Use option directly.
Richard Biener [Thu, 18 Nov 2021 08:49:38 +0000 (09:49 +0100)]
testsuite/103278 - adjust gcc.dg/tree-ssa/if-to-switch-3.c
Analysis shows that after the CD-DCE change we produce better
code which makes if-to-switch run into case-values-threshold on
some architectures, thus the switch is deemed to simple to be
worth generating. The following statically provides
--param case-values-threshold to make the testcase less
target dependent.
2021-11-18 Richard Biener <rguenther@suse.de>
PR testsuite/103278
* gcc.dg/tree-ssa/if-to-switch-3.c: Supply
--param case-values-threshold=4.
Richard Biener [Thu, 18 Nov 2021 08:07:22 +0000 (09:07 +0100)]
tree-optimization/103277 - do abnormal cleanup after call DSE
We can now DSE calls in more cases which requires us to eventually
purge dead abnormal edges. This implements this.
2021-11-18 Richard Biener <rguenther@suse.de>
PR tree-optimization/103277
* tree-ssa-dse.c (need_ab_cleanup): New.
(dse_optimize_redundant_stores): Adjust.
(delete_dead_or_redundant_assignment): Get extra
need_ab_cleanup argument and set when abnormal cleanup is
needed.
(dse_optimize_call): Adjust.
(dse_optimize_stmt): Likewise.
(pass_dse::execute): Allocate and deallocate need_ab_cleanup.
Perform abnormal cleanup.
* tree-ssa-dse.h (delete_dead_or_redundant_assignment): Adjust.
* gcc.dg/pr103277.c: New testcase.
Hongyu Wang [Thu, 18 Nov 2021 06:45:23 +0000 (14:45 +0800)]
i386: Fix wrong codegen for -mrelax-cmpxchg-loop
For -mrelax-cmpxchg-loop introduced by PR 103069/r12-5265, it would
produce infinite loop. The correct code should be
.L84:
movl (%rdi), %ecx
movl %eax, %edx
orl %esi, %edx
cmpl %eax, %ecx
jne .L82
lock cmpxchgl %edx, (%rdi)
jne .L84
movl %r8d, %eax <<< retval is missing in previous impl
ret
.L82:
rep nop
jmp .L84
Adjust corresponding expander to fix such issue, and fix runtime test
so the problem would be exposed.
gcc/ChangeLog:
* config/i386/i386-expand.c (ix86_expand_atomic_fetch_op_loop):
Adjust generated cfg to avoid infinite loop.
gcc/testsuite/ChangeLog:
* gcc.target/i386/pr103069-2.c: Adjust.
Jakub Jelinek [Thu, 18 Nov 2021 08:10:40 +0000 (09:10 +0100)]
libgomp: Ensure that either gomp_team is properly aligned [PR102838]
struct gomp_team has struct gomp_work_share array inside of it.
If that latter structure has 64-byte aligned member in the middle,
the whole struct gomp_team needs to be 64-byte aligned, but we weren't
allocating it using gomp_aligned_alloc.
This patch fixes that, except that on gcn team_malloc is special, so
I've instead decided at least for now to avoid using aligned member
and use the padding instead on gcn.
2021-11-18 Jakub Jelinek <jakub@redhat.com>
PR libgomp/102838
* libgomp.h (GOMP_USE_ALIGNED_WORK_SHARES): Define if
GOMP_HAVE_EFFICIENT_ALIGNED_ALLOC is defined and __AMDGCN__ is not.
(struct gomp_work_share): Use GOMP_USE_ALIGNED_WORK_SHARES instead of
GOMP_HAVE_EFFICIENT_ALIGNED_ALLOC.
* work.c (alloc_work_share, gomp_work_share_start): Likewise.
* team.c (gomp_new_team): If GOMP_USE_ALIGNED_WORK_SHARES, use
gomp_aligned_alloc instead of team_malloc.
Jakub Jelinek [Thu, 18 Nov 2021 08:07:31 +0000 (09:07 +0100)]
libgomp: Fix up aligned_alloc arguments [PR102838]
C says that aligned_alloc size must be an integral multiple of alignment.
While glibc doesn't care about it, apparently Solaris does.
So, this patch decreases the priority of aligned_alloc among the other
variants because it needs more work and can waste more memory and rounds
up the size to multiple of alignment.
2021-11-18 Jakub Jelinek <jakub@redhat.com>
PR libgomp/102838
* alloc.c (gomp_aligned_alloc): Prefer _aligned_alloc over
memalign over posix_memalign over aligned_alloc over fallback
with malloc instead of aligned_alloc over _aligned_alloc over
posix_memalign over memalign over fallback with malloc. For
aligned_alloc, round up size up to multiple of al.
konglin1 [Wed, 10 Nov 2021 07:31:04 +0000 (15:31 +0800)]
i386: add alias for f*mul_*ch intrinsics
gcc/ChangeLog:
* config/i386/avx512fp16intrin.h (_mm512_mul_pch): Add alias for _mm512_fmul_pch.
(_mm512_mask_mul_pch): Likewise.
(_mm512_maskz_mul_pch): Likewise.
(_mm512_mul_round_pch): Likewise.
(_mm512_mask_mul_round_pch): Likewise.
(_mm512_maskz_mul_round_pch): Likewise.
(_mm512_cmul_pch): Likewise.
(_mm512_mask_cmul_pch): Likewise.
(_mm512_maskz_cmul_pch): Likewise.
(_mm512_cmul_round_pch): Likewise.
(_mm512_mask_cmul_round_pch): Likewise.
(_mm512_maskz_cmul_round_pch): Likewise.
(_mm_mul_sch): Likewise.
(_mm_mask_mul_sch): Likewise.
(_mm_maskz_mul_sch): Likewise.
(_mm_mul_round_sch): Likewise.
(_mm_mask_mul_round_sch): Likewise.
(_mm_maskz_mul_round_sch): Likewise.
(_mm_cmul_sch): Likewise.
(_mm_mask_cmul_sch): Likewise.
(_mm_maskz_cmul_sch): Likewise.
(_mm_cmul_round_sch): Likewise.
(_mm_mask_cmul_round_sch): Likewise.
(_mm_maskz_cmul_round_sch): Likewise.
* config/i386/avx512fp16vlintrin.h (_mm_mul_pch): Likewise.
(_mm_mask_mul_pch): Likewise.
(_mm_maskz_mul_pch): Likewise.
(_mm256_mul_pch): Likewise.
(_mm256_mask_mul_pch): Likewise.
(_mm256_maskz_mul_pch): Likewise.
(_mm_cmul_pch): Likewise.
(_mm_mask_cmul_pch): Likewise.
(_mm_maskz_cmul_pch): Likewise.
(_mm256_cmul_pch): Likewise.
(_mm256_mask_cmul_pch): Likewise.
(_mm256_maskz_cmul_pch): Likewise.
gcc/testsuite/ChangeLog:
* gcc.target/i386/avx512fp16-vfcmulcph-1a.c: Add new test for alias.
* gcc.target/i386/avx512fp16-vfcmulcsh-1a.c: Likewise.
* gcc.target/i386/avx512fp16-vfmulcph-1a.c: Likewise.
* gcc.target/i386/avx512fp16-vfmulcsh-1a.c: Likewise.
* gcc.target/i386/avx512fp16vl-vfcmulcph-1a.c: Likewise.
* gcc.target/i386/avx512fp16vl-vfmulcph-1a.c: Likewise.
GCC Administrator [Thu, 18 Nov 2021 00:16:34 +0000 (00:16 +0000)]
Daily bump.
Andrew Pinski [Mon, 15 Nov 2021 09:31:20 +0000 (09:31 +0000)]
Fix PR tree-optimization/103228 and 103228: folding of (type) X op CST where type is a nop convert
Currently we fold (type) X op CST into (type) (X op ((type-x) CST)) when the conversion widens
but not when the conversion is a nop. For the same reason why we move the widening conversion
(the possibility of removing an extra conversion), we should do the same if the conversion is a
nop.
Committed as approved with the comment change.
PR tree-optimization/103228
PR tree-optimization/55177
gcc/ChangeLog:
* match.pd ((type) X bitop CST): Also do this
transformation for nop conversions.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/pr103228-1.c: New test.
* gcc.dg/tree-ssa/pr55177-1.c: New test.
Jonathan Wakely [Wed, 17 Nov 2021 22:32:33 +0000 (22:32 +0000)]
libstdc++: Fix author name in ChangeLog
The constexpr std::string commit was my own work, but the commit still
had the author name from an earlier cherry-pick that eventually got
entirely reverted. This fixes the name in the ChangeLog file.
David Malcolm [Tue, 2 Nov 2021 19:45:22 +0000 (15:45 -0400)]
libcpp: capture and underline ranges in -Wbidi-chars= [PR103026]
This patch converts the bidi::vec to use a struct so that we can
capture location_t values for the bidirectional control characters.
Before:
Wbidi-chars-1.c: In function ‘main’:
Wbidi-chars-1.c:6:43: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
6 | /*<U+202E> } <U+2066>if (isAdmin)<U+2069> <U+2066> begin admins only */
| ^
Wbidi-chars-1.c:9:28: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
9 | /* end admins only <U+202E> { <U+2066>*/
| ^
After:
Wbidi-chars-1.c: In function ‘main’:
Wbidi-chars-1.c:6:43: warning: unpaired UTF-8 bidirectional control characters detected [-Wbidi-chars=]
6 | /*<U+202E> } <U+2066>if (isAdmin)<U+2069> <U+2066> begin admins only */
| ~~~~~~~~ ~~~~~~~~ ^
| | | |
| | | end of bidirectional context
| U+202E (RIGHT-TO-LEFT OVERRIDE) U+2066 (LEFT-TO-RIGHT ISOLATE)
Wbidi-chars-1.c:9:28: warning: unpaired UTF-8 bidirectional control characters detected [-Wbidi-chars=]
9 | /* end admins only <U+202E> { <U+2066>*/
| ~~~~~~~~ ~~~~~~~~ ^
| | | |
| | | end of bidirectional context
| | U+2066 (LEFT-TO-RIGHT ISOLATE)
| U+202E (RIGHT-TO-LEFT OVERRIDE)
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/testsuite/ChangeLog:
PR preprocessor/103026
* c-c++-common/Wbidi-chars-ranges.c: New test.
libcpp/ChangeLog:
PR preprocessor/103026
* lex.c (struct bidi::context): New.
(bidi::vec): Convert to a vec of context rather than unsigned
char.
(bidi::ctx_at): Rename to...
(bidi::pop_kind_at): ...this and reimplement for above change.
(bidi::current_ctx): Update for change to vec.
(bidi::current_ctx_ucn_p): Likewise.
(bidi::current_ctx_loc): New.
(bidi::on_char): Update for usage of context struct. Add "loc"
param and pass it when pushing contexts.
(get_location_for_byte_range_in_cur_line): New.
(get_bidi_utf8): Rename to...
(get_bidi_utf8_1): ...this, reintroducing...
(get_bidi_utf8): ...as a wrapper, setting *OUT when the result is
not NONE.
(get_bidi_ucn): Rename to...
(get_bidi_ucn_1): ...this, reintroducing...
(get_bidi_ucn): ...as a wrapper, setting *OUT when the result is
not NONE.
(class unpaired_bidi_rich_location): New.
(maybe_warn_bidi_on_close): Use unpaired_bidi_rich_location when
reporting on unpaired bidi chars. Split into singular vs plural
spellings.
(maybe_warn_bidi_on_char): Pass in a location_t rather than a
const uchar * and use it when emitting warnings, and when calling
bidi::on_char.
(_cpp_skip_block_comment): Capture location when kind is not NONE
and pass it to maybe_warn_bidi_on_char.
(skip_line_comment): Likewise.
(forms_identifier_p): Likewise.
(lex_raw_string): Likewise.
(lex_string): Likewise.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
David Malcolm [Tue, 2 Nov 2021 13:54:32 +0000 (09:54 -0400)]
libcpp: escape non-ASCII source bytes in -Wbidi-chars= [PR103026]
This flags rich_locations associated with -Wbidi-chars= so that
non-ASCII bytes will be escaped when printing the source lines
(using the diagnostics support I added in
r12-4825-gbd5e882cf6e0def3dd1bc106075d59a303fe0d1e).
In particular, this ensures that the printed source lines will
be pure ASCII, and thus the visual ordering of the characters
will be the same as the logical ordering.
Before:
Wbidi-chars-1.c: In function ‘main’:
Wbidi-chars-1.c:6:43: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
6 | /* } if (isAdmin) begin admins only */
| ^
Wbidi-chars-1.c:9:28: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
9 | /* end admins only { */
| ^
Wbidi-chars-11.c:6:15: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
6 | int LRE__PDF_\u202c;
| ^
Wbidi-chars-11.c:8:19: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
8 | int LRE_\u202a_PDF__;
| ^
Wbidi-chars-11.c:10:28: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
10 | const char *s1 = "LRE__PDF_\u202c";
| ^
Wbidi-chars-11.c:12:33: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
12 | const char *s2 = "LRE_\u202a_PDF_";
| ^
After:
Wbidi-chars-1.c: In function ‘main’:
Wbidi-chars-1.c:6:43: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
6 | /*<U+202E> } <U+2066>if (isAdmin)<U+2069> <U+2066> begin admins only */
| ^
Wbidi-chars-1.c:9:28: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
9 | /* end admins only <U+202E> { <U+2066>*/
| ^
Wbidi-chars-11.c:6:15: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
6 | int LRE_<U+202A>_PDF_\u202c;
| ^
Wbidi-chars-11.c:8:19: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
8 | int LRE_\u202a_PDF_<U+202C>_;
| ^
Wbidi-chars-11.c:10:28: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
10 | const char *s1 = "LRE_<U+202A>_PDF_\u202c";
| ^
Wbidi-chars-11.c:12:33: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
12 | const char *s2 = "LRE_\u202a_PDF_<U+202C>";
| ^
libcpp/ChangeLog:
PR preprocessor/103026
* lex.c (maybe_warn_bidi_on_close): Use a rich_location
and call set_escape_on_output (true) on it.
(maybe_warn_bidi_on_char): Likewise.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Martin Sebor [Wed, 17 Nov 2021 22:09:23 +0000 (15:09 -0700)]
Avoid pathological function redeclarations when checking access sizes [PR102759].
Resolves:
PR tree-optimization/102759 - ICE: Segmentation fault in maybe_check_access_sizes since r12-2976-gb48d4e6818674898
gcc/ChangeLog:
PR tree-optimization/102759
* gimple-array-bounds.cc (build_printable_array_type): Move...
* gimple-ssa-warn-access.cc (build_printable_array_type): Avoid
pathological function redeclarations that remove a previously
declared prototype.
Improve formatting of function arguments in informational notes.
* pointer-query.cc (build_printable_array_type): ...to here.
* pointer-query.h (build_printable_array_type): Declared.
gcc/testsuite/ChangeLog:
PR tree-optimization/102759
* gcc.dg/Warray-parameter-10.c: New test.
* gcc.dg/Wstringop-overflow-82.c: New test.
H.J. Lu [Wed, 27 Oct 2021 14:48:54 +0000 (07:48 -0700)]
x86: Add -mharden-sls=[none|all|return|indirect-branch]
Add -mharden-sls= to mitigate against straight line speculation (SLS)
for function return and indirect branch by adding an INT3 instruction
after function return and indirect branch.
gcc/
PR target/102952
* config/i386/i386-opts.h (harden_sls): New enum.
* config/i386/i386.c (output_indirect_thunk): Mitigate against
SLS for function return.
(ix86_output_function_return): Likewise.
(ix86_output_jmp_thunk_or_indirect): Mitigate against indirect
branch.
(ix86_output_indirect_jmp): Likewise.
(ix86_output_call_insn): Likewise.
* config/i386/i386.opt: Add -mharden-sls=.
* doc/invoke.texi: Document -mharden-sls=.
gcc/testsuite/
PR target/102952
* gcc.target/i386/harden-sls-1.c: New test.
* gcc.target/i386/harden-sls-2.c: Likewise.
* gcc.target/i386/harden-sls-3.c: Likewise.
* gcc.target/i386/harden-sls-4.c: Likewise.
* gcc.target/i386/harden-sls-5.c: Likewise.
H.J. Lu [Wed, 17 Nov 2021 19:41:12 +0000 (11:41 -0800)]
x86: Remove "%!" before ret
Before MPX was removed, "%!" was mapped to
case '!':
if (ix86_bnd_prefixed_insn_p (current_output_insn))
fputs ("bnd ", file);
return;
After CET was added and MPX was removed, "%!" was mapped to
case '!':
if (ix86_notrack_prefixed_insn_p (current_output_insn))
fputs ("notrack ", file);
return;
ix86_notrack_prefixed_insn_p always returns false on ret since the
notrack prefix is only for indirect branches. Remove the unused "%!"
before ret.
PR target/103307
* config/i386/i386.c (ix86_code_end): Remove "%!" before ret.
(ix86_output_function_return): Likewise.
* config/i386/i386.md (simple_return_pop_internal): Likewise.
Jan Hubicka [Wed, 17 Nov 2021 21:04:26 +0000 (22:04 +0100)]
Fix modref summary streaming
Fixes bug in streaming in modref access tree that now cause a failure
of gamess benchmark. The bug is quite old (present in GCC11 release) but it
needs quite interesting series of events to manifest. In particular
1) At lto time ISRA turns some parameters passed by reference to scalar
2) At lto time modref computes summaries for old parameters and then updates
them but does so quite stupidly believing that the load from parameters
are now unkonwn loads (rather than optimized out).
This renders summary not very useful since it thinks every memory aliasing
int is now accssed (as opposed as parameter dereference)
3) At stream in we notice too early that summary is useless, set every_access
flag and drop the list. However while reading rest of the summary we
overwrite the flag back to 0 which makes us to lose part of summary.
4) right selection of partitions needs to be done to avoid late modref from
recalculating and thus fixing the summary.
This patch fixes the stream in bug, however we also should fix updating of
summaries.
gcc/ChangeLog:
2021-11-17 Jan Hubicka <hubicka@ucw.cz>
PR ipa/103246
* ipa-modref.c (read_modref_records): Fix streaminig in of every_access
flag.
Uros Bizjak [Wed, 17 Nov 2021 19:47:48 +0000 (20:47 +0100)]
i386: Redefine indirect_thunks_used as HARD_REG_SET.
Change indirect_thunks_used to HARD_REG_SET to avoid recalculations
of correct register numbers and allow usage of SET/TEST_HARD_REG_BIT
accessors.
2021-11-17 Uroš Bizjak <ubizjak@gmail.com>
gcc/ChangeLog:
* config/i386/i386.c (indirect_thunks_used): Redefine as HARD_REG_SET.
(ix86_code_end): Use TEST_HARD_REG_BIT on indirect_thunks_used.
(ix86_output_indirect_branch_via_reg): Use SET_HARD_REG_BIT
on indirect_thunks_used.
(ix86_output_indirect_function_return): Ditto.
Jan Hubicka [Wed, 17 Nov 2021 19:40:44 +0000 (20:40 +0100)]
Add very basic IPA part of modref-kill analysis
gcc/ChangeLog:
2021-11-17 Jan Hubicka <hubicka@ucw.cz>
* ipa-modref-tree.c: Include cgraph.h and tree-streamer.h.
(modref_access_node::stream_out): New member function.
(modref_access_node::stream_in): New member function.
* ipa-modref-tree.h (modref_access_node::stream_out,
modref_access_node::stream_in): Declare.
* ipa-modref.c (modref_summary_lto::useful_p): Free useless kills.
(modref_summary_lto::dump): Dump kills.
(analyze_store): Record kills for LTO
(analyze_stmt): Likewise.
(modref_summaries_lto::duplicate): Duplicate kills.
(write_modref_records): Use new stream_out member function.
(read_modref_records): Likewise.
(modref_write): Stream out kills.
(read_section): Stream in kills
(remap_kills): New function.
(update_signature): Use it.
Uros Bizjak [Wed, 17 Nov 2021 19:32:23 +0000 (20:32 +0100)]
i386: Introduce LEGACY_SSE_REGNO_P predicate
Introduce LEGACY_SSE_REGNO_P predicate to simplify a couple of places.
No functional changes.
2021-11-17 Uroš Bizjak <ubizjak@gmail.com>
gcc/ChangeLog:
* config/i386/i386.h (LEGACY_SSE_REGNO_P): New predicate.
(SSE_REGNO_P): Use LEGACY_SSE_REGNO_P predicate.
* config/i386/i386.c (zero_all_vector_registers):
Use LEGACY_SSE_REGNO_P predicate.
(ix86_register_priority): Use REX_INT_REGNO_P, REX_SSE_REGNO_P
and EXT_REG_SSE_REGNO_P predicates.
(ix86_hard_regno_call_part_clobbered): Use REX_SSE_REGNO_P
and LEGACY_SSE_REGNO_P predicates.
Martin Sebor [Wed, 17 Nov 2021 18:51:33 +0000 (11:51 -0700)]
Handle folded nonconstant array bounds [PR101702]
PR c/101702 - ICE: in handle_argspec_attribute, at c-family/c-attribs.c:3623
gcc/c/ChangeLog:
PR c/101702
* c-decl.c (get_parm_array_spec): Strip casts earlier and fold array
bounds before deciding if they're constant.
gcc/testsuite/ChangeLog:
PR c/101702
* gcc.dg/Warray-parameter-11.c: New test.
Jason Merrill [Wed, 17 Nov 2021 10:45:02 +0000 (05:45 -0500)]
doc: document -fimplicit-constexpr
I forgot this in the implementation patch.
gcc/ChangeLog:
* doc/invoke.texi (C++ Dialect Options): Document
-fimplicit-constexpr.
Jonathan Wakely [Wed, 17 Nov 2021 15:05:43 +0000 (15:05 +0000)]
libstdc++: Use std::construct_at in net::ip::address
Using placement-new isn't valid in constant expressions, so this
replaces it with std::construct_at (via the std::_Construct function
that is usable before C++20).
libstdc++-v3/ChangeLog:
* include/experimental/internet (address): Use std::_Construct
to initialize union members.
Jonathan Wakely [Wed, 17 Nov 2021 10:46:18 +0000 (10:46 +0000)]
libstdc++: Simplify std::string constructors
Several std::basic_string constructors dispatch to one of the
two-argument overloads of _M_construct, which then dispatches again to
_M_construct_aux to detect whether the arguments are iterators or not.
That then dispatches to one of _M_construct(size_type, char_type) or
_M_construct(Iter, Iter, iterator_traits<Iter>::iterator_category{}).
For most of those constructors this is a waste of time, because we know
the arguments are already iterators. For basic_string(const CharT*) and
basic_string(initializer_list<C>) we know that we call _M_construct with
two pointers, and for basic_string(const basic_string&) we call it with
two const_iterators. Those constructors can call the three-argument
overload of _M_construct with the iterator category tag right away,
without the intermediate dispatching.
The case where this doesn't apply is basic_string(InputIter, InputIter),
but for C++11 and later this is constrained so we know it's an iterator
here as well. We can restrict the dispatching in this constructor to
only be done for C++98 and to call _M_construct_aux directly, which
allows us to remove the two-argument _M_construct(InputIter, InputIter)
overload entirely.
N.B. When calling the three-arg _M_construct with pointers or string
iterators, we pass forward_iterator_tag not random_access_iterator_tag.
This is because it makes no difference which overload gets called, and
simplifies overload resolution to not have to do a base-to-derived
check. If we ever add a new overload of M_construct for random access
iterators we would have to revisit this, but that seems unlikely.
This patch also moves the __is_null_pointer checks from the three-arg
_M_construct into the constructors where a null pointer argument is
actually possible. This avoids redundant checks where we know we have a
non-null pointer, or don't have a pointer at all.
Finally, this patch replaces some try-blocks with an RAII type, so that
memory is deallocated during unwinding. This avoids the overhead of
catching and rethrowing an exception.
libstdc++-v3/ChangeLog:
* include/bits/basic_string.h (_M_construct_aux): Only define
for C++98. Remove constexpr.
(_M_construct_aux_2): Likewise.
(_M_construct(InputIter, InputIter)): Remove.
(basic_string(const basic_string&)): Call _M_construct with
iterator category argument.
(basic_string(const basic_string&, size_type, const Alloc&)):
Likewise.
(basic_string(const basic_string&, size_type, size_type)):
Likewise.
(basic_string(const charT*, size_type, const Alloc&)): Likewise.
Check for null pointer.
(basic_string(const charT*, const Alloc&)): Likewise.
(basic_string(initializer_list<charT>, const Alloc&)): Call
_M_construct with iterator category argument.
(basic_string(const basic_string&, const Alloc&)): Likewise.
(basic_string(basic_string&&, const Alloc&)): Likewise.
(basic_string(_InputIter, _InputIter, const Alloc&)): Likewise
for C++11 and later, call _M_construct_aux for C++98.
* include/bits/basic_string.tcc
(_M_construct(I, I, input_iterator_tag)): Replace try-block with
RAII type.
(_M_construct(I, I, forward_iterator_tag)): Likewise. Remove
__is_null_pointer check.
Jonathan Wakely [Wed, 17 Nov 2021 10:23:14 +0000 (10:23 +0000)]
libstdc++: Set active member of union in std::string [PR103295]
Clang diagnoses that the new constexpr std::string constructors are not
usable in constant expressions, because they start to write to members
of the union without setting an active member.
This adds a new helper function which returns the address of the local
buffer after making it the active member.
This doesn't fix all problems with Clang, because it still refuses to
write to memory returned by the allocator.
libstdc++-v3/ChangeLog:
PR libstdc++/103295
* include/bits/basic_string.h (_M_use_local_data()): New
member function to make local buffer the active member.
(assign(const basic_string&)): Use it.
* include/bits/basic_string.tcc (_M_construct, reserve()):
Likewise.
Jonathan Wakely [Tue, 16 Nov 2021 21:03:21 +0000 (21:03 +0000)]
libstdc++: Fix std::type_info::before for ARM [PR103240]
The r179236 fix for std::type_info::operator== should also have been
applied to std::type_info::before. Otherwise two distinct types can
compare equivalent due to using a string comparison, when they should do
a pointer comparison.
libstdc++-v3/ChangeLog:
PR libstdc++/103240
* libsupc++/tinfo2.cc (type_info::before): Use unadjusted name
to check for the '*' prefix.
* testsuite/util/testsuite_shared.cc: Add type_info object for
use in new test.
* testsuite/18_support/type_info/103240.cc: New test.
Jeff Law [Wed, 17 Nov 2021 16:55:50 +0000 (11:55 -0500)]
Fix two mips target tests compromised by recent IPA work
gcc/testsuite
* gcc.target/mips/frame-header-1.c (bar): Add noipa attribute.
* gcc.target/mips/frame-header-2.c (bar): Likewise.
Jakub Jelinek [Wed, 17 Nov 2021 16:31:40 +0000 (17:31 +0100)]
libcpp: Fix up handling of block comments in -fdirectives-only mode [PR103130]
Normal preprocessing, -fdirectives-only preprocessing before the Nathan's
rewrite, and all other compilers I've tried on godbolt treat even \*/
as end of a block comment, but the new -fdirectives-only handling doesn't.
2021-11-17 Jakub Jelinek <jakub@redhat.com>
PR preprocessor/103130
* lex.c (cpp_directive_only_process): Treat even \*/ as end of block
comment.
* c-c++-common/cpp/dir-only-9.c: New test.
Przemyslaw Wirkus [Wed, 17 Nov 2021 13:38:24 +0000 (13:38 +0000)]
aarch64: Add new vector mode V8DI
This patch is adding new V8DI mode which will be used with new Armv8.7-A
LS64 extension intrinsics.
gcc/ChangeLog:
* config/aarch64/aarch64-modes.def (VECTOR_MODE): New V8DI mode.
* config/aarch64/aarch64.c (aarch64_hard_regno_mode_ok): Handle
V8DImode.
* config/aarch64/iterators.md (define_mode_attr nunits): Add entry
for V8DI.
Martin Uecker [Wed, 17 Nov 2021 13:20:59 +0000 (14:20 +0100)]
Fix ICE when mixing VLAs and statement expressions [PR91038]
When returning VM-types from statement expressions, this can
lead to an ICE when declarations from the statement expression
are referred to later. Most of these issues can be addressed by
gimplifying the base expression earlier in gimplify_compound_lval.
Another issue is fixed by wrapping the pointer expression in
pointer_int_sum. This fixes PR91038 and some of the test cases
from PR29970 (structs with VLA members need further work).
gcc/
PR c/91038
PR c/29970
* gimplify.c (gimplify_var_or_parm_decl): Update comment.
(gimplify_compound_lval): Gimplify base expression first.
(gimplify_target_expr): Add comment.
gcc/c-family/
PR c/91038
PR c/29970
* c-common.c (pointer_int_sum): Make sure pointer expressions
are evaluated first when the size expression depends on for
variably-modified types.
gcc/testsuite/
PR c/91038
PR c/29970
* gcc.dg/vla-stexp-3.c: New test.
* gcc.dg/vla-stexp-4.c: New test.
* gcc.dg/vla-stexp-5.c: New test.
* gcc.dg/vla-stexp-6.c: New test.
* gcc.dg/vla-stexp-7.c: New test.
* gcc.dg/vla-stexp-8.c: New test.
* gcc.dg/vla-stexp-9.c: New test.
Jakub Jelinek [Wed, 17 Nov 2021 13:18:42 +0000 (14:18 +0100)]
lim: Reset flow sensitive info even for pointers [PR103192]
Since 2014 is lim clearing SSA_NAME_RANGE_INFO for integral SSA_NAMEs
if moving them from conditional contexts inside of a loop into unconditional
before the loop, but as the miscompilation of gimplify.c shows, we need to
treat pointers the same, even for them we need to reset whether the pointer
can/can't be null or the recorded pointer alignment.
This fixes
-FAIL: libgomp.c/../libgomp.c-c++-common/target-in-reduction-2.c (internal compiler error)
-FAIL: libgomp.c/../libgomp.c-c++-common/target-in-reduction-2.c (test for excess errors)
-UNRESOLVED: libgomp.c/../libgomp.c-c++-common/target-in-reduction-2.c compilation failed to produce executable
-FAIL: libgomp.c++/../libgomp.c-c++-common/target-in-reduction-2.c (internal compiler error)
-FAIL: libgomp.c++/../libgomp.c-c++-common/target-in-reduction-2.c (test for excess errors)
-UNRESOLVED: libgomp.c++/../libgomp.c-c++-common/target-in-reduction-2.c compilation failed to produce executable
-FAIL: libgomp.c++/target-in-reduction-2.C (internal compiler error)
-FAIL: libgomp.c++/target-in-reduction-2.C (test for excess errors)
-UNRESOLVED: libgomp.c++/target-in-reduction-2.C compilation failed to produce executable
on both x86_64 and i686.
2021-11-17 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/103192
* tree-ssa-loop-im.c (move_computations_worker): Use
reset_flow_sensitive_info instead of manually clearing
SSA_NAME_RANGE_INFO and do it for all SSA_NAMEs, not just ones
with integral types.
Jakub Jelinek [Wed, 17 Nov 2021 12:45:53 +0000 (13:45 +0100)]
ranger: Fix up fold_using_range::range_of_address [PR103255]
If on &base->member the offset isn't constant or isn't zero and
-fdelete-null-pointer-checks and not -fwrapv-pointer and base has a range
that doesn't include NULL, we return the range of the base.
Usually it isn't a big deal, because for most pointers we just use
varying, range_zero and range_nonzero ranges and nothing beyond that,
but if a pointer is initialized from a constant, we actually track the
exact range and in that case this causes miscompilation.
As discussed on IRC, I think doing something like:
offset_int off2;
if (off_cst && off.is_constant (&off2))
{
tree cst = wide_int_to_tree (sizetype, off2 / BITS_PER_UNIT);
// adjust range r with POINTER_PLUS_EXPR cst
if (!range_includes_zero_p (&r))
return true;
}
// Fallback
r = range_nonzero (TREE_TYPE (gimple_assign_rhs1 (stmt)));
return true;
could work, given that most of the pointer ranges are just the simple ones
perhaps it is too much for little benefit.
2021-11-17 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/103255
* gimple-range-fold.cc (fold_using_range::range_of_address): Return
range_nonzero rather than unadjusted base's range. Formatting fixes.
* gcc.c-torture/execute/pr103255.c: New test.
Richard Sandiford [Wed, 17 Nov 2021 12:28:44 +0000 (12:28 +0000)]
Add IFN_COND_FMIN/FMAX functions
This patch adds conditional forms of FMAX and FMIN, following
the pattern for existing conditional binary functions.
gcc/
* doc/md.texi (cond_fmin@var{mode}, cond_fmax@var{mode}): Document.
* optabs.def (cond_fmin_optab, cond_fmax_optab): New optabs.
* internal-fn.def (COND_FMIN, COND_FMAX): New functions.
* internal-fn.c (first_commutative_argument): Handle them.
(FOR_EACH_COND_FN_PAIR): Likewise.
* match.pd (UNCOND_BINARY, COND_BINARY): Likewise.
* config/aarch64/aarch64-sve.md (cond_<fmaxmin><mode>): New
pattern.
gcc/testsuite/
* gcc.target/aarch64/sve/cond_fmaxnm_5.c: New test.
* gcc.target/aarch64/sve/cond_fmaxnm_5_run.c: Likewise.
* gcc.target/aarch64/sve/cond_fmaxnm_6.c: Likewise.
* gcc.target/aarch64/sve/cond_fmaxnm_6_run.c: Likewise.
* gcc.target/aarch64/sve/cond_fmaxnm_7.c: Likewise.
* gcc.target/aarch64/sve/cond_fmaxnm_7_run.c: Likewise.
* gcc.target/aarch64/sve/cond_fmaxnm_8.c: Likewise.
* gcc.target/aarch64/sve/cond_fmaxnm_8_run.c: Likewise.
* gcc.target/aarch64/sve/cond_fminnm_5.c: Likewise.
* gcc.target/aarch64/sve/cond_fminnm_5_run.c: Likewise.
* gcc.target/aarch64/sve/cond_fminnm_6.c: Likewise.
* gcc.target/aarch64/sve/cond_fminnm_6_run.c: Likewise.
* gcc.target/aarch64/sve/cond_fminnm_7.c: Likewise.
* gcc.target/aarch64/sve/cond_fminnm_7_run.c: Likewise.
* gcc.target/aarch64/sve/cond_fminnm_8.c: Likewise.
* gcc.target/aarch64/sve/cond_fminnm_8_run.c: Likewise.
Kewen Lin [Wed, 17 Nov 2021 10:02:20 +0000 (04:02 -0600)]
i386: Fix non-robust split condition in define_insn_and_split
This patch is to fix some non-robust split conditions in some
define_insn_and_splits, to make each of them applied on top of
the corresponding condition for define_insn part, otherwise the
splitting could perform unexpectedly.
gcc/ChangeLog:
* config/i386/i386.md (*add<dwi>3_doubleword, *addv<dwi>4_doubleword,
*addv<dwi>4_doubleword_1, *sub<dwi>3_doubleword,
*subv<dwi>4_doubleword, *subv<dwi>4_doubleword_1,
*add<dwi>3_doubleword_cc_overflow_1, *divmodsi4_const,
*neg<dwi>2_doubleword, *tls_dynamic_gnu2_combine_64_<mode>): Fix split
condition.
Andrew Pinski [Tue, 16 Nov 2021 23:37:08 +0000 (23:37 +0000)]
Fix PR 103288, ICE after PHI-OPT, move an assigment when still in use for another bb
The problem is r12-5300-gf98f373dd822b35c allows phiopt to recognize more basic blocks
but missed one location where phiopt could move an assignment from the middle block
to the non-middle one. This patch fixes that.
OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.
PR tree-optimization/103288
gcc/ChangeLog:
* tree-ssa-phiopt.c (value_replacement): Return early if middle
block has more than one pred.
gcc/testsuite/ChangeLog:
* gcc.c-torture/compile/pr103288-1.c: New test.
Kewen Lin [Wed, 17 Nov 2021 05:55:01 +0000 (23:55 -0600)]
visium: Fix non-robust split condition in define_insn_and_split
This patch is to fix some non-robust split conditions in some
define_insn_and_splits, to make each of them applied on top of
the corresponding condition for define_insn part, otherwise the
splitting could perform unexpectedly.
gcc/ChangeLog:
* config/visium/visium.md (*add<mode>3_insn, *addsi3_insn, *addi3_insn,
*sub<mode>3_insn, *subsi3_insn, *subdi3_insn, *neg<mode>2_insn,
*negdi2_insn, *and<mode>3_insn, *ior<mode>3_insn, *xor<mode>3_insn,
*one_cmpl<mode>2_insn, *ashl<mode>3_insn, *ashr<mode>3_insn,
*lshr<mode>3_insn, *trunchiqi2_insn, *truncsihi2_insn,
*truncdisi2_insn, *extendqihi2_insn, *extendqisi2_insn,
*extendhisi2_insn, *extendsidi2_insn, *zero_extendqihi2_insn,
*zero_extendqisi2_insn, *zero_extendsidi2_insn): Fix split condition.
Marek Polacek [Wed, 6 Oct 2021 18:33:59 +0000 (14:33 -0400)]
libcpp: Implement -Wbidi-chars for CVE-2021-42574 [PR103026]
From a link below:
"An issue was discovered in the Bidirectional Algorithm in the Unicode
Specification through 14.0. It permits the visual reordering of
characters via control sequences, which can be used to craft source code
that renders different logic than the logical ordering of tokens
ingested by compilers and interpreters. Adversaries can leverage this to
encode source code for compilers accepting Unicode such that targeted
vulnerabilities are introduced invisibly to human reviewers."
More info:
https://nvd.nist.gov/vuln/detail/CVE-2021-42574
https://trojansource.codes/
This is not a compiler bug. However, to mitigate the problem, this patch
implements -Wbidi-chars=[none|unpaired|any] to warn about possibly
misleading Unicode bidirectional control characters the preprocessor may
encounter.
The default is =unpaired, which warns about improperly terminated
bidirectional control characters; e.g. a LRE without its corresponding PDF.
The level =any warns about any use of bidirectional control characters.
This patch handles both UCNs and UTF-8 characters. UCNs designating
bidi characters in identifiers are accepted since r204886. Then r217144
enabled -fextended-identifiers by default. Extended characters in C/C++
identifiers have been accepted since r275979. However, this patch still
warns about mixing UTF-8 and UCN bidi characters; there seems to be no
good reason to allow mixing them.
We warn in different contexts: comments (both C and C++-style), string
literals, character constants, and identifiers. Expectedly, UCNs are ignored
in comments and raw string literals. The bidirectional control characters
can nest so this patch handles that as well.
I have not included nor tested this at all with Fortran (which also has
string literals and line comments).
Dave M. posted patches improving diagnostic involving Unicode characters.
This patch does not make use of this new infrastructure yet.
PR preprocessor/103026
gcc/c-family/ChangeLog:
* c.opt (Wbidi-chars, Wbidi-chars=): New option.
gcc/ChangeLog:
* doc/invoke.texi: Document -Wbidi-chars.
libcpp/ChangeLog:
* include/cpplib.h (enum cpp_bidirectional_level): New.
(struct cpp_options): Add cpp_warn_bidirectional.
(enum cpp_warning_reason): Add CPP_W_BIDIRECTIONAL.
* internal.h (struct cpp_reader): Add warn_bidi_p member
function.
* init.c (cpp_create_reader): Set cpp_warn_bidirectional.
* lex.c (bidi): New namespace.
(get_bidi_utf8): New function.
(get_bidi_ucn): Likewise.
(maybe_warn_bidi_on_close): Likewise.
(maybe_warn_bidi_on_char): Likewise.
(_cpp_skip_block_comment): Implement warning about bidirectional
control characters.
(skip_line_comment): Likewise.
(forms_identifier_p): Likewise.
(lex_identifier): Likewise.
(lex_string): Likewise.
(lex_raw_string): Likewise.
gcc/testsuite/ChangeLog:
* c-c++-common/Wbidi-chars-1.c: New test.
* c-c++-common/Wbidi-chars-2.c: New test.
* c-c++-common/Wbidi-chars-3.c: New test.
* c-c++-common/Wbidi-chars-4.c: New test.
* c-c++-common/Wbidi-chars-5.c: New test.
* c-c++-common/Wbidi-chars-6.c: New test.
* c-c++-common/Wbidi-chars-7.c: New test.
* c-c++-common/Wbidi-chars-8.c: New test.
* c-c++-common/Wbidi-chars-9.c: New test.
* c-c++-common/Wbidi-chars-10.c: New test.
* c-c++-common/Wbidi-chars-11.c: New test.
* c-c++-common/Wbidi-chars-12.c: New test.
* c-c++-common/Wbidi-chars-13.c: New test.
* c-c++-common/Wbidi-chars-14.c: New test.
* c-c++-common/Wbidi-chars-15.c: New test.
* c-c++-common/Wbidi-chars-16.c: New test.
* c-c++-common/Wbidi-chars-17.c: New test.
David Malcolm [Tue, 16 Nov 2021 15:36:49 +0000 (10:36 -0500)]
analyzer: fix missing -Wanalyzer-write-to-const [PR102695]
This patch fixes -Wanalyzer-write-to-const so that it will complain
about attempts to write to functions, to labels.
It also "teaches" the analyzer about strchr, in that strchr can either
return a pointer into the input area (and thus -Wanalyzer-write-to-const
can now complain about writes into a string literal seen this way),
or return NULL (and thus the analyzer can complain about NULL
dereferences if the result is used without a check).
gcc/analyzer/ChangeLog:
PR analyzer/102695
* region-model-impl-calls.cc (region_model::impl_call_strchr): New.
* region-model-manager.cc
(region_model_manager::maybe_fold_unaryop): Simplify cast to
pointer type of an existing pointer to a region.
* region-model.cc (region_model::on_call_pre): Handle
BUILT_IN_STRCHR and "strchr".
(write_to_const_diagnostic::emit): Add auto_diagnostic_group. Add
alternate wordings for functions and labels.
(write_to_const_diagnostic::describe_final_event): Add alternate
wordings for functions and labels.
(region_model::check_for_writable_region): Handle RK_FUNCTION and
RK_LABEL.
* region-model.h (region_model::impl_call_strchr): New decl.
gcc/testsuite/ChangeLog:
PR analyzer/102695
* gcc.dg/analyzer/pr102695.c: New test.
* gcc.dg/analyzer/strchr-1.c: New test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
David Malcolm [Mon, 15 Nov 2021 23:23:08 +0000 (18:23 -0500)]
analyzer: don't assume target has alloca [PR102779]
gcc/testsuite/ChangeLog:
PR analyzer/102779
* gcc.dg/analyzer/capacity-1.c: Add dg-require-effective-target
alloca. Use __builtin_alloca rather than alloca.
* gcc.dg/analyzer/capacity-3.c: Likewise.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Jan Hubicka [Wed, 17 Nov 2021 00:43:57 +0000 (01:43 +0100)]
Fix clearing of to_info_lto in ipa_merge_modref_summary_after_inlining
This patch fixes bug that caused some optimizations to be dropped with
-fdump-ipa-inline.
gcc/ChangeLog:
2021-11-17 Jan Hubicka <hubicka@ucw.cz>
PR ipa/103246
* ipa-modref.c (ipa_merge_modref_summary_after_inlining): Fix clearing
of to_info_lto
GCC Administrator [Wed, 17 Nov 2021 00:16:29 +0000 (00:16 +0000)]
Daily bump.
Jonathan Wakely [Tue, 16 Nov 2021 21:00:50 +0000 (21:00 +0000)]
libstdc++: Fix tests for constexpr std::string
Some tests fail when run with -D_GLIBCXX_USE_CXX11_ABI or -stdgnu++20.
libstdc++-v3/ChangeLog:
* include/bits/basic_string.h (operator<=>): Use constexpr
unconditionally.
* testsuite/21_strings/basic_string/modifiers/constexpr.cc:
Require cxx11-abit effective target.
* testsuite/21_strings/headers/string/synopsis.cc: Add
conditional constexpr to declarations, and adjust relational
operators for C++20.
Jason Merrill [Wed, 10 Nov 2021 21:23:12 +0000 (16:23 -0500)]
c-family: don't cache large vecs
Patrick observed recently that an element of the vector cache could be
arbitrarily large. Let's only cache relatively small vecs.
gcc/c-family/ChangeLog:
* c-common.c (release_tree_vector): Only cache vecs smaller than
16 elements.
Jan Hubicka [Tue, 16 Nov 2021 22:01:28 +0000 (23:01 +0100)]
Use modref summaries for byte-wise dead store elimination.
gcc/ChangeLog:
* ipa-modref.c (get_modref_function_summary): Declare.
* ipa-modref.h (get_modref_function_summary): New function.
* tree-ssa-dse.c (clear_live_bytes_for_ref): Break out from ...
(clear_bytes_written_by): ... here; also clear memory killed by
calls.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/modref-dse-4.c: New test.
Martin Uecker [Tue, 16 Nov 2021 21:35:20 +0000 (22:35 +0100)]
MAINTAINERS: Add myself to DCO section and update email address
ChangeLog:
* MAINTAINERS: Add myself to DCO section and update email address.
Harald Anlauf [Tue, 16 Nov 2021 20:06:06 +0000 (21:06 +0100)]
Fortran: avoid NULL pointer dereference on invalid range in logical SELECT CASE
gcc/fortran/ChangeLog:
PR fortran/103286
* resolve.c (resolve_select): Choose appropriate range limit to
avoid NULL pointer dereference when generating error message.
gcc/testsuite/ChangeLog:
PR fortran/103286
* gfortran.dg/pr103286.f90: New test.
Iain Sandoe [Fri, 12 Nov 2021 17:05:13 +0000 (17:05 +0000)]
configure, Darwin: Set appropriate defaults for host-shared.
Darwin x86_64 and aarch64 platforms are PIC (shared) by default,
and user-space code must be built in this mode. The patch
ensures that this is set correctly and applies a default when
--enable-host-shared is not set.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
ChangeLog:
* configure: Regenerate.
* configure.ac: Ensure that PIC (shared) defaults are set
correctly for Darwin.
Iain Sandoe [Sat, 13 Nov 2021 12:26:16 +0000 (12:26 +0000)]
PCH: Make the save and restore diagnostics more robust.
When saving, if we cannot obtain a suitable memory segment there
is no point in continuing, so exit with an error.
When reading in the PCH, we have a situation that the read-in
data will replace the line tables used by the diagnostics output.
However, the state of the read-oin line tables is indeterminate
at some points where diagnostics might be needed.
To make this more robust, we save the existing line tables at
the start and, once we have read in the pointer to the new one,
put that to one side and restore the original table. This
avoids compiler hangs if the read or memory acquisition code
issues an assert, fatal_error, segv etc.
Once the read is complete, we swap in the new line table that
came from the PCH.
If the read-in PCH is corrupted then we still have a broken
compilation w.r.t any future diagnostics - but there is little
that can be done about that without more careful validation of
the file.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/ChangeLog:
* ggc-common.c (gt_pch_save): If we cannot find a suitable
memory segment for save, then error-out, do not try to
continue.
(gt_pch_restore): Save the existing line table, and when
the replacement is being read, use that when constructing
diagnostics.
Peter Bergner [Tue, 16 Nov 2021 18:14:22 +0000 (12:14 -0600)]
rs6000: MMA test case emits wrong code when building a vector pair [PR102976]
PR102976 shows a test case where we generate wrong code when building
a vector pair from 2 vector registers. The bug here is that with unlucky
register assignments, we can clobber one of the input operands before
we write both registers of the output operand. The solution is to use
early-clobbers in the assemble pair and accumulator patterns.
2021-11-16 Peter Bergner <bergner@linux.ibm.com>
gcc/
PR target/102976
* config/rs6000/mma.md (*vsx_assemble_pair): Add early-clobber for
output operand.
(*mma_assemble_acc): Likewise.
gcc/testsuite/
PR target/102976
* gcc.target/powerpc/pr102976.c: New test.
Mikael Morin [Sun, 7 Nov 2021 13:40:36 +0000 (14:40 +0100)]
fortran: Identify arguments by their names
This provides a new function to get the name of a dummy argument,
so that identifying an argument can be made using just its name
instead of a mix of name matching (for keyword actual arguments)
and argument counting (for other actual arguments).
gcc/fortran/ChangeLog:
* interface.c (gfc_dummy_arg_get_name): New function.
* gfortran.h (gfc_dummy_arg_get_name): Declare it.
* trans-array.c (arg_evaluated_for_scalarization): Pass a dummy
argument wrapper as argument instead of an actual argument
and an index number. Check it’s non-NULL. Use its name
to identify it.
(gfc_walk_elemental_function_args): Update call to
arg_evaluated for scalarization. Remove argument counting.
Mikael Morin [Sun, 7 Nov 2021 13:40:24 +0000 (14:40 +0100)]
fortran: Delete redundant missing_arg_type field
Now that we can get information about an actual arg's associated
dummy using the associated_dummy attribute, the field missing_arg_type
contains redundant information.
This removes it.
gcc/fortran/ChangeLog:
* gfortran.h (gfc_actual_arglist::missing_arg_type): Remove.
* interface.c (gfc_compare_actual_formal): Remove
missing_arg_type initialization.
* intrinsic.c (sort_actual): Ditto.
* trans-expr.c (gfc_conv_procedure_call): Use associated_dummy
and gfc_dummy_arg_get_typespec to get the dummy argument type.
Mikael Morin [Sun, 7 Nov 2021 13:40:11 +0000 (14:40 +0100)]
fortran: simplify elemental arguments walking
This adds two functions working with the wrapper struct gfc_dummy_arg
and makes usage of them to simplify a bit the walking of elemental
procedure arguments for scalarization. As information about dummy arguments
can be obtained from the actual argument through the just-introduced
associated_dummy field, there is no need to carry around the procedure
interface and walk dummy arguments manually together with actual arguments.
gcc/fortran/ChangeLog:
* interface.c (gfc_dummy_arg_get_typespec,
gfc_dummy_arg_is_optional): New functions.
* gfortran.h (gfc_dummy_arg_get_typespec,
gfc_dummy_arg_is_optional): Declare them.
* trans.h (gfc_ss_info::dummy_arg): Use the wrapper type
as declaration type.
* trans-array.c (gfc_scalar_elemental_arg_saved_as_reference):
use gfc_dummy_arg_get_typespec function to get the type.
(gfc_walk_elemental_function_args): Remove proc_ifc argument.
Get info about the dummy arg using the associated_dummy field.
* trans-array.h (gfc_walk_elemental_function_args): Update declaration.
* trans-intrinsic.c (gfc_walk_intrinsic_function):
Update call to gfc_walk_elemental_function_args.
* trans-stmt.c (gfc_trans_call): Ditto.
(get_proc_ifc_for_call): Remove.
Mikael Morin [Sun, 7 Nov 2021 13:39:59 +0000 (14:39 +0100)]
fortran: Reverse actual vs dummy argument mapping
There was originally no way from an actual argument to get
to the corresponding dummy argument, even if the job of sorting
and matching actual with dummy arguments was done.
The closest was a field named actual in gfc_intrinsic_arg that was
used as scratch data when sorting arguments of one specific call.
However that value was overwritten later on as arguments of another
call to the same procedure were sorted and matched.
This change removes that field from gfc_intrinsic_arg and adds instead
a new field associated_dummy in gfc_actual_arglist.
The new field has as type a new wrapper struct gfc_dummy_arg that provides
a common interface to both dummy arguments of user-defined procedures
(which have type gfc_formal_arglist) and dummy arguments of intrinsic procedures
(which have type gfc_intrinsic_arg).
As the removed field was used in the code sorting and matching arguments,
that code has to be updated. Two local vectors with matching indices
are introduced for respectively dummy and actual arguments, and the
loops are modified to use indices and update those argument vectors.
gcc/fortran/ChangeLog:
* gfortran.h (gfc_dummy_arg_kind, gfc_dummy_arg): New.
(gfc_actual_arglist): New field associated_dummy.
(gfc_intrinsic_arg): Remove field actual.
* interface.c (get_nonintrinsic_dummy_arg): New.
(gfc_compare_actual): Initialize associated_dummy.
* intrinsic.c (get_intrinsic_dummy_arg): New.
(sort_actual): Add argument vectors.
Use loops with indices on argument vectors.
Initialize associated_dummy.
Mikael Morin [Sun, 7 Nov 2021 13:39:47 +0000 (14:39 +0100)]
fortran: Tiny sort_actual internal refactoring
Preliminary refactoring to make further changes more obvious.
No functional change.
gcc/fortran/ChangeLog:
* intrinsic.c (sort_actual): initialise variable and use it earlier.
Patrick Palka [Tue, 16 Nov 2021 17:23:27 +0000 (12:23 -0500)]
libstdc++: Merge latest Ryu sources
libstdc++-v3/ChangeLog:
* src/c++17/ryu/MERGE: Update the commit hash.
* src/c++17/ryu/d2s_intrinsics.h: Merge from Ryu's master
branch.
Signed-off-by: Patrick Palka <ppalka@redhat.com>
Michael de Lang [Wed, 26 Feb 2020 22:43:45 +0000 (23:43 +0100)]
libstdc++: Implement constexpr std::basic_string for C++20
This is only supported for the cxx11 ABI, not for COW strings.
libstdc++-v3/ChangeLog:
* include/bits/basic_string.h (basic_string, operator""s): Add
constexpr for C++20.
(basic_string::basic_string(basic_string&&)): Only copy
initialized portion of the buffer.
(basic_string::basic_string(basic_string&&, const Alloc&)):
Likewise.
* include/bits/basic_string.tcc (basic_string): Add constexpr
for C++20.
(basic_string::swap(basic_string&)): Only copy initialized
portions of the buffers.
(basic_string::_M_replace): Add constexpr implementation that
doesn't depend on pointer comparisons.
* include/bits/cow_string.h: Adjust comment.
* include/ext/type_traits.h (__is_null_pointer): Add constexpr.
* include/std/string (erase, erase_if): Add constexpr.
* include/std/version (__cpp_lib_constexpr_string): Update
value.
* testsuite/21_strings/basic_string/cons/char/constexpr.cc:
New test.
* testsuite/21_strings/basic_string/cons/wchar_t/constexpr.cc:
New test.
* testsuite/21_strings/basic_string/literals/constexpr.cc:
New test.
* testsuite/21_strings/basic_string/modifiers/constexpr.cc: New test.
* testsuite/21_strings/basic_string/modifiers/swap/char/constexpr.cc:
New test.
* testsuite/21_strings/basic_string/modifiers/swap/wchar_t/constexpr.cc:
New test.
* testsuite/21_strings/basic_string/version.cc: New test.
Jonathan Wakely [Thu, 11 Nov 2021 20:51:15 +0000 (20:51 +0000)]
libstdc++: Use hidden friends for vector<bool>::reference swap overloads
These swap overloads are non-standard, but are needed to make swap work
for vector<bool>::reference rvalues. They don't need to be called
explicitly, only via ADL, so hide them from normal lookup. This is what
I've proposed as the resolution to LWG 3638.
libstdc++-v3/ChangeLog:
* include/bits/stl_bvector.h (swap(_Bit_reference, _Bit_reference))
(swap(_Bit_reference, bool&), swap(bool&, _Bit_reference)):
Define as hidden friends of _Bit_reference.
Martin Sebor [Tue, 16 Nov 2021 16:18:25 +0000 (09:18 -0700)]
Avoid assuming maximum string length is constant [PR102960].
Resolves:
PR tree-optimization/102960 - ICE: in sign_mask, at wide-int.h:855 in GCC 10.3.0
gcc/ChangeLog:
PR tree-optimization/102960
* gimple-fold.c (get_range_strlen): Take bitmap as an argument rather
than a pointer to it.
(get_range_strlen_tree): Same. Remove bitmap allocation. Use
an auto_bitmap.
(get_maxval_strlen): Use an auto_bitmap.
* tree-ssa-strlen.c (get_range_strlen_dynamic): Factor out PHI
handling...
(get_range_strlen_phi): ...into this function.
Avoid assuming maximum string length is constant
(printf_strlen_execute): Dump pointer query cache contents when
details are requisted.
gcc/testsuite/ChangeLog:
PR tree-optimization/102960
* gcc.dg/Wstringop-overflow-84.c: New test.
Tamar Christina [Tue, 16 Nov 2021 15:39:28 +0000 (15:39 +0000)]
shrn-combine-10: update test to current codegen.
When the rshrn commit was reverted I missed this testcase.
This now updates it.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/shrn-combine-10.c: Use shrn.
Tamar Christina [Tue, 16 Nov 2021 15:38:28 +0000 (15:38 +0000)]
signbit-2: make test check for scalar or vector versions
This updates the signbit-2 test to check for
the scalar optimization if the target does not
support vectorization.
gcc/testsuite/ChangeLog:
* gcc.dg/signbit-2.c: CHeck vect or scalar.
David Malcolm [Mon, 15 Nov 2021 21:12:37 +0000 (16:12 -0500)]
analyzer: fix overeager sharing of bounded_range instances [PR102662]
This was leading to an assertion failure ICE on a switch stmt when using
-fstrict-enums, due to erroneously reusing a range involving one enum
with a range involving a different enum.
gcc/analyzer/ChangeLog:
PR analyzer/102662
* constraint-manager.cc (bounded_range::operator==): Require the
types to be the same for equality.
gcc/testsuite/ChangeLog:
PR analyzer/102662
* g++.dg/analyzer/pr102662.C: New test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Jason Merrill [Fri, 29 Oct 2021 20:39:01 +0000 (16:39 -0400)]
c++: improve print_node of PTRMEM_CST
It's been inconvenient that pretty-printing of PTRMEM_CST didn't display
what member the constant refers to.
Adding that is complicated by the absence of a langhook for CONSTANT_CLASS_P
nodes; the simplest fix for that is to use the tcc_exceptional hook for
tcc_constant as well.
gcc/cp/ChangeLog:
* ptree.c (cxx_print_xnode): Handle PTRMEM_CST.
gcc/ChangeLog:
* langhooks.h (struct lang_hooks): Adjust comment.
* print-tree.c (print_node): Also call print_xnode hook for
tcc_constant class.
Andrew Pinski [Sat, 13 Nov 2021 04:16:55 +0000 (04:16 +0000)]
tree-optimization: [PR103218] Fold ((type)(a<0)) << SIGNBITOFA into ((type)a) & signbit
This folds Fold ((type)(a<0)) << SIGNBITOFA into ((type)a) & signbit inside match.pd.
This was already handled in fold-cost by:
/* A < 0 ? <sign bit of A> : 0 is simply (A & <sign bit of A>). */
I have not removed as we only simplify "a ? POW2 : 0" at the gimple level to "a << CST1"
and fold actually does the reverse of folding "(a<0)<<CST" into "(a<0) ? 1<<CST : 0".
OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.
PR tree-optimization/103218
gcc/ChangeLog:
* match.pd: New pattern for "((type)(a<0)) << SIGNBITOFA".
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/pr103218-1.c: New test.
Jonathan Wakely [Thu, 21 Jul 2016 19:38:51 +0000 (20:38 +0100)]
libstdc++: Fix out-of-bound array accesses in testsuite
I fixed some undefined behaviour in string tests in r238609, but I only
fixed the narrow char versions. This applies the same fixes to the
wchar_t ones. These problems were found when testing a patch to make
std::basic_string usable in constexpr.
libstdc++-v3/ChangeLog:
* testsuite/21_strings/basic_string/modifiers/append/wchar_t/1.cc:
Fix reads past the end of strings.
* testsuite/21_strings/basic_string/operations/compare/wchar_t/1.cc:
Likewise.
* testsuite/experimental/string_view/operations/compare/wchar_t/1.cc:
Likewise.
Jonathan Wakely [Mon, 15 Nov 2021 20:37:04 +0000 (20:37 +0000)]
libstdc++: Fix typos in tests
libstdc++-v3/ChangeLog:
* testsuite/21_strings/basic_string/allocator/71964.cc: Fix
typo.
* testsuite/23_containers/set/allocator/71964.cc: Likewise.
Claudiu Zissulescu [Tue, 16 Nov 2021 10:07:02 +0000 (12:07 +0200)]
arc: Update (u)maddhisi4 patterns
The (u)maddsihi4 patterns are using the ARC's VMAC2H(U)
instruction with null destination, however, VMAC2H(U) doesn't
rewrite the accumulator. This patch solves the destination issue
of VMAC2H by replacing it with DMACH(U) instruction.
gcc/
* config/arc/arc.md (maddhisi4): Use a single move to accumulator.
(umaddhisi4): Likewise.
(machi): Update pattern.
(umachi): Likewise.
gcc/testsuite/
* gcc.target/arc/tmac-4.c: New test.
Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
Richard Biener [Fri, 12 Nov 2021 09:21:22 +0000 (10:21 +0100)]
tree-optimization/102880 - improve CD-DCE
The PR shows a missed control-dependent DCE caused by CFG cleanup
merging a forwarder resulting in a partially degenerate PHI node.
With control-dependent DCE we need to mark control dependences
of incoming edges into PHIs as necessary but that is unnecessarily
conservative for the case when two edges have the same value.
There is no easy way to mark only a subset of control dependences
of both edges necessary so the fix is to produce forwarder blocks
where then the control dependence captures the requirements more
precisely.
For gcc.dg/tree-ssa/ssa-dom-thread-7.c the number of edges in the
CFG decrease as we have commonized PHI arguments which in turn
results in different threadings. The testcase is too complex
and the dump scanning too simple to do anything meaningful here
but to adjust the number of expected threads.
The same CFG massaging could be useful at RTL expansion time to
reduce the number of copies we need to insert on edges.
FAIL: gcc.dg/tree-ssa/ssa-hoist-4.c scan-tree-dump-times optimized "MAX_EXPR" 1
2021-11-12 Richard Biener <rguenther@suse.de>
PR tree-optimization/102880
* tree-ssa-dce.c (sort_phi_args): New function.
(make_forwarders_with_degenerate_phis): Likewise.
(perform_tree_ssa_dce): Call
make_forwarders_with_degenerate_phis.
* gcc.dg/tree-ssa/pr102880.c: New testcase.
* gcc.dg/tree-ssa/pr69270-3.c: Robustify.
* gcc.dg/tree-ssa/ssa-dom-thread-7.c: Change the number of
expected threadings.
Richard Biener [Mon, 15 Nov 2021 14:19:36 +0000 (15:19 +0100)]
tree-optimization/102880 - make PHI-OPT recognize more CFGs
This allows extra edges into the middle BB for the PHI-OPT
transforms using replace_phi_edge_with_variable that do not
end up moving stmts from that middle BB. This avoids regressing
gcc.dg/tree-ssa/ssa-hoist-4.c with the actual fix for PR102880
where CFG cleanup has the choice to remove two forwarders and
picks "the wrong" leading to
if (a > b) /
/\ /
/ <BB>
/ |
# PHI <a, b>
rather than
if (a > b) |
/\ |
<BB> \ |
/ \ |
# PHI <a, b, b>
but it's relatively straight-forward to support extra edges
into the middle-BB in paths ending in replace_phi_edge_with_variable
and that do not require moving stmts. That's because we really
only want to remove the edge from the condition to the middle BB.
Of course actually doing that means updating dominators in non-trival
ways which is why I kept the original code for the single edge
case and simply defer to CFG cleanup by adjusting the condition for
the complicated case.
The testcase needs to be a GIMPLE one since it's quite unreliable
to produce the desired CFG.
2021-11-15 Richard Biener <rguenther@suse.de>
PR tree-optimization/102880
* tree-ssa-phiopt.c (tree_ssa_phiopt_worker): Push
single_pred (bb1) condition to places that really need it.
(match_simplify_replacement): Likewise.
(value_replacement): Likewise.
(replace_phi_edge_with_variable): Deal with extra edges
into the middle BB.
* gcc.dg/tree-ssa/phi-opt-26.c: New testcase.
Claudiu Zissulescu [Tue, 16 Nov 2021 09:41:16 +0000 (11:41 +0200)]
arc: Update arc specific tests
Update assembly output test pattern. Take into consideration also for
which platform we do execute the test (baremetal or linux).
gcc/testsuite/ChangeLog:
* gcc.target/arc/add_n-combine.c: Update test patterns.
* gcc.target/arc/builtin_eh.c: Update test for linux platforms.
* gcc.target/arc/mul64-1.c: Disable this test while running on
linux.
* gcc.target/arc/tls-gd.c: Update matching patterns.
* gcc.target/arc/tls-ie.c: Likewise.
* gcc.target/arc/tls-ld.c: Likewise.
* gcc.target/arc/uncached-8.c: Likewise.
Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
Martin Jambor [Tue, 16 Nov 2021 09:44:54 +0000 (10:44 +0100)]
Replace more DEBUG_EXPR_DECL creations with build_debug_expr_decl
As discussed on the mailing list, this patch replaces all but one
remaining open coded constructions of DEBUG_EXPR_DECL with calls to
build_debug_expr_decl, even if - in order not to introduce any
functional change - the mode of the constructed decl is then
overwritten.
It is not clear if changing the mode has any effect in practice and
therefore I have added a FIXME note to code which does it, as
requested.
After this patch, DEBUG_EXPR_DECLs are created only by
build_debug_expr_decl and make_debug_expr_from_rtl which looks like
it should be left alone.
gcc/ChangeLog:
2021-11-11 Martin Jambor <mjambor@suse.cz>
* cfgexpand.c (expand_gimple_basic_block): Use build_debug_expr_decl,
add a fixme note about the mode assignment perhaps being unnecessary.
* ipa-param-manipulation.c (ipa_param_adjustments::modify_call):
Likewise.
(ipa_param_body_adjustments::mark_dead_statements): Likewise.
(ipa_param_body_adjustments::reset_debug_stmts): Likewise.
* tree-inline.c (remap_ssa_name): Likewise.
(tree_function_versioning): Likewise.
* tree-into-ssa.c (rewrite_debug_stmt_uses): Likewise.
* tree-ssa-loop-ivopts.c (remove_unused_ivs): Likewise.
* tree-ssa.c (insert_debug_temp_for_var_def): Likewise.
Martin Jambor [Tue, 16 Nov 2021 09:44:53 +0000 (10:44 +0100)]
ipa-sra: Testcase that removing a "returns_nonnull" retval works
Since we can now remove return values of functions with return_nonnull
type attribute, I'll feel a bit safer if we can test this does not ICE
when someone attempts to access a non-existent call LHS. Eventually
we should probably drop the attribute when this happens.
gcc/testsuite/ChangeLog:
2021-11-15 Martin Jambor <mjambor@suse.cz>
* gcc.dg/ipa/ipa-sra-ret-nonull.c: New test.
Jakub Jelinek [Tue, 16 Nov 2021 09:21:56 +0000 (10:21 +0100)]
libgomp: Mark thread_limit clause to target construct as implemented
After the Fortran changes we can mark it as implemented...
2021-11-16 Jakub Jelinek <jakub@redhat.com>
* libgomp.texi (OpenMP 5.1): Mark thread_limit clause to target
construct as implemented.
Jakub Jelinek [Tue, 16 Nov 2021 09:19:22 +0000 (10:19 +0100)]
openmp: Regimplify operands of GIMPLE_COND in a few more places [PR103208]
As the testcase shows, the non-rectangular loop expansion code didn't
try to regimplify operands of GIMPLE_CONDs it built in some cases.
I have added a helper function which does that and used it in some places
that were regimplifying already to simplify those spots, plus added it
in a couple of other places where it was needed.
2021-11-16 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/103208
* omp-expand.c (expand_omp_build_cond): New function.
(expand_omp_for_init_counts, expand_omp_for_init_vars,
expand_omp_for_static_nochunk, expand_omp_for_static_chunk): Use it.
* c-c++-common/gomp/loop-11.c: New test.
Jakub Jelinek [Tue, 16 Nov 2021 09:18:25 +0000 (10:18 +0100)]
waccess: Fix up pass_waccess::check_alloc_size_call [PR102009]
This function punts if the builtins have no arguments, but as can be seen
on the testcase, even if it has some arguments but alloc_size attribute's
arguments point to arguments that aren't passed, we get a warning earlier
from the FE but should punt rather than ICE on it.
Other users of alloc_size attribute e.g. in
tree-object-size.c (alloc_object_size) punt similarly and similarly
even in the same TU maybe_warn_nonstring_arg correctly verifies calls have
enough arguments.
2021-11-16 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/102009
* gimple-ssa-warn-access.cc (pass_waccess::check_alloc_size_call):
Punt if any of alloc_size arguments is out of bounds vs. number of
call arguments.
* gcc.dg/pr102009.c: New test.
Roger Sayle [Tue, 16 Nov 2021 08:55:21 +0000 (08:55 +0000)]
x86_64: Avoid rorx rotation instructions with -Os.
This patch teaches the i386 backend to avoid using BMI2's rorx
instructions when optimizing for size. The benefits are shown
with the following example:
unsigned int ror1(unsigned int x) { return (x >> 1) | (x << 31); }
unsigned int ror2(unsigned int x) { return (x >> 2) | (x << 30); }
unsigned int rol2(unsigned int x) { return (x >> 30) | (x << 2); }
unsigned int rol1(unsigned int x) { return (x >> 31) | (x << 1); }
which currently with -Os -march=cascadelake generates:
ror1: rorx $1, %edi, %eax // 6 bytes
ret
ror2: rorx $2, %edi, %eax // 6 bytes
ret
rol2: rorx $30, %edi, %eax // 6 bytes
ret
rol1: rorx $31, %edi, %eax // 6 bytes
ret
but with this patch now generates:
ror1: movl %edi, %eax // 2 bytes
rorl %eax // 2 bytes
ret
ror2: movl %edi, %eax // 2 bytes
rorl $2, %eax // 3 bytes
ret
rol2: movl %edi, %eax // 2 bytes
roll $2, %eax // 3 bytes
ret
rol1: movl %edi, %eax // 2 bytes
roll %eax // 2 bytes
ret
I've confirmed that this patch is a win on the CSiBE benchmark,
even though rotations are rare, where for example libmspack/test/md5.o
shrinks from 5824 bytes to 5632 bytes.
2021-11-16 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
* config/i386/i386.md (*bmi2_rorx<mode3>_1): Make conditional
on !optimize_function_for_size_p.
(*<any_rotate><mode>3_1): Add preferred_for_size attribute.
(define_splits): Conditionalize on !optimize_function_for_size_p.
(*bmi2_rorxsi3_1_zext): Likewise.
(*<any_rotate>si2_1_zext): Add preferred_for_size attribute.
(define_splits): Conditionalize on !optimize_function_for_size_p.
Jan Hubicka [Tue, 16 Nov 2021 08:15:39 +0000 (09:15 +0100)]
Fix uninitialized access in merge_call_side_effects
gcc/ChangeLog:
PR ipa/103262
* ipa-modref.c (merge_call_side_effects): Fix uninitialized
access.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/modref-dse-5.c: New test.
Andrew Pinski [Mon, 15 Nov 2021 22:55:09 +0000 (22:55 +0000)]
tree-optimization: [PR103245] Improve detection of abs pattern using multiplication
So while working on PR 103228 (and a few others), I noticed the testcase for PR 94785
was failing. The problem is that the nop_convert moved from being inside the IOR to be
outside of it. I also noticed the patch for PR 103228 was not needed to reproduce the
issue either.
This patch combines the two patterns together for the abs match when using multiplication
and adds a few places where nop_convert are optional.
OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.
PR tree-optimization/103245
gcc/ChangeLog:
* match.pd: Combine the abs pattern matching using multiplication.
Adding optional nop_convert too.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/pr103245-1.c: New test.
H.J. Lu [Tue, 16 Nov 2021 01:37:10 +0000 (17:37 -0800)]
Add a missing return when transforming atomic bit test and operations
When failing to transform equivalent, but slighly different cases of
atomic bit test and operations to their canonical forms, return
immediately.
gcc/
PR middle-end/103268
* tree-ssa-ccp.c (optimize_atomic_bit_test_and): Add a missing
return.
gcc/testsuite/
PR middle-end/103268
* gcc.dg/pr103268-1.c: New test.
* gcc.dg/pr103268-2.c: Likewise.
Jim Wilson [Tue, 16 Nov 2021 01:02:40 +0000 (17:02 -0800)]
Update my email address.
* MAINTAINERS: Update my address.
GCC Administrator [Tue, 16 Nov 2021 00:16:31 +0000 (00:16 +0000)]
Daily bump.
Jason Merrill [Wed, 13 Oct 2021 15:47:25 +0000 (11:47 -0400)]
c++: Add -fimplicit-constexpr
With each successive C++ standard the restrictions on the use of the
constexpr keyword for functions get weaker and weaker; it recently occurred
to me that it is heading toward the same fate as the C register keyword,
which was once useful for optimization but became obsolete. Similarly, it
seems to me that we should be able to just treat inlines as constexpr
functions and not make people add the extra keyword everywhere.
There were a lot of testcase changes needed; many disabling errors about
non-constexpr functions that are now constexpr, and many disabling implicit
constexpr so that the tests can check the same thing as before, whether
that's mangling or whatever.
gcc/c-family/ChangeLog:
* c.opt: Add -fimplicit-constexpr.
* c-cppbuiltin.c: Define __cpp_implicit_constexpr.
* c-opts.c (c_common_post_options): Disable below C++14.
gcc/cp/ChangeLog:
* cp-tree.h (struct lang_decl_fn): Add implicit_constexpr.
(decl_implicit_constexpr_p): New.
* class.c (type_maybe_constexpr_destructor): Use
TYPE_HAS_TRIVIAL_DESTRUCTOR and maybe_constexpr_fn.
(finalize_literal_type_property): Simplify.
* constexpr.c (is_valid_constexpr_fn): Check for dtor.
(maybe_save_constexpr_fundef): Try to set DECL_DECLARED_CONSTEXPR_P
on inlines.
(cxx_eval_call_expression): Use maybe_constexpr_fn.
(maybe_constexpr_fn): Handle flag_implicit_constexpr.
(var_in_maybe_constexpr_fn): Use maybe_constexpr_fn.
(potential_constant_expression_1): Likewise.
(decl_implicit_constexpr_p): New.
* decl.c (validate_constexpr_redeclaration): Allow change with
-fimplicit-constexpr.
(grok_special_member_properties): Use maybe_constexpr_fn.
* error.c (dump_function_decl): Don't print 'constexpr'
if it's implicit.
* Make-lang.in (check-c++-all): Update.
libstdc++-v3/ChangeLog:
* testsuite/20_util/to_address/1_neg.cc: Adjust error.
* testsuite/26_numerics/random/concept.cc: Adjust asserts.
gcc/testsuite/ChangeLog:
* lib/g++-dg.exp: Handle "impcx".
* lib/target-supports.exp
(check_effective_target_implicit_constexpr): New.
* g++.dg/abi/abi-tag16.C:
* g++.dg/abi/abi-tag18a.C:
* g++.dg/abi/guard4.C:
* g++.dg/abi/lambda-defarg1.C:
* g++.dg/abi/mangle26.C:
* g++.dg/cpp0x/constexpr-diag3.C:
* g++.dg/cpp0x/constexpr-ex1.C:
* g++.dg/cpp0x/constexpr-ice5.C:
* g++.dg/cpp0x/constexpr-incomplete2.C:
* g++.dg/cpp0x/constexpr-memfn1.C:
* g++.dg/cpp0x/constexpr-neg3.C:
* g++.dg/cpp0x/constexpr-specialization.C:
* g++.dg/cpp0x/inh-ctor19.C:
* g++.dg/cpp0x/inh-ctor30.C:
* g++.dg/cpp0x/lambda/lambda-mangle3.C:
* g++.dg/cpp0x/lambda/lambda-mangle5.C:
* g++.dg/cpp1y/auto-fn12.C:
* g++.dg/cpp1y/constexpr-loop5.C:
* g++.dg/cpp1z/constexpr-lambda7.C:
* g++.dg/cpp2a/constexpr-dtor3.C:
* g++.dg/cpp2a/constexpr-new13.C:
* g++.dg/cpp2a/constinit11.C:
* g++.dg/cpp2a/constinit12.C:
* g++.dg/cpp2a/constinit14.C:
* g++.dg/cpp2a/constinit15.C:
* g++.dg/cpp2a/spaceship-constexpr1.C:
* g++.dg/cpp2a/spaceship-eq3.C:
* g++.dg/cpp2a/udlit-class-nttp-neg2.C:
* g++.dg/debug/dwarf2/auto1.C:
* g++.dg/debug/dwarf2/cdtor-1.C:
* g++.dg/debug/dwarf2/lambda1.C:
* g++.dg/debug/dwarf2/pr54508.C:
* g++.dg/debug/dwarf2/pubnames-2.C:
* g++.dg/debug/dwarf2/pubnames-3.C:
* g++.dg/ext/is_literal_type3.C:
* g++.dg/ext/visibility/template7.C:
* g++.dg/gcov/gcov-12.C:
* g++.dg/gcov/gcov-2.C:
* g++.dg/ipa/devirt-35.C:
* g++.dg/ipa/devirt-36.C:
* g++.dg/ipa/devirt-37.C:
* g++.dg/ipa/devirt-44.C:
* g++.dg/ipa/imm-devirt-1.C:
* g++.dg/lookup/builtin5.C:
* g++.dg/lto/inline-crossmodule-1_0.C:
* g++.dg/modules/enum-1_a.C:
* g++.dg/modules/fn-inline-1_c.C:
* g++.dg/modules/pmf-1_b.C:
* g++.dg/modules/used-1_c.C:
* g++.dg/tls/thread_local11.C:
* g++.dg/tls/thread_local11a.C:
* g++.dg/tm/pr46653.C:
* g++.dg/ubsan/pr70035.C:
* g++.old-deja/g++.other/delete6.C:
* g++.dg/modules/pmf-1_a.H:
Adjust for implicit constexpr.
Jason Merrill [Mon, 15 Nov 2021 17:59:08 +0000 (12:59 -0500)]
c++: split_nonconstant_init and flexarrays
split_nonconstant_init was doing the wrong thing for both the initialization
and cleanup here; we know the size from the initializer, and we can pass it
along. This doesn't make the testcase work, since the y destructor is still
broken, but it removes the wrong error for the aggregate initialization.
gcc/cp/ChangeLog:
* typeck2.c (split_nonconstant_init_1): Handle flexarrays better.
gcc/testsuite/ChangeLog:
* g++.dg/ext/flexary37.C: Remove expected error.
Siddhesh Poyarekar [Mon, 15 Nov 2021 17:33:15 +0000 (23:03 +0530)]
gimple-fold: Use ranges to simplify strncat and snprintf
Use ranges for lengths and object sizes in strncat and snprintf to
determine if they can be transformed into simpler operations.
gcc/ChangeLog:
* gimple-fold.c (gimple_fold_builtin_strncat): Use ranges to
determine if it is safe to transform to strcat.
(gimple_fold_builtin_snprintf): Likewise.
gcc/testsuite/ChangeLog:
* gcc.dg/fold-stringops-2.c: Define size_t.
(safe1): Adjust.
(safe4): New test.
* gcc.dg/fold-stringops-3.c: New test.
Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
Siddhesh Poyarekar [Mon, 15 Nov 2021 17:33:14 +0000 (23:03 +0530)]
gimple-fold: Use ranges to simplify _chk calls
Instead of comparing LEN and SIZE only if they are constants, use their
ranges to decide if LEN will always be lower than or same as SIZE.
This change ends up putting the stringop-overflow warning line number
against the strcpy implementation, so adjust the warning check to be
line number agnostic.
gcc/ChangeLog:
* gimple-fold.c (known_lower): New function.
(gimple_fold_builtin_strncat_chk,
gimple_fold_builtin_memory_chk, gimple_fold_builtin_stxcpy_chk,
gimple_fold_builtin_stxncpy_chk,
gimple_fold_builtin_snprintf_chk,
gimple_fold_builtin_sprintf_chk): Use it.
gcc/testsuite/ChangeLog:
* gcc.dg/Wobjsize-1.c: Make warning change line agnostic.
* gcc.dg/fold-stringops-2.c: New test.
Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
Siddhesh Poyarekar [Mon, 15 Nov 2021 17:33:13 +0000 (23:03 +0530)]
gimple-fold: Transform stp*cpy_chk to str*cpy directly
Avoid going through another folding cycle and use the ignore flag to
directly transform BUILT_IN_STPCPY_CHK to BUILT_IN_STRCPY when set,
likewise for BUILT_IN_STPNCPY_CHK to BUILT_IN_STPNCPY.
Dump the transformation in dump_file so that we can verify in tests that
the direct transformation actually happened.
gcc/ChangeLog:
* gimple-fold.c (dump_transformation): New function.
(gimple_fold_builtin_stxcpy_chk,
gimple_fold_builtin_stxncpy_chk): Use it. Simplify to
BUILT_IN_STRNCPY if return value is not used.
gcc/testsuite/ChangeLog:
* gcc.dg/fold-stringops-1.c: New test.
Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
H.J. Lu [Fri, 12 Nov 2021 15:21:43 +0000 (07:21 -0800)]
Check optab before transforming atomic bit test and operations
Check optab before transforming equivalent, but slighly different cases
of atomic bit test and operations to their canonical forms.
gcc/
PR middle-end/103184
* tree-ssa-ccp.c (optimize_atomic_bit_test_and): Check optab
before transforming equivalent, but slighly different cases to
their canonical forms.
gcc/testsuite/
PR middle-end/103184
* gcc.dg/pr103184-1.c: New test.
* gcc.dg/pr103184-2.c: Likewise.
Iain Sandoe [Thu, 4 Nov 2021 09:37:14 +0000 (09:37 +0000)]
IPA: Provide a mechanism to register static DTORs via cxa_atexit.
For at least one target (Darwin) the platform convention is to
register static destructors (i.e. __attribute__((destructor)))
with __cxa_atexit rather than placing them into a list that is
run by some other mechanism.
This patch provides a target hook that allows a target to opt
into this and handling for the process in ipa_cdtor_merge ().
When the mode is enabled (dtors_from_cxa_atexit is set) we:
* Generate new CTORs to register static destructors with
__cxa_atexit and add them to the existing list of CTORs;
we then process the revised CTORs list.
* We sort the DTORs into priority and then TU order, this
means that they are registered in that order with
__cxa_atexit () and therefore will be run in the reverse
order.
* Likewise, CTORs are sorted into priority and then TU order,
which means that they will run in that order.
This matches the behavior of using init/fini (or
mod_init_func/mod_term_func) sections.
This also fixes a bug where Fortran needs a DTOR to be run to
close IO.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR fortran/102992
gcc/ChangeLog:
* config/darwin.h (TARGET_DTORS_FROM_CXA_ATEXIT): New.
* doc/tm.texi: Regenerated.
* doc/tm.texi.in: Add TARGET_DTORS_FROM_CXA_ATEXIT hook.
* ipa.c (cgraph_build_static_cdtor_1): Return the built
function decl.
(build_cxa_atexit_decl): New.
(build_dso_handle_decl): New.
(build_cxa_dtor_registrations): New.
(compare_cdtor_tu_order): New.
(build_cxa_atexit_fns): New.
(ipa_cdtor_merge): If dtors_from_cxa_atexit is set,
process the DTORs/CTORs accordingly.
(pass_ipa_cdtor_merge::gate): Also run if
dtors_from_cxa_atexit is set.
* target.def (dtors_from_cxa_atexit): New hook.
Iain Sandoe [Fri, 12 Nov 2021 17:03:09 +0000 (17:03 +0000)]
configure, Darwin: Check ld64 support for -platform-version.
Newer versions of ld64 allow specifiying the OS target (e.g.
macos or ios) the version and the SDK version all in a single
command. This checks the availability of the command for the
current toolchain.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/ChangeLog:
* config.in: Regenerate.
* configure: Regenerate.
* configure.ac: Test ld64 for -platform-version support.
Iain Sandoe [Sat, 13 Nov 2021 11:58:09 +0000 (11:58 +0000)]
testsuite, Darwin: In tsvc.h, use malloc for Darwin <= 9.
Earlier Darwin versions fdo not have posix_memalign() but the
malloc implementation is guaranteed to produce memory suitably
aligned for the largest vector type.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/testsuite/ChangeLog:
* gcc.dg/vect/tsvc/tsvc.h: Use malloc for Darwin 9 and
earlier.
Iain Sandoe [Fri, 12 Nov 2021 16:36:25 +0000 (16:36 +0000)]
Ada, Darwin : Use DSYMUTIL_FOR_TARGET in libgnat/gnarl builds.
Most of the time we get away with using the dsymutil that is
installed with the latest Xcode, however for some cross-compilation
cases that does not work.
We now have the ability to specify the correct dsymutil to use for
the toolchain (--with-dsymutil=) and we should use that specified
tool for debug link. Fixes cross-compilers from x86-64 to powerpc.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/ada/ChangeLog:
* gcc-interface/Makefile.in: Use DSYMUTIL_FOR_TARGET in
libgnat/libgnarl recipies.
François Dumont [Mon, 25 Oct 2021 13:59:35 +0000 (15:59 +0200)]
libstdc++: Unordered containers merge re-use hash code
When merging 2 unordered containers with same hasher we can re-use the hash code from
the cache if any.
Also in the context of the merge operation on multi-container use previous insert iterator as a hint
for the next insert.
libstdc++-v3/ChangeLog:
* include/bits/hashtable_policy.h:
(_Hash_code_base<>::_M_hash_code(const _Hash&, const _Hash_node_value<_Value, true>&)): New.
(_Hash_code_base<>::_M_hash_code<_H2>(const _H2&, const _Hash_node_value<>&)): New.
* include/bits/hashtable.h (_Hashtable<>::_M_merge_unique): Use latter.
(_Hashtable<>::_M_merge_multi): Likewise.
* testsuite/23_containers/unordered_multiset/modifiers/merge.cc (test05): New test.
* testsuite/23_containers/unordered_set/modifiers/merge.cc (test04): New test.
Thomas Schwinge [Tue, 31 Aug 2021 21:35:15 +0000 (23:35 +0200)]
Use 'location_hash' for 'gcc/diagnostic-spec.h:nowarn_map'
Instead of hard-coded '0'/'UINT_MAX', we now use the 'RESERVED_LOCATION_P'
values 'UNKNOWN_LOCATION'/'BUILTINS_LOCATION' as spare values for
'Empty'/'Deleted', and generally simplify the code.
gcc/
* diagnostic-spec.h (typedef xint_hash_t)
(typedef xint_hash_map_t): Replace with...
(typedef nowarn_map_t): ... this.
(nowarn_map): Adjust.
* diagnostic-spec.c (nowarn_map, suppress_warning_at): Likewise.
Thomas Schwinge [Tue, 31 Aug 2021 21:34:23 +0000 (23:34 +0200)]
Use 'location_hash' for 'seen_locations' in 'gcc/profile.c:branch_prob'
Follow-up to commit
102fcf94e625a2016a65829c73a42bd6c2420376
"Fix GCOV CFG related issues": considering the current
'int_hash <location_t, 0, 2>', per 'libcpp/include/line-map.h':
Actual | Value | Meaning
-----------+-------------------------------+-------------------------------
0x00000000 | UNKNOWN_LOCATION (gcc/input.h)| Unknown/invalid location.
-----------+-------------------------------+-------------------------------
0x00000001 | BUILTINS_LOCATION | The location for declarations
| (gcc/input.h) | in "<built-in>"
-----------+-------------------------------+-------------------------------
0x00000002 | RESERVED_LOCATION_COUNT | The first location to be
| (also | handed out, and the
| ordmap[0]->start_location) | first line in ordmap 0
... this currently uses value '0' ('UNKNOWN_LOCATION') as spare values for
'Empty', and value '2' ('RESERVED_LOCATION_COUNT') as spare values for
'Deleted', which is questionable?
What actually does get put into 'seen_locations' is (mostly...)
restricted/gated by '!RESERVED_LOCATION_P' (which is true unless
'UNKNOWN_LOCATION' or 'BUILTINS_LOCATION'), thus we may simply use
'location_hash'.
gcc/
* profile.c (branch_prob): Use 'location_hash' for
'seen_locations'.
Aldy Hernandez [Sat, 13 Nov 2021 11:16:40 +0000 (12:16 +0100)]
Drop tree overflow in irange setter.
Drop meaningless overflow that may creep into the IL.
gcc/ChangeLog:
PR tree-optimization/103207
* value-range.cc (irange::set): Drop overflow.
gcc/testsuite/ChangeLog:
* gcc.dg/pr103207.c: New test.
Tobias Burnus [Mon, 15 Nov 2021 14:44:11 +0000 (15:44 +0100)]
Fortran: openmp: Add support for thread_limit clause on target
gcc/fortran/ChangeLog:
* openmp.c (OMP_TARGET_CLAUSES): Add thread_limit.
* trans-openmp.c (gfc_split_omp_clauses): Add thread_limit also to
teams.
libgomp/ChangeLog:
* testsuite/libgomp.fortran/thread-limit-1.f90: New test.
Jakub Jelinek [Mon, 15 Nov 2021 13:47:44 +0000 (14:47 +0100)]
testsuite: Add testcase for already fixed PR [PR100469]
This bug introduced in r11-7448-gff92ede8d269375f800e1b347a48f4698874b4a3
has been fixed already by r12-1354-g2d2ed777b23ab6503027039e0adbfe1162f52b2f
aka PR100852 fix.
2021-11-15 Jakub Jelinek <jakub@redhat.com>
PR debug/100469
* g++.dg/opt/pr100469.C: New test.
H.J. Lu [Mon, 15 Nov 2021 13:17:55 +0000 (05:17 -0800)]
x86: Add gcc.target/i386/pr103205-2.c
PR target/103205
* gcc.target/i386/pr103205-2.c: New test.