Commit Graph

215775 Commits

Author SHA1 Message Date
Andrew Pinski
4a2352828e aarch64: Update error message check for __builtin_launder check of sve-sizeless-2.C
r15-3614-g9fe57e4879de93 changed the error message for __builtin_launder but this testcase
was not updated for the new format of the error message since it is an aarch64 specific
testcase.

This patch updates the expected error message.

Pushed as obvious after testing to see the testcase now works.

gcc/testsuite/ChangeLog:

	* g++.dg/ext/sve-sizeless-2.C: Update the expected error message
	for __builtin_launder.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2024-11-26 13:41:47 -08:00
Andrew Pinski
1a0d48060d aarch64: Fix fp8_scalar_1.c's stacktest1
The function body test was expecting:
	umov	w0, v0.b[0]
	strb	w0, [sp, 15]

But the code generation was improved after r15-5375-gbeec291225be to just:
	str	b0, [sp, 15]

which is correct and better because no longer need to move between SIMD registers
and the GPRs.
This changes the function body test to new better code generation.

Pushed as obvious after a test of the testcase to make sure it now passes.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/fp8_scalar_1.c (stacktest1): Fix for new
	improved code generation.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2024-11-26 13:11:59 -08:00
David Malcolm
746629e228 selftest: invoke "diff" when ASSERT_STREQ fails
Currently when ASSERT_STREQ or ASSERT_STREQ_AT fail we print
both strings to stderr.  However it can be hard to figure out
the problem (e.g. for 1-character differences in long strings).

Extend the output by writing out the strings to tempfiles and
invoking "diff -up" on them when we have such a selftest failure,
to (I hope) simplify debugging.

gcc/ChangeLog:
	* selftest.cc (selftest::print_diff): New function.
	(selftest::assert_streq): Call it when we have non-equal
	non-null strings.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-11-26 16:09:37 -05:00
David Malcolm
b4d4e22a62 testsuite: rename plugins from .c to .cc
In r12-6650-g5c69acb32329d4 we updated our sources from .c to .cc
since for some time GCC has been implemented in C++, not C.

GCC plugins are also implemented in C++, not C, but the plugins
in our testsuite still have .c extensions.

Rename the plugin implementation files in the testsuite from .c to .cc,
for consistency with GCC's implementation files (as opposed to .C,
which is used in C++ parts of the testsuite).

Don't rename the files that the plugins are tested *on*.

