Commit Graph

183435 Commits

Author SHA1 Message Date
Nathan Sidwell
1f9db6929d c++: header-unit build capability [PR 99023]
This defect really required building header-units and include translation
of pieces of the standard library.  This adds smarts to the modules
test harness to do that -- accept .X files as the source file, but
provide '-x c++-system-header $HDR' in the options.  The .X file will
be considered by the driver to be a linker script and ignored (with a
warning).

Using this we can add 2 tests that end up building list_initializer
and iostream, along with a test that iostream's build
include-translates list_initializer's #include.  That discovered a set
of issues with the -flang-info-include-translate=HDR handling, also
fixed and documented here.

	PR c++/99023
	gcc/cp/
	* module.cc (canonicalize_header_name): Use
	cpp_probe_header_unit.
	(maybe_translate_include): Fix note_includes comparison.
	(init_modules): Fix note_includes string termination.
	libcpp/
	* include/cpplib.h (cpp_find_header_unit): Rename to ...
	(cpp_probe_header_unit): ... this.
	* internal.h (_cp_find_header_unit): Declare.
	* files.c (cpp_find_header_unit): Break apart to ..
	(test_header_unit): ... this, and ...
	(_cpp_find_header_unit): ... and, or and ...
	(cpp_probe_header_unit): ... this.
	* macro.c (cpp_get_token_1): Call _cpp_find_header_unit.
	gcc/
	* doc/invoke.texi (flang-info-include-translate): Document header
	lookup behaviour.
	gcc/testsuite/
	* g++.dg/modules/modules.exp: Bail on cross-testing.  Add support
	for .X files.
	* g++.dg/modules/pr99023_a.X: New.
	* g++.dg/modules/pr99023_b.X: New.
2021-02-18 13:22:48 -08:00
Jakub Jelinek
d82f829905 c: Fix ICE with -fexcess-precision=standard [PR99136]
The following testcase ICEs on i686-linux, because c_finish_return wraps
c_fully_folded retval back into EXCESS_PRECISION_EXPR, but when the function
return type is void, we don't call convert_for_assignment on it that would
then be fully folded again, but just put the retval into RETURN_EXPR's
operand, so nothing removes it anymore and during gimplification we
ICE as EXCESS_PRECISION_EXPR is not handled.

This patch fixes it by not adding that EXCESS_PRECISION_EXPR in functions
returning void, the return value is ignored and all we need is evaluate any
side-effects of the expression.

2021-02-18  Jakub Jelinek  <jakub@redhat.com>

	PR c/99136
	* c-typeck.c (c_finish_return): Don't wrap retval into
	EXCESS_PRECISION_EXPR in functions that return void.

	* gcc.dg/pr99136.c: New test.
2021-02-18 22:17:52 +01:00
Nathan Sidwell
1021222ee4 c++: Remove obsolete dg-module-headers [PR 99023]
PR99023's testcase is highlighting some missing functionality of the
modules test harness.  I did have some partial support, but it's only
use in one place for a now-obsolete test.  This patch expunges that
support so I can add better functionality now I understand better what
is necessary.

	PR c++/99023
	gcc/testsuite/
	* g++.dg/modules/modules.exp: Remove dg-module-headers support
	* g++.dg/modules/alias-2_a.H: Delete.
	* g++.dg/modules/sys/alias-2_a.H: Delete.
2021-02-18 12:39:42 -08:00
Nathan Sidwell
a796f8a43a c++: Remove large abi-specific tests [PR 99150]
Remove the two large and incorrectly abi-specific testcases I added.
Replacement tests will be forthcoming.

	PR c++/99150
	gcc/testsuite/
	* g++.dg/modules/pr99023_a.H: Delete.
	* g++.dg/modules/pr99023_b.H: Delete.
2021-02-18 12:36:40 -08:00
Jakub Jelinek
3bfa96895b c++: Fix -std=c++20 ICE on virtual method call [PR99132]
On the following testcase we ICE in C++20 mode during cp_get_callee_fndecl
-> constexpr evaluation.
It is only in C++20 mode on this testcase because virtual methods can't
be constexpr in C++17 and earlier and so potential_constant_expression_1
rejects it earlier.
And the ICE is caused by genericization changing the h PARM_DECL from having
B<C *> type to B<C *> & DECL_BY_REFERENCE and the constexpr evaluation
not being able to deal with that.
I think this just shows that we shouldn't do the constexpr evaluation during
genericization and later, and other spots e.g. during gimplification
also don't call cp_get_callee_fndecl but cp_get_callee_fndecl_nofold.
After all, cp_fold has already been run and it did the folding if there
was any opportunity to do so.  And furthermore, what that cp_genericize_r
spot does is check for any left-over immediate function calls (which can be
ATM just std::source_location::current() call) and immediate functions
outside of immediate functions can't have addresses leaked into the IL,
so it will be always a direct call anyway.  And immediate functions
themselves don't make it into genericization/gimplification.

2021-02-18  Jakub Jelinek  <jakub@redhat.com>

	PR c++/99132
	* cp-gimplify.c (cp_genericize_r) <case CALL_EXPR>: Use
	cp_get_callee_fndecl_nofold instead of cp_get_callee_fndecl to check
	for immediate function calls.

	* g++.dg/cpp2a/constexpr-virtual18.C: New test.
2021-02-18 16:21:52 +01:00
Richard Biener
7ee164dcfe middle-end/99122 - Issues with VLA parameter inlining
The following instructs IPA not to inline calls with VLA parameters
and adjusts inlining not to create invalid view-converted VLA
parameters on mismatch and makes the error_mark paths with debug
stmts actually work.

The first part avoids the ICEs with the testcases already.

2021-02-18  Richard Biener  <rguenther@suse.de>

	PR middle-end/99122
	* ipa-fnsummary.c (analyze_function_body): Set
	CIF_FUNCTION_NOT_INLINABLE for VLA parameter calls.
	* tree-inline.c (insert_init_debug_bind): Pass NULL for
	error_mark_node values.
	(force_value_to_type): Do not build V_C_Es for WITH_SIZE_EXPR
	values.
	(setup_one_parameter): Delay force_value_to_type until when
	it's needed.

	* gcc.dg/pr99122-1.c: New testcase.
	* gcc.dg/pr99122-2.c: Likewise.
2021-02-18 14:38:33 +01:00
Hans-Peter Nilsson
a2ef38b1f9 match.pd: Restrict clz cmp 0 replacement by single_use, PR99142
If we're not going to eliminate the clz, it's better for the
comparison to use that result than its input, so we don't
extend the lifetime of the input.  Also, an additional use
of the result is more likely cheaper than a compare of the
input, in particular considering that the clz may have made
available a non-zero condition matching the original use.
The "s" modifier doesn't stop this situation, as the
transformation wouldn't result in "an expression with more
than one operator"; a gating single_use condition on the
result is necessary.

