[PATCH] Add rocketlake to gcc.
Hi Uros, This patch is about to add Rocket Lake to GCC. Rocket Lake is based on Ice Lake client and minus SGX. For detailed information, please refer to https://software.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html Bootstrap is ok, and no regressions for i386/x86-64 testsuite. OK for master? [PATCH] Add rocketlake to gcc. gcc/ * common/config/i386/cpuinfo.h (get_intel_cpu): Handle rocketlake. * common/config/i386/i386-common.c (processor_names): Add rocketlake. (processor_alias_table): Add rocketlake. * common/config/i386/i386-cpuinfo.h (processor_subtypes): Add INTEL_COREI7_ROCKETLAKE. * config.gcc: Add -march=rocketlake. * config/i386/i386-c.c (ix86_target_macros_internal): Handle rocketlake. * config/i386/i386-options.c (m_ROCKETLAKE) : Define. (processor_cost_table): Add rocketlake cost. * config/i386/i386.h (ix86_size_cost) : Define TARGET_ROCKETLAKE. (processor_type) : Add PROCESSOR_ROCKETLAKE. (PTA_ROCKETLAKE): Ditto. * doc/extend.texi: Add rocketlake. * doc/invoke.texi: Add rocketlake. gcc/testsuite/ * gcc.target/i386/funcspec-56.inc: Handle new march. * g++.target/i386/mv16.C: Handle new march --- gcc/common/config/i386/cpuinfo.h | 10 -- gcc/common/config/i386/i386-common.c | 4 gcc/common/config/i386/i386-cpuinfo.h | 1 + gcc/config.gcc| 2 +- gcc/config/i386/i386-c.c | 7 +++ gcc/config/i386/i386-options.c| 5 - gcc/config/i386/i386.h| 3 +++ gcc/doc/extend.texi | 3 +++ gcc/doc/invoke.texi | 8 gcc/testsuite/g++.target/i386/mv16.C | 6 ++ gcc/testsuite/gcc.target/i386/funcspec-56.inc | 1 + 11 files changed, 46 insertions(+), 4 deletions(-) diff --git a/gcc/common/config/i386/cpuinfo.h b/gcc/common/config/i386/cpuinfo.h index c1ee7a1f8b8..458f41de776 100644 --- a/gcc/common/config/i386/cpuinfo.h +++ b/gcc/common/config/i386/cpuinfo.h @@ -404,14 +404,20 @@ get_intel_cpu (struct __processor_model *cpu_model, case 0xa5: case 0xa6: /* Comet Lake. */ -case 0xa7: - /* Rocket Lake. */ cpu = "skylake"; CHECK___builtin_cpu_is ("corei7"); CHECK___builtin_cpu_is ("skylake"); cpu_model->__cpu_type = INTEL_COREI7; cpu_model->__cpu_subtype = INTEL_COREI7_SKYLAKE; break; +case 0xa7: + /* Rocket Lake. */ + cpu = "rocketlake"; + CHECK___builtin_cpu_is ("corei7"); + CHECK___builtin_cpu_is ("rocketlake"); + cpu_model->__cpu_type = INTEL_COREI7; + cpu_model->__cpu_subtype = INTEL_COREI7_ROCKETLAKE; + break; case 0x55: CHECK___builtin_cpu_is ("corei7"); cpu_model->__cpu_type = INTEL_COREI7; diff --git a/gcc/common/config/i386/i386-common.c b/gcc/common/config/i386/i386-common.c index b89183b830e..1e6c1590ac4 100644 --- a/gcc/common/config/i386/i386-common.c +++ b/gcc/common/config/i386/i386-common.c @@ -1743,6 +1743,7 @@ const char *const processor_names[] = "skylake-avx512", "cannonlake", "icelake-client", + "rocketlake", "icelake-server", "cascadelake", "tigerlake", @@ -1845,6 +1846,9 @@ const pta processor_alias_table[] = {"icelake-client", PROCESSOR_ICELAKE_CLIENT, CPU_HASWELL, PTA_ICELAKE_CLIENT, M_CPU_SUBTYPE (INTEL_COREI7_ICELAKE_CLIENT), P_PROC_AVX512F}, + {"rocketlake", PROCESSOR_ROCKETLAKE, CPU_HASWELL, +PTA_ROCKETLAKE, +M_CPU_SUBTYPE (INTEL_COREI7_ROCKETLAKE), P_PROC_AVX512F}, {"icelake-server", PROCESSOR_ICELAKE_SERVER, CPU_HASWELL, PTA_ICELAKE_SERVER, M_CPU_SUBTYPE (INTEL_COREI7_ICELAKE_SERVER), P_PROC_AVX512F}, diff --git a/gcc/common/config/i386/i386-cpuinfo.h b/gcc/common/config/i386/i386-cpuinfo.h index 869115c4b6a..e68dd656046 100644 --- a/gcc/common/config/i386/i386-cpuinfo.h +++ b/gcc/common/config/i386/i386-cpuinfo.h @@ -88,6 +88,7 @@ enum processor_subtypes INTEL_COREI7_SAPPHIRERAPIDS, INTEL_COREI7_ALDERLAKE, AMDFAM19H_ZNVER3, + INTEL_COREI7_ROCKETLAKE, CPU_SUBTYPE_MAX }; diff --git a/gcc/config.gcc b/gcc/config.gcc index 997a9f61a5c..357b0bed067 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -677,7 +677,7 @@ opteron-sse3 nocona core2 corei7 corei7-avx core-avx-i core-avx2 atom \ slm nehalem westmere sandybridge ivybridge haswell broadwell bonnell \ silvermont knl knm skylake-avx512 cannonlake icelake-client icelake-server \ skylake goldmont goldmont-plus tremont cascadelake tigerlake cooperlake \ -sapphirerapids alderlake eden-x2 nano nano-1000 nano-2000 nano-3000 \ +sapphirerapids alderlake rocketlake eden-x2 nano nano-1000 nano-2000 nano-3000 \ nano-x2 eden-x4 nano-x4 x86-64 x86-64-v2 x86-64-v3 x86-64-v4
[PATCH] Change march=alderlake ISA list and add m_ALDERLAKE to m_CORE_AVX2
Hi Uros, This patch is about to change Alder Lake ISA list to GCC add m_ALDERLAKE to m_CORE_AVX2. Alder Lake Intel Hybrid Technology is based on Tremont and plus ADCX/AVX/AVX2/BMI/BMI2/F16C/FMA/LZCNT/ PCONFIG/PKU/VAES/VPCLMULQDQ/SERIALIZE/HRESET/KL/WIDEKL/AVX-VNNI For detailed information, please refer to https://software.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html Bootstrap is ok, and no regressions for i386/x86-64 testsuite. OK for master backport to GCC 10? [PATCH] Change march=alderlake ISA list and add m_ALDERLAKE to m_CORE_AVX2 Alder Lake Intel Hybrid Technology will not support Intel(r) AVX-512. ISA features such as Intel(r) AVX, AVX-VNNI, Intel(r) AVX2, and UMONITOR/UMWAIT/TPAUSE are supported. gcc/ * config/i386/i386.h (PTA_ALDERLAKE): Change alderlake ISA list. * config/i386/i386-options.c (m_CORE_AVX2): Add m_ALDERLAKE. *common/config/i386/cpuinfo.h: (get_intel_cpu): Add rocketlake model. * doc/invoke.texi: Change alderlake ISA list. --- gcc/common/config/i386/cpuinfo.h | 1 + gcc/config/i386/i386-options.c | 2 +- gcc/config/i386/i386.h | 7 --- gcc/doc/invoke.texi | 9 + 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/gcc/common/config/i386/cpuinfo.h b/gcc/common/config/i386/cpuinfo.h index dbce022620a..c1ee7a1f8b8 100644 --- a/gcc/common/config/i386/cpuinfo.h +++ b/gcc/common/config/i386/cpuinfo.h @@ -476,6 +476,7 @@ get_intel_cpu (struct __processor_model *cpu_model, cpu_model->__cpu_subtype = INTEL_COREI7_TIGERLAKE; break; case 0x97: +case 0x9a: /* Alder Lake. */ cpu = "alderlake"; CHECK___builtin_cpu_is ("corei7"); diff --git a/gcc/config/i386/i386-options.c b/gcc/config/i386/i386-options.c index a8d06735d79..02e9c97d174 100644 --- a/gcc/config/i386/i386-options.c +++ b/gcc/config/i386/i386-options.c @@ -129,7 +129,7 @@ along with GCC; see the file COPYING3. If not see #define m_CORE_AVX512 (m_SKYLAKE_AVX512 | m_CANNONLAKE \ | m_ICELAKE_CLIENT | m_ICELAKE_SERVER | m_CASCADELAKE \ | m_TIGERLAKE | m_COOPERLAKE | m_SAPPHIRERAPIDS) -#define m_CORE_AVX2 (m_HASWELL | m_SKYLAKE | m_CORE_AVX512) +#define m_CORE_AVX2 (m_HASWELL | m_SKYLAKE | m_ALDERLAKE | m_CORE_AVX512) #define m_CORE_ALL (m_CORE2 | m_NEHALEM | m_SANDYBRIDGE | m_CORE_AVX2) #define m_GOLDMONT (HOST_WIDE_INT_1U< 0001-Change-march-alderlake-ISA-list-and-add-m_ALDERLAKE-.patch Description: 0001-Change-march-alderlake-ISA-list-and-add-m_ALDERLAKE-.patch
[Patch, fortran] PR fortran/100029 - ICE on storage_size with polymorphic argument, PR fortran/100040 - Wrong code with intent out assumed-rank allocatable
Hi All! Proposed patch to: PR100040 - Wrong code with intent out assumed-rank allocatable PR100029 - ICE on subroutine call with allocatable polymorphic assumed-rank argument Patch tested only on x86_64-pc-linux-gnu. Made sure the code also recognized assumed-rank arrays as full arrays. Changed the order of free and class to class conversion so that the free occurs first so that there are no problems with freeing an unexpected type of transformed class. Thank you very much. Best regards, José Rui Fortran: Fix ICE and wrong code emission [PR100029, PR100040] gcc/fortran/ChangeLog: PR fortran/100040 * trans-expr.c (gfc_conv_class_to_class): add code to have assumed-rank arrays recognized as full arrays and fix the type of the array assignment. PR fortran/100029 * trans-expr.c (gfc_conv_procedure_call): change order of code blocks, such that the free occurs first. gcc/testsuite/ChangeLog: PR fortran/100029 * gfortran.dg/PR100029.f90: New test. PR fortran/100040 * gfortran.dg/PR100040.f90: New test. diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 2fa17b36c03..35b784ab782 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -1099,8 +1099,10 @@ gfc_conv_class_to_class (gfc_se *parmse, gfc_expr *e, gfc_typespec class_ts, return; /* Test for FULL_ARRAY. */ - if (e->rank == 0 && gfc_expr_attr (e).codimension - && gfc_expr_attr (e).dimension) + if (e->rank == 0 + && ((gfc_expr_attr (e).codimension && gfc_expr_attr (e).dimension) + || (class_ts.u.derived->components->as + && class_ts.u.derived->components->as->type == AS_ASSUMED_RANK))) full_array = true; else gfc_is_class_array_ref (e, _array); @@ -1148,8 +1150,12 @@ gfc_conv_class_to_class (gfc_se *parmse, gfc_expr *e, gfc_typespec class_ts, && e->rank != class_ts.u.derived->components->as->rank) { if (e->rank == 0) - gfc_add_modify (>post, gfc_class_data_get (parmse->expr), - gfc_conv_descriptor_data_get (ctree)); + { + tmp = gfc_class_data_get (parmse->expr); + gfc_add_modify (>post, tmp, + fold_convert (TREE_TYPE (tmp), + gfc_conv_descriptor_data_get (ctree))); + } else class_array_data_assign (>post, parmse->expr, ctree, true); } @@ -6111,23 +6117,6 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym, base_object = build_fold_indirect_ref_loc (input_location, parmse.expr); - /* A class array element needs converting back to be a - class object, if the formal argument is a class object. */ - if (fsym && fsym->ts.type == BT_CLASS - && e->ts.type == BT_CLASS - && ((CLASS_DATA (fsym)->as - && CLASS_DATA (fsym)->as->type == AS_ASSUMED_RANK) - || CLASS_DATA (e)->attr.dimension)) - gfc_conv_class_to_class (, e, fsym->ts, false, - fsym->attr.intent != INTENT_IN - && (CLASS_DATA (fsym)->attr.class_pointer - || CLASS_DATA (fsym)->attr.allocatable), - fsym->attr.optional - && e->expr_type == EXPR_VARIABLE - && e->symtree->n.sym->attr.optional, - CLASS_DATA (fsym)->attr.class_pointer - || CLASS_DATA (fsym)->attr.allocatable); - /* If an ALLOCATABLE dummy argument has INTENT(OUT) and is allocated on entry, it must be deallocated. */ if (fsym && fsym->attr.intent == INTENT_OUT @@ -6186,6 +6175,22 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym, gfc_add_expr_to_block (>pre, tmp); } + /* A class array element needs converting back to be a + class object, if the formal argument is a class object. */ + if (fsym && fsym->ts.type == BT_CLASS + && e->ts.type == BT_CLASS + && ((CLASS_DATA (fsym)->as + && CLASS_DATA (fsym)->as->type == AS_ASSUMED_RANK) + || CLASS_DATA (e)->attr.dimension)) + gfc_conv_class_to_class (, e, fsym->ts, false, + fsym->attr.intent != INTENT_IN + && (CLASS_DATA (fsym)->attr.class_pointer + || CLASS_DATA (fsym)->attr.allocatable), + fsym->attr.optional + && e->expr_type == EXPR_VARIABLE + && e->symtree->n.sym->attr.optional, + CLASS_DATA (fsym)->attr.class_pointer + || CLASS_DATA (fsym)->attr.allocatable); if (fsym && (fsym->ts.type == BT_DERIVED || fsym->ts.type == BT_ASSUMED) diff --git a/gcc/testsuite/gfortran.dg/PR100029.f90 b/gcc/testsuite/gfortran.dg/PR100029.f90 new file mode 100644 index 000..1fef06fd2d3 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/PR100029.f90 @@ -0,0 +1,26 @@ +! { dg-do run } +! +! Test the fix for PR100029 +! + +program foo_p + + implicit none + + type :: foo_t + end type foo_t + + class(foo_t), allocatable :: pout + + call foo_s(pout) + stop + +contains + + subroutine foo_s(that) +class(foo_t), allocatable, intent(out) :: that(..) + +return + end subroutine foo_s +
Re: [committed] ada: Avoid invalid "up" link in manual
> >> With this patch the bottom navigation of the page at > >> https://gcc.gnu.org/onlinedocs/gnat_ugn/index.html > >> changes from > >> Next: About This Guide, Up: (dir) [Contents][Index] > >> to > >> Next: About This Guide [Contents][Index] > >> and the invalid "(dir)" link that pointed to > >> http://gcc.gnu.org/onlinedocs/dir/index.html > >> which does not exist is gone. > > Well the master is the rest/sphinx files in doc, the texi file is auto > > generated, so your change will dispapear at the next generation. > > You're right, good catch, Arnaud! > > How can we fix this at the root, then? I'm not sufficiently familiar > with Sphinx and did not find where we might change that. You can always do some postprocessing, see gcc/ada/doc/Makefile line 66 for an existing kludge^Wpostprocessing. Arno
[PATCH] c++: constraints are unevaluated operands [PR99961]
According to [temp.concept]/6 and [temp.pre]/9, a concept definition and a requires clause are both unevaluated contexts, and hence satisfaction deals only with unevaluated operands, so we should set cp_unevaluated in these three situations. (I guess we should set cp_unevaluated during normalization too, but I wasn't able to construct a testcase for which it makes a difference.) Bootstrapped and regtested on x86_64-pc-linux-gnu, and also tested on cmcstl2 and range-v3, does this look OK for trunk? gcc/cp/ChangeLog: PR c++/99961 * constraint.cc (satisfy_normalized_constraints): Set cp_unevaluated. * parser.c (cp_parser_concept_definition): Likewise. (cp_parser_requires_clause_opt): Likewise. gcc/testsuite/ChangeLog: PR c++/99961 * g++.dg/cpp2a/concepts-uneval1.C: New test. --- gcc/cp/constraint.cc | 3 +++ gcc/cp/parser.c | 6 ++ gcc/testsuite/g++.dg/cpp2a/concepts-uneval1.C | 10 ++ 3 files changed, 19 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp2a/concepts-uneval1.C diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc index 0ddb2990dd9..6c8e29d809f 100644 --- a/gcc/cp/constraint.cc +++ b/gcc/cp/constraint.cc @@ -3066,6 +3066,9 @@ satisfy_normalized_constraints (tree t, tree args, sat_info info) /* We need to check access during satisfaction. */ deferring_access_check_sentinel acs (dk_no_deferred); + /* Constraints are an unevaluated operands. */ + cp_unevaluated u; + return satisfy_constraint_r (t, args, info); } diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index b6f94bdda23..8b7801b2be7 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -28353,6 +28353,9 @@ cp_parser_label_declaration (cp_parser* parser) static tree cp_parser_concept_definition (cp_parser *parser) { + /* A concept definition is an unevaluated context. */ + cp_unevaluated u; + gcc_assert (cp_lexer_next_token_is_keyword (parser->lexer, RID_CONCEPT)); cp_lexer_consume_token (parser->lexer); @@ -28714,6 +28717,9 @@ cp_parser_constraint_expression (cp_parser *parser) static tree cp_parser_requires_clause_opt (cp_parser *parser, bool lambda_p) { + /* A requires clause is an unevaluated context. */ + cp_unevaluated u; + cp_token *tok = cp_lexer_peek_token (parser->lexer); if (tok->keyword != RID_REQUIRES) { diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-uneval1.C b/gcc/testsuite/g++.dg/cpp2a/concepts-uneval1.C new file mode 100644 index 000..4c5f1b5c019 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-uneval1.C @@ -0,0 +1,10 @@ +// PR c++/99961 +// { dg-do compile { target c++20 } } + +struct A { static const int x = 42; bool y; }; + +void f(auto a) requires (a.x == 42) { } +template void f(A); + +template concept C = V || A::y; +static_assert(C); -- 2.31.1.272.g89b43f80a5
Re: [committed] ada: Avoid invalid "up" link in manual
On Sun, 11 Apr 2021, Arnaud Charlet wrote: >> With this patch the bottom navigation of the page at >> https://gcc.gnu.org/onlinedocs/gnat_ugn/index.html >> changes from >> Next: About This Guide, Up: (dir) [Contents][Index] >> to >> Next: About This Guide [Contents][Index] >> and the invalid "(dir)" link that pointed to >> http://gcc.gnu.org/onlinedocs/dir/index.html >> which does not exist is gone. > Well the master is the rest/sphinx files in doc, the texi file is auto > generated, so your change will dispapear at the next generation. You're right, good catch, Arnaud! How can we fix this at the root, then? I'm not sufficiently familiar with Sphinx and did not find where we might change that. Is there a newer version of Sphinx available to avoid this? Gerald
[Committed] MAINTAINERS: Add myself for write after approval
ChangeLog: 2021-04-11 Hafiz Abid Qadeer * MAINTAINERS (Write After Approval): Add myself. --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 0fbbc0519d0..db25583b37b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -568,6 +568,7 @@ Siddhesh Poyarekar Vidya Praveen Thomas Preud'homme Vladimir Prus +Hafiz Abid Qadeer Yao Qi Jerry Quinn Easwaran Raman -- 2.25.1
Re: [committed] ada: Avoid invalid "up" link in manual
> This is something I have been noticing for a while, and a hint by > Sandra in a somewhat similar context taught me how to avoid it. > > With this patch the bottom navigation of the page at > https://gcc.gnu.org/onlinedocs/gnat_ugn/index.html > changes from > Next: About This Guide, Up: (dir) [Contents][Index] > to > Next: About This Guide [Contents][Index] > and the invalid "(dir)" link that pointed to > http://gcc.gnu.org/onlinedocs/dir/index.html > which does not exist is gone. > > Pushed. Well the master is the rest/sphinx files in doc, the texi file is auto generated, so your change will dispapear at the next generation. Arno
[committed] ada: Avoid invalid "up" link in manual
This is something I have been noticing for a while, and a hint by Sandra in a somewhat similar context taught me how to avoid it. With this patch the bottom navigation of the page at https://gcc.gnu.org/onlinedocs/gnat_ugn/index.html changes from Next: About This Guide, Up: (dir) [Contents][Index] to Next: About This Guide [Contents][Index] and the invalid "(dir)" link that pointed to http://gcc.gnu.org/onlinedocs/dir/index.html which does not exist is gone. Pushed. Gerald (who too late realized that in the Git world he should have added this explanation to the actual commit message) commit c660464a9ef07726a5d5217b4b39def189ec21e6 Author: Gerald Pfeifer Date: Sun Apr 11 11:23:41 2021 +0200 ada: Avoid invalid "up" link in manual gcc/ada/ * gnat_ugn.texi (Top): Avoid invalid "up" link. diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index 360177b042b..ae8f7580355 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -41,7 +41,7 @@ Copyright @copyright{} 2008-2021, Free Software Foundation @c %** end of user preamble @ifnottex -@node Top +@node Top, About This Guide @top GNAT User's Guide for Native Platforms @insertcopying @end ifnottex
[committed] wwwdocs: bugs: Refine reference to Goldberg's paper
Pushed. Refer to the PDF version instead of Postscript and quote the title of the paper instead of "this paper". --- htdocs/bugs/index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/bugs/index.html b/htdocs/bugs/index.html index 88fba1b9..4a258213 100644 --- a/htdocs/bugs/index.html +++ b/htdocs/bugs/index.html @@ -298,9 +298,9 @@ represent all real numbers exactly, so it has to use approximations. When computing with approximation, the computer needs to round to the nearest representable number. -This is not a bug in the compiler, but an inherent limitation of -the floating point types. Please study -https://www.validlab.com/goldberg/paper.ps;>this paper +This is an inherent limitation of floating point types, not a bug. +See Goldberg's https://www.validlab.com/goldberg/paper.pdf;>What +Every Computer Scientist Should Know about Floating-Point Arithmetic for more information. -- 2.31.1
Re: [Patch, fortran] 99307 - FAIL: gfortran.dg/class_assign_4.f90 execution test
Tobias noticed a major technical fault with the resubmission below: I forgot to attach the patch :-( Please find it attached this time. Paul On Tue, 6 Apr 2021 at 18:08, Paul Richard Thomas < paul.richard.tho...@gmail.com> wrote: > Hi Tobias, > > I believe that the attached fixes the problems that you found with > gfc_find_and_cut_at_last_class_ref. > > I will test: >type1%type%array_class2 → NULL is returned (why?) >class1%type%array_class2 → ts = class1 but array2_class is used later > on (ups!) >class1%...%scalar_class2 → ts = class1 but scalar_class2 is used > > The ChangeLogs remain the same, apart from the date. > > Regtests OK on FC33/x86_64. > > Paul > > > On Mon, 29 Mar 2021 at 14:58, Tobias Burnus > wrote: > >> Hi all, >> >> as preremark I want to note that the testcase class_assign_4.f90 >> was added for PR83118/PR96012 (fixes problems in handling class objects, >> Dec 18, 2020) >> and got revised for PR99124 (class defined operators, Feb 23, 2021). >> Both patches were then also applied to GCC 9 and 10. >> >> On 26.03.21 17:30, Paul Richard Thomas via Gcc-patches wrote: >> > This patch comes in two versions: submit.diff with Change.Logs or >> > submit2.diff with Change2.Logs. >> > The first fixes the problem by changing array temporaries from class >> > expressions into class temporaries. This permits the use of >> > gfc_get_class_from_expr to obtain the vptr for these temporaries and all >> > the good things that come with that when handling dynamic types. The >> second >> > part of the fix is to use the array element length from the class >> > descriptor, when reallocating on assignment. This is needed because the >> > vptr is being set too early. I will set about trying to track down why >> this >> > is happening and fix it after release. >> > >> > The second version does the same as the first but puts in place a load >> of >> > tidying up that is permitted by the fix to class array temporaries. >> >> > I couldn't readily see how to prepare a testcase - ideas? >> > Both regtest on FC33/x86_64. The first was tested by Dominique (see the >> > PR). OK for master? >> >> Typo – underscore-'c' should be a dot-'c' – both changelog files >> >> > * trans-expr_c (gfc_trans_scalar_assign): Make use of pre and >> >> I think the second longer version is nicer in general, but at least for >> GCC 9/GCC10 the first version is simpler and, hence, less error prone. >> >> As you only ask about mainline, I would prefer the second one. >> >> However, I am not happy about gfc_find_and_cut_at_last_class_ref: >> >> > + of refs following. If ts is non-null the cut is at the class entity >> > + or component that is followed by an array reference, which is not + >> > an element. */ ... + + if (ts) + { + if (e->symtree + && >> > e->symtree->n.sym->ts.type == BT_CLASS) + *ts = >> > >symtree->n.sym->ts; + else + *ts = NULL; + } + for (ref = e->ref; >> > ref; ref = ref->next) { + if (ts && ref->type == REF_COMPONENT + && >> > ref->u.c.component->ts.type == BT_CLASS + && ref->next && >> > ref->next->type == REF_COMPONENT + && strcmp >> > (ref->next->u.c.component->name, "_data") == 0 + && ref->next->next + >> > && ref->next->next->type == REF_ARRAY + && ref->next->next->u.ar.type >> > != AR_ELEMENT) + { + *ts = >u.c.component->ts; + class_ref = ref; >> > + break; + } + + if (ts && *ts == NULL) + return NULL; + >> Namely, if there is: >>type1%array_class2 → array_class2 is used for 'ts' and later (ok) >>type1%type%array_class2 → NULL is returned (why?) >>class1%type%array_class2 → ts = class1 but array2_class is used later >> on (ups!) >>class1%...%scalar_class2 → ts = class1 but scalar_class2 is used >> etc. >> >> Thus this either needs to be cleaned up (separate 'ref' loop for >> ts != NULL) – including the wording in the description which tells what >> happens if 'ts' is passed as arg but the expr has rank == 0 – and >> what value is assigned to 'ts'. (You can then also fix 'class.c::' to >> 'class.c: ' in the description above the function.) >> >> Alternatively, you can leave the current code ref handling code in place >> at build_class_array_ref, which might be the simpler alternative. >> >> Otherwise, it looks sensible to me. >> >> Tobias >> >> - >> Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München >> Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank >> Thürauf >> > > > -- > "If you can't explain it simply, you don't understand it well enough" - > Albert Einstein > -- "If you can't explain it simply, you don't understand it well enough" - Albert Einstein diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index be5eb89350f..ca90142530c 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -1403,9 +1403,6 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post, gfc_ss * ss, desc = gfc_create_var (type, "atmp"); GFC_DECL_PACKED_ARRAY (desc) = 1; -