Commit Graph

191981 Commits

Author SHA1 Message Date
GCC Administrator
8cc4f9cd82 Daily bump. 2022-03-10 00:16:28 +00:00
Patrick Palka
65857caee8 libstdc++: Avoid implicit narrowing from uint128_t [PR104859]
We need to be explicit about narrowing conversions from uint128_t since,
on targets that lack __int128, this type is defined as an integer-class
type that is only _explicitly_ convertible to the builtin integer types.
This issue was latent until r12-7563-ge32869a17b788b made the frontend
correctly reject explicit conversion functions during (dependent)
copy-initialization.

	PR libstdc++/104859

libstdc++-v3/ChangeLog:

	* src/c++17/floating_to_chars.cc (__floating_to_chars_hex):
	Be explicit when narrowing the shifted effective_mantissa,
	since it may have an integer-class type.
2022-03-09 18:48:52 -05:00
Joseph Myers
4ea128d5c7 c: Revert C2x changes to function type compatibility
In commit cc80612621, I implemented
changes that C2x had made to compatibility of unprototyped and
prototyped function types.

C2x has since completely removed unprototyped function types, making
() in a function declaration mean (void) as in C++.  While that change
isn't appropriate at the current development stage for GCC 12, it does
mean that it doesn't make sense for GCC 12 to have different rules for
unprototyped functions in C2x mode than in other modes or previous and
subsequent GCC versions.  Thus, revert the previous change to avoid it
getting into a GCC release, and update the corresponding tests to
expect the same behavior with -std=c2x as with -std=c11 (they will of
course need to change again after implementing () as meaning (void)).

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

gcc/c/
	* c-typeck.cc (function_types_compatible_p): Do not handle C2X
	differently from earlier standards for unprototyped function type
	compatibility.

gcc/testsuite/
	* gcc.dg/c11-unproto-1.c, gcc.dg/c11-unproto-2.c: Update comments.
	* gcc.dg/c2x-unproto-1.c, gcc.dg/c2x-unproto-2.c: Expect same
	results as in C11 mode.  Update comments.
2022-03-09 22:51:23 +00:00
Harald Anlauf
22015e77d3 Fortran: improve error recovery on invalid array section
gcc/fortran/ChangeLog:

	PR fortran/104849
	* expr.cc (find_array_section): Avoid NULL pointer dereference on
	invalid array section.

gcc/testsuite/ChangeLog:

	PR fortran/104849
	* gfortran.dg/pr104849.f90: New test.
2022-03-09 21:58:26 +01:00
Hans-Peter Nilsson
e2607d71e5 toplevel: Makefile.def: Make configure-sim depend on all-readline
Without this, a "make all-sim" without the equivalent of
libreadline-dev installed on the build system, won't
properly pick up the in-tree readline build, and you'll see:

mkdir -p -- ./sim
Configuring in ./sim
configure: creating cache ./config.cache
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... cris-axis-elf
checking for x86_64-pc-linux-gnu-gcc... gcc
checking whether the C compiler works... yes
...
checking for library containing tgetent... -ltermcap
checking for readline in -lreadline... no
configure: error: the required "readline" library is missing
make[1]: *** [Makefile:11188: configure-sim] Error 1
make[1]: Leaving directory '/home/hp/sim/b'

The sim dependency on readline is apparently (nominally)
valid as there's a readline call in sim/erc32/sis.c.

2022-02-21  Hans-Peter Nilsson  <hp@axis.com>

	* Makefile.def (dependencies): Make configure-sim depend on
	all-readline.
	* Makefile.in: Regenerate.
2022-03-09 20:54:37 +01:00
Tobias Burnus
450526551d GCN: Implement __atomic_compare_exchange_{1,2} in libgcc [PR102215]
libgcc/ChangeLog:

	PR target/102215
	* config/gcn/atomic.c (__sync_val_compare_and_swap_##SIZE): Move
	a line up to non-arg-dependent value first.
	(__ATOMIC_COMPARE_EXCHANGE): Define + call to generate
	__atomic_compare_exchange_{1,2}.
2022-03-09 19:34:48 +01:00
Richard Biener
bded0d549f Restore INDIRECT_REF asm operand heuristic with MEM_REF
As noticed we are looking for INDIRECT_REF with allows_mem to avoid
a copy since then we're sure the operand is in memory (assuming
*& is folded).  But INDIRECT_REFs are no longer a thing, the following
replaces the check with a check for a MEM_REF with a non-ADDR_EXPR
operand.  This should fix the regression part without fully
exploring all possibilities around tcc_reference operands.

I've placed an assert that we do not see an INDIRECT_REF here.
While we gimplify asm operands we never do any checking on its
IL afterwards.

2022-03-09  Richard Biener  <rguenther@suse.de>

	* cfgexpand.cc (expand_gimple_asm): Special-case MEM_REF
	with non-decl operand, avoiding a copy.