gcc/testsuite/ChangeLog:
	* g++.dg/plugin/plugin.exp (plugin_test_list): Update for renaming
	of all plugin implementation files from .c to .cc.
	* g++.dg/plugin/attribute_plugin.c: Rename to...
	* g++.dg/plugin/attribute_plugin.cc: ...this.
	* g++.dg/plugin/comment_plugin.c: Rename to...
	* g++.dg/plugin/comment_plugin.cc: ...this.
	* g++.dg/plugin/decl_plugin.c: Rename to...
	* g++.dg/plugin/decl_plugin.cc: ...this.
	* g++.dg/plugin/def_plugin.c: Rename to...
	* g++.dg/plugin/def_plugin.cc: ...this.
	* g++.dg/plugin/dumb_plugin.c: Rename to...
	* g++.dg/plugin/dumb_plugin.cc: ...this.
	* g++.dg/plugin/header_plugin.c: Rename to...
	* g++.dg/plugin/header_plugin.cc: ...this.
	* g++.dg/plugin/pragma_plugin.c: Rename to...
	* g++.dg/plugin/pragma_plugin.cc: ...this.
	* g++.dg/plugin/selfassign.c: Rename to...
	* g++.dg/plugin/selfassign.cc: ...this.
	* g++.dg/plugin/show_template_tree_color_plugin.c: Rename to...
	* g++.dg/plugin/show_template_tree_color_plugin.cc: ...this.
	* gcc.dg/plugin/plugin.exp (plugin_test_list): Update for renaming
	of all plugin implementation files from .c to .cc.
	* gcc.dg/plugin/analyzer_cpython_plugin.c: Rename to...
	* gcc.dg/plugin/analyzer_cpython_plugin.cc: ...this.
	* gcc.dg/plugin/analyzer_gil_plugin.c: Rename to...
	* gcc.dg/plugin/analyzer_gil_plugin.cc: ...this.
	* gcc.dg/plugin/analyzer_kernel_plugin.c: Rename to...
	* gcc.dg/plugin/analyzer_kernel_plugin.cc: ...this.
	* gcc.dg/plugin/analyzer_known_fns_plugin.c: Rename to...
	* gcc.dg/plugin/analyzer_known_fns_plugin.cc: ...this.
	* gcc.dg/plugin/crash_test_plugin.c: Rename to...
	* gcc.dg/plugin/crash_test_plugin.cc: ...this.
	* gcc.dg/plugin/diagnostic_group_plugin.c: Rename to...
	* gcc.dg/plugin/diagnostic_group_plugin.cc: ...this.
	* gcc.dg/plugin/diagnostic_plugin_show_trees.c: Rename to...
	* gcc.dg/plugin/diagnostic_plugin_show_trees.cc: ...this.
	* gcc.dg/plugin/diagnostic_plugin_test_inlining.c: Rename to...
	* gcc.dg/plugin/diagnostic_plugin_test_inlining.cc: ...this.
	* gcc.dg/plugin/diagnostic_plugin_test_metadata.c: Rename to...
	* gcc.dg/plugin/diagnostic_plugin_test_metadata.cc: ...this.
	* gcc.dg/plugin/diagnostic_plugin_test_nesting.c: Rename to...
	* gcc.dg/plugin/diagnostic_plugin_test_nesting.cc: ...this.
	* gcc.dg/plugin/diagnostic_plugin_test_paths.c: Rename to...
	* gcc.dg/plugin/diagnostic_plugin_test_paths.cc: ...this.
	* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c: Rename to...
	* gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc: ...this.
	* gcc.dg/plugin/diagnostic_plugin_test_string_literals.c: Rename
	* gcc.dg/plugin/diagnostic_plugin_test_string_literals.cc: ..to
	this.
	* gcc.dg/plugin/diagnostic_plugin_test_text_art.c: Rename to...
	* gcc.dg/plugin/diagnostic_plugin_test_text_art.cc: ...this.
	* gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.c:
	Rename to...
	* gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.cc:
	...this.
	* gcc.dg/plugin/diagnostic_plugin_xhtml_format.c: Rename to...
	* gcc.dg/plugin/diagnostic_plugin_xhtml_format.cc: ...this.
	* gcc.dg/plugin/dump_plugin.c: Rename to...
	* gcc.dg/plugin/dump_plugin.cc: ...this.
	* gcc.dg/plugin/expensive_selftests_plugin.c: Rename to...
	* gcc.dg/plugin/expensive_selftests_plugin.cc: ...this.
	* gcc.dg/plugin/finish_unit_plugin.c: Rename to...
	* gcc.dg/plugin/finish_unit_plugin.cc: ...this.
	* gcc.dg/plugin/ggcplug.c: Rename to...
	* gcc.dg/plugin/ggcplug.cc: ...this.
	* gcc.dg/plugin/location_overflow_plugin.c: Rename to...
	* gcc.dg/plugin/location_overflow_plugin.cc: ...this.
	* gcc.dg/plugin/must_tail_call_plugin.c: Rename to...
	* gcc.dg/plugin/must_tail_call_plugin.cc: ...this.
	* gcc.dg/plugin/one_time_plugin.c: Rename to...
	* gcc.dg/plugin/one_time_plugin.cc: ...this.
	* gcc.dg/plugin/poly-int-01_plugin.c: Rename to...
	* gcc.dg/plugin/poly-int-01_plugin.cc: ...this.
	* gcc.dg/plugin/poly-int-02_plugin.c: Rename to...
	* gcc.dg/plugin/poly-int-02_plugin.cc: ...this.
	* gcc.dg/plugin/poly-int-03_plugin.c: Rename to...
	* gcc.dg/plugin/poly-int-03_plugin.cc: ...this.
	* gcc.dg/plugin/poly-int-04_plugin.c: Rename to...
	* gcc.dg/plugin/poly-int-04_plugin.cc: ...this.
	* gcc.dg/plugin/poly-int-05_plugin.c: Rename to...
	* gcc.dg/plugin/poly-int-05_plugin.cc: ...this.
	* gcc.dg/plugin/poly-int-06_plugin.c: Rename to...
	* gcc.dg/plugin/poly-int-06_plugin.cc: ...this.
	* gcc.dg/plugin/poly-int-07_plugin.c: Rename to...
	* gcc.dg/plugin/poly-int-07_plugin.cc: ...this.
	* gcc.dg/plugin/selfassign.c: Rename to...
	* gcc.dg/plugin/selfassign.cc: ...this.
	* gcc.dg/plugin/start_unit_plugin.c: Rename to...
	* gcc.dg/plugin/start_unit_plugin.cc: ...this.
	* gcc.dg/plugin/wide-int_plugin.c: Rename to...
	* gcc.dg/plugin/wide-int_plugin.cc: ...this.
	* obj-c++.dg/plugin/plugin.exp: Update for renaming of plugin
	implementation file from .c to .cc.
	* objc.dg/plugin/plugin.exp: Likewise.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-11-26 16:01:35 -05:00
David Malcolm
e2db825f85 csky: use quotes when referring to cpus and archs [PR90160]
gcc/ChangeLog:
	PR translation/90160
	* config/csky/csky.cc (csky_configure_build_target): Use %qs when
	referring to cpu and arch names.
	(csky_option_override): Likewise.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-11-26 15:58:25 -05:00
yulong
3e2a1b268c [PATCH] testsuite:RISC-V:Modify the char string.
From: yulong <shiyulong@iscas.ac.cn>

This patch modifies the char string from __riscv_xsfvcp to __riscv_xsfcease.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/predef-sf-2.c: Modify the char string.
2024-11-26 10:36:44 -07:00
Harald Anlauf
eff7e72815 Fortran: passing inquiry ref of complex array to assumed rank dummy [PR117774]
PR fortran/117774

gcc/fortran/ChangeLog:

	* trans-expr.cc (gfc_conv_procedure_call): When passing an array
	to an assumed-rank dummy, terminate search for array reference of
	actual argument before an inquiry reference (e.g. INQUIRY_RE,
	INQUIRY_IM) so that bounds update works properly.

gcc/testsuite/ChangeLog:

	* gfortran.dg/assumed_rank_25.f90: New test.
