Commit Graph

193983 Commits

Author SHA1 Message Date
Dimitar Dimitrov
75fa80bb56 testsuite: Skip btf-bitfields-1.c if int is less than 32-bits
This test spuriously fails on AVR with:
   error: width of 'bitfield_c' exceeds its type

8-bit and 16-bit microcontrollers do not seem to be the target audience
for BTF file format.  So the least intrusive fix is to simply skip the
test for them.

gcc/testsuite/ChangeLog:

	* gcc.dg/debug/btf/btf-bitfields-1.c: Skip if int is less than
	32-bits.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2022-06-24 23:30:22 +03:00
Harald Anlauf
f21f17f95c Fortran: fix checking of arguments to UNPACK when MASK is a variable [PR105813]
gcc/fortran/ChangeLog:

	PR fortran/105813
	* check.cc (gfc_check_unpack): Try to simplify MASK argument to
	UNPACK so that checking of the VECTOR argument can work when MASK
	is a variable.

gcc/testsuite/ChangeLog:

	PR fortran/105813
	* gfortran.dg/unpack_vector_1.f90: New test.
2022-06-24 22:27:11 +02:00
Dimitar Dimitrov
5cd0e80019 testsuite: Handle default_packed for gcc.dg/builtin-object-size-20.c
The gcc.dg/builtin-object-size-20.c test case assumes that the target
inserts padding between structure members.  Obviously it fails for
targets which pack structures by default.

Split the cases into two tests, so that the ones requiring structure
padding can be skipped for default_packed targets.

gcc/testsuite/ChangeLog:

	* gcc.dg/builtin-object-size-20.c: Remove cases which
	work on default_packed targets.
	* gcc.dg/builtin-object-size-22.c: New test with the cases
	removed above.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2022-06-24 23:22:14 +03:00
Dimitar Dimitrov
2e2371b5da testsuite: Rename test-defined macros
Epiphany, PRU, ARC and NDS32 may predefine __big_endian__ and
__little_endian__ macros.  This leads to spurious warnings like:
  gcc.dg/sso/memcpy-1.c:7: warning: "__little_endian__" redefined

Fix by renaming the macros in the test.

gcc/testsuite/ChangeLog:

	* gcc.dg/sso/memcpy-1.c (__big_endian__, __little_endian__):
	Rename macros to avoid conflicts with predefined ones.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2022-06-24 23:22:14 +03:00
Dimitar Dimitrov
b1d0d3520e testsuite: Remove reliance on argc in lto/pr101868_0.c
Some embedded targets do not pass any argv arguments.  When argc is
zero, this causes spurious failures for lto/pr101868_0.c.  Fix by
following the strategy in r0-114701-g2c49569ecea56d.  Use a volatile
variable instead of argc to inject a runtime value into the test.

I validated the following:
  - No changes in testresults for x86_64-pc-linux-gnu.
  - The spurious failures are fixed for PRU target.
  - lto/pr101868_0.c still fails on x86_64-pc-linux-gnu, if
    the PR/101868 fix (r12-2254-gfedcf3c476aff7) is reverted.

	PR tree-optimization/101868

gcc/testsuite/ChangeLog:

	* gcc.dg/lto/pr101868_0.c (zero): New volatile variable.
	(main): Use it instead of argc.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2022-06-24 23:22:14 +03:00
Iain Buclaw
5959cf8217 d: Give consistent error message when attribute argument not a string constant
gcc/d/ChangeLog:

	* d-attribs.cc (d_handle_section_attribute): Update error message.
	(d_handle_symver_attribute): Likewise.
	(d_handle_no_sanitize_attribute): Likewise.
	(d_handle_visibility_attribute): Likewise.

gcc/testsuite/ChangeLog:

	* gdc.dg/attr_section1.d: Update dg-error.
	* gdc.dg/attr_visibility1.d: Likewise.
2022-06-24 20:54:03 +02:00
Iain Buclaw
91418c4208 d: Add `@register' attribute to compiler and library.
The `@register` attribute specifies that a local or `__gshared` variable
is to be given a register storage-class in the C sense of the term, and
will be placed into a register named `registerName`.

The variable needs to boiled down to a data type that fits the target
register.  It also cannot have either thread-local or `extern` storage.
It is an error to take the address of a register variable.

	PR d/105413

gcc/d/ChangeLog:

	* d-attribs.cc (d_handle_register_attribute): New function.
	(d_langhook_attribute_table): Add register attribute.
	* d-codegen.cc (d_mark_addressable): Error if taken address of
	register variable.
	(build_frame_type): Error if register variable has non-local
	references.
	* d-tree.h (d_mark_addressable): Add complain parameter.
	* decl.cc (get_symbol_decl): Mark register varibles DECL_REGISTER.
	Error when register variable declared thread-local or extern.
	* expr.cc (ExprVisitor::visit (IndexExp *)): Don't complain about
	marking register vectors as addressable in an ARRAY_REF.

libphobos/ChangeLog:

	* libdruntime/gcc/attributes.d (register): Define.

gcc/testsuite/ChangeLog:

	* gdc.dg/attr_register1.d: New test.
	* gdc.dg/attr_register2.d: New test.
	* gdc.dg/attr_register3.d: New test.
2022-06-24 20:49:58 +02:00
Iain Buclaw
8288cd635f d: Construct indexes of ARRAY_TYPE using ARRAY_REF.
This is a small simplification over `((T *)&array)[index]', which also
allows eliding an unneccesary marking of TREE_ADDRESSABLE when the array
expression is a parameter or variable declaration.

gcc/d/ChangeLog:

	* d-codegen.cc (build_array_index): Rename to...
	(build_pointer_index): ...this.
	* d-tree.h (build_array_index): Rename declaration to...
	(build_pointer_index): ...this.
	* expr.cc (ExprVisitor::visit (IndexExp *)): Construct indexes of
	ARRAY_TYPE using ARRAY_REF.
	(ExprVisitor::visit (SliceExp *)): Update.
	* intrinsics.cc (expand_intrinsic_bt): Update.
2022-06-24 20:49:58 +02:00
Iain Buclaw
d97f3bca6e d: Merge upstream dmd 529110f66, druntime 148608b7.
D front-end changes:

    - Import latest bug fixes to mainline.

gcc/d/ChangeLog:

	* dmd/MERGE: Merge upstream dmd 529110f66.
	* decl.cc (DeclVisitor::visit (TupleDeclaration *)): Update for new
	front-end interface.
	* types.cc (layout_aggregate_members): Likewise.

libphobos/ChangeLog:

	* libdruntime/MERGE: Merge upstream druntime 148608b7.