2022-03-09 15:56:23 +01:00
Jakub Jelinek
caa6c33c5d x86: Define LIBGCC2_UNWIND_ATTRIBUTE on ia32 [PR104781]
On Mon, Mar 07, 2022 at 07:06:28AM -0800, H.J. Lu wrote:
> Since eh_return doesn't work with stack realignment, disable SSE on
> unwind-c.c and unwind-dw2.c to avoid stack realignment with the 4-byte
> incoming stack to avoid SSE usage which is caused by

The following change does that using LIBGCC2_UNWIND_ATTRIBUTE macro instead,
for ia32 only by forcing -mgeneral-regs-only on routines that call
__builtin_eh_return in libgcc.

2022-03-09  Jakub Jelinek  <jakub@redhat.com>

	PR target/104781
	* config/i386/i386.h (LIBGCC2_UNWIND_ATTRIBUTE): Define for ia32.
2022-03-09 15:25:30 +01:00
Patrick Palka
ec0f53a3a5 c++: non-constant non-dependent decltype folding [PR104823]
When processing a non-dependent decltype operand we want to instantiate
it even if it's non-constant, since non-dependent decltype is always
resolved ahead of time.  But currently finish_decltype_type uses
instantiate_non_dependent_expr, which instantiates only potentially
constant expressions, and this causes us to miss diagnosing the narrowing
conversion in S{id(v)} in the below testcase because we never instantiate
this non-constant non-dependent decltype operand.

In light of

  > On Mon, 7 Mar 2022, Jason Merrill wrote:
  >> On 3/7/22 14:41, Patrick Palka wrote:
  >>> instantiate_non_dependent_expr instantiates only potentially constant
  >>> expressions
  >>
  >> Hmm, that now strikes me as a problematic interface, as we don't know whether
  >> what we get back is template or non-template trees.

this patch drops the potentially-constant check in i_n_d_e and turns
its dependence check into a checking_assert, since most callers already
check that the argument is non-dependent; thus i_n_d_e now instantiates
even non-constant expressions and always returns non-templated trees.
This patch also relaxes the dependence check in i_n_d_e to use the
_uneval version (since that's what finish_decltype_type uses) and
strengthens the dependence checks used by other callers accordingly.

In cp_parser_parenthesized_expression_list_elt we were calling
instantiate_non_dependent_expr (when parsing an attribute list) without
first checking for non-dependence.  We could fix this by guarding the
call appropriately, but I noticed we also fold non-dependent attributes
later from cp_check_const_attribute, so this earlier folding is at best
redundant.  And it currently causes us to reject constexpr-attribute4.C
below due to the second folding seeing non-templated trees.  Thus the
right solution here seems to be to remove this unguarded call to i_n_d_e
so that we end up instantiating non-dependent attributes only once.

Finally, after calling i_n_d_e in finish_decltype_type we need to keep
processing_template_decl cleared for sake of the later call to
lvalue_kind, which handles templated and non-templated COND_EXPR
differently.  Otherwise we'd incorrectly reject the declaration of g in
cpp0x/cond2.C with:

  error: 'g' declared as function returning a function

	PR c++/104823

gcc/cp/ChangeLog:

	* except.cc (build_noexcept_spec): Strengthen dependence check
	to instantiation_dependent_expression_p.
	* parser.cc (cp_parser_parenthesized_expression_list_elt):
	Remove fold_expr_p parameter, and don't call
	instantiate_non_dependent_expr.
	(cp_parser_parenthesized_expression_list): Adjust accordingly.
	* pt.cc (expand_integer_pack): Strengthen dependence check
	to instantiation_dependent_expression_p.
	(instantiate_non_dependent_expr_internal): Adjust comment.
	(instantiate_non_dependent_expr_sfinae): Likewise.  Drop
	the potentially-constant check, and relax and turn the
	dependence check into a checking assert.
	(instantiate_non_dependent_or_null): Adjust comment.
	* semantics.cc (finish_decltype_type): Keep
	processing_template_decl cleared after calling
	instantiate_non_dependent_expr_sfinae.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/Wnarrowing19.C: New test.
2022-03-09 08:42:37 -05:00
Patrick Palka
e32869a17b c++: detecting copy-init context during CTAD [PR102137]
Here we're failing to communicate to cp_finish_decl from tsubst_expr
that we're in a copy-initialization context (via the LOOKUP_ONLYCONVERTING
flag), which causes us to always consider explicit deduction guides when
performing CTAD for a templated variable initializer.

It turns out this bug also affects consideration of explicit conversion
operators for the same reason.  But consideration of explicit constructors
seems unaffacted thanks to code in build_aggr_init that sets
LOOKUP_ONLYCONVERTING when the initializer represents copy-initialization.

So this patch fixes this by making cp_finish_decl set LOOKUP_ONLYCONVERTING
just like build_aggr_init does, by inspecting the initializer, so that
callers don't need to explicitly pass this flag appropriately.

	PR c++/102137
	PR c++/87820

gcc/cp/ChangeLog:

	* cp-tree.h (is_copy_initialization): Declare.
	* decl.cc (cp_finish_decl): Set LOOKUP_ONLYCONVERTING
	when is_copy_initialization is true.
	* init.cc (build_aggr_init): Split out copy-initialization
	check into ...
	(is_copy_initialization): ... here.
	* pt.cc (instantiate_decl): Pass 0 instead of
	LOOKUP_ONLYCONVERTING as flags to cp_finish_decl.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/explicit15.C: New test.
	* g++.dg/cpp1z/class-deduction108.C: New test.
