It was pointed out in recent LWG 3545 discussion that having a
constrained partial specialization of std::pointer_traits can cause
ambiguities with program-defined specializations. For example, the
addition to the testcase has:
template<typename P> requires std::derived_from<P, base_type
struct std::pointer_traits<P>;
This would be ambiguous with the library's own constrained partial
specialization:
template<typename Ptr> requires requires { typename Ptr::element_type; }
struct std::pointer_traits<Ptr>;
Neither specialization is more specialized than the other for a type
that is derived from base_type and also has an element_type member.
The solution is to remove the library's partial specialization, and do
the check for Ptr::element_type in the __ptr_traits_elem helper (which
is what we already do for !__cpp_concepts anyway).
libstdc++-v3/ChangeLog:
* include/bits/ptr_traits.h (__ptr_traits_elem) [__cpp_concepts]:
Also define the __ptr_traits_elem class template for the
concepts case.
(pointer_traits<Ptr>): Remove constrained partial
specialization.
* testsuite/20_util/pointer_traits/lwg3545.cc: Check for
ambiguitiy with program-defined partial specialization.
P0482R6, which added char8_t, didn't allow
const char arr[] = u8"howdy";
because it said "Declarations of arrays of char may currently be initialized
with UTF-8 string literals. Under this proposal, such initializations would
become ill-formed." This caused too many issues, so P2513R4 alleviates some
of those compatibility problems. In particular, "Arrays of char or unsigned
char may now be initialized with a UTF-8 string literal." This restriction
has been lifted for initialization only, not implicit conversions. Also,
my reading is that 'signed char' was excluded from the allowable conversions.
This is supposed to be treated as a DR in C++20.
PR c++/106656
gcc/c-family/ChangeLog:
* c-cppbuiltin.cc (c_cpp_builtins): Update value of __cpp_char8_t
for C++20.
gcc/cp/ChangeLog:
* typeck2.cc (array_string_literal_compatible_p): Allow
initializing arrays of char or unsigned char by a UTF-8 string literal.
gcc/testsuite/ChangeLog:
* g++.dg/cpp23/feat-cxx2b.C: Adjust.
* g++.dg/cpp2a/feat-cxx2a.C: Likewise.
* g++.dg/ext/char8_t-feature-test-macro-2.C: Likewise.
* g++.dg/ext/char8_t-init-2.C: Likewise.
* g++.dg/cpp2a/char8_t3.C: New test.
* g++.dg/cpp2a/char8_t4.C: New test.
For [0 = x & MASK], we can determine that x is ~MASK. This is
something we're picking up in DOM thanks to maybe_set_nonzero_bits,
but is something we should handle natively.
This is a good example of how much easier to maintain the range-ops
entries are versus the ad-hoc pattern matching stuff we had to do
before. For the curious, compare the changes to range-op here,
versus maybe_set_nonzero_bits.
I'm leaving the call to maybe_set_nonzero_bits until I can properly
audit it to make sure we're catching it all in range-ops. It won't
hurt, since both set_range_info() and set_nonzero_bits() are
intersect operations, so we'll never lose information if we do both.
PR tree-optimization/107009
gcc/ChangeLog:
* range-op.cc (operator_bitwise_and::op1_range): Optimize 0 = x & MASK.
(range_op_bitwise_and_tests): New test.
Jon reported that evaluating __is_convertible in a test led to
instantiating something ill-formed and so we failed to compile the test.
__is_convertible doesn't and shouldn't need to instantiate so much, so
let's limit it with a cp_unevaluated guard. Use a helper function to
implement both built-ins.
PR c++/106784
gcc/cp/ChangeLog:
* method.cc (is_convertible_helper): New.
(is_convertible): Use it.
(is_nothrow_convertible): Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/ext/is_convertible3.C: New test.
* g++.dg/ext/is_nothrow_convertible3.C: New test.
In r13-2775-g32d8123cd6ce87 I missed that we need to adjust the call to
add_mergeable_specialization in the MK_partial case to correctly handle
variable template partial specializations (it currently assumes we're
always dealing with one for a class template). This fixes an ICE when
converting the testcase from that commit to use an importable header
instead of a named module.
PR c++/107033
gcc/cp/ChangeLog:
* module.cc (trees_in::decl_value): In the MK_partial case for
a variable template partial specialization, pass decl_p=true to
add_mergeable_specialization, and set spec to the VAR_DECL not
the TEMPLATE_DECL.
* pt.cc (add_mergeable_specialization): For a variable template
partial specialization, set the TREE_TYPE of the new
DECL_TEMPLATE_SPECIALIZATIONS node to the TREE_TYPE of the
VAR_DECL not the VAR_DECL itself.
gcc/testsuite/ChangeLog:
* g++.dg/modules/partial-2.cc, g++.dg/modules/partial-2.h: New
files, factored out from ...
* g++.dg/modules/partial-2_a.C, g++.dg/modules/partial-2_b.C: ...
these.
* g++.dg/modules/partial-2_c.H: New test.
* g++.dg/modules/partial-2_d.C: New test.
In the conversion of DOM+evrp to DOM+ranger, we missed that evrp was
exporting ranges for unreachable edges for all SSA names for which we
have ranges for. Instead we have only been exporting ranges for the
SSA name in the final conditional to the BB involving the unreachable
edge.
This patch adjusts adjusts DOM to iterate over the exports, similarly
to what evrp was doing.
Note that I also noticed that we don't calculate the nonzero bit mask
for op1, when 0 = op1 & MASK. This isn't needed for this PR,
since maybe_set_nonzero_bits() is chasing the definition and
parsing the bitwise and on its own. However, I'll be adding the
functionality for completeness sake, plus we could probably drop the
maybe_set_nonzero_bits legacy call entirely.
PR tree-optimization/107009
gcc/ChangeLog:
* tree-ssa-dom.cc
(dom_opt_dom_walker::set_global_ranges_from_unreachable_edges):
Iterate over exports.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/pr107009.c: New test.
... primarily in preparation for later changes.
gcc/
* config.gcc (TM_MULTILIB_CONFIG) [nvptx]: Set to '$with_arch'.
* config/nvptx/t-nvptx (MULTILIB_OPTIONS, MULTILIB_MATCHES)
(MULTILIB_EXCEPTIONS): Handle it.
gcc/
* cfgcleanup.cc (bb_is_just_return): No longer static.
* cfgcleanup.h (bb_is_just_return): Add prototype.
* cfgrtl.cc (fixup_reorder_chain): Do not create an
unconditional jump to a return block. Conditionally
remove unreachable blocks.
gcc/testsuite/
* gcc.target/riscv/ret-1.c: New test.
When using the atomic fast path deregistering can fail during
program shutdown if the lookup structures are already destroyed.
The assert in __deregister_frame_info_bases takes that into
account. In the non-fast-path case however is not aware of
program shutdown, which caused a compiler error on such platforms.
We fix that by introducing a constant for in_shutdown in
non-fast-path builds.
We also drop the destructor priority, as it is not supported on
all platforms and we no longer rely upon the priority anyway.
libgcc/ChangeLog:
* unwind-dw2-fde.c: Introduce a constant for in_shutdown
for the non-fast-path case. Drop destructor priority.
The tree for var == incoming == outgound was
'MEM <double[5]> [(double *)&reduced]' which caused the ICE
"incorrect sharing of tree nodes".
PR middle-end/106982
gcc/ChangeLog:
* omp-low.cc (lower_oacc_reductions): Add some unshare_expr.
gcc/testsuite/ChangeLog:
* c-c++-common/goacc/reduction-7.c: New test.
* c-c++-common/goacc/reduction-8.c: New test.
Since r13-2251-g1930c5d05ceff2, the refactoring is not 1:1 and we end
up with a wrong rtx type.
gcc/ChangeLog:
* config/s390/s390.cc (s390_rtx_costs): Remove dest variable
and use only dst.
This is a straightforward patch that allows targeting the architecture revisions mentioned in the subject
through -march. These are already supported in binutils.
Bootstrapped and tested on aarch64-none-linux-gnu.
gcc/ChangeLog:
* config/aarch64/aarch64-arches.def (armv9.1-a): Define.
(armv9.2-a): Likewise.
(armv9.3-a): Likewise.
* config/aarch64/aarch64.h (AARCH64_FL_V9_1): Likewise.
(AARCH64_FL_V9_2): Likewise.
(AARCH64_FL_V9_3): Likewise.
(AARCH64_FL_FOR_ARCH9_1): Likewise.
(AARCH64_FL_FOR_ARCH9_2): Likewise.
(AARCH64_FL_FOR_ARCH9_3): Likewise.
(AARCH64_ISA_V9_1): Likewise.
(AARCH64_ISA_V9_2): Likewise.
(AARCH64_ISA_V9_3): Likewise.
* doc/invoke.texi (AArch64 Options): Document armv9.1-a, armv9.2-a,
armv9.3-a values to -march.
This renaming happened some time ago in the code, but the documentation
was not updated.
gcc/ada/
* doc/gnat_rm/implementation_defined_attributes.rst: Rename Valid_Image.
* gnat_rm.texi: Regenerate.
* gnat_ugn.texi: Regenerate.
This patch fixes an AST anomaly where pragmas that correspond to aspects
of a generic package declaration appeared as the auxiliary declarations
of the compilation unit for the instantiated package body.
In particular, this anomaly happened for aspect Annotate and affected
GNATprove, which didn't pick pragma corresponding to this aspect.
gcc/ada/
* sem_ch12.adb (Build_Instance_Compilation_Unit_Nodes): Relocate
auxiliary declarations from the original compilation unit to the
newly created compilation unit for the spec.
Remove unreferenced entries for finding runtime units and runtime
entities by the compiler. Code cleanup using basic grep scripting.
gcc/ada/
* rtsfind.ads
(RTU_Id): Remove unreferenced packages; fix whitespace.
(RE_Id): Remove unreferenced entities; add comment about entity
that is only used by GNATprove and not by GNAT.
The STR/STR1 macros in OS constants template has been unreferenced since
2005, so we can safely remove them.
gcc/ada/
* s-oscons-tmplt.c (STR, STR1): Remove.
This was overlooked when the new parameter was created.
gcc/ada/
* doc/gnat_ugn/building_executable_programs_with_gnat.rst
(-gnateT): Document new parameter Long_Long_Long_Size.
* gnat_ugn.texi: Regenerate.
Binder-generated code is not allowed to use Ada2012 syntax. In order to
specify an aspect, a pragma must be used.
gcc/ada/
* bindgen.adb: When the binder is invoked for the device, specify
the CUDA_Global aspect for the adainit and adafinal procedures via
a pragma instead of via an aspect_specification.
gcc/ada/
* doc/gnat_ugn/building_executable_programs_with_gnat.rst
(Linker Switches): Document support for mold along with gold; add some
advice regarding OpenSSL in the Pro version.
* gnat_ugn.texi: Regenerate.
This commit makes Original_Aspect_Pragma_Name more precise in cases
where there is a second level of indirection caused by pragmas being
turned into Check pragmas.
gcc/ada/
* sem_util.adb (Original_Aspect_Pragma_Name): Check for Check
pragmas.
When preanalysing spec expression (e.g. expression of an expression
function), the name of iterator specification should not be expanded.
This patch simplifies a complicated condition for delaying expansion
within quantified expressions and iterated component associations.
gcc/ada/
* sem_ch5.adb (Analyze_Iterator_Specification): Delay expansion
based on Full_Analysis flag.
When preanalysing spec expression (e.g. expression of an expression
function), the name of iterator specification within an iterated
component association should not be expanded, especially in GNATprove
mode.
gcc/ada/
* sem_ch5.adb (Analyze_Iterator_Specification): Delay expansion of
for iterated component association just like it is done within
quantified expression.
SPARK rule that forbids ghost volatile objects is only affecting proof
and not generation of object code. It is now only applied where SPARK_Mode
is On. This flexibility is needed to compile code automatically instrumented
by GNATcoverage.
gcc/ada/
* contracts.adb (Analyze_Object_Contract): Check SPARK_Mode before
applying SPARK rule.
Improve accessibility check generation by more precisely identifying cases in
which an Original_Node call is needed.
Instead of grabbing the Original_Node of a prefix in all cases (since this
can cause issues where unanalyzed instance names get referenced) we only
obtain the original node when said prefix comes as a result of expanding
function calls.
gcc/ada/
* sem_util.adb
(Accessibility_Level): Modify indexed and selected components case
by reducing the scope where Original_Node gets used.
Modern MinGW defines _WIN32_WINNT as 0xa00, so there is no need go guard
against it being lower than 0x0600 or setting it to 0x0501.
gcc/ada/
* gsocket.h: Remove redefinition of _WIN32_WINNT.
* mingw32.h: Remove conditional definition of _WIN32_WINNT.
Modern MinGW defines MAXPATHLEN in sys/param.h, so better to use it
directly.
gcc/ada/
* mingw32.h: Remove condition definition of MAXPATHLEN; the include
directive for stdlib.h was most likely intended to provide the
MAX_PATH.
Remove conditional C code for building GNAT with MinGW earlier than 2.0,
which was released in 2007.
gcc/ada/
* adaint.c: Remove conditional #include directives for old MinGW.
* cal.c: Always include winsock.h, since it is part of modern
MinGW.
* cstreams.c: Remove workaround for old MinGW.
* expect.c: Remove conditional #include directive for old MinGW.
* mingw32.h: Remove STD_MINGW and OLD_MINGW declarations.
* sysdep.c: Remove conditional #include directive for old MinGW.
As PR96072 shows, the code adding REG_CFA_DEF_CFA reg note
makes one assumption that we have emitted one insn which
restores the frame pointer previously. That part of code
was guarded with flag frame_pointer_needed before, it was
consistent, but it was replaced with flag
frame_pointer_needed_indeed since commit r10-7981. It
caused ICE due to unexpected NULL insn.
PR target/96072
gcc/ChangeLog:
* config/rs6000/rs6000-logue.cc (rs6000_emit_epilogue): Update the
condition for adding REG_CFA_DEF_CFA reg note with
frame_pointer_needed_indeed.
gcc/testsuite/ChangeLog:
* gcc.target/powerpc/pr96072.c: New test.
PR100645 exposes one latent bug in define_expand vec_shr_<mode>
that the current condition TARGET_ALTIVEC is too loose. The
mode iterator VEC_L contains a few modes, they are not always
supported as vector mode, VECTOR_UNIT_ALTIVEC_OR_VSX_P should
be used like some other VEC_L usages.
PR target/100645
gcc/ChangeLog:
* config/rs6000/vector.md (vec_shr_<mode>): Replace condition
TARGET_ALTIVEC with VECTOR_UNIT_ALTIVEC_OR_VSX_P.
gcc/testsuite/ChangeLog:
* gcc.target/powerpc/pr100645.c: New test.
2022-09-23 Hongtao Liu <hongtao.liu@intel.com>
Liwei Xu <liwei.xu@intel.com>
gcc/ChangeLog:
PR target/53346
* config/i386/i386-expand.cc (expand_vec_perm_shufps_shufps):
New function.
(ix86_expand_vec_perm_const_1): Insert
expand_vec_perm_shufps_shufps at the end of 2-instruction
expand sequence.
gcc/testsuite/ChangeLog:
* gcc.target/i386/pr53346-1.c: New test.
* gcc.target/i386/pr53346-2.c: New test.
* gcc.target/i386/pr53346-3.c: New test.
* gcc.target/i386/pr53346-4.c: New test.
This adds support for clobbering of non-polymorphic derived type
variables, when they are passed as actual argument whose associated
dummy has the INTENT(OUT) attribute.
We avoid to play with non-constant type sizes or class descriptors by
requiring that the types are derived (not class) and strictly matching,
and by excluding parameterized derived types.
Types that are used in the callee are also excluded: they are types with
allocatable components (the components will be deallocated), and
finalizable types or types with finalizable components (they will be
passed to finalization routines).
PR fortran/41453
gcc/fortran/ChangeLog:
* trans-expr.cc (gfc_conv_procedure_call): Allow strictly
matching derived types.
gcc/testsuite/ChangeLog:
* gfortran.dg/intent_optimize_10.f90: New test.
This adds support for clobbering of allocatable and pointer scalar
variables passed as actual argument to a subroutine when the associated
dummy has the INTENT(OUT) attribute.
Support was explicitly disabled (since the beginning for pointers, since
r11-7315-g2df374b337a5f6cf5528e91718e4e12e4006b7ae for allocatables),
but the clobber generation code seems to support it well, as
demonstrated by the newly added testcase.
PR fortran/41453
PR fortran/99169
gcc/fortran/ChangeLog:
* trans-expr.cc (gfc_conv_procedure_call): Remove conditions
on ALLOCATABLE and POINTER attributes guarding clobber
generation.
gcc/testsuite/ChangeLog:
* gfortran.dg/intent_optimize_9.f90: New test.
This is in spirit a revert of:
r9-3051-gc109362313623d83fe0a5194bceaf994cf0c6ce0
That commit added a condition to avoid generating ICE with clobbers
of ASSOCIATE variables.
The test added at that point continues to pass if we remove that
condition now.
PR fortran/41453
PR fortran/87401
gcc/fortran/ChangeLog:
* trans-expr.cc (gfc_conv_procedure_call): Remove condition
disabling clobber generation for ASSOCIATE variables.
gcc/testsuite/ChangeLog:
* gfortran.dg/intent_optimize_8.f90: New test.
This removes a condition added in:
r9-3032-gee7fb0588c6361b4d77337ab0f7527be64fcdde2.
That commit added a condition to avoid generating ICE with clobbers
of variables with the SAVE attribute.
The test added at that point continues to pass if we remove that
condition now.
PR fortran/41453
PR fortran/87395
gcc/fortran/ChangeLog:
* trans-expr.cc (gfc_conv_procedure_call): Remove condition
on SAVE attribute guarding clobber generation.
gcc/testsuite/ChangeLog:
* gfortran.dg/intent_optimize_7.f90: New test.
This adds support for clobbering of variables passed by reference,
when the reference is forwarded to a subroutine as actual argument
whose associated dummy has the INTENT(OUT) attribute.
This was explicitly disabled by a condition added with
r9-3032-gee7fb0588c6361b4d77337ab0f7527be64fcdde2 and removing that
condition seems to work, as demonstrated by the new testcase.
PR fortran/41453
PR fortran/87395
gcc/fortran/ChangeLog:
* trans-expr.cc (gfc_conv_procedure_call): Remove condition
disabling clobber generation for dummy variables. Remove
obsolete comment.
gcc/testsuite/ChangeLog:
* gfortran.dg/intent_optimize_6.f90: New test.
Before procedure calls, we clobber actual arguments whose associated
dummy is INTENT(OUT). This only applies to procedures with explicit
interfaces, as the knowledge of the interface is necessary to know
whether an argument has the INTENT(OUT) attribute.
This change also enables clobber generation for procedure calls without
explicit interface, when the procedure has been defined in the same
file because we can use the dummy arguments' characteristics from the
procedure definition in that case.
The knowledge of the dummy characteristics is directly available through
gfc_actual_arglist’s associated_dummy pointers which have been populated
as a side effect of calling gfc_check_externals.
PR fortran/105012
gcc/fortran/ChangeLog:
* trans-expr.cc (gfc_conv_procedure_call): Use dummy
information from associated_dummy if there is no information
from the procedure interface.
gcc/testsuite/ChangeLog:
* gfortran.dg/intent_optimize_5.f90: New test.
Co-Authored-By: Mikael Morin <mikael@gcc.gnu.org>
For actual arguments whose dummy is INTENT(OUT), we used to generate
clobbers on them at the same time we generated the argument reference
for the function call. This was wrong if for an argument coming
later, the value expression was depending on the value of the just-
clobbered argument, and we passed an undefined value in that case.
With this change, clobbers are collected separatedly and appended
to the procedure call preliminary code after all the arguments have been
evaluated.
PR fortran/106817
gcc/fortran/ChangeLog:
* trans-expr.cc (gfc_conv_procedure_call): Collect all clobbers
to their own separate block. Append the block of clobbers to
the procedure preliminary block after the argument evaluation
codes for all the arguments.
gcc/testsuite/ChangeLog:
* gfortran.dg/intent_optimize_4.f90: New test.