[gcc r13-8651] gfortran: Allow ref'ing PDT's len() in parameter-initializer.
https://gcc.gnu.org/g:e207b67fcde224f2be0c79bf2a24f7fc75b6f481 commit r13-8651-ge207b67fcde224f2be0c79bf2a24f7fc75b6f481 Author: Andre Vehreschild Date: Wed Jul 12 12:51:30 2023 +0200 gfortran: Allow ref'ing PDT's len() in parameter-initializer. Fix declaring a parameter initialized using a pdt_len reference not simplifying the reference to a constant. 2023-07-12 Andre Vehreschild gcc/fortran/ChangeLog: PR fortran/102003 * expr.cc (find_inquiry_ref): Replace len of pdt_string by constant. (simplify_ref_chain): Ensure input to find_inquiry_ref is NULL. (gfc_match_init_expr): Prevent PDT analysis for function calls. (gfc_pdt_find_component_copy_initializer): Get the initializer value for given component. * gfortran.h (gfc_pdt_find_component_copy_initializer): New function. * simplify.cc (gfc_simplify_len): Replace len() of PDT with pdt component ref or constant. gcc/testsuite/ChangeLog: * gfortran.dg/pdt_33.f03: New test. (cherry picked from commit f9182da3213aa57c16dd0b52862126de4a259f6a) Diff: --- gcc/fortran/expr.cc | 31 ++-- gcc/fortran/gfortran.h | 1 + gcc/fortran/simplify.cc | 57 gcc/testsuite/gfortran.dg/pdt_33.f03 | 21 + 4 files changed, 94 insertions(+), 16 deletions(-) diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc index 8b9c93940c8..a6c4dccb125 100644 --- a/gcc/fortran/expr.cc +++ b/gcc/fortran/expr.cc @@ -1854,6 +1854,13 @@ find_inquiry_ref (gfc_expr *p, gfc_expr **newp) else if (tmp->expr_type == EXPR_CONSTANT) *newp = gfc_get_int_expr (gfc_default_integer_kind, NULL, tmp->value.character.length); + else if (gfc_init_expr_flag + && tmp->ts.u.cl->length->symtree->n.sym->attr.pdt_len) + *newp = gfc_pdt_find_component_copy_initializer (tmp->symtree->n +.sym, +tmp->ts.u.cl +->length->symtree +->n.sym->name); else goto cleanup; @@ -1894,7 +1901,9 @@ find_inquiry_ref (gfc_expr *p, gfc_expr **newp) mpc_imagref (tmp->value.complex), GFC_RND_MODE); break; } - tmp = gfc_copy_expr (*newp); + // TODO: Fix leaking expr tmp, when simplify is done twice. + if (inquiry->next) + gfc_replace_expr (tmp, *newp); } if (!(*newp)) @@ -2059,7 +2068,7 @@ static bool simplify_ref_chain (gfc_ref *ref, int type, gfc_expr **p) { int n; - gfc_expr *newp; + gfc_expr *newp = NULL; for (; ref; ref = ref->next) { @@ -3221,7 +3230,7 @@ gfc_match_init_expr (gfc_expr **result) return m; } - if (gfc_derived_parameter_expr (expr)) + if (expr->expr_type != EXPR_FUNCTION && gfc_derived_parameter_expr (expr)) { *result = expr; gfc_init_expr_flag = false; @@ -6533,3 +6542,19 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool alloc_obj, return true; } + +gfc_expr* +gfc_pdt_find_component_copy_initializer (gfc_symbol *sym, const char *name) +{ + /* The actual length of a pdt is in its components. In the + initializer of the current ref is only the default value. + Therefore traverse the chain of components and pick the correct + one's initializer expressions. */ + for (gfc_component *comp = sym->ts.u.derived->components; comp != NULL; + comp = comp->next) +{ + if (!strcmp (comp->name, name)) + return gfc_copy_expr (comp->initializer); +} + return NULL; +} diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index 47414f73254..c1430f7dfec 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -3716,6 +3716,7 @@ gfc_expr* gfc_find_stat_co (gfc_expr *); gfc_expr* gfc_build_intrinsic_call (gfc_namespace *, gfc_isym_id, const char*, locus, unsigned, ...); bool gfc_check_vardef_context (gfc_expr*, bool, bool, bool, const char*); +gfc_expr* gfc_pdt_find_component_copy_initializer (gfc_symbol *, const char *); /* st.cc */ diff --git a/gcc/fortran/simplify.cc b/gcc/fortran/simplify.cc index b65854c1021..fe700097b7b 100644 --- a/gcc/fortran/simplify.cc +++ b/gcc/fortran/simplify.cc @@ -4566,19 +4566,50 @@ gfc_simplify_len (gfc_expr *e, gfc_expr *kind) return range_check (result, "LEN"); } else if (e->expr_type == EXPR_VARIABLE && e->ts.type == BT_CHARACTER - && e->symtree->n.sym - && e->symtree->n.sym->ts.type != BT_DERIVED - && e->symtree->n.sym->assoc && e->symtree->n.s
[gcc r14-10137] i386: Fix array index overflow in pr105354-2.c
https://gcc.gnu.org/g:4a2e55b3ada20fe6457466bb687a66c8d03e056e commit r14-10137-g4a2e55b3ada20fe6457466bb687a66c8d03e056e Author: Haochen Jiang Date: Fri Apr 26 16:48:29 2024 +0800 i386: Fix array index overflow in pr105354-2.c The array index should not be over 8 for v8hi, or it will fail under -O0 or using -fstack-protector. gcc/testsuite/ChangeLog: PR target/110621 * gcc.target/i386/pr105354-2.c: As mentioned. Diff: --- gcc/testsuite/gcc.target/i386/pr105354-2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/testsuite/gcc.target/i386/pr105354-2.c b/gcc/testsuite/gcc.target/i386/pr105354-2.c index b78b62e1e7e..1c592e84860 100644 --- a/gcc/testsuite/gcc.target/i386/pr105354-2.c +++ b/gcc/testsuite/gcc.target/i386/pr105354-2.c @@ -17,7 +17,7 @@ sse2_test (void) b.a[i] = i + 16; res_ab.a[i] = 0; exp_ab.a[i] = -1; - if (i <= 8) + if (i < 8) { c.a[i] = i; d.a[i] = i + 8;
[gcc r13-8652] i386: Fix array index overflow in pr105354-2.c
https://gcc.gnu.org/g:7425436b5382a04f3eb28c7c7912f4d9a1cad0bd commit r13-8652-g7425436b5382a04f3eb28c7c7912f4d9a1cad0bd Author: Haochen Jiang Date: Fri Apr 26 16:48:29 2024 +0800 i386: Fix array index overflow in pr105354-2.c The array index should not be over 8 for v8hi, or it will fail under -O0 or using -fstack-protector. gcc/testsuite/ChangeLog: PR target/110621 * gcc.target/i386/pr105354-2.c: As mentioned. Diff: --- gcc/testsuite/gcc.target/i386/pr105354-2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/testsuite/gcc.target/i386/pr105354-2.c b/gcc/testsuite/gcc.target/i386/pr105354-2.c index b78b62e1e7e..1c592e84860 100644 --- a/gcc/testsuite/gcc.target/i386/pr105354-2.c +++ b/gcc/testsuite/gcc.target/i386/pr105354-2.c @@ -17,7 +17,7 @@ sse2_test (void) b.a[i] = i + 16; res_ab.a[i] = 0; exp_ab.a[i] = -1; - if (i <= 8) + if (i < 8) { c.a[i] = i; d.a[i] = i + 8;
[gcc r14-10138] amdgcn: Add gfx90c target
https://gcc.gnu.org/g:b8e9fd535d6093e3a24af858364d8517a767b0d7 commit r14-10138-gb8e9fd535d6093e3a24af858364d8517a767b0d7 Author: Frederik Harwath Date: Wed Apr 24 20:29:14 2024 +0200 amdgcn: Add gfx90c target Add support for gfx90c GCN5 APU integrated graphics devices. The LLVM AMDGPU documentation does not list those devices as supported by rocm-amdhsa, but it passes most libgomp offloading tests. Although they are constrainted compared to dGPUs, they might be interesting for learning, experimentation, and testing. gcc/ChangeLog: * config.gcc: Add gfx90c. * config/gcn/gcn-hsa.h (NO_SRAM_ECC): Likewise. * config/gcn/gcn-opts.h (enum processor_type): Likewise. (TARGET_GFX90c): New macro. * config/gcn/gcn.cc (gcn_option_override): Handle gfx90c. (gcn_omp_device_kind_arch_isa): Likewise. (output_file_start): Likewise. * config/gcn/gcn.h: Add gfx90c. * config/gcn/gcn.opt: Likewise. * config/gcn/mkoffload.cc (EF_AMDGPU_MACH_AMDGCN_GFX90c): New macro. (get_arch): Handle gfx90c. (main): Handle EF_AMDGPU_MACH_AMDGCN_GFX90c * config/gcn/t-omp-device: Add gfx90c. * doc/install.texi: Likewise. * doc/invoke.texi: Likewise. libgomp/ChangeLog: * plugin/plugin-gcn.c (isa_hsa_name): Handle EF_AMDGPU_MACH_AMDGCN_GFX90c. (isa_code): Handle gfx90c. (max_isa_vgprs): Handle EF_AMDGPU_MACH_AMDGCN_GFX90c. Signed-off-by: Frederik Harwath Diff: --- gcc/config.gcc | 4 ++-- gcc/config/gcn/gcn-hsa.h| 2 +- gcc/config/gcn/gcn-opts.h | 2 ++ gcc/config/gcn/gcn.cc | 8 gcc/config/gcn/gcn.h| 2 ++ gcc/config/gcn/gcn.opt | 3 +++ gcc/config/gcn/mkoffload.cc | 9 + gcc/config/gcn/t-omp-device | 2 +- gcc/doc/install.texi| 4 ++-- gcc/doc/invoke.texi | 3 +++ libgomp/plugin/plugin-gcn.c | 9 + 11 files changed, 42 insertions(+), 6 deletions(-) diff --git a/gcc/config.gcc b/gcc/config.gcc index c2764095f0c..95c91ee02be 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -4572,7 +4572,7 @@ case "${target}" in for which in arch tune; do eval "val=\$with_$which" case ${val} in - "" | fiji | gfx900 | gfx906 | gfx908 | gfx90a | gfx1030 | gfx1036 | gfx1100 | gfx1103) + "" | fiji | gfx900 | gfx906 | gfx908 | gfx90a | gfx90c | gfx1030 | gfx1036 | gfx1100 | gfx1103) # OK ;; *) @@ -4588,7 +4588,7 @@ case "${target}" in TM_MULTILIB_CONFIG= ;; xdefault | xyes) - TM_MULTILIB_CONFIG=`echo "gfx900,gfx906,gfx908,gfx90a,gfx1030,gfx1036,gfx1100,gfx1103" | sed "s/${with_arch},\?//;s/,$//"` + TM_MULTILIB_CONFIG=`echo "gfx900,gfx906,gfx908,gfx90a,gfx90c,gfx1030,gfx1036,gfx1100,gfx1103" | sed "s/${with_arch},\?//;s/,$//"` ;; *) TM_MULTILIB_CONFIG="${with_multilib_list}" diff --git a/gcc/config/gcn/gcn-hsa.h b/gcc/config/gcn/gcn-hsa.h index 7d6e3141cea..4611bc55392 100644 --- a/gcc/config/gcn/gcn-hsa.h +++ b/gcc/config/gcn/gcn-hsa.h @@ -93,7 +93,7 @@ extern unsigned int gcn_local_sym_hash (const char *name); #define NO_XNACK "march=fiji:;march=gfx1030:;march=gfx1036:;march=gfx1100:;march=gfx1103:;" \ /* These match the defaults set in gcn.cc. */ \ "!mxnack*|mxnack=default:%{march=gfx900|march=gfx906|march=gfx908:-mattr=-xnack};" -#define NO_SRAM_ECC "!march=*:;march=fiji:;march=gfx900:;march=gfx906:;" +#define NO_SRAM_ECC "!march=*:;march=fiji:;march=gfx900:;march=gfx906:;march=gfx90c:;" /* In HSACOv4 no attribute setting means the binary supports "any" hardware configuration. The name of the attribute also changed. */ diff --git a/gcc/config/gcn/gcn-opts.h b/gcc/config/gcn/gcn-opts.h index 49099bad7e7..1091035a69a 100644 --- a/gcc/config/gcn/gcn-opts.h +++ b/gcc/config/gcn/gcn-opts.h @@ -25,6 +25,7 @@ enum processor_type PROCESSOR_VEGA20, // gfx906 PROCESSOR_GFX908, PROCESSOR_GFX90a, + PROCESSOR_GFX90c, PROCESSOR_GFX1030, PROCESSOR_GFX1036, PROCESSOR_GFX1100, @@ -36,6 +37,7 @@ enum processor_type #define TARGET_VEGA20 (gcn_arch == PROCESSOR_VEGA20) #define TARGET_GFX908 (gcn_arch == PROCESSOR_GFX908) #define TARGET_GFX90a (gcn_arch == PROCESSOR_GFX90a) +#define TARGET_GFX90c (gcn_arch == PROCESSOR_GFX90c) #define TARGET_GFX1030 (gcn_arch == PROCESSOR_GFX1030) #define TARGET_GFX1036 (gcn_arch == PROCESSOR_GFX1036) #define TARGET_GFX1100 (gcn_arch == PROCESSOR_GFX1100) diff --git a/gcc/config/gcn/gcn.cc b/gcc/config/gcn/gcn.cc index 9f91d4f9ebd..d6531f55190 100644 --- a/gcc/config/gc
[gcc] Created branch 'releases/gcc-14'
The branch 'releases/gcc-14' was created pointing to: b8e9fd535d6... amdgcn: Add gfx90c target
[gcc r14-10139] Bump BASE-VER.
https://gcc.gnu.org/g:48a320a175780a0714741c71b4299a634807ad4b commit r14-10139-g48a320a175780a0714741c71b4299a634807ad4b Author: Jakub Jelinek Date: Fri Apr 26 11:50:36 2024 +0200 Bump BASE-VER. 2024-04-26 Jakub Jelinek * BASE-VER: Set to 15.0.0. Diff: --- gcc/BASE-VER | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/BASE-VER b/gcc/BASE-VER index 63dba868a0c..94188a74831 100644 --- a/gcc/BASE-VER +++ b/gcc/BASE-VER @@ -1 +1 @@ -14.0.1 +15.0.0
[gcc] Created tag 'basepoints/gcc-15'
The signed tag 'basepoints/gcc-15' was created pointing to: 48a320a1757... Bump BASE-VER. Tagger: Jakub Jelinek Date: Fri Apr 26 11:53:56 2024 +0200 GCC 15 basepoint
[gcc r15-1] Update crontab and git_update_version.py
https://gcc.gnu.org/g:036aad9dfca74d022180c656177762b27f47ccf6 commit r15-1-g036aad9dfca74d022180c656177762b27f47ccf6 Author: Jakub Jelinek Date: Fri Apr 26 12:18:29 2024 +0200 Update crontab and git_update_version.py 2024-04-26 Jakub Jelinek maintainer-scripts/ * crontab: Snapshots from trunk are now GCC 15 related. Add GCC 14 snapshots from the respective branch. contrib/ * gcc-changelog/git_update_version.py (active_refs): Add releases/gcc-14. Diff: --- contrib/gcc-changelog/git_update_version.py | 4 ++-- maintainer-scripts/crontab | 9 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/contrib/gcc-changelog/git_update_version.py b/contrib/gcc-changelog/git_update_version.py index 3e79dab0096..f194757b0cb 100755 --- a/contrib/gcc-changelog/git_update_version.py +++ b/contrib/gcc-changelog/git_update_version.py @@ -76,8 +76,8 @@ def prepend_to_changelog_files(repo, folder, git_commit, add_to_git): repo.git.add(full_path) -active_refs = ['master', - 'releases/gcc-11', 'releases/gcc-12', 'releases/gcc-13'] +active_refs = ['master', 'releases/gcc-11', + 'releases/gcc-12', 'releases/gcc-13', 'releases/gcc-14'] parser = argparse.ArgumentParser(description='Update DATESTAMP and generate ' 'ChangeLog entries') diff --git a/maintainer-scripts/crontab b/maintainer-scripts/crontab index 6fedb5d1ef5..322778ab23f 100644 --- a/maintainer-scripts/crontab +++ b/maintainer-scripts/crontab @@ -1,7 +1,8 @@ 16 0 * * * sh /home/gccadmin/scripts/update_version_git 50 0 * * * sh /home/gccadmin/scripts/update_web_docs_git 55 0 * * * sh /home/gccadmin/scripts/update_web_docs_libstdcxx_git -32 22 * * 4 sh /home/gccadmin/scripts/gcc_release -s 11:releases/gcc-11 -l -d /sourceware/snapshot-tmp/gcc all -32 22 * * 5 sh /home/gccadmin/scripts/gcc_release -s 12:releases/gcc-12 -l -d /sourceware/snapshot-tmp/gcc all -32 22 * * 6 sh /home/gccadmin/scripts/gcc_release -s 13:releases/gcc-13 -l -d /sourceware/snapshot-tmp/gcc all -32 22 * * 7 sh /home/gccadmin/scripts/gcc_release -s 14:master -l -d /sourceware/snapshot-tmp/gcc all +32 22 * * 3 sh /home/gccadmin/scripts/gcc_release -s 11:releases/gcc-11 -l -d /sourceware/snapshot-tmp/gcc all +32 22 * * 4 sh /home/gccadmin/scripts/gcc_release -s 12:releases/gcc-12 -l -d /sourceware/snapshot-tmp/gcc all +32 22 * * 5 sh /home/gccadmin/scripts/gcc_release -s 13:releases/gcc-13 -l -d /sourceware/snapshot-tmp/gcc all +32 22 * * 6 sh /home/gccadmin/scripts/gcc_release -s 14:releases/gcc-14 -l -d /sourceware/snapshot-tmp/gcc all +32 22 * * 7 sh /home/gccadmin/scripts/gcc_release -s 15:master -l -d /sourceware/snapshot-tmp/gcc all
[gcc r15-2] ada: bump Library_Version to 15.
https://gcc.gnu.org/g:8a9a4648ec1040e34b88fb3e2c60784daa78ef85 commit r15-2-g8a9a4648ec1040e34b88fb3e2c60784daa78ef85 Author: Jakub Jelinek Date: Fri Apr 26 12:20:45 2024 +0200 ada: bump Library_Version to 15. gcc/ada/ChangeLog: * gnatvsn.ads: Bump Library_Version to 15. Diff: --- gcc/ada/gnatvsn.ads | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/ada/gnatvsn.ads b/gcc/ada/gnatvsn.ads index 29238362cc0..6cf170dc4ca 100644 --- a/gcc/ada/gnatvsn.ads +++ b/gcc/ada/gnatvsn.ads @@ -32,7 +32,7 @@ package Gnatvsn is -- Static string identifying this version, that can be used as an argument -- to e.g. pragma Ident. - Library_Version : constant String := "14"; + Library_Version : constant String := "15"; -- Library version. It needs to be updated whenever the major version -- number is changed. --
[gcc r15-3] libstdc++: Adjust whitespace in status tables in manual
https://gcc.gnu.org/g:772250a36c53a7b29a53e090d911b502afdfd1fe commit r15-3-g772250a36c53a7b29a53e090d911b502afdfd1fe Author: Jonathan Wakely Date: Fri Apr 26 11:48:48 2024 +0100 libstdc++: Adjust whitespace in status tables in manual This simplifies the changes needed after branching for a new release, so that new line breaks don't need to be introduced every time we branch. libstdc++-v3/ChangeLog: * doc/html/manual/status.html: Regenerate. * doc/xml/manual/status_cxx1998.xml: Adjust whitespace. * doc/xml/manual/status_cxx2011.xml: Likewise. * doc/xml/manual/status_cxx2014.xml: Likewise. * doc/xml/manual/status_cxx2017.xml: Likewise. * doc/xml/manual/status_cxx2020.xml: Likewise. * doc/xml/manual/status_cxx2023.xml: Likewise. * doc/xml/manual/status_cxxtr1.xml: Likewise. * doc/xml/manual/status_cxxtr24733.xml: Likewise. Diff: --- libstdc++-v3/doc/html/manual/status.html | 32 +++ libstdc++-v3/doc/xml/manual/status_cxx1998.xml| 4 +-- libstdc++-v3/doc/xml/manual/status_cxx2011.xml| 4 +-- libstdc++-v3/doc/xml/manual/status_cxx2014.xml| 4 +-- libstdc++-v3/doc/xml/manual/status_cxx2017.xml| 4 +-- libstdc++-v3/doc/xml/manual/status_cxx2020.xml| 4 +-- libstdc++-v3/doc/xml/manual/status_cxx2023.xml| 4 +-- libstdc++-v3/doc/xml/manual/status_cxxtr1.xml | 4 +-- libstdc++-v3/doc/xml/manual/status_cxxtr24733.xml | 4 +-- 9 files changed, 32 insertions(+), 32 deletions(-) diff --git a/libstdc++-v3/doc/html/manual/status.html b/libstdc++-v3/doc/html/manual/status.html index 2e293d32f81..3d55e265272 100644 --- a/libstdc++-v3/doc/html/manual/status.html +++ b/libstdc++-v3/doc/html/manual/status.html @@ -5,8 +5,8 @@ NextChapter 1. StatusTable of ContentsImplementation StatusC++ 1998/2003Implementation StatusImplementation Specific BehaviorC++ 2011Implementation Specific BehaviorC++ 2014Implementation Specific BehaviorFilesystem TSC++ 2017Implementation Specific BehaviorParallelism 2 TSC++ 2020C++ 2023C++ TR1Implementation Specific BehaviorC++ TR 24733C++ IS 29124Implementation Specific BehaviorLicenseThe Code: GPLThe Documentation: GPL, FDLBugsImplementation BugsStandard Bugs Implementation StatusC++ 1998/2003Implementation Status This status table is based on the table of contents of ISO/IEC 14882:2003. -This section describes the C++ support in mainline GCC, not in any -particular release. +This section describes the C++ support in +mainline GCC, not in any particular release. Table 1.1. C++ 1998/2003 Implementation StatusSectionDescriptionStatusComments 18 @@ -160,8 +160,8 @@ since that release. This status table is based on the table of contents of ISO/IEC 14882:2011. -This section describes the C++11 support in mainline GCC, not in any -particular release. +This section describes the C++11 support in +mainline GCC, not in any particular release. Table 1.2. C++ 2011 Implementation StatusSectionDescriptionStatusComments 18 @@ -433,8 +433,8 @@ This status table is based on the table of contents of ISO/IEC 14882:2014. Some subclauses are not shown in the table where the content is unchanged since C++11 and the implementation is complete. -This section describes the C++14 and library TS support in mainline GCC, -not in any particular release. +This section describes the C++14 and library TS support in +mainline GCC, not in any particular release. Table 1.3. C++ 2014 Implementation StatusSectionDescriptionStatusComments 18 @@ -578,8 +578,8 @@ GCC 9.1 was the first release with non-experimental C++17 support, so the API and ABI of features added in C++17 is only stable since that release. -This section describes the C++17 and library TS support in mainline GCC, -not in any particular release. +This section describes the C++17 and library TS support in +mainline GCC, not in any particular release. The following table lists new library features that are included in the C++17 standard. The "Proposal" column provides a link to the @@ -1254,8 +1254,8 @@ options. The pre-defined symbol __cplusplus is used to check for the presence of the required flag. -This section describes the C++20 and library TS support in mainline GCC, -not in any particular release. +This section describes the C++20 and library TS support in +mainline GCC, not in any particular release. The following table lists new library features that are included in the C++20 standard. The "Proposal" column provides a link to the @@ -1724,8 +1724,8 @@ options. The pre-defined symbol __cplusplus is used to check for the presence of the required flag. -This section describes the C++23 and library TS support in mainline GCC, -not in any particular release. +This section describes the C++23 and library TS support in +mainline GCC, not in any particul
[gcc r13-8653] libstdc++: Update status tables to refer to GCC 13 not mainline
https://gcc.gnu.org/g:56f28dd436c75b5cfbd6af7a02bff968894eafa6 commit r13-8653-g56f28dd436c75b5cfbd6af7a02bff968894eafa6 Author: Jonathan Wakely Date: Fri Apr 26 11:46:01 2024 +0100 libstdc++: Update status tables to refer to GCC 13 not mainline This should have been done before the 13.1.0 release. libstdc++-v3/ChangeLog: * doc/html/manual/status.html: Regenerate. * doc/xml/manual/status_cxx1998.xml: Replace references to mainline GCC. * doc/xml/manual/status_cxx2011.xml: Likewise. * doc/xml/manual/status_cxx2014.xml: Likewise. * doc/xml/manual/status_cxx2017.xml: Likewise. * doc/xml/manual/status_cxx2020.xml: Likewise. * doc/xml/manual/status_cxx2023.xml: Likewise. * doc/xml/manual/status_cxxtr1.xml: Likewise. * doc/xml/manual/status_cxxtr24733.xml: Likewise. Diff: --- libstdc++-v3/doc/html/manual/status.html | 32 +++ libstdc++-v3/doc/xml/manual/status_cxx1998.xml| 4 +-- libstdc++-v3/doc/xml/manual/status_cxx2011.xml| 4 +-- libstdc++-v3/doc/xml/manual/status_cxx2014.xml| 4 +-- libstdc++-v3/doc/xml/manual/status_cxx2017.xml| 4 +-- libstdc++-v3/doc/xml/manual/status_cxx2020.xml| 4 +-- libstdc++-v3/doc/xml/manual/status_cxx2023.xml| 4 +-- libstdc++-v3/doc/xml/manual/status_cxxtr1.xml | 4 +-- libstdc++-v3/doc/xml/manual/status_cxxtr24733.xml | 4 +-- 9 files changed, 32 insertions(+), 32 deletions(-) diff --git a/libstdc++-v3/doc/html/manual/status.html b/libstdc++-v3/doc/html/manual/status.html index af94ead2b82..53957bd2e0d 100644 --- a/libstdc++-v3/doc/html/manual/status.html +++ b/libstdc++-v3/doc/html/manual/status.html @@ -5,8 +5,8 @@ NextChapter 1. StatusTable of ContentsImplementation StatusC++ 1998/2003Implementation StatusImplementation Specific BehaviorC++ 2011Implementation Specific BehaviorC++ 2014Implementation Specific BehaviorFilesystem TSC++ 2017Implementation Specific BehaviorParallelism 2 TSC++ 2020C++ 2023C++ TR1Implementation Specific BehaviorC++ TR 24733C++ IS 29124Implementation Specific BehaviorLicenseThe Code: GPLThe Documentation: GPL, FDLBugsImplementation BugsStandard Bugs Implementation StatusC++ 1998/2003Implementation Status This status table is based on the table of contents of ISO/IEC 14882:2003. -This section describes the C++ support in mainline GCC, not in any -particular release. +This section describes the C++ support in +the GCC 13 release series, not in any particular release. Table 1.1. C++ 1998/2003 Implementation StatusSectionDescriptionStatusComments 18 @@ -160,8 +160,8 @@ since that release. This status table is based on the table of contents of ISO/IEC 14882:2011. -This section describes the C++11 support in mainline GCC, not in any -particular release. +This section describes the C++11 support in +the GCC 13 release series, not in any particular release. Table 1.2. C++ 2011 Implementation StatusSectionDescriptionStatusComments 18 @@ -433,8 +433,8 @@ This status table is based on the table of contents of ISO/IEC 14882:2014. Some subclauses are not shown in the table where the content is unchanged since C++11 and the implementation is complete. -This section describes the C++14 and library TS support in mainline GCC, -not in any particular release. +This section describes the C++14 and library TS support in +the GCC 13 release series, not in any particular release. Table 1.3. C++ 2014 Implementation StatusSectionDescriptionStatusComments 18 @@ -578,8 +578,8 @@ GCC 9.1 was the first release with non-experimental C++17 support, so the API and ABI of features added in C++17 is only stable since that release. -This section describes the C++17 and library TS support in mainline GCC, -not in any particular release. +This section describes the C++17 and library TS support in +the GCC 13 release series, not in any particular release. The following table lists new library features that are included in the C++17 standard. The "Proposal" column provides a link to the @@ -1254,8 +1254,8 @@ options. The pre-defined symbol __cplusplus is used to check for the presence of the required flag. -This section describes the C++20 and library TS support in mainline GCC, -not in any particular release. +This section describes the C++20 and library TS support in +the GCC 13 release series, not in any particular release. The following table lists new library features that are included in the C++20 standard. The "Proposal" column provides a link to the @@ -1724,8 +1724,8 @@ options. The pre-defined symbol __cplusplus is used to check for the presence of the required flag. -This section describes the C++23 and library TS support in mainline GCC, -not in any particular release. +This section describes the C++23 and library TS support in +the GCC 13 release ser
[gcc r14-10139] libstdc++: Update status tables to refer to GCC 14 not mainline
https://gcc.gnu.org/g:5e5f33a067d03d11f67eba719d3ef9f37b23886d commit r14-10139-g5e5f33a067d03d11f67eba719d3ef9f37b23886d Author: Jonathan Wakely Date: Fri Apr 26 11:46:01 2024 +0100 libstdc++: Update status tables to refer to GCC 14 not mainline libstdc++-v3/ChangeLog: * doc/html/manual/status.html: Regenerate. * doc/xml/manual/status_cxx1998.xml: Replace references to mainline GCC. * doc/xml/manual/status_cxx2011.xml: Likewise. * doc/xml/manual/status_cxx2014.xml: Likewise. * doc/xml/manual/status_cxx2017.xml: Likewise. * doc/xml/manual/status_cxx2020.xml: Likewise. * doc/xml/manual/status_cxx2023.xml: Likewise. * doc/xml/manual/status_cxxtr1.xml: Likewise. * doc/xml/manual/status_cxxtr24733.xml: Likewise. Diff: --- libstdc++-v3/doc/html/manual/status.html | 32 +++ libstdc++-v3/doc/xml/manual/status_cxx1998.xml| 4 +-- libstdc++-v3/doc/xml/manual/status_cxx2011.xml| 4 +-- libstdc++-v3/doc/xml/manual/status_cxx2014.xml| 4 +-- libstdc++-v3/doc/xml/manual/status_cxx2017.xml| 4 +-- libstdc++-v3/doc/xml/manual/status_cxx2020.xml| 4 +-- libstdc++-v3/doc/xml/manual/status_cxx2023.xml| 4 +-- libstdc++-v3/doc/xml/manual/status_cxxtr1.xml | 4 +-- libstdc++-v3/doc/xml/manual/status_cxxtr24733.xml | 4 +-- 9 files changed, 32 insertions(+), 32 deletions(-) diff --git a/libstdc++-v3/doc/html/manual/status.html b/libstdc++-v3/doc/html/manual/status.html index 2e293d32f81..c13ec20feaa 100644 --- a/libstdc++-v3/doc/html/manual/status.html +++ b/libstdc++-v3/doc/html/manual/status.html @@ -5,8 +5,8 @@ NextChapter 1. StatusTable of ContentsImplementation StatusC++ 1998/2003Implementation StatusImplementation Specific BehaviorC++ 2011Implementation Specific BehaviorC++ 2014Implementation Specific BehaviorFilesystem TSC++ 2017Implementation Specific BehaviorParallelism 2 TSC++ 2020C++ 2023C++ TR1Implementation Specific BehaviorC++ TR 24733C++ IS 29124Implementation Specific BehaviorLicenseThe Code: GPLThe Documentation: GPL, FDLBugsImplementation BugsStandard Bugs Implementation StatusC++ 1998/2003Implementation Status This status table is based on the table of contents of ISO/IEC 14882:2003. -This section describes the C++ support in mainline GCC, not in any -particular release. +This section describes the C++ support in +the GCC 14 release series, not in any particular release. Table 1.1. C++ 1998/2003 Implementation StatusSectionDescriptionStatusComments 18 @@ -160,8 +160,8 @@ since that release. This status table is based on the table of contents of ISO/IEC 14882:2011. -This section describes the C++11 support in mainline GCC, not in any -particular release. +This section describes the C++11 support in +the GCC 14 release series, not in any particular release. Table 1.2. C++ 2011 Implementation StatusSectionDescriptionStatusComments 18 @@ -433,8 +433,8 @@ This status table is based on the table of contents of ISO/IEC 14882:2014. Some subclauses are not shown in the table where the content is unchanged since C++11 and the implementation is complete. -This section describes the C++14 and library TS support in mainline GCC, -not in any particular release. +This section describes the C++14 and library TS support in +the GCC 14 release series, not in any particular release. Table 1.3. C++ 2014 Implementation StatusSectionDescriptionStatusComments 18 @@ -578,8 +578,8 @@ GCC 9.1 was the first release with non-experimental C++17 support, so the API and ABI of features added in C++17 is only stable since that release. -This section describes the C++17 and library TS support in mainline GCC, -not in any particular release. +This section describes the C++17 and library TS support in +the GCC 14 release series, not in any particular release. The following table lists new library features that are included in the C++17 standard. The "Proposal" column provides a link to the @@ -1254,8 +1254,8 @@ options. The pre-defined symbol __cplusplus is used to check for the presence of the required flag. -This section describes the C++20 and library TS support in mainline GCC, -not in any particular release. +This section describes the C++20 and library TS support in +the GCC 14 release series, not in any particular release. The following table lists new library features that are included in the C++20 standard. The "Proposal" column provides a link to the @@ -1724,8 +1724,8 @@ options. The pre-defined symbol __cplusplus is used to check for the presence of the required flag. -This section describes the C++23 and library TS support in mainline GCC, -not in any particular release. +This section describes the C++23 and library TS support in +the GCC 14 release series, not in any particular release. The following table lis
[gcc r15-4] c++: fix source printing for "required from here" message
https://gcc.gnu.org/g:7d5479a2ecf6309281de10b747a7423169a2ff95 commit r15-4-g7d5479a2ecf6309281de10b747a7423169a2ff95 Author: Patrick Palka Date: Fri Apr 26 07:44:25 2024 -0400 c++: fix source printing for "required from here" message It seems the diagnostic machinery's source line printing respects the pretty printer prefix, but this is undesirable for the call to diagnostic_show_locus in print_instantiation_partial_context_line (added in r14-4388-g1c45319b66edc9) since the prefix may have been set when issuing an earlier, unrelated diagnostic and we just want to print an unprefixed source line. This patch naively fixes this by clearing the prefix before calling diagnostic_show_locus. Before this patch, for error60a.C below we'd print gcc/testsuite/g++.dg/template/error60a.C: In function ‘void usage()’: gcc/testsuite/g++.dg/template/error60a.C:24:3: error: ‘unrelated_error’ was not declared in this scope 24 | unrelated_error; // { dg-error "not declared" } | ^~~ gcc/testsuite/g++.dg/template/error60a.C: In instantiation of ‘void test(Foo) [with Foo = int]’: gcc/testsuite/g++.dg/template/error60a.C:25:13: required from here gcc/testsuite/g++.dg/template/error60a.C:24:3: error:25 | test (42); // { dg-message " required from here" } gcc/testsuite/g++.dg/template/error60a.C:24:3: error: | ~~^~~~ gcc/testsuite/g++.dg/template/error60a.C:19:24: error: invalid conversion from ‘int’ to ‘int*’ [-fpermissive] 19 | my_pointer ptr (val); // { dg-error "invalid conversion from 'int' to 'int\\*'" } |^~~ || |int gcc/testsuite/g++.dg/template/error60a.C:9:20: note: initializing argument 1 of ‘my_pointer::my_pointer(Foo*) [with Foo = int]’ 9 | my_pointer (Foo *ptr) // { dg-message " initializing argument 1" } | ~^~~ and afterward we print gcc/testsuite/g++.dg/template/error60a.C: In function ‘void usage()’: gcc/testsuite/g++.dg/template/error60a.C:24:3: error: ‘unrelated_error’ was not declared in this scope 24 | unrelated_error; // { dg-error "not declared" } | ^~~ gcc/testsuite/g++.dg/template/error60a.C: In instantiation of ‘void test(Foo) [with Foo = int]’: gcc/testsuite/g++.dg/template/error60a.C:25:13: required from here 25 | test (42); // { dg-message " required from here" } | ~~^~~~ gcc/testsuite/g++.dg/template/error60a.C:19:24: error: invalid conversion from ‘int’ to ‘int*’ [-fpermissive] 19 | my_pointer ptr (val); // { dg-error "invalid conversion from 'int' to 'int\\*'" } |^~~ || |int gcc/testsuite/g++.dg/template/error60a.C:9:20: note: initializing argument 1 of ‘my_pointer::my_pointer(Foo*) [with Foo = int]’ 9 | my_pointer (Foo *ptr) // { dg-message " initializing argument 1" } | ~^~~ gcc/cp/ChangeLog: * error.cc (print_instantiation_partial_context_line): Clear the pretty printer prefix around the call to diagnostic_show_locus. gcc/testsuite/ChangeLog: * g++.dg/concepts/diagnostic2.C: Expect source line printed for the "required from here" message. * g++.dg/template/error60a.C: New test. Diff: --- gcc/cp/error.cc | 2 ++ gcc/testsuite/g++.dg/concepts/diagnostic2.C | 6 +++- gcc/testsuite/g++.dg/template/error60a.C| 46 + 3 files changed, 53 insertions(+), 1 deletion(-) diff --git a/gcc/cp/error.cc b/gcc/cp/error.cc index 7074845154e..37987ccb570 100644 --- a/gcc/cp/error.cc +++ b/gcc/cp/error.cc @@ -3793,7 +3793,9 @@ print_instantiation_partial_context_line (diagnostic_context *context, : _("required from here\n")); } gcc_rich_location rich_loc (loc); + char *saved_prefix = pp_take_prefix (context->printer); diagnostic_show_locus (context, &rich_loc, DK_NOTE); + pp_set_prefix (context->printer, saved_prefix); } /* Same as print_instantiation_full_context but less verbose. */ diff --git a/gcc/testsuite/g++.dg/concepts/diagnostic2.C b/gcc/testsuite/g++.dg/concepts/diagnostic2.C index 6550ed6b3bd..d6f5872de2c 100644 --- a/gcc/testsuite/g++.dg/concepts/diagnostic2.C +++ b/gcc/testsuite/g++.dg/concepts/diagnostic2.C @@ -23,7 +23,11 @@ void baz() { bar(); // { dg-error "no match" } -/* { dg-begin-multiline-output "" } +/* { dg-begin-multiline-output "for no match error" } + bar(); + ^~ + { dg-end-multiline-output "" } */ +/* { dg-begin-multiline-output "for required from here message" } bar(); ^~ { dg-end-multiline-output "" }
[gcc r14-10140] c++: fix source printing for "required from here" message
https://gcc.gnu.org/g:c014cfd8853240827feb3a4cef92403e83cd4265 commit r14-10140-gc014cfd8853240827feb3a4cef92403e83cd4265 Author: Patrick Palka Date: Fri Apr 26 07:44:25 2024 -0400 c++: fix source printing for "required from here" message It seems the diagnostic machinery's source line printing respects the pretty printer prefix, but this is undesirable for the call to diagnostic_show_locus in print_instantiation_partial_context_line (added in r14-4388-g1c45319b66edc9) since the prefix may have been set when issuing an earlier, unrelated diagnostic and we just want to print an unprefixed source line. This patch naively fixes this by clearing the prefix before calling diagnostic_show_locus. Before this patch, for error60a.C below we'd print gcc/testsuite/g++.dg/template/error60a.C: In function ‘void usage()’: gcc/testsuite/g++.dg/template/error60a.C:24:3: error: ‘unrelated_error’ was not declared in this scope 24 | unrelated_error; // { dg-error "not declared" } | ^~~ gcc/testsuite/g++.dg/template/error60a.C: In instantiation of ‘void test(Foo) [with Foo = int]’: gcc/testsuite/g++.dg/template/error60a.C:25:13: required from here gcc/testsuite/g++.dg/template/error60a.C:24:3: error:25 | test (42); // { dg-message " required from here" } gcc/testsuite/g++.dg/template/error60a.C:24:3: error: | ~~^~~~ gcc/testsuite/g++.dg/template/error60a.C:19:24: error: invalid conversion from ‘int’ to ‘int*’ [-fpermissive] 19 | my_pointer ptr (val); // { dg-error "invalid conversion from 'int' to 'int\\*'" } |^~~ || |int gcc/testsuite/g++.dg/template/error60a.C:9:20: note: initializing argument 1 of ‘my_pointer::my_pointer(Foo*) [with Foo = int]’ 9 | my_pointer (Foo *ptr) // { dg-message " initializing argument 1" } | ~^~~ and afterward we print gcc/testsuite/g++.dg/template/error60a.C: In function ‘void usage()’: gcc/testsuite/g++.dg/template/error60a.C:24:3: error: ‘unrelated_error’ was not declared in this scope 24 | unrelated_error; // { dg-error "not declared" } | ^~~ gcc/testsuite/g++.dg/template/error60a.C: In instantiation of ‘void test(Foo) [with Foo = int]’: gcc/testsuite/g++.dg/template/error60a.C:25:13: required from here 25 | test (42); // { dg-message " required from here" } | ~~^~~~ gcc/testsuite/g++.dg/template/error60a.C:19:24: error: invalid conversion from ‘int’ to ‘int*’ [-fpermissive] 19 | my_pointer ptr (val); // { dg-error "invalid conversion from 'int' to 'int\\*'" } |^~~ || |int gcc/testsuite/g++.dg/template/error60a.C:9:20: note: initializing argument 1 of ‘my_pointer::my_pointer(Foo*) [with Foo = int]’ 9 | my_pointer (Foo *ptr) // { dg-message " initializing argument 1" } | ~^~~ gcc/cp/ChangeLog: * error.cc (print_instantiation_partial_context_line): Clear the pretty printer prefix around the call to diagnostic_show_locus. gcc/testsuite/ChangeLog: * g++.dg/concepts/diagnostic2.C: Expect source line printed for the "required from here" message. * g++.dg/template/error60a.C: New test. (cherry picked from commit 7d5479a2ecf6309281de10b747a7423169a2ff95) Diff: --- gcc/cp/error.cc | 2 ++ gcc/testsuite/g++.dg/concepts/diagnostic2.C | 6 +++- gcc/testsuite/g++.dg/template/error60a.C| 46 + 3 files changed, 53 insertions(+), 1 deletion(-) diff --git a/gcc/cp/error.cc b/gcc/cp/error.cc index 7074845154e..37987ccb570 100644 --- a/gcc/cp/error.cc +++ b/gcc/cp/error.cc @@ -3793,7 +3793,9 @@ print_instantiation_partial_context_line (diagnostic_context *context, : _("required from here\n")); } gcc_rich_location rich_loc (loc); + char *saved_prefix = pp_take_prefix (context->printer); diagnostic_show_locus (context, &rich_loc, DK_NOTE); + pp_set_prefix (context->printer, saved_prefix); } /* Same as print_instantiation_full_context but less verbose. */ diff --git a/gcc/testsuite/g++.dg/concepts/diagnostic2.C b/gcc/testsuite/g++.dg/concepts/diagnostic2.C index 6550ed6b3bd..d6f5872de2c 100644 --- a/gcc/testsuite/g++.dg/concepts/diagnostic2.C +++ b/gcc/testsuite/g++.dg/concepts/diagnostic2.C @@ -23,7 +23,11 @@ void baz() { bar(); // { dg-error "no match" } -/* { dg-begin-multiline-output "" } +/* { dg-begin-multiline-output "for no match error" } + bar(); + ^~ + { dg-end-multiline-output "" } */ +/* { dg-begin-multiline-output "for required
[gcc r15-5] libstdc++: Do not apply localized formatting to NaN and inf [PR114863]
https://gcc.gnu.org/g:a0bc71e480132a528a4869c1cd7863f709768c53 commit r15-5-ga0bc71e480132a528a4869c1cd7863f709768c53 Author: Jonathan Wakely Date: Fri Apr 26 11:42:26 2024 +0100 libstdc++: Do not apply localized formatting to NaN and inf [PR114863] We don't want to add grouping to strings like "-inf", and there is no radix character to replace either. libstdc++-v3/ChangeLog: PR libstdc++/114863 * include/std/format (__formatter_fp::format): Only use _M_localized for finite values. * testsuite/std/format/functions/format.cc: Check localized formatting of NaN and initiny. Diff: --- libstdc++-v3/include/std/format | 2 +- libstdc++-v3/testsuite/std/format/functions/format.cc | 8 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format index 22dcb5f24bd..48deba2bcb2 100644 --- a/libstdc++-v3/include/std/format +++ b/libstdc++-v3/include/std/format @@ -1734,7 +1734,7 @@ namespace __format } #endif - if (_M_spec._M_localized) + if (_M_spec._M_localized && __builtin_isfinite(__v)) { __wstr = _M_localize(__str, __expc, __fc.locale()); if (!__wstr.empty()) diff --git a/libstdc++-v3/testsuite/std/format/functions/format.cc b/libstdc++-v3/testsuite/std/format/functions/format.cc index 4499397aaf9..78cc1ab482a 100644 --- a/libstdc++-v3/testsuite/std/format/functions/format.cc +++ b/libstdc++-v3/testsuite/std/format/functions/format.cc @@ -248,6 +248,14 @@ test_locale() s = std::format(cloc, "{:05L}", -1.0); // PR libstdc++/110968 VERIFY( s == "-0001" ); + // PR libstdc++/114863 grouping applied to nan and inf + double inf = std::numeric_limits::infinity(); + s = std::format(eloc, "{0:Le} {0:Lf} {0:Lg}", -inf); + VERIFY( s == "-inf -inf -inf" ); + double nan = std::numeric_limits::quiet_NaN(); + s = std::format(eloc, "{0:Le} {0:Lf} {0:Lg}", -nan); + VERIFY( s == "-nan -nan -nan" ); + // Restore std::locale::global(cloc); }
[gcc r12-10396] gfortran: Allow ref'ing PDT's len() in parameter-initializer.
https://gcc.gnu.org/g:8ad460ca8824f7e29e38a63f9cb4a9a3b96d506f commit r12-10396-g8ad460ca8824f7e29e38a63f9cb4a9a3b96d506f Author: Andre Vehreschild Date: Wed Jul 12 12:51:30 2023 +0200 gfortran: Allow ref'ing PDT's len() in parameter-initializer. Fix declaring a parameter initialized using a pdt_len reference not simplifying the reference to a constant. 2023-07-12 Andre Vehreschild gcc/fortran/ChangeLog: PR fortran/102003 * expr.cc (find_inquiry_ref): Replace len of pdt_string by constant. (simplify_ref_chain): Ensure input to find_inquiry_ref is NULL. (gfc_match_init_expr): Prevent PDT analysis for function calls. (gfc_pdt_find_component_copy_initializer): Get the initializer value for given component. * gfortran.h (gfc_pdt_find_component_copy_initializer): New function. * simplify.cc (gfc_simplify_len): Replace len() of PDT with pdt component ref or constant. gcc/testsuite/ChangeLog: * gfortran.dg/pdt_33.f03: New test. (cherry picked from commit f9182da3213aa57c16dd0b52862126de4a259f6a) Diff: --- gcc/fortran/expr.cc | 31 ++-- gcc/fortran/gfortran.h | 1 + gcc/fortran/simplify.cc | 57 gcc/testsuite/gfortran.dg/pdt_33.f03 | 21 + 4 files changed, 94 insertions(+), 16 deletions(-) diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc index c04403a2b89..5640d215925 100644 --- a/gcc/fortran/expr.cc +++ b/gcc/fortran/expr.cc @@ -1850,6 +1850,13 @@ find_inquiry_ref (gfc_expr *p, gfc_expr **newp) else if (tmp->expr_type == EXPR_CONSTANT) *newp = gfc_get_int_expr (gfc_default_integer_kind, NULL, tmp->value.character.length); + else if (gfc_init_expr_flag + && tmp->ts.u.cl->length->symtree->n.sym->attr.pdt_len) + *newp = gfc_pdt_find_component_copy_initializer (tmp->symtree->n +.sym, +tmp->ts.u.cl +->length->symtree +->n.sym->name); else goto cleanup; @@ -1890,7 +1897,9 @@ find_inquiry_ref (gfc_expr *p, gfc_expr **newp) mpc_imagref (tmp->value.complex), GFC_RND_MODE); break; } - tmp = gfc_copy_expr (*newp); + // TODO: Fix leaking expr tmp, when simplify is done twice. + if (inquiry->next) + gfc_replace_expr (tmp, *newp); } if (!(*newp)) @@ -2055,7 +2064,7 @@ static bool simplify_ref_chain (gfc_ref *ref, int type, gfc_expr **p) { int n; - gfc_expr *newp; + gfc_expr *newp = NULL; for (; ref; ref = ref->next) { @@ -3217,7 +3226,7 @@ gfc_match_init_expr (gfc_expr **result) return m; } - if (gfc_derived_parameter_expr (expr)) + if (expr->expr_type != EXPR_FUNCTION && gfc_derived_parameter_expr (expr)) { *result = expr; gfc_init_expr_flag = false; @@ -6530,3 +6539,19 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool alloc_obj, return true; } + +gfc_expr* +gfc_pdt_find_component_copy_initializer (gfc_symbol *sym, const char *name) +{ + /* The actual length of a pdt is in its components. In the + initializer of the current ref is only the default value. + Therefore traverse the chain of components and pick the correct + one's initializer expressions. */ + for (gfc_component *comp = sym->ts.u.derived->components; comp != NULL; + comp = comp->next) +{ + if (!strcmp (comp->name, name)) + return gfc_copy_expr (comp->initializer); +} + return NULL; +} diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index 98c0cd39503..0b0a8fe7118 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -3667,6 +3667,7 @@ gfc_expr* gfc_find_stat_co (gfc_expr *); gfc_expr* gfc_build_intrinsic_call (gfc_namespace *, gfc_isym_id, const char*, locus, unsigned, ...); bool gfc_check_vardef_context (gfc_expr*, bool, bool, bool, const char*); +gfc_expr* gfc_pdt_find_component_copy_initializer (gfc_symbol *, const char *); /* st.cc */ diff --git a/gcc/fortran/simplify.cc b/gcc/fortran/simplify.cc index 83b4e7d3493..a10f79c4a93 100644 --- a/gcc/fortran/simplify.cc +++ b/gcc/fortran/simplify.cc @@ -4525,19 +4525,50 @@ gfc_simplify_len (gfc_expr *e, gfc_expr *kind) return range_check (result, "LEN"); } else if (e->expr_type == EXPR_VARIABLE && e->ts.type == BT_CHARACTER - && e->symtree->n.sym - && e->symtree->n.sym->ts.type != BT_DERIVED - && e->symtree->n.sym->assoc && e->symtree->n.
[gcc r13-8654] aarch64: Fix SCHEDULER_IDENT for Cortex-A510
https://gcc.gnu.org/g:28b3b8a2fe55521a43f3710cf6ced1ab63f1ea03 commit r13-8654-g28b3b8a2fe55521a43f3710cf6ced1ab63f1ea03 Author: Richard Ball Date: Fri Apr 26 18:15:23 2024 +0100 aarch64: Fix SCHEDULER_IDENT for Cortex-A510 The SCHEDULER_IDENT for this CPU was incorrectly set to cortexa55. This can cause sub-optimal asm to be generated. gcc/ChangeLog: PR target/114272 * config/aarch64/aarch64-cores.def (AARCH64_CORE): Change SCHEDULER_IDENT from cortexa55 to cortexa53 for Cortex-A510. Diff: --- gcc/config/aarch64/aarch64-cores.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/config/aarch64/aarch64-cores.def b/gcc/config/aarch64/aarch64-cores.def index 8d9eb817d6d..fdda0697b88 100644 --- a/gcc/config/aarch64/aarch64-cores.def +++ b/gcc/config/aarch64/aarch64-cores.def @@ -168,7 +168,7 @@ AARCH64_CORE("cortex-r82", cortexr82, cortexa53, V8R, (), cortexa53, 0x41, 0xd15 /* Armv9.0-A Architecture Processors. */ /* Arm ('A') cores. */ -AARCH64_CORE("cortex-a510", cortexa510, cortexa55, V9A, (SVE2_BITPERM, MEMTAG, I8MM, BF16), cortexa53, 0x41, 0xd46, -1) +AARCH64_CORE("cortex-a510", cortexa510, cortexa53, V9A, (SVE2_BITPERM, MEMTAG, I8MM, BF16), cortexa53, 0x41, 0xd46, -1) AARCH64_CORE("cortex-a710", cortexa710, cortexa57, V9A, (SVE2_BITPERM, MEMTAG, I8MM, BF16), neoversen2, 0x41, 0xd47, -1)
[gcc r12-10397] aarch64: Fix SCHEDULER_IDENT for Cortex-A510
https://gcc.gnu.org/g:751a0f54345b7e037db7f0389c19c1f87e0ae4de commit r12-10397-g751a0f54345b7e037db7f0389c19c1f87e0ae4de Author: Richard Ball Date: Fri Apr 26 18:21:07 2024 +0100 aarch64: Fix SCHEDULER_IDENT for Cortex-A510 The SCHEDULER_IDENT for this CPU was incorrectly set to cortexa55. This can cause sub-optimal asm to be generated. gcc/ChangeLog: PR target/114272 * config/aarch64/aarch64-cores.def (AARCH64_CORE): Change SCHEDULER_IDENT from cortexa55 to cortexa53 for Cortex-A510. Diff: --- gcc/config/aarch64/aarch64-cores.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/config/aarch64/aarch64-cores.def b/gcc/config/aarch64/aarch64-cores.def index 30b5591f1a3..956afa70714 100644 --- a/gcc/config/aarch64/aarch64-cores.def +++ b/gcc/config/aarch64/aarch64-cores.def @@ -164,7 +164,7 @@ AARCH64_CORE("cortex-r82", cortexr82, cortexa53, 8R, AARCH64_FL_FOR_ARCH8_R, cor /* Armv9.0-A Architecture Processors. */ /* Arm ('A') cores. */ -AARCH64_CORE("cortex-a510", cortexa510, cortexa55, 9A, AARCH64_FL_FOR_ARCH9 | AARCH64_FL_SVE2_BITPERM | AARCH64_FL_MEMTAG +AARCH64_CORE("cortex-a510", cortexa510, cortexa53, 9A, AARCH64_FL_FOR_ARCH9 | AARCH64_FL_SVE2_BITPERM | AARCH64_FL_MEMTAG | AARCH64_FL_I8MM | AARCH64_FL_BF16, cortexa53, 0x41, 0xd46, -1) AARCH64_CORE("cortex-a710", cortexa710, cortexa57, 9A, AARCH64_FL_FOR_ARCH9 | AARCH64_FL_SVE2_BITPERM | AARCH64_FL_MEMTAG | AARCH64_FL_I8MM | AARCH64_FL_BF16, neoversen2, 0x41, 0xd47, -1)
[gcc r15-6] libatomic: Cleanup macros in atomic_16.S
https://gcc.gnu.org/g:5716f8daf3f2abc54ececa61350fff0af2e7ce90 commit r15-6-g5716f8daf3f2abc54ececa61350fff0af2e7ce90 Author: Wilco Dijkstra Date: Tue Mar 26 15:42:16 2024 + libatomic: Cleanup macros in atomic_16.S Cleanup the macros to add the libat_ prefixes in atomic_16.S. Emit the alias to __atomic_ when ifuncs are not enabled in the ENTRY macro. libatomic: * config/linux/aarch64/atomic_16.S: Add __libat_ prefix in the LSE2/LSE128/CORE macros, remove elsewhere. Add ATOMIC macro. Diff: --- libatomic/config/linux/aarch64/atomic_16.S | 220 + 1 file changed, 102 insertions(+), 118 deletions(-) diff --git a/libatomic/config/linux/aarch64/atomic_16.S b/libatomic/config/linux/aarch64/atomic_16.S index 4e3fa870b03..b63e97ac5a2 100644 --- a/libatomic/config/linux/aarch64/atomic_16.S +++ b/libatomic/config/linux/aarch64/atomic_16.S @@ -45,7 +45,7 @@ # define HAVE_FEAT_LSE128 0 #endif -#define HAVE_FEAT_LSE2 HAVE_IFUNC +#define HAVE_FEAT_LSE2 HAVE_IFUNC #if HAVE_FEAT_LSE128 .arch armv9-a+lse128 @@ -53,31 +53,37 @@ .arch armv8-a+lse #endif -#define LSE128(NAME) NAME##_i1 -#define LSE2(NAME) NAME##_i2 -#define CORE(NAME) NAME +#define LSE128(NAME) libat_##NAME##_i1 +#define LSE2(NAME) libat_##NAME##_i2 +#define CORE(NAME) libat_##NAME +#define ATOMIC(NAME) __atomic_##NAME -#define ENTRY_FEAT(NAME, FEAT) \ - ENTRY (FEAT (NAME)) +#if HAVE_IFUNC +# define ENTRY(NAME) ENTRY2 (CORE (NAME), ) +# define ENTRY_FEAT(NAME, FEAT) ENTRY2 (FEAT (NAME), ) +# define END_FEAT(NAME, FEAT) END2 (FEAT (NAME)) +#else +/* Emit __atomic_* entrypoints if no ifuncs. */ +# define ENTRY(NAME) ENTRY2 (CORE (NAME), ALIAS (NAME, ATOMIC, CORE)) +#endif + +#define END(NAME) END2 (CORE (NAME)) -#define ENTRY(NAME)\ +#define ENTRY2(NAME, ALIASES) \ .global NAME; \ .hidden NAME; \ .type NAME,%function; \ .p2align 4; \ + ALIASES;\ NAME: \ - .cfi_startproc; \ - hint34 // bti c - -#define END_FEAT(NAME, FEAT) \ - END (FEAT (NAME)) + .cfi_startproc; \ + hint34; // bti c -#define END(NAME) \ +#define END2(NAME) \ .cfi_endproc; \ .size NAME, .-NAME; -#define ALIAS(NAME, FROM, TO) ALIAS1 (FROM (NAME),TO (NAME)) -#define ALIAS2(NAME) ALIAS1 (__atomic_##NAME, libat_##NAME) +#define ALIAS(NAME, FROM, TO) ALIAS1 (FROM (NAME), TO (NAME)) #define ALIAS1(ALIAS, NAME)\ .global ALIAS; \ @@ -116,7 +122,7 @@ NAME: \ #define SEQ_CST 5 -ENTRY (libat_load_16) +ENTRY (load_16) mov x5, x0 cbnzw1, 2f @@ -131,11 +137,11 @@ ENTRY (libat_load_16) stxpw4, res0, res1, [x5] cbnzw4, 2b ret -END (libat_load_16) +END (load_16) #if HAVE_FEAT_LSE2 -ENTRY_FEAT (libat_load_16, LSE2) +ENTRY_FEAT (load_16, LSE2) cbnzw1, 1f /* RELAXED. */ @@ -155,11 +161,11 @@ ENTRY_FEAT (libat_load_16, LSE2) ldp res0, res1, [x0] dmb ishld ret -END_FEAT (libat_load_16, LSE2) +END_FEAT (load_16, LSE2) #endif -ENTRY (libat_store_16) +ENTRY (store_16) cbnzw4, 2f /* RELAXED. */ @@ -173,11 +179,11 @@ ENTRY (libat_store_16) stlxp w4, in0, in1, [x0] cbnzw4, 2b ret -END (libat_store_16) +END (store_16) #if HAVE_FEAT_LSE2 -ENTRY_FEAT (libat_store_16, LSE2) +ENTRY_FEAT (store_16, LSE2) cbnzw4, 1f /* RELAXED. */ @@ -189,11 +195,11 @@ ENTRY_FEAT (libat_store_16, LSE2) stlxp w4, in0, in1, [x0] cbnzw4, 1b ret -END_FEAT (libat_store_16, LSE2) +END_FEAT (store_16, LSE2) #endif -ENTRY (libat_exchange_16) +ENTRY (exchange_16) mov x5, x0 cbnzw4, 2f @@ -217,11 +223,11 @@ ENTRY (libat_exchange_16) stlxp w4, in0, in1, [x5] cbnzw4, 4b ret -END (libat_exchange_16) +END (exchange_16) #if HAVE_FEAT_LSE128 -ENTRY_FEAT (libat_exchange_16, LSE128) +ENTRY_FEAT (exchange_16, LSE128) mov tmp0, x0 mov res0, in0 mov res1, in1 @@ -241,11 +247,11 @@ ENTRY_FEAT (libat_exchange_16, LSE128) /* RELEASE/ACQ_REL/SEQ_CST. */ 2: swppal res0, res1, [tmp0] ret -END_FEAT (libat_exchange_16, LSE128) +END_FEAT (exchange_16, LSE128) #endif -ENTRY (libat_compare_exchange_16) +ENTRY (compare_exchange_16) ldp exp0, exp1, [x1] cbz w4, 3f cmp w4, RELEASE @@ -289,11 +295,11 @@ ENTRY (libat_compare_exchange_16) stp tmp0, tmp1, [x1] 6: csetx0, eq ret -END (libat_compare_exchange_16) +END (compare_exchange_16) #if HAVE_FEAT_LSE2 -ENTRY_FEAT (libat_com
[gcc r15-7] AArch64: Remove AARCH64_EXTRA_TUNE_NO_LDP_STP_QREGS
https://gcc.gnu.org/g:768fbb56b3285b2a3cf067881e745e0f8caec215 commit r15-7-g768fbb56b3285b2a3cf067881e745e0f8caec215 Author: Wilco Dijkstra Date: Fri Apr 26 15:09:31 2024 +0100 AArch64: Remove AARCH64_EXTRA_TUNE_NO_LDP_STP_QREGS Remove the tune AARCH64_EXTRA_TUNE_NO_LDP_STP_QREGS since it is only used by an old core and doesn't properly support -Os. SPECINT_2017 shows that removing it has no performance difference, while codesize is reduced by 0.07%. gcc/ChangeLog: * config/aarch64/aarch64.cc (aarch64_mode_valid_for_sched_fusion_p): Remove check for AARCH64_EXTRA_TUNE_NO_LDP_STP_QREGS. (aarch64_advsimd_ldp_stp_p): Likewise. (aarch64_stp_sequence_cost): Likewise. (aarch64_expand_cpymem): Likewise. (aarch64_expand_setmem): Likewise. * config/aarch64/aarch64-ldp-fusion.cc (ldp_operand_mode_ok_p): Likewise. * config/aarch64/aarch64-ldpstp.md: Likewise. * config/aarch64/aarch64-tuning-flags.def: Remove NO_LDP_STP_QREGS. * config/aarch64/tuning_models/emag.h: Likewise. * config/aarch64/tuning_models/xgene1.h: Likewise. gcc/testsuite: * gcc.target/aarch64/ldp_stp_q_disable.c: Remove test. Diff: --- gcc/config/aarch64/aarch64-ldp-fusion.cc | 8 --- gcc/config/aarch64/aarch64-ldpstp.md | 8 ++- gcc/config/aarch64/aarch64-tuning-flags.def| 3 --- gcc/config/aarch64/aarch64.cc | 22 -- gcc/config/aarch64/tuning_models/emag.h| 2 +- gcc/config/aarch64/tuning_models/xgene1.h | 2 +- .../gcc.target/aarch64/ldp_stp_q_disable.c | 26 -- 7 files changed, 8 insertions(+), 63 deletions(-) diff --git a/gcc/config/aarch64/aarch64-ldp-fusion.cc b/gcc/config/aarch64/aarch64-ldp-fusion.cc index 365dcf48b22..0bc225dae7b 100644 --- a/gcc/config/aarch64/aarch64-ldp-fusion.cc +++ b/gcc/config/aarch64/aarch64-ldp-fusion.cc @@ -315,17 +315,9 @@ any_post_modify_p (rtx x) static bool ldp_operand_mode_ok_p (machine_mode mode) { - const bool allow_qregs -= !(aarch64_tune_params.extra_tuning_flags - & AARCH64_EXTRA_TUNE_NO_LDP_STP_QREGS); - if (!aarch64_ldpstp_operand_mode_p (mode)) return false; - const auto size = GET_MODE_SIZE (mode).to_constant (); - if (size == 16 && !allow_qregs) -return false; - // We don't pair up TImode accesses before RA because TImode is // special in that it can be allocated to a pair of GPRs or a single // FPR, and the RA is best placed to make that decision. diff --git a/gcc/config/aarch64/aarch64-ldpstp.md b/gcc/config/aarch64/aarch64-ldpstp.md index b7c0bf05cd1..7890a8cc32b 100644 --- a/gcc/config/aarch64/aarch64-ldpstp.md +++ b/gcc/config/aarch64/aarch64-ldpstp.md @@ -96,9 +96,7 @@ (set (match_operand:VQ2 2 "register_operand" "") (match_operand:VQ2 3 "memory_operand" ""))] "TARGET_FLOAT - && aarch64_operands_ok_for_ldpstp (operands, true) - && (aarch64_tune_params.extra_tuning_flags - & AARCH64_EXTRA_TUNE_NO_LDP_STP_QREGS) == 0" + && aarch64_operands_ok_for_ldpstp (operands, true)" [(const_int 0)] { aarch64_finish_ldpstp_peephole (operands, true); @@ -111,9 +109,7 @@ (set (match_operand:VQ2 2 "memory_operand" "") (match_operand:VQ2 3 "register_operand" ""))] "TARGET_FLOAT - && aarch64_operands_ok_for_ldpstp (operands, false) - && (aarch64_tune_params.extra_tuning_flags - & AARCH64_EXTRA_TUNE_NO_LDP_STP_QREGS) == 0" + && aarch64_operands_ok_for_ldpstp (operands, false)" [(const_int 0)] { aarch64_finish_ldpstp_peephole (operands, false); diff --git a/gcc/config/aarch64/aarch64-tuning-flags.def b/gcc/config/aarch64/aarch64-tuning-flags.def index d917da720b2..d5bcaebce77 100644 --- a/gcc/config/aarch64/aarch64-tuning-flags.def +++ b/gcc/config/aarch64/aarch64-tuning-flags.def @@ -36,9 +36,6 @@ AARCH64_EXTRA_TUNING_OPTION ("rename_fma_regs", RENAME_FMA_REGS) are not considered cheap. */ AARCH64_EXTRA_TUNING_OPTION ("cheap_shift_extend", CHEAP_SHIFT_EXTEND) -/* Disallow load/store pair instructions on Q-registers. */ -AARCH64_EXTRA_TUNING_OPTION ("no_ldp_stp_qregs", NO_LDP_STP_QREGS) - AARCH64_EXTRA_TUNING_OPTION ("rename_load_regs", RENAME_LOAD_REGS) AARCH64_EXTRA_TUNING_OPTION ("cse_sve_vl_constants", CSE_SVE_VL_CONSTANTS) diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 1beec94629d..bf5fb129b45 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -10400,9 +10400,7 @@ aarch64_mode_valid_for_sched_fusion_p (machine_mode mode) || mode == SDmode || mode == DDmode || (aarch64_vector_mode_supported_p (mode) && (known_eq (GET_MODE_SIZE (mode), 8) -|| (known_eq (GET_MODE_SIZE (mode), 16) - && (aarch64_tune_params.extra_tuning_flags -
[gcc r15-8] AArch64: Cleanup memset expansion
https://gcc.gnu.org/g:6b86f71165de9ee64fb76489c04ce032dd74ac21 commit r15-8-g6b86f71165de9ee64fb76489c04ce032dd74ac21 Author: Wilco Dijkstra Date: Wed Feb 21 23:34:37 2024 + AArch64: Cleanup memset expansion Cleanup memset implementation. Similar to memcpy/memmove, use an offset and bytes throughout. Simplify the complex calculations when optimizing for size by using a fixed limit. gcc/ChangeLog: * config/aarch64/aarch64.cc (MAX_SET_SIZE): New define. (aarch64_progress_pointer): Remove function. (aarch64_set_one_block_and_progress_pointer): Simplify and clean up. (aarch64_expand_setmem): Clean up implementation, use byte offsets, simplify size calculation. Diff: --- gcc/config/aarch64/aarch64.cc | 157 ++ 1 file changed, 35 insertions(+), 122 deletions(-) diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index bf5fb129b45..a4b7db62546 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -103,6 +103,10 @@ /* Defined for convenience. */ #define POINTER_BYTES (POINTER_SIZE / BITS_PER_UNIT) +/* Maximum bytes set for an inline memset expansion. With -Os use 3 STP + and 1 MOVI/DUP (same size as a call). */ +#define MAX_SET_SIZE(speed) (speed ? 256 : 96) + /* Flags that describe how a function shares certain architectural state with its callers. @@ -26565,15 +26569,6 @@ aarch64_move_pointer (rtx pointer, poly_int64 amount) next, amount); } -/* Return a new RTX holding the result of moving POINTER forward by the - size of the mode it points to. */ - -static rtx -aarch64_progress_pointer (rtx pointer) -{ - return aarch64_move_pointer (pointer, GET_MODE_SIZE (GET_MODE (pointer))); -} - /* Expand a cpymem/movmem using the MOPS extension. OPERANDS are taken from the cpymem/movmem pattern. IS_MEMMOVE is true if this is a memmove rather than memcpy. Return true iff we succeeded. */ @@ -26699,48 +26694,6 @@ aarch64_expand_cpymem (rtx *operands, bool is_memmove) return true; } -/* Like aarch64_copy_one_block_and_progress_pointers, except for memset where - SRC is a register we have created with the duplicated value to be set. */ -static void -aarch64_set_one_block_and_progress_pointer (rtx src, rtx *dst, - machine_mode mode) -{ - /* If we are copying 128bits or 256bits, we can do that straight from - the SIMD register we prepared. */ - if (known_eq (GET_MODE_BITSIZE (mode), 256)) -{ - mode = GET_MODE (src); - /* "Cast" the *dst to the correct mode. */ - *dst = adjust_address (*dst, mode, 0); - /* Emit the memset. */ - emit_move_insn (*dst, src); - emit_move_insn (aarch64_move_pointer (*dst, 16), src); - - /* Move the pointers forward. */ - *dst = aarch64_move_pointer (*dst, 32); - return; -} - if (known_eq (GET_MODE_BITSIZE (mode), 128)) -{ - /* "Cast" the *dst to the correct mode. */ - *dst = adjust_address (*dst, GET_MODE (src), 0); - /* Emit the memset. */ - emit_move_insn (*dst, src); - /* Move the pointers forward. */ - *dst = aarch64_move_pointer (*dst, 16); - return; -} - /* For copying less, we have to extract the right amount from src. */ - rtx reg = lowpart_subreg (mode, src, GET_MODE (src)); - - /* "Cast" the *dst to the correct mode. */ - *dst = adjust_address (*dst, mode, 0); - /* Emit the memset. */ - emit_move_insn (*dst, reg); - /* Move the pointer forward. */ - *dst = aarch64_progress_pointer (*dst); -} - /* Expand a setmem using the MOPS instructions. OPERANDS are the same as for the setmem pattern. Return true iff we succeed. */ static bool @@ -26767,24 +26720,21 @@ aarch64_expand_setmem_mops (rtx *operands) bool aarch64_expand_setmem (rtx *operands) { - int n, mode_bits; + int mode_bytes; unsigned HOST_WIDE_INT len; rtx dst = operands[0]; rtx val = operands[2], src; unsigned align = UINTVAL (operands[3]); rtx base; - machine_mode cur_mode = BLKmode, next_mode; + machine_mode mode = BLKmode, next_mode; /* Variable-sized or strict-align memset may use the MOPS expansion. */ if (!CONST_INT_P (operands[1]) || !TARGET_SIMD || (STRICT_ALIGNMENT && align < 16)) return aarch64_expand_setmem_mops (operands); - bool size_p = optimize_function_for_size_p (cfun); - - /* Default the maximum to 256-bytes when considering only libcall vs - SIMD broadcast sequence. */ - unsigned max_set_size = 256; + /* Set inline limits for memset. MOPS has a separate threshold. */ + unsigned max_set_size = MAX_SET_SIZE (optimize_function_for_speed_p (cfun)); unsigned mops_threshold = aarch64_mops_memset_size_threshold; len = UINTVAL (operands[1]); @@ -26793,88 +26743,51 @@ aarch64_expand_setmem (rtx *operands) if (len > m
[gcc r12-10398] Fortran: Fix assumed length chars and len inquiry [PR103716]
https://gcc.gnu.org/g:b482968801158116dd8ba3b15a4c29143b2a423a commit r12-10398-gb482968801158116dd8ba3b15a4c29143b2a423a Author: Paul Thomas Date: Tue May 23 06:46:37 2023 +0100 Fortran: Fix assumed length chars and len inquiry [PR103716] 2023-05-23 Paul Thomas gcc/fortran PR fortran/103716 * resolve.cc (gfc_resolve_ref): Conversion of array_ref into an element should be done for all characters without a len expr, not just deferred lens, and for integer expressions. * trans-expr.cc (conv_inquiry): For len and kind inquiry refs, set the se string_length to NULL_TREE. gcc/testsuite/ PR fortran/103716 * gfortran.dg/pr103716.f90 : New test. (cherry picked from commit 842a432b02238361ecc601d301ac400a7f30f4fa) Diff: --- gcc/fortran/resolve.cc | 4 +++- gcc/fortran/trans-expr.cc | 2 ++ gcc/testsuite/gfortran.dg/pr103716.f90 | 15 +++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc index 9264322f671..6a7325e15e7 100644 --- a/gcc/fortran/resolve.cc +++ b/gcc/fortran/resolve.cc @@ -5461,7 +5461,9 @@ gfc_resolve_ref (gfc_expr *expr) case REF_INQUIRY: /* Implement requirement in note 9.7 of F2018 that the result of the LEN inquiry be a scalar. */ - if (ref->u.i == INQUIRY_LEN && array_ref && expr->ts.deferred) + if (ref->u.i == INQUIRY_LEN && array_ref + && ((expr->ts.type == BT_CHARACTER && !expr->ts.u.cl->length) + || expr->ts.type == BT_INTEGER)) { array_ref->u.ar.type = AR_ELEMENT; expr->rank = 0; diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc index 11ee1931b8e..e78a01003c9 100644 --- a/gcc/fortran/trans-expr.cc +++ b/gcc/fortran/trans-expr.cc @@ -2854,11 +2854,13 @@ conv_inquiry (gfc_se * se, gfc_ref * ref, gfc_expr *expr, gfc_typespec *ts) case INQUIRY_KIND: res = build_int_cst (gfc_typenode_for_spec (&expr->ts), ts->kind); + se->string_length = NULL_TREE; break; case INQUIRY_LEN: res = fold_convert (gfc_typenode_for_spec (&expr->ts), se->string_length); + se->string_length = NULL_TREE; break; default: diff --git a/gcc/testsuite/gfortran.dg/pr103716.f90 b/gcc/testsuite/gfortran.dg/pr103716.f90 new file mode 100644 index 000..4f78900839e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr103716.f90 @@ -0,0 +1,15 @@ +! { dg-do compile } +! +! The gimplifier used to throw a fit on thes two functions. +! +! Contributed by Gerhard Steinmetz +! +function f1(x) + character(*) :: x(*) + print *, g(x%len) +end + +function f2(x) + character(*) :: x(3) + print *, g(x%len) +end
[gcc r15-10] RISC-V: Add -X to link spec
https://gcc.gnu.org/g:50c218e3ffe57860591a987ecf44fcc0abb31f2c commit r15-10-g50c218e3ffe57860591a987ecf44fcc0abb31f2c Author: Fangrui Song Date: Fri Apr 26 18:14:33 2024 -0700 RISC-V: Add -X to link spec --discard-locals (-X) instructs the linker to remove local .L* symbols, which occur a lot due to label differences for linker relaxation. The arm port has a similar need and passes -X to ld. In contrast, the RISC-V port does not pass -X to ld and rely on the default --discard-locals in GNU ld's riscv port. The arm way is more conventional (compiler driver instead of the linker customizes the default linker behavior) and works with lld. gcc/ChangeLog: * config/riscv/elf.h (LINK_SPEC): Add -X. * config/riscv/freebsd.h (LINK_SPEC): Add -X. * config/riscv/linux.h (LINK_SPEC): Add -X. Diff: --- gcc/config/riscv/elf.h | 1 + gcc/config/riscv/freebsd.h | 1 + gcc/config/riscv/linux.h | 1 + 3 files changed, 3 insertions(+) diff --git a/gcc/config/riscv/elf.h b/gcc/config/riscv/elf.h index f533764d9f8..c97f13c0cca 100644 --- a/gcc/config/riscv/elf.h +++ b/gcc/config/riscv/elf.h @@ -20,6 +20,7 @@ along with GCC; see the file COPYING3. If not see #define LINK_SPEC "\ -melf" XLEN_SPEC DEFAULT_ENDIAN_SPEC "riscv \ %{mno-relax:--no-relax} \ +-X \ %{mbig-endian:-EB} \ %{mlittle-endian:-EL} \ %{shared}" diff --git a/gcc/config/riscv/freebsd.h b/gcc/config/riscv/freebsd.h index bd08a985285..5dd4d51c42b 100644 --- a/gcc/config/riscv/freebsd.h +++ b/gcc/config/riscv/freebsd.h @@ -44,6 +44,7 @@ along with GCC; see the file COPYING3. If not see %{p:%nconsider using `-pg' instead of `-p' with gprof (1)} \ %{v:-V} \ %{assert*} %{R*} %{rpath*} %{defsym*}\ + -X \ %{mbig-endian:-EB} \ %{mlittle-endian:-EL}\ %{shared:-Bshareable %{h*} %{soname*}} \ diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h index 15851f653bc..3c356227134 100644 --- a/gcc/config/riscv/linux.h +++ b/gcc/config/riscv/linux.h @@ -50,6 +50,7 @@ along with GCC; see the file COPYING3. If not see #define LINK_SPEC "\ -melf" XLEN_SPEC DEFAULT_ENDIAN_SPEC "riscv" LD_EMUL_SUFFIX " \ %{mno-relax:--no-relax} \ +-X \ %{mbig-endian:-EB} \ %{mlittle-endian:-EL} \ %{shared} \
[gcc r15-11] LoongArch: Add constraints for bit string operation define_insn_and_split's [PR114861]
https://gcc.gnu.org/g:140124ad54eef88ca87909f63aedc8aaeacefc65 commit r15-11-g140124ad54eef88ca87909f63aedc8aaeacefc65 Author: Xi Ruoyao Date: Fri Apr 26 15:59:11 2024 +0800 LoongArch: Add constraints for bit string operation define_insn_and_split's [PR114861] Without the constrants, the compiler attempts to use a stack slot as the target, causing an ICE building the kernel with -Os: drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c:3144:1: error: could not split insn (insn:TI 1764 67 1745 (set (mem/c:DI (reg/f:DI 3 $r3) [707 %sfp+-80 S8 A64]) (and:DI (reg/v:DI 28 $r28 [orig:422 raster_config ] [422]) (const_int -50331649 [0xfcff]))) "drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c":1386:21 111 {*bstrins_di_for_mask} (nil)) Add these constrants to fix the issue. gcc/ChangeLog: PR target/114861 * config/loongarch/loongarch.md (bstrins__for_mask): Add constraints for operands. (bstrins__for_ior_mask): Likewise. gcc/testsuite/ChangeLog: PR target/114861 * gcc.target/loongarch/pr114861.c: New test. Diff: --- gcc/config/loongarch/loongarch.md | 16 +-- gcc/testsuite/gcc.target/loongarch/pr114861.c | 39 +++ 2 files changed, 47 insertions(+), 8 deletions(-) diff --git a/gcc/config/loongarch/loongarch.md b/gcc/config/loongarch/loongarch.md index a316c8fb820..5c80c169cbf 100644 --- a/gcc/config/loongarch/loongarch.md +++ b/gcc/config/loongarch/loongarch.md @@ -1543,9 +1543,9 @@ (set_attr "mode" "")]) (define_insn_and_split "*bstrins__for_mask" - [(set (match_operand:GPR 0 "register_operand") - (and:GPR (match_operand:GPR 1 "register_operand") -(match_operand:GPR 2 "ins_zero_bitmask_operand")))] + [(set (match_operand:GPR 0 "register_operand" "=r") + (and:GPR (match_operand:GPR 1 "register_operand" "r") +(match_operand:GPR 2 "ins_zero_bitmask_operand" "i")))] "" "#" "" @@ -1563,11 +1563,11 @@ }) (define_insn_and_split "*bstrins__for_ior_mask" - [(set (match_operand:GPR 0 "register_operand") - (ior:GPR (and:GPR (match_operand:GPR 1 "register_operand") - (match_operand:GPR 2 "const_int_operand")) -(and:GPR (match_operand:GPR 3 "register_operand") - (match_operand:GPR 4 "const_int_operand"] + [(set (match_operand:GPR 0 "register_operand" "=r") + (ior:GPR (and:GPR (match_operand:GPR 1 "register_operand" "r") + (match_operand:GPR 2 "const_int_operand" "i")) +(and:GPR (match_operand:GPR 3 "register_operand" "r") + (match_operand:GPR 4 "const_int_operand" "i"] "loongarch_pre_reload_split () && loongarch_use_bstrins_for_ior_with_mask (mode, operands)" "#" diff --git a/gcc/testsuite/gcc.target/loongarch/pr114861.c b/gcc/testsuite/gcc.target/loongarch/pr114861.c new file mode 100644 index 000..e6507c406b9 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/pr114861.c @@ -0,0 +1,39 @@ +/* PR114861: ICE building the kernel with -Os + Reduced from linux/fs/ntfs3/attrib.c at revision c942a0cd3603. */ +/* { dg-do compile } */ +/* { dg-options "-Os -march=loongarch64 -msoft-float -mabi=lp64s" } */ + +long evcn, attr_collapse_range_vbo, attr_collapse_range_bytes; +unsigned short flags; +int attr_collapse_range_ni_0_0; +int *attr_collapse_range_mi; +unsigned attr_collapse_range_svcn, attr_collapse_range_vcn1; +void ni_insert_nonresident (unsigned, unsigned short, int **); +int mi_pack_runs (int); +int +attr_collapse_range (void) +{ + _Bool __trans_tmp_1; + int run = attr_collapse_range_ni_0_0; + unsigned evcn1, vcn, end; + short a_flags = flags; + __trans_tmp_1 = flags & (32768 | 1); + if (__trans_tmp_1) +return 2; + vcn = attr_collapse_range_vbo; + end = attr_collapse_range_bytes; + evcn1 = evcn; + for (;;) +if (attr_collapse_range_svcn >= end) + { +unsigned eat, next_svcn = mi_pack_runs (42); +attr_collapse_range_vcn1 = (vcn ? vcn : attr_collapse_range_svcn); +eat = (0 < end) - attr_collapse_range_vcn1; +mi_pack_runs (run - eat); +if (next_svcn + eat) + ni_insert_nonresident (evcn1 - eat - next_svcn, a_flags, + &attr_collapse_range_mi); + } +else + return 42; +}
[gcc r14-10142] LoongArch: Add constraints for bit string operation define_insn_and_split's [PR114861]
https://gcc.gnu.org/g:3e04b6f6ba568e6183e8aa8223d4156234503843 commit r14-10142-g3e04b6f6ba568e6183e8aa8223d4156234503843 Author: Xi Ruoyao Date: Fri Apr 26 15:59:11 2024 +0800 LoongArch: Add constraints for bit string operation define_insn_and_split's [PR114861] Without the constrants, the compiler attempts to use a stack slot as the target, causing an ICE building the kernel with -Os: drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c:3144:1: error: could not split insn (insn:TI 1764 67 1745 (set (mem/c:DI (reg/f:DI 3 $r3) [707 %sfp+-80 S8 A64]) (and:DI (reg/v:DI 28 $r28 [orig:422 raster_config ] [422]) (const_int -50331649 [0xfcff]))) "drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c":1386:21 111 {*bstrins_di_for_mask} (nil)) Add these constrants to fix the issue. gcc/ChangeLog: PR target/114861 * config/loongarch/loongarch.md (bstrins__for_mask): Add constraints for operands. (bstrins__for_ior_mask): Likewise. gcc/testsuite/ChangeLog: PR target/114861 * gcc.target/loongarch/pr114861.c: New test. (cherry picked from commit 140124ad54eef88ca87909f63aedc8aaeacefc65) Diff: --- gcc/config/loongarch/loongarch.md | 16 +-- gcc/testsuite/gcc.target/loongarch/pr114861.c | 39 +++ 2 files changed, 47 insertions(+), 8 deletions(-) diff --git a/gcc/config/loongarch/loongarch.md b/gcc/config/loongarch/loongarch.md index a316c8fb820..5c80c169cbf 100644 --- a/gcc/config/loongarch/loongarch.md +++ b/gcc/config/loongarch/loongarch.md @@ -1543,9 +1543,9 @@ (set_attr "mode" "")]) (define_insn_and_split "*bstrins__for_mask" - [(set (match_operand:GPR 0 "register_operand") - (and:GPR (match_operand:GPR 1 "register_operand") -(match_operand:GPR 2 "ins_zero_bitmask_operand")))] + [(set (match_operand:GPR 0 "register_operand" "=r") + (and:GPR (match_operand:GPR 1 "register_operand" "r") +(match_operand:GPR 2 "ins_zero_bitmask_operand" "i")))] "" "#" "" @@ -1563,11 +1563,11 @@ }) (define_insn_and_split "*bstrins__for_ior_mask" - [(set (match_operand:GPR 0 "register_operand") - (ior:GPR (and:GPR (match_operand:GPR 1 "register_operand") - (match_operand:GPR 2 "const_int_operand")) -(and:GPR (match_operand:GPR 3 "register_operand") - (match_operand:GPR 4 "const_int_operand"] + [(set (match_operand:GPR 0 "register_operand" "=r") + (ior:GPR (and:GPR (match_operand:GPR 1 "register_operand" "r") + (match_operand:GPR 2 "const_int_operand" "i")) +(and:GPR (match_operand:GPR 3 "register_operand" "r") + (match_operand:GPR 4 "const_int_operand" "i"] "loongarch_pre_reload_split () && loongarch_use_bstrins_for_ior_with_mask (mode, operands)" "#" diff --git a/gcc/testsuite/gcc.target/loongarch/pr114861.c b/gcc/testsuite/gcc.target/loongarch/pr114861.c new file mode 100644 index 000..e6507c406b9 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/pr114861.c @@ -0,0 +1,39 @@ +/* PR114861: ICE building the kernel with -Os + Reduced from linux/fs/ntfs3/attrib.c at revision c942a0cd3603. */ +/* { dg-do compile } */ +/* { dg-options "-Os -march=loongarch64 -msoft-float -mabi=lp64s" } */ + +long evcn, attr_collapse_range_vbo, attr_collapse_range_bytes; +unsigned short flags; +int attr_collapse_range_ni_0_0; +int *attr_collapse_range_mi; +unsigned attr_collapse_range_svcn, attr_collapse_range_vcn1; +void ni_insert_nonresident (unsigned, unsigned short, int **); +int mi_pack_runs (int); +int +attr_collapse_range (void) +{ + _Bool __trans_tmp_1; + int run = attr_collapse_range_ni_0_0; + unsigned evcn1, vcn, end; + short a_flags = flags; + __trans_tmp_1 = flags & (32768 | 1); + if (__trans_tmp_1) +return 2; + vcn = attr_collapse_range_vbo; + end = attr_collapse_range_bytes; + evcn1 = evcn; + for (;;) +if (attr_collapse_range_svcn >= end) + { +unsigned eat, next_svcn = mi_pack_runs (42); +attr_collapse_range_vcn1 = (vcn ? vcn : attr_collapse_range_svcn); +eat = (0 < end) - attr_collapse_range_vcn1; +mi_pack_runs (run - eat); +if (next_svcn + eat) + ni_insert_nonresident (evcn1 - eat - next_svcn, a_flags, + &attr_collapse_range_mi); + } +else + return 42; +}