2022-06-24 20:49:58 +02:00
Iain Buclaw
c0ad48527c tilegx: Fix infinite loop in gen-mul-tables generator
Since around GCC 10, the condition `j < (INTMAX_MAX / 10)' will get
optimized into `j != 922337203685477580', which will result in an
infinite loop for certain inputs of `j'.

Copy the condition already used by the -DTILEPRO generator code, which
doesn't fall into this trap.

gcc/ChangeLog:

	* config/tilepro/gen-mul-tables.cc (tilegx_emit): Adjust loop
	condition to avoid overflow.
2022-06-24 20:49:58 +02:00
Ian Lance Taylor
bb403de36a compiler: use bool for comma-ok if not already boolean
If a comma-ok variable already has a type, and that type is not a
boolean type, then set the type of the temporary variable to bool.
Otherwise we may try to convert an unnamed bool type to an interface
type, which will fail. But we don't want to always use bool, because
the type of the comma-ok variable may be a named bool type, in
which case the assignment would fail (or need an explicit conversion).

The test case is https://go.dev/cl/404496.

Fixes golang/go#52535

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/413894
2022-06-24 11:24:57 -07:00
David Malcolm
bb8e93eb1a analyzer: consolidate call_string instances
ana::call_string is a wrapper around an auto_vec of callsites, leading
to non-trivial copying when copying around call_string instances, e.g.
in ana::program_point.

This patch consolidates call_string instances within the
region_model_manager: it now owns the root/empty call_string, and
each call_string instance tracks its children, lazily creating them on
demand, so that the call_string instances form a tree-like hierarchy in
memory.  Doing this requires passing the region_model_manager to the
various program_point factory methods, so that they can get at the root
call_string.

Instances of call_string become immutable (apart from their internal
cache for looking up their children); operations that previously
modified them now return the call_string for the result of the
operation.

I wasn't able to observe any performance impact of this, but it
simplifies call_string and program_point management, and thus I hope
will make it easier to improve call summarization.  In particular,
region_model_manager::log_stats will now print a hierarchical dump of
all the call_string instances used in the analysis (in -fdump-analyzer
and -fdump-analyzer-stderr).

gcc/analyzer/ChangeLog:
	* call-string.cc: Add includes of "analyzer/analyzer.h"
	and "analyzer/analyzer-logging.h".
	(call_string::call_string): Delete copy ctor.
	(call_string::operator=): Delete.
	(call_string::operator==): Delete.
	(call_string::hash): Delete.
	(call_string::push_call): Make const, returning the resulting
	call_string.
	(call_string::pop): Delete.
	(call_string::cmp_ptr_ptr): New.
	(call_string::validate): Assert that m_parent is non-NULL, or
	m_elements is empty.
	(call_string::call_string): Move default ctor here from
	call-string.h and reimplement.  Add ctor taking a parent
	and an element.
	(call_string::~call_string): New.
	(call_string::recursive_log): New.
	* call-string.h (call_string::call_string): Move default ctor's
	defn to call-string.cc.  Delete copy ctor.  Add ctor taking a
	parent and an element.
	(call_string::operator=): Delete.
	(call_string::operator==): Delete.
	(call_string::hash): Delete.
	(call_string::push_call): Make const, returning the resulting
	call_string.
	(call_string::pop): Delete decl.
	(call_string::get_parent): New.
	(call_string::cmp_ptr_ptr): New decl.
	(call_string::get_top_of_stack): New.
	(struct call_string::hashmap_traits_t): New.
	(class call_string): Add friend class region_model_manager.  Add
	DISABLE_COPY_AND_ASSIGN.
	(call_string::~call_string): New decl.
	(call_string::recursive_log): New decl.
	(call_string::m_parent): New field.
	(call_string::m_children): New field.
	* constraint-manager.cc (selftest::test_many_constants): Pass
	model manager to program_point::origin.
	* engine.cc (exploded_graph::exploded_graph): Likewise.
	(exploded_graph::add_function_entry): Likewise for
	program_point::from_function_entry.
	(add_tainted_args_callback): Likewise.
	(exploded_graph::maybe_process_run_of_before_supernode_enodes):
	Update for change to program_point.get_call_string.
	(exploded_graph::process_node): Likewise.
	(class function_call_string_cluster): Convert m_cs from a
	call_string to a const call_string &.
	(struct function_call_string): Likewise.
	(pod_hash_traits<function_call_string>::hash): Use pointer_hash
	for m_cs.
	(pod_hash_traits<function_call_string>::equal): Update for change
	to m_cs.
	(root_cluster::add_node): Update for change to
	function_call_string.
	(viz_callgraph_node::dump_dot): Update for change to call_string.
	* exploded-graph.h (per_call_string_data::m_key): Convert to a
	reference.
	(struct eg_call_string_hash_map_traits): Delete.
	(exploded_graph::call_string_data_map_t): Remove traits class.
	* program-point.cc: Move include of "analyzer/call-string.h" to
	after "analyzer/analyzer-logging.h".
	(program_point::print): Update for conversion of m_call_string to
	a pointer.
	(program_point::to_json): Likewise.
	(program_point::push_to_call_stack): Update for immutability of
	call strings.
	(program_point::pop_from_call_stack): Likewise.
	(program_point::hash): Use pointer hashing for m_call_string.
	(program_point::get_function_at_depth): Update for change to
	m_call_string.
	(program_point::validate): Update for changes to call_string.
	(program_point::on_edge): Likewise.
	(program_point::origin): Move here from call-string.h.  Add
	region_model_manager param and use it to get empty call string.
	(program_point::from_function_entry): Likewise.
	(selftest::test_function_point_ordering): Likewise.
	(selftest::test_function_point_ordering): Likewise.
	* program-point.h (program_point::program_point): Update for
	change to m_call_string.
	(program_point::get_call_string): Likewise.
	(program_point::get_stack_depth): Likewise.
	(program_point::origin): Add region_model_manager param, and move
	defn to call-string.cc.
	(program_point::from_function_entry): Likewise.
	(program_point::empty): Drop call_string.
	(program_point::deleted): Likewise.
	(program_point::program_point): New private ctor.
	(program_point::m_call_string): Convert from call_string to const
	call_string *.
	* program-state.cc (selftest::test_program_state_merging): Update
	for call_string changes.
	(selftest::test_program_state_merging_2): Likewise.
	* region-model-manager.cc
	(region_model_manager::region_model_manager): Construct
	m_empty_call_string.
	(region_model_manager::log_stats): Log the call strings.
	* region-model.cc (assert_region_models_merge): Pass the
	region_model_manager when creating program_point instances.
	(selftest::test_state_merging): Likewise.
	(selftest::test_constraint_merging): Likewise.
	(selftest::test_widening_constraints): Likewise.
	(selftest::test_iteration_1): Likewise.
	* region-model.h (region_model_manager::get_empty_call_string):
	New.
	(region_model_manager::m_empty_call_string): New.
	* sm-signal.cc (register_signal_handler::impl_transition): Update
	for changes to call_string.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-06-24 13:44:48 -04:00
David Malcolm
3752e21d8c analyzer: whitespace cleanups
Clean up whitespace in preparation for a follow-up patch.

No functional change intended.

gcc/analyzer/ChangeLog:
	* call-string.cc (call_string::calc_recursion_depth): Whitespace
	cleanups.
	(call_string::cmp): Likewise.
	(call_string::get_caller_node): Likewise.
	(call_string::validate): Likewise.
	* engine.cc (dynamic_call_info_t::add_events_to_path): Likewise.
	(exploded_graph::get_per_function_data): Likewise.
	(exploded_graph::maybe_create_dynamic_call): Likewise.
	(exploded_graph::maybe_create_dynamic_call): Likewise.
	(exploded_graph::process_node): Likewise.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-06-24 13:43:01 -04:00
Will Schmidt
eb2887a19f [PATCH,RS6000 5/5] Replace MASK_<xxxx> usage with OPTION_MASK_<xxxx>
This continues the changes of replacing the MASK_<xxxx> defines
with their OPTION_MASK_<xxxx> equivalents.

This patch removes the defines for
MASK_P8_VECTOR, MASK_P9_VECTOR, MASK_P9_MISC, MASK_POPCNTB,
MASK_POPCNTD, MASK_PPC_GFXOPT, MASK_PPC_GPOPT, MASK_RECIP_PRECISION,
MASK_SOFT_FLOAT, MASK_VSX, MASK_POWER10, MASK_P10_FUSION.

gcc/
	* config/rs6000/aix71.h (MASK_PPC_GPOPT, MASK_PPC_GFXOPT): Replace with
	OPTION_MASK_PPC_GPOPT, OPTION_MASK_PPC_GFXOPT.
	* config/rs6000/darwin.h (MASK_PPC_GFXOPT): Replace with
	OPTION_MASK_PPC_GFXOPT.
	* config/rs6000/darwin64-biarch.h (MASK_PPC_GFXOPT): Same.
	* config/rs6000/default64.h (MASK_PPC_GPOPT, MASK_PPC_GFXOPT): Replace with
	OPTION_MASK_PPC_GPOPT, OPTION_MASK_PPC_GFXOPT.
	* config/rs6000/rs6000-c.cc: Update comment.
	* config/rs6000/rs6000-cpus.def: Update RS6000_CPU macro calls.
	* config/rs6000/rs6000.cc (rs6000_darwin_file_start): Replace
	MASK_PPC_GPOPT with OPTION_MASK_PPC_GPOPT.
	(rs6000_builtin_mask_names): Replace MASK_PPC_GFXOPT, MASK_POPCNTB
	with OPTION_MASK_PPC_GFXOPT, OPTION_MASK_POPCNTB.
	* config/rs6000/rs6000.h: (MASK_P8_VECTOR, MASK_P9_VECTOR,
	MASK_P9_MISC, MASK_POPCNTB, MASK_POPCNTD, MASK_PPC_GFXOPT,
	MASK_PPC_GPOPT, MASK_RECIP_PRECISION, MASK_SOFT_FLOAT,
	MASK_VSX, MASK_POWER10, MASK_P10_FUSION): Delete.
2022-06-24 09:21:03 -05:00
Will Schmidt
9ccc75eba9 [PATCH,RS6000 4/5] Replace MASK_<xxxx> with OPTION_MASK_<xxxx>
This replaces the MASK_<xxxx> references with OPTION_MASK_<xxxx>
and removes the now unused defines.

This patch removes the defines for
MASK_ALTIVEC, MASK_CMPB, MASK_CRYPTO, MASK_DFP,
MASK_DIRECT_MOVE, MASK_DLMZB, MASK_EABI, MASK_FLOAT128_KEYWORD,
MASK_FLOAT128_HW, MASK_FPRND, MASK_P8_FUSION, MASK_HARD_FLOAT,
MASK_HTM, MASK_MFCRF, MASK_MMA, MASK_MULHW, MASK_MULTIPLE,
MASK_NO_UPDATE.

gcc/
	* config/rs6000/aix71.h (TARGET_DEFAULT): Replace MASK_MFCRF with
	OPTION_MASK_MFCRF.
	* config/rs6000/darwin.h (TARGET_DEFAULT): Replace MASK_MULTIPLE with
	OPTION_MASK_MULTIPLE.
	* config/rs6000/darwin64-biarch.h (TARGET_DEFAULT): Same.
	* config/rs6000/default64.h (TARGET_DEFAULT): Replace MASK_MFCRF with
	OPTION_MASK_MFCRF.
	* config/rs6000/eabi.h (TARGET_DEFAULT): Replace MASK_EABI with
	OPTION_MASK_EABI.
	* config/rs6000/eabialtivec.h (TARGET_DEFAULT): Same.
	* config/rs6000/linuxaltivec.h (TARGET_DEFAULT): Replace
	MASK_ALTIVEC with OPTION_MASK_ALTIVEC.
	* config/rs6000/rs6000-cpus.def (MASK_ALTIVEC, MASK_CMPB,
	MASK_CRYPTO, MASK_DFP, MASK_DIRECT_MOVE, MASK_DLMZB, MASK_EABI,
	MASK_FLOAT128_KEYWORD, MASK_FLOAT128_HW, MASK_FPRND,
	MASK_P8_FUSION, MASK_HARD_FLOAT, MASK_HTM, MASK_ISEL, MASK_MFCRF,
	MASK_MMA, MASK_MULHW, MASK_MULTIPLE, MASK_NO_UPDATE):
	Replace with
	OPTION_MASK_ALTIVEC, OPTION_MASK_CMPB, OPTION_MASK_CRYPTO,
	OPTION_MASK_DFP, OPTION_MASK_DIRECT_MOVE, OPTION_MASK_DLMZB,
	OPTION_MASK_EABI, OPTION_MASK_FLOAT128_KEYWORD,
	OPTION_MASK_FLOAT128_HW, OPTION_MASK_FPRND, OPTION_MASK_P8_FUSION,
	OPTION_MASK_HARD_FLOAT, OPTION_MASK_HTM, OPTION_MASK_ISEL,
	OPTION_MASK_MFCRF, OPTION_MASK_MMA, OPTION_MASK_MULHW,
	OPTION_MASK_MULTIPLE, OPTION_MASK_NO_UPDATE.
	* config/rs6000/rs6000.cc (rs6000_darwin_file_start): Replace
	MASK_MFCRF, MASK_ALTIVEC with OPTION_MASK_MFCRF, OPTION_MASK_ALTIVEC.
	* config/rs6000/rs6000.h (TARGET_DEFAULT): Replace MASK_MULTIPLE
	with OPTION_MASK_MULTIPLE.
	(MASK_ALTIVEC, MASK_CMPB, MASK_CRYPTO, MASK_DFP,
	MASK_DIRECT_MOVE, MASK_DLMZB, MASK_EABI, MASK_FLOAT128_KEYWORD,
	MASK_FLOAT128_HW, MASK_FPRND, MASK_P8_FUSION, MASK_HARD_FLOAT,
	MASK_HTM, MASK_ISEL, MASK_MFCRF, MASK_MMA, MASK_MULHW,
	MASK_MULTIPLE, MASK_NO_UPDATE): Delete.
	* config/rs6000/vxworks.h (TARGET_DEFAULT): Replace MASK_EABI
	with OPTION_MASK_EABI.
2022-06-24 09:20:02 -05:00
Will Schmidt
a5c117e9f3 [PATCH,RS6000 3/5] Rework the RS6000_BTM defines, continued.
The RS6000_BTM_<xxxx> definitions are mostly unused after
the rs6000 builtin code was reworked.   This cleans
up the remaining RS6000_BTM_<xxxx> references by replacing
them with their OPTION_MASK_<xxxx> equivalents.

This patch removes the defines
RS6000_BTM_MODULO, RS6000_BTM_ALTIVEC, RS6000_BTM_CMPB,
RS6000_BTM_VSX, RS6000_BTM_P8_VECTOR, RS6000_BTM_P9_VECTOR,
RS6000_BTM_P9_MISC, RS6000_BTM_CRYPTO, RS6000_BTM_HTM,
RS6000_BTM_FRE.

gcc/
	* config/rs6000/rs6000.cc (RS6000_BTM_ALTIVEC, RS6000_BTM_CMPB,
	RS6000_BTM_VSX, RS6000_BTM_FRE, RS6000_BTM_P8_VECTOR,
	RS6000_BTM_P9_VECTOR, RS6000_BTM_P9_MISC, RS6000_BTM_MODULO,
	RS6000_BTM_CRYPTO, RS6000_BTM_HTM): Replace with OPTION_MASK_ALTIVEC,
	OPTION_MASK_CMPB, OPTION_MASK_VSX, OPTION_MASK_POPCNTB,
	OPTION_MASK_P8_VECTOR, OPTION_MASK_P9_VECTOR, OPTION_MASK_P9_MISC,
	OPTION_MASK_MODULO, OPTION_MASK_CRYPTO, OPTION_MASK_HTM.
	* config/rs6000/rs6000.h (RS6000_BTM_MODULO, RS6000_BTM_ALTIVEC,
	RS6000_BTM_CMPB, RS6000_BTM_VSX, RS6000_BTM_P8_VECTOR,
	RS6000_BTM_P9_VECTOR, RS6000_BTM_P9_MISC, RS6000_BTM_CRYPTO,
	RS6000_BTM_HTM, RS6000_BTM_FRE): Remove.
2022-06-24 09:18:14 -05:00
Will Schmidt
0c0d2b63a7 [PATCH,RS6000 2/5] Rework the RS6000_BTM defines.
The RS6000_BTM_<xxxx> definitions are mostly unused after the rs6000
builtin code was reworked.  The remaining references can be replaced
with the OPTION_MASK_<xxxx> and MASK_<xxxx> equivalents.

This patch remvoes the defines:
RS6000_BTM_FRES, RS6000_BTM_FRSQRTE, RS6000_BTM_FRSQRTES,
RS6000_BTM_POPCNTD, RS6000_BTM_CELL, RS6000_BTM_DFP,
RS6000_BTM_HARD_FLOAT, RS6000_BTM_LDBL128, RS6000_BTM_64BIT,
RS6000_BTM_POWERPC64, RS6000_BTM_FLOAT128, RS6000_BTM_FLOAT128_HW
RS6000_BTM_MMA, RS6000_BTM_P10.

I note that the BTM -> OPTION_MASK mappings are not always 1-to-1.
in particular the BTM_FRES and BTM_FRSQRTE values were both mapped to
OPTION_MASK_PPC_GFXOPT, while the BTM_FRE and BTM_FRSQRTES both mapped
to OPTION_MASK_POPCNTB.  In total I spent quite a bit of time
double-checking these since it looked like copy/paste errors.  I split
some of these changes out into a subsequent patch to limit the amount
of potential confusion in any particular patch.

gcc/
	* config/rs6000/rs6000-c.cc: Update comments.
	* config/rs6000/rs6000.cc (RS6000_BTM_FRES, RS6000_BTM_FRSQRTE,
	RS6000_BTM_FRSQRTES, RS6000_BTM_POPCNTD, RS6000_BTM_CELL,
	RS6000_BTM_64BIT, RS6000_BTM_POWERPC64, RS6000_BTM_DFP,
	RS6000_BTM_HARD_FLOAT,RS6000_BTM_LDBL128, RS6000_BTM_FLOAT128,
	RS6000_BTM_FLOAT128_HW, RS6000_BTM_MMA, RS6000_BTM_P10): Replace
	with OPTION_MASK_PPC_GFXOPT, OPTION_MASK_PPC_GFXOPT,
	OPTION_MASK_POPCNTB, OPTION_MASK_POPCNTD,
	OPTION_MASK_FPRND, MASK_64BIT, MASK_POWERPC64,
	OPTION_MASK_DFP, OPTION_MASK_SOFT_FLOAT, OPTION_MASK_MULTIPLE,
	OPTION_MASK_FLOAT128_KEYWORD, OPTION_MASK_FLOAT128_HW,
	OPTION_MASK_MMA, OPTION_MASK_POWER10.
	* config/rs6000/rs6000.h (RS6000_BTM_FRES, RS6000_BTM_FRSQRTE,
	RS6000_BTM_FRSQRTES, RS6000_BTM_POPCNTD, RS6000_BTM_CELL,
	RS6000_BTM_DFP, RS6000_BTM_HARD_FLOAT, RS6000_BTM_LDBL128,
	RS6000_BTM_64BIT, RS6000_BTM_POWERPC64, RS6000_BTM_FLOAT128,
	RS6000_BTM_FLOAT128_HW, RS6000_BTM_MMA, RS6000_BTM_P10): Delete.
2022-06-24 09:18:06 -05:00
Will Schmidt
124580b00f [PATCH,RS6000 1/5] Clean-up MASK_<xxxx> and RS6000_BTM_<xxxx> definitions.
This patch removes the defines that are no longer used, and
updates the comment for the set of MASK_<xxxx> defines.

This patch removes the defines for
MASK_REGNAMES, MASK_PROTOTYPE, RS6000_BTM_ALWAYS, RS6000_BTM_COMMON.

gcc/
	* config/rs6000/rs6000.h (RS6000_BTM_COMMON, RS6000_BTM_ALWAYS,
	MASK_REGNAMES, OPTION_MASK_REGNAMES, MASK_PROTOTYPE,
	OPTION_MASK_PROTOTYPE, MASK_UPDATE, OPTION_MASK_UPDATE): Remove.
2022-06-24 09:15:51 -05:00
Richard Biener
b36a1c964f middle-end/106070 - bogus cond-expr folding
The following fixes up r13-469-g9a53101caadae1b5 by properly
implementing what operand_equal_for_comparison_p did.

2022-06-24  Richard Biener  <rguenther@suse.de>

	PR middle-end/106070
	* match.pd (a != b ? a : b): Fix translation of
	operand_equal_for_comparison_p.

	* gcc.dg/torture/pr106070.c: New testcase.
2022-06-24 14:50:05 +02:00
Xi Ruoyao
fa4e97907f
libstdc++: use grep -E instead of egrep in scripts
egrep has been deprecated in favor of grep -E for a long time, and the
next grep release (3.8 or 4.0) will print a warning of egrep is used.
Stop using egrep so we won't see the warning.

grep's from GNU, BSD (including Mac OS X), AIX, BusyBox all support -E
and -F.  Solaris grep doesn't support -E, but extract_symvers.in already
contains a special case for Solaris and doxygen documentation generation
is already broken on non-GNU.

libstdc++-v3/ChangeLog:

	* scripts/extract_symvers.in: Use grep -E instead of egrep.
	* scripts/run_doxygen: Likewise.
2022-06-24 20:31:31 +08:00
Jan Hubicka
7fd34782b9 Fix stmt_kills_ref_p WRT external throws
Add missing check to stmt_kills_ref_p for case that function
is terminated by EH before call return value kills the ref. In the PR
I tried to construct testcase but I don't know how to do that until I
annotate EH code with fnspec attributes which I will do in separate patch
and add a testcase.

	PR ipa/106057
	* tree-ssa-alias.cc (stmt_kills_ref_p): Check for external throw.
2022-06-24 13:52:44 +02:00
Martin Liska
268b5c81e9 profile-count: fix /= and *= operators
PR middle-end/106059

gcc/ChangeLog:

	* profile-count.h: *= and /= operators need to modify this
	object.
2022-06-24 10:43:46 +02:00
Roger Sayle
3b8794302b PR target/105930: Split *xordi3_doubleword after reload on x86.
This patch addresses PR target/105930 which is an ia32 stack frame size
regression in high-register pressure XOR-rich cryptography functions
reported by Linus Torvalds.  The underlying problem is once the limited
number of registers on the x86 are exhausted, the register allocator
has to decide which to spill, where some eviction choices lead to much
poorer code, but these consequences are difficult to predict in advance.

The patch below, which splits xordi3_doubleword and iordi3_doubleword
after reload (instead of before), significantly reduces the amount of
spill code and stack frame size, in what might appear to be an arbitrary
choice.

My explanation of this behaviour is that the mixing of pre-reload split
SImode instructions and post-reload split DImode instructions is
confusing some of the heuristics used by reload.  One might think
that splitting early gives the register allocator more freedom to
use available registers, but in practice the constraint that double
word values occupy consecutive registers (when ultimately used as a
DImode value) is the greater constraint.  Instead, I believe in this
case, the pseudo registers used in memory addressing, appear to be
double counted for split SImode instructions compared to unsplit
DImode instructions.  For the reduced test case in comment #13, this
leads to %eax being used to hold the long-lived argument pointer "v",
blocking the use of the ax:dx pair for processing double word values.
The important lines are at the very top of the assembly output:

GCC 11	[use %ecx to address memory, require a 24-byte stack frame]
        sub     esp, 24
        mov     ecx, DWORD PTR [esp+40]

GCC 12 [use %eax to address memory, require a 44-byte stack frame]
        sub     esp, 44
        mov     eax, DWORD PTR [esp+64]

2022-06-24  Roger Sayle  <roger@nextmovesoftware.com>
	    Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog
	PR target/105930
	* config/i386/i386.md (*<any_or>di3_doubleword): Split after
	reload.  Use rtx_equal_p to avoid creating memory-to-memory moves,
	and emit NOTE_INSN_DELETED if operand[2] is zero (i.e. with -O0).
2022-06-24 07:15:08 +01:00
Alexandre Oliva
93070671ea libstdc++: check for openat
rtems6.0 has fdopendir, and fcntl.h defines AT_FDCWD and declares
openat, but there's no openat in libc.  Adjust dir-common.h to not
assume ::openat just because of AT_FDCWD.


for  libstdc++-v3/ChangeLog

	* acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Check for
	openat.
	* configure, config.h.in: Rebuilt.
	* src/filesystem/dir-common.h (openat): Use ::openat if
	_GLIBCXX_HAVE_OPENAT.
	* src/filesystem/dir.cc (dir_and_pathname): Use dirfd if
	_GLIBCXX_HAVE_OPENAT.
2022-06-23 23:28:14 -03:00
Alexandre Oliva
5d8a5f04ac libstdc++: xfail rename tests on rtems
::rename on RTEMS does not meet several POSIX requirements, despite
compliance with C and C++ standards.  ::std::filesystem::rename, in
turn, has requirements borrowed from POSIX, so it would have to be a
lot more than a simple wrapper around ::rename on RTEMS, and even then
fall short.

Until RTEMS reimplements ::rename for POSIX compliance, expect
filesystem rename tests to fail on it.


for  libstdc++-v3/ChangeLog

	* testsuite/27_io/filesystem/operations/rename.cc: xfail on
	rtems.
	* testsuite/experimental/filesystem/operations/rename.cc:
	Likewise.
2022-06-23 23:28:14 -03:00
Alexandre Oliva
f01cf5eaa0 libstdc++: testsuite: skip fs last_write_time tests if dummy
The last_write_time functions are defined in ways that are useful, or
that fail immediately, depending on various macros.  When they fail
immediately, the filesystem last_write_time.cc tests fail noisily, but
the fail is entirely expected.

Define NO_LAST_WRITE_TIME in the last_write_time.cc tests, according
to the macros that select implementations of last_write_time, and use
it through the new dg-require-target-fs-lwt to skip tests that are
expected to fail.


for  libstdc++-v3/ChangeLog

	* testsuite/util/testsuite_fs.h (NO_LAST_WRITE_TIME): Define
	when appropriate.
	* testsuite/lib/libstdc++.exp
	(check_v3_target_fs_last_write_time): New.
	* testsuite/lib/dg-options.exp (dg-require-target-fs-lwt):
	New.
	* testsuite/27_io/filesystem/operations/last_write_time.cc:
	Skip the test if the features are unavailable.
	* testsuite/experimental/filesystem/operations/last_write_time.cc:
	Likewise.
2022-06-23 23:28:14 -03:00
Alexandre Oliva
b931c6874e libstdc++: testsuite: skip fs space tests on dummy implementations
The do_space function is defined in ways that are useful, or that fail
immediately, depending on various macros.  When it fails immediately,
the filesystem space.cc tests fail noisily, but the fail is entirely
expected.

Define NO_SPACE in testsuite_fs.h, according to the macros that select
implementations of do_space, and use it to skip tests that are
expected to fail, through a new dg-require.


for  libstdc++-v3/ChangeLog

	* testsuite/util/testsuite_fs.h (NO_SPACE): Define if
	appropriate.
	* testsuite/lib/libstdc++.exp (check_v3_target_fs_space): New.
	* testsuite/lib/dg-options.exp (dg-require-target-fs-space):
	New.
	* testsuite/27_io/filesystem/operations/space.cc: Require
	target-fs-space.
	* testsuite/experimental/filesystem/operations/space.cc:
	Likewise.
2022-06-23 23:28:14 -03:00
Alexandre Oliva
9f7f25bb35 libstdc++: testsuite: conditionalize symlink tests
Several filesystem tests expect to be able to create symlinks even
when !defined (_GLIBCXX_HAVE_SYMLINK), and fail predictably, reducing
the amount of testing of other filesystem features.

They are already skipped for mingw targets.  I've extended the
skipping to other targets in which _GLIBCXX_HAVE_SYMLINK is undefined,
through a new NO_SYMLINKS macro in testsuite_fs.h that guards
skippable portions of tests, and dg-require-target-fs-symlinks for
tests that would be reduced to nothing.


for  libstdc++-v3/ChangeLog

	* testsuite/util/testsuite_fs.h (NO_SYMLINKS): Define on
	mingw and when create_symlink is a dummy.
	* testsuite/27_io/filesystem/operations/symlink_status.cc:
	Drop mingw xfail.
	(test01, test02): Don't create symlinks when NO_SYMLINKS is
	defined.
	* testsuite/27_io/filesystem/operations/canonical.cc (test03):
	Likewise.
	* testsuite/27_io/filesystem/operations/copy.cc (test02):
	Likewise.
	* testsuite/27_io/filesystem/operations/create_directories.cc
	(test04): Likewise.
	* testsuite/27_io/filesystem/operations/create_directory.cc
	(test01): Likewise.
	* testsuite/27_io/filesystem/operations/permissions.cc
	(test03, test04): Likewise.
	* testsuite/27_io/filesystem/operations/remove.cc (test01):
	Likewise.
	* testsuite/27_io/filesystem/operations/remove_all.cc (test01):
	Likewise.
	* testsuite/27_io/filesystem/operations/rename.cc
	(test_symlinks): Likewise.
	* testsuite/27_io/filesystem/operations/weakly_canonical.cc
	(test01): Likewise.
	* testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc
	(test06): Likewise.
	* testsuite/experimental/filesystem/operations/copy.cc
	(test01): Likewise.
	* testsuite/experimental/filesystem/operations/create_directories.cc
	(test04): Likewise.
	* testsuite/experimental/filesystem/operations/create_directory.cc
	(test01): Likewise.
	* testsuite/experimental/filesystem/operations/permissions.cc
	(test03, test04): Likewise.
	* testsuite/experimental/filesystem/operations/remove.cc
	(test01): Likewise.
	* testsuite/experimental/filesystem/operations/remove_all.cc
	(test01): Likewise.
	* testsuite/experimental/filesystem/operations/rename.cc
	(test01): Likewise.
	* testsuite/lib/libstdc++.exp
	(v3_check_preprocessor_condition): Add optional inc parameter.
	Add it to the test program after include bits/c++config.h.
	(check_v3_target_fs_symlinks): New.
	* testsuite/lib/dg-options.exp
	(dg-require-target-fs-symlinks): New.
	* testsuite/27_io/filesystem/operations/read_symlink.cc:
	Replace mingw xfail with require target-fs-symlinks.
	* testsuite/experimental/filesystem/operations/read_symlink.cc:
	Likewise.
2022-06-23 23:25:52 -03:00
Alexandre Oliva
fc2fb4fd54 Introduce -nostdlib++ option
Using g++ to link without libstdc++, as in g++.dg/abi/pure-virtual1.C,
is error prone, because there's no way to tell g++ to drop libstdc++
without also dropping libc and any other libraries that the target
implicitly links in.

This has often led to the need for manual adjustments to this
testcase.

I figured adding support for -nostdlib++, even though redundant, makes
some sense.  One could presumably use gcc rather than g++ for linking,
for the same effect, but sometimes changing the link command is harder
than adding an option, as in our testsuite.

Since clang already had an option with this effect, we've adopted the
same spelling.


for  gcc/ChangeLog

	* common.opt (nostdlib++): New.
	* doc/invoke.texi (-nostdlib++): Document it.

for  gcc/cp/ChangeLog

	* g++spec.cc (lang_specific_driver): Implement -nostdlib++.

for  gcc/testsuite/ChangeLog

	* g++.dg/abi/pure-virtual1.C: Use -nostdlib++.
2022-06-23 23:25:52 -03:00
Alexandre Oliva
2b86788d7c libstdc++: testsuite: avoid predictable mkstemp
This patch was originally meant to reduce the likelihood that
nonexistent_path() returns the same pathname for from and to.

It was prompted by a target system with a non-random implementation of
mkstemp, that returns a predictable sequence of filenames and selects
the first one that isn't already taken.

That turned out not to be enough: nonexistent_path adds a suffix to
the filename chosen by mkstemp and removes the file it created, so
mkstemp may very well insist on the same basename, and the case that
doesn't use mkstemp doesn't even check whether the file already
exists.

Anyway, by the time I realized this wasn't enough, I'd already
implemented some of the changes, and I figured I might as well
contribute them, even though they don't really solve any problem, and
even if they did, they'd be just a partial solution.


for  libstdc++-v3/ChangeLog

	* testsuite/27_io/filesystem/operations/copy.cc (test02):
	Select TO after creating FROM.
	(test03, test04): Likewise.
	* testsuite/experimental/filesystem/operations/copy.cc
	(test02, test03, test04): Likewise.
2022-06-23 23:25:52 -03:00
Alexandre Oliva
0b2c1781db libstdc++: testsuite: tolerate non-cancelling sleep
Though sleep, nanosleep and clock_nanosleep are all POSIX cancellation
points, not all target systems follow this POSIX requirement.
30_threads/thread/native_handle/cancel.cc will run until it times out
on such systems.

Rather than failing a C++ library test because of a limitation of the
target system, this patch gives the test a chance to successfully
exercise the features it intends to exercise, by introducing a
cancellation point in a loop that would otherwise run indefinitely on
systems exhibiting this limitation.


for  libstdc++-v3/ChangeLog

	* testsuite/30_threads/thread/native_handle/cancel.cc: Add an
	explicit cancellation point in case sleep_for lacks one.
2022-06-23 23:25:52 -03:00
Alexandre Oliva
a5bba80e32 libstdc++: testsuite: use -lbsd for net_ts on RTEMS
Networking functions that net_ts tests rely on are defined in libbsd
on RTEMS, so link with it.


for  libstdc++-v3/ChangeLog

	* testsuite/lib/dg-options.exp (add_options_for_net_ts): Add
	-lbsd for RTEMS targets.
2022-06-23 23:25:52 -03:00
Alexandre Oliva
c655ff35ed aarch64: testsuite: symbol-range fallback to compile
On some of our embedded aarch64 targets, RAM size is too small for
this test to fit.  It doesn't look like this test requires linking,
and if it does, the -tiny version may presumably get most of the
coverage without going overboard in target system requirements.

Still, linking may be useful, so introduce a two_plus_gigs effective
target, that checks for the ability to link a program with 2GiB of
sbss, and use that to select whether to link or just compile
symbol-range.c.


for  gcc/ChangeLog

	* doc/sourcebuild.texi (Environment attributes): Document
	two_plus_gigs.

for  gcc/testsuite/ChangeLog

	* lib/target-supports.exp
	(check_effective_target_two_plus_gigs): New.
	* gcc.target/aarch64/symbol-range.c: Link only on
	two_plus_gigs targets, compile otherwise.
2022-06-23 23:20:45 -03:00
GCC Administrator
df724ec773 Daily bump. 2022-06-24 00:16:41 +00:00
Jason Merrill
6c72f1bfc3 c++: designated init cleanup [PR105925]
build_aggr_conv expects to run after reshape_init, which will usually have
filled out all the CONSTRUCTOR indexes; there's no reason to limit using
those to the case where the user gave an explicit designator.

	PR c++/105925

gcc/cp/ChangeLog:

	* call.cc (build_aggr_conv): Don't depend on
	CONSTRUCTOR_IS_DESIGNATED_INIT.
2022-06-23 17:16:42 -04:00
Jason Merrill
d610ae121e c++: anon union designated init [PR105925]
This testcase was failing because CONSTRUCTOR_IS_DESIGNATED_INIT wasn't
getting set on the introduced CONSTRUCTOR for the anonymous union, and
build_aggr_conv uses that flag to decide whether to pay attention to the
indexes of the CONSTRUCTOR.  So set the flag when we see a designator rather
than relying on copying it from another CONSTRUCTOR.

This avoids some redundant errors on desig4.C because we stop setting
CONSTRUCTOR_IS_DESIGNATED_INIT on _Complex CONSTRUCTORs where it's
nonsense.

	PR c++/105925

gcc/cp/ChangeLog:

	* decl.cc (reshape_init_array_1): Set
	CONSTRUCTOR_IS_DESIGNATED_INIT here.
	(reshape_init_class): And here.
	(reshape_init): Not here.

gcc/testsuite/ChangeLog:

	* g++.dg/ext/desig4.C: Remove extra errors.
	* g++.dg/cpp2a/desig26.C: New test.
2022-06-23 17:16:17 -04:00
Patrick Palka
b00b95198e c++: constexpr folding in unevaluated context [PR105931]
Changing the type of N from int to unsigned in decltype82.C (from
r13-986-g0ecb6b906f215e) reveals another spot where we perform constexpr
evaluation in an unevaluated context for sake of warnings, this time
from the call to shorten_compare in cp_build_binary_op, which calls
fold_for_warn.

We could (and probably should) suppress the shorten_compare warnings
when in an unevaluated context, but there's probably other callers of
fold_for_warn that are similarly affected.  So this patch takes the
approach of directly suppressing fold_for_warn when in an unevaluated
context.

	PR c++/105931

gcc/cp/ChangeLog:

	* expr.cc (fold_for_warn): Don't fold when in an unevaluated
	context.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/decltype82a.C: New test.
2022-06-23 16:36:43 -04:00
Patrick Palka
01aff2ba18 c++: context completion in lookup_template_class [PR105982]
The below testcase demonstrates that completion of the substituted
context during lookup_template_class can end up registering the desired
specialization for us in more cases than r13-1045-gcb7fd1ea85feea
anticipated.  In particular this can happen for a non-dependent
specialization of a nested class as well.

For this testcase, during overload resolution with A's guides, we
substitute the deduced argument T=int into the TYPENAME_TYPE B::C,
during which we call lookup_template_class for A<T>::B with T=int,
which completes A<int> for the first time, which recursively registers
the desired specialization of B already.  The parent call to
lookup_template_class then tries to register the same specialization,
triggering an ICE.

This patch fixes this by making lookup_template_class determine more
directly whether we need to recheck the specializations table after
completion of the context -- when and only when the call to complete_type
had an effect.

	PR c++/105982

gcc/cp/ChangeLog:

	* pt.cc (lookup_template_class): After calling complete_type for
	the substituted context, check the table again iff the type was
	previously incomplete and complete_type made it complete.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1z/class-deduction111.C: New test.
2022-06-23 16:18:55 -04:00
zhangjian
5ee8e1d1b0 compiler: in Sort_bindings return false if comparing value to itself
Some versions of std::sort may pass elements at the same iterator location.

Fixes golang/go#53483

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/413434
2022-06-23 12:44:43 -07:00
Ian Lance Taylor
038a7150ec compiler: unalias types for hash/equality functions
Test case is https://go.dev/cl/413694.

Fixes golang/go#52846

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/413660
2022-06-23 12:22:05 -07:00
David Malcolm
0b14f590e3 diagnostics: add ability to associate diagnostics with rules from coding standards
gcc/ChangeLog:
	* common.opt (fdiagnostics-show-rules): New option.
	* diagnostic-format-json.cc (diagnostic_output_format_init_json):
	Fix up context->show_rules.
	* diagnostic-format-sarif.cc
	(diagnostic_output_format_init_sarif): Likewise.
	* diagnostic-metadata.h (diagnostic_metadata::rule): New class.
	(diagnostic_metadata::precanned_rule): New class.
	(diagnostic_metadata::add_rule): New.
	(diagnostic_metadata::get_num_rules): New.
	(diagnostic_metadata::get_rule): New.
	(diagnostic_metadata::m_rules): New field.
	* diagnostic.cc (diagnostic_initialize): Initialize show_rules.
	(print_any_rules): New.
	(diagnostic_report_diagnostic): Call it.
	* diagnostic.h (diagnostic_context::show_rules): New field.
	* doc/invoke.texi (-fno-diagnostics-show-rules): New option.
	* opts.cc (common_handle_option): Handle
	OPT_fdiagnostics_show_rules.
	* toplev.cc (general_init): Set up global_dc->show_rules.

gcc/testsuite/ChangeLog:
	* gcc.dg/plugin/diagnostic-test-metadata.c: Expect " [STR34-C]" to
	be emitted at the "gets" call.
	* gcc.dg/plugin/diagnostic_plugin_test_metadata.c
	(pass_test_metadata::execute): Associate the "gets" diagnostic
	with a rule named "STR34-C".

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-06-23 14:59:24 -04:00
Jonathan Wakely
7c1c7e120c libstdc++: Properly remove temporary directories in filesystem tests
Although these tests use filesystem::remove_all to clean up, that fails
because it uses recursive_directory_iterator which is intentionally
bodged by the custom readdir defined in the test.

Just use POSIX rmdir to clean up. We don't need to use _rmdir or _wrmdir
for Windows, because we'll never reach test02() on targets where the
custom readdir doesn't interpose the one from libc.

libstdc++-v3/ChangeLog:

	* testsuite/27_io/filesystem/iterators/error_reporting.cc: Use
	rmdir to remove directories.
	* testsuite/experimental/filesystem/iterators/error_reporting.cc:
	Likewise.
2022-06-23 17:19:38 +01:00
Jason Merrill
124a9e08b7 c++: -Waddress and if constexpr [PR94554]
Like we avoid various warnings for seemingly tautological expressions when
substituting a template, we should avoid warning for the implicit conversion
to bool in an if statement.  I considered also doing this for the conditions
in loop expressions, but that seems unnecessary, as a loop condition is
unlikely to be a constant.

The change to finish_if_stmt_cond isn't necessary since dependent_operand_p
looks through IMPLICIT_CONV_EXPR, but makes it more constent with
e.g. build_x_binary_op that determines the type of an expression and then
builds it using the original operands.

	PR c++/94554

gcc/cp/ChangeLog:

	* pt.cc (dependent_operand_p): Split out from...
	(tsubst_copy_and_build): ...here.
	(tsubst_expr) [IF_STMT]: Use it.
	* semantics.cc (finish_if_stmt_cond): Keep the pre-conversion
	condition in the template tree.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1z/constexpr-if38.C: New test.
2022-06-23 11:07:21 -04:00
Jason Merrill
6e4d5300c1 c++: -Waddress and value-dependent expr [PR105885]
We already suppress various warnings for code that would be tautological if
written directly, but not when it's the result of template substitution.  It
seems we need to do this for -Waddress as well.

	PR c++/105885

gcc/cp/ChangeLog:

	* pt.cc (tsubst_copy_and_build): Also suppress -Waddress for
	comparison of dependent operands.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1z/constexpr-if37.C: New test.
2022-06-23 11:06:25 -04:00
Martin Liska
8a15cd3396 c++: properly initialize UBSAN built-ins
PR c++/106062

gcc/ChangeLog:

	* ubsan.cc (sanitize_unreachable_fn): Change order of calls
	in order to initialize UBSAN built-ins.

gcc/testsuite/ChangeLog:

	* gfortran.dg/ubsan/pr106062.f90: New test.
2022-06-23 15:28:27 +02:00
Nathan Sidwell
c01fe6729e c++: Prune unneeded macro locations
This implements garbage collection on locations within macro
expansions, when streaming out a CMI.  When doing the reachability
walks, we now note which macro locations we need and then only write
those locations.  The complication here is that every macro expansion
location has an independently calculated offset.  This complicates
writing, but reading remains the same -- the macro locations of a CMI
continue to form a contiguous block.

For std headers this reduced the number of macro maps by 40% and the
number of locations by 16%.  For a GMF including iostream, it reduced
it by 80% and 60% respectively.

Ordinary locations are still transformed en-mass.  They are somewhat
more complicated to apply a similar optimization to.

	gcc/cp/
	* module.cc (struct macro_info): New.
	(struct macro_traits): New.
	(macro_remap, macro_table): New globals.
	(depset:#️⃣:find_dependencies): Note namespace location.
	(module_for_macro_loc): Adjust.
	(module_state::note_location): New.
	(module_state::Write_location): Note location when not
	streaming. Adjust macro location streaming.
	(module_state::read_location): Adjust macro location
	streaming.
	(module_state::write_init_maps): New.
	(module_state::write_prepare_maps): Reimplement macro map
	preparation.
	(module_state::write_macro_maps): Reimplement.
	(module_state::read_macro_maps): Likewise.
	(module_state::write_begin): Adjust.
	gcc/testsuite/
	* g++.dg/modules/loc-prune-1.C: New.
	* g++.dg/modules/loc-prune-2.C: New.
	* g++.dg/modules/loc-prune-3.C: New.
	* g++.dg/modules/pr98718_a.C: Adjust.
	* g++.dg/modules/pr98718_b.C: Adjust.
2022-06-23 05:16:24 -07:00
Richard Sandiford
509cdb4416 testsuite: Compile slsr-39.c without vectorisation
The fix for PR106019 regressed slsr-39.c for -m32 -march=cascadelake
because we are now able to vectorise the code.  (Whether the code model
should be allowing that is a different question -- the vectorised code
looked worse to me.)

The test runs at -O2 and predates vectorisation being enabled at -O2,
so this patch just adds -fno-tree-vectorize.

gcc/testsuite/
	* gcc.dg/tree-ssa/slsr-39.c: Force vectorization off.
2022-06-23 12:54:10 +01:00
Jonathan Wakely
78fd15fd4a libstdc++: Simplify test by not using std::log2
This test uses std::log2 without including <cmath>, but it doesn't need
to use it at all. Just get the number of digits from numeric_limits
instead.

libstdc++-v3/ChangeLog:

	* testsuite/26_numerics/random/random_device/entropy.cc: Use
	numeric_limits<unsigned>::digits.
2022-06-23 12:00:01 +01:00
Martin Liska
31ce821a79 ipa-icf: skip variables with body_removed
Similarly to cgraph_nodes, it may happen that body_removed is set
during merging of symbols.

	PR ipa/105600

gcc/ChangeLog:

	* ipa-icf.cc (sem_item_optimizer::filter_removed_items):
	Skip variables with body_removed.
2022-06-23 06:07:22 +02:00
liuhongt
7f52df186d Replace REGNO with reg_or_subregno in pre_reload splitter.
gcc/ChangeLog:

	* config/i386/sse.md:(sse4_2_pcmpestr): Replace REGNO with
	reg_or_subregno.
	(sse4_2_pcmpistr): Ditto.
2022-06-23 11:34:37 +08:00