Commit Graph

191632 Commits

Author SHA1 Message Date
Martin Liska
7dc4d63c64 Support LDPT_GET_SYMBOLS_V3.
That supports skipping of an object file.
2022-02-14 11:31:43 +01:00
Richard Biener
3f10e0d50b middle-end/104497 - gimplification of vector indexing
The following attempts to address gimplification of

   ... = VIEW_CONVERT_EXPR<int[4]>((i & 1) != 0 ? inv : src)[i];

which is problematic since gimplifying the base object
? inv : src produces a register temporary but GIMPLE does not
really support a register as a base for an ARRAY_REF (even
though that's not strictly validated it seems as can be seen
at -O0).  Interestingly the C++ frontend avoids this issue
by emitting the following GENERIC instead:

   ... = (i & 1) != 0 ? VIEW_CONVERT_EXPR<int[4]>(inv)[i] : VIEW_CONVERT_EXPR<int[4]>(src)[i];

The proposed patch below fixes things up when using an rvalue
as the base is OK by emitting a copy from a register base to a
non-register one.  The ?: as lvalue extension seems to be gone
for C, C++ again unwraps the COND_EXPR in that case.

2022-02-11  Richard Biener  <rguenther@suse.de>

	PR middle-end/104497
	* gimplify.cc (gimplify_compound_lval): Make sure the
	base is a non-register if needed and possible.

	* c-c++-common/torture/pr104497.c: New testcase.
2022-02-14 09:12:36 +01:00
GCC Administrator
0d31c8ec3f Daily bump. 2022-02-14 00:16:23 +00:00
Maciej W. Rozycki
4493c5a203 [Ada] PR ada/98724: Alpha/Linux/libada: Use wraplf for Aux_Long_Long_Float
Use the Long Long Float wrapper in terms of Long Float for Alpha/Linux
targets as well, fixing gnatlib compilation errors:

a-nallfl.ads:48:13: warning: intrinsic binding type mismatch on result [enabledby default]
a-nallfl.ads:48:13: warning: intrinsic binding type mismatch on parameter 1 [enabled by default]
a-nallfl.ads:48:13: warning: profile of "Sin" doesn't match the builtin it binds [enabled by default]