gcc:
	PR tree-optimization/99142
	* match.pd (clz cmp 0): Gate replacement on single_use of clz result.

gcc/testsuite:
	PR tree-optimization/99142
	* gcc.dg/tree-ssa/pr99142.c: New test.
2021-02-18 13:19:08 +01:00
Jakub Jelinek
a1541628df i386: Avoid C++ global constructors in every object that includes i386.h
When looking at recog.o when working on the recog.[ch] changes to make sure
I have not introduced runtime construction of recog_data variable, I have
noticed that at least in unoptimized build, every single *.o file that
included i386.h has lots of runtime constructors for all the PTA_*
variables.

As we now require C++11, the following patch makes those constexpr so that
they don't need runtime initialization.
I've verified that ~ 8276 bytes long _Z41__static_initialization_and_destruction_0ii
at -O0 is gone from every *.o that included i386.h (and doesn't really need
any global ctors anymore).

2021-02-18  Jakub Jelinek  <jakub@redhat.com>

	* wide-int-bitmask.h (wide_int_bitmask::wide_int_bitmask (),
	wide_int_bitmask::wide_int_bitmask (uint64_t),
	wide_int_bitmask::wide_int_bitmask (uint64_t, uint64_t),
	wide_int_bitmask::operator ~ () const,
	wide_int_bitmask::operator | (wide_int_bitmask) const,
	wide_int_bitmask::operator & (wide_int_bitmask) const): Use constexpr
	instead of inline.
	* config/i386/i386.h (PTA_3DNOW, PTA_3DNOW_A, PTA_64BIT, PTA_ABM,
	PTA_AES, PTA_AVX, PTA_BMI, PTA_CX16, PTA_F16C, PTA_FMA, PTA_FMA4,
	PTA_FSGSBASE, PTA_LWP, PTA_LZCNT, PTA_MMX, PTA_MOVBE, PTA_NO_SAHF,
	PTA_PCLMUL, PTA_POPCNT, PTA_PREFETCH_SSE, PTA_RDRND, PTA_SSE, PTA_SSE2,
	PTA_SSE3, PTA_SSE4_1, PTA_SSE4_2, PTA_SSE4A, PTA_SSSE3, PTA_TBM,
	PTA_XOP, PTA_AVX2, PTA_BMI2, PTA_RTM, PTA_HLE, PTA_PRFCHW, PTA_RDSEED,
	PTA_ADX, PTA_FXSR, PTA_XSAVE, PTA_XSAVEOPT, PTA_AVX512F, PTA_AVX512ER,
	PTA_AVX512PF, PTA_AVX512CD, PTA_NO_TUNE, PTA_SHA, PTA_PREFETCHWT1,
	PTA_CLFLUSHOPT, PTA_XSAVEC, PTA_XSAVES, PTA_AVX512DQ, PTA_AVX512BW,
	PTA_AVX512VL, PTA_AVX512IFMA, PTA_AVX512VBMI, PTA_CLWB, PTA_MWAITX,
	PTA_CLZERO, PTA_NO_80387, PTA_PKU, PTA_AVX5124VNNIW, PTA_AVX5124FMAPS,
	PTA_AVX512VPOPCNTDQ, PTA_SGX, PTA_AVX512VNNI, PTA_GFNI, PTA_VAES,
	PTA_AVX512VBMI2, PTA_VPCLMULQDQ, PTA_AVX512BITALG, PTA_RDPID,
	PTA_PCONFIG, PTA_WBNOINVD, PTA_AVX512VP2INTERSECT, PTA_PTWRITE,
	PTA_AVX512BF16, PTA_WAITPKG, PTA_MOVDIRI, PTA_MOVDIR64B, PTA_ENQCMD,
	PTA_CLDEMOTE, PTA_SERIALIZE, PTA_TSXLDTRK, PTA_AMX_TILE, PTA_AMX_INT8,
	PTA_AMX_BF16, PTA_UINTR, PTA_HRESET, PTA_KL, PTA_WIDEKL, PTA_AVXVNNI,
	PTA_X86_64_BASELINE, PTA_X86_64_V2, PTA_X86_64_V3, PTA_X86_64_V4,
	PTA_CORE2, PTA_NEHALEM, PTA_WESTMERE, PTA_SANDYBRIDGE, PTA_IVYBRIDGE,
	PTA_HASWELL, PTA_BROADWELL, PTA_SKYLAKE, PTA_SKYLAKE_AVX512,
	PTA_CASCADELAKE, PTA_COOPERLAKE, PTA_CANNONLAKE, PTA_ICELAKE_CLIENT,
	PTA_ICELAKE_SERVER, PTA_TIGERLAKE, PTA_SAPPHIRERAPIDS, PTA_ALDERLAKE,
	PTA_KNL, PTA_BONNELL, PTA_SILVERMONT, PTA_GOLDMONT, PTA_GOLDMONT_PLUS,
	PTA_TREMONT, PTA_KNM): Use constexpr instead of const.
2021-02-18 10:32:57 +01:00
Jakub Jelinek
f72e3d8c9f array-bounds: Fix up ICE on overaligned variables [PR99109]
check_mem_ref builds artificial arrays for variables that don't have
array type.
The C standard says:
"For the purposes of these operators, a pointer to an object that is not an element of an
array behaves the same as a pointer to the first element of an array of length one with the
type of the object as its element type."
so it isn't completely wrong and does simplify the function.
But, layout_type can fail if the size of the element type is not a multiple
of its alignment (i.e. overaligned types) and we then ICE because of that.

The following patch uses TYPE_MAIN_VARIANT in those cases instead, but only
for the types that need it, as for the diagnostics it is better to use the
typedef names etc. that were really used in the source if possible.

2021-02-18  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/99109
	* gimple-array-bounds.cc (build_zero_elt_array_type): Rename to ...
	(build_printable_array_type): ... this.  Add nelts argument.  For
	overaligned eltype, use TYPE_MAIN_VARIANT (eltype) instead.  If
	nelts, call build_array_type_nelts.
	(array_bounds_checker::check_mem_ref): Use build_printable_array_type
	instead of build_zero_elt_array_type and build_array_type_nelts.

	* g++.dg/warn/Warray-bounds-17.C: New test.