2022-03-09 08:42:32 -05:00
Patrick Palka
fe548eb843 c++: merge default targs for function templates [PR65396]
We currently merge default template arguments for class templates, but
not for function templates.  This patch fixes this by factoring out the
argument merging logic in redeclare_class_template into a separate
function and using it in duplicate_decls as well.

	PR c++/65396

gcc/cp/ChangeLog:

	* cp-tree.h (merge_default_template_args): Declare.
	* decl.cc (merge_default_template_args): Define, factored out
	from redeclare_class_template.
	(duplicate_decls): Use it when merging member function template
	and free function declarations.
	* pt.cc (redeclare_class_template): Factor out default argument
	merging logic into merge_default_template_args.  Improve location
	of a note when there's a template parameter kind mismatch.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/vt-34314.C: Adjust expected location of
	"redeclared here" note.
	* g++.dg/template/pr92440.C: Likewise.
	* g++.old-deja/g++.pt/redecl1.C: Adjust expected location of
	"redefinition of default argument" error.
	* g++.dg/template/defarg23.C: New test.
	* g++.dg/template/defarg23a.C: New test.
2022-03-09 08:42:19 -05:00
Richard Biener
4470e813b0 testsuite/104759 - adjust gcc.dg/vect/vect-multitypes-12.c
This adjusts gcc.dg/vect/vect-multitypes-12.c to just look for the
interesting loop vectorization.

2022-03-09  Richard Biener  <rguenther@suse.de>

	PR testsuite/104759
	* gcc.dg/vect/vect-multitypes-12.c: Adjust.
2022-03-09 14:37:35 +01:00
Richard Biener
ba3ff5e351 middle-end/104786 - ICE with asm and VLA
The following fixes an ICE observed with a MEM_REF allows_mem asm
operand referencing a VLA.  The following makes sure to not attempt
to go the temporary creation way when we cannot.

2022-03-09  Richard Biener  <rguenther@suse.de>

	PR middle-end/104786
	* cfgexpand.cc (expand_asm_stmt): Do not generate a copy
	for VLAs without an upper size bound.

	* gcc.dg/pr104786.c: New testcase.
2022-03-09 14:37:02 +01:00
Xi Ruoyao
1c7b110e1e
vect: fix out-of-bound access in supports_vec_convert_optab_p [PR 104851]
Calling VECTOR_MODE_P with MAX_MACHINE_MODE has caused out-of-bound
access.

gcc/

	PR tree-optimization/104851
	* optabs-query.cc (supports_vec_convert_optab_p): Fix off-by-one
	error.
2022-03-09 17:27:23 +08:00
Tobias Burnus
a5c9b7c4f9 Fortran: Fix CLASS handling in SIZEOF intrinsic
gcc/fortran/ChangeLog:

	* trans-intrinsic.cc (gfc_conv_intrinsic_sizeof): Fix CLASS handling.

gcc/testsuite/ChangeLog:

	* gfortran.dg/sizeof_6.f90: New test.
2022-03-09 10:26:15 +01:00
Jakub Jelinek
d76511138d c, c++, c-family: -Wshift-negative-value and -Wshift-overflow* tweaks for -fwrapv and C++20+ [PR104711]
As mentioned in the PR, different standards have different definition
on what is an UB left shift.  They all agree on out of bounds (including
negative) shift count.
The rules used by ubsan are:
C99-C2x ((unsigned) x >> (uprecm1 - y)) != 0 then UB
C++11-C++17 x < 0 || ((unsigned) x >> (uprecm1 - y)) > 1 then UB
C++20 and later everything is well defined
Now, for C++20, I've in the P1236R1 implementation added an early
exit for -Wshift-overflow* warning so that it never warns, but apparently
-Wshift-negative-value remained as is.  As it is well defined in C++20,
the following patch doesn't enable -Wshift-negative-value from -Wextra
anymore for C++20 and later, if users want for compatibility with C++17
and earlier get the warning, they still can by using -Wshift-negative-value
explicitly.
Another thing is -fwrapv, that is an extension to the standards, so it is up
to us how exactly we define that case.  Our ubsan code treats
TYPE_OVERFLOW_WRAPS (type0) and cxx_dialect >= cxx20 the same as only
diagnosing out of bounds shift count and nothing else and IMHO it is most
sensical to treat -fwrapv signed left shifts the same as C++20 treats
them, https://eel.is/c++draft/expr.shift#2
"The value of E1 << E2 is the unique value congruent to E1×2^E2 modulo 2^N,
where N is the width of the type of the result.
[Note 1: E1 is left-shifted E2 bit positions; vacated bits are zero-filled.
— end note]"
with no UB dependent on the E1 values.  The UB is only
"The behavior is undefined if the right operand is negative, or greater
than or equal to the width of the promoted left operand."
Under the hood (except for FEs and ubsan from FEs) GCC middle-end doesn't
consider UB in left shifts dependent on the first operand's value, only
the out of bounds shifts.

