The recent changes to add assertions to std::array broke the functions
that need to be constexpr in C++11, because of the restrictive rules for
constexpr functions in C++11.
This simply disables the assertions for C++11 mode, so the functions can
be constexpr again.
libstdc++-v3/ChangeLog:
* include/std/array (array::operator[](size_t) const, array::front() const)
(array::back() const) [__cplusplus == 201103]: Disable
assertions.
* testsuite/23_containers/array/element_access/constexpr_element_access.cc:
Check for correct values.
* testsuite/23_containers/array/tuple_interface/get_neg.cc:
Adjust dg-error line numbers.
* testsuite/23_containers/array/debug/constexpr_c++11.cc: New test.
This patch makes a couple of type-creation routines available to
modules. That needs to create unbound template parms, and canonical
template parms.
gcc/cp/
* cp-tree.h (make_unbound_class_template_raw): Declare.
(canonical_type_parameter): Declare.
* decl.c (make_unbound_class_template_raw): Break out of ...
(make_unboud_class_template): ... here. Call it.
* pt.c (canonical_type_parameter): Externalize. Refactor & set
structural_equality for type parms.
ix86_md_asm_adjust assumes that dest_mode can be only [QHSD]Imode
and nothing else. The patch rewrites zero-extension part to use
convert_to_mode to handle TImode and hypothetically even wider modes.
2020-12-03 Uroš Bizjak <ubizjak@gmail.com>
Jakub Jelinek <jakub@redhat.com>
gcc/
PR target/98086
* config/i386/i386.c (ix86_md_asm_adjustmd): Rewrite
zero-extension part to use convert_to_mode.
gcc/testsuite/
PR target/98086
* gcc.target/i386/pr98086.c: New test.
These two testcases provide coverage for 98115, which doesn't trigger on all hosts.
PR c++/98115
PR c++/98116
gcc/testsuite/
* g++.dg/template/pr98115.C: New.
* g++.dg/template/pr98116.C: New.
Go used to use slightly different semantics than C99 for complex division,
so we used runtime routines to handle the different. The gc compiler
has changes its behavior to match C99, so changes ours as well.
For golang/go#14644
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/274213
The probe pattern uses Pmode but the middle-end wants to emit a
word_mode probe check. This - as usual - breaks on Z with -m31
-mzarch were word_mode doesn't match Pmode.
gcc/ChangeLog:
* config/s390/s390.md ("@probe_stack2<mode>"): Change mode
iterator to W.
gcc/testsuite/ChangeLog:
* gcc.target/s390/stack-clash-4.c: New test.
I'd missed some paths through build_cplus_array_type, plus, some
arrays come via the C-type builder. This propagates dependency in
more places and asserts that in the cases where TYPE_DEPENDENT_P_VALID
is unset, the type is non-dependent.
PR c++/98107
gcc/cp/
* tree.c (build_cplus_array_type): Mark dependency of new variant.
(cp_build_qualified_type_real, strip_typedefs): Assert
TYPE_DEPENDENT_P_VALID, or not a dependent type.
As the testcase shows, folding svundef*() at the gimple level
has the unfortunate side-effect of introducing -Wuninitialized
or -Wmaybe-uninitialized warnings. We don't have a testcase
that relies on the fold, so the easiest fix seems to be to
remove it.
gcc/
* config/aarch64/aarch64-sve-builtins-base.cc (svundef_impl::fold):
Delete.
gcc/testsuite/
* gcc.target/aarch64/sve/acle/general/undef_1.c: New test.
this replaces the ICE by a sorry message for the use of reverse scalar
storage order with 128-bit decimal floating-point type on 32-bit targets.
gcc/ChangeLog:
PR middle-end/98099
* expmed.c (flip_storage_order): In the case of a non-integer mode,
sorry out if the integer mode to be used instead is not supported.
gcc/testsuite/ChangeLog:
* gcc.dg/pr98099.c: New test.
this fixes an ICE introduced by the fix for PR middle-end/97078 where
use_register_for_decl was changed to return true at -O0 for a parameter
of a thunk. It turns out that we need to do the same for a result in
this case.
gcc/ChangeLog:
PR middle-end/98082
* function.c (use_register_for_decl): Also return true for a result
if cfun->tail_call_marked is true.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/pr98082.C: New test.
The following patch adds __builtin_bit_cast builtin, similarly to
clang or MSVC which implement std::bit_cast using such an builtin too.
It checks the various std::bit_cast requirements, when not constexpr
evaluated acts pretty much like VIEW_CONVERT_EXPR of the source argument
to the destination type and the hardest part is obviously the constexpr
evaluation.
I've left out PDP11 handling of those, couldn't figure out how exactly are
bitfields laid out there
2020-12-03 Jakub Jelinek <jakub@redhat.com>
PR libstdc++/93121
* fold-const.h (native_encode_initializer): Add mask argument
defaulted to nullptr.
(find_bitfield_repr_type): Declare.
(native_interpret_aggregate): Declare.
* fold-const.c (find_bitfield_repr_type): New function.
(native_encode_initializer): Add mask argument and support for
filling it. Handle also some bitfields without integral
DECL_BIT_FIELD_REPRESENTATIVE.
(native_interpret_aggregate): New function.
* gimple-fold.h (clear_type_padding_in_mask): Declare.
* gimple-fold.c (struct clear_padding_struct): Add clear_in_mask
member.
(clear_padding_flush): Handle buf->clear_in_mask.
(clear_padding_union): Copy clear_in_mask. Don't error if
buf->clear_in_mask is set.
(clear_padding_type): Don't error if buf->clear_in_mask is set.
(clear_type_padding_in_mask): New function.
(gimple_fold_builtin_clear_padding): Set buf.clear_in_mask to false.
* doc/extend.texi (__builtin_bit_cast): Document.
* c-common.h (enum rid): Add RID_BUILTIN_BIT_CAST.
* c-common.c (c_common_reswords): Add __builtin_bit_cast.
* cp-tree.h (cp_build_bit_cast): Declare.
* cp-tree.def (BIT_CAST_EXPR): New tree code.
* cp-objcp-common.c (names_builtin_p): Handle RID_BUILTIN_BIT_CAST.
(cp_common_init_ts): Handle BIT_CAST_EXPR.
* cxx-pretty-print.c (cxx_pretty_printer::postfix_expression):
Likewise.
* parser.c (cp_parser_postfix_expression): Handle
RID_BUILTIN_BIT_CAST.
* semantics.c (cp_build_bit_cast): New function.
* tree.c (cp_tree_equal): Handle BIT_CAST_EXPR.
(cp_walk_subtrees): Likewise.
* pt.c (tsubst_copy): Likewise.
* constexpr.c (check_bit_cast_type, cxx_eval_bit_cast): New functions.
(cxx_eval_constant_expression): Handle BIT_CAST_EXPR.
(potential_constant_expression_1): Likewise.
* cp-gimplify.c (cp_genericize_r): Likewise.
* g++.dg/cpp2a/bit-cast1.C: New test.
* g++.dg/cpp2a/bit-cast2.C: New test.
* g++.dg/cpp2a/bit-cast3.C: New test.
* g++.dg/cpp2a/bit-cast4.C: New test.
* g++.dg/cpp2a/bit-cast5.C: New test.
We weren't recognizing a default argument for a consteval member function as
being in immediate function context because there was no function parameter
scope to look at.
The following testcase is an attempt to test it with templates, both
non-dependent and dependent consteval calls in both function and class
templates, and with r11-5694 it now passes.
2020-12-03 Jakub Jelinek <jakub@redhat.com>
* g++.dg/cpp2a/consteval-defarg2.C: New test.
This is the same as commit 70a6200918 ("tree-ssa-threadbackward.c
(profitable_jump_thread_path): Do not allow __builtin_constant_p."), but
for the old forward threader.
gcc/ChangeLog:
2020-12-03 Ilya Leoshkevich <iii@linux.ibm.com>
* tree-ssa-threadedge.c (record_temporary_equivalences_from_stmts_at_dest):
Do not allow __builtin_constant_p on a threading path.
- We would like to canonicalize the arch string for --with-arch for
easier handling multilib, so split canonicalization part to a stand
along script to shared the logic.
gcc/ChangeLog:
* config/riscv/multilib-generator (arch_canonicalize): Move
code to arch-canonicalize, and call that script to canonicalize arch
string.
(canonical_order): Move code to arch-canonicalize.
(LONG_EXT_PREFIXES): Ditto.
(IMPLIED_EXT): Ditto.
* config/riscv/arch-canonicalize: New.
* config.gcc (riscv*-*-*): Canonicalize --with-arch.
New +flagm (Condition flag manipulation) feature option for -march command line
option.
Please note that FLAGM stays a Armv8.4-A feature but now can be
assigned to other architectures or CPUs.
gcc/ChangeLog:
* config/aarch64/aarch64-option-extensions.def
(AARCH64_OPT_EXTENSION): New +flagm option in -march for AArch64.
* config/aarch64/aarch64.h (AARCH64_FL_FLAGM): Add new flagm extension bit
mask.
(AARCH64_FL_FOR_ARCH8_4): Add flagm to Armv8.4-A.
* doc/invoke.texi: Update docs with +flagm.
This testcase got broken with r11-3826 and got fixed with r11-5628.
2020-12-03 Jakub Jelinek <jakub@redhat.com>
PR c++/98104
* g++.dg/warn/pr98104.C: New test.
For signed comparisons, it handles cases that are eq or neq to 0.
For unsigned comparisons, it additionaly handles cases that are le or
gt to 0(equivilent to eq or neq to 0). Transform case eq to leu,
case neq to gtu.
.i.e. for -mavx512bw -mavx512vl transform eq case code from
vpsubusw %xmm1, %xmm0, %xmm0
vpxor %xmm1, %xmm1, %xmm1
vpcmpeqw %xmm1, %xmm0, %k0
to
vpcmpleuw %xmm1, %xmm0, %k0
.i.e. for -mavx512bw -mavx512vl transform neq case code from
vpsubusw %xmm1, %xmm0, %xmm0
vpxor %xmm1, %xmm1, %xmm1
vpcmpneqw %xmm1, %xmm0, %k0
to
vpcmpnleuw %xmm1, %xmm0, %k0
gcc/ChangeLog
PR target/96906
* config/i386/sse.md
(<avx512>_ucmp<mode>3<mask_scalar_merge_name>): Add a new
define_split after this insn.
gcc/testsuite/ChangeLog
* gcc.target/i386/avx512bw-pr96906-1.c: New test.
* gcc.target/i386/pr96906-1.c: Add -mno-avx512f.
gcc/ChangeLog:
PR target/97642
* config/i386/i386-expand.c
(ix86_expand_special_args_builtin): Don't move all-ones mask
operands into register.
* config/i386/sse.md (UNSPEC_MASKLOAD): New unspec.
(*<avx512>_load<mode>_mask): New define_insns for masked load
instructions.
(<avx512>_load<mode>_mask): Changed to define_expands which
specifically handle memory or all-ones mask operands.
(<avx512>_blendm<mode>): Changed to define_insns which are same
as original <avx512>_load<mode>_mask with adjustment of
operands order.
(*<avx512>_load<mode>): New define_insn_and_split which is
used to optimize for masked load with all one mask.
gcc/testsuite/ChangeLog:
* gcc.target/i386/avx512bw-vmovdqu16-1.c: Adjust testcase to
make sure only masked load instruction is generated.
* gcc.target/i386/avx512bw-vmovdqu8-1.c: Ditto.
* gcc.target/i386/avx512f-vmovapd-1.c: Ditto.
* gcc.target/i386/avx512f-vmovaps-1.c: Ditto.
* gcc.target/i386/avx512f-vmovdqa32-1.c: Ditto.
* gcc.target/i386/avx512f-vmovdqa64-1.c: Ditto.
* gcc.target/i386/avx512vl-vmovapd-1.c: Ditto.
* gcc.target/i386/avx512vl-vmovaps-1.c: Ditto.
* gcc.target/i386/avx512vl-vmovdqa32-1.c: Ditto.
* gcc.target/i386/avx512vl-vmovdqa64-1.c: Ditto.
* gcc.target/i386/pr97642-1.c: New test.
* gcc.target/i386/pr97642-2.c: New test.
In this testcase we weren't catching the error in A::f because the parameter
'I' wasn't in scope, so the default argument for 'b' found the global
typedef I. Fixed by pushing the parms before parsing. This is a bit
complicated because pushdecl clears DECL_CHAIN; do_push_parm_decls deals
with this by nreversing first, but that doesn't work here because we only
want to push them one at a time; if we pushed all of them before parsing,
we'd wrongly reject A::g.
gcc/cp/ChangeLog:
* parser.c (cp_parser_primary_expression): Distinguish
parms from vars in error.
(cp_parser_late_parsing_default_args): Pushdecl parms
as we go.
gcc/testsuite/ChangeLog:
* g++.dg/parse/defarg17.C: New test.
Jakub noticed that we weren't recognizing a default argument for a consteval
member function as being in immediate function context because there was no
function parameter scope to look at.
Note that this patch doesn't actually push the parameters into the scope,
that happens in a separate commit.
gcc/cp/ChangeLog:
* name-lookup.c (begin_scope): Set immediate_fn_ctx_p.
* parser.c (cp_parser_late_parsing_default_args): Push
sk_function_parms scope.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/consteval-defarg1.C: New test.
This patch introduces maybe_emit_call_builtin___clear_cache for the
builtin expander machinery and the trampoline initializers to use to
clear the instruction cache, removing a source of inconsistencies and
subtle errors in low-level machinery.
I've adjusted all trampoline_init implementations that used to issue
explicit calls to __clear_cache or similar to use this new primitive.
Specifically on vxworks targets, we needed to drop the __clear_cache
symbol in libgcc, for reasons related with linking that I didn't need
to understand, and we wanted to call cacheTextUpdate directly, despite
the different calling conventions: the second argument is a length
rather than the end address.
So I introduced a target hook to enable target OS-level overriding of
builtin __clear_cache call emission, retaining nearly (*) the same
logic to govern the decision on whether to emit a call (or nothing, or
a machine-dependent insn) but enabling a call to a target
system-defined function with different calling conventions to be
issued, without having to modify .md files of the various
architectures supported by the target system to introduce or modify
clear_cache insns.
(*) I write "nearly" mainly because, when not optimizing, we'd issue a
call regardless, but since the call may now be overridden, I added it
to the set of builtins that are not directly turned into calls when
not optimizing, following the normal expansion path instead. It
wouldn't be hard to skip the emission of cache-clearing insns when not
optimizing, but it didn't seem very important, especially for the new
uses from trampoline init.
Another difference that might be relevant is that now we expand
the begin and end arguments unconditionally. This might make a
difference if they have side effects. That's prettty much impossible
at expand time, but I thought I'd mention it.
I have NOT modified targets that did not issue cache-clearing calls in
trampoline init to use the new clear_cache-calling infrastructure even
if it would expand to nothing. I have considered doing so, to have
__builtin___clear_cache and trampoline init call cacheTextUpdate on
all vxworks targets, but decided not to, since on targets that don't
do any cache clearing, cacheTextUpdate ought to be a no-op, even
though rs6000 seems to use icbi and dcbf instructions in the function
called to initialize a trampoline, but AFAICT not in the __clear_cache
builtin. Hopefully target maintainers will have a look and take
advantage of this new piece of infrastructure to remove such
(apparent?) inconsistencies. Not rs6000 and other that call asm-coded
trampoline setup instructions, for sure, but they might wish to
introduce a CLEAR_INSN_CACHE macro or a clear_cache expander if they
don't have one.
for gcc/ChangeLog
* builtins.c (default_emit_call_builtin___clear_cache): New.
(maybe_emit_call_builtin___clear_cache): New.
(expand_builtin___clear_cache): Split into the above.
(expand_builtin): Do not issue clear_cache call any more.
* builtins.h (maybe_emit_call_builtin___clear_cache): Declare.
* config/aarch64/aarch64.c (aarch64_trampoline_init): Use
maybe_emit_call_builtin___clear_cache.
* config/arc/arc.c (arc_trampoline_init): Likewise.
* config/arm/arm.c (arm_trampoline_init): Likewise.
* config/c6x/c6x.c (c6x_initialize_trampoline): Likewise.
* config/csky/csky.c (csky_trampoline_init): Likewise.
* config/m68k/linux.h (FInALIZE_TRAMPOLINE): Likewise.
* config/tilegx/tilegx.c (tilegx_trampoline_init): Likewise.
* config/tilepro/tilepro.c (tilepro_trampoline_init): Ditto.
* config/vxworks.c: Include rtl.h, memmodel.h, and optabs.h.
(vxworks_emit_call_builtin___clear_cache): New.
* config/vxworks.h (CLEAR_INSN_CACHE): Drop.
(TARGET_EMIT_CALL_BUILTIN___CLEAR_CACHE): Define.
* target.def (trampoline_init): In the documentation, refer to
maybe_emit_call_builtin___clear_cache.
(emit_call_builtin___clear_cache): New.
* doc/tm.texi.in: Add new hook point.
(CLEAR_CACHE_INSN): Remove duplicate 'both'.
* doc/tm.texi: Rebuilt.
* targhooks.h (default_meit_call_builtin___clear_cache):
Declare.
* tree.h (BUILTIN_ASM_NAME_PTR): New.
for libgcc/ChangeLog
* config/t-vxworks (LIB2ADD): Drop.
* config/t-vxworks7 (LIB2ADD): Likewise.
* config/vxcache.c: Remove.
There's a help.exp test that checks that the help message for
-Wabsolute-value mentions it's available in C and ObjC, when compiling
a C++ program.
However, if GCC is built with the C++ language disabled, the
.cc file is compiled as C, and the message [available in C...] becomes
[disabled] instead, because that's the default for the flag in C.
I suppose it might also be possible to disable the C language, and
then the multitude of help.exp tests that name c as the source
language will fail.
This patch avoids these fails: it detects the message "compiler not
installed" in the compiler output, and bails out as "unsupported".
for gcc/testsuite/ChangeLog
* lib/options.exp (check_for_options_with_filter): Detect
unavailable compiler for the selected language, and bail out
as unsupported.
Linux Kernel (specifically, drivers/leds/trigger/ledtrig-cpu.c) build
with GCC 10 fails on s390 with "impossible constraint".
Explanation by Jeff Law:
```
So what we have is a b_c_p at the start of an if-else chain. Subsequent
tests on the "true" arm of the the b_c_p test may throw us off the
constant path (because the constants are out of range). Once all the
tests are passed (it's constant and the constant is in range) the true
arm's terminal block has a special asm that requires a constant
argument. In the case where we get to the terminal block on the true
arm, the argument to the b_c_p is used as the constant argument to the
special asm.
At first glace jump threading seems to be doing the right thing. Except
that we end up with two paths to that terminal block with the special
asm, one for each of the two constant arguments to the b_c_p call.
Naturally since that same value is used in the asm, we have to introduce
a PHI to select between them at the head of the terminal block. Now
the argument in the asm is no longer constant and boom we fail.
```
Fix by disallowing __builtin_constant_p on threading paths.
gcc/ChangeLog:
2020-06-03 Ilya Leoshkevich <iii@linux.ibm.com>
* tree-ssa-threadbackward.c (thread_jumps::profitable_jump_thread_path):
Do not allow __builtin_constant_p on a threading path.
gcc/testsuite/ChangeLog:
2020-06-03 Ilya Leoshkevich <iii@linux.ibm.com>
* gcc.target/s390/builtin-constant-p-threading.c: New test.
MODE_OPAQUE and the associated OPAQUE_TYPE were added to stop the optimizers
from knowing how the bits in a variable with an opaque type are laid out.
This makes them a kind of pseudo aggregate type and we need to treat them
as such when we process the INIT initializer for variables with an
opaque type.
2020-12-02 Peter Bergner <bergner@linux.ibm.com>
gcc/cp/
PR c++/97947
* typeck2.c (digest_init_r): Handle OPAQUE_TYPE as an aggregate type.
gcc/testsuite/
PR c++/97947
* g++.target/powerpc/pr97947.C: New test.
As discussed in https://sourceware.org/bugzilla/show_bug.cgi?id=26987 ,
for very large bounds (which don't fit into HOST_WIDE_INT) GCC emits invalid
DWARF.
In DWARF2, DW_AT_{lower,upper}_bound were constant reference class.
In DWARF3 they are block constant reference and the
Static and Dynamic Properties of Types
chapter says:
"For a block, the value is interpreted as a DWARF expression; evaluation of the expression
yields the value of the attribute."
In DWARF4/5 they are constant exprloc reference class.
Now, for add_AT_wide we use DW_FORM_data16 (valid in constant class)
when -gdwarf-5, but otherwise just use DW_FORM_block1, which is not constant
class, but block.
For DWARF3 this means emitting clearly invalid DWARF, because the
DW_FORM_block1 should contain a DWARF expression, not random bytes
containing the constant directly.
For DWARF2/DWARF4/5 it could be considered a GNU extension, but a very badly
designed one when it means something different in DWARF3.
The following patch uses add_AT_wide only if we know we'll be using
DW_FORM_data16, and otherwise wastes 2 extra bytes and emits in there
DW_OP_implicit_value <size> before the constant.
2020-12-03 Jakub Jelinek <jakub@redhat.com>
* dwarf2out.c (add_scalar_info): Only use add_AT_wide for 128-bit
constants and only in dwarf-5 or later, where DW_FORM_data16 is
available. Otherwise use DW_FORM_block*/DW_FORM_exprloc with
DW_OP_implicit_value to describe the constant.
While std::source_location::current () is static consteval source_location
current() noexcept; in the standard, it also says with LWG3396:
"Any call to current that appears as a default member initializer
([class.mem]), or as a subexpression thereof, should correspond to the
location of the constructor definition or aggregate initialization that uses
the default member initializer. Any call to current that appears as a
default argument ([dcl.fct.default]), or as a subexpression thereof, should
correspond to the location of the invocation of the function that uses the
default argument ([expr.call])."
so it must work as compiler magic rather than normal immediate functions,
in particular we need to defer its evaluation when parsing default arguments
or nsdmis.
This patch actually defers evaluation of all the calls to
std::source_location::current () until genericization (or constant expression
evaluation when called from constant expression contexts).
I had to change constexpr.c too so that it temporarily adjusts
current_function_decl from the constexpr evaluation context, but we do the
same already from __builtin_FUNCTION ().
2020-12-03 Jakub Jelinek <jakub@redhat.com>
PR c++/80780
PR c++/93093
* cp-tree.h (source_location_current_p): Declare.
* tree.c (source_location_current_p): New function.
* call.c (immediate_invocation_p): New function.
(build_over_call): Use it to resolve LWG3396.
* constexpr.c (cxx_eval_builtin_function_call): Temporarily set
current_function_decl from ctx->call->fundef->decl if any.
* cp-gimplify.c (cp_genericize_r) <case CALL_EXPR>: Fold calls
to immediate function std::source_location::current ().
* g++.dg/cpp2a/srcloc15.C: New test.
* g++.dg/cpp2a/srcloc16.C: New test.
* g++.dg/cpp2a/srcloc17.C: New test.
* g++.dg/cpp2a/srcloc18.C: New test.
reg-stack pass does not maintain the data flow information correctly.
call df_insn_rescan_all after the transformation is done.
gcc/
PR rtl-optimization/97777
* reg-stack.c (rest_of_handle_stack_regs): call
df_insn_rescan_all if reg_to_stack return true.
gcc/testsuite/
PR rtl-optimization/97777
* gcc.target/i386/pr97777.c: New test.
This fixes errors seen on powerpc64 (big endian only) due to the
printers for std::any and std::experimental::any being unable to find
the manager function.
libstdc++-v3/ChangeLog:
PR libstdc++/65480
PR libstdc++/68735
* python/libstdcxx/v6/printers.py (function_pointer_to_name):
New helper function to get the name of a function from its
address.
(StdExpAnyPrinter.__init__): Use it.
We were saying 'auto parameter not permitted' in a place where 'auto' is in
fact permitted in C++20, but a class template placeholder is not.
gcc/cp/ChangeLog:
* decl.c (grokdeclarator): Improve diagnostic for
disallowed CTAD placeholder.
gcc/testsuite/ChangeLog:
* g++.dg/other/pr88187.C: Adjust expected error.
* g++.dg/cpp2a/class-deduction-abbrev1.C: New test.
While looking at another issue I noticed that in a template we were failing
to find the INIT_EXPR we were looking for, and so ended up doing redundant
processing. No testcase, as the redundant processing ended up getting the
right result.
gcc/cp/ChangeLog:
* decl.c (check_initializer): Also look through STMT_EXPR
and BIND_EXPR.
For modules we need to compare structurally all the way down. This
means inhibiting typename_type resolution, independent of comparing
specializations.
gcc/cp/
* cp-tree.h (comparing_typenames): Declare.
* pt.c (comparing_typenames): Define.
(spec_hasher::equal): Increment it around comparisons.
* typeck.c (structural_comptypes): Adjust TYPENAME resolution
check.
I've been using
git send-email --annotate --suppress-from --to=gcc-patches@gcc.gnu.org \
${@:-HEAD^} ':!*/ChangeLog' ':!*configure'
for sending most patches, but it occurs to me that it would be useful to put
the To: address in the configury.
If someone were feeling ambitious, they could write a script to analyze a
patch and add the relevant maintainers to To: or CC:.
contrib/ChangeLog:
* gcc-git-customization.sh: Configure sendemail.to.
In this test, we have
static inline const int c = b;
in a class template, and we call store_init_value as usual. There, the
value is
IMPLICIT_CONV_EXPR<const float>(b)
which is is_nondependent_static_init_expression but isn't
is_nondependent_constant_expression (they only differ in STRICT).
We call fold_non_dependent_expr, but that just returns the expression
because it only instantiates is_nondependent_constant_expression
expressions. Since we're not checking the initializer of a constexpr
variable, we go on to call maybe_constant_init, whereupon we crash
because it tries to evaluate all is_nondependent_static_init_expression
expressions, which our value is, but it still contains a template code.
I think the fix is to call fold_non_dependent_init instead of
maybe_constant_init, and only call fold_non_dependent_expr on the
"this is a constexpr variable" path so as to avoid instantiating twice
in a row. Outside a template this should also avoid evaluating the
value twice.
gcc/cp/ChangeLog:
PR c++/97975
* constexpr.c (fold_non_dependent_init): Add a tree parameter.
Use it.
* cp-tree.h (fold_non_dependent_init): Add a tree parameter with
a default value.
* typeck2.c (store_init_value): Call fold_non_dependent_expr
only when checking the initializer for constexpr variables.
Call fold_non_dependent_init instead of maybe_constant_init.
gcc/testsuite/ChangeLog:
PR c++/97975
* g++.dg/cpp1z/inline-var8.C: New test.
I had a strong sense of deja vu when looking into this, and no wonder,
since this is almost identical to c++/95728.
Since r11-423 tsubst_copy_and_build/TREE_LIST uses tsubst_tree_list
instead of open coding it. While the latter could return an error
node wrapped in a TREE_LIST, the former can return a naked error node.
That broke in tsubst_copy_and_build/NEW_EXPR, because we were accessing
TREE_VALUE of an error node.
gcc/cp/ChangeLog:
PR c++/97187
PR c++/97993
* pt.c (tsubst_copy_and_build) <case NEW_EXPR>: Return error_mark_node
if init is erroneous.
gcc/testsuite/ChangeLog:
PR c++/97187
PR c++/97993
* g++.dg/eh/crash2.C: New test.
* g++.dg/template/crash132.C: New test.
Currently GCC loads large immediates into GPRs from the literal pool,
which is not as efficient as loading two halves with llihf and oilf.
gcc/ChangeLog:
2020-11-30 Ilya Leoshkevich <iii@linux.ibm.com>
* config/s390/s390-protos.h (s390_const_int_pool_entry_p): New
function.
* config/s390/s390.c (s390_const_int_pool_entry_p): New
function.
* config/s390/s390.md: Add define_peephole2 that produces llihf
and oilf.
gcc/testsuite/ChangeLog:
2020-11-30 Ilya Leoshkevich <iii@linux.ibm.com>
* gcc.target/s390/load-imm64-1.c: New test.
* gcc.target/s390/load-imm64-2.c: New test.
In addition to the existing powerpc targets, powerpc64 needs libatomic
for 64-bit atomics when testing the 32-bit multilib with -m32. Adjust
the existing target checks to match all 32-bit powerpc targets, but not
64-bit ones.
libstdc++-v3/ChangeLog:
* testsuite/lib/dg-options.exp (add_options_for_libatomic):
Replace powerpc-ibm-aix* and powerpc*-*-darwin* with check for
powerpc && ilp32.
The module machinery needs to serialize tinfo types and vars by
meaning, not literally. This adds the necessary pieces to rtti.
gcc/cp/
* cp-tree.h (DECL_TINFO_P): Also for TYPE_DECLs.
(get_tinfo_decl_direct): Declare.
(get_pseudo_tinfo_index, get_pseudo_tinfo_type): Declare.
* rtti.c (get_tinfo_decl_direct): Externalize.
(get_tinfo_desc): Set DECL_TINFO_P on the typedef.
(get_pseudo_tinfo_index, get_pseudo_tinfo_type): New.
This is a gofrontend copy of https://golang.org/cl/203282.
From the CL 203282 description:
"declared and not used" is technically correct, but might confuse
the user. Switching "and" to "but" will hopefully create the
contrast for the users: they did one thing (declaration), but
not the other --- actually using the variable.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/273629