2021-02-18 09:45:19 +01:00
Jakub Jelinek
decd8fb012 i386: Fix up df uses in i386 splitters [PR99104]
The following testcase started ICEing with my recent changes to enable
split4 after sel-sched, but it seems the bug is more general.
Some of the i386 splitter condition functions use and rely on df, but
the split passes don't really df_analyze/df_finish_pass, so the DF info
may be stale or not computed at all - the particular ICE is because
there is a new bb and df_get_live_out (bb) returns NULL on it as the
live or lr problem has not been computed yet.

This patch fixes it by not calling ix86_ok_to_clobber_flags from
ix86_avoid_lea_for_add where it wasn't ever needed because the splitters
using that function as condition have (clobber FLAGS) in their pattern.
And, changes the ix86_avoid_lea_for_addr using splitter from normal splitter
to peephole2 splitter that uses peep2_regno_dead_p infrastructure to
determine if FLAGS is dead.  Also, it saves and restores recog_data
variable around the call to distance_non_agu_define and doesn't call
extract_insn_data there, because split_insns or peephole2_insns just
clear recog_data.insn and then fill in recog_data.operand array, and so
might not match what extract_insn will do on the insn at all.

2021-02-18  Jakub Jelinek  <jakub@redhat.com>

	PR target/99104
	* config/i386/i386.c (distance_non_agu_define): Don't call
	extract_insn_cached here.
	(ix86_lea_outperforms): Save and restore recog_data around call
	to distance_non_agu_define and distance_agu_use.
	(ix86_ok_to_clobber_flags): Remove.
	(ix86_avoid_lea_for_add): Don't call ix86_ok_to_clobber_flags.
	(ix86_avoid_lea_for_addr): Likewise.  Adjust function comment.
	* config/i386/i386.md (*lea<mode>): Change from define_insn_and_split
	into define_insn.  Move the splitting to define_peephole2 and
	check there using peep2_regno_dead_p if FLAGS_REG is dead.

	* gcc.dg/pr99104.c: New test.
2021-02-18 09:22:14 +01:00
GCC Administrator
acc0ee5c07 Daily bump. 2021-02-18 00:16:29 +00:00
David Malcolm
963aecff24 testsuite: add regression test for PR analyzer/94596
This use-after-free false positive affected GCC 10, but seems to be
fixed in trunk for GCC 11; adding a reduced version as a regression
test.

gcc/testsuite/ChangeLog:
	PR analyzer/94596
	* gcc.dg/analyzer/pr94596.c: New test.
2021-02-17 17:50:52 -05:00
Nathan Sidwell
d8889c99aa c++: Macros need to be GTY-reachable [PR 99023]
I'd missed that macros were allocated from GC storage, and that they can
become unattached from an identifier, and therefore not GC-reachable.
And then bad things happen.   Fixed by making the module machinery's
reference vector a GC root.

	PR c++/99023
	gcc/cp/
	* module.cc (struct macro_export): Add GTY markers.
	(macro_exports): Likewise, us a va_gc Vector.
	gcc/testsuite/
	* g++.dg/modules/pr99023_a.H: New.
	* g++.dg/modules/pr99023_b.H: New.
2021-02-17 10:47:00 -08:00
David Malcolm
e0139b2a91 analyzer: fix false leak involving params [PR98969]
This patch updates the svalue liveness code so that the initial value
of parameters at top-level functions to the analysis are treated as
live (since the values are presumably still live within the
outside-of-the-analysis calling code).

This fixes the false leak in PR analyzer/98969 seen on:

void
test (long int i)
{
  struct foo *f = (struct foo *)i;
  f->expr = __builtin_malloc (1024);
}

since the calling code can presumably still access the allocated
buffer via:
  ((struct foo *)i)->expr

The patch also removes the expected leak warnings from
g++.dg/analyzer/pr99064.C and gcc.dg/analyzer/pr96841.c, which now
appear to me to be false positives.

gcc/analyzer/ChangeLog:
	PR analyzer/98969
	* constraint-manager.cc (dead_svalue_purger::should_purge_p):
	Update for change to svalue::live_p.
	* program-state.cc (sm_state_map::on_liveness_change): Likewise.
	(program_state::detect_leaks): Likewise.
	* region-model-reachability.cc (reachable_regions::init_cluster):
	When dealing with a symbolic region, if the underlying pointer is
	implicitly live, add the region to the reachable regions.
	* region-model.cc (region_model::compare_initial_and_pointer):
	Move logic for detecting initial values of params to
	initial_svalue::initial_value_of_param_p.
	* svalue.cc (svalue::live_p): Convert "live_svalues" from a
	reference to a pointer; support it being NULL.
	(svalue::implicitly_live_p): Convert first param from a
	refererence to a pointer.
	(region_svalue::implicitly_live_p): Likewise.
	(constant_svalue::implicitly_live_p): Likewise.
	(initial_svalue::implicitly_live_p): Likewise.  Treat the initial
	values of params for the top level frame as still live.
	(initial_svalue::initial_value_of_param_p): New function, taken
	from a test in region_model::compare_initial_and_pointer.
	(unaryop_svalue::implicitly_live_p): Convert first param from a
	refererence to a pointer.
	(binop_svalue::implicitly_live_p): Likewise.
	(sub_svalue::implicitly_live_p): Likewise.
	(unmergeable_svalue::implicitly_live_p): Likewise.
	* svalue.h (svalue::live_p): Likewise.
	(svalue::implicitly_live_p): Likewise.
	(region_svalue::implicitly_live_p): Likewise.
	(constant_svalue::implicitly_live_p): Likewise.
	(initial_svalue::implicitly_live_p): Likewise.
	(initial_svalue::initial_value_of_param_p): New decl.
	(unaryop_svalue::implicitly_live_p): Convert first param from a
	refererence to a pointer.
	(binop_svalue::implicitly_live_p): Likewise.
	(sub_svalue::implicitly_live_p): Likewise.
	(unmergeable_svalue::implicitly_live_p): Likewise.

gcc/testsuite/ChangeLog:
	PR analyzer/98969
	* g++.dg/analyzer/pr99064.C: Convert dg-bogus to dg-warning.
	* gcc.dg/analyzer/pr96841.c: Add -Wno-analyzer-too-complex to
	options.  Remove false leak directive.
	* gcc.dg/analyzer/pr98969.c (test_1): Remove xfail from leak
	false positive.
	(test_3): New.
2021-02-17 10:37:16 -05:00
Julian Brown
366cf1127a openacc: Strided array sections and components of derived-type arrays
This patch disallows selecting components of array sections in update
directives for OpenACC, as specified in OpenACC 3.0, "2.14.4. Update
Directive":

  In Fortran, members of variables of derived type may appear, including
  a subarray of a member. Members of subarrays of derived type may
  not appear.