While this change isn't a regression, I'd think it is useful for GCC 12,
it doesn't add new warnings, but just removes warnings that aren't
appropriate.

2022-03-09  Jakub Jelinek  <jakub@redhat.com>

	PR c/104711
gcc/
	* doc/invoke.texi (-Wextra): Document that -Wshift-negative-value
	is enabled by it only for C++11 to C++17 rather than for C++03 or
	later.
	(-Wshift-negative-value): Similarly (except here we stated
	that it is enabled for C++11 or later).
gcc/c-family/
	* c-opts.cc (c_common_post_options): Don't enable
	-Wshift-negative-value from -Wextra for C++20 or later.
	* c-ubsan.cc (ubsan_instrument_shift): Adjust comments.
	* c-warn.cc (maybe_warn_shift_overflow): Use TYPE_OVERFLOW_WRAPS
	instead of TYPE_UNSIGNED.
gcc/c/
	* c-fold.cc (c_fully_fold_internal): Don't emit
	-Wshift-negative-value warning if TYPE_OVERFLOW_WRAPS.
	* c-typeck.cc (build_binary_op): Likewise.
gcc/cp/
	* constexpr.cc (cxx_eval_check_shift_p): Use TYPE_OVERFLOW_WRAPS
	instead of TYPE_UNSIGNED.
	* typeck.cc (cp_build_binary_op): Don't emit
	-Wshift-negative-value warning if TYPE_OVERFLOW_WRAPS.
gcc/testsuite/
	* c-c++-common/Wshift-negative-value-1.c: Remove
	dg-additional-options, instead in target selectors of each diagnostic
	check for exact C++ versions where it should be diagnosed.
	* c-c++-common/Wshift-negative-value-2.c: Likewise.
	* c-c++-common/Wshift-negative-value-3.c: Likewise.
	* c-c++-common/Wshift-negative-value-4.c: Likewise.
	* c-c++-common/Wshift-negative-value-7.c: New test.
	* c-c++-common/Wshift-negative-value-8.c: New test.
	* c-c++-common/Wshift-negative-value-9.c: New test.
	* c-c++-common/Wshift-negative-value-10.c: New test.
	* c-c++-common/Wshift-overflow-1.c: Remove
	dg-additional-options, instead in target selectors of each diagnostic
	check for exact C++ versions where it should be diagnosed.
	* c-c++-common/Wshift-overflow-2.c: Likewise.
	* c-c++-common/Wshift-overflow-5.c: Likewise.
	* c-c++-common/Wshift-overflow-6.c: Likewise.
	* c-c++-common/Wshift-overflow-7.c: Likewise.
	* c-c++-common/Wshift-overflow-8.c: New test.
	* c-c++-common/Wshift-overflow-9.c: New test.
	* c-c++-common/Wshift-overflow-10.c: New test.
	* c-c++-common/Wshift-overflow-11.c: New test.
	* c-c++-common/Wshift-overflow-12.c: New test.
2022-03-09 09:15:28 +01:00
Jakub Jelinek
7ca24ae570 simplify-rtx: Fix up SUBREG_PROMOTED_SET arguments [PR104839]
The following testcase is miscompiled on powerpc64le-linux at -O1 and higher
(except for -Og).  The bug was introduced in r12-3252-gcad36f38576a6a7
which for SIGN_EXTEND from SUBREG_PROMOTED_SIGNED_P SUBREG used
SUBREG_PROMOTED_SET (temp, 1) (but that makes temp
SUBREG_PROMOTED_UNSIGNED_P because SRP_UNSIGNED is 1) and similarly the
ZERO_EXTEND from SUBREG_PROMOTED_UNSIGNED_P SUBREG used
SUBREG_PROMOTED_SET (temp, 0) (but that makes temp
SUBREG_PROMOTED_SIGNED_P because SRP_SIGNED is 0).
The following patch fixes that (swaps the 0s and 1s), but for better
readability uses the SRP_* constants.
rtl.h has:
/* Valid for subregs which are SUBREG_PROMOTED_VAR_P().  In that case
   this gives the necessary extensions:
   0  - signed (SPR_SIGNED)
   1  - normal unsigned (SPR_UNSIGNED)
   2  - value is both sign and unsign extended for mode
        (SPR_SIGNED_AND_UNSIGNED).
   -1 - pointer unsigned, which most often can be handled like unsigned
        extension, except for generating instructions where we need to
        emit special code (ptr_extend insns) on some architectures
        (SPR_POINTER). */
The expr.c change in the same commit looks ok to me (passes unsignedp
to SUBREG_PROMOTED_SET, so 0 for signed, 1 for unsigned).

2022-03-09  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/104839
	* simplify-rtx.cc (simplify_unary_operation_1) <case SIGN_EXTEND>:
	Use SRP_SIGNED instead of incorrect 1 in SUBREG_PROMOTED_SET.
	(simplify_unary_operation_1) <case ZERO_EXTEND>: Use SRP_UNSIGNED
	instead of incorrect 0 in SUBREG_PROMOTED_SET.

	* gcc.c-torture/execute/pr104839.c: New test.
