Age | Commit message (Collapse) | Author | Files | Lines |
|
According to PR: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110751
As Richard and Richi suggested, we recognize uninitialized SSA_NAME and convert it
into SCRATCH rtx if the target predicate allows SCRATCH.
It can help to reduce redundant data move instructions of targets like RISC-V.
Bootstrap and Regression on x86 passed.
gcc/ChangeLog:
PR target/110751
* internal-fn.cc (expand_fn_using_insn): Support undefined rtx value.
* optabs.cc (maybe_legitimize_operand): Ditto.
(can_reuse_operands_p): Ditto.
* optabs.h (enum expand_operand_type): Ditto.
(create_undefined_input_operand): Ditto.
|
|
1. Move class NTTP object pretty printing to a more general spot in
the pretty printer, so that we always print its value instead of
its (mangled) name even when it appears outside of a template
argument list.
2. Print the type of an class NTTP object alongside its CONSTRUCTOR
value, like dump_expr would have done.
3. Don't print const VIEW_CONVERT_EXPR wrappers for class NTTPs.
PR c++/111471
gcc/cp/ChangeLog:
* cxx-pretty-print.cc (cxx_pretty_printer::expression)
<case VAR_DECL>: Handle class NTTP objects by printing
their type and value.
<case VIEW_CONVERT_EXPR>: Strip const VIEW_CONVERT_EXPR
wrappers for class NTTPs.
(pp_cxx_template_argument_list): Don't handle class NTTP
objects here.
gcc/testsuite/ChangeLog:
* g++.dg/concepts/diagnostic19.C: New test.
|
|
This patch makes tsubst_template_decl use use_spec_table=false also in
the non-class non-function template case, to avoid computing 'argvec' and
doing a hash table lookup from tsubst_decl (when partially instantiating
a member variable/alias template).
This change reveals that for function templates, tsubst_template_decl
registers the partially instantiated TEMPLATE_DECL, whereas for other
non-class templates it registers the corresponding DECL_TEMPLATE_RESULT
which is an interesting inconsistency that I decided to preserve for now.
Trying to consistently register the TEMPLATE_DECL (or DECL_TEMPLATE_RESULT)
causes modules ICEs which I didn't look into.
In passing, in tsubst_function_decl I noticed 'argvec' is unused
when 'lambda_fntype' is set (since lambdas aren't recorded in the
specializations table), so we can avoid computing it in that case.
gcc/cp/ChangeLog:
* pt.cc (tsubst_function_decl): Don't bother computing 'argvec'
when 'lambda_fntype' is set.
(tsubst_template_decl): Make sure we return a TEMPLATE_DECL
during specialization lookup. In the non-class non-function
template case, use tsubst_decl directly with use_spec_table=false,
update DECL_TI_ARGS and call register_specialization like
tsubst_decl would have done if use_spec_table=true.
|
|
Call GOMP_alloc/free for 'omp allocate' allocated variables. This is
for C only as C++ and Fortran show a sorry already in the FE. Note that
this only applies to stack variables as the C FE shows a sorry for
static variables.
gcc/ChangeLog:
* gimplify.cc (gimplify_bind_expr): Call GOMP_alloc/free for
'omp allocate' variables; move stack cleanup after other
cleanup.
(omp_notice_variable): Process original decl when decl
of the value-expression for a 'omp allocate' variable is passed.
* omp-low.cc (scan_omp_1_op): Handle 'omp allocate' variables
libgomp/ChangeLog:
* libgomp.texi (OpenMP 5.1 Impl.): Mark 'omp allocate' as
implemented for C only.
* testsuite/libgomp.c/allocate-4.c: New test.
* testsuite/libgomp.c/allocate-5.c: New test.
* testsuite/libgomp.c/allocate-6.c: New test.
gcc/testsuite/ChangeLog:
* c-c++-common/gomp/allocate-11.c: Remove C-only dg-message
for 'sorry, unimplemented'.
* c-c++-common/gomp/allocate-12.c: Likewise.
* c-c++-common/gomp/allocate-15.c: Likewise.
* c-c++-common/gomp/allocate-9.c: Likewise.
* c-c++-common/gomp/allocate-10.c: New test.
* c-c++-common/gomp/allocate-17.c: New test.
|
|
gcc/ChangeLog:
* simplify-rtx.cc (simplify_context::simplify_binary_operation_1):
support simplifying vector int not only scalar int.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/base/simplify-vdiv.c: New test.
Signed-off-by: Yanzhang Wang <yanzhang.wang@intel.com>
|
|
Regression passed.
Committed.
gcc/ChangeLog:
* config/riscv/vector-iterators.md: Extend VLS floating-point.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/autovec/widen/widen-10.c: Adapt test.
* gcc.target/riscv/rvv/autovec/widen/widen-11.c: Ditto.
* gcc.target/riscv/rvv/autovec/widen/widen-12.c: Ditto.
* gcc.target/riscv/rvv/autovec/widen/widen-complicate-7.c: Ditto.
* gcc.target/riscv/rvv/autovec/widen/widen-complicate-8.c: Ditto.
* gcc.target/riscv/rvv/autovec/widen/widen-complicate-9.c: Ditto.
* gcc.target/riscv/rvv/autovec/vls/ext-4.c: New test.
* gcc.target/riscv/rvv/autovec/vls/ext-5.c: New test.
* gcc.target/riscv/rvv/autovec/vls/trunc-4.c: New test.
* gcc.target/riscv/rvv/autovec/vls/trunc-5.c: New test.
|
|
This bug is exposed when we support VLS integer conversion patterns.
FAIL: c-c++-common/torture/pr53505.c execution.
This is because incorrect vsetvl elimination by Phase 4:
10318: 0d207057 vsetvli zero,zero,e32,m4,ta,ma
1031c: 5e003e57 vmv.v.i v28,0
.....: ........ missed e8,m1 vsetvl
10320: 7b07b057 vmsgtu.vi v0,v16,15
10324: 03083157 vadd.vi v2,v16,-16
Regression on release version GCC no surprise difference.
Committed.
gcc/ChangeLog:
* config/riscv/riscv-vsetvl.cc (vector_insn_info::operator==): Fix bug.
|
|
This avoids a bunch of irrelevant diagnostics if the user passes '-shared' to
gnatmake. Currently, we push '-dynamiclib' back onto the command line (since
that is the Darwin spelling of 'shared') but this is not handled by gnat1,
leading to a diagnostic for every character after the '-d'.
'-shared' has no effect on gnatmake (it needs to be passed to gnatbind).
This moves the handling of '-shared' to leaf specs so that we do not need to
push 'dynamiclib' onto the command line.
gcc/ChangeLog:
* config/darwin.h:
(SUBTARGET_DRIVER_SELF_SPECS): Move handling of 'shared' into the same
specs as 'dynamiclib'. (STARTFILE_SPEC): Handle 'shared'.
|
|
This raises --param uninit-max-chain-len to avoid a bogus diagnostic
for the large testcase in PR111489.
PR tree-optimization/111489
* params.opt (-param uninit-max-chain-len=): Raise default to 8.
* gcc.dg/uninit-pr111489.c: New testcase.
|
|
The following turns MAX_NUM_CHAINS and MAX_CHAIN_LEN to params which
allows to experiment with raising them. For the testcase in PR111489
raising MAX_CHAIN_LEN from 5 to 8 avoids the bogus diagnostics
at -O2, at -O3 we need a MAX_CHAIN_LEN of 6.
PR tree-optimization/111489
* doc/invoke.texi (--param uninit-max-chain-len): Document.
(--param uninit-max-num-chains): Likewise.
* params.opt (-param=uninit-max-chain-len=): New.
(-param=uninit-max-num-chains=): Likewise.
* gimple-predicate-analysis.cc (MAX_NUM_CHAINS): Define to
param_uninit_max_num_chains.
(MAX_CHAIN_LEN): Define to param_uninit_max_chain_len.
(uninit_analysis::init_use_preds): Avoid VLA.
(uninit_analysis::init_from_phi_def): Likewise.
(compute_control_dep_chain): Avoid using MAX_CHAIN_LEN in
template parameter.
|
|
On Tue, Sep 19, 2023 at 05:50:59PM +0100, Richard Sandiford wrote:
> How about using MAX_FIXED_MODE_SIZE for things like this?
Seems like a good idea.
The following patch does that.
2023-09-20 Jakub Jelinek <jakub@redhat.com>
* match.pd ((x << c) >> c): Use MAX_FIXED_MODE_SIZE instead of
GET_MODE_PRECISION of TImode or DImode depending on whether
TImode is supported scalar mode.
* gimple-lower-bitint.cc (bitint_precision_kind): Likewise.
* expr.cc (expand_expr_real_1): Likewise.
* tree-ssa-sccvn.cc (eliminate_dom_walker::eliminate_stmt): Likewise.
* ubsan.cc (ubsan_encode_value, ubsan_type_descriptor): Likewise.
|
|
This patch reorganize and rename the combine patterns in autovec-opt.md
by category. There shouldn't be any functional changes.
The current classification includes the following categories:
- Combine op + vmerge to cond_op
- Combine binop + trunc to narrow_binop
- Combine extend + binop to widen_binop
- Combine extend + ternop to widen_ternop
- Misc combine patterns
gcc/ChangeLog:
* config/riscv/autovec-opt.md (*<optab>not<mode>): Move and rename.
(*n<optab><mode>): Ditto.
(*v<any_shiftrt:optab><any_extend:optab>trunc<mode>): Ditto.
(*<any_shiftrt:optab>trunc<mode>): Ditto.
(*narrow_<any_shiftrt:optab><any_extend:optab><mode>): Ditto.
(*narrow_<any_shiftrt:optab><mode>_scalar): Ditto.
(*single_widen_mult<any_extend:su><mode>): Ditto.
(*single_widen_mul<any_extend:su><mode>): Ditto.
(*single_widen_mult<mode>): Ditto.
(*single_widen_mul<mode>): Ditto.
(*dual_widen_fma<mode>): Ditto.
(*dual_widen_fma<su><mode>): Ditto.
(*single_widen_fma<mode>): Ditto.
(*single_widen_fma<su><mode>): Ditto.
(*dual_fma<mode>): Ditto.
(*single_fma<mode>): Ditto.
(*dual_fnma<mode>): Ditto.
(*dual_widen_fnma<mode>): Ditto.
(*single_fnma<mode>): Ditto.
(*single_widen_fnma<mode>): Ditto.
(*dual_fms<mode>): Ditto.
(*dual_widen_fms<mode>): Ditto.
(*single_fms<mode>): Ditto.
(*single_widen_fms<mode>): Ditto.
(*dual_fnms<mode>): Ditto.
(*dual_widen_fnms<mode>): Ditto.
(*single_fnms<mode>): Ditto.
(*single_widen_fnms<mode>): Ditto.
|
|
This patch adds support for (so far C++) omp::decl attribute. For
declare simd and declare variant directives it is essentially another
spelling of omp::decl, except per discussions it is not allowed inside
of omp::sequence attribute. For threadprivate, declare target, allocate
and later groupprivate directives it should appertain to variable (or for
declare target also function definitions and) declarations and where in
normal syntax one specifies a list of variables (or variables and functions),
either as argument of the directive or clause argument, such argument is
not specified and implied to be the variable it applies to.
2023-09-20 Jakub Jelinek <jakub@redhat.com>
PR c++/111392
gcc/
* attribs.cc (decl_attributes): Don't warn on omp::directive attribute
on vars or function decls if -fopenmp or -fopenmp-simd.
gcc/c-family/
* c-omp.cc (c_omp_directives): Add commented out groupprivate
directive entry.
gcc/cp/
* parser.h (struct cp_lexer): Add in_omp_decl_attribute member.
* cp-tree.h (cp_maybe_parse_omp_decl): Declare.
* parser.cc (cp_parser_handle_statement_omp_attributes): Diagnose
omp::decl attribute on statements. Adjust diagnostic wording for
omp::decl.
(cp_parser_omp_directive_args): Add DECL_P argument, set TREE_PUBLIC
to it on the DEFERRED_PARSE tree.
(cp_parser_omp_sequence_args): Adjust caller.
(cp_parser_std_attribute): Handle omp::decl attribute.
(cp_parser_omp_var_list): If parser->lexer->in_omp_decl_attribute
don't expect any arguments, instead create clause or TREE_LIST for
that decl.
(cp_parser_late_parsing_omp_declare_simd): Adjust diagnostic wording
for omp::decl.
(cp_maybe_parse_omp_decl): New function.
(cp_parser_omp_declare_target): If
parser->lexer->in_omp_decl_attribute and first token isn't name or
comma invoke cp_parser_omp_var_list.
* decl2.cc (cplus_decl_attributes): Adjust diagnostic wording for
omp::decl. Handle omp::decl on declarations.
* name-lookup.cc (finish_using_directive): Adjust diagnostic wording
for omp::decl.
gcc/testsuite/
* g++.dg/gomp/attrs-19.C: New test.
* g++.dg/gomp/attrs-20.C: New test.
* g++.dg/gomp/attrs-21.C: New test.
libgomp/
* libgomp.texi: Mark decl attribute was added to the C++ attribute
syntax as implemented.
|
|
This ICE appears in GCC compiled with -O2 flags.
PR target/111488
gcc/ChangeLog:
* config/riscv/autovec-opt.md: Add missed operand.
|
|
Split DWARF files aren't processed by the linker, so DW_MACRO_import
offsets aren't relocated and the .debug_macro.dwo sections aren't
deduplicated and merged. There's no clear way for this to work for
split DWARF, so disable it.
gcc/ChangeLog:
PR debug/111409
* dwarf2out.cc (output_macinfo): Don't call optimize_macinfo_range if
dwarf_split_debug_info.
gcc/testsuite/ChangeLog:
PR debug/111409
* gcc.dg/pr111409.c: New test.
|
|
When commit the fix for pr111324, the test cases was named as pr111303.c
by mistake. Here, rename it to pr111324.c
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/pr111303.c: Rename to ...
* gcc.dg/tree-ssa/pr111324.c: ... this.
|
|
This patch extends 'VWEXT' iterator so that we will support
integer extension/integer truncate/integer average VLS patterns.
This patch reduce these following FAILs:
FAIL: gcc.dg/pr92301.c execution test
XPASS: gcc.dg/vect/bb-slp-subgroups-3.c -flto -ffat-lto-objects scan-tree-dump-times slp2 "optimized: basic block" 2
XPASS: gcc.dg/vect/bb-slp-subgroups-3.c scan-tree-dump-times slp2 "optimized: basic block" 2
The pr92301.c is the latent bug in middle-end GIMPLE FOLD.
We are just lucky that this test passes with this patch which makes us not trigger the GIMPLE FOLD bug again.
gcc/ChangeLog:
* config/riscv/riscv-v.cc (can_find_related_mode_p): New function.
(vectorize_related_mode): Add VLS related modes.
* config/riscv/vector-iterators.md: Extend VLS modes.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/autovec/binop/narrow-1.c: Adapt testcase.
* gcc.target/riscv/rvv/autovec/binop/narrow-2.c: Ditto.
* gcc.target/riscv/rvv/autovec/binop/narrow-3.c: Ditto.
* gcc.target/riscv/rvv/autovec/cmp/vcond-1.c: Ditto.
* gcc.target/riscv/rvv/autovec/cmp/vcond-2.c: Ditto.
* gcc.target/riscv/rvv/autovec/cmp/vcond-3.c: Ditto.
* gcc.target/riscv/rvv/autovec/cmp/vcond-4.c: Ditto.
* gcc.target/riscv/rvv/autovec/partial/slp-18.c: Ditto.
* gcc.target/riscv/rvv/autovec/partial/slp-19.c: Ditto.
* gcc.target/riscv/rvv/autovec/pr110950.c: Ditto.
* gcc.target/riscv/rvv/autovec/ternop/ternop-1.c: Ditto.
* gcc.target/riscv/rvv/autovec/ternop/ternop-10.c: Ditto.
* gcc.target/riscv/rvv/autovec/ternop/ternop-11.c: Ditto.
* gcc.target/riscv/rvv/autovec/ternop/ternop-12.c: Ditto.
* gcc.target/riscv/rvv/autovec/ternop/ternop-2.c: Ditto.
* gcc.target/riscv/rvv/autovec/ternop/ternop-3.c: Ditto.
* gcc.target/riscv/rvv/autovec/ternop/ternop-4.c: Ditto.
* gcc.target/riscv/rvv/autovec/ternop/ternop-5.c: Ditto.
* gcc.target/riscv/rvv/autovec/ternop/ternop-6.c: Ditto.
* gcc.target/riscv/rvv/autovec/ternop/ternop-7.c: Ditto.
* gcc.target/riscv/rvv/autovec/ternop/ternop-8.c: Ditto.
* gcc.target/riscv/rvv/autovec/ternop/ternop-9.c: Ditto.
* gcc.target/riscv/rvv/autovec/ternop/ternop_nofm-1.c: Ditto.
* gcc.target/riscv/rvv/autovec/ternop/ternop_nofm-10.c: Ditto.
* gcc.target/riscv/rvv/autovec/ternop/ternop_nofm-11.c: Ditto.
* gcc.target/riscv/rvv/autovec/ternop/ternop_nofm-12.c: Ditto.
* gcc.target/riscv/rvv/autovec/ternop/ternop_nofm-2.c: Ditto.
* gcc.target/riscv/rvv/autovec/ternop/ternop_nofm-3.c: Ditto.
* gcc.target/riscv/rvv/autovec/ternop/ternop_nofm-4.c: Ditto.
* gcc.target/riscv/rvv/autovec/ternop/ternop_nofm-5.c: Ditto.
* gcc.target/riscv/rvv/autovec/ternop/ternop_nofm-6.c: Ditto.
* gcc.target/riscv/rvv/autovec/ternop/ternop_nofm-7.c: Ditto.
* gcc.target/riscv/rvv/autovec/ternop/ternop_nofm-8.c: Ditto.
* gcc.target/riscv/rvv/autovec/ternop/ternop_nofm-9.c: Ditto.
* gcc.target/riscv/rvv/autovec/vls/def.h: Ditto.
* gcc.target/riscv/rvv/autovec/vls/div-1.c: Ditto.
* gcc.target/riscv/rvv/autovec/vls/shift-3.c: Ditto.
* gcc.target/riscv/rvv/autovec/widen/widen-1.c: Ditto.
* gcc.target/riscv/rvv/autovec/widen/widen-2.c: Ditto.
* gcc.target/riscv/rvv/autovec/widen/widen-3.c: Ditto.
* gcc.target/riscv/rvv/autovec/widen/widen-4.c: Ditto.
* gcc.target/riscv/rvv/autovec/widen/widen-5.c: Ditto.
* gcc.target/riscv/rvv/autovec/widen/widen-6.c: Ditto.
* gcc.target/riscv/rvv/autovec/widen/widen-7.c: Ditto.
* gcc.target/riscv/rvv/autovec/widen/widen-8.c: Ditto.
* gcc.target/riscv/rvv/autovec/widen/widen-9.c: Ditto.
* gcc.target/riscv/rvv/autovec/widen/widen-complicate-1.c: Ditto.
* gcc.target/riscv/rvv/autovec/widen/widen-complicate-2.c: Ditto.
* gcc.target/riscv/rvv/autovec/widen/widen-complicate-3.c: Ditto.
* gcc.target/riscv/rvv/autovec/widen/widen-complicate-4.c: Ditto.
* gcc.target/riscv/rvv/autovec/widen/widen-complicate-5.c: Ditto.
* gcc.target/riscv/rvv/autovec/widen/widen-complicate-6.c: Ditto.
* gcc.target/riscv/rvv/autovec/zve32f-1.c: Ditto.
* gcc.target/riscv/rvv/autovec/vls/avg-1.c: New test.
* gcc.target/riscv/rvv/autovec/vls/avg-2.c: New test.
* gcc.target/riscv/rvv/autovec/vls/avg-3.c: New test.
* gcc.target/riscv/rvv/autovec/vls/avg-4.c: New test.
* gcc.target/riscv/rvv/autovec/vls/avg-5.c: New test.
* gcc.target/riscv/rvv/autovec/vls/avg-6.c: New test.
* gcc.target/riscv/rvv/autovec/vls/ext-1.c: New test.
* gcc.target/riscv/rvv/autovec/vls/ext-2.c: New test.
* gcc.target/riscv/rvv/autovec/vls/ext-3.c: New test.
* gcc.target/riscv/rvv/autovec/vls/trunc-1.c: New test.
* gcc.target/riscv/rvv/autovec/vls/trunc-2.c: New test.
* gcc.target/riscv/rvv/autovec/vls/trunc-3.c: New test.
|
|
In improve_allocation() routine, IRA checks for each allocno if spilling
any conflicting allocnos can improve the allocation of this allocno.
This routine computes the cost improvement for usage of each profitable
hard register for a given allocno. The existing code in
improve_allocation() does not consider the save/restore costs of callee
save registers while computing the cost improvement.
This can result in a callee save register being assigned to a pseudo
that is live in the entire function and across a call, overriding a
non-callee save register assigned to the pseudo by graph coloring. So
the entry basic block requires a prolog, thereby causing shrink wrap to
fail.
2023-09-14 Surya Kumari Jangala <jskumari@linux.ibm.com>
gcc/
PR rtl-optimization/110071
* ira-color.cc (improve_allocation): Consider cost of callee
save registers.
gcc/testsuite/
PR rtl-optimization/110071
* gcc.target/powerpc/pr110071.c: New test.
|
|
Some assemblers (GNU as for LoongArch) generates relocations for leb128
symbol arithmetic for relaxation, we need to disable relaxation probing
leb128 support then.
gcc/ChangeLog:
* configure: Regenerate.
* configure.ac: Checking assembler for -mno-relax support.
Disable relaxation when probing leb128 support.
co-authored-by: Xi Ruoyao <xry111@xry111.site>
|
|
explicit relocs are turned off by default.
gcc/ChangeLog:
* config.in: Regenerate.
* config/loongarch/genopts/loongarch.opt.in: Add compilation option
mrelax. And set the initial value of explicit-relocs according to the
detection status.
* config/loongarch/gnu-user.h: When compiling with -mno-relax, pass the
--no-relax option to the linker.
* config/loongarch/loongarch-driver.h (ASM_SPEC): When compiling with
-mno-relax, pass the -mno-relax option to the assembler.
* config/loongarch/loongarch-opts.h (HAVE_AS_MRELAX_OPTION): Define macro.
* config/loongarch/loongarch.opt: Regenerate.
* configure: Regenerate.
* configure.ac: Add detection of support for binutils relax function.
|
|
|
|
It affects the build, and if used as a static file, can reliably be
tracked using the `-MF` mechanism.
gcc/cp/:
* mapper-client.cc, mapper-client.h (open_module_client): Accept
dependency tracking and track module mapper files as
dependencies.
* module.cc (make_mapper, get_mapper): Pass the dependency
tracking class down.
gcc/testsuite/:
* g++.dg/modules/depreport-2.modmap: New test.
* g++.dg/modules/depreport-2_a.C: New test.
* g++.dg/modules/depreport-2_b.C: New test.
* g++.dg/modules/test-depfile.py: Support `:|` syntax output
when generating modules.
Signed-off-by: Ben Boeckel <ben.boeckel@kitware.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
|
|
They affect the build, so report them via `-MF` mechanisms.
gcc/cp/
* module.cc (do_import): Report imported CMI files as
dependencies.
gcc/testsuite/
* g++.dg/modules/depreport-1_a.C: New test.
* g++.dg/modules/depreport-1_b.C: New test.
* g++.dg/modules/test-depfile.py: New tool for validating depfile
information.
* lib/modules.exp: Support for validating depfile contents.
Signed-off-by: Ben Boeckel <ben.boeckel@kitware.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
|
|
This patch implements support for [P1689R5][] to communicate to a build
system the C++20 module dependencies to build systems so that they may
build `.gcm` files in the proper order.
Support is communicated through the following three new flags:
- `-fdeps-format=` specifies the format for the output. Currently named
`p1689r5`.
- `-fdeps-file=` specifies the path to the file to write the format to.
- `-fdeps-target=` specifies the `.o` that will be written for the TU
that is scanned. This is required so that the build system can
correlate the dependency output with the actual compilation that will
occur.
CMake supports this format as of 17 Jun 2022 (to be part of 3.25.0)
using an experimental feature selection (to allow for future usage
evolution without committing to how it works today). While it remains
experimental, docs may be found in CMake's documentation for
experimental features.
Future work may include using this format for Fortran module
dependencies as well, however this is still pending work.
[P1689R5]: https://isocpp.org/files/papers/P1689R5.html
[cmake-experimental]: https://gitlab.kitware.com/cmake/cmake/-/blob/master/Help/dev/experimental.rst
TODO:
- header-unit information fields
Header units (including the standard library headers) are 100%
unsupported right now because the `-E` mechanism wants to import their
BMIs. A new mode (i.e., something more workable than existing `-E`
behavior) that mocks up header units as if they were imported purely
from their path and content would be required.
- non-utf8 paths
The current standard says that paths that are not unambiguously
represented using UTF-8 are not supported (because these cases are rare
and the extra complication is not worth it at this time). Future
versions of the format might have ways of encoding non-UTF-8 paths. For
now, this patch just doesn't support non-UTF-8 paths (ignoring the
"unambiguously representable in UTF-8" case).
- figure out why junk gets placed at the end of the file
Sometimes it seems like the file gets a lot of `NUL` bytes appended to
it. It happens rarely and seems to be the result of some
`ftruncate`-style call which results in extra padding in the contents.
Noting it here as an observation at least.
libcpp/
* include/cpplib.h: Add cpp_fdeps_format enum.
(cpp_options): Add fdeps_format field
(cpp_finish): Add structured dependency fdeps_stream parameter.
* include/mkdeps.h (deps_add_module_target): Add flag for
whether a module is exported or not.
(fdeps_add_target): Add function.
(deps_write_p1689r5): Add function.
* init.cc (cpp_finish): Add new preprocessor parameter used for C++
module tracking.
* mkdeps.cc (mkdeps): Implement P1689R5 output.
gcc/
* doc/invoke.texi: Document -fdeps-format=, -fdeps-file=, and
-fdeps-target= flags.
* gcc.cc: add defaults for -fdeps-target= and -fdeps-file= when
only -fdeps-format= is specified.
* json.h: Add a TODO item to refactor out to share with
`libcpp/mkdeps.cc`.
gcc/c-family/
* c-opts.cc (c_common_handle_option): Add fdeps_file variable and
-fdeps-format=, -fdeps-file=, and -fdeps-target= parsing.
* c.opt: Add -fdeps-format=, -fdeps-file=, and -fdeps-target=
flags.
gcc/cp/
* module.cc (preprocessed_module): Pass whether the module is
exported to dependency tracking.
gcc/testsuite/
* g++.dg/modules/depflags-f-MD.C: New test.
* g++.dg/modules/depflags-f.C: New test.
* g++.dg/modules/depflags-fi.C: New test.
* g++.dg/modules/depflags-fj-MD.C: New test.
* g++.dg/modules/depflags-fj.C: New test.
* g++.dg/modules/depflags-fjo-MD.C: New test.
* g++.dg/modules/depflags-fjo.C: New test.
* g++.dg/modules/depflags-fo-MD.C: New test.
* g++.dg/modules/depflags-fo.C: New test.
* g++.dg/modules/depflags-j-MD.C: New test.
* g++.dg/modules/depflags-j.C: New test.
* g++.dg/modules/depflags-jo-MD.C: New test.
* g++.dg/modules/depflags-jo.C: New test.
* g++.dg/modules/depflags-o-MD.C: New test.
* g++.dg/modules/depflags-o.C: New test.
* g++.dg/modules/p1689-1.C: New test.
* g++.dg/modules/p1689-1.exp.ddi: New test expectation.
* g++.dg/modules/p1689-2.C: New test.
* g++.dg/modules/p1689-2.exp.ddi: New test expectation.
* g++.dg/modules/p1689-3.C: New test.
* g++.dg/modules/p1689-3.exp.ddi: New test expectation.
* g++.dg/modules/p1689-4.C: New test.
* g++.dg/modules/p1689-4.exp.ddi: New test expectation.
* g++.dg/modules/p1689-5.C: New test.
* g++.dg/modules/p1689-5.exp.ddi: New test expectation.
* g++.dg/modules/modules.exp: Load new P1689 library routines.
* g++.dg/modules/test-p1689.py: New tool for validating P1689 output.
* lib/modules.exp: Support for validating P1689 outputs.
Signed-off-by: Ben Boeckel <ben.boeckel@kitware.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
|
|
When passing `-o` flags to other options, the typical `-o foo` spelling
leaves a leading whitespace when replacing elsewhere. This ends up
creating flags spelled as `-some-option-with-arg= foo.ext` which doesn't
parse properly. When attempting to make a spec function to just remove
the leading whitespace, the argument splitting ends up masking the
whitespace. However, the intended extension *also* ends up being its own
argument. To perform the desired behavior, the arguments need to be
concatenated together.
gcc/:
* gcc.cc (join_spec_func): Add a spec function to join all
arguments.
Signed-off-by: Ben Boeckel <ben.boeckel@kitware.com>
Co-authored-by: Jason Merrill <jason@redhat.com>
|
|
Resolves PR 111461.
during RTL pass: expand
offtime.c: In function '__offtime':
offtime.c:79:6: internal compiler error: RTL check: expected elt 0 type 'e' or 'u', have 'w' (rtx const_int) in riscv_legitimize_const_move, at config/riscv/riscv.cc:2176
79 | ip = __mon_yday[__isleap(y)];
Tested on rv32gc glibc with --enable-checking=rtl.
2023-09-19 Juzhe Zhong <juzhe.zhong@rivai.ai>
gcc/ChangeLog:
* config/riscv/riscv.cc (riscv_legitimize_const_move): Eliminate
src_op_0 var to avoid rtl check error.
Tested-by: Patrick O'Neill <patrick@rivosinc.com>
|
|
The following patch removes all the special casing from the floating
point relational folding code. Now all the code relating to folding
of relationals is in frelop_early_resolve() and in
operator_not_equal::fold_range() which requires a small tweak.
I have written new relational tests, and moved them to
gcc.dg/tree-ssa/vrp-float-relations-* for easy reference. In the
tests it's easy to see the type of things we need to handle:
(a)
if (x != y)
if (x == y)
link_error ();
(b)
if (a != b)
if (a != b) // Foldable as true.
(c)
/* We can thread BB2->BB4->BB5 even though we have no knowledge
of the NANness of either x_1 or a_5. */
__BB(4):
x_1 = __PHI (__BB2: a_5(D), __BB3: b_4(D));
if (x_1 __UNEQ a_5(D))
(d)
/* Even though x_1 and a_4 are equivalent on the BB2->BB4 path,
we cannot fold the conditional because of possible NANs: */
__BB(4):
# x_1 = __PHI (__BB2: a_4(D), __BB3: 8.0e+0(3));
if (x_1 == a_4(D))
(e)
if (cond)
x = a;
else
x = 8.0;
/* We can fold this as false on the path coming out of cond==1,
regardless of NANs on either "x" or "a". */
if (x < a)
stuff ();
[etc, etc]
We can implement everything without either special casing,
get_identity_relation(), or adding new unordered relationals.
The basic idea is that if we accurately reflect NANs in op[12]_range,
this information gets propagated to the relevant edges, and there's no
need for unordered relations (VREL_UN*), because the information is in
the range itself. This information is then used in
frelop_early_resolve() to fold certain combinations.
I don't mean this patch as a hard-no against implementing the
unordered relations Jakub preferred, but seeing that it's looking
cleaner and trivially simple without the added burden of more enums,
I'd like to flesh it out completely and then discuss if we still think
new codes are needed.
More testcases or corner cases are highly welcome.
In follow-up patches I will finish up unordered relation folding, and
come up with suitable tests.
gcc/ChangeLog:
* range-op-float.cc (frelop_early_resolve): Clean-up and remove
special casing.
(operator_not_equal::fold_range): Handle VREL_EQ.
(operator_lt::fold_range): Remove special casing for VREL_EQ.
(operator_gt::fold_range): Same.
(foperator_unordered_equal::fold_range): Same.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/vrp-float-12.c: Moved to...
* gcc.dg/tree-ssa/vrp-float-relations-1.c: ...here.
* gcc.dg/tree-ssa/vrp-float-relations-2.c: New test.
* gcc.dg/tree-ssa/vrp-float-relations-3.c: New test.
* gcc.dg/tree-ssa/vrp-float-relations-4.c: New test.
|
|
Most code is cold. This patch extends support for attribute ((cold)) to C++
Classes, Unions, and Structs (RECORD_TYPES and UNION_TYPES) to benefit from
encapsulation - reducing the verbosity of using the attribute where
deserved. The ((hot)) attribute is also extended for its semantic relation.
gcc/c-family/ChangeLog:
* c-attribs.cc (handle_hot_attribute): remove warning on
RECORD_TYPE and UNION_TYPE when in c_dialect_xx.
(handle_cold_attribute): Likewise.
gcc/cp/ChangeLog:
* class.cc (propagate_class_warmth_attribute): New function.
(check_bases_and_members): propagate hot and cold attributes
to all FUNCTION_DECL when the record is marked hot or cold.
* cp-tree.h (maybe_propagate_warmth_attributes): New function.
* decl2.cc (maybe_propagate_warmth_attributes): New function.
* method.cc (lazily_declare_fn): propagate hot and cold
attributes to lazily declared functions when the record is
marked hot or cold.
gcc/ChangeLog:
* doc/extend.texi: Document attributes hot, cold on C++ types.
gcc/testsuite/ChangeLog:
* g++.dg/ext/attr-hotness.C: New test.
Signed-off-by: Javier Martinez <javier.martinez.bugzilla@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
|
|
Unlike DECL_TEMPLATE_INFO which is stored in DECL_LANG_SPECIFIC,
TYPE_TEMPLATE_INFO isn't stored in TYPE_LANG_SPECIFIC, so we don't
need to check for both in cxx_print_type. This fixes dumping the
template-info of ENUMERAL_TYPE and BOUND_TEMPLATE_TEMPLATE_PARM,
which seem to never have TYPE_LANG_SPECIFIC.
gcc/cp/ChangeLog:
* ptree.cc (cxx_print_type): Remove TYPE_LANG_SPECIFIC
test guarding TYPE_TEMPLATE_INFO.
|
|
It was recently discovered that the scalar modulo instructions can suffer
noticeable performance issues for certain input values. This patch disables
their generation since the equivalent div/mul/sub sequence does not suffer
the same problem.
gcc/
* config/rs6000/rs6000.cc (rs6000_rtx_costs): Check whether the
modulo instruction is disabled.
* config/rs6000/rs6000.h (RS6000_DISABLE_SCALAR_MODULO): New.
* config/rs6000/rs6000.md (mod<mode>3, *mod<mode>3): Check it.
(define_expand umod<mode>3): New.
(define_insn umod<mode>3): Rename to *umod<mode>3 and check if the modulo
instruction is disabled.
(umodti3, modti3): Check if the modulo instruction is disabled.
gcc/testsuite/
* gcc.target/powerpc/clone1.c: Add xfails.
* gcc.target/powerpc/clone3.c: Likewise.
* gcc.target/powerpc/mod-1.c: Update scan strings and add xfails.
* gcc.target/powerpc/mod-2.c: Likewise.
* gcc.target/powerpc/p10-vdivq-vmodq.c: Add xfails.
|
|
This patch introduces a configure for LONGREAL as float128 when
targetting or hosting cc1gm2 on ppc64le. It fixes calls to builtins
and fixes the -fdebug-builtins option.
gcc/ChangeLog:
* doc/gm2.texi (fdebug-builtins): Correct description.
gcc/m2/ChangeLog:
* Make-lang.in (host_mc_longreal): Detect hosting on powerpc64le
and if so use __float128 for longreal in mc.
(MC_ARGS): Append host_mc_longreal.
* config-make.in (TEST_TARGET_CPU_DEFAULT): New variable.
(TEST_HOST_CPU_DEFAULT): New variable.
* configure: Regenerate.
* configure.ac (M2C_LONGREAL_FLOAT128): New define set if target
is powerpc64le.
(M2C_LONGREAL_PPC64LE): New define set if target is powerpc64le.
* gm2-compiler/M2GCCDeclare.mod: Correct comment case.
* gm2-compiler/M2GenGCC.mod (MaybeDebugBuiltinAlloca): Call
SetLastFunction for the builtin function call.
(MaybeDebugBuiltinMemcpy): Call SetLastFunction for the builtin
function call.
(MaybeDebugBuiltinMemset): New procedure function.
(MakeCopyUse): Use GNU formatting.
(UseBuiltin): Rewrite to check BuiltinExists.
(CodeDirectCall): Rewrite to check BuiltinExists and call
SetLastFunction.
(CodeMakeAdr): Re-format.
* gm2-compiler/M2Options.def (SetDebugBuiltins): New procedure.
* gm2-compiler/M2Options.mod (SetUninitVariableChecking): Allow
"cond" to switch UninitVariableConditionalChecking separately.
(SetDebugBuiltins): New procedure.
* gm2-compiler/M2Quads.def (BuildFunctionCall): Add parameter
ConstExpr.
* gm2-compiler/M2Quads.mod (BuildRealProcedureCall): Add parameter
to BuildRealFuncProcCall.
(BuildRealFuncProcCall): Add ConstExpr parameter. Pass ConstExpr
to BuildFunctionCall.
(BuildFunctionCall): Add parameter ConstExpr. Pass ConstExpr to
BuildRealFunctionCall.
(BuildConstFunctionCall): Add parameter ConstExpr. Pass ConstExpr to
BuildFunctionCall.
(BuildRealFunctionCall): Add parameter ConstExpr. Pass ConstExpr to
BuildRealFuncProcCall.
* gm2-compiler/P3Build.bnf (SetOrDesignatorOrFunction): Pass FALSE
to BuildFunctionCall.
(AssignmentOrProcedureCall): Pass FALSE to BuildFunctionCall.
* gm2-compiler/SymbolTable.def (IsProcedureBuiltinAvailable): New
procedure function.
* gm2-compiler/SymbolTable.mod (CanUseBuiltin): New procedure
function.
(IsProcedureBuiltinAvailable): New procedure function.
* gm2-gcc/m2builtins.cc (DEBUGGING): Undef.
(bf_category): New enum type.
(struct builtin_function_entry): New field function_avail.
(m2builtins_BuiltInMemCopy): Rename from ...
(m2builtins_BuiltinMemCopy): ... this.
(DoBuiltinMemSet): New function.
(m2builtins_BuiltinMemSet): New function.
(do_target_support_exists): New function.
(target_support_exists): New function.
(m2builtins_BuiltinExists): Return true or false.
(m2builtins_BuildBuiltinTree): Rename local variables.
Replace long_double_type_node with GetM2LongRealType.
(m2builtins_init): Use GetM2LongRealType rather than
long_double_type_node.
* gm2-gcc/m2builtins.def (BuiltInMemCopy): Rename to ...
(BuiltinMemCopy): ... this.
(BuiltinMemSet): New procedure function.
* gm2-gcc/m2builtins.h (m2builtins_BuiltInMemCopy): Rename to ...
(m2builtins_BuiltinMemCopy): ... this.
(m2builtins_BuiltinMemSet): New procedure function.
* gm2-gcc/m2configure.cc (m2configure_M2CLongRealFloat128): New
procedure function.
(m2configure_M2CLongRealIBM128): New procedure function.
(m2configure_M2CLongRealLongDouble): New procedure function.
(m2configure_M2CLongRealLongDoublePPC64LE): New procedure function.
* gm2-gcc/m2configure.def (M2CLongRealFloat128): New procedure function.
(M2CLongRealIBM128): New procedure function.
(M2CLongRealLongDouble): New procedure function.
(M2CLongRealLongDoublePPC64LE): New procedure function.
* gm2-gcc/m2configure.h (m2configure_FullPathCPP): New procedure function.
(m2configure_M2CLongRealFloat128): New procedure function.
(m2configure_M2CLongRealIBM128): New procedure function.
(m2configure_M2CLongRealLongDouble): New procedure function.
(m2configure_M2CLongRealLongDoublePPC64LE): New procedure function.
* gm2-gcc/m2convert.cc (m2convert_BuildConvert): Use convert_loc.
* gm2-gcc/m2options.h (M2Options_SetDebugBuiltins): New function.
* gm2-gcc/m2statement.cc (m2statement_BuildAssignmentTree): Set
TREE_USED to true.
(m2statement_BuildGoto):Set TREE_USED to true.
(m2statement_BuildParam): Set TREE_USED to true.
(m2statement_BuildBuiltinCallTree): New function.
(m2statement_BuildFunctValue): Set TREE_USED to true.
* gm2-gcc/m2statement.def (BuildBuiltinCallTree): New procedure function.
* gm2-gcc/m2statement.h (m2statement_BuildBuiltinCallTree): New
procedure function.
* gm2-gcc/m2treelib.cc (m2treelib_DoCall0): Remove spacing.
(m2treelib_DoCall1): Remove spacing.
(m2treelib_DoCall2): Remove spacing.
(m2treelib_DoCall3): Remove spacing.
(add_stmt): Rename parameter.
* gm2-gcc/m2type.cc (build_set_type): Remove spacing.
(build_m2_specific_size_type): Remove spacing.
(finish_build_pointer_type): Remove spacing.
(m2type_BuildVariableArrayAndDeclare): Remove spacing.
(build_m2_short_real_node): Remove spacing.
(build_m2_real_node): Remove spacing.
(build_m2_long_real_node): Use float128_type_node if
M2CLongRealFloat128 is set.
(build_m2_ztype_node): Remove spacing.
(build_m2_long_int_node): Remove spacing.
(build_m2_long_card_node): Remove spacing.
(build_m2_short_int_node): Remove spacing.
(build_m2_short_card_node): Remove spacing.
(build_m2_iso_loc_node): Remove spacing.
(m2type_SameRealType): New function.
(m2type_InitBaseTypes): Create m2_c_type_node using
m2_long_complex_type_node.
(m2type_SetAlignment): Tidy up comment.
* gm2-gcc/m2type.def (SameRealType): New procedure function.
* gm2-gcc/m2type.h (m2type_SameRealType): New procedure function.
* gm2-lang.cc (gm2_langhook_type_for_mode): Build long complex
node from m2 language specific long double node.
* gm2-libs-log/RealConversions.mod (IsNan): New procedure
function.
(doPowerOfTen): Re-implement.
* gm2-libs/Builtins.mod: Add newline.
* gm2-libs/DynamicStrings.def (ReplaceChar): New procedure function.
* gm2-libs/DynamicStrings.mod (ReplaceChar): New procedure function.
* gm2config.aci.in (M2C_LONGREAL_FLOAT128): New config value.
(M2C_LONGREAL_PPC64LE): New config value.
* gm2spec.cc (lang_specific_driver): New local variable
need_default_mabi set to default value depending upon
M2C_LONGREAL_PPC64LE and M2C_LONGREAL_FLOAT128.
* lang.opt (Wcase-enum): Moved to correct section.
* m2pp.cc (m2pp_real_type): New function.
(m2pp_type): Call m2pp_real_type.
(m2pp_print_mode): New function.
(m2pp_simple_type): Call m2pp_simple_type.
(m2pp_float): New function.
(m2pp_expression): Call m2pp_float.
* mc-boot/GDynamicStrings.cc: Rebuild.
* mc-boot/GDynamicStrings.h: Rebuild.
* mc-boot/GFIO.cc: Rebuild.
* mc-boot/GFIO.h: Rebuild.
* mc-boot/GIO.cc: Rebuild.
* mc-boot/GRTint.cc: Rebuild.
* mc-boot/Gdecl.cc: Rebuild.
* mc-boot/GmcOptions.cc: Rebuild.
* mc-boot/GmcOptions.h: Rebuild.
* mc/decl.mod: Rebuild.
* mc/mcOptions.def (getCRealType): New procedure function.
(getCLongRealType): New procedure function.
(getCShortRealType): New procedure function.
* mc/mcOptions.mod (getCRealType): New procedure function.
(getCLongRealType): New procedure function.
(getCShortRealType): New procedure function.
libgm2/ChangeLog:
* Makefile.am (TARGET_LONGDOUBLE_ABI): New variable set to
-mabi=ieeelongdouble if the target is powerpc64le.
(AM_MAKEFLAGS): Append TARGET_LONGDOUBLE_ABI.
* Makefile.in: Rebuild.
* libm2cor/Makefile.am (AM_MAKEFLAGS): Add CFLAGS_LONGDOUBLE and
TARGET_LONGDOUBLE_ABI.
(libm2cor_la_CFLAGS): Add TARGET_LONGDOUBLE_ABI.
(libm2cor_la_M2FLAGS): Add TARGET_LONGDOUBLE_ABI.
* libm2cor/Makefile.in: Rebuild.
* libm2iso/Makefile.am (AM_MAKEFLAGS): Add CFLAGS_LONGDOUBLE and
TARGET_LONGDOUBLE_ABI.
(libm2iso_la_CFLAGS): Add TARGET_LONGDOUBLE_ABI.
(libm2iso_la_M2FLAGS): Add TARGET_LONGDOUBLE_ABI.
* libm2iso/Makefile.in: Rebuild.
* libm2log/Makefile.am (AM_MAKEFLAGS): Add CFLAGS_LONGDOUBLE and
TARGET_LONGDOUBLE_ABI.
(libm2log_la_CFLAGS): Add TARGET_LONGDOUBLE_ABI.
(libm2log_la_M2FLAGS): Add TARGET_LONGDOUBLE_ABI.
* libm2log/Makefile.in: Rebuild.
* libm2min/Makefile.am (AM_MAKEFLAGS): Add CFLAGS_LONGDOUBLE and
TARGET_LONGDOUBLE_ABI.
(libm2min_la_CFLAGS): Add TARGET_LONGDOUBLE_ABI.
(libm2min_la_M2FLAGS): Add TARGET_LONGDOUBLE_ABI.
* libm2min/Makefile.in: Rebuild.
* libm2pim/Makefile.am (AM_MAKEFLAGS): Add CFLAGS_LONGDOUBLE and
TARGET_LONGDOUBLE_ABI.
(libm2pim_la_CFLAGS): Add TARGET_LONGDOUBLE_ABI.
(libm2pim_la_M2FLAGS): Add TARGET_LONGDOUBLE_ABI.
* libm2pim/Makefile.in: Rebuild.
gcc/testsuite/ChangeLog:
* gm2/extensions/pass/libc.def: Add spacing.
* gm2/pimlib/logitech/run/pass/realconv.mod: Add debugging print.
* gm2/switches/uninit-variable-checking/cascade/fail/switches-uninit-variable-checking-cascade-fail.exp:
Add -fdebug-builtins flag.
* lib/gm2.exp (gm2_target_compile_default): Add
-mabi=ieeelongdouble if the target is powerpc.
(gm2_link_flags): Add
-mabi=ieeelongdouble if the target is powerpc.
* gm2/pim/intrinsic/run/pass/cstub.c: New test.
* gm2/pim/intrinsic/run/pass/cstub.def: New test.
* gm2/pim/intrinsic/run/pass/pim-intrinsic-run-pass.exp: New test.
* gm2/pim/intrinsic/run/pass/test.mod: New test.
* gm2/pim/run/pass/builtins.mod: New test.
* gm2/pim/run/pass/convert1.mod: New test.
* gm2/pim/run/pass/longint1.mod: New test.
* gm2/pim/run/pass/longint2.mod: New test.
* gm2/pim/run/pass/longint3.mod: New test.
* gm2/pim/run/pass/longint4.mod: New test.
* gm2/pim/run/pass/longint5.mod: New test.
* gm2/pim/run/pass/longint6.mod: New test.
* gm2/pim/run/pass/longint7.mod: New test.
* gm2/pim/run/pass/longint8.mod: New test.
Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
|
|
The iq2000-elf port regressed these tests recently:
> iq2000-sim: gcc.c-torture/execute/20040703-1.c -O2 (test for excess errors)
> iq2000-sim: gcc.c-torture/execute/20040703-1.c -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors)
> iq2000-sim: gcc.c-torture/execute/20040703-1.c -O3 -g (test for excess errors)
It turns out one of the patterns had an operand predicate that allowed REG,
SUBREG, CONST_INT (with a limited set of CONST_INTs). Yet the constraint only
allowed the limited set of immediates. This naturally triggered an LRA
constraint failure.
The fix is trivial, create an operand predicate that accurately reflects the
kinds of operands allowed by the instruction.
It turns out this was a long standing bug -- fixing the pattern resolved 55
failing tests in the testsuite.
gcc/
* config/iq2000/predicates.md (uns_arith_constant): New predicate.
* config/iq2000/iq2000.md (rotrsi3): Use it.
|
|
gcc/fortran/ChangeLog:
PR fortran/70231
* trans-array.cc (trans_array_constructor): In absence of a typespec,
use string length determined by get_array_ctor_strlen() to reasonably
initialize auxiliary variable for bounds-checking.
gcc/testsuite/ChangeLog:
PR fortran/70231
* gfortran.dg/bounds_check_fail_7.f90: New test.
|
|
The known_isnan() method is a subset of maybe_isnan(). This patch
removes redundant calls to known_isnan().
gcc/ChangeLog:
* range-op-float.cc (operator_lt::op1_range): Remove known_isnan check.
(operator_lt::op2_range): Same.
(operator_le::op1_range): Same.
(operator_le::op2_range): Same.
(operator_gt::op1_range): Same.
(operator_gt::op2_range): Same.
(operator_ge::op1_range): Same.
(operator_ge::op2_range): Same.
(foperator_unordered_lt::op1_range): Same.
(foperator_unordered_lt::op2_range): Same.
(foperator_unordered_le::op1_range): Same.
(foperator_unordered_le::op2_range): Same.
(foperator_unordered_gt::op1_range): Same.
(foperator_unordered_gt::op2_range): Same.
(foperator_unordered_ge::op1_range): Same.
(foperator_unordered_ge::op2_range): Same.
|
|
We can set_nan() with a nan_state so it's good form to have the
analogous form for update_nan().
gcc/ChangeLog:
* value-range.h (frange::update_nan): New.
|
|
We're missing an op2_range entry for operator_not_equal so GORI can
calculate an outgoing edge. The false side of != is true and
guarantees we don't have a NAN, so it's important to get this right.
We eventually get it through an intersection of various ranges in
ranger, but it's best to get things correct as early as possible.
gcc/ChangeLog:
* range-op-float.cc (operator_not_equal::op2_range): New.
* range-op-mixed.h: Add operator_not_equal::op2_range.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/vrp-float-13.c: New test.
|
|
targets [PR111377]
On Mon, Sep 11, 2023 at 11:11:30PM +0200, Jakub Jelinek via Gcc-patches wrote:
> I think the divergence is whether called_by_test_5b returns the struct
> in registers or in memory. If in memory (like in the x86_64 -m32 case), we have
> [compound-assignment-1.c:71:21] D.3191 = called_by_test_5b (); [return slot optimization]
> [compound-assignment-1.c:71:21 discrim 1] D.3191 ={v} {CLOBBER(eol)};
> [compound-assignment-1.c:72:1] return;
> in the IL, while if in registers (like x86_64 -m64 case), just
> [compound-assignment-1.c:71:21] D.3591 = called_by_test_5b ();
> [compound-assignment-1.c:72:1] return;
>
> If you just want to avoid the differences, putting } on the same line as the
> call might be a usable workaround for that.
Here is the workaround in patch form.
2023-09-19 Jakub Jelinek <jakub@redhat.com>
PR testsuite/111377
* c-c++-common/analyzer/compound-assignment-1.c (test_5b): Move
closing } to the same line as the call to work-around differences in
diagnostics line.
|
|
In this testcase, it seems clear that B should be trivially
default-constructible, since the inherited default constructor is trivial
and there are no other subobjects to initialize. But we were saying no
because we don't define triviality of inherited constructors.
CWG discussion suggested that the solution is to implicitly declare a
default constructor when inheriting a default constructor; that makes sense
to me.
DR 2799
gcc/cp/ChangeLog:
* class.cc (add_implicit_default_ctor): Split out...
(add_implicitly_declared_members): ...from here.
Also call it when inheriting a default ctor.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/inh-ctor38.C: New test.
|
|
in VRP passes before __builtin_unreachable MUST be removed, only remove it
if all exports affected by the unreachable can have global values updated, and
do not involve loads from memory.
PR tree-optimization/110080
PR tree-optimization/110249
gcc/
* tree-vrp.cc (remove_unreachable::final_p): New.
(remove_unreachable::maybe_register): Rename from
maybe_register_block and call early or final routine.
(fully_replaceable): New.
(remove_unreachable::handle_early): New.
(remove_unreachable::remove_and_update_globals): Remove
non-final processing.
(rvrp_folder::rvrp_folder): Add final flag to constructor.
(rvrp_folder::post_fold_bb): Remove unreachable registration.
(rvrp_folder::pre_fold_stmt): Move unreachable processing to here.
(execute_ranger_vrp): Adjust some call parameters.
gcc/testsuite/
* g++.dg/pr110249.C: New.
* gcc.dg/pr110080.c: New.
* gcc.dg/pr93917.c: Adjust.
|
|
In the review of P2564:
<https://gcc.gnu.org/pipermail/gcc-patches/2023-August/628747.html>
it turned out that in order to correctly handle an example in the paper,
we should stop doing immediate evaluation in build_over_call and
bot_replace, and instead do it in cp_fold_r. This patch does that.
Another benefit is that this is a pretty significant simplification, at
least in my opinion. Also, this fixes the c++/110997 ICE (but the test
doesn't compile yet).
The main drawback seems to be that cp_fold_r doesn't process
uninstantiated templates. We still have to handle things like
"false ? foo () : 1". To that end, I've added cp_fold_immediate, called
on dead branches in cxx_eval_conditional_expression.
You'll see that I've reintroduced ADDR_EXPR_DENOTES_CALL_P here. This
is to detect
*(&foo)) ()
(s.*&S::foo) ()
which were deemed ill-formed.
gcc/cp/ChangeLog:
* call.cc (build_over_call): Set ADDR_EXPR_DENOTES_CALL_P. Don't handle
immediate_invocation_p here.
* constexpr.cc (cxx_eval_call_expression): Use mce_true for
DECL_IMMEDIATE_FUNCTION_P.
(cxx_eval_conditional_expression): Call cp_fold_immediate.
* cp-gimplify.cc (enum fold_flags): Add ff_fold_immediate.
(maybe_replace_decl): Make static.
(cp_fold_r): Expand immediate invocations.
(cp_fold_immediate_r): New.
(cp_fold_immediate): New.
* cp-tree.h (ADDR_EXPR_DENOTES_CALL_P): Define.
(cp_fold_immediate): Declare.
* tree.cc (bot_replace): Don't handle immediate invocations here.
libstdc++-v3/ChangeLog:
* testsuite/20_util/allocator/105975.cc: Add dg-error.
gcc/testsuite/ChangeLog:
* g++.dg/cpp23/consteval-if2.C: Add xfail.
* g++.dg/cpp2a/consteval-memfn1.C: Adjust.
* g++.dg/cpp2a/consteval11.C: Remove dg-message.
* g++.dg/cpp2a/consteval3.C: Remove dg-message and dg-error.
* g++.dg/cpp2a/consteval9.C: Remove dg-message.
* g++.dg/cpp2a/consteval32.C: New test.
* g++.dg/cpp2a/consteval33.C: New test.
* g++.dg/cpp2a/consteval34.C: New test.
* g++.dg/cpp2a/consteval35.C: New test.
|
|
The following adjusts -gimple dumping to dump the unordered compare ops
and *h in their GIMPLE form. It also adds parsing for __LTGT which I
missed before.
PR c/111468
gcc/c/
* gimple-parser.cc (c_parser_gimple_binary_expression): Handle __LTGT.
gcc/
* tree-pretty-print.h (op_symbol_code): Add defaulted flags
argument.
* tree-pretty-print.cc (op_symbol): Likewise.
(op_symbol_code): Print TDF_GIMPLE variant if requested.
* gimple-pretty-print.cc (dump_binary_rhs): Pass flags to
op_symbol_code.
(dump_gimple_cond): Likewise.
gcc/testsuite/
* gcc.dg/gimplefe-50.c: Amend.
|
|
Here convert_to_void always completes the type of an indirection or
id-expression, but according to [expr.context] an lvalue-to-rvalue
conversion is applied to a discarded-value expression only if "the
expression is a glvalue of volatile-qualified type". This patch
restricts convert_to_void's type completion to match.
PR c++/111419
gcc/cp/ChangeLog:
* cvt.cc (convert_to_void) <case INDIRECT_REF>: Only call
complete_type if the type is volatile.
<case VAR_DECL>: Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-requires36.C: New test.
* g++.dg/expr/discarded1.C: New test.
* g++.dg/expr/discarded1a.C: New test.
|
|
This corrects resolving decltype of a (class) NTTP object as per
[dcl.type.decltype]/1.2 and [temp.param]/6 in the type-dependent case.
Note that in the non-dependent case we resolve the decltype ahead of
time, in which case finish_decltype_type drops the const VIEW_CONVERT_EXPR
wrapper around the TEMPLATE_PARM_INDEX, and the latter has the desired
non-const type.
In the type-dependent case, at instantiation time tsubst drops the
VIEW_CONVERT_EXPR since the substituted NTTP is the already-const object
created by get_template_parm_object. So in this case finish_decltype_type
sees the const object, which this patch now adds special handling for.
PR c++/99631
gcc/cp/ChangeLog:
* semantics.cc (finish_decltype_type): For an NTTP object,
return its type modulo cv-quals.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/nontype-class60.C: New test.
|
|
Add tests and committed.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/autovec/vls/def.h: Add FNMS VLS modes tests.
* gcc.target/riscv/rvv/autovec/vls/fnms-1.c: New test.
* gcc.target/riscv/rvv/autovec/vls/fnms-2.c: New test.
* gcc.target/riscv/rvv/autovec/vls/fnms-3.c: New test.
|
|
This, in particular, resolves LTO ICEs with big 'machine_mode's, as for RISC-V.
('mode_table' in 'lto_file_decl_data' still is 'unsigned char'; changing that
is still to be done (for use in offloading compilation), but is not trivial.)
For now, get rid of 'lto_mode_identity_table' to resolve the RISC-V LTO ICEs;
we don't need an actual table for a 1-to-1 mapping.
gcc/lto/
* lto-common.cc (lto_mode_identity_table): Remove.
(lto_file_finalize) [!ACCEL_COMPILER]: 'NULL'-intialize
'file_data->mode_table'.
(lto_fe_init): Don't initialize 'lto_mode_identity_table'.
* lto-common.h (lto_mode_identity_table): Remove.
gcc/
* tree-streamer.h (bp_unpack_machine_mode): If
'ib->file_data->mode_table' not available, apply 1-to-1 mapping.
Co-authored-by: Pan Li <pan2.li@intel.com>
|
|
After support the VLS mode conversion, current case triggers a latent bug that we are
lucky we didn't encounter.
This is a real bug in 'cprop_hardreg':
orig:RVVMF8BI,16,16
new:V32BI,32,0
during RTL pass: cprop_hardreg
auto.c: In function 'main':
auto.c:79:1: internal compiler error: in partial_subreg_p, at rtl.h:3186
79 | }
| ^
0x10979a7 partial_subreg_p(machine_mode, machine_mode)
../../../../gcc/gcc/rtl.h:3186
0x1723eda mode_change_ok
../../../../gcc/gcc/regcprop.cc:402
0x1724007 maybe_mode_change
../../../../gcc/gcc/regcprop.cc:436
0x172445d find_oldest_value_reg
../../../../gcc/gcc/regcprop.cc:489
0x172534d copyprop_hardreg_forward_1
../../../../gcc/gcc/regcprop.cc:808
0x1727017 cprop_hardreg_bb
../../../../gcc/gcc/regcprop.cc:1358
0x17272f7 execute
../../../../gcc/gcc/regcprop.cc:1425
When trying to do reg copy propagation between RVVMF8BI (precision = 16,16)
and V32BI (precision = 32,0).
The assertion failed in partial_subreg_p:
gcc_checking_assert (ordered_p (outer_prec, inner_prec));
In regcprop.cc:
if (partial_subreg_p (orig_mode, new_mode))
return false;
If orig_mode (RVVMF8BI) smaller than new_mode (V32BI), we don't do the hard reg propogation.
However, the 'partial_subreg_p' cause ICE since gcc_checking_assert (ordered_p (outer_prec, inner_prec)).
After analysis in aarch64.cc, they do careful block in 'TARGET_CAN_CHANGE_MODE_CLASS'.
So it's reasonable block regcprop when old mode size maybe_lt than new mode size since we won't do the
copy propgation.
gcc/ChangeLog:
* config/riscv/riscv.cc (riscv_can_change_mode_class): Block unordered VLA and VLS modes.
|
|
...subtypes of unconstrained synchronized private extensions should take
care to designate the corresponding record of the underlying concurrent
type.
When generating TSS finalize address subprograms for class-wide types of
constrained root types, it follows the parent chain looking for the
first "non-constrained" type. It is possible that such a type is a
private extension with the “synchronized” keyword, in which case the
underlying type is a concurrent type. When that happens, the designated
type of the finalize address subprogram should be the corresponding
record’s class-wide-type.
gcc/ada/ChangeLog:
* exp_ch3.adb (Expand_Freeze_Class_Wide_Type): Expanded comments
explaining why TSS Finalize_Address is not generated for
concurrent class-wide types.
* exp_ch7.adb (Make_Finalize_Address_Stmts): Handle cases where the
underlying non-constrained parent type is a concurrent type, and
adjust the designated type to be the corresponding record’s
class-wide type.
gcc/testsuite/ChangeLog:
* gnat.dg/sync_tag_finalize.adb: New test.
Signed-off-by: Richard Wai <richard@annexi-strayline.com>
|
|
GNAT was relying on synchronized private type extensions deriving from a
concurrent interface to determine its limitedness. This does not cover the case
where such an extension derives a limited interface. RM-7.6(6/2) makes is clear
that "synchronized" in a private extension implies the derived type is limited.
GNAT should explicitly check for the presence of "synchronized" in a private
extension declaration, and it should have the same effect as the presence of
“limited”.
gcc/ada/ChangeLog:
* sem_ch3.adb (Build_Derived_Record_Type): Treat presence of
keyword "synchronized" the same as "limited" when determining if a
private extension is limited.
gcc/testsuite/ChangeLog:
* gnat.dg/sync_tag_discriminals.adb: New test.
* gnat.dg/sync_tag_limited.adb: New test.
Signed-off-by: Richard Wai <richard@annexi-strayline.com>
|
|
Extend current VLA patterns with VLS modes.
Regression all passed.
gcc/ChangeLog:
* config/riscv/autovec.md: Extend VLS modes.
* config/riscv/vector.md: Ditto.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/autovec/vls/def.h: Add unary test.
* gcc.target/riscv/rvv/autovec/vls/neg-2.c: New test.
|
|
When using bit-packed arrays, the compiler creates new array subtypes of
1-bit component indexed by integers. The existing routine checks the
index subtype to find the min/max values. Bit-packed arrays being
indexed by integers, the routines gives up as returning the maximum
possible integer carries no useful information.
This change adds a simple max_value routine that can evaluate very
simple expressions by substituting variables by their min/max value.
Bit-packed array subtypes are currently declared as:
subtype bp_array is packed_bytes1 (0 .. integer((1 * Var + 7) / 8 - 1));
The simple max_value evaluator handles the bare minimum for this
expression pattern.
gcc/ada/ChangeLog:
* gcc-interface/utils.cc (max_value): New.
* gcc-interface/gigi.h (max_value): New.
* gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Array_Subtype>:
When computing gnu_min/gnu_max, try to use max_value if there is
an initial expression.
|