The diagnostic for attempting to use the same construct on other
directives has also been improved.

gcc/fortran/
	* openmp.c (resolve_omp_clauses): Disallow selecting components
	of arrays of derived type.

gcc/testsuite/
	* gfortran.dg/goacc/array-with-dt-2.f90: Remove expected errors.
	* gfortran.dg/goacc/array-with-dt-6.f90: New test.
	* gfortran.dg/goacc/mapping-tests-2.f90: Update expected error.
	* gfortran.dg/goacc/ref_inquiry.f90: Update expected errors.
	* gfortran.dg/gomp/ref_inquiry.f90: Likewise.

libgomp/
	* testsuite/libgomp.oacc-fortran/array-stride-dt-1.f90: Remove
	expected errors.
2021-02-17 06:13:55 -08:00
Julian Brown
d28f3da11d openacc: Fix lowering for derived-type mappings through array elements
This patch fixes lowering of derived-type mappings which select elements
of arrays of derived types, and similar. These would previously lead
to ICEs.

With this change, OpenACC directives can pass through constructs that
are no longer recognized by the gimplifier, hence alterations are needed
there also.

gcc/fortran/
	* trans-openmp.c (gfc_trans_omp_clauses): Handle element selection
	for arrays of derived types.

gcc/
	* gimplify.c (gimplify_scan_omp_clauses): Handle ATTACH_DETACH
	for non-decls.

gcc/testsuite/
	* gfortran.dg/goacc/array-with-dt-1.f90: New test.
	* gfortran.dg/goacc/array-with-dt-3.f90: Likewise.
	* gfortran.dg/goacc/array-with-dt-4.f90: Likewise.
	* gfortran.dg/goacc/array-with-dt-5.f90: Likewise.
	* gfortran.dg/goacc/derived-chartypes-1.f90: Re-enable test.
	* gfortran.dg/goacc/derived-chartypes-2.f90: Likewise.
	* gfortran.dg/goacc/derived-classtypes-1.f95: Uncomment
	previously-broken directives.

libgomp/
	* testsuite/libgomp.oacc-fortran/derivedtypes-arrays-1.f90: New test.
	* testsuite/libgomp.oacc-fortran/update-dt-array.f90: Likewise.
2021-02-17 06:13:55 -08:00
Jakub Jelinek
7768cadb42 c++: Fix up build_zero_init_1 once more [PR99106]
My earlier build_zero_init_1 patch for flexible array members created
an empty CONSTRUCTOR.  As the following testcase shows, that doesn't work
very well because the middle-end doesn't expect CONSTRUCTOR elements with
incomplete type (that the empty CONSTRUCTOR at the end of outer CONSTRUCTOR
had).

The following patch just doesn't add any CONSTRUCTOR for the flexible array
members, it doesn't seem to be needed.

2021-02-17  Jakub Jelinek  <jakub@redhat.com>

	PR sanitizer/99106
	* init.c (build_zero_init_1): For flexible array members just return
	NULL_TREE instead of returning empty CONSTRUCTOR with non-complete
	ARRAY_TYPE.

	* g++.dg/ubsan/pr99106.C: New test.
2021-02-17 15:03:25 +01:00
Nathan Sidwell
24bf79f179 c++: More set_identifier_type_value fixing [PR 99116]
My recent change looked under template_parms in two places, but that
was covering up a separate problem.  We were attempting to set the
identifier_type_value of a template_parm into the template_parm
scope.  The peeking stopped us doing that, but confused poplevel,
leaving an identifier value lying around.  This fixes the underlying
problem in do_pushtag -- we only need to set the identifier_type_value
directly when we're in a template_parm scope (a later pushdecl will
push the actual template_decl).  for non-class non-template-parm
bindings do_pushdecl already ends up manipulating
identifier_type_value correctly.

	PR c++/99116
	gcc/cp/
	* name-lookup.c (do_pushdecl): Don't peek under template_parm
	bindings here ...
	(set_identifier_type_value_with_scope): ... or here.
	(do_pushtag): Only set_identifier_type_value_with_scope at
	non-class template parm scope, and use parent scope.
	gcc/testsuite/
	* g++.dg/lookup/pr99116-1.C: New.
	* g++.dg/lookup/pr99116-2.C: New.
2021-02-17 05:41:37 -08:00
Nathan Sidwell
d46c7e2c54 c++: ICE with header-units [PR 99071]
This ICE was caused by dereferencing the wrong pointer and not finding the
expected thing there.  Pointers are like that.

	PR c++/99071
	gcc/cp/
	* name-lookup.c (maybe_record_mergeable_decl): Deref the correct
	pointer.
	gcc/testsuite/
	* g++.dg/modules/pr99071_a.H: New.
	* g++.dg/modules/pr99071_b.H: New.
2021-02-17 05:41:37 -08:00
Xi Ruoyao
06505e701d mips: Avoid out-of-bounds access in mips_symbol_insns [PR98491]
An invalid use of MSA_SUPPORTED_MODE_P was causing an ICE on
mips64el with -mmsa.  The detailed analysis is posted on bugzilla.

gcc/ChangeLog:

2021-02-17  Xi Ruoyao  <xry111@mengyan1223.wang>

	PR target/98491
	* config/mips/mips.c (mips_symbol_insns): Do not use
	MSA_SUPPORTED_MODE_P if mode is MAX_MACHINE_MODE.
2021-02-17 11:57:13 +00:00
Patrick Palka
78a6d0e30d c++: Revert EXPR_LOCATION change to build_aggr_init_expr [PR96997]
My change in r10-7718 to make build_aggr_init_expr set EXPR_LOCATION
(mimicking build_target_expr) causes the debuginfo regression PR96997.
Given that this change is mostly independent of the rest of the commit,
and that the only fallout of reverting it is a less accurate error
message location in a testcase introduced in the same commit, it seems
the best way forward is to just revert this part of the commit.

gcc/cp/ChangeLog:

	PR debug/96997
	PR c++/94034
	* tree.c (build_aggr_init_expr): Revert r10-7718 change.

gcc/testsuite/ChangeLog:

	PR debug/96997
	PR c++/94034
	* g++.dg/cpp1y/constexpr-nsdmi7b.C:  Adjust expected location of
	"call to non-'constexpr' function" error message.
