-v needs to generate a -V not -v, as most/all other ports do.
The latter causes collect2 to output exec'd collect-ld with same
switches, which in turn causes a configure test which accumulates
linker switches to contain duplicates, leading to a libstdc++ configure
failure in some configurations.
-V is typically used in such contexts to output the available
emulations.
The change also removes reference to %(link_target), long obsolete.
2021-12-07 Doug Rupp <rupp@adacore.com>
* config/vxworks.h (LINK_SPEC): Remove %(link_target).
Change %{v:-v} to %{v:-V}.
Just redundant with the default Makefile setting.
2021-12-07 Olivier Hainque <hainque@adacore.com>
* config/t-vxworks: Remove assignment to STMP_FIXINC.
A mutex and condition variable is used for timed waits on atomics if
there is no "platform wait" (e.g. futex) supported. But the use of those
types wasn't guarded by the _GLIBCXX_HAS_GTHREADS macro, causing errors
for --disable-threads builds. This fix allows <atomic> to work on
targets with futexes but no gthreads.
libstdc++-v3/ChangeLog:
PR libstdc++/103638
* include/bits/atomic_timed_wait.h: Check _GLIBCXX_HAS_GTHREADS
before using std::mutex and std::__condvar.
If no OS function to sleep (e.g. nanosleep, usleep, Win32 Sleep etc.) is
available then configure defines the macro NO_SLEEP. But this will not
get prefixed with "_GLIBCXX_" because include/Makefile.am only does that
for macros beginning with "HAVE_". The configure script should define
_GLIBCXX_NO_SLEEP instead (which is what the code actually checks for).
libstdc++-v3/ChangeLog:
* acinclude.m4 (GLIBCXX_ENABLE_LIBSTDCXX_TIME): Add _GLIBCXX_
prefix to NO_SLEEP macro.
* config.h.in: Regenerate.
* configure: Regenerate.
This removes ibm-ldouble.c and a few eabi crt files from the build
closure, which were producing objects we don't use anyway.
2021-12-07 Rasmus Villemoes <rv@rasmusvillemoes.dk>
libgcc/
* config/rs6000/t-vxworks: New file.
* config.host (powerpc*-*-vxworks*): Use it instead of
t-ppccomm.
Fixes:
FAIL: compiler driver --help=param option(s): "^ +-.*[^:.]$" absent from output: "
--param=max-inline-functions-called-once-loop-depth= Maximum loop depth of a call which is considered for inlining functions called once"
FAIL: compiler driver --help=params option(s): "[^.]$" absent from output: "e"
gcc/ChangeLog:
* params.opt: Add missing dot.
This patch fixes PR ipa/103061 which is P1 regression that shows up as
an ICE in ipa-modref-tree.c's insert_kill when compiling the CSiBE
benchmark. I believe the underlying cause is that the new kill tracking
functionality wasn't anticipating memory accesses that are zero bits
wide!?. The failing source code (test case) contains the unusual lines:
typedef struct { } spinlock_t;
and
q->lock = (spinlock_t) { };
Making spinlock_t larger, or removing the assignment work around the issue.
The one line patch below to useful_for_kill_p teaches IPA that a memory
write is only useful as a "kill" if it is more than zero bits wide.
In theory, the existing known_size_p (size) test is now redundant, as
poly_int64 currently uses the value -1 for unknown size values,
but the proposed change makes the semantics clear, and defends against
possible future changes in representation.
2021-12-10 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
PR ipa/103601
* ipa-modref-tree.h (useful_for_kill_p): Zero width accesses aren't
useful for kill tracking.
gcc/testsuite/ChangeLog
PR ipa/103601
* gcc.dg/ipa/pr103601.c: New test case.
Up to now the libgomp GCN plugin has been finding the offload variables
by using a symbol lookup, but the AMD runtime requires that the symbols are
global for that to work. This was ensured by mkoffload as a post-procssing
step, but the LLVM 13 assembler no longer accepts this in the case where the
variable was previously declared differently.
This patch switches to locating the symbols directly from the
offload_var_table, which means that only one symbol needs to be forced
global.
This changes breaks the libgomp image compatibility so GOMP_VERSION_GCN has
also been bumped.
gcc/ChangeLog:
* config/gcn/mkoffload.c (process_asm): Process the variable table
completely differently.
(process_obj): Encode the varaible data differently.
include/ChangeLog:
* gomp-constants.h (GOMP_VERSION_GCN): Bump.
libgomp/ChangeLog:
* plugin/plugin-gcn.c (struct gcn_image_desc): Remove global_variables.
(GOMP_OFFLOAD_load_image): Locate the offload variables via the
table, not individual symbols.
Check for PLUS_EXPR/MINUS_EXPR support in vectorizable_induction.
PR103523 is an ICE on valid code:
void d(float *a, float b, int c) {
float e;
for (; c; c--, e += b)
a[c] = e;
}
This is due to not checking for PLUS_EXPR support, which is missing in
VNx2sf mode. This causes an ICE at expand time. This patch adds a check
for support in vectorizable_induction.
gcc/ChangeLog:
PR tree-optimization/103523
* tree-vect-loop.c (vectorizable_induction): Check for
PLUS_EXPR/MINUS_EXPR support.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/pr103523.c: New test.
This was an oversight in the original commit adding wait/notify
to atomic<T>.
libstdc++-v3/ChangeLog:
PR libstdc++/102994
* include/bits/atomic_base.h (__atomic_base<_PTp*>::wait()):
Add const qualifier.
* include/std/atomic (atomic<_Tp*>::wait(), atomic_wait()):
Likewise.
* testsuite/29_atomics/atomic/wait_notify/102994.cc:
New test.
Silvermont has a special handle in add_stmt_cost function, because it has in
order SIMD pipeline. But for Tremont, its SIMD pipeline is out of order,
remove Tremont from this special handle.
gcc/ChangeLog
* config/i386/i386.c (ix86_vector_costs::add_stmt_cost): Remove Tremont.
Aligns all D defined methods to MINIMUM_METHOD_BOUNDARY, improving
interoperability with C++ methods.
gcc/d/ChangeLog:
* decl.cc (get_symbol_decl): Align methods to MINIMUM_METHOD_BOUNDARY.
Since r11-1571 (c++: Refinements to "more constrained") was changed in
the front end, the following comment from stl_iterator.h stopped being
true:
// These extra overloads are not needed in C++20, because the ones above
// are constrained with a requires-clause and so overload resolution will
// prefer them to greedy unconstrained function templates.
The requires-clause is no longer considered when comparing unrelated
function templates. That means that the constrained operator== specified
in the standard is no longer more constrained than the pathological
comparison operators defined in the testsuite_greedy_ops.h header. This
was causing several tests to FAIL in C++20 mode:
FAIL: 23_containers/deque/types/1.cc (test for excess errors)
FAIL: 23_containers/vector/types/1.cc (test for excess errors)
FAIL: 24_iterators/move_iterator/greedy_ops.cc (test for excess errors)
FAIL: 24_iterators/normal_iterator/greedy_ops.cc (test for excess errors)
FAIL: 24_iterators/reverse_iterator/greedy_ops.cc (test for excess errors)
The solution is to restore some of the non-standard comparison operators
that are more specialized than the greedy operators in the testsuite.
libstdc++-v3/ChangeLog:
* include/bits/stl_iterator.h (operator==, operator<=>): Define
overloads for homogeneous specializations of reverse_iterator,
__normal_iterator and move_iterator.
This test no longer has additional errors for C++20 mode, so remove the
dg-error that is now failing, and the unnecessary dg-prune-output.
libstdc++-v3/ChangeLog:
* testsuite/20_util/scoped_allocator/69293_neg.cc: Remove
dg-error for c++20.
This allows std::make_exception_ptr to be used in a translation unit
compiled with -fno-exceptions. This works because the new implementation
added for PR 68297 doesn't need to throw or catch anything. The catch is
there to handle exceptions from the constructor of the exception object,
which we can assume won't happen in a -fno-exceptions TU and so use the
__catch macro instead. If the constructor does throw (because it's
defined in a different TU which was compiled with exceptions enabled)
then that exception will propagate to the make_exception_ptr caller.
That seems acceptable for a program that is trying to mix & match TUs
compiled with and without exceptions, and using types that throw when
constructed. That should be rare, and can't reasonably be expected to
have sensible behaviour.
This also enables the new implementation for targets that use a
non-standard calling convention for the exceptionDestructor callback
(specifically, mingw, which uses __thiscall). All we need to do is mark
the __dest_thunk function template with the right calling convention.
Finally, the useless no-op definition of make_exception_ptr (which is
only used if both RTTI and exceptions are disabled) is marked
always_inline, to ensure that the linker won't keep that definition and
discard the functional ones when both definitions of the function are
present in the link. An alternative would be to add the abi_tag
attribute to the useless definition, but making it always_inline should
work, and it's small enough to always be inlined reliably.
libstdc++-v3/ChangeLog:
PR libstdc++/85813
* libsupc++/exception_ptr.h (__dest_thunk): Add macro for
destructor calling convention.
(make_exception_ptr): Enable non-throwing implementation for
-fno-exceptions and for non-standard calling conventions. Use
always_inline attribute on the useless no-rtti no-exceptions
definition.
* testsuite/18_support/exception_ptr/64241.cc: Add -fno-rtti so
the no-op implementation is still used.
This restores support for std::make_exception_ptr<E&> and for using
std::exception_ptr in C++98.
Because the new non-throwing implementation needs to use std::decay to
handle references the original throwing implementation is used for
C++98.
We also need to change the typeid expression so it doesn't yield the
dynamic type when the function parameter is a reference to a polymorphic
type. Otherwise the new exception object could be caught by any handler
matching the dynamic type, even though the actual exception object is
only a copy of the base class, sliced to the static type.
libstdc++-v3/ChangeLog:
PR libstdc++/103630
* libsupc++/exception_ptr.h (exception_ptr): Fix exception
specifications on inline definitions.
(make_exception_ptr): Decay the template parameter. Use typeid
of the static type.
* testsuite/18_support/exception_ptr/103630.cc: New test.
This implements my P2467R0 proposal to support opening an fstream in
exclusive mode. The new constant is also supported pre-C++23 as
std::ios_base::__noreplace.
This proposal hasn't been approved for C++23 yet, but I am confident it
will be, as this is restoring a feture found in pre-ISO C++ iostreams
implementations (and still present in the MSVC library as _Noreplace).
If the proposal fails for C++23 we can remove the ios::noreplace
name and just keep ios::__noreplace as an extension.
libstdc++-v3/ChangeLog:
PR libstdc++/59769
* config/io/basic_file_stdio.cc (fopen_mode): Add support for
exclusive mode.
* include/bits/ios_base.h (_S_noreplace): Define new enumerator.
(ios_base::__noreplace): Define.
(ios_base::noreplace): Define for C++23.
* include/std/version (__cpp_lib_ios_noreplace): Define.
* testsuite/27_io/basic_ofstream/open/char/noreplace.cc: New test.
* testsuite/27_io/basic_ofstream/open/wchar_t/noreplace.cc: New test.
std::condition_variable::wait(unique_lock<mutex>&) is incorrectly marked
noexcept, which means that the __forced_unwind exception used by NPTL
cancellation will terminate the process. It should allow exceptions to
pass through, so that a thread can be cleanly cancelled when waiting on
a condition variable.
The new behaviour is exported as a new version of the symbol, to avoid
an ABI break for existing code linked to the non-throwing definition of
the function. Code linked against older releases will have a reference
to the @GLIBCXX_3.4.11 version, andcode compiled against the new
libstdc++ will get a reference to the @@GLIBCXX_3.4.30 version.
libstdc++-v3/ChangeLog:
PR libstdc++/103382
* config/abi/pre/gnu.ver (GLIBCXX_3.4.11): Do not export old
symbol if .symver renaming is supported.
(GLIBCXX_3.4.30): Export new symbol if .symver renaming is
supported.
* doc/xml/manual/evolution.xml: Document change.
* doc/html/manual/api.html: Regenerate.
* include/bits/std_mutex.h (__condvar::wait, __condvar::wait_until):
Remove noexcept.
* include/std/condition_variable (condition_variable::wait):
Likewise.
* src/c++11/condition_variable.cc (condition_variable::wait):
Likewise.
* src/c++11/compatibility-condvar.cc (__nothrow_wait_cv::wait):
Define nothrow wrapper around std::condition_variable::wait and
export the old symbol as an alias to it.
* testsuite/30_threads/condition_variable/members/103382.cc: New test.
Inserting a pair<Key, Value> into a map<Key, Value> will allocate a new
node and construct a pair<const Key, Value> in the node, then check if
the Key is already present in the map. That is because pair<Key, Value>
is not the same type as the map's value_type. But it only differs in the
const-qualification on the Key, and so we should be able to do the
lookup directly, without allocating a new node. This avoids allocating
and then deallocating a node for the case where the key is already found
and nothing gets inserted.
We can take this optimization further and lookup the key directly for a
pair<Key, X>, pair<const Key, X>, pair<Key&, X> etc. for any X. A strict
reading of the standard says we can only do this when we know the
allocator won't do anything funky with the value when constructing a
pair<const Key, Value> from a slightly different type. Inserting that
type only requires the value_type to be Cpp17EmplaceInsertable into the
container, and that doesn't have any requirement that the value is
unchanged (unlike Cpp17CopyInsertable and Cpp17MoveInsertable). For that
reason, the optimization is only done for maps using std::allocator.
A similar optimization can be done for map.emplace(key, value) where the
first argument is similar to the key_type and so can be looked up
without allocating a new node and constructing a key_type.
Finally, both of the insert and emplace cases can use the same
optimization when key_type is a scalar type and some other scalar is
being passed as the insert/emplace argument. Converting from one scalar
type to another won't have surprising value-altering behaviour, and has
no side effects (unlike e.g. constructing a std::string from a const
char* argument, which might allocate).
We don't need to do this for std::multimap, because we always insert the
new node even if the key is already present. So there's no benefit to
doing the lookup before allocating the new node.
libstdc++-v3/ChangeLog:
PR libstdc++/92300
* include/bits/stl_map.h (insert(Pair&&), emplace(Args&&...)):
Check whether the arguments can be looked up directly without
constructing a temporary node first.
* include/bits/stl_pair.h (__is_pair): Move to here, from ...
* include/bits/uses_allocator_args.h (__is_pair): ... here.
* testsuite/23_containers/map/modifiers/emplace/92300.cc: New test.
* testsuite/23_containers/map/modifiers/insert/92300.cc: New test.
When non-const references, pointers or iterators are obtained to the
contents of a COW std::basic_string, the implementation has to assume it
could result in a write to the contents. If the string was previously
shared, it does the "copy-on-write" step of creating a new copy of the
data that is not shared by another object. It also marks the string as
"leaked", so that no future copies of it will share ownership either.
However, if the string is empty then the only character in the sequence
is the terminating null, and modifying that is undefined behaviour. This
means that non-const references/pointers/iterators to an empty string
are effectively const. Since no direct modification is possible, there
is no need to "leak" the string, it can be safely shared with other
objects. This avoids unnecessary allocations to create new copies of
empty strings that can't be modified anyway.
We already did this optimization for strings that share ownership of the
static _S_empty_rep() object, but not for strings that have non-zero
capacity, and not for fully-dynamic-strings (where the _S_empty_rep()
object is never used).
With this change we avoid two allocations in the return statement:
std::string s;
s.reserve(1); // allocate
std::string s2 = s;
std::string s3 = s;
return s[0] + s2[0] + s3[0]; // leak+allocate twice
libstdc++-v3/ChangeLog:
* include/bits/cow_string.h (basic_string::_M_leak_hard): Do not
reallocate an empty string.
These warnings are triggered by perfectly valid code using std::string.
They're particularly bad when --enable-fully-dynamic-string is used,
because even std::string().begin() will give a warning.
Use pragmas to stop the troublesome warnings for copies done by
std::char_traits.
libstdc++-v3/ChangeLog:
PR libstdc++/103332
PR libstdc++/102958
PR libstdc++/103483
* include/bits/char_traits.h: Suppress stringop and array-bounds
warnings.
The possible base classes of std::allocator are new_allocator and
malloc_allocator, which both cause a non-reserved name to be declared in
every program that includes the definition of std::allocator. This is
non-conforming.
This change replaces __gnu_cxx::new_allocator with std::__new_allocator
which is identical except for using a reserved name. The non-standard
extension __gnu_cxx::new_allocator is preserved as a thin wrapper over
std::__new_allocator. There is no problem with the extension using a
non-reserved name now that it's not included by default in other
headers.
The same change could be done to __gnu_cxx::malloc_allocator but as it's
not the default configuration it can wait.
libstdc++-v3/ChangeLog:
PR libstdc++/64135
* config/allocator/new_allocator_base.h: Include
<bits/new_allocator.h> instead of <ext/new_allocator.h>.
(__allocator_base): Use std::__new_allocator instead of
__gnu_cxx::new_allocator.
* doc/xml/manual/allocator.xml: Document new default base class
for std::allocator.
* doc/xml/manual/evolution.xml: Likewise.
* doc/html/*: Regenerate.
* include/Makefile.am: Add bits/new_allocator.h.
* include/Makefile.in: Regenerate.
* include/experimental/memory_resource (new_delete_resource):
Use std::__new_allocator instead of __gnu_cxx::new_allocator.
* include/ext/new_allocator.h (new_allocator): Derive from
std::__new_allocator. Move implementation to ...
* include/bits/new_allocator.h: New file.
* testsuite/20_util/allocator/64135.cc: New test.
as dicussed in PR ipa/103454 there are several benchmarks that regresses
for -finline-functions-called once. Runtmes:
- tramp3d with -Ofast. 31%
- exchange2 with -Ofast 11-21%
- roms O2 9%-10%
- tonto 2.5-3.5% with LTO
Build times:
- specfp2006 41% (mostly wrf that builds 71% faster)
- specint2006 1.5-3%
- specfp2017 64% (again mostly wrf)
- specint2017 2.5-3.5%
This patch adds two params to tweak the behaviour:
1) max-inline-functions-called-once-loop-depth limiting the loop depth
(this is useful primarily for exchange where the inlined function is in
loop depth 9)
2) max-inline-functions-called-once-insns
We already have large-function-insns/growth parameters, but these are
limiting also inlining small functions, so reducing them will regress
very large functions that are hot.
Because inlining functions called once is meant just as a cleanup pass
I think it makes sense to have separate limit for it.
gcc/ChangeLog:
2021-12-09 Jan Hubicka <hubicka@ucw.cz>
* doc/invoke.texi (max-inline-functions-called-once-loop-depth,
max-inline-functions-called-once-insns): New parameters.
* ipa-inline.c (check_callers): Handle
param_inline_functions_called_once_loop_depth and
param_inline_functions_called_once_insns.
(edge_badness): Fix linebreaks.
* params.opt (param=max-inline-functions-called-once-loop-depth,
param=max-inline-functions-called-once-insn): New params.
Resolves:
PR tree-optimization/103215 - bogus -Warray-bounds with two pointers with different offsets each
gcc/ChangeLog:
PR tree-optimization/103215
* pointer-query.cc (access_ref::merge_ref): Extend the offset and
size of the merged object instead of using the larger.
gcc/testsuite/ChangeLog:
PR tree-optimization/103215
* gcc.dg/Wstringop-overflow-58.c: Adjust and xfail expected warnings.
* gcc.dg/Wstringop-overflow-59.c: Same.
* gcc.dg/warn-strnlen-no-nul.c: Same.
* gcc.dg/Warray-bounds-91.c: New test.
* gcc.dg/Warray-bounds-92.c: New test.
* gcc.dg/Wstringop-overflow-85.c: New test.
* gcc.dg/Wstringop-overflow-87.c: New test.
This fixes a basic mistake in the relative path used to reference
a rs6000 specific Makefile fragment in the libgcc configuration bits
for powerpc*-vxworks7.
2021-01-14 Fred Konrad <konrad@adacore.com>
libgcc/
* config.host (powerpc*-wrs-vxworks7*): Fix path to
rs6000/t-ppc64-fp, relative to config/ not libgcc/.
On Thu, Dec 09, 2021 at 05:42:10PM +0100, Christophe Lyon wrote:
> This also broke aarch64 I think:
> In file included from
> /tmp/6140018_6.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/config/aarch64/aarch64-sve-builtins.cc:3920:0:
> ./gt-aarch64-sve-builtins.h: In function 'void
> gt_pch_p_19registered_function(void*, void*, gt_pointer_operator, void*)':
> ./gt-aarch64-sve-builtins.h:86:44: error: no matching function for call to
> 'gt_pch_nx(aarch64_sve::function_instance*, void (*&)(void*, void*, void*),
> void*&)'
> gt_pch_nx (&((*x).instance), op, cookie);
Fixed thusly.
2021-12-09 Jakub Jelinek <jakub@redhat.com>
PR pch/71934
* config/aarch64/aarch64-sve-builtins.cc (gt_pch_nx): Change type of
second argument from function with 2 pointer arguments to function
with 3 pointer arguments.
This change tightens the CPU macro definitions issued
for VxWorks system headers on aarch64 to incorporate
the common VX_CPU_PREFIX facility, as the powerpc port
does.
The net effect for current configurations is the addition
of an actual "_VX_" prefix to the references to architecture
representative values. The absence of this prefix is most
often compensated for in system headers, but not always (when
going through particular #include paths), and this caused
a couple of spurious test failures.
2021-12-09 Olivier Hainque <hainque@adacore.com>
gcc/
* config/aarch64/aarch64-vxworks.h (TARGET_OS_CPP_BUILTINS):
Use VX_CPU_PREFIX in CPU definitions.
gcc/ChangeLog:
* pointer-query.cc (access_ref::dump): Define new function
(pointer_query::dump): Call it.
* pointer-query.h (access_ref::dump): Declare new function.
gcc/ChangeLog:
* pointer-query.cc (compute_objsize_r): Add an argument.
(gimple_call_return_array): Pass a new argument to compute_objsize_r.
(access_ref::merge_ref): Same.
(access_ref::inform_access): Add an argument and use it.
(access_data::access_data): Initialize new member.
(handle_min_max_size): Pass a new argument to compute_objsize_r.
(handle_decl): New function.
(handle_array_ref): Pass a new argument to compute_objsize_r.
Avoid incrementing deref.
(set_component_ref_size): New function.
(handle_component_ref): New function.
(handle_mem_ref): Pass a new argument to compute_objsize_r.
Only increment deref after successfully computing object size.
(handle_ssa_name): New function.
(compute_objsize_r): Move code into helpers and call them.
(compute_objsize): Pass a new argument to compute_objsize_r.
* pointer-query.h (access_ref::inform_access): Add an argument.
(access_data::ostype): New member.
gcc/ChangeLog:
* pointer-query.cc (access_ref::merge_ref): Define new function.
(access_ref::get_ref): Move code into merge_ref and call it.
* pointer-query.h (access_ref::merge_ref): Declare new function.
In C++23, auto(x) is valid, so decltype(auto(x)) should also be valid,
so
void f(decltype(auto(0)));
should be just as
void f(int);
but currently, everytime we see 'auto' in a parameter-declaration-clause,
we try to synthesize_implicit_template_parm for it, creating a new template
parameter list. The code above actually has us calling s_i_t_p twice;
once from cp_parser_decltype_expr -> cp_parser_postfix_expression which
fails and then again from cp_parser_decltype_expr -> cp_parser_expression.
So it looks like we have f<auto, auto> and we accept ill-formed code.
This shows that we need to be more careful about synthesizing the
implicit template parameter. [dcl.spec.auto.general] says that "A
placeholder-type-specifier of the form type-constraintopt auto can be
used as a decl-specifier of the decl-specifier-seq of a
parameter-declaration of a function declaration or lambda-expression..."
so this patch turns off auto_is_... after we've parsed the decl-specifier-seq.
That doesn't quite cut it yet though, because we also need to handle an
auto nested in the decl-specifier:
void f(decltype(new auto{0}));
therefore the cp_parser_decltype change.
To accept "sizeof(auto{10})", the cp_parser_type_id_1 hunk only gives a
hard error when we're not parsing tentatively.
The cp_parser_parameter_declaration hunk broke lambda-generic-85713-2.C but
I think the error we issue with this patch is in fact correct, and clang++
agrees.
The r11-1913 change is OK: we need to make sure that we see '(auto)' after
decltype to go ahead with 'decltype(auto)'.
PR c++/103401
gcc/cp/ChangeLog:
* parser.c (cp_parser_decltype): Clear
auto_is_implicit_function_template_parm_p.
(cp_parser_type_id_1): Give errors only when !cp_parser_simulate_error.
(cp_parser_parameter_declaration): Clear
auto_is_implicit_function_template_parm_p after parsing the
decl-specifier-seq.
(cp_parser_sizeof_operand): Clear
auto_is_implicit_function_template_parm_p.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1y/lambda-generic-85713-2.C: Add dg-error.
* g++.dg/cpp1y/pr60054.C: Adjust dg-error.
* g++.dg/cpp1y/pr60332.C: Likewise.
* g++.dg/cpp2a/concepts-pr84979-2.C: Likewise.
* g++.dg/cpp2a/concepts-pr84979-3.C: Likewise.
* g++.dg/cpp2a/concepts-pr84979.C: Likewise.
* g++.dg/cpp23/auto-fncast7.C: New test.
* g++.dg/cpp23/auto-fncast8.C: New test.
* g++.dg/cpp23/auto-fncast9.C: New test.
Some testcases for libgomp.c++ only works for non-shared address space offloading,
because it exercises the zero-length array section behavior for offloaded
address space, testing for NULL/non-NULL cases.
libgomp/ChangeLog:
* testsuite/libgomp.c++/target-lambda-1.C: Only run under
"target offload_device_nonshared_as"
* testsuite/libgomp.c++/target-this-3.C: Likewise.
* testsuite/libgomp.c++/target-this-4.C: Likewise.
This change arranges to provide the vxworks alternate stdint.h
at build time instead of at install time, so it is used instead
of the system one while building the libraries.
This is a lot more consistent and helps the build on configurations
where the system does not come with stdint.h at all.
The change uses a similar mechanism as the one previsouly introduced
for glimits.h and takes the opportunity to simplify the glimits.h
command to use an automatic variable.
This introduces an indirect dependency on the VxWorks version.h
for vxcrtstuff objects, for which we then need to apply the same
tricks as for libgcc2 regarding include paths (to select the system
header instead of the gcc one).
2021-02-12 Olivier Hainque <hainque@adacore.com>
Rasmus Villemoes <rv@rasmusvillemoes.dk>
gcc/
* Makefile.in (T_STDINT_GCC_H): New variable, path to
stdint-gcc.h that a target configuration may override when
use_gcc_stdint is "provide".
(stmp-int-hdrs): Depend on it and copy that for
USE_GCC_INT=provide.
* config.gcc (vxworks): Revert to use_gcc_stdint=provide.
* config/t-vxworks (T_STDINT_GCC_H): Define, as vxw-stdint-gcc.h.
(vxw-stdint-gcc.h): New target, produced from the original
stdint-gcc.h.
(vxw-glimits.h): Use an automatic variable to designate the
first and only prerequisite.
* config/vxworks/stdint.h: Remove.
libgcc/
* config/t-vxworks: Set CRTSTUFF_T_CFLAGS to
$(LIBGCC2_INCLUDES).
* config/t-vxworks7: Likewise.
Now we have a relocatable PCH implementation we can revise the
hooks that find and use the mmapped memory. Specifically, this
removes the extra checking and diagnostic output for cases that
were likely to fail in a non-relocatable scenario.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/ChangeLog:
PR pch/71934
* config/host-darwin.c (SAFE_ALLOC_SIZE): Remove.
(darwin_gt_pch_get_address): Rework for relocatable PCH.
(darwin_gt_pch_use_address): Likewise.
In the last change, I've changed the arguments from void * to void *&,
but missed the fact that these hooks will in that case update the value
the caller will see in an undesirable way.
2021-12-09 Jakub Jelinek <jakub@redhat.com>
PR pch/71934
* config/host-darwin.c (darwin_gt_pch_use_address): When reading
manually the file into mapped area, update mapped_addr as
an automatic variable rather than addr which is a reference parameter.
* config/host-hpux.c (hpux_gt_pch_use_address): When reading
manually the file into mapped area, update addr as
an automatic variable rather than base which is a reference parameter.
The following patch adds support for relocation of the PCH blob on PCH
restore if we don't manage to get the preferred map slot for it.
The GTY stuff knows where all the pointers are, after all it relocates
it once during PCH save from the addresses where it was initially allocated
to addresses in the preferred map slot.
But, if we were to do it solely using GTY info upon PCH restore, we'd need
another set of GTY functions, which I think would make it less maintainable
and I think it would also be more costly at PCH restore time. Those
functions would need to call something to add bias to pointers that haven't
been marked yet and make sure not to add bias to any pointer twice.
So, this patch instead builds a relocation table (sorted list of addresses
in the blob which needs relocation) at PCH save time, stores it in a very
compact form into the gch file and upon restore, adjusts pointers in GTY
roots (that is right away in the root structures) and the addresses in the
relocation table.
The cost on stdc++.gch/O2g.gch (previously 85MB large) is about 3% file size
growth, there are 2.5 million pointers that need relocation in the gch blob
and the relocation table uses uleb128 for address deltas and needs ~1.01 bytes
for one address that needs relocation, and about 20% compile time during
PCH save (I think it is mainly because of the need to qsort those 2.5
million pointers). On PCH restore, if it doesn't need relocation (the usual
case), it is just an extra fread of sizeof (size_t) data and fseek
(in my tests real time on vanilla tree for #include <bits/stdc++.h> CU
was ~0.175s and with the patch but no relocation ~0.173s), while if it needs
relocation it took ~0.193s, i.e. 11.5% slower.
Without PCH that
#include <bits/stdc++.h>
int i;
testcase compiles with -O2 -g in ~1.199s, i.e. 6.2 times slower than PCH with
relocation and 6.9 times than PCH without relocation.
The discovery of the pointers in the blob that need relocation is done
in the relocate_ptrs hook which does the pointer relocation during PCH save.
Unfortunately, I had to make one change to the gengtype stuff due to the
nested_ptr feature of GTY, which some libcpp headers and stringpool.c use.
The relocate_ptrs hook had 2 arguments, pointer to the pointer and a cookie.
When relocate_ptrs is done, in most cases it is called solely on the
subfields of the current object, so e.g.
if ((void *)(x) == this_obj)
op (&((*x).u.fld[0].rt_rtx), cookie);
so relocate_ptrs can assert that ptr_p is within the
state->ptrs[state->ptrs_i]->obj ..
state->ptrs[state->ptrs_i]->obj+state->ptrs[state->ptrs_i]->size-sizeof(void*)
range and compute from that the address in the blob which will need
relocation (state->ptrs[state->ptrs_i]->new_addr is the new address
given to it and ptr_p-state->ptrs[state->ptrs_i]->obj is the relative
offset. Unfortunately, for nested_ptr gengtype emits something like:
{
union tree_node * x0 =
((*x).val.node.node) ? HT_IDENT_TO_GCC_IDENT (HT_NODE (((*x).val.node.node))) : NULL;
if ((void *)(x) == this_obj)
op (&(x0), cookie);
(*x).val.node.node = (x0) ? CPP_HASHNODE (GCC_IDENT_TO_HT_IDENT ((x0))) : NULL;
}
so relocate_ptrs is called with an address of some temporary variable and
so doesn't know where the pointer will finally be.
So, I've added another argument to relocate_ptrs (and to
gt_pointer_operator). For the most common case I pass NULL as the new middle
argument to that function, first one remains pointer to the pointer that
needs adjustment and last the cookie. The NULL seems to be cheap to compute
and short in the gt*.[ch] files and stands for ptr_p is an address within
the this_obj's range, remember its address. For the nested_ptr case, the
new middle argument contains actual address of the pointer that might need
to be relocated, so instead of the above
op (&(x0), &((*x).val.node.node), cookie);
in there. And finally, e.g. for the reorder case I need a way to tell
restore_ptrs to ignore a particular address for the relocation purposes
and only treat it the old way. I've used for that the case when
the first and second arguments are equal.
In order to enable support for mapping PCH as fallback at different
addresses than the preferred ones, a small change is needed to the
host pch_use_address hooks. One change I've done to all of them is
the change of the type of the first argument from void * to void *&,
such that the actual address can be told to the callers (or shall I
instead use void **?), but another change that still needs to be done
in them if they want the relocation is actually not fail if they couldn't
get a preferred address, but instead modify what the first argument
refers to. I've done that only for host-linux.c and Iain is testing
similar change for host-darwin.c. Didn't change hpux, netbsd, openbsd,
solaris, mingw32 or the fallbacks because I can't test those.
Tested also with the:
--- gcc/config/host-linux.c.jj 2021-12-06 22:22:42.007777367 +0100
+++ gcc/config/host-linux.c 2021-12-07 00:21:53.052674040 +0100
@@ -191,6 +191,8 @@ linux_gt_pch_use_address (void *&base, s
if (size == 0)
return -1;
+base = (char *) base + ((size + 8191) & (size_t) -4096);
+
/* Try to map the file with MAP_PRIVATE. */
addr = mmap (base, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, offset);
hack which forces all PCH restores to be relocated. An earlier version of the
patch has been also regrest with base = (char *) base + 16384; in that spot,
so both relocation to a non-overlapping spot and to an overlapping spot have
been tested.
2021-12-09 Jakub Jelinek <jakub@redhat.com>
PR pch/71934
* coretypes.h (gt_pointer_operator): Use 3 pointer arguments instead
of two.
* gengtype.c (struct walk_type_data): Add in_nested_ptr argument.
(walk_type): Temporarily set d->in_nested_ptr around nested_ptr
handling.
(write_types_local_user_process_field): Pass a new middle pointer
to gt_pointer_operator op calls, if d->in_nested_ptr pass there
address of d->prev_val[2], otherwise NULL.
(write_types_local_process_field): Likewise.
* ggc-common.c (relocate_ptrs): Add real_ptr_p argument. If equal
to ptr_p, do nothing, otherwise if NULL remember ptr_p's
or if non-NULL real_ptr_p's corresponding new address in
reloc_addrs_vec.
(reloc_addrs_vec): New variable.
(compare_ptr, read_uleb128, write_uleb128): New functions.
(gt_pch_save): When iterating over objects through relocate_ptrs,
save current i into state.ptrs_i. Sort reloc_addrs_vec and emit
it as uleb128 of differences between pointer addresses into the
PCH file.
(gt_pch_restore): Allow restoring of PCH to a different address
than the preferred one, in that case adjust global pointers by bias
and also adjust by bias addresses read from the relocation table
as uleb128 differences. Otherwise fseek over it. Perform
gt_pch_restore_stringpool only after adjusting callbacks and for
callback adjustments also take into account the bias.
(default_gt_pch_use_address): Change type of first argument from
void * to void *&.
(mmap_gt_pch_use_address): Likewise.
* ggc-tests.c (gt_pch_nx): Pass NULL as new middle argument to op.
* hash-map.h (hash_map::pch_nx_helper): Likewise.
(gt_pch_nx): Likewise.
* hash-set.h (gt_pch_nx): Likewise.
* hash-table.h (gt_pch_nx): Likewise.
* hash-traits.h (ggc_remove::pch_nx): Likewise.
* hosthooks-def.h (default_gt_pch_use_address): Change type of first
argument from void * to void *&.
(mmap_gt_pch_use_address): Likewise.
* hosthooks.h (struct host_hooks): Change type of first argument of
gt_pch_use_address hook from void * to void *&.
* machmode.h (gt_pch_nx): Expect a callback with 3 pointers instead of
two in the middle argument.
* poly-int.h (gt_pch_nx): Likewise.
* stringpool.c (gt_pch_nx): Pass NULL as new middle argument to op.
* tree-cfg.c (gt_pch_nx): Likewise, except for LOCATION_BLOCK pass
the same &(block) twice.
* value-range.h (gt_pch_nx): Pass NULL as new middle argument to op.
* vec.h (gt_pch_nx): Likewise.
* wide-int.h (gt_pch_nx): Likewise.
* config/host-darwin.c (darwin_gt_pch_use_address): Change type of
first argument from void * to void *&.
* config/host-darwin.h (darwin_gt_pch_use_address): Likewise.
* config/host-hpux.c (hpux_gt_pch_use_address): Likewise.
* config/host-linux.c (linux_gt_pch_use_address): Likewise. If
it couldn't succeed to mmap at the preferred location, set base
to the actual one. Update addr in the manual reading loop instead of
base.
* config/host-netbsd.c (netbsd_gt_pch_use_address): Change type of
first argument from void * to void *&.
* config/host-openbsd.c (openbsd_gt_pch_use_address): Likewise.
* config/host-solaris.c (sol_gt_pch_use_address): Likewise.
* config/i386/host-mingw32.c (mingw32_gt_pch_use_address): Likewise.
* config/rs6000/rs6000-gen-builtins.c (write_init_file): Pass NULL
as new middle argument to op in the generated code.
* doc/gty.texi: Adjust samples for the addition of middle pointer
to gt_pointer_operator callback.
gcc/ada/
* gcc-interface/decl.c (gt_pch_nx): Pass NULL as new middle argument
to op.
gcc/c-family/
* c-pch.c (c_common_no_more_pch): Pass a temporary void * var
with NULL value instead of NULL to host_hooks.gt_pch_use_address.
gcc/c/
* c-decl.c (resort_field_decl_cmp): Pass the same pointer twice
to resort_data.new_value.
gcc/cp/
* module.cc (nop): Add another void * argument.
* name-lookup.c (resort_member_name_cmp): Pass the same pointer twice
to resort_data.new_value.
Fixes:
gcc/d/expr.cc:2596:9: runtime error: null pointer passed as argument 2, which is declared to never be null
gcc/d/ChangeLog:
* expr.cc: Call memcpy only when length != 0.
The testcase shows malformed asms in one block confuse reg-stack logic
in another block. Moving the resetting of any_malformed_asm to the
end of the pass enables it to take effect throughout the affected
function.
for gcc/ChangeLog
PR target/103097
* reg-stack.c (convert_regs_1): Move any_malformed_asm
resetting...
(reg_to_stack): ... here.
for gcc/testsuite/ChangeLog
PR target/103097
* gcc.target/i386/pr103097.c: New.
If we emit clobbers before multi-word moves during lra, we get
confused if a copy ends up with input or output replaced with each
other: the clobber then kills the previous set, and it gets deleted.
This patch avoids emitting such clobbers when lra_in_progress.
for gcc/ChangeLog
PR target/103302
* expr.c (emit_move_multi_word): Skip clobber during lra.
for gcc/testsuite/ChangeLog
PR target/103302
* gcc.target/riscv/pr103302.c: New.
This patch adjusts the harden-compares pass to cope with compares that
end basic blocks, and to accept non-boolean integral types whose
conversion to boolean may have been discarded.
for gcc/ChangeLog
PR tree-optimization/103024
PR middle-end/103530
* gimple-harden-conditionals.cc (non_eh_succ_edge): New.
(pass_harden_compares::execute): Accept 1-bit integral types,
and cope with throwing compares.
for gcc/testsuite/ChangeLog
PR tree-optimization/103024
PR middle-end/103530
* g++.dg/pr103024.C: New.
* g++.dg/pr103530.C: New.
D front-end changes:
- Import dmd v2.098.0
- New ImportC module for compiling preprocessed C11 code into D.
- New -ftransition=in switch.
- Improved handling of new 'noreturn' type.
Druntime changes:
- Import druntime v2.098.0
- Fix broken import in core.sys.linux.perf_event module (PR103558).
Phobos changes:
- Import phobos v2.098.0
- All sources are now compiled with -fpreview=fieldwise.
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd 568496d5b.
* Make-lang.in (D_FRONTEND_OBJS): Add d/common-file.o,
d/common-outbuffer.o, d/common-string.o, d/file_manager.o,
d/importc.o. Remove d/root-outbuffer.o.
(d/common-%.o): New recipe.
* d-builtins.cc (build_frontend_type): Update for new front-end
interface.
(d_build_d_type_nodes): Set noreturn_type_node.
* d-codegen.cc (d_build_call): Don't call function if one of the
arguments is type 'noreturn'.
(build_vthis_function): Propagate TYPE_QUAL_VOLATILE from original
function type.
* d-frontend.cc (eval_builtin): Update signature.
(getTypeInfoType): Likewise.
(toObjFile): New function.
* d-gimplify.cc (d_gimplify_call_expr): Always evaluate arguments from
left to right.
* d-lang.cc (d_handle_option): Handle OPT_ftransition_in.
(d_parse_file): Don't generate D main if it is declared in user code.
* d-tree.h (CALL_EXPR_ARGS_ORDERED): Remove.
(enum d_tree_index): Add DTI_BOTTOM_TYPE.
(noreturn_type_node): New.
* decl.cc (apply_pragma_crt): Remove.
(DeclVisitor::visit): Update for new front-end interface.
(DeclVisitor::visit (PragmaDeclaration *)): Don't handle
crt_constructor and crt_destructor pragmas.
(DeclVisitor::visit (VarDeclaration *)): Don't generate declarations
of type 'noreturn'.
(DeclVisitor::visit (FuncDeclaration *)): Stop adding parameters when
'noreturn' type has been encountered.
(get_symbol_decl): Set DECL_STATIC_CONSTRUCTOR and
DECL_STATIC_DESTRUCTOR on decl node if requested.
(aggregate_initializer_decl): Update for new front-end interface.
* expr.cc (ExprVisitor::visit (CallExp *)): Always use the 'this'
object as the result of calling any constructor function.
(ExprVisitor::visit): Update for new front-end interface.
* gdc.texi (Runtime Options): Document -fmain and -ftransition=in.
* lang.opt (ftransition=in): New option.
* modules.cc (get_internal_fn): Update for new front-end interface.
* types.cc (TypeVisitor::visit): Likewise.
(TypeVisitor::visit (TypeNoreturn *)): Return noreturn_type_node.
(TypeVisitor::visit (TypeFunction *)): Stop adding parameters when
'notreturn' type has been encountered. Qualify function types that
return 'noreturn' as TYPE_QUAL_VOLATILE.
libphobos/ChangeLog:
PR d/103558
* libdruntime/MERGE: Merge upstream druntime 178c44ff.
* libdruntime/Makefile.am (DRUNTIME_DSOURCES_LINUX): Add
core/sys/linux/syscalls.d.
(DRUNTIME_DSOURCES_OPENBSD): Add core/sys/openbsd/pthread_np.d.
* libdruntime/Makefile.in: Regenerate.
* src/MERGE: Merge upstream phobos 574bf883b.
* src/Makefile.am (D_EXTRA_DFLAGS): Add -fpreview=fieldwise.
* src/Makefile.in: Regenerate.
* testsuite/libphobos.exceptions/assert_fail.d: Update test.
* testsuite/libphobos.betterc/test22336.d: New test.
The check for _Atomic_word being 32-bit is just a normal runtime
condition for C++11 and C++14, because it doesn't use if-constexpr. That
means the 1LL << (CHAR_BIT * sizeof(_Atomic_word)) expression expands to
1LL << 64 on Solaris, which is ill-formed.
This adds another indirection so that the shift width is zero if the
code is unreachable.
libstdc++-v3/ChangeLog:
* include/bits/shared_ptr_base.h (_Sp_counted_base::_M_release()):
Make shift width conditional on __double_word condition.