Commit Graph

185050 Commits

Author SHA1 Message Date
Jan Hubicka
d0adc557a2 Clear EAF_NOCLOBBER for indirect calls
gcc/ChangeLog:

2021-08-22  Jan Hubicka  <hubicka@ucw.cz>
	    Martin Liska  <mliska@suse.cz>

	PR middle-end/101949
	* ipa-modref.c (analyze_ssa_name_flags): Indirect call implies
	~EAF_NOCLOBBER.

gcc/testsuite/ChangeLog:

2021-08-22  Jan Hubicka  <hubicka@ucw.cz>
	    Martin Liska  <mliska@suse.cz>

	* gcc.dg/lto/pr101949_0.c: New test.
	* gcc.dg/lto/pr101949_1.c: New test.

(cherry picked from commit 9b08f7764c)
2021-08-24 10:24:47 +02:00
Richard Biener
5bc33f0318 ipa/97565 - fix IPA PTA body availability check
Looks like the existing check using has_gimple_body_p isn't enough
at LTRANS time but I need to check in_other_partition as well.

2021-08-23  Richard Biener  <rguenther@suse.de>

	PR ipa/97565
	* tree-ssa-structalias.c (ipa_pta_execute): Check in_other_partition
	in addition to has_gimple_body.

	* g++.dg/lto/pr97565_0.C: New testcase.
	* g++.dg/lto/pr97565_1.C: Likewise.

(cherry picked from commit 0230e69a3f)
2021-08-24 08:44:41 +02:00
GCC Administrator
c62cf32d05 Daily bump. 2021-08-24 00:18:52 +00:00
Jonathan Wakely
f918470940 libstdc++: Add default template argument to basic_istream_view
The standard shows this default template argument in the <ranges>
synopsis, but it was missing in libstdc++.

libstdc++-v3/ChangeLog:

	* include/std/ranges (basic_istream_view): Add default template
	argument.
	* testsuite/std/ranges/istream_view.cc: Check it.

(cherry picked from commit 1a129376bb)
2021-08-23 17:02:53 +01:00
Christophe Lyon
05dbde3bfb arm: Fix __arm_vctp16q return type in arm_mve.h
__arm_vctp16q actually returns mve_pred16_t rather than int64_t.

2021-08-23  Christophe Lyon  <christophe.lyon@foss.st.com>

	gcc/
	* config/arm/arm_mve.h: Fix __arm_vctp16q return type.

(cherry picked from commit ac3bcc813f)
2021-08-23 11:40:30 +00:00
Jakub Jelinek
513c543bb5 dwarf2out: Emit DW_AT_location for global register vars during early dwarf [PR101905]
The following patch emits DW_AT_location for global register variables
already during early dwarf, since usually late_global_decl hook isn't even
called for those, as nothing needs to be emitted for them.

2021-08-23  Jakub Jelinek  <jakub@redhat.com>

	PR debug/101905
	* dwarf2out.c (gen_variable_die): Add DW_AT_location for global
	register variables already during early_dwarf if possible.

	* gcc.dg/guality/pr101905.c: New test.

(cherry picked from commit b284053bb7)
2021-08-23 11:55:42 +02:00
Martin Liska
f7134a12cd gcov: fix output location for JSON mode.
PR gcov-profile/89961

gcc/ChangeLog:

	* gcov.c (make_gcov_file_name): Rewrite using std::string.
	(mangle_name): Simplify, do not used the second argument.
	(strip_extention): New function.
	(get_md5sum): Likewise.
	(get_gcov_intermediate_filename): Handle properly -p and -x
	options.
	(output_gcov_file): Use string type.
	(generate_results): Likewise.
	(md5sum_to_hex): Remove.

(cherry picked from commit b777f228b4)
2021-08-23 10:54:46 +02:00
GCC Administrator
0597b6e259 Daily bump. 2021-08-23 00:18:05 +00:00
GCC Administrator
d056e29c7f Daily bump. 2021-08-22 00:18:16 +00:00
GCC Administrator
2e90914b79 Daily bump. 2021-08-21 00:18:05 +00:00
GCC Administrator
ffd2d701ad Daily bump. 2021-08-20 00:18:08 +00:00
Jonathan Wakely
46a1acba89 libstdc++: Move status table entry to be with other ranges papers
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* doc/xml/manual/status_cxx2020.xml: Move row  earlier in table.
	* doc/html/manual/status.html: Regenerate.