2021-02-16 20:49:12 -05:00
GCC Administrator
0e804ce39a Daily bump. 2021-02-17 00:16:20 +00:00
Ian Lance Taylor
e7a8d69a55 compiler: unalias receiver type in export data
Test case is https://golang.org/cl/292009.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/291991
2021-02-16 13:01:00 -08:00
Nathan Sidwell
b37695c9bf c++: directives-only preprocessing and include translation [PR 99050]
We make sure files end in \n by placing one at the limit of the buffer
(just past the end of what is read).  We need to do the same for
buffers generated via include-translation.  Fortunately they have
space.

	libcpp/
	* files.c (_cpp_stack_file): Make buffers end in unread \n.
	gcc/testsuite/
	* g++.dg/modules/pr99050_a.H: New.
	* g++.dg/modules/pr99050_b.C: New.
2021-02-16 12:26:51 -08:00
Marek Polacek
30a4d95bf7 c-family: ICE with assume_aligned attribute [PR99062]
We ICE in handle_assume_aligned_attribute since r271338 which added

@@ -2935,8 +2936,8 @@ handle_assume_aligned_attribute (tree *node, tree name, tree args, int,
          /* The misalignment specified by the second argument
             must be non-negative and less than the alignment.  */
          warning (OPT_Wattributes,
-                  "%qE attribute argument %E is not in the range [0, %E)",
-                  name, val, align);
+                  "%qE attribute argument %E is not in the range [0, %wu]",
+                  name, val, tree_to_uhwi (align) - 1);
          *no_add_attrs = true;
          return NULL_TREE;
        }
because align is INT_MIN and tree_to_uhwi asserts tree_fits_uhwi_p -- which
ALIGN does not and the prior tree_fits_shwi_p check is fine with it, as
well as the integer_pow2p check.

Since neither of the arguments to assume_aligned can be negative, I've
hoisted the tree_int_cst_sgn check.  And add the missing "argument"
word to an existing warning.

gcc/c-family/ChangeLog:

	PR c++/99062
	* c-attribs.c (handle_assume_aligned_attribute): Check that the
	alignment argument is non-negative.  Tweak a warning message.

gcc/testsuite/ChangeLog:

	PR c++/99062
	* gcc.dg/attr-assume_aligned-4.c: Adjust dg-warning.
	* g++.dg/ext/attr-assume-aligned.C: New test.
2021-02-16 14:07:26 -05:00
YunQiang Su
5d5e4f6ec6 [PATCH 3/3] MIPS: fix compact-branches test FAIL for PIC default configuration
gcc/testsuite

	* gcc.target/mips/compact-branches-5.c: Force -fno-PIC.
	* gcc.target/mips/compact-branches-6.c: Force -fno-PIC.
2021-02-16 11:37:21 -07:00
Tobias Burnus
799478b891 Fortran: %re/%im fixes for OpenMP/OpenACC + gfc_is_simplify_contiguous
gcc/fortran/ChangeLog:

	* expr.c (gfc_is_simplify_contiguous): Handle REF_INQUIRY, i.e.
	%im and %re which are EXPR_VARIABLE.
	* openmp.c (resolve_omp_clauses): Diagnose %re/%im explicitly.

gcc/testsuite/ChangeLog:

	* gfortran.dg/goacc/ref_inquiry.f90: New test.
	* gfortran.dg/gomp/ref_inquiry.f90: New test.
2021-02-16 17:39:49 +01:00
Vladimir N. Makarov
72d78655a9 [PR98096] inline-asm: Take inout operands into account for access to labels by names.
GCC splits inout operands into output and new matched input operands
during gimplfication.  Addressing operands by name or number is not
problem as the new input operands are added at the end of existing
input operands.  However it became a problem for labels in asm goto
with output reloads.  Addressing labels should take into account the
new input operands.  The patch solves the problem.

gcc/ChangeLog:

	PR inline-asm/98096
	* stmt.c (resolve_operand_name_1): Take inout operands into account
	for access to labels by names.
	* doc/extend.texi: Describe counting operands for accessing labels.

gcc/testsuite/ChangeLog:

	PR inline-asm/98096
	* gcc.c-torture/compile/pr98096.c: New.
2021-02-16 10:30:10 -05:00
Tobias Burnus
ebf9b6c13f Fortran: Reject DT as fmt in I/O statments [PR99111]
gcc/fortran/ChangeLog:

	PR fortran/99111
	* io.c (resolve_tag_format): Reject BT_DERIVED/CLASS/VOID
	as (array-valued) FORMAT tag.

gcc/testsuite/ChangeLog:

	PR fortran/99111
	* gfortran.dg/fmt_nonchar_1.f90: New test.
	* gfortran.dg/fmt_nonchar_2.f90: New test.