2024-11-26 17:06:32 +01:00
David Malcolm
5134bad11b c: avoid double-negative in warning message [PR94370]
gcc/c/ChangeLog:
	PR c/94370
	* c-typeck.cc (c_build_functype_attribute_variant): Reword
	warning message to avoid double-negative.

gcc/testsuite/ChangeLog:
	PR c/94370
	* gcc.dg/format/proto.c: Update wording of message.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-11-26 10:39:48 -05:00
David Malcolm
67458ea138 loop-prefetch: fix wording of warning [PR80760]
gcc/ChangeLog:
	PR translation/80760
	* tree-ssa-loop-prefetch.cc (pass_loop_prefetch::execute): Add
	missing colon to not-a-power-of-two param warning.

gcc/testsuite/ChangeLog:
	PR translation/80760
	* gcc.dg/tree-ssa/pr79803.c: Add ':' to expected warning.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-11-26 10:39:18 -05:00
David Malcolm
08bb92d642 plugin: add missing colon in error message [PR93746]
gcc/ChangeLog:
	PR plugins/93746
	* plugin.cc (try_init_one_plugin): Add missing colon in error
	message.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-11-26 10:39:12 -05:00
Alex Coplan
098a41cb97 gdbhooks: Handle references to vec* in VecPrinter
vec.h has this method:

  template<typename T, typename A>
  inline T *
  vec_safe_push (vec<T, A, vl_embed> *&v, const T &obj CXX_MEM_STAT_INFO)

where v is a reference to a pointer to vec.  This matches the regex for
VecPrinter, so gdbhooks.py attempts to print it but chokes on the reference.
I see the following:

  #1  0x0000000002b84b7b in vec_safe_push<edge_def*, va_gc> (v=Traceback (most
  recent call last):
    File "$SRC/gcc/gcc/gdbhooks.py", line 486, in to_string
      return '0x%x' % intptr(self.gdbval)
    File "$SRC/gcc/gcc/gdbhooks.py", line 168, in intptr
      return long(gdbval) if sys.version_info.major == 2 else int(gdbval)
  gdb.error: Cannot convert value to long.

This patch makes VecPrinter handle such references by stripping them
(dereferencing) at the top of the relevant functions.

gcc/ChangeLog:

	* gdbhooks.py (strip_ref): New. Use it ...
	(VecPrinter.to_string): ... here,
	(VecPrinter.children): ... and here.
2024-11-26 15:10:29 +00:00
Pan Li
a22dfe208d RISC-V: Refactor the testcases for RVV gather/scatter
This patch would like to refactor the testcases of gather/scatter
after sorts of optimization option passing to testcase.  Includes:

* Remove unnecessary optimization options.
* Adjust dg-final by any-opts and/or no-opts if the rtl dump changes
  on different optimization options (like O2, O3).

The below test suites are passed for this patch.
* The rv64gcv fully regression test.

It is test only patch and obvious up to a point, will commit it
directly if no comments in next 48H.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_64-12-zvbb.c:
	Adjust the dump check times.
	* gcc.target/riscv/rvv/autovec/gather-scatter/strided_load-1.c:
	Remove unnecessary option and add target no-opts/any-tops.
	* gcc.target/riscv/rvv/autovec/gather-scatter/strided_load-2.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/strided_store-1.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/strided_store-2.c: Ditto.

Signed-off-by: Pan Li <pan2.li@intel.com>
2024-11-26 20:53:55 +08:00
Pan Li
1802669b76 RISC-V: Fix incorrect optimization options passing to gather/scatter
Like the strided load/store, the testcases of vector gather/scatter are
designed to pick up different sorts of optimization options but actually
these option are ignored according to the Execution log of gcc.log.  This patch
would like to make it correct almost the same as what we fixed for
strided load/store.

The below test suites are passed for this patch.
* The rv64gcv fully regression test.

It is test only patch and obvious up to a point, will commit it
directly if no comments in next 48H.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/rvv.exp: Fix the incorrect optimization
	options passing to testcases.

Signed-off-by: Pan Li <pan2.li@intel.com>
2024-11-26 20:53:47 +08:00
Jan Hubicka
1729147f2b improve std::deque::_M_reallocate_map
Looking into reason why we still do throw_bad_alloc in clang binary I noticed
that quite few calls come from deque::_M_reallocate_map.  This patch adds
unreachable to limit the size of realloc_map.  _M_reallocate_map is called only
if new size is smaller then max_size.  map is an array holding pointers to
entries of fixed size.

Since rellocation is done by doubling the map size, I think the maximal size of
map allocated is max_size / deque_buf_size rounded up times two.  This should
be also safe for overflows since we have extra bit.

map size is always at least 8. Theoretically this computation may be wrong for
very large T, but in that case callers should never reallocate.

On the testcase I get:
jh@shroud:~> ~/trunk-install-new4/bin/g++ -O2 dq.C -c ; size -A dq.o | grep text
.text                                              284      0
.text._ZNSt5dequeIiSaIiEE17_M_reallocate_mapEmb    485      0
.text.unlikely                                      10      0
jh@shroud:~> ~/trunk-install-new5/bin/g++ -O2 dq.C -c ; size -A dq.o | grep text
.text                                              284      0
.text._ZNSt5dequeIiSaIiEE17_M_reallocate_mapEmb    465      0
.text.unlikely                                      10      0