(cherry picked from commit c5e0f954ae)
2021-08-19 15:06:47 +01:00
Jonathan Wakely
31433e154f libstdc++: Document P1739R4 status [PR100139]
We should document the status of this unimplemented feature.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	PR libstdc++/100139
	* doc/xml/manual/status_cxx2020.xml: Add P1739R4 to status table.
	* doc/html/manual/status.html: Regenerate.

(cherry picked from commit 926d4a71c7)
2021-08-19 14:59:14 +01:00
Thomas Schwinge
5fb588a677 Fix up 'gcc.dg/pr78213.c' for '--enable-checking=release' etc.
Fix up for r242748 (commit 3615816da8)
"[PR target/78213] Do not ICE on non-empty -fself-test", as made
apparent by recent commit a42467bdb7
"Restore 'gcc.dg/pr78213.c' testing", after the test case had gotten
disabled in r243681 (commit ecfc21ff34)
"Introduce selftest::locate_file" shortly after its original introduction.

	gcc/testsuite/
	PR testsuite/101969
	* gcc.dg/pr78213.c: Fix up for '--enable-checking=release' etc.

(cherry picked from commit b7fc42073c)
2021-08-19 08:45:40 +02:00
GCC Administrator
1499cc4aba Daily bump. 2021-08-19 00:18:33 +00:00
Christophe Lyon
b8a001599d arm: Fix pr69245.c testcase for reorder assembler architecture directives [PR101723]
In gcc.target/arm/pr69245.c, to have a .fpu neon-vfpv4 directive, make
sure code for fn1() is emitted, by removing the static keyword.

Fix a typo in gcc.target/arm/pr69245.c, where \s should be \\s.

2021-08-06  Christophe Lyon  <christophe.lyon@foss.st.com>

	gcc/testsuite/

	PR target/101723
	* gcc.target/arm/pr69245.c: Make sure to emit code for fn1, fix
	typo.

(cherry picked from commit aff75af3b5)
2021-08-18 16:22:39 +01:00
Christophe Lyon
39bb64e79a arm: Fix typos for reorder assembler architecture directives [PR101723]
Two tests had typos preventing them from passing, committed as obvious.

2021-08-06  Christophe Lyon  <christophe.lyon@foss.st.com>

	gcc/testsuite/
	PR target/101723
	* gcc.target/arm/attr-neon3.c: Fix typo.
	* gcc.target/arm/pragma_fpu_attribute_2.c: Fix typo.

(cherry picked from commit a22b3e022c)
2021-08-18 16:22:38 +01:00
Richard Earnshaw
c21ba5e57e arm: reorder assembler architecture directives [PR101723]
A change to the way gas interprets the .fpu directive in binutils-2.34
means that issuing .fpu will clear any features set by .arch_extension
that apply to the floating point or simd units.  This unfortunately
causes problems for more recent versions of the architecture because
we currently emit .arch, .arch_extension and .fpu directives at
different times and try to suppress redundant changes.

This change addresses this by firstly unifying all the places where we
emit these directives to a single block of code and secondly
(re)emitting all the directives if any changes have been made to the
target options.  Whilst this is slightly more than the strict minimum
it should be enough to catch all cases where a change could have
happened.  The new code also emits the directives in the order: .arch,
.fpu, .arch_extension.  This ensures that the additional architectural
extensions are not removed by a later .fpu directive.

Whilst writing this patch I also noticed that in the corner case where
the last function to be compiled had a non-standard set of
architecture flags, the assembler would add an incorrect set of
derived attributes for the file as a whole.  Instead of reflecting the
command-line options it would reflect the flags from the last file in
the function.  To address this I've also added a call to re-emit the
flags from the asm_file_end callback so the assembler will be in the
correct state when it finishes processing the intput.

There's some slight churn to the testsuite as a consequence of this,
because previously we had a hack to suppress emitting a .fpu directive
for one specific case, but with the new order this is no-longer
necessary.