2021-02-16 14:17:35 +01:00
Richard Biener
3f16a16781 tree-optimization/38474 - improve PTA varinfo sorting
This improves a previous heuristic to sort address-taken variables
first (because those appear in points-to bitmaps) by tracking which
variables appear in ADDRESSOF constraints (there's also
graph->address_taken but that's computed only later).

This shaves off 30s worth of compile-time for the full testcase in
PR38474 (which then still takes 965s to compile at -O2).

2021-02-16  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/38474
	* tree-ssa-structalias.c (variable_info::address_taken): New.
	(new_var_info): Initialize address_taken.
	(process_constraint): Set address_taken.
	(solve_constraints): Use the new address_taken flag rather
	than is_reg_var for sorting variables.
	(dump_constraint): Dump the variable number if the name
	is just NULL.
2021-02-16 12:48:07 +01:00
Jakub Jelinek
1531f39268 openmp: Fix up vectorization simd call badness computation [PR99100]
As mentioned in the PR, ix86_simd_clone_usable didn't make it more desirable
to use 'e' mangled AVX512F entrypoints over 'd' mangled ones (AVX2) with the
same simdlen.  This patch fixes that.  I have tweaked the generic code too
to make more room for these target specific badness factors.

2021-02-16  Jakub Jelinek  <jakub@redhat.com>

	PR target/99100
	* tree-vect-stmts.c (vectorizable_simd_clone_call): For num_calls != 1
	multiply by 4096 and for inbranch by 8192.
	* config/i386/i386.c (ix86_simd_clone_usable): For TARGET_AVX512F,
	return 3, 2 or 1 for mangle letters 'b', 'c' or 'd'.

	* gcc.target/i386/pr99100.c: New test.
2021-02-16 08:59:03 +01:00
Hans-Peter Nilsson
0b5c58c2dc gcc.misc-tests/outputs.exp (outest): Fix typo "is_target".
Fix typo for istarget in "is_target hppa*-*-hpux*", yielding
an error running the test-suite for any target not matching
powerpc*-*-aix* (presumably, by code inspection), aborting
the check-gcc (check-gcc-c) regression test run some 3000
tests before the last one, missing e.g. all gcc.target
tests like so:

-----
...
Running /x/gcc/gcc/testsuite/gcc.misc-tests/outputs.exp ...
ERROR: (DejaGnu) proc "is_target hppa*-*-hpux*" does not exist.
The error code is TCL LOOKUP COMMAND is_target
The info on the error is:
invalid command name "is_target"
    while executing
"::tcl_unknown is_target hppa*-*-hpux*"
    ("uplevel" body line 1)
    invoked from within
"uplevel 1 ::tcl_unknown $args"

		=== gcc Summary ===
...
-----

gcc/testsuite:
	* gcc.misc-tests/outputs.exp (outest): Fix typo "is_target".
2021-02-16 02:22:44 +01:00
GCC Administrator
de594739f7 Daily bump. 2021-02-16 00:16:22 +00:00
Maya Rashish
f9d4544df5 aarch64: Run SUBTARGET_INIT_BUILTINS if it exists
Some subtargets don't provide the canonical function names as
the symbol name in C libraries, and libcalls will only work if
the builtins are patched to emit the correct library name.

For example, on NetBSD, cabsl has the symbol name __c99_cabsl,
and the patching is done via netbsd_patch_builtin.

With this change, libgfortran.so is correctly built with a
reference to __c99_cabsl, instead of "cabsl" which is not defined.

gcc/ChangeLog:
	* config/aarch64/aarch64.c (aarch64_init_builtins):
	Call SUBTARGET_INIT_BUILTINS.
2021-02-15 18:38:55 +00:00
Peter Bergner
a33927c9ab rtl-optimization: Fix uninitialized use of opaque mode variable ICE [PR98872]
The initialize_uninitialized_regs function emits (set (reg:) (CONST0_RTX))
for all uninitialized pseudo uses.  However, some modes (eg, opaque modes)
may not have a CONST0_RTX defined, leading to an ICE when we try and create
the initialization insn.  The fix is to skip emitting the initialization
if there is no CONST0_RTX defined for the mode.

2021-02-15  Peter Bergner  <bergner@linux.ibm.com>

gcc/
	PR rtl-optimization/98872
	* init-regs.c (initialize_uninitialized_regs): Skip initialization
	if CONST0_RTX is NULL.

gcc/testsuite/
	PR rtl-optimization/98872
	* gcc.target/powerpc/pr98872.c: New test.
2021-02-15 10:39:24 -06:00
Jonathan Wakely
cc9a0a3d79 libstdc++: Fix __thread_yield for non-gthreads targets
The __gthread_yield() function is only defined for gthreads targets, so
check _GLIBCXX_HAS_GTHREADS before using it.

Also reorder __thread_relax and __thread_yield so that the former can
use the latter instead of repeating the same preprocessor checks.

libstdc++-v3/ChangeLog:

	* include/bits/atomic_wait.h (__thread_yield()): Check
	_GLIBCXX_HAS_GTHREADS before using __gthread_yield.
	(__thread_relax()): Use __thread_yield() instead of repeating
	the preprocessor checks for __gthread_yield.
2021-02-15 15:52:25 +00:00
Jonathan Wakely
d27153f038 libstdc++: Add missing return and use reserved name
The once_flag::_M_activate() function is only ever called immediately
after a call to once_flag::_M_passive(), and so in the non-gthreads case
it is impossible for _M_passive() to be true in the body of
_M_activate(). Add a check for it anyway, to avoid warnings about
missing return.

Also replace a non-reserved name with a reserved one.

libstdc++-v3/ChangeLog:

	* include/std/mutex (once_flag::_M_activate()): Add explicit
	return statement for passive case.
	(once_flag::_M_finish(bool)): Use reserved name for parameter.
2021-02-15 15:52:25 +00:00
Richard Sandiford
abe07a74bb rtl-ssa: Reduce the amount of temporary memory needed [PR98863]
The rtl-ssa code uses an on-the-side IL and needs to build that IL
for each block and RTL insn.  I'd originally not used the classical
dominance frontier method for placing phis on the basis that it seemed
like more work in this context: we're having to visit everything in
an RPO walk anyway, so for non-backedge cases we can tell immediately
whether a phi node is needed.  We then speculatively created phis for
registers that are live across backedges and simplified them later.
This avoided having to walk most of the IL twice (once to build the
initial IL, and once to link uses to phis).

However, as shown in PR98863, this leads to excessive temporary
memory in extreme cases, since we had to record the value of
every live register on exit from every block.  In that PR,
there were many registers that were live (but unused) across
a large region of code.

This patch does use the classical approach to placing phis, but tries
to use the existing DF defs information to avoid two walks of the IL.
We still use the previous approach for memory, since there is no
up-front information to indicate whether a block defines memory or not.
However, since memory is just treated as a single unified thing
(like for gimple vops), memory doesn't suffer from the same
scalability problems as registers.

With this change, fwprop no longer seems to be a memory-hog outlier
in the PR: the maximum RSS is similar with and without fwprop.

The PR also shows the problems inherent in using bitmap operations
involving the live-in and live-out sets, which in the testcase are
very large.  I've therefore tried to reduce those operations to the
bare minimum.

The patch also includes other compile-time optimisations motivated
by the PR; see the changelog for details.

I tried adding:

    for (int i = 0; i < 200; ++i)
      {
	crtl->ssa = new rtl_ssa::function_info (cfun);
	delete crtl->ssa;
      }

to fwprop.c to stress the code.  fwprop then took 35% of the compile
time for the problematic partition in the PR (measured on a release
build).  fwprop takes less than .5% of the compile time when running
normally.

The command:

  git diff 0b76990a9d75d97b84014e37519086b81824c307~ gcc/fwprop.c | \
    patch -p1 -R

still gives a working compiler that uses the old fwprop.c.  The compile
time with that version is very similar.

For a more reasonable testcase like optabs.ii at -O, I saw a 6.7%
compile time regression with the loop above added (i.e. creating
the info 201 times per pass instead of once per pass).  That goes
down to 4.8% with -O -g.  I can't measure a significant difference
with a normal compiler (no 200-iteration loop).

So I think that (as expected) the patch does make things a bit
slower in the normal case.  But like Richi says, peak memory usage
is harder for users to work around than slighter slower compile times.

gcc/
	PR rtl-optimization/98863
	* rtl-ssa/functions.h (function_info::bb_live_out_info): Delete.
	(function_info::build_info): Turn into a declaration, moving the
	definition to internals.h.
	(function_info::bb_walker): Declare.
	(function_info::create_reg_use): Likewise.
	(function_info::calculate_potential_phi_regs): Take a build_info
	parameter.
	(function_info::place_phis, function_info::create_ebbs): Declare.
	(function_info::calculate_ebb_live_in_for_debug): Likewise.
	(function_info::populate_backedge_phis): Delete.
	(function_info::start_block, function_info::end_block): Declare.
	(function_info::populate_phi_inputs): Delete.
	(function_info::m_potential_phi_regs): Move information to build_info.
	* rtl-ssa/internals.h: New file.
	(function_info::bb_phi_info): New class.
	(function_info::build_info): Moved from functions.h.
	Add a constructor and destructor.
	(function_info::build_info::ebb_use): Delete.
	(function_info::build_info::ebb_def): Likewise.
	(function_info::build_info::bb_live_out): Likewise.
	(function_info::build_info::tmp_ebb_live_in_for_debug): New variable.
	(function_info::build_info::potential_phi_regs): Likewise.
	(function_info::build_info::potential_phi_regs_for_debug): Likewise.
	(function_info::build_info::ebb_def_regs): Likewise.
	(function_info::build_info::bb_phis): Likewise.
	(function_info::build_info::bb_mem_live_out): Likewise.
	(function_info::build_info::bb_to_rpo): Likewise.
	(function_info::build_info::def_stack): Likewise.
	(function_info::build_info::old_def_stack_limit): Likewise.
	* rtl-ssa/internals.inl (function_info::build_info::record_reg_def):
	Remove the regno argument.  Push the previous definition onto the
	definition stack where necessary.
	* rtl-ssa/accesses.cc: Include internals.h.
	* rtl-ssa/changes.cc: Likewise.
	* rtl-ssa/blocks.cc: Likewise.
	(function_info::build_info::build_info): Define.
	(function_info::build_info::~build_info): Likewise.
	(function_info::bb_walker): New class.
	(function_info::bb_walker::bb_walker): Define.
	(function_info::add_live_out_use): Convert a logarithmic-complexity
	test into a linear one.  Allow the same definition to be passed
	multiple times.
	(function_info::calculate_potential_phi_regs): Moved from
	functions.cc.  Take a build_info parameter and store the
	information there instead.
	(function_info::place_phis): New function.
	(function_info::add_entry_block_defs): Update call to record_reg_def.
	(function_info::calculate_ebb_live_in_for_debug): New function.
	(function_info::add_phi_nodes): Use bb_phis to decide which
	registers need phi nodes and initialize ebb_def_regs accordingly.
	Do not add degenerate phis here.
	(function_info::add_artificial_accesses): Use create_reg_use.
	Assert that all definitions are listed in the DF LR sets.
	Update call to record_reg_def.
	(function_info::record_block_live_out): Record live-out register
	values in the phis of successor blocks.  Use the live-out set
	when processing the last block in an EBB, instead of always
	using the live-in sets of successor blocks.  AND the live sets
	with the set of registers that have been defined in the EBB,
	rather than with all potential phi registers.  Cope correctly
	with branches back to the start of the current EBB.
	(function_info::start_block): New function.
	(function_info::end_block): Likewise.
	(function_info::populate_phi_inputs): Likewise.
	(function_info::create_ebbs): Likewise.
	(function_info::process_all_blocks): Rewrite into a multi-phase
	process.
	* rtl-ssa/functions.cc: Include internals.h.
	(function_info::calculate_potential_phi_regs): Move to blocks.cc.
	(function_info::init_function_data): Remove caller.
	* rtl-ssa/insns.cc: Include internals.h
	(function_info::create_reg_use): New function.  Lazily any
	degenerate phis needed by the linear RPO view.
	(function_info::record_use): Use create_reg_use.  When processing
	debug uses, use potential_phi_regs and test it before checking
	whether the register is live on entry to the current EBB.  Lazily
	calculate ebb_live_in_for_debug.
	(function_info::record_call_clobbers): Update call to record_reg_def.
	(function_info::record_def): Likewise.
2021-02-15 15:05:22 +00:00
Martin Liska
40f235b5f0 Fix 2 more leaks related to gen_command_line_string.
gcc/ChangeLog:

	* toplev.c (init_asm_output): Free output of
	gen_command_line_string function.
	(process_options): Likewise.
2021-02-15 16:01:58 +01:00
Martin Liska
26cedbce4b Add 2 missing Param keywords.
gcc/ChangeLog:

	* params.opt: Add 2 missing Param keywords.
2021-02-15 15:09:04 +01:00
Eric Botcazou
8ec4f693fb Fix cast in df_worklist_dataflow_doublequeue
The existing cast to float gives weird results in the RTL dump files
on x86 when the compiler is configured -with-fpmath=sse.

gcc/
	* df-core.c (df_worklist_dataflow_doublequeue): Use proper cast.
2021-02-15 10:43:30 +01:00
Jakub Jelinek
70099a6acf match.pd: Fix up A % (cast) (pow2cst << B) simplification [PR99079]
The (mod @0 (convert?@3 (power_of_two_cand@1 @2))) simplification
uses tree_nop_conversion_p (type, TREE_TYPE (@3)) condition, but I believe
it doesn't check what it was meant to check.  On convert?@3
TREE_TYPE (@3) is not the type of what it has been converted from, but
what it has been converted to, which needs to be (because it is operand
of normal binary operation) equal or compatible to type of the modulo
result and first operand - type.
I could fix that by using && tree_nop_conversion_p (type, TREE_TYPE (@1))
and be done with it, but actually most of the non-nop conversions are IMHO
ok and so we would regress those optimizations.
In particular, if we have say narrowing conversions (foo5 and foo6 in
the new testcase), I think we are fine, either the shift of the power of two
constant after narrowing conversion is still that power of two (or negation
of that) and then it will still work, or the result of narrowing conversion
is 0 and then we would have UB which we can ignore.
Similarly, widening conversions where the shift result is unsigned are fine,
or even widening conversions where the shift result is signed, but we sign
extend to a signed wider divisor, the problematic case of INT_MIN will
become x % (long long) INT_MIN and we can still optimize that to
x & (long long) INT_MAX.
What doesn't work is the case in the pr99079.c testcase, widening conversion
of a signed shift result to wider unsigned divisor, where if the shift
is negative, we end up with x % (unsigned long long) INT_MIN which is
x % 0xffffffff80000000ULL where the divisor is not a power of two and
we can't optimize that to x & 0x7fffffffULL.

So, the patch rejects only the single problematic case.

Furthermore, when the shift result is signed, we were introducing UB into
a program which previously didn't have one (well, left shift into the sign
bit is UB in some language/version pairs, but it is definitely valid in
C++20 - wonder if I shouldn't move the gcc.c-torture/execute/pr99079.c
testcase to g++.dg/torture/pr99079.C and use -std=c++20), by adding that
subtraction of 1, x % (1 << 31) in C++20 is well defined, but
x & ((1 << 31) - 1) triggers UB on the subtraction.
So, the patch performs the subtraction in the unsigned type if it isn't
wrapping.

