[PATCH] LoongArch: Add descriptions of the compilation options.
Add descriptions for the compilation options '-mfrecipe' '-mdiv32' '-mlam-bh' '-mlamcas' and '-mld-seq-sa'. gcc/ChangeLog: * doc/invoke.texi: Add descriptions for the compilation options. --- gcc/doc/invoke.texi | 45 +++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index c584664e168..942103c23f5 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -1058,8 +1058,9 @@ Objective-C and Objective-C++ Dialects}. -mmax-inline-memcpy-size=@var{n} -mexplicit-relocs=@var{style} -mexplicit-relocs -mno-explicit-relocs -mdirect-extern-access -mno-direct-extern-access --mcmodel=@var{code-model} -mrelax -mpass-mrelax-to-as} --mrecip -mrecip=@var{opt} +-mcmodel=@var{code-model} -mrelax -mpass-mrelax-to-as +-mrecip -mrecip=@var{opt} -mfrecipe -mno-frecipe -mdiv32 -mno-div32 +-mlam-bh -mno-lam-bh -mlamcas -mno-lamcas -mld-seq-sa -mno-ld-seq-sa} @emph{M32R/D Options} @gccoptlist{-m32r2 -m32rx -m32r @@ -27095,6 +27096,46 @@ Enable the approximation for vectorized reciprocal square root. So, for example, @option{-mrecip=all,!sqrt} enables all of the reciprocal approximations, except for scalar square root. +@opindex mfrecipe +@opindex mno-frecipe +@item -mfrecipe +@itemx -mno-frecipe +Use (do not use) @code{frecipe.@{s/d@}} and @code{frsqrte.@{s/d@}} +instructions. When build with @option{-march=la664}, it is enabled by default. +The default is @option{-mno-frecipe}. + +@opindex mdiv32 +@opindex mno-div32 +@item -mdiv32 +@itemx -mno-div32 +Use (do not use) @code{div.w[u]} and @code{mod.w[u]} instructions with input +not sign-extended. When build with @option{-march=la664}, it is enabled by +default. The default is @option{-mno-div32}. + +@opindex mlam-bh +@opindex mno-lam-bh +@item -mlam-bh +@itemx -mno-lam-bh +Use (do not use) @code{am@{swap/add@}[_db].@{b/h@}} instructions. When build +with @option{-march=la664}, it is enabled by default. The default is +@option{-mno-lam-bh}. + +@opindex mlamcas +@opindex mno-lamcas +@item -mlamcas +@itemx -mno-lamcas +Use (do not use) @code{amcas[_db].@{b/h/w/d@}} instructions. When build with +@option{-march=la664}, it is enabled by default. The default is +@option{-mno-lamcas}. + +@opindex mld-seq-sa +@opindex mno-ld-seq-sa +@item -mld-seq-sa +@itemx -mno-ld-seq-sa +Whether a load-load barrier (@code{dbar 0x700}) is needed. When build with +@option{-march=la664}, it is enabled by default. The default is +@option{-mno-ld-seq-sa}, the load-load barrier is needed. + @item loongarch-vect-unroll-limit The vectorizer will use available tuning information to determine whether it would be beneficial to unroll the main vectorized loop and by how much. This -- 2.39.3
[Patch, fortran] PR112407 - [13/14 Regression] Fix for PR37336 triggers an ICE in gfc_format_decoder while constructing a vtab
Hi All, This bug emerged in a large code and involves possible recursion with a "hidden" module procedure; ie. where the symtree name starts with '@'. This throws the format decoder. As the last message in the PR shows, I have vacillated between silently passing on the possible recursion or adding an alternative warning message. In the end, as a conservative choice I went for emitting the message. In the course of trying to develop a compact test case, I found that type bound procedures were not being tested for recursion and that class dummies, with intent out, were being incorrectly initialized with an empty default initializer. Both of these have been fixed. Unfortunately, the most compact reproducer that Tomas was able to come up with required more than 100kbytes of module files. I tried from the bottom up but failed. Both the tests check the fixes for the other bugs. Regtests on x86_64 - OK for mainline and, in a couple of weeks, 13-branch? Paul Fortran: Fix wrong recursive errors and class initialization [PR112407] 2024-03-30 Paul Thomas gcc/fortran PR fortran/112407 *resolve.cc (resolve_procedure_expression): Change the test for for recursion in the case of hidden procedures from modules. (resolve_typebound_static): Add warning for possible recursive calls to typebound procedures. * trans-expr.cc (gfc_trans_class_init_assign): Do not apply default initializer to class dummy where component initializers are all null. gcc/testsuite/ PR fortran/112407 * gfortran.dg/pr112407a.f90: New test. * gfortran.dg/pr112407b.f90: New test. diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc index 50d51b06c92..43315a6a550 100644 --- a/gcc/fortran/resolve.cc +++ b/gcc/fortran/resolve.cc @@ -1963,12 +1963,20 @@ resolve_procedure_expression (gfc_expr* expr) || (sym->attr.function && sym->result == sym)) return true; - /* A non-RECURSIVE procedure that is used as procedure expression within its + /* A non-RECURSIVE procedure that is used as procedure expression within its own body is in danger of being called recursively. */ if (is_illegal_recursion (sym, gfc_current_ns)) -gfc_warning (0, "Non-RECURSIVE procedure %qs at %L is possibly calling" - " itself recursively. Declare it RECURSIVE or use" - " %<-frecursive%>", sym->name, &expr->where); +{ + if (sym->attr.use_assoc && expr->symtree->name[0] == '@') + gfc_warning (0, "Non-RECURSIVE procedure %qs from module %qs is " + " possibly calling itself recursively in procedure %qs. " + " Declare it RECURSIVE or use %<-frecursive%>", + sym->name, sym->module, gfc_current_ns->proc_name->name); + else + gfc_warning (0, "Non-RECURSIVE procedure %qs at %L is possibly calling" + " itself recursively. Declare it RECURSIVE or use" + " %<-frecursive%>", sym->name, &expr->where); +} return true; } @@ -6820,6 +6828,13 @@ resolve_typebound_static (gfc_expr* e, gfc_symtree** target, if (st) *target = st; } + + if (is_illegal_recursion ((*target)->n.sym, gfc_current_ns) + && !e->value.compcall.tbp->deferred) +gfc_warning (0, "Non-RECURSIVE procedure %qs at %L is possibly calling" + " itself recursively. Declare it RECURSIVE or use" + " %<-frecursive%>", (*target)->n.sym->name, &e->where); + return true; } diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc index 76bed9830c4..3b54874cf1f 100644 --- a/gcc/fortran/trans-expr.cc +++ b/gcc/fortran/trans-expr.cc @@ -1719,6 +1719,7 @@ gfc_trans_class_init_assign (gfc_code *code) tree tmp; gfc_se dst,src,memsz; gfc_expr *lhs, *rhs, *sz; + gfc_component *cmp; gfc_start_block (&block); @@ -1735,6 +1736,21 @@ gfc_trans_class_init_assign (gfc_code *code) /* The _def_init is always scalar. */ rhs->rank = 0; + /* Check def_init for initializers. If this is a dummy with all default + initializer components NULL, return NULL_TREE and use the passed value as + required by F2018(8.5.10). */ + if (!lhs->ref && lhs->symtree->n.sym->attr.dummy) +{ + cmp = rhs->ref->next->u.c.component->ts.u.derived->components; + for (; cmp; cmp = cmp->next) + { + if (cmp->initializer) + break; + else if (!cmp->next) + return build_empty_stmt (input_location); + } +} + if (code->expr1->ts.type == BT_CLASS && CLASS_DATA (code->expr1)->attr.dimension) { @@ -12511,11 +12527,14 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag, gfc_add_block_to_block (&body, &lse.pre); gfc_add_expr_to_block (&body, tmp); - /* Add the post blocks to the body. */ - if (!l_is_temp) + /* Add the post blocks to the body. Scalar finalization must appear before + the post block in case any dellocations are done. */ + if (rse.finalblock.head + && (!l_is_temp || (expr2->expr_type == EXPR_FUNCTION + && gfc_expr_attr (expr2).elemental))) { - gfc_add_block_to_block (&rse.finalblock, &rse.post);
Re: [PATCH v4] LoongArch: Split loongarch_option_override_internal into smaller procedures
v1 -> v2: - Rebased to master. - Specifies "(void)" for the empty parameter list of loongarch_global_init. v2 -> v3: - Keep the original option-processing behavior (-march=la664 enables -mrecip=all) and fix the ICE when -mfrecipe is not passed with -mrecip. v3 -> v4: - Rewrite changelog.
[PATCH v4] LoongArch: Split loongarch_option_override_internal into smaller procedures
gcc/ChangeLog: * config/loongarch/genopts/loongarch.opt.in: Mark -m[no-]recip as aliases to -mrecip={all,none}, respectively. * config/loongarch/loongarch.opt: Regenerate. * config/loongarch/loongarch-def.h (ABI_FPU_64): Rename to... (ABI_FPU64_P): ...this. (ABI_FPU_32): Rename to... (ABI_FPU32_P): ...this. (ABI_FPU_NONE): Rename to... (ABI_NOFPU_P): ...this. (ABI_LP64_P): Define. * config/loongarch/loongarch.cc (loongarch_init_print_operand_punct): Merged into loongarch_global_init. (loongarch_cpu_option_override): Renamed to loongarch_target_option_override. (loongarch_option_override_internal): Move the work after loongarch_config_target into loongarch_target_option_override. (loongarch_global_init): Define. (INIT_TARGET_FLAG): Move to loongarch-opts.cc. (loongarch_option_override): Call loongarch_global_init separately. * config/loongarch/loongarch-opts.cc (loongarch_parse_mrecip_scheme): Split the parsing of -mrecip= from loongarch_option_override_internal. (loongarch_generate_mrecip_scheme): Define. Split from loongarch_option_override_internal. (loongarch_target_option_override): Define. Renamed from loongarch_cpu_option_override. (loongarch_init_misc_options): Define. Split from loongarch_option_override_internal. (INIT_TARGET_FLAG): Move from loongarch.cc. * config/loongarch/loongarch-opts.h (loongarch_target_option_override): New prototype. (loongarch_parse_mrecip_scheme): New prototype. (loongarch_init_misc_options): New prototype. (TARGET_ABI_LP64): Simplify with ABI_LP64_P. * config/loongarch/loongarch.h (TARGET_RECIP_DIV): Simplify. Do not reference specific CPU architecture (LA664). (TARGET_RECIP_SQRT): Same. (TARGET_RECIP_RSQRT): Same. (TARGET_RECIP_VEC_DIV): Same. (TARGET_RECIP_VEC_SQRT): Same. (TARGET_RECIP_VEC_RSQRT): Same. --- gcc/config/loongarch/genopts/loongarch.opt.in | 8 +- gcc/config/loongarch/loongarch-def.h | 11 +- gcc/config/loongarch/loongarch-opts.cc| 253 ++ gcc/config/loongarch/loongarch-opts.h | 27 +- gcc/config/loongarch/loongarch.cc | 253 +++--- gcc/config/loongarch/loongarch.h | 18 +- gcc/config/loongarch/loongarch.opt| 8 +- 7 files changed, 342 insertions(+), 236 deletions(-) diff --git a/gcc/config/loongarch/genopts/loongarch.opt.in b/gcc/config/loongarch/genopts/loongarch.opt.in index 02f918053f5..a77893d31d9 100644 --- a/gcc/config/loongarch/genopts/loongarch.opt.in +++ b/gcc/config/loongarch/genopts/loongarch.opt.in @@ -197,14 +197,14 @@ mexplicit-relocs Target Alias(mexplicit-relocs=, always, none) Use %reloc() assembly operators (for backward compatibility). -mrecip -Target RejectNegative Var(la_recip) Save -Generate approximate reciprocal divide and square root for better throughput. - mrecip= Target RejectNegative Joined Var(la_recip_name) Save Control generation of reciprocal estimates. +mrecip +Target Alias(mrecip=, all, none) +Generate approximate reciprocal divide and square root for better throughput. + ; The code model option names for -mcmodel. Enum Name(cmodel) Type(int) diff --git a/gcc/config/loongarch/loongarch-def.h b/gcc/config/loongarch/loongarch-def.h index 2dbf006d013..0cbf9476690 100644 --- a/gcc/config/loongarch/loongarch-def.h +++ b/gcc/config/loongarch/loongarch-def.h @@ -90,11 +90,16 @@ extern loongarch_def_array #define TO_LP64_ABI_BASE(C) (C) -#define ABI_FPU_64(abi_base) \ +#define ABI_LP64_P(abi_base) \ + (abi_base == ABI_BASE_LP64D \ + || abi_base == ABI_BASE_LP64F \ + || abi_base == ABI_BASE_LP64S) + +#define ABI_FPU64_P(abi_base) \ (abi_base == ABI_BASE_LP64D) -#define ABI_FPU_32(abi_base) \ +#define ABI_FPU32_P(abi_base) \ (abi_base == ABI_BASE_LP64F) -#define ABI_FPU_NONE(abi_base) \ +#define ABI_NOFPU_P(abi_base) \ (abi_base == ABI_BASE_LP64S) diff --git a/gcc/config/loongarch/loongarch-opts.cc b/gcc/config/loongarch/loongarch-opts.cc index 627f9148adf..e600f08f03b 100644 --- a/gcc/config/loongarch/loongarch-opts.cc +++ b/gcc/config/loongarch/loongarch-opts.cc @@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see #include "coretypes.h" #include "tm.h" #include "obstack.h" +#include "opts.h" #include "diagnostic-core.h" #include "loongarch-cpu.h" @@ -32,8 +33,12 @@ along with GCC; see the file COPYING3. If not see #include "loongarch-str.h" #include "loongarch-def.h" +/* Target configuration */ struct loongarch_target la_target; +/* RTL cost information */ +const struct loongarch_rtx_cost_data *loongarch_cost; + /* ABI-related configuration. */ #define ABI_COUNT (sizeof(abi_priority_list)/sizeof(struct loongarch_abi)) static co
[PATCH] RISC-V: Fix misspelled term builtin in error message
From: Pan Li This patch would like to fix below misspelled term in error message. ../../gcc/config/riscv/riscv-vector-builtins.cc:4592:16: error: misspelled term 'builtin function' in format; use 'built-in function' instead [-Werror=format-diag] 4592 | "builtin function %qE requires the V ISA extension", exp); The below tests are passed for this patch. * The riscv regression test on rvv.exp and riscv.exp. gcc/ChangeLog: * config/riscv/riscv-vector-builtins.cc (expand_builtin): Take the term built-in over builtin. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-7.c: Adjust test dg-error. * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-8.c: Ditto. Signed-off-by: Pan Li --- gcc/config/riscv/riscv-vector-builtins.cc | 2 +- .../riscv/rvv/base/target_attribute_v_with_intrinsic-7.c| 2 +- .../riscv/rvv/base/target_attribute_v_with_intrinsic-8.c| 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/config/riscv/riscv-vector-builtins.cc b/gcc/config/riscv/riscv-vector-builtins.cc index e07373d8b57..db9246eed2d 100644 --- a/gcc/config/riscv/riscv-vector-builtins.cc +++ b/gcc/config/riscv/riscv-vector-builtins.cc @@ -4589,7 +4589,7 @@ expand_builtin (unsigned int code, tree exp, rtx target) if (!TARGET_VECTOR) error_at (EXPR_LOCATION (exp), - "builtin function %qE requires the V ISA extension", exp); + "built-in function %qE requires the V ISA extension", exp); return function_expander (rfn.instance, rfn.decl, exp, target).expand (); } diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-7.c b/gcc/testsuite/gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-7.c index 520b2e59fae..a4cd67f4f95 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-7.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-7.c @@ -5,5 +5,5 @@ size_t test_1 (size_t vl) { - return __riscv_vsetvl_e8m4 (vl); /* { dg-error {builtin function '__riscv_vsetvl_e8m4\(vl\)' requires the V ISA extension} } */ + return __riscv_vsetvl_e8m4 (vl); /* { dg-error {built-in function '__riscv_vsetvl_e8m4\(vl\)' requires the V ISA extension} } */ } diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-8.c b/gcc/testsuite/gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-8.c index 9032d9d0b43..06ed9a9eddc 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-8.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-8.c @@ -19,5 +19,5 @@ test_2 () size_t test_3 (size_t vl) { - return __riscv_vsetvl_e8m4 (vl); /* { dg-error {builtin function '__riscv_vsetvl_e8m4\(vl\)' requires the V ISA extension} } */ + return __riscv_vsetvl_e8m4 (vl); /* { dg-error {built-in function '__riscv_vsetvl_e8m4\(vl\)' requires the V ISA extension} } */ } -- 2.34.1
Re: [PATCH 1/2] modula2: Add m2.install-html rule to gcc/m2/Make-lang.in
Christophe Lyon writes: > This rule was missing, and 'make install-html' was failing. > It is copied from the corresponding one in fortran. > > 2024-03-29 Christophe Lyon > > gcc/m2/ > * Make-lang.in (install-html): New rule. > --- > gcc/m2/Make-lang.in | 19 +++ > 1 file changed, 19 insertions(+) > > diff --git a/gcc/m2/Make-lang.in b/gcc/m2/Make-lang.in > index ef6990ce617..2d8a47a1b1f 100644 > --- a/gcc/m2/Make-lang.in > +++ b/gcc/m2/Make-lang.in > @@ -206,6 +206,25 @@ $(build_htmldir)/m2/index.html: $(TEXISRC) > $(objdir)/m2/images/gnu.eps > rm -f $(@D)/* > $(TEXI2HTML) -I $(objdir)/m2 -I $(srcdir)/m2 -I $(gcc_docdir)/include > -o $(@D) $< > > +M2_HTMLFILES = $(build_htmldir)/m2 > + > +m2.install-html: $(M2_HTMLFILES) > + @$(NORMAL_INSTALL) > + test -z "$(htmldir)" || $(mkinstalldirs) "$(DESTDIR)$(htmldir)" > + @list='$(M2_HTMLFILES)'; for p in $$list; do \ > + if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; > fi; \ > + f=$(html__strip_dir) \ > + if test -d "$$d$$p"; then \ > + echo " $(mkinstalldirs) '$(DESTDIR)$(htmldir)/$$f'"; \ > + $(mkinstalldirs) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ > + echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \ > + $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \ > + else \ > + echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \ > + $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \ > + fi; \ > + done > + > # gm2-libs.texi > > m2/gm2-libs.texi: gm2-libs.texi-check; @true lgtm, many thanks for the fix, regards, Gaius
Re: [PATCH 2/2] modula2: Fix m2.install-info in gcc/m2/Make-lang.in
Christophe Lyon writes: > Fix a few typos: the generated filename is m2.info (not gm2.info, and > gm2$(exeext) is a file not a directory (so test -d would always fail). > > 2024-03-29 Christophe Lyon > > gcc/m2/ > * Make-lang.in (m2.install-info): Fix rule. > --- > gcc/m2/Make-lang.in | 14 +++--- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/gcc/m2/Make-lang.in b/gcc/m2/Make-lang.in > index 2d8a47a1b1f..e56240b4c44 100644 > --- a/gcc/m2/Make-lang.in > +++ b/gcc/m2/Make-lang.in > @@ -400,20 +400,20 @@ m2.install-common: installdirs > done > > m2.install-info: installdirs > - if [ -d gm2$(exeext) ] ; then \ > - if [ -f $(objdir)/doc/gm2.info ]; then \ > - rm -f $(DESTDIR)$(infodir)/gm2.info*; \ > - for f in $(objdir)/doc/gm2.info*; do \ > + if [ -f gm2$(exeext) ] ; then \ > + if [ -f $(objdir)/doc/m2.info ]; then \ > + rm -f $(DESTDIR)$(infodir)/m2.info*; \ > + for f in $(objdir)/doc/m2.info*; do \ > realfile=`echo $$f | sed -e 's|.*/\([^/]*\)$$|\1|'`; \ >rm -f $(DESTDIR)$(infodir)/`basename $$realfile`; \ > $(INSTALL_DATA) $$f $(DESTDIR)$(infodir)/`basename $$realfile`; \ > done; \ > - chmod a-x $(DESTDIR)$(infodir)/gm2.info*; \ > + chmod a-x $(DESTDIR)$(infodir)/m2.info*; \ > else true; fi; \ > else true; fi > - -if [ -f gm2$(exeext) ] && [ -f $(DESTDIR)$(infodir)/gm2.info ]; then \ > + -if [ -f gm2$(exeext) ] && [ -f $(DESTDIR)$(infodir)/m2.info ]; then \ > if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \ > - install-info --dir-file=$(infodir)/dir > $(DESTDIR)$(infodir)/gm2.info; \ > + install-info --dir-file=$(infodir)/dir > $(DESTDIR)$(infodir)/m2.info; \ > else true; fi; \ > else true; fi lgtm, many thanks for spotting these bugs, regards, Gaius
Re: [PATCH v2] RISC-V: Bugfix ICE for __attribute__((target("arch=+v"))
../../gcc/common/config/riscv/riscv-common.cc: In static member function 'static riscv_subset_list* riscv_subset_list::parse(const char*, location_t)': ../../gcc/common/config/riscv/riscv-common.cc:1501:19: error: unused variable 'itr' [-Werror=unused-variable] 1501 | riscv_subset_t *itr; | ^~~ cc1plus: all warnings being treated as errors make[3]: *** [Makefile:2563: riscv-common.o] Error 1 -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."
[PATCH] RISC-V: Fix one unused varable in riscv_subset_list::parse
From: Pan Li This patch would like to fix one unused variable as below: ../../gcc/common/config/riscv/riscv-common.cc: In static member function 'static riscv_subset_list* riscv_subset_list::parse(const char*, location_t)': ../../gcc/common/config/riscv/riscv-common.cc:1501:19: error: unused variable 'itr' [-Werror=unused-variable] 1501 | riscv_subset_t *itr; The variable consume code was removed but missed the var itself in previous. Thus, we have unused variable here. gcc/ChangeLog: * common/config/riscv/riscv-common.cc (riscv_subset_list::parse): Remove unused var decl. Signed-off-by: Pan Li --- gcc/common/config/riscv/riscv-common.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc index 7095f303cbb..43b7549e3ec 100644 --- a/gcc/common/config/riscv/riscv-common.cc +++ b/gcc/common/config/riscv/riscv-common.cc @@ -1498,7 +1498,6 @@ riscv_subset_list::parse (const char *arch, location_t loc) return NULL; riscv_subset_list *subset_list = new riscv_subset_list (arch, loc); - riscv_subset_t *itr; const char *p = arch; p = subset_list->parse_base_ext (p); if (p == NULL) -- 2.34.1
Re: [PATCH v8 0/5] New attribute "counted_by" to annotate bounds for C99 FAM(PR108896)
On Fri, Mar 29, 2024 at 04:06:58PM +, Qing Zhao wrote: > This is the 8th version of the patch. Thanks for the updated version! I've done a full Linux kernel build and run through my behavioral regression test suite. Everything is working as expected. -Kees -- Kees Cook
Re: [Patch, fortran] PR112407 - [13/14 Regression] Fix for PR37336 triggers an ICE in gfc_format_decoder while constructing a vtab
Hi Paul, I had only a quick glance at your patch. I guess you unintentionally forgot to remove those parts that you already committed for PR110987, along with the finalize-testcases. I am still trying to find the precise paragraph in the standard you refer to regarding INTENT(OUT) and default initialization. While at it, I think I found a minor nit in testcase pr112407a.f90: component x%i appears undefined the first time it is printed. This can be verified by either adding an explicit x% i = -42 in the main after the allocate(x). Alternatively, running the code with Intel and using MALLOC_PERTURB_ shows a random arg1%i, but is otherwise fine. However, if by chance (random memory) x% i = +42 then the test would likely fail everywhere. Cheers, Harald Am 30.03.24 um 10:06 schrieb Paul Richard Thomas: Hi All, This bug emerged in a large code and involves possible recursion with a "hidden" module procedure; ie. where the symtree name starts with '@'. This throws the format decoder. As the last message in the PR shows, I have vacillated between silently passing on the possible recursion or adding an alternative warning message. In the end, as a conservative choice I went for emitting the message. In the course of trying to develop a compact test case, I found that type bound procedures were not being tested for recursion and that class dummies, with intent out, were being incorrectly initialized with an empty default initializer. Both of these have been fixed. Unfortunately, the most compact reproducer that Tomas was able to come up with required more than 100kbytes of module files. I tried from the bottom up but failed. Both the tests check the fixes for the other bugs. Regtests on x86_64 - OK for mainline and, in a couple of weeks, 13-branch? Paul Fortran: Fix wrong recursive errors and class initialization [PR112407] 2024-03-30 Paul Thomas gcc/fortran PR fortran/112407 *resolve.cc (resolve_procedure_expression): Change the test for for recursion in the case of hidden procedures from modules. (resolve_typebound_static): Add warning for possible recursive calls to typebound procedures. * trans-expr.cc (gfc_trans_class_init_assign): Do not apply default initializer to class dummy where component initializers are all null. gcc/testsuite/ PR fortran/112407 * gfortran.dg/pr112407a.f90: New test. * gfortran.dg/pr112407b.f90: New test.
[PATCH] libiberty: Invoke D demangler when --format=auto
Investigating GDB PR d/31580 showed that the libiberty demangler doesn't automatically demangle D mangled names. However, I think it should -- like C++ and Rust (new-style), D mangled names are readily distinguished by the leading "_D", and so the likelihood of confusion is low. The other non-"auto" cases in this code are Ada (where the encoded form could more easily be confused by ordinary programs) and Java (which is long gone, but which also shared the C++ mangling and thus was just an output style preference). This patch also fixed another GDB bug, though of course that part won't apply to the GCC repository. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31580 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30276 libiberty * cplus-dem.c (cplus_demangle): Try the D demangler with "auto" format. * testsuite/d-demangle-expected: Add --format=auto test. --- gdb/testsuite/gdb.dlang/dlang-start-2.exp | 4 +--- libiberty/cplus-dem.c | 2 +- libiberty/testsuite/d-demangle-expected | 5 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/gdb/testsuite/gdb.dlang/dlang-start-2.exp b/gdb/testsuite/gdb.dlang/dlang-start-2.exp index 4b3163ec97d..284f841b54a 100644 --- a/gdb/testsuite/gdb.dlang/dlang-start-2.exp +++ b/gdb/testsuite/gdb.dlang/dlang-start-2.exp @@ -79,10 +79,8 @@ if {[gdb_start_cmd] < 0} { return -1 } -# We should probably have "D main" instead of "_Dmain" here, filed PR30276 -# '[gdb/symtab] function name is _Dmain instead of "D main"' about that. gdb_test "" \ -"in _Dmain \\(\\)" \ +"in D main \\(\\)" \ "start" gdb_test "show language" {"auto; currently d".} diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c index 8b92946981f..ee9e84f5d6b 100644 --- a/libiberty/cplus-dem.c +++ b/libiberty/cplus-dem.c @@ -186,7 +186,7 @@ cplus_demangle (const char *mangled, int options) if (GNAT_DEMANGLING) return ada_demangle (mangled, options); - if (DLANG_DEMANGLING) + if (DLANG_DEMANGLING || AUTO_DEMANGLING) { ret = dlang_demangle (mangled, options); if (ret) diff --git a/libiberty/testsuite/d-demangle-expected b/libiberty/testsuite/d-demangle-expected index 47b059c4298..cfbdf2a52cb 100644 --- a/libiberty/testsuite/d-demangle-expected +++ b/libiberty/testsuite/d-demangle-expected @@ -1470,3 +1470,8 @@ demangle.anonymous --format=dlang _D8demangle9anonymous03fooZ demangle.anonymous.foo +# +# Test that 'auto' works. +--format=auto +_D8demangle9anonymous03fooZ +demangle.anonymous.foo -- 2.43.0
Re: [PATCH] RISC-V: Fix one unused varable in riscv_subset_list::parse
LGTM On Sat, Mar 30, 2024 at 9:35 PM wrote: > > From: Pan Li > > This patch would like to fix one unused variable as below: > > ../../gcc/common/config/riscv/riscv-common.cc: In static member function > 'static riscv_subset_list* riscv_subset_list::parse(const char*, location_t)': > ../../gcc/common/config/riscv/riscv-common.cc:1501:19: error: unused variable > 'itr' > [-Werror=unused-variable] > 1501 | riscv_subset_t *itr; > > The variable consume code was removed but missed the var itself in > previous. Thus, we have unused variable here. > > gcc/ChangeLog: > > * common/config/riscv/riscv-common.cc (riscv_subset_list::parse): > Remove unused var decl. > > Signed-off-by: Pan Li > --- > gcc/common/config/riscv/riscv-common.cc | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/gcc/common/config/riscv/riscv-common.cc > b/gcc/common/config/riscv/riscv-common.cc > index 7095f303cbb..43b7549e3ec 100644 > --- a/gcc/common/config/riscv/riscv-common.cc > +++ b/gcc/common/config/riscv/riscv-common.cc > @@ -1498,7 +1498,6 @@ riscv_subset_list::parse (const char *arch, location_t > loc) > return NULL; > >riscv_subset_list *subset_list = new riscv_subset_list (arch, loc); > - riscv_subset_t *itr; >const char *p = arch; >p = subset_list->parse_base_ext (p); >if (p == NULL) > -- > 2.34.1 >
Re: [PATCH] RISC-V: Fix misspelled term builtin in error message
lgtm On Sat, Mar 30, 2024 at 8:07 PM wrote: > > From: Pan Li > > This patch would like to fix below misspelled term in error message. > > ../../gcc/config/riscv/riscv-vector-builtins.cc:4592:16: error: > misspelled term 'builtin function' in format; use 'built-in function' instead > [-Werror=format-diag] > 4592 | "builtin function %qE requires the V ISA extension", > exp); > > The below tests are passed for this patch. > * The riscv regression test on rvv.exp and riscv.exp. > > gcc/ChangeLog: > > * config/riscv/riscv-vector-builtins.cc (expand_builtin): Take > the term built-in over builtin. > > gcc/testsuite/ChangeLog: > > * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-7.c: > Adjust test dg-error. > * gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-8.c: > Ditto. > > Signed-off-by: Pan Li > --- > gcc/config/riscv/riscv-vector-builtins.cc | 2 +- > .../riscv/rvv/base/target_attribute_v_with_intrinsic-7.c| 2 +- > .../riscv/rvv/base/target_attribute_v_with_intrinsic-8.c| 2 +- > 3 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/gcc/config/riscv/riscv-vector-builtins.cc > b/gcc/config/riscv/riscv-vector-builtins.cc > index e07373d8b57..db9246eed2d 100644 > --- a/gcc/config/riscv/riscv-vector-builtins.cc > +++ b/gcc/config/riscv/riscv-vector-builtins.cc > @@ -4589,7 +4589,7 @@ expand_builtin (unsigned int code, tree exp, rtx target) > >if (!TARGET_VECTOR) > error_at (EXPR_LOCATION (exp), > - "builtin function %qE requires the V ISA extension", exp); > + "built-in function %qE requires the V ISA extension", exp); > >return function_expander (rfn.instance, rfn.decl, exp, target).expand (); > } > diff --git > a/gcc/testsuite/gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-7.c > > b/gcc/testsuite/gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-7.c > index 520b2e59fae..a4cd67f4f95 100644 > --- > a/gcc/testsuite/gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-7.c > +++ > b/gcc/testsuite/gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-7.c > @@ -5,5 +5,5 @@ > > size_t test_1 (size_t vl) > { > - return __riscv_vsetvl_e8m4 (vl); /* { dg-error {builtin function > '__riscv_vsetvl_e8m4\(vl\)' requires the V ISA extension} } */ > + return __riscv_vsetvl_e8m4 (vl); /* { dg-error {built-in function > '__riscv_vsetvl_e8m4\(vl\)' requires the V ISA extension} } */ > } > diff --git > a/gcc/testsuite/gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-8.c > > b/gcc/testsuite/gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-8.c > index 9032d9d0b43..06ed9a9eddc 100644 > --- > a/gcc/testsuite/gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-8.c > +++ > b/gcc/testsuite/gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-8.c > @@ -19,5 +19,5 @@ test_2 () > size_t > test_3 (size_t vl) > { > - return __riscv_vsetvl_e8m4 (vl); /* { dg-error {builtin function > '__riscv_vsetvl_e8m4\(vl\)' requires the V ISA extension} } */ > + return __riscv_vsetvl_e8m4 (vl); /* { dg-error {built-in function > '__riscv_vsetvl_e8m4\(vl\)' requires the V ISA extension} } */ > } > -- > 2.34.1 >
[PATCH] Simplify \r handling
Simplify \r checking with regex globs. Signed-off-by: Jonathan Yong <10wa...@gmail.com> gcc/testsuite * g++.dg/contracts/contracts14.C: simplify \r regex. * g++.dg/contracts/contracts15.C: ditto * g++.dg/contracts/contracts16.C: ditto * g++.dg/coroutines/torture/mid-suspend-destruction-0.C: ditto --- gcc/testsuite/g++.dg/contracts/contracts14.C | 12 ++-- gcc/testsuite/g++.dg/contracts/contracts15.C | 8 gcc/testsuite/g++.dg/contracts/contracts16.C | 4 ++-- .../coroutines/torture/mid-suspend-destruction-0.C | 8 4 files changed, 16 insertions(+), 16 deletions(-) Attached patch Okay?From b64524632e236b2476d5eced8315c2ba8bece315 Mon Sep 17 00:00:00 2001 From: Jonathan Yong <10wa...@gmail.com> Date: Sun, 11 Feb 2024 09:26:20 + Subject: [PATCH] Simplify \r handling Simplify \r checking with regex globs. Signed-off-by: Jonathan Yong <10wa...@gmail.com> gcc/testsuite * g++.dg/contracts/contracts14.C: simplify \r regex. * g++.dg/contracts/contracts15.C: ditto * g++.dg/contracts/contracts16.C: ditto * g++.dg/coroutines/torture/mid-suspend-destruction-0.C: ditto --- gcc/testsuite/g++.dg/contracts/contracts14.C | 12 ++-- gcc/testsuite/g++.dg/contracts/contracts15.C | 8 gcc/testsuite/g++.dg/contracts/contracts16.C | 4 ++-- .../coroutines/torture/mid-suspend-destruction-0.C | 8 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/gcc/testsuite/g++.dg/contracts/contracts14.C b/gcc/testsuite/g++.dg/contracts/contracts14.C index d9156d6875d..fb2884b8cb2 100644 --- a/gcc/testsuite/g++.dg/contracts/contracts14.C +++ b/gcc/testsuite/g++.dg/contracts/contracts14.C @@ -48,11 +48,11 @@ int main(int, char**) { return 0; } -// { dg-output "custom std::handle_contract_violation called: 30 .*/contracts14.C(\n|\r\n|\r)" } -// { dg-output "synth caught direct: -30(\n|\r\n|\r)" } -// { dg-output "custom std::handle_contract_violation called: 18 .*/contracts14.C(\n|\r\n|\r)" } -// { dg-output "synth caught indirect: -18(\n|\r\n|\r)" } -// { dg-output "custom std::handle_contract_violation called: 18 .*/contracts14.C(\n|\r\n|\r)" } -// { dg-output "synth caught double indirect: -18(\n|\r\n|\r)" } +// { dg-output "custom std::handle_contract_violation called: 30 .*/contracts14.C\r*\n+" } +// { dg-output "synth caught direct: -30\r*\n+" } +// { dg-output "custom std::handle_contract_violation called: 18 .*/contracts14.C\r*\n+" } +// { dg-output "synth caught indirect: -18\r*\n+" } +// { dg-output "custom std::handle_contract_violation called: 18 .*/contracts14.C\r*\n+" } +// { dg-output "synth caught double indirect: -18\r*\n+" } // { dg-output "end main" } diff --git a/gcc/testsuite/g++.dg/contracts/contracts15.C b/gcc/testsuite/g++.dg/contracts/contracts15.C index ef52a0e67f0..58db940518a 100644 --- a/gcc/testsuite/g++.dg/contracts/contracts15.C +++ b/gcc/testsuite/g++.dg/contracts/contracts15.C @@ -48,9 +48,9 @@ int main(int, char**) { return 0; } -// { dg-output "custom std::handle_contract_violation called: 30 .*/contracts15.C(\n|\r\n|\r)" } -// { dg-output "synth caught direct: -30(\n|\r\n|\r)" } -// { dg-output "custom std::handle_contract_violation called: 18 .*/contracts15.C(\n|\r\n|\r)" } -// { dg-output "terminate called after throwing an instance of .int.(\n|\r\n|\r)" } +// { dg-output "custom std::handle_contract_violation called: 30 .*/contracts15.C\r*\n+" } +// { dg-output "synth caught direct: -30\r*\n+" } +// { dg-output "custom std::handle_contract_violation called: 18 .*/contracts15.C\r*\n+" } +// { dg-output "terminate called after throwing an instance of .int.\r*\n+" } // { dg-shouldfail "throwing in noexcept" } diff --git a/gcc/testsuite/g++.dg/contracts/contracts16.C b/gcc/testsuite/g++.dg/contracts/contracts16.C index 5d58ab8eaa1..9e1688ba51b 100644 --- a/gcc/testsuite/g++.dg/contracts/contracts16.C +++ b/gcc/testsuite/g++.dg/contracts/contracts16.C @@ -29,6 +29,6 @@ int main(int, char**) { return 0; } -// { dg-output "custom std::handle_contract_violation called: 18 .*/contracts16.C(\n|\r\n|\r)" } -// { dg-output "synth caught indirect: -18(\n|\r\n|\r)" } +// { dg-output "custom std::handle_contract_violation called: 18 .*/contracts16.C\r*\n+" } +// { dg-output "synth caught indirect: -18\r*\n+" } diff --git a/gcc/testsuite/g++.dg/coroutines/torture/mid-suspend-destruction-0.C b/gcc/testsuite/g++.dg/coroutines/torture/mid-suspend-destruction-0.C index 0cbf93ad8af..00d6d58c3b1 100644 --- a/gcc/testsuite/g++.dg/coroutines/torture/mid-suspend-destruction-0.C +++ b/gcc/testsuite/g++.dg/coroutines/torture/mid-suspend-destruction-0.C @@ -1,8 +1,8 @@ // { dg-do run } -// { dg-output "main: returning(\n|\r\n|\r)" } -// { dg-output "Destroyed coro1(\n|\r\n|\r)" } -// { dg-output "Destroyed suspend_always_prt(\n|\r\n|\r)" } -// { dg-output "Destroyed Promise(\n|\r\n|\r)" } +// { dg-output "main: returning\r*\n+" }