gcc/ChangeLog:

	PR target/101723
	* config/arm/arm-cpus.in (generic-armv7-a): Add quirk to suppress
	writing .cpu directive in asm output.
	* config/arm/arm.c (arm_identify_fpu_from_isa): New variable.
	(arm_last_printed_arch_string): Delete.
	(arm_last-printed_fpu_string): Delete.
	(arm_configure_build_target): If use of floating-point/SIMD is
	disabled, remove all fp/simd related features from the target ISA.
	(last_arm_targ_options): New variable.
	(arm_print_asm_arch_directives): Add new parameters.  Change order
	of emitted directives and handle all cases here.
	(arm_file_start): Always call arm_print_asm_arch_directives, move
	all generation of .arch/.arch_extension here.
	(arm_file_end): Call arm_print_asm_arch.
	(arm_declare_function_name): Call arm_print_asm_arch_directives
	instead of printing .arch/.fpu directives directly.

gcc/testsuite/ChangeLog:

	PR target/101723
	* gcc.target/arm/cortex-m55-nofp-flag-hard.c: Update expected output.
	* gcc.target/arm/cortex-m55-nofp-flag-softfp.c: Likewise.
	* gcc.target/arm/cortex-m55-nofp-nomve-flag-softfp.c: Likewise.
	* gcc.target/arm/mve/intrinsics/mve_fpu1.c: Convert to dg-do assemble.
	Add a non-no-op function body.
	* gcc.target/arm/mve/intrinsics/mve_fpu2.c: Likewise.
	* gcc.target/arm/pr98636.c (dg-options): Add -mfloat-abi=softfp.
	* gcc.target/arm/attr-neon.c: Tighten scan-assembler tests.
	* gcc.target/arm/attr-neon2.c: Use -Ofast, convert test to use
	check-function-bodies.
	* gcc.target/arm/attr-neon3.c: Likewise.
	* gcc.target/arm/pr69245.c: Tighten scan-assembler match, but allow
	multiple instances.
	* gcc.target/arm/pragma_fpu_attribute.c: Likewise.
	* gcc.target/arm/pragma_fpu_attribute_2.c: Likewise.

(cherry picked from commit c1cdabe3aa)
2021-08-18 16:22:38 +01:00
Richard Earnshaw
302eb5361d arm: Don't reconfigure globals in arm_configure_build_target
arm_configure_build_target is usually used to reconfigure the
arm_active_target structure, which is then used to reconfigure a
number of other global variables describing the current target.
Occasionally, however, we need to use arm_configure_build_target to
construct a temporary target structure and in that case it is wrong to
try to reconfigure the global variables (although probably harmless,
since arm_option_reconfigure_globals() only looks at
arm_active_target).  At the very least, however, this is wasted work,
so it is best not to do it unless needed.  What's more, several
callers of arm_configure_build target call
arm_option_reconfigure_globals themselves within a few lines, making
the call from within arm_configure_build_target completely redundant.

So this patch moves the responsibility of calling of
arm_configure_build_target to its callers (only two places needed
updating).

gcc:
	* config/arm/arm.c (arm_configure_build_target): Don't call
	arm_option_reconfigure_globals.
	(arm_option_restore): Call arm_option_reconfigure_globals after
	reconfiguring the target.
	* config/arm/arm-c.c (arm_pragma_target_parse): Likewise.
(cherry picked from commit 6a37d0331c)
2021-08-18 16:22:38 +01:00
Richard Earnshaw
95c56f26a9 arm: ensure the arch_name is always set for the build target
This should never happen now if GCC is invoked by the driver, but in
the unusual case of calling cc1 (or its ilk) directly from the command
line the build target's arch_name string can remain NULL.  This can
complicate later processing meaning that we need to check for this
case explicitly in some circumstances.  Nothing should rely on this
behaviour, so it's simpler to always set the arch_name when
configuring the build target and be done with it.

gcc:

	* config/arm/arm.c (arm_configure_build_target): Ensure the target's
	arch_name is always set.