2022-03-09 09:12:38 +01:00
Xi Ruoyao
2ab70a4a5c
mips: avoid signed overflow in LUI_OPERAND [PR104842]
gcc/

	PR target/104842
	* config/mips/mips.h (LUI_OPERAND): Cast the input to an unsigned
	value before adding an offset.
2022-03-09 11:21:08 +08:00
Jonathan Wakely
17bffa0c9f contrib: Fix non-portable sed commands in gcc-descr [PR102664/]
POSIX sed does not support \? or \+ in its Basic Regular Expression
grammar. Replace the \(tags/\)\? part of the pattern with a substitution
to remove ^tags/ before other substitutions. Replace \([0-9]\+\) with
\([0-9][0-9]*\) or with \([1-9][0-9]*\) in release branch numbers, where
a leading zero does not occur.

contrib/ChangeLog:

	PR other/102664
	* git-descr.sh: Use portable sed commands.
	* git-undescr.sh: Likewise.
2022-03-09 00:19:01 +00:00
GCC Administrator
8d038a841a Daily bump. 2022-03-09 00:16:29 +00:00
Roger Sayle
e52af9cac7 PR c++/96440: ICE-on-invalid-code error recovery.
This patch fixes PR c++/96440 which is an ICE-on-invalid-code regression
affecting mainline.

2022-03-08  Roger Sayle  <roger@nextmovesoftware.com>

gcc/cp/ChangeLog
	PR c++/96440
	* decl.cc (start_decl): Defend against prefix_attributes being
	error_mark_node.

gcc/testsuite/ChangeLog
	PR c++/96440
	* g++.dg/cpp0x/pr96440.C: New test case.
2022-03-08 23:33:46 +00:00
Tobias Burnus
48777d982a Fortran: Fix gfc_conv_gfc_desc_to_cfi_desc with NULL [PR104126]
PR fortran/104126
gcc/fortran/ChangeLog:

	* trans-expr.cc (gfc_conv_gfc_desc_to_cfi_desc): Handle NULL
	without MOLD.

gcc/testsuite/ChangeLog:

	* gfortran.dg/null_actual_2.f90: New test.
2022-03-09 00:27:45 +01:00
Roger Sayle
3093f8a18e PR c++/96437: ICE-on-invalid-code error recovery.
This patch fixes PR c++/96437 which is an ICE-on-invalid-code regression
affecting mainline.

2022-03-08  Roger Sayle  <roger@nextmovesoftware.com>

gcc/cp/ChangeLog
	PR c++/96437
	* parser.cc (synthesize_implicit_template_parm): Check that
	TREE_VALUE (new_parm) isn't error_mark_node before setting its
	DECL_VIRTUAL_P.

gcc/testsuite/ChangeLog
	PR c++/96437
	* g++.dg/cpp2a/pr96437.C: New test case.
2022-03-08 23:23:19 +00:00
Roger Sayle
8ab72ec7c4 PR c++/96329: ICE-on-invalid-code error recovery.
This patch fixes PR c++/96329 which is an ICE-on-invalid-code regression
affecting mainline.

2022-03-08  Roger Sayle  <roger@nextmovesoftware.com>

gcc/cp/ChangeLog
	PR c++/96329
	* parser.cc (cp_parser_linkage_specification): Treat the case where
	linkage is error_mark_node as "invalid linkage-specification".

gcc/testsuite/ChangeLog
	PR c++/96329
	* g++.dg/template/pr96329.C: New test case.
2022-03-08 23:18:34 +00:00
Marek Polacek
d54ce4641e c++: Wrong error with alias template in class tmpl [PR104108]
In r10-6329 I tried to optimize the number of calls to v_d_e_p in
convert_nontype_argument by remembering whether the expression was
value-dependent in a bool flag.  I did that wrongly assuming that its
value-dependence will not be changed by build_converted_constant_expr.
This testcase shows that it can: b_c_c_e gets a VAR_DECL for m_parameter,
which is not value-dependent, but we're converting it to "const int &"
so it returns

  (const int &)(const int *) &m_parameter

which suddenly becomes value-dependent because of the added ADDR_EXPR:
has_value_dependent_address is now true because m_parameter's context S<T>
is dependent.  With this bug in place, we went to the second branch here:

      if (TYPE_REF_OBJ_P (TREE_TYPE (expr)) && val_dep_p)
        /* OK, dependent reference.  We don't want to ask whether a DECL is
           itself value-dependent, since what we want here is its address.  */;
      else
        {
          expr = build_address (expr);

          if (invalid_tparm_referent_p (type, expr, complain))
            return NULL_TREE;
        }

wherein build_address created a bad tree and then i_t_r_p complained.

	PR c++/104108

gcc/cp/ChangeLog:

	* pt.cc (convert_nontype_argument): Recompute
	value_dependent_expression_p after build_converted_constant_expr.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/alias-decl-74.C: New test.