so this saves about 20 bytes of rellocate_map, which I think is worthwhile.
Curiously enough gcc14 does:

jh@shroud:~> g++ -O2 dq.C -c ; size -A dq.o | grep text
.text                 604      0
.text.unlikely         10      0

which is 145 bytes smaller. Obvoius difference is that _M_reallocate_map gets inlined.
Compiling gcc14 preprocessed file with trunk gives:

jh@shroud:~> g++ -O2 dq.C -S ; size -A dq.o | grep text
.text                 762      0
.text.unlikely         10      0

So inlining is due to changes at libstdc++ side, but code size growth is due to
something else.

For clang this reduced number of thris_bad_new_array_length from 121 to 61.

libstdc++-v3/ChangeLog:

	* include/bits/deque.tcc (std::deque::_M_reallocate_map): Add
	__builtin_unreachable check to declare that maps are not very large.
	* include/bits/stl_deque.h (std::deque::size): Add __builtin_unreachable
	to check for maximal size of map.

gcc/testsuite/ChangeLog:

	* g++.dg/tree-ssa/deque-1.C: New test.
	* g++.dg/tree-ssa/deque-2.C: New test.
2024-11-26 13:54:21 +01:00
Eric Botcazou
ae7c0475f1 ada: Do not use ATTR_ADDR_EXPR for 'Unrestricted_Access
Unlike for 'Access or 'Unchecked_Access, the Attribute_to_gnu routine passes
ATTR_ADDR_EXPR to build_unary_op for 'Unrestricted_Access, which causes the
processing done in build_unary_op to flatten the reference, in particular to
remove all intermediate (view) conversions, which may be problematic for the
SUBSTITUTE_PLACEHOLDER_IN_EXPR machinery.

gcc/ada/ChangeLog:

	* gcc-interface/trans.cc (Attribute_to_gnu) <Attr_Access>: Do not
	pass ATTR_ADDR_EXPR to build_unary_op for 'Unrestricted_Access.
2024-11-26 10:49:36 +01:00
Eric Botcazou
84d8a383c9 ada: Add minimal support for address clause/aspect on controlled objects
The clause and aspect have been accepted by the compiler for a few years,
but the result is generally an internal compiler error or an incorrect
finalization at run time.

gcc/ada/ChangeLog:

	* exp_ch3.adb (Expand_N_Object_Declaration): Do not insert the tag
	assignment there if the object has the Address aspect.
	* exp_ch7.adb: Add clauses for Aspect package.
	(Build_Finalizer.Process_Object_Declaration): Deal with an object
	with delayed freezing.
	(Insert_Actions_In_Scope_Around): If the target is the declaration
	of an object with address clause or aspect, move all the statements
	that have been inserted after it into the Initialization_Statements
	list of the object.
	* freeze.adb (Check_Address_Clause): Do not reassign the tag here,
	instead set the appropriate flag on the assignment statement.
2024-11-26 10:49:36 +01:00
Eric Botcazou
936f9f1d15 ada: Clean up previous change
gcc/ada/ChangeLog:

	* sem_res.adb (Valid_Conversion): Do not initialize Opnd_Type before
	calling Get_Corresponding_Mutably_Tagged_Type_If_Present.
2024-11-26 10:49:36 +01:00
Eric Botcazou
e14ec5681e ada: Minor adjustments to error message for RM B.1(24)
The RM B.1(24) sub-clause says that imported entities cannot be initialized
and it is checked in three contexts, aspect Import, pragma Import and pragma
Import_Object, with slightly different error messages.  Moreover, for the
aspect, the error is given twice because that of the pragma is also given.

In addition, if the initialization expression is an aggregate that is not
static, the error is given only for the aspect and not for the two pragmas.

This change aligns the error messages on that of pragma Import and plugs the
aforementioned loophole for the two pragmas.

gcc/ada/ChangeLog:

	* sem_ch13.adb (Analyze_Aspect_Export_Import): Add explicit mention
	of the declaration in the error message for the Import.
	* sem_prag.adb (Process_Extended_Import_Export_Object_Pragma): Also
	test Has_Init_Expression on the declaration node for Import_Object
	and use the same wording as that of Import.
	(Process_Import_Or_Interface): Also test Has_Init_Expression on the
	declaration node for Import.
2024-11-26 10:49:36 +01:00
Javier Miranda
38b977cc07 ada: Refactor code of Check_Ambiguous_Call and Valid_Conversion
Code cleanup; factorizing code.

gcc/ada/ChangeLog:

	* sem_ch2.adb (Check_Ambiguous_Call): Replace code factorized
	code by call to the new subprogram Is_Ambiguous_Operand.
	* sem_res.ads (Is_Ambiguous_Operand): New subprogram that
	factorizes previous code in Check_Ambiguous_Call and
	Valid_Conversion.
	* sem_res.adb (Is_Ambiguous_Operand): New subprogram.
	(Valid_Tagged_Conversion): Replace factorized code by call to
	the new subprogram Is_Ambiguous_Operand.
	(Report_Error_N): New subprogram.
	(Report_Error_NE): New subprogram.
	(Report_Interpretation): New subprogram.
	(Conversion_Error_N): Removed; replaced by Report_Error_N.
	(Conversion_Error_NE): Removed; replaced by Report_Error_NE.
	(Valid_Conversion): Update Opnd_Type after the call to
	Is_Ambiguous_Operand in the overloaded case.