(cherry picked from commit 62e66c6a6c)
2021-08-18 16:22:37 +01:00
GCC Administrator
f00b55eef3 Daily bump. 2021-08-18 00:18:30 +00:00
Thomas Schwinge
112bbc8d1d libstdc++: Avoid illegal argument to verbose in dg-test callback, continued
This is a follow-up to commit 697b94cfae
"libstdc++: Avoid illegal argument to verbose in dg-test callback".
I'm confirming the original problem, but on one system, it's not
resolved by this change, because instead we get:

    extra_tool_flags are:
    ERROR: tcl error sourcing [...]/libstdc++-v3/testsuite/libstdc++-dg/conformance.exp.
    ERROR: usage: send [args] string
        while executing
    "send_log "$message\n""
        (procedure "verbose" line 48)
        invoked from within
    "verbose -log -- $extra_tool_flags"
        (procedure "libstdc++-dg-test" line 45)
        invoked from within
    "${tool}-dg-test $prog [lindex ${dg-do-what} 0] "$tool_flags ${dg-extra-tool-flags}""
        (procedure "saved-dg-test" line 115)
        invoked from within
    [...]

That's Ubuntu's dejagnu 1.5-3ubuntu1 being so old that it doesn't include
DejaGnu commit 57c22601afe43d2c2b8819df4f2ecacb034516fd "Protect from leading
dash in message".  (I suppose that's what'd make this work, but have not
verified.)

	libstdc++-v3/
	* testsuite/lib/libstdc++.exp: Avoid illegal argument to verbose,
	continued.

(cherry picked from commit 60b94d8bd2)
2021-08-17 21:06:30 +02:00
Thomas Schwinge
177dfb6167 Restore 'gcc.dg/pr78213.c' testing
... after it had gotten disabled in r243681 (Git
commit ecfc21ff34)
"Introduce selftest::locate_file".

	gcc/testsuite/
	* gcc.dg/pr78213.c: Restore testing.

(cherry picked from commit a42467bdb7)
2021-08-17 20:58:07 +02:00
Richard Biener
ee875b63b2 tree-optimization/101868 - avoid PRE of trapping mems across calls
This backports a fix for the omission of a check of trapping mems
when hoisting them across calls that might not return.  This was
originally done as part of a fix to handle const functions that throw
properly.

2021-08-17  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/101373
	PR tree-optimization/101868
	* tree-ssa-pre.c (prune_clobbered_mems): Also prune trapping
	references when the BB may not return.

	* gcc.dg/lto/pr101868_0.c: New testcase.
	* gcc.dg/lto/pr101868_1.c: Likewise.
	* gcc.dg/lto/pr101868_2.c: Likewise.
	* gcc.dg/lto/pr101868_3.c: Likewise.
2021-08-17 08:38:35 +02:00
GCC Administrator
a0a0499b8b Daily bump. 2021-08-17 00:18:10 +00:00
Harald Anlauf
4a414ac2a5 Fortran: fix checks for STAT= and ERRMSG= arguments of SYNC ALL/SYNC IMAGES
gcc/fortran/ChangeLog:

	PR fortran/99351
	* match.c (sync_statement): Replace %v code by %e in gfc_match to
	allow for function references as STAT and ERRMSG arguments.
	* resolve.c (resolve_sync): Adjust checks of STAT= and ERRMSG= to
	being definable arguments.  Function references with a data
	pointer result are accepted.
	* trans-stmt.c (gfc_trans_sync): Adjust assertion.

gcc/testsuite/ChangeLog:

	PR fortran/99351
	* gfortran.dg/coarray_sync.f90: New test.
	* gfortran.dg/coarray_3.f90: Adjust error messages.

(cherry picked from commit bbf19f9c20)
2021-08-16 22:00:23 +02:00
Joseph Myers
dfd32aa8c4 Update cpplib de.po
* de.po: Update.
2021-08-16 19:17:50 +00:00
Eric Botcazou
0c0c320a6e Fix regression in debug info for Ada with DWARF 5
add_scalar_info can directly generate a reference to an existing DIE for a
scalar attribute, e.g the upper bound of a VLA, but it does so only if this
existing DIE has a location or is a constant:

              if (get_AT (decl_die, DW_AT_location)
                  || get_AT (decl_die, DW_AT_data_member_location)
                  || get_AT (decl_die, DW_AT_const_value))

Now, in DWARF 5, members of a structure that are bitfields no longer have a
DW_AT_data_member_location but a DW_AT_data_bit_offset attribute instead, so
the condition is bypassed.

gcc/
	* dwarf2out.c (add_scalar_info): Deal with DW_AT_data_bit_offset.
2021-08-16 15:29:28 +02:00
Martin Liska
64336a85c9 ipa: ICF should check SSA_NAME_IS_DEFAULT_DEF
PR ipa/100600