2021-02-15  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/99079
	* match.pd (A % (pow2pcst << N) -> A & ((pow2pcst << N) - 1)): Remove
	useless tree_nop_conversion_p (type, TREE_TYPE (@3)) check.  Instead
	require both type and TREE_TYPE (@1) to be integral types and either
	type having smaller or equal precision, or TREE_TYPE (@1) being
	unsigned type, or type being signed type.  If TREE_TYPE (@1)
	doesn't have wrapping overflow, perform the subtraction of one in
	unsigned type.

	* gcc.dg/fold-modpow2-2.c: New test.
	* gcc.c-torture/execute/pr99079.c: New test.
2021-02-15 09:16:06 +01:00
GCC Administrator
c5ae38e8dc Daily bump. 2021-02-15 00:16:18 +00:00
Jan Hubicka
9966699d7a Fix memory leak in ipa-refernece
2021-02-14  Jan Hubicka  <hubicka@ucw.cz>
	    Richard Biener  <rguether@suse.de>

	PR ipa/97346
	* ipa-reference.c (ipa_init): Only conditinally initialize
	reference_vars_to_consider.
	(propagate): Conditionally deninitialize reference_vars_to_consider.
	(ipa_reference_write_optimization_summary): Sanity check that
	reference_vars_to_consider is not allocated.