2024-11-26 10:49:36 +01:00
Viljar Indus
fed7c5cd73 ada: Relocate implementation of Write_Error_Summary
Reuse the same implementation in Errout and Errutil.

gcc/ada/ChangeLog:

	* errout.adb: Remove implmentation of Write_Error_Summary.
	* erroutc.adb: Add implemenetation of Write_Error_Summary.
	* erroutc.ads: Add spec of Write_Error_Summary.
	* errutil.adb: Remove implementation for writing the error summary.
2024-11-26 10:49:35 +01:00
Viljar Indus
9b33f74c84 ada: Relocate implementation of Set_Msg_Insertion_Column
The implementation was duplicated in errout and errutil. Move
the implementation to erroutc where other similar commonly used
functions are.

gcc/ada/ChangeLog:

	* errout.adb: Remove implemntation of Set_Msg_Insertion_Column.
	* erroutc.adb: Add implementation of Set_Msg_Insertion_Column.
	* erroutc.ads: Add spec of Set_Msg_Insertion_Column.
	* errutil.adb: Remove implementation of Set_Msg_Insertion_Column.
2024-11-26 10:49:35 +01:00
Viljar Indus
9fb54f47d0 ada: Remove Warn_Runtime_Raise attribute from Error_Msg_Object
The goal of this attribute is to raise a warning to an error when
the -gnatwE flag is used. This is similar to the existing warnings
as error behavior under the Warn_Err flag so it can be merged.

gcc/ada/ChangeLog:

	* errout.adb: Set Warn_Err as true if Is_Runtime_Error was
	set in the error message.
	* erroutc.adb: Remove instances of Warn_Runtime_Raise.
	* erroutc.ads: Likewise.
	* errutil.adb: Likewise.
2024-11-26 10:49:35 +01:00
Viljar Indus
8d0bb808f6 ada: Refactor checking redundant messages
Move common code between errout and errutil into a single function.

gcc/ada/ChangeLog:

	* errout.adb: Use Is_Redundant_Error_Message.
	* erroutc.adb: Move the common code for checking if a message
	can be removed to Is_Redundant_Error_Message.
	* erroutc.ads: Add definition of Is_Redundant_Error_Message.
	* errutil.adb: Use Is_Redundant_Error_Message.
2024-11-26 10:49:35 +01:00
Viljar Indus
ba0c6d0e4e ada: Remove Current_Node from Errout
This variable was used for Opt.Include_Subprogram_In_Messages
activated by -gnatdJ. This switch has been removed so this variable
is no longer used.

gcc/ada/ChangeLog:

	* errout.ads: Remove Current_Node.
	* errout.adb: Remove uses of Current_Node.
	* par-ch6.adb: Same as above.
	* par-ch7.adb: Same as above.
	* par-ch9.adb: Same as above.
2024-11-26 10:49:35 +01:00
Viljar Indus
2364e96f01 ada: Remove Raise_Exception_On_Error
Raise_Exception_On_Error is never modified so it can be removed.

gcc/ada/ChangeLog:

	* err_vars.ads: Remove Raise_Exception_On_Error and
	Error_Msg_Exception.
	* errout.ads: Same as above.
	* errout.adb: Remove uses of Raise_Exception_On_Error and
	Error_Msg_Exception.
	* errutil.adb: Same as above.
2024-11-26 10:49:35 +01:00
Viljar Indus
9a09142326 ada: Store error message kind as an enum
Simplify the storage for the kind of error message under a single
enumerator. This replaces the existing attributes with the following
enumeration values.
* Is_Warning_Msg => Warning
* Is_Style_Msg => Style
* Is_Info_Msg => Info
* Is_Check_Msg => Low_Check, Medium_Check, High_Check
* Is_Serious_Error => Error, if the attribute was false then
  Non_Serious_Error.

gcc/ada/ChangeLog:

	* diagnostics-converter.adb: Use new enum values instead
	of the old attributes.
	* diagnostics-switch_repository.adb: Same as above.
	* diagnostics-utils.adb: Same as above.
	* diagnostics.adb: Same as above.
	* diagnostics.ads: Same as above.
	* errout.adb: Same as above.
	* erroutc.adb: Same as above.
	* erroutc.ads: Remove old attriubtes and replace them
	with Error_Msg_Kind.
	* errutil.adb: Same as others.
2024-11-26 10:49:35 +01:00
Viljar Indus
20e7dfa9fb ada: Refactor code for printing the error location
gcc/ada/ChangeLog:

	* errout.adb: Use Output_Msg_Location
	* erroutc.adb: add common implementation for printing the
	error message line.
	* erroutc.ads: Add new method Output_Msg_Location
	* errutil.adb: use Output_Msg_Location
2024-11-26 10:49:34 +01:00
Viljar Indus
7cdb07a77b ada: Simplify code
gcc/ada/ChangeLog:

	* diagnostics-converter.adb: Remove uses of Info_Warning type. Use
	common constructors to simplify implementation.
	* diagnostics-pretty_emitter.adb: Remove Info_Warning type.
	* diagnostics-utils.adb: Remove uses of Info_Warning.
	* diagnostics.adb: Simplify implementation of Primary_Location.
	* diagnostics.ads: Remove Info_Warning type.