gcc/ChangeLog:

	* ipa-icf-gimple.c (func_checker::compare_ssa_name): Do not
	  consider equal SSA_NAMEs when one is a param.

gcc/testsuite/ChangeLog:

	* gcc.dg/ipa/pr100600.c: New test.
2021-08-16 13:14:18 +02:00
Martin Liska
076b214b14 ipa: do not make localaliases for target_clones [PR101261]
PR ipa/101261

gcc/ChangeLog:

	* symtab.c (symtab_node::noninterposable_alias): Do not create
	  local aliases for target_clone functions as the clonning pass
	  rejects aliases.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr101261.c: New test.
2021-08-16 13:14:18 +02:00
Martin Liska
3d520d00ac ipa: make target_clone default decl local [PR101726]
PR ipa/101726

gcc/ChangeLog:

	* multiple_target.c (create_dispatcher_calls): Make default
	  function local only if it is a definition.
2021-08-16 13:14:18 +02:00
Martin Liska
dce5367eec LTO: bump minor version
Bump the LTO_minor_version due to changes in 52f0aa4dee

	PR c/100150

gcc/ChangeLog:

	* lto-streamer.h (LTO_minor_version): Bump.
2021-08-16 13:02:54 +02:00
GCC Administrator
056e324ce4 Daily bump. 2021-08-16 00:18:19 +00:00
GCC Administrator
389e4929ae Daily bump. 2021-08-15 00:18:14 +00:00
GCC Administrator
aa8b5b6e05 Daily bump. 2021-08-14 00:18:04 +00:00
Martin Liska
5f00ef3bc7 coverage: handle function beginning
PR gcov-profile/100788

gcc/ChangeLog:

	* coverage.c (coverage_begin_function): Update function
	  beginning when #line macro is used.

gcc/testsuite/ChangeLog:

	* gcc.dg/pr100788.c: New test.
2021-08-13 12:07:00 +02:00
GCC Administrator
7319c2c9e6 Daily bump. 2021-08-13 00:18:24 +00:00
Jakub Jelinek
b1c4b1c100 libcpp: Fix ICE with -Wtraditional preprocessing [PR101638]
The following testcase ICEs in cpp_sys_macro_p, because cpp_sys_macro_p
is called for a builtin macro which doesn't use node->value.macro union
member but a different one and so dereferencing it ICEs.
As the testcase is distilled from contemporary glibc headers, it means
basically -Wtraditional now ICEs on almost everything.

