Commit Graph

197551 Commits

Author SHA1 Message Date
Iain Sandoe
3cc159bc01 libffi: Fix X86 32b Darwin build and EH frames.
This addresses a number of issues in the X86 Darwin 32b port for libffi.

1. The pic symbol stubs are weak definitions; the correct section placement
   for these depends on the linker version in use.  We do not have access
   to that information, but we can use the target OS version (assumes that
   the user has installed the latest version of xcode available).
   When a coalesced section is in use (OS versions earlier than Darwin12 /
   OSX 10.8), its name must differ from  __TEXT,__text since otherwise that
   would correspond to altering the attributes of the .text section (which
   produces a diagnostic from the assembler).
   Here we use __TEXT, __textcoal_nt for this which is what GCC emits for
   these stubs.
   For later versions than Darwin 12 (OS X 10.8) we can place the stubs in
   the .text section (if we do not we get a diagnostic from clang -cc1as
   saying that the use of coalesced sections for this is deprecated).

2. The EH frame is specified manually, since there is no support for .cfi_
   directives in 'cctools' assemblers.  The implementation needs to provide
   offsets for CFA advance, code size and to the CIE as signed values
   rather than relocations. However the cctools assembler will produce a
   relocation for expressions like ' .long Lxx-Lyy' which then leads to a
   link-time error.  We correct this by forming the offset values using
   ' .set' directives and then assigning the results of them.

3. The register numbering used by m32 X86 Darwin EH frames is not the same
   as the DWARF debug numbering (the Frame and Stack pointer numbers are
   swapped).

4. The FDE address encoding used by the system tools is '0x10' (PCrel + abs)
   where the value provided was PCrel + sdata4.

5. GCC does not use compact unwind at present, and it was not implemented
   until Darwin10 / OSX 10.6.  There were some issues with function location
   in 10.6 so that the solution here suppresses emitting the compact unwind
   section until Darwin11 / OSX 10.7.

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

libffi/ChangeLog:

	* src/x86/sysv.S (COMDAT): Amend section use for Darwin, accounting
	cases where coalesced is needed. (eh_frame): Rework to avoid relocs
	that cause builf fails on earlier Darwin.  Adjust register numbers
	to account for X86 m32 Darwin differences between EH and debug.
2022-12-21 13:02:25 +00:00
Richard Biener
845b514e8a middle-end/107994 - ICE after error with comparison gimplification
The following avoids passing down error_mark_node to fold_convert.

	PR middle-end/107994
	* gimplify.cc (gimplify_expr): Catch errorneous comparison
	operand.
2022-12-21 13:12:52 +01:00
Jan Hubicka
89ba8366fe Skip -fwhole-program when merging LTO options.
gcc/ChangeLog:

2022-12-21  Jan Hubicka  <hubicka@ucw.cz>

	* lto-opts.cc (lto_write_options): Also skip -fwhole-program.
2022-12-21 12:45:56 +01:00
Jan Hubicka
6bfc384f55 When doing WPA in incremental link pass down resolution info.
* lto-cgraph.cc (lto_output_node): When doing WPA in incremental link
	pass down resolution info.
2022-12-21 12:44:11 +01:00
Jan Hubicka
39ebd3a9f5 Make -fwhole-program to work with incremental LTO linking
Update documentation of -fwhole-program which was wrongly
claiming that it is useless with LTO whole it is useful for LTO without plugin
and extends -fwhole-program to also work with incremental linking.
This is useful when building kernel where the incremental link is de-facto fina
binary and only some explicitly marked symbols needs to remain.

Bootstrapped/regtested x86_64-linux, comitted.

gcc/ChangeLog:

2022-12-21  Jan Hubicka  <hubicka@ucw.cz>

	* doc/invoke.texi: Fix documentation of -fwhole-program with LTO
	and document behaviour for incremental linking.

gcc/lto/ChangeLog:

2022-12-21  Jan Hubicka  <hubicka@ucw.cz>

	* lto-common.cc (lto_resolution_read): With incremental linking
	and whole program ignore turn LDPR_PREVAILING_DEF_IRONLY to
	LDPR_PREVAILING_DEF_IRONLY_EXP
	* lto-lang.cc (lto_post_options): Do not clear flag_whole_program
	for incremental link
2022-12-21 12:41:25 +01:00
Jakub Jelinek
88709c4a1e modula2: Fix lto profiledbootstrap on powerpc64le-linux and s390x-linux [PR108153]
Lto profiledbootstrap was failing for me on {powerpc64le,s390x}-linux with
modula 2 enabled, with:
cc1gm2: internal compiler error: the location value is corrupt
0x11a3d2d m2assert_AssertLocation(unsigned int)
	../../gcc/m2/gm2-gcc/m2assert.cc:40
0x11a3d2d m2statement_BuildAssignmentTree
	../../gcc/m2/gm2-gcc/m2statement.cc:177