2024-11-26 10:49:34 +01:00
Jose Ruiz
92e782e775 ada: Fix the file documenting the ali format
gcc/ada/ChangeLog:

	* doc/gnat_ugn/the_gnat_compilation_model.rst: The format of
	the ali file is documented in lib-writ.ads.
	* gnat_ugn.texi: Regenerate.
2024-11-26 10:49:34 +01:00
Ronan Desplanques
bd0b9886f1 ada: Change specifications of Uname subprograms
The old specifications were ambiguous as to whether they expected
actuals to have %s/%b suffixes. The new specifications also increases
modularity across the board.

gcc/ada/ChangeLog:

	* uname.ads (Is_Internal_Unit_Name, Is_Predefined_Unit_Name): Change
	specifications to take a Unit_Name_Type as input.
	(Encoded_Library_Unit_Name): New subprogram.
	(Is_Predefined_Unit_Name): New overloaded subprogram.
	(Get_External_Unit_Name_String): Make use of new
	Encoded_Library_Unit_Name subprogram.
	* uname.adb (Is_Internal_Unit_Name, Is_Predefined_Unit_Name): Adapt
	bodies to specification changes.
	* fname-uf.adb (Get_File_Name): Adapt to Uname interface changes.
2024-11-26 10:49:34 +01:00
Ronan Desplanques
222da6bd24 ada: Remove use of global name buffer
Before this patch, the body of Fname.UF.Get_File_Name did a lot of
juggling with the global name buffer, which made it hard to understand.
This patch makes the body use local buffers instead.

gcc/ada/ChangeLog:

	* fname-uf.adb (Get_File_Name): Use local name buffers.
2024-11-26 10:49:34 +01:00
Ronan Desplanques
22bd313342 ada: Clean up utility function
This patch makes Sem_Util.Get_Library_Unit_Name use Uname more idiomatically.

gcc/ada/ChangeLog:

	* sem_util.adb (Get_Library_Unit_Name): Improve use of Uname.
2024-11-26 10:49:34 +01:00
Eric Botcazou
95bb4ef5cb ada: Fix latent issue exposed by recent change in aggregate expansion
The tag is not assigned when a compile-time known aggregate initializes an
object declared with an address clause/aspect.

gcc/ada/ChangeLog:

	* freeze.adb: Remove clauses for Exp_Ch3.
	(Check_Address_Clause): Always reassign the tag for an object of a
	tagged type if there is an initialization expression.
2024-11-26 10:49:34 +01:00
Paul Thomas
8278d9551d Fortran: Partial reversion of r15-5083 [PR117763]
2024-11-26  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
	PR fortran/117763
	* trans-array.cc (gfc_get_array_span): Guard against derefences
	of 'expr'. Clean up some typos. Use 'gfc_get_vptr_from_expr'
	for clarity and apply a functional reversion of last section
	that deals with class dummies.

gcc/testsuite/
	PR fortran/117763
	* gfortran.dg/pr117763.f90: New test.
2024-11-26 08:59:17 +00:00
Robin Dapp
9c82afd42e RISC-V: avlprop: Do not propagate VL from slidedown.
In the following situation (found in the
rvv/autovec/vls-vlmax/shuffle-slide.c test which is not yet pushed)

	vsetivli	zero,4,e8,mf4,ta,ma
	vle8.v	v2,0(a1)			# (1)
	vle8.v	v1,0(a2)			# (2)
	vsetivli	zero,2,e8,mf4,tu,ma
	vslidedown.vi	v1,v2,2
	vsetivli	zero,4,e8,mf4,ta,ma
	vse8.v	v1,0(a2)

we wrongly "propagate" VL=2 from vslidedown into the load.

Although we check whether the "target" instruction has a merge operand
the check only handles cases where the merge operand itself is
loaded, like (2) in the snippet above.  For (1) we load the non-merged
operand, assume propagation is valid and continue despite (2).

This patch just re-uses avl_can_be_propagated_p in order to disable
slides altogether in such situations.

gcc/ChangeLog:

	* config/riscv/riscv-avlprop.cc (pass_avlprop::get_vlmax_ta_preferred_avl):
	Check whether the use insn is valid for propagation.
2024-11-26 09:51:54 +01:00
Jakub Jelinek
5bb36d832c builtins: Fix up DFP ICEs on __builtin_fpclassify [PR102674]
This patch is similar to the one I've just posted, __builtin_fpclassify also
needs to print decimal float minimum differently and use real_from_string3.
Plus I've done some formatting fixes.

2024-11-26  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/102674
	* builtins.cc (fold_builtin_fpclassify): Use real_from_string3 rather
	than real_from_string.  Use "1E%d" format string rather than "0x1p%d"
	for decimal float minimum.  Formatting fixes.

	* gcc.dg/dfp/pr102674.c: New test.
2024-11-26 09:46:51 +01:00
Jakub Jelinek
f39e6b4f5c builtins: Fix up DFP ICEs on __builtin_is{inf,finite,normal} [PR43374]
__builtin_is{inf,finite,normal} builtins ICE on _Decimal{32,64,128,64x}
operands unless those operands are constant.

The problem is that we fold the builtins to comparisons with the largest
finite number, but
a) get_max_float was only handling binary floats
b) real_from_string again assumes binary float
and so we were ICEing in the build_real called after the two calls.