The fix can be either the patch below, return true for builtin macros,
or we could instead return false for builtin macros, or the fix could
be also (untested):
--- libcpp/expr.c       2021-05-07 10:34:46.345122608 +0200
+++ libcpp/expr.c       2021-08-12 09:54:01.837556365 +0200
@@ -783,13 +783,13 @@ cpp_classify_number (cpp_reader *pfile,

       /* Traditional C only accepted the 'L' suffix.
          Suppress warning about 'LL' with -Wno-long-long.  */
-      if (CPP_WTRADITIONAL (pfile) && ! cpp_sys_macro_p (pfile))
+      if (CPP_WTRADITIONAL (pfile))
        {
          int u_or_i = (result & (CPP_N_UNSIGNED|CPP_N_IMAGINARY));
          int large = (result & CPP_N_WIDTH) == CPP_N_LARGE
                       && CPP_OPTION (pfile, cpp_warn_long_long);

-         if (u_or_i || large)
+         if ((u_or_i || large) && ! cpp_sys_macro_p (pfile))
            cpp_warning_with_line (pfile, large ? CPP_W_LONG_LONG : CPP_W_TRADITIONAL,
                                   virtual_location, 0,
                                   "traditional C rejects the \"%.*s\" suffix",
The builtin macros at least currently don't add any suffixes
or numbers -Wtraditional would like to warn about.  For floating
point suffixes, -Wtraditional calls cpp_sys_macro_p only right
away before emitting the warning, but in the above case the ICE
is because cpp_sys_macro_p is called even if the number doesn't
have any suffixes (that is I think always for builtin macros
right now).

2021-08-12  Jakub Jelinek  <jakub@redhat.com>

	PR preprocessor/101638
	* macro.c (cpp_sys_macro_p): Return true instead of
	crashing on builtin macros.

	* gcc.dg/cpp/pr101638.c: New test.

(cherry picked from commit 408d88af60)
2021-08-12 22:55:08 +02:00
Jakub Jelinek
13e44296ea sanitizer: Cherry-pick realpath fix
tsan in some cases starts ignoring interceptors and only calls the
intercepted functions.  But for realpath the behavior for NULL second argument
was only handled in the interceptor and intercepted function was the one
found by dlsym which is often one that doesn't handle NULL as second argument.

Fixed by using dlvsym with "GLIBC_2.3" if possible for intercepted function
and don't emulate behavior in the wrapper.

2021-08-11  Jakub Jelinek  <jakub@redhat.com>

	* sanitizer_common/sanitizer_common_interceptors.inc: Cherry-pick
	llvm-project revision faef0d042f523357fe5590e7cb6a8391cf0351a8.

(cherry picked from commit 0e6017f5b4)
2021-08-12 22:55:01 +02:00
Jakub Jelinek
dd34596183 c++: Fix up #pragma omp declare {simd,variant} and acc routine parsing
When parsing default arguments, we need to temporarily clear parser->omp_declare_simd
and parser->oacc_routine, otherwise it can clash with further declarations
inside of e.g. lambdas inside of those default arguments.

2021-08-04  Jakub Jelinek  <jakub@redhat.com>

	PR c++/101759
	* parser.c (cp_parser_default_argument): Temporarily override
	parser->omp_declare_simd and parser->oacc_routine to NULL.

	* g++.dg/gomp/pr101759.C: New test.
	* g++.dg/goacc/pr101759.C: New test.

(cherry picked from commit af31cab047)
2021-08-12 22:54:19 +02:00
Jakub Jelinek
e7fd8e978e ubsan: Fix ICEs with DECL_REGISTER tests [PR101624]
The following testcase ICEs, because the base is a CONST_DECL for
the Fortran parameter, and ubsan/sanopt uses DECL_REGISTER macro on it.
 /* In VAR_DECL and PARM_DECL nodes, nonzero means declared `register'.  */
 #define DECL_REGISTER(NODE) (DECL_WRTL_CHECK (NODE)->decl_common.decl_flag_0)
while CONST_DECL doesn't satisfy DECL_WRTL_CHECK.

The following patch checks explicitly for VAR_DECL/PARM_DECL/RESULT_DECL
only before using DECL_REGISTER, assumes other decls aren't DECL_REGISTER.
Not really sure about RESULT_DECL but it at least satisfies DECL_WRTL_CHECK...

2021-07-28  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/101624
	* ubsan.c (maybe_instrument_pointer_overflow,
	instrument_object_size): Only test DECL_REGISTER on VAR_DECLs,
	PARM_DECLs or RESULT_DECLs.
	* sanopt.c (maybe_optimize_ubsan_ptr_ifn): Likewise.

	* gfortran.dg/ubsan/ubsan.exp: New file.
	* gfortran.dg/ubsan/pr101624.f90: New test.

(cherry picked from commit 49e28c02a9)
2021-08-12 22:53:42 +02:00
Patrick Palka
f65ae298d4 c++: constexpr std::construct_at on empty field [PR101663]
Here during constexpr evaluation of

  std::construct_at(&a._M_value)

we find ourselves in cxx_eval_store_expression where the target object
is 'a._M_value' and the initializer is {}.  Since _M_value is an empty
[[no_unique_address]] member we don't create a sub-CONSTRUCTOR for it,
so we end up in the early exit code path for empty stores with mismatched
types and trip over the assert therein

  gcc_assert (is_empty_class (TREE_TYPE (init)) && !lval);

because lval is true.  The reason it's true is because the INIT_EXPR in
question is the LHS of a COMPOUND_EXPR, and evaluation of the LHS is
always performed with lval=true (to indicate there's no lvalue-to-rvalue
conversion).

This patch makes the code path in question handle the lval=true case
appropriately rather than asserting.  In passing, it also consolidates
the duplicate implementations of std::construct_at/destroy_at in some
of the C++20 constexpr tests into a common header file.

	PR c++/101663

gcc/cp/ChangeLog:

	* constexpr.c (cxx_eval_store_expression): Handle the lval=true
	case in the early exit code path for empty stores with mismatched
	types.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/construct_at.h: New convenience header file that
	defines minimal implementations of std::construct_at/destroy_at,
	split out from ...
	* g++.dg/cpp2a/constexpr-new5.C: ... here.
	* g++.dg/cpp2a/constexpr-new6.C: Use the header.
	* g++.dg/cpp2a/constexpr-new14.C: Likewise.
	* g++.dg/cpp2a/constexpr-new20.C: New test.

(cherry picked from commit 21fd62e5ca)
2021-08-12 08:18:04 -04:00
Eric Botcazou
2e4e16f75e Make -no-pie option work for native Windows
Binutils 2.36/2.37 generate PIE executables by default on native Windows
(because --dynamicbase is the default) so it makes sense to have a simple
way to counter that and -no-pie seems appropriate, all the more so that
it is automatically passed when building the compiler itself.

gcc/
	* configure.ac (PE linker --disable-dynamicbase support): New check.
	* configure: Regenerate.
	* config.in: Likewise.
	* config/i386/mingw32.h (LINK_SPEC_DISABLE_DYNAMICBASE): New define.
	(LINK_SPEC): Use it.
	* config/i386/mingw-w64.h (LINK_SPEC_DISABLE_DYNAMICBASE): Likewise.
	(LINK_SPEC): Likewise.
2021-08-12 09:57:46 +02:00
GCC Administrator
a2beaebecd Daily bump. 2021-08-12 00:18:06 +00:00
Jonathan Wakely
6e3647c98e libstdc++: Fix test that fails randomly [PR101866]
This test assumes that the same sequence of three values cannot occur,
which is incorect. It's unlikely, but not impossible.

Perform the check in a loop, so that in the unlikely event of an
identical sequence, we retry. If the library code is buggy it will keep
producing the same sequence and the test will time out. If the code is
working correctly then we will usually break out of the loop after one
iteration, or very rarely after two or three.

libstdc++-v3/ChangeLog:

	PR libstdc++/101866
	* testsuite/experimental/random/randint.cc: Loop and retry if
	reseed() produces the same sequence.

(cherry picked from commit 93f1dbc7cd)
2021-08-11 23:50:33 +01:00
Patrick Palka
be45bc283e c++: parameterized requires-expr as default argument [PR101725]
Here we're rejecting the default template argument

  requires (T t) { x(t); }

because we consider the 't' in the requirement to be a local variable
(according to local_variable_p), and we generally forbid local variables
from appearing inside default arguments.  We can perhaps fix this by
giving special treatment to parameters introduced by requires-expressions,
but DR 2082 relaxed the restriction about local variables appearing within
default arguments to permit them inside unevaluated operands thereof.
So this patch just implements DR 2082 which also fixes this PR since a
requires-expression is an unevaluated context.

	PR c++/101725
	DR 2082

gcc/cp/ChangeLog:

	* cp-tree.h (unevaluated_p): Return true for REQUIRES_EXPR.
	* decl.c (local_variable_p_walkfn): Don't walk into unevaluated
	operands.
	* parser.c (cp_parser_primary_expression) <case CPP_NAME>: Never
	reject uses of local variables in unevaluated contexts.
	* tree.c (cp_walk_subtrees) <case REQUIRES_EXPR>: Increment
	cp_unevaluated_operand.  Use cp_walk_tree directly instead of
	WALK_SUBTREE to avoid the goto.  Use REQUIRES_EXPR_REQS instead
	of TREE_OPERAND directly.

gcc/testsuite/ChangeLog:

	* g++.dg/DRs/dr2082.C: New test.
	* g++.dg/cpp2a/concepts-uneval4.C: New test.

(cherry picked from commit 9707d2e5db)
2021-08-11 17:40:42 -04:00
Harald Anlauf
4ee9e57684 Fortran: ICE in resolve_allocate_deallocate for invalid STAT argument
gcc/fortran/ChangeLog:

	PR fortran/101564
	* expr.c (gfc_check_vardef_context): Add check for KIND and LEN
	parameter inquiries.
	* match.c (gfc_match): Fix comment for %v code.
	(gfc_match_allocate, gfc_match_deallocate): Replace use of %v code
	by %e in gfc_match to allow for function references as STAT and
	ERRMSG arguments.
	* resolve.c (resolve_allocate_deallocate): Avoid NULL pointer
	dereferences and shortcut for bad STAT and ERRMSG argument to
	(DE)ALLOCATE.  Remove bogus parts of checks for STAT and ERRMSG.

gcc/testsuite/ChangeLog:

	PR fortran/101564
	* gfortran.dg/allocate_stat_3.f90: New test.
	* gfortran.dg/allocate_stat.f90: Adjust error messages.
	* gfortran.dg/implicit_11.f90: Likewise.
	* gfortran.dg/inquiry_type_ref_3.f90: Likewise.

(cherry picked from commit 7bf582e6cf)
2021-08-11 21:36:34 +02:00
Patrick Palka
90f3dd128b c++: Improve memory usage of subsumption [PR100828]
Constraint subsumption is implemented in two steps.  The first step
computes the disjunctive (or conjunctive) normal form of one of the
constraints, and the second step verifies that each clause in the
decomposed form implies the other constraint.   Performing these two
steps separately is problematic because in the first step the DNF/CNF
can be exponentially larger than the original constraint, and by
computing it ahead of time we'd have to keep all of it in memory.

This patch fixes this exponential blowup in memory usage by interleaving
the two steps, so that as soon as we decompose one clause we check
implication for it.  In turn, memory usage during subsumption is now
worst case linear in the size of the constraints rather than
exponential, and so we can safely remove the hard limit of 16 clauses
without introducing runaway memory usage on some inputs.  (Note the
_time_ complexity of subsumption is still exponential in the worst case.)

In order for this to work we need to make formula::branch() insert the
copy of the current clause directly after the current clause rather than
at the end of the list, so that we fully decompose a clause shortly
after creating it.  Otherwise we'd end up accumulating exponentially
many (partially decomposed) clauses in memory anyway.

	PR c++/100828

gcc/cp/ChangeLog:

	* logic.cc (formula::formula): Use emplace_back instead of
	push_back.
	(formula::branch): Insert a copy of m_current directly after
	m_current instead of at the end of the list.
	(formula::erase): Define.
	(decompose_formula): Remove.
	(decompose_antecedents): Remove.
	(decompose_consequents): Remove.
	(derive_proofs): Remove.
	(max_problem_size): Remove.
	(diagnose_constraint_size): Remove.
	(subsumes_constraints_nonnull): Rewrite directly in terms of
	decompose_clause and derive_proof, interleaving decomposition
	with implication checking.  Remove limit on constraint complexity.
	Use formula::erase to free the current clause before moving on to
	the next one.

(cherry picked from commit f48c3cd2e3)
2021-08-11 11:54:19 -04:00
Jonathan Wakely
bde28c60c7 libstdc++: Fix create_directories to resolve symlinks [PR101510]
When filesystem__create_directories checks to see if the path already
exists and resolves to a directory, it uses filesystem::symlink_status,
which means it reports an error if the path is a symlink. It should use
filesystem::status, so that the target directory is detected, and no
error is reported.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	PR libstdc++/101510
	* src/c++17/fs_ops.cc (fs::create_directories): Use status
	instead of symlink_status.
	* src/filesystem/ops.cc (fs::create_directories): Likewise.
	* testsuite/27_io/filesystem/operations/create_directories.cc:
	Check symlink to existing directory.
	* testsuite/27_io/filesystem/operations/create_directory.cc: Do
	not test with symlinks on Windows.
	* testsuite/experimental/filesystem/operations/create_directories.cc:
	Check symlink to existing directory.
	* testsuite/experimental/filesystem/operations/create_directory.cc:
	Do not test with symlinks on Windows.

(cherry picked from commit 124eaa50e0)
2021-08-11 15:30:38 +01:00
Jonathan Wakely
c5f17274aa libstdc++: Add more tests for filesystem::create_directory [PR101510]
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	PR libstdc++/101510
	* src/c++17/fs_ops.cc (create_dir): Adjust whitespace.
	* testsuite/27_io/filesystem/operations/create_directory.cc:
	Test creating directory with name of existing symlink to
	directory.
	* testsuite/experimental/filesystem/operations/create_directory.cc:
	Likewise.

(cherry picked from commit 0c4ae4ff46)
2021-08-11 15:30:38 +01:00