etc. with the `alpha-linux-gnu' target.

	gcc/ada/
	PR ada/98724
	PR ada/97504
	* Makefile.rtl (LIBGNAT_TARGET_PAIRS) <alpha*-*-linux*>: Use
	wraplf version of Aux_Long_Long_Float.
2022-02-13 22:57:21 +00:00
Ian Lance Taylor
58aeb75d40 runtime: call timer functions via syscall
It turns out to be painful to require linking against -lrt on
GNU/Linux, as that makes it harder to link Go code into C programs.
Instead just call the timer syscalls directly.  That is what the
upstream library does anyhow.

gcc/go/
	* gospec.cc: Revert 2022-02-09 change:
	(RTLIB, RT_LIBRARY): Don't define.
	(lang_specific_driver): Don't add -lrt if linking statically
	on GNU/Linux.

gotools/
	* configure.ac: Revert 2022-02-09 change:
	(RT_LIBS): Don't define.
	* Makefile.am (check-runtime): Don't set GOLIBS to $(RT_LIBS).
	* configure, Makefile.in: Regenerate.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/385475
2022-02-13 11:03:45 -08:00
Ian Lance Taylor
033ec967ec compiler: don't set ptrmask bit for pointer to notinheap type
Test case is https://go.dev/cl/385454.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/385474
2022-02-13 10:54:26 -08:00
Mikael Morin
57da349397 fortran: Unshare associate var charlen [PR104228]
PR104228 showed that character lengths were shared between associate
variable and associate targets.  This is problematic when the associate
target is itself a variable and gets a variable to hold the length, as
the length variable is added (and all the variables following it in the chain)
to both the associate variable scope and the target variable scope.
This caused an ICE when compiling with -O0 -fsanitize=address.

This change forces the creation of a separate character length for the
associate variable.  It also forces the initialization of the character
length variable to avoid regressing associate_32 and associate_47 tests.

	PR fortran/104228

gcc/fortran/ChangeLog:

	* resolve.cc (resolve_assoc_var): Also create a new character
	length for non-dummy associate targets.
	* trans-stmt.cc (trans_associate_var): Initialize character length
	even if no temporary is used for the associate variable.

gcc/testsuite/ChangeLog:

	* gfortran.dg/asan/associate_58.f90: New test.
	* gfortran.dg/asan/associate_59.f90: New test.
2022-02-13 16:46:46 +01:00
liuhongt
7e204bd2f1 Add vect_recog_cond_expr_convert_pattern.
The pattern converts (cond (cmp a b) (convert c) (convert d))
to (convert (cond (cmp a b) c d)) when
1) types_match (c, d)
2) single_use for (convert c) and (convert d)
3) TYPE_PRECISION (TREE_TYPE (c)) == TYPE_PRECISION (TREE_TYPE (a))
4) INTEGERAL_TYPE_P (TREE_TYPE (c))

The pattern can save packing of mask and data(partial for data, 2 vs
1).

gcc/ChangeLog:

	PR target/103771
	* match.pd (cond_expr_convert_p): New match.
	* tree-vect-patterns.cc (gimple_cond_expr_convert_p): Declare.
	(vect_recog_cond_expr_convert_pattern): New.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr103771-2.c: New test.
	* gcc.target/i386/pr103771-3.c: New test.
2022-02-13 17:57:38 +08:00
GCC Administrator
23756b7063 Daily bump. 2022-02-13 00:16:20 +00:00
Jakub Jelinek
f0c7367b88 asan: Fix up address sanitizer instrumentation of __builtin_alloca* if it can throw [PR104449]
With -fstack-check* __builtin_alloca* can throw and the asan
instrumentation of this builtin wasn't prepared for that case.
The following patch fixes that by replacing the builtin with the
replacement builtin and emitting any further insns on the fallthru
edge.

I haven't touched the hwasan code which most likely suffers from the
same problem.

2022-02-12  Jakub Jelinek  <jakub@redhat.com>

	PR sanitizer/104449
	* asan.cc: Include tree-eh.h.
	(handle_builtin_alloca): Handle the case when __builtin_alloca or
	__builtin_alloca_with_align can throw.

	* gcc.dg/asan/pr104449.c: New test.
	* g++.dg/asan/pr104449.C: New test.
2022-02-12 19:17:44 +01:00
H.J. Lu
5c4258d7c7 x86: Update PR 35513 tests
1. Require linker with GNU_PROPERTY_1_NEEDED support for PR 35513
run-time tests.
2. Compile pr35513-8.c to scan assembly code.

	PR testsuite/104481
	* g++.target/i386/pr35513-1.C: Require property_1_needed target.
	* g++.target/i386/pr35513-2.C: Likewise.
	* gcc.target/i386/pr35513-8.c: Change to compile.
	* lib/target-supports.exp (check_compile): Support assembly code.
	(check_effective_target_property_1_needed): New proc.
2022-02-12 05:41:09 -08:00
Jakub Jelinek
0538d42cdd i386: Fix up cvtsd2ss splitter [PR104502]
The following testcase ICEs, because AVX512F is enabled, AVX512VL is not,
and the cvtsd2ss insn has %xmm0-15 as output operand and %xmm16-31 as
input operand.  For output operand %xmm16+ the splitter just gives up
in such case, but for such input it just emits vmovddup which requires
AVX512VL if either operand is EXT_REX_SSE_REG_P (when it is 128-bit).

The following patch fixes it by treating that case like the pre-SSE3
output != input case - move the input to output and do everything on
the output reg which is known to be < %xmm16.

2022-02-12  Jakub Jelinek  <jakub@redhat.com>

	PR target/104502
	* config/i386/i386.md (cvtsd2ss splitter): If operands[1] is xmm16+
	and AVX512VL isn't available, move operands[1] to operands[0] first.

	* gcc.target/i386/pr104502.c: New test.
2022-02-12 11:17:41 +01:00
Uros Bizjak
edadc7e051 i386: Skip decimal float vector modes in type_natural_mode [PR79754]
2022-02-12  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:

	PR target/79754
	* config/i386/i386.cc (type_natural_mode):
	Skip decimal float vector modes.

gcc/testsuite/ChangeLog:

	PR target/79754
	* gcc.target/i386/pr79754.c: New test.
2022-02-12 10:55:29 +01:00
GCC Administrator
e8d68f0a45 Daily bump. 2022-02-12 00:16:23 +00:00
Iain Sandoe
4c3792d448 LRA, rs6000, Darwin: Amend lo_sum use for forced constants [PR104117].
Two issues resulted in this PR, which manifests when we force a constant into
memory in LRA (in PIC code on Darwin).  The presence of such forced constants
is quite dependent on other RTL optimisations, and it is easy for the issue to
become latent for a specific case.

First, in the Darwin-specific rs6000 backend code, we were not being careful
enough in rejecting invalid symbolic addresses.  Specifically, when generating
PIC code, we require a SYMBOL_REF to be wrapped in an UNSPEC_MACHOPIC_OFFSET.

Second, LRA was attempting to load a register using an invalid lo_sum address.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
Co-authored-by: Vladimir Makarov <vmakarov@redhat.com>

	PR target/104117

gcc/ChangeLog:

	* config/rs6000/rs6000.cc (darwin_rs6000_legitimate_lo_sum_const_p):
	Check for UNSPEC_MACHOPIC_OFFSET wrappers on symbolic addresses when
	emitting PIC code.
	(legitimate_lo_sum_address_p): Likewise.
	* lra-constraints.cc (process_address_1): Do not attempt to emit a reg
	load from an invalid lo_sum address.
2022-02-11 23:52:12 +00:00
Joseph Myers
13caa028f9 Regenerate .pot files.
gcc/po/
	* gcc.pot: Regenerate.

libcpp/po/
	* cpplib.pot: Regenerate.
2022-02-11 23:23:48 +00:00
Joseph Myers
becc9a12a5 preprocessor: Extract messages from cpp_*_at calls for translation
The logic in libcpp/Makefile.in listing diagnostic functions in a call
to xgettext was missing cpp_warning_at, cpp_pedwarning_at and
cpp_error_at, so resulting in some messages not being extracted for
translation; add those functions to those for which messages are
extracted.

Tested with "make cpplib.pot".

	* Makefile.in (po/$(PACKAGE).pot): Also handle cpp_warning_at,
	cpp_pedwarning_at and cpp_error_at.
2022-02-11 23:22:07 +00:00
Joseph Myers
434b2caf5d i18n: fix exgettext handling of C++ sources
The move of source files to .cc names broke most message extraction by
exgettext because it processed .c files with --language=GCC-source but
didn't process .cc files that way.  Fix to process files identified as
C++ that way as well.

Tested with "make gcc.pot".

	* exgettext: Also process C++ sources with --language=GCC-source.
2022-02-11 23:17:24 +00:00
Ian Lance Taylor
8dc2499aa6 libgo: update to Go1.18beta2
gotools/
	* Makefile.am (go_cmd_cgo_files): Add ast_go118.go
	(check-go-tool): Copy golang.org/x/tools directories.
	* Makefile.in: Regenerate.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/384695
2022-02-11 15:01:19 -08:00
Jonathan Wakely
9a56779dbc libstdc++: Fix FAIL: 20_util/temporary_buffer.cc for C++14
The std::get_temporary_buffer function is deprecated since C++17, but
the test was expecting a warning for C++14 as well.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/temporary_buffer.cc: Fix dg-warning target
	selector.
2022-02-11 21:42:22 +00:00
Jonathan Wakely
b02247346e libstdc++: Fix test failures at -O0
libstdc++-v3/ChangeLog:

	* testsuite/20_util/monotonic_buffer_resource/allocate.cc:
	Ignore -Walloc-larger-than warning.
	* testsuite/20_util/unsynchronized_pool_resource/allocate.cc:
	Likewise.
	* testsuite/29_atomics/atomic/cons/user_pod.cc: Compile with -O1
	to avoid linker error for __atomic_is_lock_free.
2022-02-11 21:41:43 +00:00
Jakub Jelinek
9355a8c358 match.pd: Fix up (X & Y) CMP 0 -> X CMP2 ~Y simplifications [PR104499]
The following testcase ICEs on x86_64-linux, because match.pd emits
there a NOP_EXPR cast from int*8 vector type with BLKmode to
unsigned*8 vector type with BLKmode and vec-lowering isn't prepared
to handle such casts.

Fixed by using VIEW_CONVERT_EXPR instead.

2022-02-11  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/104499
	* match.pd ((X & Y) CMP 0 -> X CMP2 ~Y): Use view_convert instead
	of convert.

	* gcc.c-torture/compile/pr104499.c: New test.
2022-02-11 20:27:23 +01:00
Jakub Jelinek
b56ad95854 middle-end: Small __builtin_clear_padding improvements
When looking at __builtin_clear_padding today, I've noticed that
it is quite wasteful to extend the original user one argument to 3,
2 is enough.  We need to encode the original type of the first argument
because pointer conversions are useless in GIMPLE, and we need to record
a boolean whether it is for -ftrivial-auto-var-init=* or not.
But for recording the type we don't need the value (we've always used
zero) and for recording the boolean we don't need the type (we've always
used integer_type_node).
So, this patch merges the two into one.

2022-02-11  Jakub Jelinek  <jakub@redhat.com>

	* tree.cc (build_common_builtin_nodes): Fix up formatting in
	__builtin_clear_padding decl creation.
	* gimplify.cc (gimple_add_padding_init_for_auto_var): Encode
	for_auto_init in the value of 2nd BUILT_IN_CLEAR_PADDING
	argument rather than in 3rd argument.
	(gimplify_call_expr): Likewise.  Fix up comment formatting.
	* gimple-fold.cc (gimple_fold_builtin_clear_padding): Expect
	2 arguments instead of 3, take for_auto_init from the value
	of 2nd argument.
2022-02-11 19:47:14 +01:00
Vladimir N. Makarov
274a4d2942 [PR104400] LRA: Modify exclude start hard register calculation for insn alternative
v850 target has an interesting insn alternative constraint 'e!r' where e
denotes even general regs and e is a subset of r.  We cannot just make
union of exclude start hard registers for e and r and should use only
exclude start hard registers of r.  The following patch implements this.

gcc/ChangeLog:

	PR rtl-optimization/104400
	* lra-constraints.cc (process_alt_operands): Don't make union of
	this_alternative_exclude_start_hard_regs when reg class in insn
	alternative covers other reg classes in the same alternative.

gcc/testsuite/ChangeLog:

	PR rtl-optimization/104400
	* gcc.target/v850/pr104400.c: New.
	* gcc.target/v850/v850.exp: New.
2022-02-11 10:50:01 -05:00
David Malcolm
cc68ad8701 analyzer: ignore uninitialized uses of empty types [PR104274]
PR analyzer/104274 reports a false positive from
-Wanalyzer-use-of-uninitialized-value on hppa when passing
an empty struct as a function parameter.

pa_pass_by_reference returns true for empty structs, so the
call is turned into:

  struct empty arg.0;
  arg.0 = arg
  called_function (arg.0);

by gimplify_parameters.

However, gimplify_modify_expr discards assignments statments
of empty types, so that we end up with:

  struct empty arg.0;
  called_function (arg.0);

which the analyzer considers to be a use of uninitialized "arg.0";

Given that gimplify_modify_expr will discard any assignments to
such types, it seems simplest for -Wanalyzer-use-of-uninitialized-value
to ignore values of empty types.

gcc/analyzer/ChangeLog:
	PR analyzer/104274
	* region-model.cc (region_model::check_for_poison): Ignore
	uninitialized uses of empty types.

gcc/testsuite/ChangeLog:
	PR analyzer/104274
	* gcc.dg/analyzer/torture/empty-struct-1.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-02-11 08:46:05 -05:00
Richard Biener
ae117af439 [gimplefe] Add vector_mask attribute to get access to vector bools
The following adds __attribute__((vector_mask)) to get access to
the corresponding mask type for a vector type.  The implementation
simply uses truth_type_for so creating a mask type that's not
what the target would choose as canonical, say a AVX2 style one
when AVX512VL is enabled, is not possible.  It might be possible
to provide access to that with an optional argument specifying
the precision of the bool element.  The syntax is as simple as

typedef vector_type mask_type __attribute__((vector_mask));

In theory this allows to create unit testcases for vector
lowering and ISEL.

2022-02-11  Richard Biener  <rguenther@suse.de>

gcc/c-family/
	* c-attribs.cc (c_common_attribute_table): Add entry for
	vector_mask.
	(handle_vector_mask_attribute): New.

gcc/c/
	* gimple-parser.cc (c_parser_gimple_statement): Properly parse
	VEC_COND_EXPRs.

gcc/testsuite/
	* gcc.dg/gimplefe-48.c: New testcase.
2022-02-11 13:53:45 +01:00
Jakub Jelinek
84993d94e1 c++: Fix up constant expression __builtin_convertvector folding [PR104472]
The following testcase ICEs, because due to the -frounding-math
fold_const_call fails, which is it returns NULL, and returning NULL from
cxx_eval* is wrong, all the callers rely on them to either return folded
value or original with *non_constant_p = true.

The following patch does that, and additionally falls through into the
default case where there is diagnostics for the !ctx->quiet case too.

2022-02-11  Jakub Jelinek  <jakub@redhat.com>

	PR c++/104472
	* constexpr.cc (cxx_eval_internal_function) <case IFN_VEC_CONVERT>:
	Only return fold_const_call result if it is non-NULL.  Otherwise
	fall through into the default: case to return t, set *non_constant_p
	and emit diagnostics if needed.

	* g++.dg/cpp0x/constexpr-104472.C: New test.
2022-02-11 13:52:44 +01:00
Jakub Jelinek
fb76c0ad35 combine: Fix ICE with substitution of CONST_INT into PRE_DEC argument [PR104446]
The following testcase ICEs, because combine substitutes
(insn 10 9 11 2 (set (reg/v:SI 7 sp [ a ])
        (const_int 0 [0])) "pr104446.c":9:5 81 {*movsi_internal}
     (nil))
(insn 13 11 14 2 (set (mem/f:SI (pre_dec:SI (reg/f:SI 7 sp)) [0  S4 A32])
        (reg:SI 85)) "pr104446.c":10:3 56 {*pushsi2}
     (expr_list:REG_DEAD (reg:SI 85)
        (expr_list:REG_ARGS_SIZE (const_int 16 [0x10])
            (nil))))
forming
(insn 13 11 14 2 (set (mem/f:SI (pre_dec:SI (const_int 0 [0])) [0  S4 A32])
        (reg:SI 85)) "pr104446.c":10:3 56 {*pushsi2}
     (expr_list:REG_DEAD (reg:SI 85)
        (expr_list:REG_ARGS_SIZE (const_int 16 [0x10])
            (nil))))
which is invalid RTL (pre_dec's argument must be a REG).
I know substitution creates various forms of invalid RTL and hopes that
invalid RTL just won't recog.
But unfortunately in this case we ICE before we get to recog, as
try_combine does:
  if (n_auto_inc)
    {
      int new_n_auto_inc = 0;
      for_each_inc_dec (newpat, count_auto_inc, &new_n_auto_inc);

      if (n_auto_inc != new_n_auto_inc)
        {
          if (dump_file && (dump_flags & TDF_DETAILS))
            fprintf (dump_file, "Number of auto_inc expressions changed\n");
          undo_all ();
          return 0;
        }
    }
and for_each_inc_dec under the hood will do e.g. for the PRE_DEC case:
    case PRE_DEC:
    case POST_DEC:
      {
        poly_int64 size = GET_MODE_SIZE (GET_MODE (mem));
        rtx r1 = XEXP (x, 0);
        rtx c = gen_int_mode (-size, GET_MODE (r1));
        return fn (mem, x, r1, r1, c, data);
      }
and that code rightfully expects that the PRE_DEC operand has non-VOIDmode
(as it needs to be a REG) - gen_int_mode for VOIDmode results in ICE.
I think it is better not to emit the clearly invalid RTL during substitution
like we do for other cases, than to adding workarounds for invalid IL
created by combine to rtlanal.cc and perhaps elsewhere.
As for the testcase, of course it is UB at runtime to modify sp that way,
but if such code is never reached, we must compile it, not to ICE on it.
And I don't see why on other targets which use the autoinc rtxes much more
it couldn't happen with other registers.

2022-02-11  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/104446
	* combine.cc (subst): Don't substitute CONST_INTs into RTX_AUTOINC
	operands.

	* gcc.target/i386/pr104446.c: New test.
2022-02-11 13:51:56 +01:00
Richard Biener
72f8d228af middle-end/104496 - fix vectorized_internal_fn_supported_p
This fixes vectorized_internal_fn_supported_p behavior when
facing vector types with an integer mode.

2022-02-11  Richard Biener  <rguenther@suse.de>

	PR middle-end/104496
	* internal-fn.cc (vectorized_internal_fn_supported_p):
	Bail out for integer mode vector types.

	* gcc.target/i386/pr104496.c: New testcase.
2022-02-11 11:28:25 +01:00
Jakub Jelinek
18c8086d65 df: Don't set bbs dirty because of debug insn moves [PR104459]
As mentioned in the PR, we get -fcompare-debug failure, which is caused by
cfg_layout_merge_blocks successfully merging two bbs where both bbs
contained just CODE_LABEL, NOTE_INSN_BASIC_BLOCK and in the -g case both
some debug insns at the end.  cfg_layout_merge_blocks calls
update_bb_for_insn_chain which for the post-label insns in the second block
(except for BARRIERs) calls df_insn_change_bb.  This function changes
the bb of the insns and for notes just punts, but for other insns calls
df_set_bb_dirty.  Now the problem is that because there were only debug
insns and notes in the second block, df_set_bb_dirty is called on both
only in the -g case and not with -g0.  df_set_bb_dirty these days
sets both the BB_MODIFIED flag and marks the bb as dirty, and the former
is what 6 spots in cfgcleanup.cc use in code-generation decisions,
in this case
          may_thread |= (target->flags & BB_MODIFIED) != 0;
in particular.  So, with -g may_thread is true while with -g0 it is not
and we diverge from that point onwards.
I've thought about introducing df_set_bb_dirty_nondebug that wouldn't
set BB_MODIFIED but would mark the bb dirty, but then I went through
history and found changes like:
https://gcc.gnu.org/legacy-ml/gcc-patches/2010-10/msg00059.html
so I've also tried just not calling df_set_bb_dirty for debug insns
at all and it passed x86_64-linux and i686-linux
--enable-checking=yes,rtl,extra,df bootstraps/regtests, so perhaps
that works too.
Now that I look at it again, if we don't need those from %d to %d messages
for debug insns in the dump files, another way to fix it would be just to
change the very first line in the hunk from
  if (!INSN_P (insn))
to
  if (!DEBUG_INSN_P (insn))
Though, df_set_bb_dirty_nondebug which will do everything but
set bb->flags |= BB_MODIFIED is yet another option I can test.
Perhaps even that PR42889 was solely about those 6 decisions in cfgcleanup
(at that point it used df_get_bb_dirty) and not about actually the
recomputation of some of the problems causing different code generations.

2022-02-11  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/104459
	* df-scan.cc (df_insn_change_bb): Don't call df_set_bb_dirty when
	moving DEBUG_INSNs between bbs.

	* gcc.dg/pr104459.c: New test.
2022-02-11 11:21:24 +01:00
liuhongt
165947fecf Add single_use to simplification (uncond_op + vec_cond -> cond_op).
gcc/ChangeLog:

	PR tree-optimization/104479
	* match.pd (uncond_op + vec_cond -> cond_op): Add single_use
	for the dest of uncond_op.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr104479.c: New test.
	* gcc.target/i386/cond_op_shift_w-1.c: Adjust testcase.
2022-02-11 15:46:43 +08:00
Tom de Vries
7cc6a8d00a [testsuite] Require non_strict_prototype in a few tests
Require effective target non_strict_prototype in a few test-cases.

Tested on nvptx.

gcc/testsuite/ChangeLog:

2022-02-10  Tom de Vries  <tdevries@suse.de>

	* gcc.c-torture/compile/pr100576.c: Require effective target
	non_strict_prototype.
	* gcc.c-torture/compile/pr97576.c: Same.
2022-02-11 08:44:20 +01:00
Tom de Vries
893aeac17c [testsuite] Require alloca support in a few tests
Require effective target alloca in a few test-cases.

Tested on nvptx.

gcc/testsuite/ChangeLog:

2022-02-10  Tom de Vries  <tdevries@suse.de>

	* c-c++-common/Walloca-larger-than.c: Require effective target alloca.
	* c-c++-common/Warray-bounds-9.c: Same.
	* c-c++-common/Wdangling-pointer-2.c: Same.
	* c-c++-common/Wdangling-pointer-4.c: Same.
	* c-c++-common/Wdangling-pointer-5.c: Same.
	* c-c++-common/Wdangling-pointer.c: Same.
	* c-c++-common/auto-init-11.c: Same.
	* c-c++-common/auto-init-12.c: Same.
	* c-c++-common/auto-init-15.c: Same.
	* c-c++-common/auto-init-16.c: Same.
	* c-c++-common/torture/builtin-clear-padding-4.c: Same.
	* gcc.c-torture/compile/pr99787-1.c: Same.
	* gcc.dg/Walloca-larger-than-4.c: Same.
	* gcc.dg/Wdangling-pointer.c: Same.
	* gcc.dg/Wfree-nonheap-object-2.c: Same.
	* gcc.dg/Wfree-nonheap-object.c: Same.
	* gcc.dg/Wstringop-overflow-56.c: Same.
	* gcc.dg/Wstringop-overflow-57.c: Same.
	* gcc.dg/Wstringop-overflow-67.c: Same.
	* gcc.dg/Wstringop-overflow-71.c: Same.
	* gcc.dg/Wvla-larger-than-5.c: Same.
	* gcc.dg/analyzer/taint-alloc-1.c: Same.
	* gcc.dg/analyzer/torture/ubsan-1.c: Same.
	* gcc.dg/graphite/pr99085.c: Same.
	* gcc.dg/pr100225.c: Same.
	* gcc.dg/pr98721-1.c: Same.
	* gcc.dg/pr99122-2.c: Same.
	* gcc.dg/sso-14.c: Same.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-25.c: Same.
	* gcc.dg/uninit-38.c: Same.
	* gcc.dg/uninit-39.c: Same.
	* gcc.dg/uninit-41.c: Same.
	* gcc.dg/uninit-pr100250.c: Same.
	* gcc.dg/uninit-pr101300.c: Same.
	* gcc.dg/uninit-pr101494.c: Same.
	* gcc.dg/uninit-pr98578.c: Same.
	* gcc.dg/uninit-pr98583.c: Same.
	* gcc.dg/vla-stexp-1.c: Same.
	* gcc.dg/vla-stexp-2.c: Same.
	* gcc.dg/vla-stexp-4.c: Same.
	* gcc.dg/vla-stexp-5.c: Same.
2022-02-11 08:44:07 +01:00
Tom de Vries
fd64b09217 [nvptx] Handle asm insn in prevent_branch_around_nothing
With GOMP_NVPTX_JIT=-00 and -mptx=3.1, I run into:
...
FAIL: libgomp.oacc-c/../libgomp.oacc-c-c++-common/acc_prof-version-1.c \
  -DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 -foffload=nvptx-none  -O2 \
  execution test
...

The problem is that we're generating a diverging branch around nothing:
...
        {
                .reg.u32        %x;
                mov.u32 %x, %tid.x;
                setp.ne.u32     %r23, %x, 0;
        }
        @%r23   bra     $L2;
$L2:
...
which the driver JIT has problems with at -O0, so consequently we run into the
nvptx_uniform_warp_check.

Fix this by handling asm ("") and alike in prevent_branch_around_nothing.

Tested on x86_64 with nvptx accelerator.

gcc/ChangeLog:

2022-02-10  Tom de Vries  <tdevries@suse.de>

	PR target/104456
	* config/nvptx/nvptx.cc (prevent_branch_around_nothing): Handle asm
	insn.
2022-02-11 08:43:14 +01:00
GCC Administrator
a645583d4d Daily bump. 2022-02-11 00:16:25 +00:00
Jakub Jelinek
50243f4918 testsuite: Fix up g++.dg/warn/Wuninitialized-32.C test for ilp32 [PR104373]
The testcase FAILs whenever size_t is not unsigned long:
FAIL: g++.dg/warn/Wuninitialized-32.C  -std=c++98 (test for excess errors)
Excess errors:
.../gcc/testsuite/g++.dg/warn/Wuninitialized-32.C:4:7: error: 'operator new' takes type 'size_t' ('unsigned int') as first parameter [-fpermissive]

Fixed by using __SIZE_TYPE__ instead of unsigned long.

2022-02-11  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/104373
	* g++.dg/warn/Wuninitialized-32.C (operator new[]): Use __SIZE_TYPE__
	as type of the first argument instead of unsigned long.
2022-02-11 00:27:11 +01:00
Jason Merrill
db84f382ae c++: ICE on xtreme-header_a.H
This test regressed after my PR103752 patch with -march=cascadelake.  I
don't understand why that flag makes a difference, but this patch is correct
in any case.

gcc/cp/ChangeLog:

	* module.cc (depset:#️⃣:add_specializations): Use
	STRIP_TEMPLATE.
2022-02-10 15:32:19 -05:00
Thomas Rodgers
b25a7c05f1 libstdc++: Strengthen memory order for atomic<T>::wait/notify
This changes the memory order used in the spin wait code to match
that of libc++.

libstdc++-v3/ChangeLog:
	* include/bits/atomic_wait.h (__waiter_base::_S_do_spin,
	__waiter_base::_S_do_spin_v): Change memory order from relaxed
	to acquire.
2022-02-10 10:14:36 -08:00
Tobias Burnus
c22f3fb780 OpenMP/C++: Permit mapping classes with virtual members [PR102204]
PR c++/102204
gcc/cp/ChangeLog:

	* decl2.cc (cp_omp_mappable_type_1): Remove check for virtual
	members as those are permitted since OpenMP 5.0.

libgomp/ChangeLog:

	* testsuite/libgomp.c++/target-virtual-1.C: New test.

gcc/testsuite/ChangeLog:

	* g++.dg/gomp/unmappable-1.C: Remove previously expected dg-message.
2022-02-10 19:03:42 +01:00
David Malcolm
2ac7b19f1e analyzer: handle more casts of string literals [PR98797]
gcc/analyzer/ChangeLog:
	PR analyzer/98797
	* region-model-manager.cc
	(region_model_manager::maybe_fold_sub_svalue): Generalize getting
	individual chars of a STRING_CST from element_region to any
	subregion which is a concrete access of a single byte from its
	parent region.
	* region.cc (region::get_relative_concrete_byte_range): New.
	* region.h (region::get_relative_concrete_byte_range): New decl.

gcc/testsuite/ChangeLog:
	PR analyzer/98797
	* gcc.dg/analyzer/casts-1.c: Mark xfails as fixed; add further
	test coverage for casts of string literals.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-02-10 13:00:58 -05:00
Qing Zhao
b32305b41d middle-end: updating the reg use in exit block for -fzero-call-used-regs [PR100775]
In the pass_zero_call_used_regs, when updating dataflow info after adding
the register zeroing sequence in the epilogue of the function, we should
call "df_update_exit_block_uses" to update the register use information in
the exit block to include all the registers that have been zeroed.

2022-02-10  Qing Zhao  <qing.zhao@oracle.com>

gcc/ChangeLog:

	PR middle-end/100775
	* function.cc (gen_call_used_regs_seq): Call
	df_update_exit_block_uses when updating df.

gcc/testsuite/ChangeLog:

	PR middle-end/100775
	* gcc.target/arm/pr100775.c: New test.
2022-02-10 16:40:39 +00:00
Uros Bizjak
53fcc46339 i386: Fix vec_unpacks_float_lo_v4si operand constraint [PR104469]
2022-02-10  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:

	PR target/104469
	* config/i386/sse.md (vec_unpacks_float_lo_v4si):
	Change operand 1 constraint to register_operand.

gcc/testsuite/ChangeLog:

	PR target/104469
	* gcc.target/i386/pr104469.c: New test.
2022-02-10 17:23:59 +01:00
H.J. Lu
69febe8527 pr104458.c: Replace long with long long for -mx32
PR target/104458
	* gcc.target/i386/pr104458.c: Replace long with long long.
2022-02-10 06:28:17 -08:00
David Malcolm
8383d41d70 analyzer: fix testsuite issues seen with mingw [PR102052]
gcc/testsuite/ChangeLog:
	PR analyzer/102052
	* gcc.dg/analyzer/fields.c (size_t): Use __SIZE_TYPE__ rather than
	hardcoding long unsigned int.
	* gcc.dg/analyzer/gzio-3.c (size_t): Likewise.
	* gcc.dg/analyzer/gzio-3a.c (size_t): Likewise.
	* gcc.dg/analyzer/pr98969.c (test_1): Use __UINTPTR_TYPE__ rather
	than long int.
	(test_2): Likewise.
	* gcc.dg/analyzer/pr99716-2.c (test_mountpoint): Use "rand" rather
	than "random".
	* gcc.dg/analyzer/pr99774-1.c (size_t): Use __SIZE_TYPE__ rather
	than hardcoding long unsigned int.
	* gcc.dg/analyzer/strndup-1.c: Add MinGW to targets that don't
	implement strndup.
	* gcc.dg/analyzer/zlib-5.c (size_t): Use __SIZE_TYPE__ rather
	than hardcoding long unsigned int.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-02-10 09:13:46 -05:00
Patrick Palka
3d7341cd73 c++: memfn lookup consistency and dependent using-decls
Rather than not doing any filtering when filter_memfn_lookup encounters
a dependent using-decl, handle this case less imprecisely by holding on
to the members in the new lookup set that come from a base, i.e. that
could plausibly have been introduced by that using-decl, and filtering
the rest as usual.  This is still imperfect, but it's closer to the
correct answer than the previous behavior was.

gcc/cp/ChangeLog:

	* pt.cc (filter_memfn_lookup): Handle dependent USING_DECL
	better.
2022-02-10 08:54:07 -05:00
Roger Sayle
3881e1823c gfortran: Respect target's NO_DOT_IN_LABEL in trans-common.cc
This patch fixes 9 unexpected failures in the gfortran testsuite on
nvptx-none.  The issue is that gfortran's EQUIVALENCE internally uses
symbols such as "equiv.0" even on platforms that define NO_DOT_IN_LABEL.
On nvptx-none, this then results in the following error message(s):
ptxas application ptx input, fatal: Parsing error near '.0': syntax error
ptxas fatal: Ptx assembly aborted due to errors

The fix is to tweak trans-common.cc to respect the target's NO_DOT_IN_LABEL
(and NO_DOLLAR_IN_LABEL) when generating internal equiv.%d symbols.
Only the nvptx, mmix and xtensa backends define NO_DOT_IN_LABEL which
explains why no-one has spotted/fixed this issue since the problematic
code was last changed back in 2005(!).

2022-02-10  Roger Sayle  <roger@nextmovesoftware.com>
	    Tobias Burnus  <tobias@codesourcery.com>

gcc/fortran/ChangeLog
	* trans-common.cc (GFC_EQUIV_FMT): New macro respecting the
	target's NO_DOT_IN_LABEL and NO_DOLLAR_IN_LABEL preferences.
	(build_equiv_decl): Use GFC_EQUIV_FMT here.
2022-02-10 13:32:07 +00:00
Jonathan Wakely
3e539985cc libstdc++: Add atomic_fetch_xor to <stdatomic.h>
This function (and the explicit memory over version) are present in both
C++ <atomic> and C <stdatomic.h>, so should be in C++ <stdatomic.h> too.
There is a library issue incoming for this, but the resolution is
obvious.

libstdc++-v3/ChangeLog:

	* include/c_compatibility/stdatomic.h (atomic_fetch_xor): Add
	using-declaration.
	(atomic_fetch_xor_explicit): Likewise.
	* testsuite/29_atomics/headers/stdatomic.h/c_compat.cc: Check
	arithmetic and logical operations for atomic_int.
2022-02-10 13:01:10 +00:00
Jonathan Wakely
3d5f4f76e6 libstdc++: Fix directory iterator build for newlib
When building for newlib HAVE_OPENAT and HAVE_UNLINKAT are (sometimes?)
defined, but <fcntl.h> is only included when HAVE_DIRENT_H is defined.
Since directory iterators are completely useless without <dirent.h>,
just override the HAVE_OPENAT and HAVE_UNLINKAT detection when we don't
have <dirent.h>.

libstdc++-v3/ChangeLog:

	* src/filesystem/dir-common.h (_GLIBCXX_HAVE_DIRFD): Undefine
	when <dirent.h> is not available.
	(_GLIBCXX_HAVE_UNLINKAT):  Likewise.
2022-02-10 13:01:10 +00:00
Richard Biener
0f58ba4dd6 tree-optimization/104373 - early diagnostic on unreachable code
The following improves early uninit diagnostics by computing edge
reachability using VN and ignoring unreachable blocks when looking
for uninitialized uses.  To not ICE with -fdump-tree-all the
early uninit pass needs a dumpfile since VN tries to dump statistics.

2022-02-04  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/104373
	* tree-ssa-sccvn.h (do_rpo_vn): New export exposing the
	walk kind.
	* tree-ssa-sccvn.cc (do_rpo_vn): Export, get the default
	walk kind as argument.
	(run_rpo_vn): Adjust.
	(pass_fre::execute): Likewise.
	* tree-ssa-uninit.cc (warn_uninitialized_vars): Skip
	blocks not reachable.
	(execute_late_warn_uninitialized): Mark all edges as
	executable.
	(execute_early_warn_uninitialized): Use VN to compute
	executable edges.
	(pass_data_early_warn_uninitialized): Enable a dump file,
	change dump name to warn_uninit.

	* g++.dg/warn/Wuninitialized-32.C: New testcase.
	* gcc.dg/uninit-pr20644-O0.c: Remove XFAIL.
2022-02-10 10:56:14 +01:00
Richard Biener
4a8083285c middle-end/104467 - fix vector extract simplification
This fixes a bogus vector type used for a CTOR build as part of
vector extract simplification.  The code failed to consider a
CTOR of vector elements.

2022-02-10  Richard Biener  <rguenther@suse.de>

	PR middle-end/104467
	* match.pd (vector extract simplification): Multiply the
	number of CTOR elements with the number of element elements.

	* gcc.dg/torture/pr104467.c: New testcase.
2022-02-10 10:54:43 +01:00