This patch adds decimal handling into get_max_float (well, moves it
from c-cppbuiltin.cc which was printing those for __DEC{32,64,128}_MAX__
macros) and uses real_from_string3 (perhaps it is time to rename it
to just real_from_string now that we can use function overloading)
so that it handles both binary and decimal floats.

2024-11-26  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/43374
gcc/
	* real.cc (get_max_float): Handle decimal float.
	* builtins.cc (fold_builtin_interclass_mathfn): Use
	real_from_string3 rather than real_from_string.  Use
	"1E%d" format string rather than "0x1p%d" for decimal
	float minimum.
gcc/c-family/
	* c-cppbuiltin.cc (builtin_define_decimal_float_constants): Use
	get_max_float.
gcc/testsuite/
	* gcc.dg/dfp/pr43374.c: New test.
2024-11-26 09:46:19 +01:00
Andrew Pinski
014b135672 affine: Remove unused variable rem from wide_int_constant_multiple_p
This might fix the current bootstrap failure on aarch64, I only tested it
on x86_64. But the rem variable is unused and the for poly_widest_int, there
could be loop if NUM_POLY_INT_COEFFS is 2 or more. In the case of aarch64,
NUM_POLY_INT_COEFFS is 2.
Note the reason why there is warning for the unused variable is due to the deconstructor.

Pushed as obvious after a build for x86_64-linux-gnu.

gcc/ChangeLog:

	* tree-affine.cc (wide_int_constant_multiple_p): Remove unused rem variable.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2024-11-26 00:43:14 -08:00
Jonathan Wakely
8692cb10e8
libstdc++: Add conditional noexcept to range access functions
As an extension, this adds conditional noexcept to std::begin, std::end,
and std::ssize.

libstdc++-v3/ChangeLog:

	* include/bits/range_access.h (begin, end, ssize): Add
	conditional noexcept.
	* testsuite/18_support/initializer_list/range_access.cc: Check
	results and noexcept-specifier for std::begin and std::end.
	* testsuite/24_iterators/headers/iterator/range_access_c++11.cc:
	Check for conditional noexcept on std::begin and std::end.
	* testsuite/24_iterators/headers/iterator/range_access_c++14.cc:
	Likewise.
	* testsuite/24_iterators/headers/iterator/range_access_c++17.cc:
	Likewise.
	* testsuite/24_iterators/range_access/range_access.cc: Check
	conditional noexcept is correct.
	* testsuite/24_iterators/range_access/range_access_cpp17.cc:
	Check std::size, std::empty and std::data.
	* testsuite/24_iterators/range_access/range_access_cpp20.cc:
	Check conditional noexcept on std::ssize.
2024-11-26 08:31:27 +00:00
Jonathan Wakely
828287eac4
libstdc++: Improve Doxygen comments in <forward_list>
Use Markdown backticks to format comments, instead of Doxygen @c and @a
commands.

libstdc++-v3/ChangeLog:

	* include/bits/forward_list.h: Use Markdown in Doxygen comments.
2024-11-26 08:31:27 +00:00
Jonathan Wakely
1f4f368345
libstdc++: Move std::error_category symbol to separate file [PR117630]
As described in PR 117630 the cow-stdexcept.cc file pulls in symbols
from system_error.cc, which are not actually needed there. Moving the
definition of error_category::_M_message to a separate file should solve
it.

libstdc++-v3/ChangeLog:

	PR libstdc++/117630
	* src/c++11/Makefile.am: Add new file.
	* src/c++11/Makefile.in: Regnerate.
	* src/c++11/cow-stdexcept.cc (error_category::_M_message): Move
	member function definition to ...
	* src/c++11/cow-system_error.cc: New file.
2024-11-26 08:31:26 +00:00
Cui, Lili
60b708a9c8 Optimize 128-bit vector permutation with pand, pandn and por.
This patch introduces a new subroutine in ix86_expand_vec_perm_const_1.
On x86, use mixed constant permutation for V8HImode and V16QImode when
SSE2 is supported. This patch handles certain vector shuffle operations
more efficiently using pand, pandn, and por. This change is intended to
improve assembly code generation for configurations that support SSE2.

gcc/ChangeLog:

	PR target/116675
	* config/i386/i386-expand.cc (expand_vec_perm_pand_pandn_por):
	New subroutine.
	(ix86_expand_vec_perm_const_1): Call expand_vec_perm_pand_pandn_por.

gcc/testsuite/ChangeLog:

	PR target/116675
	* gcc.target/i386/pr116675.c: New test.
2024-11-26 15:14:43 +08:00
Haochen Jiang
efb1d2e236 i386/testsuite: Correct AVX10.2 FP8 test mask usage
Under FP8, we should not use AVX512F_LEN_HALF to get the mask size since
it will get 16 instead of 8 and drop into wrong if condition. Correct
the usage for vcvtneph2[b,h]f8[,s] runtime test.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/avx10_2-512-vcvtneph2bf8-2.c: Correct 128bit
	mask usage.
	* gcc.target/i386/avx10_2-512-vcvtneph2bf8s-2.c: Ditto.
	* gcc.target/i386/avx10_2-512-vcvtneph2hf8-2.c: Ditto.
	* gcc.target/i386/avx10_2-512-vcvtneph2hf8s-2.c: Ditto.