2021-02-14 23:24:44 +01:00
Jonathan Wakely
4e3590d06c libstdc++: Restore <unistd.h> in testsuite_fs.h header [PR 99096]
libstdc++-v3/ChangeLog:

	PR libstdc++/99096
	* testsuite/util/testsuite_fs.h: Always include <unistd.h>.
2021-02-14 20:38:32 +00:00
GCC Administrator
c8656df666 Daily bump. 2021-02-14 00:16:34 +00:00
Levy Hsu
18fabc35f4 RISC-V: Avoid zero/sign extend for volatile loads. Fix for 97417.
This expands sub-word loads as a zero/sign extended load, followed by
a subreg.  This helps eliminate unnecessary zero/sign extend insns after
the load, particularly for volatiles, but also in some other cases.
Testing shows that it gives consistent code size decreases.

Tested with riscv32-elf rv32imac/ilp32 and riscv64-linux rv64gc/lp064d
builds and checks.  Some -gsplit-stack tests fail with the patch, but
this turns out to be an existing bug with the split-stack support that
I hadn't noticed before.  It isn't a bug in this patch.  Ignoring that
there are no regressions.

Committed.

	gcc/
	PR target/97417
	* config/riscv/riscv-shorten-memrefs.c (pass_shorten_memrefs): Add
	extend parameter to get_si_mem_base_reg declaration.
	(get_si_mem_base_reg): Add extend parameter.  Set it.
	(analyze): Pass extend arg to get_si_mem_base_reg.
	(transform): Likewise.  Use it when rewriting mems.
	* config/riscv/riscv.c (riscv_legitimize_move): Check for subword
	loads and emit sign/zero extending load followed by subreg move.
2021-02-13 12:33:44 -08:00
Jim Wilson
a4953810ba RISC-V: Shorten memrefs improvement, partial fix 97417.
We already have a check for riscv_shorten_memrefs in riscv_address_cost.
This adds the same check to riscv_rtx_costs.  Making this work also
requires a change to riscv_compressed_lw_address_p to work before reload
by checking the offset and assuming any pseudo reg is OK.  Testing shows
that this consistently gives small code size reductions.

	gcc/
	PR target/97417
	* config/riscv/riscv.c (riscv_compressed_lw_address_p): Drop early
	exit when !reload_completed.  Only perform check for compressed reg
	if reload_completed.
	(riscv_rtx_costs): In MEM case, when optimizing	for size and
	shorten memrefs, if not compressible, then increase cost.
2021-02-13 12:13:08 -08:00
Jakub Jelinek
05402ca65a passes: Enable split4 with selective scheduling 2 [PR98439]
As mentioned in the PR, we have 5 split passes (+ splitting during final).
split1 is before RA and is unconditional,
split2 is after RA and is gated on optimize > 0,
split3 is before sched2 and is gated on
  defined(INSN_SCHEDULING) && optimize > 0 && flag_schedule_insns_after_reload
split4 is before regstack and is gated on
  HAVE_ATTR_length && defined (STACK_REGS) && !gate (split3)
split5 is before shorten_branches and is gated on
  HAVE_ATTR_length && !defined (STACK_REGS)
and the splitting during final works only when !HAVE_ATTR_length.
STACK_REGS is a macro enabled only on i386/x86_64.

The problem with the following testcase is that split3 before sched2
is the last splitting pass for the target/command line options set,
but selective scheduling unlike normal scheduling can create new
instructions that need to be split, which means we ICE during final as
there are insns that require splitting but nothing split them.

This patch fixes it by doing split4 also when -fselective-scheduling2
is enabled on x86 and split3 has been run.  As that option isn't on
by default, it should slow down compilation only for those that enable
that option.

2021-02-13  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/98439
	* recog.c (pass_split_before_regstack::gate): Enable even when
	pass_split_before_sched2 is enabled if -fselective-scheduling2 is
	on.

	* gcc.target/i386/pr98439.c: New test.
2021-02-13 16:08:29 +01:00
Iain Buclaw
a3b38b7781 d: Merge upstream dmd 7132b3537
Splits out all semantic passes for Dsymbol, Type, and TemplateParameter
nodes into Visitors in separate files, and the copyright years of all
sources have been updated.

Reviewed-on: https://github.com/dlang/dmd/pull/12190

gcc/d/ChangeLog:

	* dmd/MERGE: Merge upstream dmd 7132b3537.
	* Make-lang.in (D_FRONTEND_OBJS): Add d/dsymbolsem.o, d/semantic2.o,
	d/semantic3.o, and d/templateparamsem.o.
	* d-compiler.cc (Compiler::genCmain): Update calls to semantic
	entrypoint functions.
	* d-lang.cc (d_parse_file): Likewise.
	* typeinfo.cc (make_frontend_typeinfo): Likewise.
2021-02-13 12:50:45 +01:00