2022-03-08 17:37:22 -05:00
Ian Lance Taylor
2858e2afcb compiler: ignore function type result name in export data
This change ensures that we never output a result name in the export
data if there is only a single result.  Previously we would output a ?
if the single result had a name.  That made the output unstable,
because the hashing ignores the result name, so whether we output a ?
or not depended on how equal hash elements were handled.

For https://gcc.gnu.org/PR104832

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/390874
2022-03-08 13:53:59 -08:00
Marek Polacek
6f748bc1e7 c++: Attribute deprecated/unavailable divergence
Attributes deprecated and unavailable are largely the same, except
that the former produces a warning whereas the latter produces an error.
So is_late_template_attribute should treat them the same.  Confirmed by
Iain that this divergence is not intentional:
<https://gcc.gnu.org/pipermail/gcc-patches/2022-February/591007.html>.

gcc/cp/ChangeLog:

	* decl2.cc (is_late_template_attribute): Do not defer attribute
	unavailable.
	* pt.cc (tsubst_enum): Set TREE_UNAVAILABLE.

gcc/testsuite/ChangeLog:

	* g++.dg/ext/attr-unavailable-9.C: Add dg-error.
2022-03-08 16:15:55 -05:00
Harald Anlauf
e3e369dad6 Fortran: do not frontend-optimize MINLOC/MAXLOC for character arrays
gcc/fortran/ChangeLog:

	PR fortran/104811
	* frontend-passes.cc (optimize_minmaxloc): Do not attempt
	frontend-optimization of MINLOC/MAXLOC for character arrays, as
	there is no suitable code yet for inline expansion.

gcc/testsuite/ChangeLog:

	PR fortran/104811
	* gfortran.dg/minmaxloc_16.f90: New test.
2022-03-08 21:47:04 +01:00
Jakub Jelinek
e480c3c06d c++: Don't suggest cdtor or conversion op identifiers in spelling hints [PR104806]
On the following testcase, we emit "did you mean '__dt '?" in the error
message.  "__dt " shows there because it is dtor_identifier, but we
shouldn't suggest those to the user, they are purely internal and can't
be really typed by the user because of the final space in it.

2022-03-08  Jakub Jelinek  <jakub@redhat.com>

	PR c++/104806
	* search.cc (lookup_field_fuzzy_info::fuzzy_lookup_field): Ignore
	identifiers with space at the end.

	* g++.dg/spellcheck-pr104806.C: New test.
2022-03-08 21:41:21 +01:00
Christophe Lyon
768956c0d1 arm: Remove unused variable arm_binop_none_none_unone_qualifiers
Commits r12-7342 and r12-7344 made some cleanup, leaving
arm_binop_none_none_unone_qualifiers unused.
This is causing build failures with -Werror (eg bootstrap).

This patch fixes the problem by removing the definition of
arm_binop_none_none_unone_qualifiers and
BINOP_NONE_NONE_UNONE_QUALIFIERS which are now unused.

Tested by bootstraping on arm-linux-gnueaibhf.

2022-03-04  Christophe Lyon  <christophe.lyon@arm.com>

	gcc/
	* config/arm/arm-builtins.cc
	(arm_binop_none_none_unone_qualifiers): Delete.
	(BINOP_NONE_NONE_UNONE_QUALIFIERS): Delete.
2022-03-08 21:21:03 +01:00
Iain Sandoe
34b45cc526 Darwin: Address a translation comment [PR104552].
This amends an error message to correct punctuation and a little
better wording.

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

	PR translation/104552

gcc/ChangeLog:

	* config/host-darwin.cc (darwin_gt_pch_get_address): Amend
	the PCH out of memory error message punctuation and wording.
2022-03-08 19:29:47 +00:00
David Malcolm
b7175f3681 analyzer: more test coverage of leak detection [PR99771]
gcc/testsuite/ChangeLog:
	PR analyzer/99771
	* gcc.dg/analyzer/leak-4.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-03-08 14:16:48 -05:00
Marek Polacek
e1133c0205 rtl: ICE with thread_local and inline asm [PR104777]
In r270550, Jakub fixed classify_insn to handle asm goto: if the asm can
jump to a label, the insn should be a JUMP_INSN.

However, as the following testcase shows, non-null ASM_OPERANDS_LABEL_VEC
doesn't guarantee that the rtx has any actual labels it can branch to.
Here, the rtvec has 0 elements because expand_asm_stmt created it:

  rtvec labelvec = rtvec_alloc (nlabels); // nlabels == 0

This causes an ICE in update_br_prob_note: BRANCH_EDGE (bb) crashes
because there's no branch edge.  I think we can fix this by checking
that there is at least one label the asm can jump to before wrapping
the ASM_OPERANDS in a JUMP_INSN.

	PR rtl-optimization/104777

gcc/ChangeLog:

	* rtl.cc (classify_insn): For ASM_OPERANDS, return JUMP_INSN only if
	ASM_OPERANDS_LABEL_VEC has at least one element.

gcc/testsuite/ChangeLog:

	* gcc.dg/torture/tls/pr104777.c: New test.