2024-11-26 14:06:28 +08:00
Joseph Myers
980929bdb8 c: Fix ICEs from invalid atomic compound assignment [PR98195, PR117755]
As reported in bug 98195, there are ICEs from an _Atomic compound
assignment with an incomplete type on the RHS, arising from an invalid
temporary being created with such a type.  As reported in bug 117755,
there are also (different) ICEs in cases with complete types where the
binary operation itself is invalid, when inside a nested function,
arising from a temporary being created for the RHS, but then not used
because the binary operation returns error_mark_node, resulting in the
temporary not appearing in a TARGET_EXPR, never getting its
DECL_CONTEXT set by the gimplifier and eventually resulting in an ICE
in nested function processing (trying to find a function context for
the temporary) as a result.

Fix the first ICE with an earlier check for a complete type for the
RHS of an assignment so the problematic temporary is never created for
an incomplete type (which changes the error message three existing
tests get for that case; the new message seems as good as the old
one).  Fix the second ICE by ensuring that once a temporary has been
created, it always gets a corresponding TARGET_EXPR even on error.

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

	PR c/98195
	PR c/117755

gcc/c/
	* c-typeck.cc (build_atomic_assign): Always create a TARGET_EXPR
	for newval even in case of error from binary operation.
	(build_modify_expr): Check early for incomplete type of rhs.

gcc/testsuite/
	* gcc.dg/pr98195-1.c, gcc.dg/pr117755-1.c: New tests.
	* gcc.dg/noncompile/20020207-1.c, gcc.dg/pr14765-1.c,
	objc.dg/method-11.m: Update expected error messages.
2024-11-26 03:25:44 +00:00
GCC Administrator
f89c7916b9 Daily bump. 2024-11-26 00:19:26 +00:00
Gaius Mulley
e6d26a21e0 PR modula2/117777: m2 does not allow single const string in asm volatile
gm2 does not allow single const string in ASM VOLATILE.  The bugfix is to
modify AsmOperands in all passes except P3Build.bnf (which is correct).
The remaining passes need to make the term following the ConstExpression
optional.

gcc/m2/ChangeLog:

	PR modula2/117777
	* gm2-compiler/P0SyntaxCheck.bnf (AsmOperands): Allow term after
	ConstExpression to be optional.
	* gm2-compiler/P1Build.bnf (AsmOperands): Ditto.
	* gm2-compiler/P2Build.bnf (AsmOperands): Ditto.
	* gm2-compiler/PCBuild.bnf (AsmOperands): Ditto.
	* gm2-compiler/PHBuild.bnf (AsmOperands): Ditto.

gcc/testsuite/ChangeLog:

	PR modula2/117777
	* gm2/extensions/asm/pass/conststr.mod: New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2024-11-25 22:46:16 +00:00
Andrew Pinski
f6e00226a4 build: Move sstream include above safe-ctype.h {PR117771]
sstream in some versions of libstdc++ include locale which might not have been
included yet. safe-ctype.h defines the toupper, tolower, etc. as macros so the
c++ header files needed to be included before hand as comment in system.h says:
/* Include C++ standard headers before "safe-ctype.h" to avoid GCC
   poisoning the ctype macros through safe-ctype.h */

I don't understand how it was working before when memory was included after
safe-ctype.h rather than before. But this makes sstream consistent with the
other C++ headers.

Pushed as obvious after a build for riscv64-elf.

gcc/ChangeLog:

	PR target/117771
	* system.h: Move the include of sstream above safe-ctype.h.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2024-11-25 14:36:41 -08:00
H.J. Lu
c61576d89e sibcall: Check partial != 0 for BLKmode argument
The outgoing stack slot size may be different from the BLKmode argument
size due to parameter alignment.  Check partial != 0 for BLKmode argument
passed on stack.

gcc/

	PR middle-end/117098
	* calls.cc (store_one_arg): Check partial != 0 for BLKmode argument
	passed on stack.

gcc/testsuite/

	PR middle-end/117098
	* gcc.dg/sibcall-12.c: New test.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2024-11-26 05:48:45 +08:00
John David Anglin
22b13b1d4e hppa: Revise TImode aritmetic patterns to support arith11_operands
2024-11-25  John David Anglin  <danglin@gcc.gnu.org>

gcc/ChangeLog:

	PR target/117645
	* config/pa/pa.md (addti3): Revise pattern to support
	arith11_operands.  Use "R" operand prefix to print least
	significant register of TImode register pair.
	(addvti3, subti3, subvti3): Likewise.
	(negti2, negvti2): Use "R" operand prefix.
2024-11-25 16:40:29 -05:00
Vladimir N. Makarov
4b09e2c67e [PR117105][LRA]: Use unique value reload pseudo for early clobber operand
LRA did not generate insn satisfying insn constraints on the PR
test.  The reason for this is that LRA assigned the same hard reg for
two conflicting reload pseudos.  The two insn reload pseudos are
originated from the same pseudo and LRA tried to optimize as it
assigned the same value for the reload pseudos.  It is an LRA
optimization to minimize reload insns.  The two reload pseudos
conflict as one of them is an early clobber insn operands.  The patch
solves this problem by assigning unique value if the operand is early
clobber one.

gcc/ChangeLog:

	PR target/117105
	* lra-constraints.cc (get_reload_reg): Create unique value reload
	pseudos for early clobbered operands.

gcc/testsuite/ChangeLog:

	PR target/117105
	* gcc.target/i386/pr117105.c: New test.
2024-11-25 16:11:46 -05:00