ICE.  The problem was that caller (m2assert_AssertLocation used
location_t M2Options_OverrideLocation (location_t);
prototype with the libcpp/line-map.h
typedef unsigned int location_t;
typedef, but the callee defined in Modula 2 was using:
TYPE
   location_t = INTEGER ;
and
PROCEDURE OverrideLocation (location: location_t) : location_t ;
Now, on powerpc64le-linux unsigned int is returned and passed zero extended
into 64-bits, while signed int is returned and passed sign-extended into 64-bits
and Modula 2 INTEGER is signed 32-bit type, so when the caller then compared
M2Options_OverrideLocation (location) != location
and powerpc64le-linux performed the comparison as 64-bit compare, there
was a mismatch for location_t of 0x8000007 or others with the MSB set.

Fixed by making Modula 2 location_t a CARDINAL, which is 32-bit unsigned type.

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

	PR modula2/108153
	* gm2-gcc/m2linemap.def (location_t): Use CARDINAL instead of INTEGER.
2022-12-21 09:17:48 +01:00
Martin Liska
af49fd41ab contrib: simplify filter-clang-warnings.py
contrib/ChangeLog:

	* filter-clang-warnings.py: Simplify.
2022-12-21 09:10:34 +01:00
Jakub Jelinek
1119902b6c openmp: Don't try to destruct DECL_OMP_PRIVATIZED_MEMBER vars [PR108180]
DECL_OMP_PRIVATIZED_MEMBER vars are artificial vars with DECL_VALUE_EXPR
of this->field used just during gimplification and omp lowering/expansion
to privatize individual fields in methods when needed.
As the following testcase shows, when not in templates, they were handled
right, but in templates we actually called cp_finish_decl on them and
that can result in their destruction, which is obviously undesirable,
we should only destruct the privatized copies of them created in omp
lowering.

Fixed thusly.

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

	PR c++/108180
	* pt.cc (tsubst_expr): Don't call cp_finish_decl on
	DECL_OMP_PRIVATIZED_MEMBER vars.

	* testsuite/libgomp.c++/pr108180.C: New test.
2022-12-21 09:10:03 +01:00
Martin Liska
0d1b5446bf contrib: filter out more unrelated warnings
contrib/ChangeLog:

	* filter-clang-warnings.py: Skip Makefile and libffi warnings.
2022-12-21 09:08:24 +01:00
Martin Liska
3e030227ea libgccjit: silent 2 Clang warnings
The make silent the following 2 warnings:

jit/jit-playback.h:785:16: warning: private field 'm_source_file' is not used [-Wunused-private-field]
jit/jit-playback.h:804:16: warning: private field 'm_line' is not used [-Wunused-private-field]

gcc/jit/ChangeLog:

	* jit-playback.h: Use unused attribute.
2022-12-21 09:06:23 +01:00
Jakub Jelinek
3102b57f31 libstdc++: Don't call 4-5 argument to_chars with chars_format{}
In Fedora build libstdc++.so is built with assertions enabled and
FAIL: 20_util/to_chars/float128_c++23.cc execution test
was failing on all arches.  The problem is that it called 5 argument version
of to_chars with chars_format{}, which C++ says is invalid:
http://eel.is/c++draft/charconv.to.chars#12
Preconditions: fmt has the value of one of the enumerators of chars_format.

The following patch fixes it by skipping the second part of the test
which needs the 5 argument to_chars for chars_format{}, but because
it is strictly speaking invalid also for 4 argument to_chars, it uses
3 argument to_chars instead of 4 argument to_chars with last argument
chars_format{}.

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

	* testsuite/20_util/to_chars/float16_c++23.cc (test): Use 3 argument
	std::to_chars if fmt is std::chars_format{}, rather than 4 argument.
	* testsuite/20_util/to_chars/float128_c++23.cc (test): Likewise, and
	skip second part of testing that requires 5 argument std::to_chars.
2022-12-21 09:04:06 +01:00
Tobias Burnus
18fc70aa9c gfortran.dg/read_dir.f90: Make PASS on Windows
On non-Cygwin Windows, use '.' and expect the documented fail when opening
a directory (EACCESS).  As gfortran does not set __WIN32__ this check is
done on the C side. (On __CYGWIN__, __WIN32__ is not set - but to make it
clear, !__CYGWIN__ is used in #if.)

On non-Windows, replace the 'call system' shell call by the POSIX functions
stat/mkdir/rmdir for better compatibility, especially on embedded systems;
additionally add some more checks. In particular, confirm that 'close' with
status='delete' indeed deleted the directory.

gcc/testsuite/ChangeLog:

	* gfortran.dg/read_dir-aux.c: New; provides my_mkdir, my_rmdir,
	my_verify_not_exists and expect_open_to_fail.
	* gfortran.dg/read_dir.f90: Call those; expect that opening a
	directory fails on Windows.
2022-12-21 08:14:32 +01:00
Ian Lance Taylor
2b1a604a9b libgo: check for makecontext in -lucontext
Patch from Sören Tempel.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/458396
2022-12-20 19:34:55 -08:00
Kewen Lin
fb73bfdb67 rs6000: Fix the wrong location of OPTION_MASK_P10_FUSION setting hunk
The hunk for setting flag OPTION_MASK_P10_FUSION locates wrongly
between the if and else if block for OPTION_MASK_MMA.  This is
to fix this oversight accordingly.

gcc/ChangeLog:

	* config/rs6000/rs6000.cc (rs6000_option_override_internal): Fix the
	location for OPTION_MASK_P10_FUSION flag setting.
2022-12-20 21:06:15 -06:00
Kewen Lin
94cf7a2d95 fold-const: Treat fp conversion to a type with same mode as copy
In function fold_convert_const_real_from_real, when the modes of
two types involved in fp conversion are the same, we can simply
take it as copy, rebuild with the exactly same TREE_REAL_CST and
the target type.  It is more efficient and helps to avoid possible
unexpected signalling bit clearing in [1].

[1] https://gcc.gnu.org/pipermail/gcc-patches/2022-December/608533.html

gcc/ChangeLog:

	* fold-const.cc (fold_convert_const_real_from_real): Treat floating
	point conversion to a type with same mode as copy instead of normal
	convertFormat.
2022-12-20 21:04:54 -06:00
Kewen Lin
282462b395 rs6000: Raise error for __vector_{quad,pair} uses without MMA enabled [PR106736]
As PR106736 shows, it's unexpected to use __vector_quad and
__vector_pair types without MMA support, it would cause ICE
when expanding the corresponding assignment.  We can't guard
these built-in types registering under MMA support as Peter
pointed out in that PR, because the registering is global,
it doesn't work for target pragma/attribute support with MMA
enabled.  The existing verify_type_context mentioned in [2]
can help to make the diagnostics invalid built-in type uses
better, but as Richard pointed out in [4], it can't deal with
all cases.  As the discussions in [1][3], this patch is to
check the invalid use of built-in types __vector_quad and
__vector_pair in mov pattern of OOmode and XOmode, on the
currently being expanded gimple assignment statement.  It
still puts an assertion in else arm rather than just makes
it go through, it's to ensure we can catch any other possible
unexpected cases in time if there are.

[1] https://gcc.gnu.org/pipermail/gcc/2022-December/240218.html
[2] https://gcc.gnu.org/pipermail/gcc/2022-December/240220.html
[3] https://gcc.gnu.org/pipermail/gcc/2022-December/240223.html
[4] https://gcc.gnu.org/pipermail/gcc-patches/2022-December/608083.html

	PR target/106736

gcc/ChangeLog:

	* config/rs6000/mma.md (define_expand movoo): Call function
	rs6000_opaque_type_invalid_use_p to check and emit error message for
	the invalid use of opaque type.
	(define_expand movxo): Likewise.
	* config/rs6000/rs6000-protos.h
	(rs6000_opaque_type_invalid_use_p): New function declaration.
	(currently_expanding_gimple_stmt): New extern declaration.
	* config/rs6000/rs6000.cc (rs6000_opaque_type_invalid_use_p): New
	function.

gcc/testsuite/ChangeLog:

	* gcc.target/powerpc/pr106736-1.c: New test.
	* gcc.target/powerpc/pr106736-2.c: Likewise.
	* gcc.target/powerpc/pr106736-3.c: Likewise.
	* gcc.target/powerpc/pr106736-4.c: Likewise.
	* gcc.target/powerpc/pr106736-5.c: Likewise.
2022-12-20 21:02:08 -06:00
Jason Merrill
ef0abcbc40 fold: fix use of protected_set_expr_location_unshare
Unlike protected_set_expr_location, this variant can return
a different tree.

gcc/ChangeLog:

	* fold-const.cc (fold_convert_loc): Check return value of
	protected_set_expr_location_unshare.
2022-12-20 21:07:31 -05:00
Jason Merrill
302485a70a c++: source position of lambda captures [PR84471]
If the DECL_VALUE_EXPR of a VAR_DECL has EXPR_LOCATION set, then any use of
that variable looks like it has that location, which leads to the debugger
jumping back and forth for both lambdas and structured bindings.

Rather than fix all the uses, it seems simplest to remove any EXPR_LOCATION
when setting DECL_VALUE_EXPR.  So the cp/ hunks aren't necessary, but they
avoid the need to unshare to remove the location.

	PR c++/84471
	PR c++/107504

gcc/cp/ChangeLog:

	* coroutines.cc (transform_local_var_uses): Don't
	specify a location for DECL_VALUE_EXPR.
	* decl.cc (cp_finish_decomp): Likewise.

gcc/ChangeLog:

	* fold-const.cc (protected_set_expr_location_unshare): Not static.
	* tree.h: Declare it.
	* tree.cc (decl_value_expr_insert): Use it.

include/ChangeLog:

	* ansidecl.h (ATTRIBUTE_WARN_UNUSED_RESULT): Add __.

gcc/testsuite/ChangeLog:

	* g++.dg/tree-ssa/value-expr1.C: New test.
	* g++.dg/tree-ssa/value-expr2.C: New test.
	* g++.dg/analyzer/pr93212.C: Move warning.
2022-12-20 21:01:44 -05:00
GCC Administrator
a996888327 Daily bump. 2022-12-21 00:17:15 +00:00
Patrick Palka
8aa045c974 c++, tree: walk TREE_VEC (and VECTOR_CST) in natural order [PR101886]
Unfortunately the extract_autos_r fix in r13-4799-ga7c8036b26082d is
derailed by the fact that walk_tree_1 currently walks the elements of a
TREE_VEC in reverse, which means for A<auto, auto> in the below testcase
extract_autos_r ends up adjusting the TEMPLATE_TYPE_IDX of the first
auto instead of the second one, and the first auto is the canonical auto
of level 2 (and index 0), so we rightfully trigger the sanity check
added in that commit.

It seems TREE_VEC and VECTOR_CST are the only trees we walk in reverse,
and this has been the case since r21884 whence the original version of
walk_tree_1 was introduced.  But that's arguably unnatural and not
consistent with how we walk all other compound trees such as CONSTRUCTORs
and EXPR_P trees in forward order.

So this patch makes walk_tree_1 walk TREE_VEC (and VECTOR_CST) in
forward order as well, which fixes the testcase.  Doing so revealed that
keep_template_parm grows the list of found template parameters from the
front, which previously compensated for the TREE_VEC behavior, so now we
should grow it from the back.

	PR c++/101886

gcc/cp/ChangeLog:

	* pt.cc (find_template_parameter_info::parm_list_tail):
	New data member.
	(keep_template_parm): Use parm_list_tail to append rather
	than prepend to parm_list.

gcc/ChangeLog:

	* tree.cc (walk_tree_1) <case TREE_VEC>: Walk the elements
	in forward instead of reverse order.
	<case VECTOR_CST>: Likewise.

gcc/testsuite/ChangeLog:

	* g++.dg/concepts/diagnostic12.C: Adjust expected order of
	template parameters within pretty printed parameter mapping.
	* g++.dg/concepts/auto6.C: New test.
2022-12-20 17:02:37 -05:00
Harald Anlauf
aed5584ff6 Fortran: a C interoperable function cannot have the CLASS attribute [PR95375]
gcc/fortran/ChangeLog:

	PR fortran/95375
	* decl.cc (verify_bind_c_sym): Extend interoperability check to
	CLASS variables.

gcc/testsuite/ChangeLog:

	PR fortran/95375
	* gfortran.dg/bind_c_procs_4.f90: New test.
2022-12-20 22:24:01 +01:00
Iain Sandoe
a6504f13a0 coroutines: Accept 'extern "C"' coroutines.
'extern "C"' coroutines are permitted by the standard and expected to work
(although constructing useful cases could be challenging). In order to
permit this we need to arrange for the outlined helper functions to be
named properly, even when no mangling is required.  To do this, we append
the actor and destroy suffixes in all cases.

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

gcc/cp/ChangeLog:

	* mangle.cc (write_mangled_name): Append the helper function
	suffixes here...
	(write_encoding): ... rather than here.

gcc/testsuite/ChangeLog:

	* g++.dg/coroutines/torture/extern-c-coroutine.C: New test.
2022-12-20 19:31:47 +00:00
Patrick Palka
49b6b7ac33 c++: NTTP object wrapper substitution fixes [PR103346, ...]
This patch fixes some issues with substitution into a C++20 template
parameter object wrapper:

* The first testcase demonstrates a situation where the same_type_p
  assert in relevant case of tsubst_copy doesn't hold, because (partial)
  substitution of {int,} into the wrapper's TREE_TYPE yields A<int> but
  substitution into the underlying TEMPLATE_PARM_INDEX is a nop due to
  tsubst's level==1/tf_partial early exit tests, hence TREE_TYPE in the
  latter case remains A<T>.  So this patch just gets rid of the assert;
  the type mismatch doesn't seem to be a problem in practice.

* In the second testcase, dependent substitution into the underlying
  TEMPLATE_PARM_INDEX yields a CALL_EXPR with empty TREE_TYPE, which
  tsubst_copy doesn't expect.  This patch fixes this by handling empty
  TREE_TYPE the same way as a non-const TREE_TYPE.  Moreover, after
  this substitution we're left with a VIEW_CONVERT_EXPR wrapping a
  CALL_EXPR instead of a TEMPLATE_PARM_INDEX, which during the subsequent
  non-dependent substitution tsubst_copy doesn't expect either.  So
  this patch also relaxes tsubst_copy to accept such VIEW_CONVERT_EXPR
  too.

* In the third testcase, we end up never resolving the call to
  f.modify() because tsubst_copy doesn't do overload resolution.
  This patch fixes this by moving the handling of these
  VIEW_CONVERT_EXPR wrappers from tsubst_copy to tsubst_copy_and_build.
  For good measure tsubst_copy_and_build should also handle
  REF_PARENTHESIZED_P wrappers instead of delegating to tsubst_copy.

	PR c++/103346
	PR c++/104278
	PR c++/102553

gcc/cp/ChangeLog:

	* pt.cc (tsubst_copy) <case VIEW_CONVERT_EXPR>: Move the
	handling of C++20 template parameter object wrappers to ...
	(tsubst_copy_and_build) <case VIEW_CONVERT_EXPR>: ... here.
	Accept non-TEMPLATE_PARM_INDEX inner operand.  Handle empty
	TREE_TYPE on substituted inner operand.  Remove same_type_p
	assert.  Also handle REF_PARENTHESIZED_P VIEW_CONVERT_EXPRs.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/nontype-class52a.C: New test.
	* g++.dg/cpp2a/nontype-class53.C: New test.
	* g++.dg/cpp2a/nontype-class54.C: New test.
	* g++.dg/cpp2a/nontype-class55.C: New test.
2022-12-20 11:09:11 -05:00
Andrew MacLeod
0bdd2261c2 Don't use PHI equivalences in range-on-entry.
If there is only one argument to a PHI which is defined, an equivalency is
created between the def and the argument.  It is safe to consider the def
equal to the argument, but it is dangerous to assume the argument is also
equivalent to the def as there may be branches which change the range on the
path to the PHI on that argument

This patch avoid using that relation in range-on-entry calculations.

	PR tree-optimization/108139
	gcc/
	* gimple-range-cache.cc (ranger_cache::fill_block_cache): Do not
	use equivalences originating from PHIS.

	gcc/testsuite/
	* gcc.dg/pr108139.c: New.
2022-12-20 09:15:23 -05:00
Richard Biener
05b7cf52e1 d/104749 - document host GDC version requirement
This documents that GDC 9.4 or later is required to build the D
language rather than GDC 9.1 which suffers from PR94240.

	PR d/104749
	* doc/install.texi (GDC): Document GDC 9.4 or later is required
	to build the D language frontend.
2022-12-20 14:37:09 +01:00
Marc Poulhiès
02c031088a rust: fix link serialization [PR108113]
The Make-lang.in was missing the link serialization support.

	PR rust/108113

gcc/rust
	* Make-lang.in (rust.serial): New variable.
	(rust1$(exeext)): Depend on $(rust.prev). Call LINK_PROGRESS.

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2022-12-20 09:11:30 +01:00
Jiufu Guo
1060cd2ad0 rs6000: Optimize cmp on rotated 16bits constant
Hi,

When checking eq/ne with a constant which has only 16bits, it can be
optimized to check the rotated data.  By this, the constant building
is optimized.

As the example in PR103743:
For "in == 0x8000000000000000LL", this patch generates:
        rotldi 3,3,1 ; cmpldi 0,3,1
instead of:
        li 9,-1 ; rldicr 9,9,0,0 ; cmpd 0,3,9

Compare with previous version:
https://gcc.gnu.org/pipermail/gcc-patches/2022-August/600475.html.
This patch refactor the code according to review comments.
e.g. updating function names/comments/code.

This patch pass bootstrap and regtest on ppc64 and ppc64le.
Is it ok for trunk?  Thanks for comments!

BR,
Jeff(Jiufu)

	PR target/103743

gcc/ChangeLog:

	* config/rs6000/rs6000-protos.h (can_be_rotated_to_lowbits): New.
	(can_be_rotated_to_positive_16bits): New.
	(can_be_rotated_to_negative_15bits): New.
	* config/rs6000/rs6000.cc (can_be_rotated_to_lowbits): New definition.
	(can_be_rotated_to_positive_16bits): New definition.
	(can_be_rotated_to_negative_15bits): New definition.
	* config/rs6000/rs6000.md (*rotate_on_cmpdi): New define_insn_and_split.
	(eqne): Move earlier.

gcc/testsuite/ChangeLog:

	* gcc.target/powerpc/pr103743.c: New test.
	* gcc.target/powerpc/pr103743_1.c: New test.
2022-12-20 11:52:10 +08:00
GCC Administrator
d2ef2327bb Daily bump. 2022-12-20 00:17:00 +00:00
Jason Merrill
1e007fa5c9 build: avoid -Wconditionally-supported on qsort check
It's OK to rely on conditionally-supported features in #if CHECKING_P, since
that isn't defined in stage 1.

gcc/ChangeLog:

	* sort.cc: Disable -Wconditionally-supported in
	CHECKING_P code.
2022-12-19 15:46:35 -05:00
Patrick Palka
64f7a3b387 c++: modules and std::source_location::current() def arg [PR100881]
We currently declare __builtin_source_location with a const void* return
type instead of the actual type const std::source_location::__impl*, and
later when folding this builtin we obtain the actual type via name lookup.

But the below testcase demonstrates this approach seems to interact
poorly with modules, since we may import an entity that uses
std::source_location::current() in its default argument (or DMI) without
necessarily importing <source_location>, and thus the name lookup for
std::source_location will fail at the call site (when using the default
argument) unless we also import <source_location>.

This patch fixes this by instead initially declaring the builtin with an
auto return type and updating it appropriately upon its first use (in
standard code the first/only use would be in the definition of
std::source_location).  Thus when folding calls to this builtin we can
get at its return type through the type of the CALL_EXPR and avoid
needing to do a name lookup.

	PR c++/100881

gcc/cp/ChangeLog:

	* constexpr.cc (cxx_eval_builtin_function_call): Adjust calls
	to fold_builtin_source_location.
	* cp-gimplify.cc (cp_gimplify_expr): Likewise.
	(cp_fold): Likewise.
	(get_source_location_impl_type): Remove location_t parameter and
	adjust accordingly.  No longer static.
	(fold_builtin_source_location): Take a CALL_EXPR tree instead of a
	location and obtain the impl type from its return type.
	* cp-tree.h (enum cp_tree_index): Remove CPTI_SOURCE_LOCATION_IMPL
	enumerator.
	(source_location_impl): Remove.
	(fold_builtin_source_location): Adjust parameter type.
	(get_source_location_impl_type): Declare.
	* decl.cc (cxx_init_decl_processing): Declare
	__builtin_source_location with auto return type instead of
	const void*.
	(require_deduced_type): Update the return type of
	__builtin_source_location.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/srcloc3.C: Adjust expected note s/evaluating/using.
	* g++.dg/cpp2a/srcloc4.C: Likewise.
	* g++.dg/cpp2a/srcloc5.C: Likewise.
	* g++.dg/cpp2a/srcloc6.C: Likewise.
	* g++.dg/cpp2a/srcloc7.C: Likewise.
	* g++.dg/cpp2a/srcloc8.C: Likewise.
	* g++.dg/cpp2a/srcloc9.C: Likewise.
	* g++.dg/cpp2a/srcloc10.C: Likewise.
	* g++.dg/cpp2a/srcloc11.C: Likewise.
	* g++.dg/cpp2a/srcloc12.C: Likewise.
	* g++.dg/cpp2a/srcloc13.C: Likewise.
	* g++.dg/modules/pr100881_a.C: New test.
	* g++.dg/modules/pr100881_b.C: New test.
2022-12-19 15:35:51 -05:00
Patrick Palka
a7c8036b26 c++: ICE with concepts TS multiple auto deduction [PR101886]
In extract_autos_r, we need to recompute TYPE_CANONICAL for the template
type parameter after adjusting its index, otherwise we end up with a
comptypes ICE for the below testcase.  Note that such in-place type
adjustment isn't generally safe to do since the type could be the
TYPE_CANONICAL of another (unadjusted) type, but in this case the
canonical auto (of some level and 0 index) is the first auto (of that
level) that's created, and so any auto that we do end up adjusting can't
be the canonical one.

	PR c++/101886

gcc/cp/ChangeLog:

	* pt.cc (extract_autos_r): Recompute TYPE_CANONICAL after
	adjusting the template type parameter's index.  Simplify
	by using TEMPLATE_TYPE_IDX.  Add some sanity checks.

gcc/testsuite/ChangeLog:

	* g++.dg/concepts/auto5.C: New test.
2022-12-19 15:26:37 -05:00
Arsen Arsenović
a39f454f0f contracts: Lowercase {MAYBE,NEVER}_CONTINUE
The lowercase constants are more consistent with the standard, and it is
unlikely that the uppercase versions would've been accepted.

gcc/cp/ChangeLog:

	* contracts.cc: Rename references to
	contract_violation_continuation_mode constants to be lowercase.

libstdc++-v3/ChangeLog:

	* include/experimental/contract: Lowercase the constants in
	contract_violation_continuation_mode.
2022-12-19 15:08:08 -05:00
Jakub Jelinek
4e4620d8c7 c: Diagnose compound literals with function type [PR108043]
Both C99 and latest C2X say that compound literal shall have an object type
(complete object type in the latter case) or array of unknown bound,
so complit with function type is invalid.  When the initializer had to be
non-empty for such case, we used to diagnose it as incorrect initializer,
but with (fntype){} now allowed we just ICE on it.

The following patch diagnoses that.

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

	PR c/108043
	* c-parser.cc (c_parser_postfix_expression_after_paren_type): Diagnose
	compound literals with function type.

	* gcc.dg/pr108043.c: New test.
	* gcc.dg/c99-complit-2.c (foo): Adjust expected diagnostics for
	complit with function type.
2022-12-19 20:55:56 +01:00
Marek Polacek
68e51bd0a8 c-family: Fix ICE with -Wsuggest-attribute [PR98487]
Here we crash because check_function_format was using TREE_PURPOSE
directly rather than using get_attribute_name.

	PR c/98487

gcc/c-family/ChangeLog:

	* c-format.cc (check_function_format): Use get_attribute_name.

gcc/testsuite/ChangeLog:

	* c-c++-common/Wsuggest-attribute-1.c: New test.
2022-12-19 11:16:42 -05:00
Jason Merrill
263c22a95b build: add -Wconditionally-supported to strict_warn [PR64867]
The PR (which isn't resolved by this commit) pointed out to me that GCC
should build with -Wconditionally-supported to support bootstrapping with a
C++11 compiler that makes different choices.

	PR c++/64867

gcc/ChangeLog:

	* configure.ac (strict_warn): Add -Wconditionally-supported.
	* configure: Regenerate.
2022-12-19 10:56:33 -05:00
Richard Biener
ec459469f8 tree-optimization/108164 - undefined overflow with IV vectorization
vect_update_ivs_after_vectorizer can end up emitting a signed
IV update when the loop body performed an unsigned computation.
The following makes sure to perform that update in the type
of the loop update type to avoid undefined behavior on overflow.

	PR tree-optimization/108164
	* tree-vect-loop-manip.cc (vect_update_ivs_after_vectorizer):
	Perform vect_step_op_add update in the appropriate type.

	* gcc.dg/pr108164.c: New testcase.
2022-12-19 16:36:21 +01:00
Richard Earnshaw
aa510619f8 arm: correctly define __ARM_FEATURE_CLZ
The ACLE requires that __ARM_FEATURE_CLZ be defined if the hardware
supports it; it's also clear that this doesn't mean the current ISA,
so we must define this even when compiling for Thumb1 if the target
supports CLZ in A32.

This brings GCC into alignment with Clang.

gcc/ChangeLog:

	* config/arm/arm-c.cc (__ARM_FEATURE_CLZ): Fix definition of
	preprocessor macro when target has CLZ in another ISA.
2022-12-19 15:03:30 +00:00
Ju-Zhe Zhong
8577356f4b RISC-V: Remove unit-stride store from ta attribute
Since store instructions doesn't care about tail policy, we remove
vste from "ta" attribute. Hence, we could have more fusion chances
and better optimization.

gcc/ChangeLog:

	* config/riscv/vector.md: Remove vste.
2022-12-19 22:23:32 +08:00
Ju-Zhe Zhong
6c098f7d23 RISC-V: Add testcases for VSETVL PASS 5
gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-1.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-10.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-11.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-12.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-13.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-14.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-15.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-16.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-17.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-18.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-19.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-2.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-20.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-21.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-22.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-23.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-24.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-25.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-26.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-27.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-28.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-29.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-3.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-30.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-31.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-32.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-33.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-34.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-35.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-36.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-37.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-38.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-39.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-4.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-40.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-41.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-42.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-43.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-44.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-45.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-46.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-5.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-6.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-7.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-8.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-9.c: New test.
2022-12-19 22:23:29 +08:00
Ju-Zhe Zhong
5a1b66b77c RISC-V: Add testcases for VSETVL PASS 4
gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-1.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-10.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-11.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-12.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-13.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-14.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-15.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-16.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-17.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-18.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-19.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-2.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-20.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-21.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-22.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-23.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-24.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-25.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-26.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-27.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-28.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-3.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-4.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-5.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-6.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-7.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-8.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-9.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_call-1.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_call-2.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_call-3.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_call-4.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_complex_loop-1.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_complex_loop-2.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_conflict-1.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_conflict-10.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_conflict-11.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_conflict-12.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_conflict-2.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_conflict-3.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_conflict-4.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_conflict-5.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_conflict-6.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_conflict-7.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_conflict-8.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_conflict-9.c: New test.
2022-12-19 22:23:26 +08:00
Ju-Zhe Zhong
76023293e6 RISC-V: Add testcases for VSETVL PASS 3
gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-1.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-10.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-11.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-12.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-13.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-14.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-15.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-16.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-17.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-18.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-19.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-2.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-20.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-21.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-22.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-23.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-24.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-25.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-26.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-27.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-28.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-3.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-4.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-5.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-6.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-7.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-8.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-9.c: New test.
2022-12-19 22:23:22 +08:00
Ju-Zhe Zhong
6f18836ca0 RISC-V: Add testcases for VSETVL PASS 2
gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-1.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-10.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-11.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-12.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-13.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-14.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-15.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-16.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-17.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-18.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-19.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-2.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-20.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-21.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-22.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-23.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-24.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-25.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-26.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-27.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-28.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-3.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-4.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-5.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-6.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-7.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-8.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_phi-9.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-1.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-10.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-11.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-12.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-13.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-14.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-15.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-16.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-2.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-3.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-4.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-5.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-6.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-7.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-8.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-9.c: New test.
2022-12-19 22:23:18 +08:00
Ju-Zhe Zhong
e4433e075f RISC-V: Add testcases for VSETVL PASS
gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/rvv.exp: Adjust to enable tests for VSETVL PASS.
	* gcc.target/riscv/rvv/vsetvl/dump-1.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-1.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-10.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-11.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-12.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-13.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-14.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-15.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-16.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-17.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-18.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-19.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-2.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-3.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-4.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-5.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-6.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-7.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-8.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_block-9.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-1.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-2.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-3.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-4.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-5.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-6.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-7.c: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-8.c: New test.
2022-12-19 22:23:11 +08:00
Kito Cheng
c2c29fbebb RISC-V: Simplify ASM checks in gcc.target/riscv/rvv/base/.
gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/base/mov-1.c: Simplify operand check.
	* gcc.target/riscv/rvv/base/mov-10.c: Ditto.
	* gcc.target/riscv/rvv/base/mov-11.c: Ditto.
	* gcc.target/riscv/rvv/base/mov-12.c: Ditto.
	* gcc.target/riscv/rvv/base/mov-2.c: Ditto.
	* gcc.target/riscv/rvv/base/mov-3.c: Ditto.
	* gcc.target/riscv/rvv/base/mov-4.c: Ditto.
	* gcc.target/riscv/rvv/base/mov-5.c: Ditto.
	* gcc.target/riscv/rvv/base/mov-6.c: Ditto.
	* gcc.target/riscv/rvv/base/mov-8.c: Ditto.
	* gcc.target/riscv/rvv/base/mov-9.c: Ditto.
	* gcc.target/riscv/rvv/base/vread_csr.c: Ditto.
	* gcc.target/riscv/rvv/base/vsetvl-1.c: Ditto.
	* gcc.target/riscv/rvv/base/vwrite_csr.c: Ditto.
2022-12-19 22:22:30 +08:00
Ju-Zhe Zhong
9243c3d1b6 RISC-V: Support VSETVL PASS for RVV support
This patch is to support VSETVL PASS for RVV support.
1.The optimization and performance is guaranteed LCM (Lazy code motion).
2.Base on RTL_SSA framework to gain better optimization chances.
3.Also we do VL/VTYPE, demand information backward propagation across
  blocks by RTL_SSA reverse order in CFG.
4.It has been well and fully tested by about 200+ testcases for VLMAX
  AVL situation (Only for VLMAX since we don't have an intrinsics to
  test non-VLMAX).
5.Will support AVL model in the next patch.

gcc/ChangeLog:

	* config.gcc: Add riscv-vsetvl.o.
	* config/riscv/riscv-passes.def (INSERT_PASS_BEFORE): Add VSETVL PASS
	location.
	* config/riscv/riscv-protos.h (make_pass_vsetvl): New function.
	(enum avl_type): New enum.
	(get_ta): New function.
	(get_ma): Ditto.
	(get_avl_type): Ditto.
	(calculate_ratio): Ditto.
	(enum tail_policy): New enum.
	(enum mask_policy): Ditto.
	* config/riscv/riscv-v.cc (calculate_ratio): New function.
	(emit_pred_op): change the VLMAX mov codgen.
	(get_ta): New function.
	(get_ma): Ditto.
	(enum tail_policy): Change enum.
	(get_prefer_tail_policy): New function.
	(enum mask_policy): Change enum.
	(get_prefer_mask_policy): New function.
	* config/riscv/t-riscv: Add riscv-vsetvl.o
	* config/riscv/vector.md: Adjust attribute and pattern for VSETVL
	PASS.
	(@vlmax_avl<mode>): Ditto.
	(@vsetvl<mode>_no_side_effects): Delete.
	(vsetvl_vtype_change_only): New MD pattern.
	(@vsetvl_discard_result<mode>): Ditto.
	* config/riscv/riscv-vsetvl.cc: New file.
	* config/riscv/riscv-vsetvl.h: New file.
2022-12-19 22:21:37 +08:00
Ju-Zhe Zhong
22dc669e10 RISC-V: Fix RVV machine mode attribute configuration
The attribute configuration of each machine mode are support in the previous patch.
I noticed some of them are not correct during VSETVL PASS testsing.
Correct them in the single patch now.

gcc/ChangeLog:

	* config/riscv/riscv-vector-switch.def (ENTRY): Correct attributes.
2022-12-19 22:09:35 +08:00
Jakub Jelinek
6e85f89a7d testsuite: Fix up pr64536.c for LLP64 targets [PR108151]
Apparently llp64 had 2 further warnings, fixed thusly.

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

	PR testsuite/108151
	* gcc.dg/pr64536.c (bar): Cast long to __INTPTR_TYPE__
	before casting to long *.
2022-12-19 15:05:16 +01:00
Jakub Jelinek
de2b8c41b8 modula2: Don't treat % in Modula 2 messages specially
On top of the just posted patch, this patch makes sure that
any % chars in message strings aren't treated as format chars.
None of these functions take variable number of arguments, so for
most of format specifiers there is nowhere to take arguments from,
it is true that a couple of format specifiers don't take any
arguments - %%, %m, %<, %>, %' - so it is actually possible
to use them, but one needs to verify that no other are emitted and
that what should be printed as % is really emitted as %%.
If the FE does that, then please ignore this patch, otherwise I think
it is safer to do this.

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

	* gm2-gcc/m2linemap.cc (m2linemap_ErrorAt, m2linemap_ErrorAtf,
	m2linemap_WarningAtf, m2linemap_NoteAtf, m2linemap_internal_error):
	Call functions with "%s", message rather than just message, so that
	% chars in message aren't treated as format specifiers.
2022-12-19 15:00:47 +01:00
Jakub Jelinek
158b18ffa5 modula2: Fix up bootstrap on powerpc64le-linux [PR108147]
As mentioned in the PR, bootstrap with m2 enabled currently fails
on powerpc64le-linux, we get weird ICE after printing some diagnostics.
The problem is that mc creates from *.def prototypes like
extern void m2linemap_WarningAtf (m2linemap_location_t location, void * message);
but the actual function definitions use
void m2linemap_WarningAtf (m2linemap_location_t location, void * message,
...) { code }
and on powerpc64le-linux such lying about the prototype results in
wrong-code, on the caller side we assume the function isn't varargs
and so don't reserve 64 bytes in the frame for it, while the callee
relies on the area being reserved and stores into it.

Fixed by adding non-stdarg wrappers around stdarg functions (because
we want va_list and pass it to diagnostics functions).

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

	PR modula2/108147
	* gm2-gcc/m2linemap.def (ErrorAtf, WarningAtf, NoteAtf):
	Comment out prototypes with varargs.
	* gm2-gcc/m2linemap.h (m2linemap_ErrorAtf, m2linemap_WarningAtf,
	m2linemap_NoteAtf): No longer varargs.
	* gm2-gcc/m2linemap.cc (m2linemap_ErrorAtf): Turned into a
	non-varargs wrapper around ...
	(m2linemap_ErrorAtf_1): ... this.  New static function.
	(m2linemap_WarningAtf): Turned into a non-varargs wrapper around ...
	(m2linemap_WarningAtf_1): ... this.  New static function.
	(m2linemap_NoteAtf): Turned into a non-varargs wrapper around ...
	(m2linemap_NoteAtf_1): ... this.  New static function.
2022-12-19 15:00:08 +01:00
Martin Liska
a9f6a2b7f5 gcc-changelog: support digits in PR's component in subject
contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Support digits in PR's
	component in subject.
2022-12-19 14:55:39 +01:00