2022-03-08 14:00:32 -05:00
H.J. Lu
23ed4df521 x86: Disallow unsupported EH return
Disallow stack realignment and regparm nested function with EH return
since they don't work together.

gcc/

	PR target/104781
	* config/i386/i386.cc (ix86_expand_epilogue): Sorry if there is
	stack realignment or regparm nested function with EH return.

gcc/testsuite/

	PR target/104781
	* gcc.target/i386/eh_return-1.c: Add -mincoming-stack-boundary=4.
	* gcc.target/i386/eh_return-2.c: Likewise.
2022-03-08 09:56:02 -08:00
Andre Vieira
796f5220c8 arm: MVE: Relax addressing modes for full loads and stores
This patch relaxes the addressing modes for the mve full load and stores (by
full loads and stores I mean non-widening or narrowing loads and stores resp).
The code before was requiring a LO_REGNUM for these, where this is only a
requirement if the load is widening or the store narrowing.

gcc/ChangeLog:

	PR target/104790
	* config/arm/arm.h (MVE_STN_LDW_MODE): New MACRO.
	* config/arm/arm.cc (mve_vector_mem_operand): Relax constraint on base
	register for non widening loads or narrowing stores.
2022-03-08 17:50:51 +00:00
Eric Gallager
6319391d56 Fix typo in gcc/params.opt.
Addresses one of the points raised in #104552; checking in under
the "obvious" rule.

gcc/ChangeLog:
	PR translation/104552
	* params.opt: Fix typo.
2022-03-08 12:14:33 -05:00
Jonathan Wakely
10ecf5182a contrib: Fix gcc-descr script [PR102664]
POSIX expr does not support the 'match' keyword, so the git-descr.sh
scripts should use ':' instead.

contrib/ChangeLog:

	PR other/102664
	* git-descr.sh: Use portable form of expr match.
2022-03-08 16:46:36 +00:00
Richard Biener
058d19b42a tree-optimization/84201 - add --param vect-induction-float
This adds a --param to allow disabling of vectorization of
floating point inductions.  Ontop of -Ofast this should allow
549.fotonik3d_r to not miscompare.

2022-03-08  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/84201
	* params.opt (-param=vect-induction-float): Add.
	* doc/invoke.texi (vect-induction-float): Document.
	* tree-vect-loop.cc (vectorizable_induction): Honor
	param_vect_induction_float.

	* gcc.dg/vect/pr84201.c: New testcase.
2022-03-08 15:57:50 +01:00
Jonathan Wakely
7cce7b1c3d libstdc++: Remove incorrect copyright notice from header
This file has the SGI copyright notice, but contains no code from
the SGI STL. It was entirely written by me in 2019, originally as part
of the <memory> header. When I extracted it into a new header I
accidentally copied across the SGI copyright, but that only applies to
some much older parts of <memory>.

libstdc++-v3/ChangeLog:

	* include/bits/uses_allocator_args.h: Remove incorrect copyright
	notice.
2022-03-08 12:53:04 +00:00
Tamar Christina
5f07095d22 vect: disable bitmask tests on sparc
These testcases declare requiring vect_int which sparc declares as well however
sparc doesn't have an optab to vectorize comparisons so these testcases fail to
vectorize and so the tests fail.

As such best coure of action is to just skip them on sparc as comparisons are
somewhat expected from a target that can do SIMD.

gcc/testsuite/ChangeLog:

	PR tree-optimization/104755
	* gcc.dg/vect/vect-bic-bitmask-10.c: Disable sparc.
	* gcc.dg/vect/vect-bic-bitmask-11.c: Likewise.
	* gcc.dg/vect/vect-bic-bitmask-12.c: Likewise.
	* gcc.dg/vect/vect-bic-bitmask-2.c: Likewise.
	* gcc.dg/vect/vect-bic-bitmask-23.c: Likewise.
	* gcc.dg/vect/vect-bic-bitmask-3.c: Likewise.
	* gcc.dg/vect/vect-bic-bitmask-4.c: Likewise.
	* gcc.dg/vect/vect-bic-bitmask-5.c: Likewise.
	* gcc.dg/vect/vect-bic-bitmask-6.c: Likewise.
	* gcc.dg/vect/vect-bic-bitmask-8.c: Likewise.
	* gcc.dg/vect/vect-bic-bitmask-9.c: Likewise.
2022-03-08 11:32:59 +00:00
Martin Jambor
da2667cb02
params: Remove repeated word "that" in parameter description
One of the mistakes reported in PR 104552 is repeated "that" in
description of ipa-cp-recursive-freq-factor which I introduced.  This
patch removes one of them.

gcc/ChangeLog:

2022-03-07  Martin Jambor  <mjambor@suse.cz>

	PR translation/104552
	* params.opt (ipa-cp-recursive-freq-factor): Remove repeated word
	"that" in the description.
2022-03-08 11:47:56 +01:00
Richard Biener
dc46350d44 tree-optimization/104825 - guard modref query
The following makes sure to guard the modref query in VN on a
pointer typed argument.

2022-03-08  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/104825
	* tree-ssa-sccvn.cc (visit_reference_op_call): Properly
	guard modref get_ao_ref on a pointer typed argument.

	* gcc.dg/torture/pr104825.c: New testcase.
2022-03-08 09:55:58 +01:00
liuhongt
b1a741a030 Optimize v4si broadcast for noavx512vl.
This will enable below

-       vbroadcastss    .LC1(%rip), %xmm0
+       movl    $-45, %edx
+       vmovd   %edx, %xmm0
+       vpshufd $0, %xmm0, %xmm0

According to microbenchmark, it's faster than broadcast from memory
for TARGET_INTER_UNIT_MOVES_TO_VEC.

gcc/ChangeLog:

	* config/i386/sse.md (*vec_dupv4si): Disable memory operand
	for !TARGET_INTER_UNIT_MOVES_TO_VEC when prefer_for_speed.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr100865-8a.c: Adjust testcase.
	* gcc.target/i386/pr100865-8c.c: Ditto.
	* gcc.target/i386/pr100865-9c.c: Ditto.
2022-03-08 09:02:05 +08:00
GCC Administrator
e6533e2ebe Daily bump. 2022-03-08 00:16:32 +00:00
Jason Merrill
03e0c807ef c++: tweak to (*(fn))() patch [PR104618]
Other callers of mark_single_function might also want to look through these
wrapapers.

	PR c++/104618

gcc/cp/ChangeLog:

	* decl2.cc (mark_single_function): Look through parens and location
	wrapper.
	* typeck.cc (cp_build_addr_expr_1): Not here.
2022-03-07 18:32:39 -05:00
Joseph Myers
b7dbe870bc Update gcc fr.po, sv.po
* fr.po, sv.po: Update.
2022-03-07 21:44:04 +00:00
Tobias Burnus
c0134b7383 Fortran: Fix gfc_maybe_dereference_var [PR104430][PR99585]
PR fortran/99585
	PR fortran/104430

gcc/fortran/ChangeLog:

	* trans-expr.cc (conv_parent_component_references): Fix comment;
	simplify comparison.
	(gfc_maybe_dereference_var): Avoid d referencing a nonpointer.

gcc/testsuite/ChangeLog:

	* gfortran.dg/class_result_10.f90: New test.
2022-03-07 22:11:33 +01:00
David Malcolm
0af37ad442 analyzer: fix leak suppression at end of 'main' [PR101983]
PR analyzer/101983 reports what I thought were false positives
from -Wanalyzer-malloc-leak, but on closer inspection, the
analyzer is correctly reporting heap-allocated buffers that are
no longer reachable.

However, these "leaks" occur at the end of "main".  The analyzer already
has some logic to avoid reporting leaks at the end of main, where the
leak is detected at the end of the EXIT basic block.  However, in this case,
the leak is detected at the clobber in BB 2 here:
  <bb 2> :
  func (&res);
  res ={v} {CLOBBER(eol)};
  _4 = 0;

  <bb 3> :
<L0>:
  return _4;

where we have a chain BB 2 -> BB 3 -> EXIT BB.

This patch generalizes the "are we at the end of 'main'" detection to
handle such cases, silencing -Wanalyzer-malloc-leak on them.

There's a remaining issue where the analyzer unhelpfully describes one
of the leaking values as '<unknown>', rather than 'res.a', but I'm
leaving that for a followup (covered by PR analyzer/99771).

gcc/analyzer/ChangeLog:
	PR analyzer/101983
	* engine.cc (returning_from_function_p): New.
	(impl_region_model_context::on_state_leak): Use it when rejecting
	leaks at the return from "main".

gcc/testsuite/ChangeLog:
	PR analyzer/101983
	* gcc.dg/analyzer/pr101983-main.c: New test.
	* gcc.dg/analyzer/pr101983-not-main.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-03-07 14:19:30 -05:00
Tobias Burnus
e3ca3e7993 Fortran: Fix typos
gcc/fortran/ChangeLog:

	* array.cc (gfc_ref_dimen_size): Fix comment typo.
	* dump-parse-tree.cc (gfc_dump_c_prototypes): Likewise.
	* frontend-passes.cc (cfe_code): Likewise.
	* gfortran.texi: Likewise.
	* resolve.cc (generate_component_assignments): Likewise.
	* simplify.cc (gfc_simplify_this_image): Likewise.
	* trans-expr.cc (trans_scalar_class_assign,
	gfc_maybe_dereference_var): Likewise.
	* intrinsic.texi: Remove word duplication.
	* invoke.texi: Likewise.
2022-03-07 17:20:52 +01:00
Jonathan Wakely
a86ca83a1b doc: Remove redundant sentence about modules being in C++20
As C++20 has already been published, we don't need to link to the draft
(which is now the C++23 draft anyway). And there's no need to say it's
part of the C++20 spec, or that there might be defect reports. That's
true for everything in C++20, so calling it out here just for Modules
isn't needed.

gcc/ChangeLog:

	* doc/invoke.texi (C++ Modules): Remove anachronism.
2022-03-07 16:08:10 +00:00