diff options
24 files changed, 814 insertions, 228 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4031426..549505e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,46 @@ +2025-06-12 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/120638 + * tree-ssa-math-opts.cc (pass_cse_reciprocals::execute): Call + reset_flow_sensitive_info on arg1. + +2025-06-12 Stafford Horne <shorne@gmail.com> + + PR target/120587 + * config/or1k/or1k.cc (or1k_can_change_mode_class): Allow + changing flags mode from BI to SI to allow for paradoxical + subregs. + +2025-06-12 Uros Bizjak <ubizjak@gmail.com> + + PR target/120604 + * config/i386/i386-expand.cc (ix86_expand_int_movcc): Make sure + we can represent the difference between two 64-bit DImode + immediate values in 64-bit HOST_WIDE_INT. + +2025-06-12 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/120629 + * cfgexpand.cc (expand_gimple_cond): If dest bb isn't BB_RTL, + has any PHI nodes and false_edge->dest_idx before redirection is + different from make_single_succ_edge result's dest_idx, swap the + latter with the former last pred edge and their dest_idx members. + +2025-06-12 Pan Li <pan2.li@intel.com> + + * config/riscv/riscv-v.cc (expand_vx_binary_vec_dup_vec): Add new + case SMAX. + (expand_vx_binary_vec_vec_dup): Ditto. + * config/riscv/riscv.cc (riscv_rtx_costs): Ditto. + * config/riscv/vector-iterators.md: Add new op smax. + +2025-06-12 Richard Sandiford <richard.sandiford@arm.com> + + PR target/120624 + * config/aarch64/aarch64.md (SME_STATE_REGNUM): Expand on comments. + * config/aarch64/aarch64-sme.md (aarch64_restore_za): Also set + SME_STATE_REGNUM + 2025-06-12 Alfie Richards <alfie.richards@arm.com> * cgraph.cc (cgraph_node::record_function_versions): Refactor and diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index b1bf7be..c544224 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20250612 +20250613 diff --git a/gcc/config/mcore/mcore.cc b/gcc/config/mcore/mcore.cc index cd5f2c5..c4fc145 100644 --- a/gcc/config/mcore/mcore.cc +++ b/gcc/config/mcore/mcore.cc @@ -2984,9 +2984,7 @@ mcore_mark_dllimport (tree decl) /* ??? At least I think that's why we do this. */ idp = get_identifier (newname); - newrtl = gen_rtx_MEM (Pmode, - gen_rtx_SYMBOL_REF (Pmode, - IDENTIFIER_POINTER (idp))); + newrtl = gen_rtx_SYMBOL_REF (Pmode, IDENTIFIER_POINTER (idp)); XEXP (DECL_RTL (decl), 0) = newrtl; } diff --git a/gcc/config/or1k/or1k.cc b/gcc/config/or1k/or1k.cc index 62e2168..f1c92c6 100644 --- a/gcc/config/or1k/or1k.cc +++ b/gcc/config/or1k/or1k.cc @@ -1408,8 +1408,9 @@ static bool or1k_can_change_mode_class (machine_mode from, machine_mode to, reg_class_t rclass) { + /* Allow cnoverting special flags to SI mode subregs. */ if (rclass == FLAG_REGS) - return from == to; + return from == to || (from == BImode && to == SImode); return true; } @@ -8506,11 +8506,13 @@ driver::set_up_specs () const spec_machine_suffix = just_machine_suffix; #endif + const char *exec_prefix + = gcc_exec_prefix ? gcc_exec_prefix : standard_exec_prefix; /* We need to check standard_exec_prefix/spec_machine_suffix/specs for any override of as, ld and libraries. */ - specs_file = (char *) alloca (strlen (standard_exec_prefix) - + strlen (spec_machine_suffix) + sizeof ("specs")); - strcpy (specs_file, standard_exec_prefix); + specs_file = (char *) alloca ( + strlen (exec_prefix) + strlen (spec_machine_suffix) + sizeof ("specs")); + strcpy (specs_file, exec_prefix); strcat (specs_file, spec_machine_suffix); strcat (specs_file, "specs"); if (access (specs_file, R_OK) == 0) diff --git a/gcc/po/ChangeLog b/gcc/po/ChangeLog index 1e5e07a..487defa 100644 --- a/gcc/po/ChangeLog +++ b/gcc/po/ChangeLog @@ -1,3 +1,7 @@ +2025-06-12 Joseph Myers <josmyers@redhat.com> + + * es.po: Update. + 2025-05-15 Joseph Myers <josmyers@redhat.com> * zh_CN.po: Update. diff --git a/gcc/po/es.po b/gcc/po/es.po index 6033f331..2959212 100644 --- a/gcc/po/es.po +++ b/gcc/po/es.po @@ -2,7 +2,7 @@ # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2016, 2017, 2018, 2019, 2020 Free Software Foundation, Inc. # This file is distributed under the same license as the gcc package. # Cristian Othón Martínez Vera <cfuga@cfuga.mx>, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -# Antonio Ceballos Roa <aceballos@gmail.com>, 2016, 2017, 2018, 2019, 2020 +# Antonio Ceballos Roa <aceballos@gmail.com>, 2016, 2017, 2018, 2019, 2020, 2025 # # Agradezco a Juan Cuquejo Mira por sus comentarios sobre esta traducción # @@ -40,10 +40,10 @@ # msgid "" msgstr "" -"Project-Id-Version: gcc 10.1-b20200209\n" +"Project-Id-Version: gcc 15.1.0\n" "Report-Msgid-Bugs-To: https://gcc.gnu.org/bugs/\n" "POT-Creation-Date: 2025-04-23 19:27+0000\n" -"PO-Revision-Date: 2020-03-22 16:48+0100\n" +"PO-Revision-Date: 2025-06-12 23:08+0200\n" "Last-Translator: Antonio Ceballos Roa <aceballos@gmail.com>\n" "Language-Team: Spanish <es@tp.org.es>\n" "Language: es\n" @@ -15533,12 +15533,12 @@ msgstr "Activa las opciones comunes para generar información de análisis de pe #: common.opt:2648 #, no-c-format msgid "Register the profile information in the .gcov_info section instead of using a constructor/destructor." -msgstr "" +msgstr "Registra la información de análisis de perfil en la sección .gcov_info en lugar de utilizar un constructor/destructor." #: common.opt:2652 #, no-c-format msgid "Register the profile information in the specified section instead of using a constructor/destructor." -msgstr "" +msgstr "Registra la información de análisis de perfil en la sección especificada en lugar de utilizar un constructor/destructor." #: common.opt:2656 #, no-c-format @@ -18902,7 +18902,7 @@ msgstr "" #: gcov-tool.cc:157 gcov-tool.cc:300 #, c-format msgid "no profile files were merged\n" -msgstr "" +msgstr "no se han mezclado ficheros de perfil\n" #: gcov-tool.cc:169 #, c-format @@ -18925,26 +18925,22 @@ msgid " -w, --weight <w1,w2> Set weights (float point values)\ msgstr " -w, --weight <p1,p2> Establece los pesos (valores de coma flotante)\n" #: gcov-tool.cc:188 -#, fuzzy, c-format -#| msgid "Merge subcomand usage:" +#, c-format msgid "Merge subcommand usage:" msgstr "Modo de empleo de la suborden de mezcla:" #: gcov-tool.cc:240 -#, fuzzy, c-format -#| msgid "" -#| " -l, --long-file-names Use long output file names for included\n" -#| " source files\n" +#, c-format msgid "" " merge-stream [options] [<file>] Merge coverage stream file (or stdin)\n" " and coverage file contents\n" msgstr "" -" -l, --long-file-names Usa nombres largos de ficheros para los\n" -" ficheros fuentes incluidos\n" +" merge-stream [options] [<fich>] Mezcla el fichero de flujo de cobertura\n" +" (o stdin) y el contenido del fichero de\n" +" cobertura\n" #: gcov-tool.cc:258 -#, fuzzy, c-format -#| msgid "Merge subcomand usage:" +#, c-format msgid "Merge-stream subcommand usage:" msgstr "Modo de empleo de la suborden de mezcla:" @@ -19014,8 +19010,7 @@ msgid " -t <float>, --hot_threshold <float> Set the threshold for hotness\n" msgstr " -t <float>, --hot_threshold <float> Establece el umbral de calentura\n" #: gcov-tool.cc:510 -#, fuzzy, c-format -#| msgid "Overlap subcomand usage:" +#, c-format msgid "Overlap subcommand usage:" msgstr "Modo de empleo de la suborden de solapamiento:" @@ -19059,10 +19054,9 @@ msgstr "" "%s.\n" #: gcov-tool.cc:595 -#, fuzzy, c-format -#| msgid "Copyright %s 2019 Free Software Foundation, Inc.\n" +#, c-format msgid "Copyright %s 2025 Free Software Foundation, Inc.\n" -msgstr "Copyright %s 2019 Free Software Foundation, Inc.\n" +msgstr "Copyright %s 2025 Free Software Foundation, Inc.\n" #: gcov.cc:1096 #, c-format @@ -19102,22 +19096,21 @@ msgstr "" " en lugar de los porcentajes\n" #: gcov.cc:1102 -#, fuzzy, c-format -#| msgid "" -#| " -c, --branch-counts Output counts of branches taken\n" -#| " rather than percentages\n" +#, c-format msgid "" " -g, --conditions Include modified condition/decision\n" " coverage (masking MC/DC) in output\n" msgstr "" -" -c, --branch-counts Se muestra el número de ramificaciones\n" -" en lugar de los porcentajes\n" +" -g, --conditions Incluye la cobertura de condición/decisión\n" +" modificada (enmascarando MC/DC) en la\n" +" salida\n" #: gcov.cc:1104 -#, fuzzy, c-format -#| msgid " -p, --preserve-paths Preserve all pathname components\n" +#, c-format msgid " -e, --prime-paths Show prime path coverage summary\n" -msgstr " -p, --preserve-paths Preserva todos los nombres de ruta de los componentes\n" +msgstr "" +" -e, --prime-paths Muestra el resumen de la cobertura de camino\n" +" primario\n" #: gcov.cc:1105 #, c-format @@ -19127,6 +19120,10 @@ msgid "" " TYPE is 'covered', 'uncovered', or 'both'\n" " and defaults to 'uncovered'\n" msgstr "" +" --prime-paths-lines[=TIPO] Incluye los caminos en la salida\n" +" modo de traza de línea - no afecta a json\n" +" TIPO es 'covered', 'uncovered' o 'both'\n" +" y el predefinido es 'uncovered'\n" #: gcov.cc:1109 #, c-format @@ -19136,6 +19133,10 @@ msgid "" " TYPE is 'covered', 'uncovered', or 'both'\n" " and defaults to 'uncovered'\n" msgstr "" +" --prime-paths-source[=TIPO] Incluye los caminos en la salida\n" +" modo de traza de fuente - no afecta a json\n" +" TIPO es 'covered', 'uncovered' o 'both'\n" +" y el predefinido es 'uncovered'\n" #: gcov.cc:1113 #, c-format @@ -19145,7 +19146,7 @@ msgstr " -d, --display-progress Muestra información de progreso\n" #: gcov.cc:1114 #, c-format msgid " -D, --debug\t\t\t Display debugging dumps\n" -msgstr "" +msgstr " -D, --debug\t\t\t Muestra volcados de depuración\n" #: gcov.cc:1115 #, c-format @@ -19153,16 +19154,14 @@ msgid " -f, --function-summaries Output summaries for each function\n" msgstr " -f, --function-summaries Muestra sumarios para cada función\n" #: gcov.cc:1116 -#, fuzzy, c-format -#| msgid " -f, --function Print function level info\n" +#, c-format msgid " --include Include functions matching this regex\n" -msgstr " -f, --function Imprime información sobre el nivel de funciones\n" +msgstr " --include Incluye funciones coincidentes con esta regex\n" #: gcov.cc:1117 -#, fuzzy, c-format -#| msgid " -h, --help Print this help, then exit\n" +#, c-format msgid " --exclude Exclude functions matching this regex\n" -msgstr " -h, --help Muestra esta información, y finaliza\n" +msgstr " --exclude Excluye funciones coincidentes con esta regex\n" #: gcov.cc:1118 #, c-format @@ -19170,18 +19169,18 @@ msgid " -h, --help Print this help, then exit\n" msgstr " -h, --help Muestra esta información, y finaliza\n" #: gcov.cc:1119 -#, fuzzy, c-format -#| msgid " -i, --json-format Output JSON intermediate format into .gcov.json.gz file\n" +#, c-format msgid "" " -j, --json-format Output JSON intermediate format\n" " into .gcov.json.gz file\n" -msgstr " -i, --json-format Salida con formato JSON intermedia en el fichero .gcov.json.gz\n" +msgstr "" +" -j, --json-format Envía el formato intermedio JSON\n" +" al fichero .gcov.json.gz\n" #: gcov.cc:1121 -#, fuzzy, c-format -#| msgid " -j, --human-readable Output human readable numbers\n" +#, c-format msgid " -H, --human-readable Output human readable numbers\n" -msgstr " -j, --human-readable Salida con números legibles para humanos\n" +msgstr " -H, --human-readable Salida con números legibles para humanos\n" #: gcov.cc:1122 #, c-format @@ -19200,19 +19199,16 @@ msgstr "" #: gcov.cc:1125 #, c-format msgid " -m, --demangled-names Output demangled function names\n" -msgstr " -m, --demangled-names Nombres de función mutilados de salida\n" +msgstr " -m, --demangled-names Saca nombres de función desofuscados\n" #: gcov.cc:1126 -#, fuzzy, c-format -#| msgid "" -#| " -l, --long-file-names Use long output file names for included\n" -#| " source files\n" +#, c-format msgid "" " -M, --filter-on-demangled Make --include/--exclude match on demangled\n" " names. This does not imply -m\n" msgstr "" -" -l, --long-file-names Usa nombres largos de ficheros para los\n" -" ficheros fuentes incluidos\n" +" -M, --filter-on-demangled Aplica --include/--exclude a los nombres\n" +" desofuscados. No implica -m\n" #: gcov.cc:1128 #, c-format @@ -19270,24 +19266,23 @@ msgid " -x, --hash-filenames Hash long pathnames\n" msgstr " -x, --hash-filenames Nombres de ruta largos de Hash\n" #: gcov.cc:1139 -#, fuzzy, c-format -#| msgid "Options:\n" +#, c-format msgid "" "\n" "Obsolete options:\n" -msgstr "Opciones:\n" +msgstr "" +"\n" +"Opciones obsoletas:\n" #: gcov.cc:1140 -#, fuzzy, c-format -#| msgid " -i, --json-format Output JSON intermediate format into .gcov.json.gz file\n" +#, c-format msgid " -i, --json-format Replaced with -j, --json-format\n" -msgstr " -i, --json-format Salida con formato JSON intermedia en el fichero .gcov.json.gz\n" +msgstr " -i, --json-format Reemplazado por -j, --json-format\n" #: gcov.cc:1141 -#, fuzzy, c-format -#| msgid " -j, --human-readable Output human readable numbers\n" +#, c-format msgid " -j, --human-readable Replaced with -H, --human-readable\n" -msgstr " -j, --human-readable Salida con números legibles para humanos\n" +msgstr " -j, --human-readable Reemplazado por -H, --human-readable\n" #: gcov.cc:1152 #, c-format @@ -19295,20 +19290,19 @@ msgid "gcov %s%s\n" msgstr "gcov %s%s\n" #: gcov.cc:1153 -#, fuzzy, c-format -#| msgid "collect2 version %s\n" +#, c-format msgid "JSON format version: %s\n" -msgstr "collect2 versión %s\n" +msgstr "versión del formato JSON: %s\n" #: gcov.cc:1237 #, c-format msgid "invalid argument '%s' for '--prime-paths-lines'. Valid arguments are: 'covered', 'uncovered', 'both'\n" -msgstr "" +msgstr "argumento no válido '%s' para --prime-paths-lines'. Argumentos válidos: 'covered', 'uncovered', 'both'\n" #: gcov.cc:1258 #, c-format msgid "invalid argument '%s' for '--prime-paths-source'. Valid arguments are: 'covered', 'uncovered', 'both'\n" -msgstr "" +msgstr "argumento no válido '%s' para --prime-paths-source'. Argumentos válidos: 'covered', 'uncovered', 'both'\n" #: gcov.cc:1726 #, c-format @@ -19376,10 +19370,9 @@ msgid "%s:already seen blocks for '%s'\n" msgstr "%s:ya se vieron bloques para '%s'\n" #: gcov.cc:2391 -#, fuzzy, c-format -#| msgid "%s:already seen blocks for '%s'\n" +#, c-format msgid "%s:already seen conditions for '%s'\n" -msgstr "%s:ya se vieron bloques para '%s'\n" +msgstr "%s:condiciones ya vistas para '%s'\n" #: gcov.cc:2449 gcov.cc:2589 #, c-format @@ -19482,28 +19475,24 @@ msgid "No calls\n" msgstr "No hay llamadas\n" #: gcov.cc:3090 gcov.cc:3144 -#, fuzzy, c-format -#| msgid "Lines executed:%s of %d\n" +#, c-format msgid "Condition outcomes covered:%s of %d\n" -msgstr "Líneas ejecutadas:%s de %d\n" +msgstr "Salidas de condiciones cubiertas:%s de %d\n" #: gcov.cc:3095 gcov.cc:3149 -#, fuzzy, c-format -#| msgid "bad condition code" +#, c-format msgid "No conditions\n" -msgstr "código de condición erróneo" +msgstr "No hay condiciones\n" #: gcov.cc:3101 gcov.cc:3155 -#, fuzzy, c-format -#| msgid "Branches executed:%s of %d\n" +#, c-format msgid "Prime paths covered:%s of %d\n" -msgstr "Ramificaciones ejecutadas:%s de %d\n" +msgstr "Caminos primarios cubiertos:%s de %d\n" #: gcov.cc:3105 gcov.cc:3159 -#, fuzzy, c-format -#| msgid "Display this information." +#, c-format msgid "No path information\n" -msgstr "Muestra esta información." +msgstr "No hay información de caminos\n" #: gcov.cc:3379 #, c-format @@ -19513,13 +19502,12 @@ msgstr "%s:no hay líneas para '%s'\n" #: gcov.cc:3515 #, c-format msgid "condition outcomes covered %d/%d\n" -msgstr "" +msgstr "salidas de condiciones cubiertas %d/%d\n" #: gcov.cc:3528 -#, fuzzy, c-format -#| msgid "unconditional %2d taken %s\n" +#, c-format msgid "condition %2u not covered (%s%s)\n" -msgstr "el incondicional %2d tomado %s\n" +msgstr "condición %2u no cubierta (%s%s)\n" #: gcov.cc:3542 #, c-format @@ -19537,10 +19525,9 @@ msgid "branch %2d taken %s%s" msgstr "ramificación %2d tomada %s%s" #: gcov.cc:3557 -#, fuzzy, c-format -#| msgid "branch %2d never executed" +#, c-format msgid "branch %2d never executed%s" -msgstr "la ramificacion %2d nunca se ejecuta" +msgstr "la ramificacion %2d nunca se ejecuta%s" #: gcov.cc:3562 #, c-format @@ -19558,15 +19545,14 @@ msgid "unconditional %2d never executed\n" msgstr "el incondicional %2d nunca se ejecuta\n" #: gcov.cc:3729 -#, fuzzy, c-format -#| msgid "parameter name omitted" +#, c-format msgid "path coverage omitted\n" -msgstr "se omitió el nombre del parámetro" +msgstr "cobertura de caminos omitida\n" #: gcov.cc:3731 #, c-format msgid "paths covered %u of %zu\n" -msgstr "" +msgstr "caminos cubiertos %u de %zu\n" #: gcov.cc:3806 #, c-format @@ -19612,16 +19598,14 @@ msgid "End of search list.\n" msgstr "Fin de la lista de búsqueda.\n" #: incpath.cc:408 -#, fuzzy, c-format -#| msgid "#include <...> search starts here:\n" +#, c-format msgid "#embed <...> search starts here:\n" -msgstr "la búsqueda de #include <...> inicia aquí:\n" +msgstr "la búsqueda de #embed <...> comienza aquí:\n" #: incpath.cc:411 -#, fuzzy, c-format -#| msgid "End of search list.\n" +#, c-format msgid "End of #embed search list.\n" -msgstr "Fin de la lista de búsqueda.\n" +msgstr "Fin de la lista de búsqueda de #embed.\n" #: input.cc:35 msgid "<built-in>" @@ -27144,10 +27128,9 @@ msgid "wrong number of arguments to %%:dwarf-version-gt" msgstr "número erróneo de argumentos para %%:debug-level-gt" #: gcov-tool.cc:75 -#, fuzzy, gcc-internal-format, gfc-internal-format -#| msgid "error in removing %s\n" +#, gcc-internal-format, gfc-internal-format msgid "error in removing %s" -msgstr "error al quitar %s\n" +msgstr "error al quitar %s" #: gcov-tool.cc:106 #, gcc-internal-format, gfc-internal-format @@ -27167,19 +27150,17 @@ msgstr "No se puede cambiar al directorio %s" #: gcov-tool.cc:125 #, gcc-internal-format, gfc-internal-format msgid "output file %s already exists in folder %s" -msgstr "" +msgstr "el fichero de salida %s ya existe en la carpeta %s" #: gcov-tool.cc:217 gcov-tool.cc:285 -#, fuzzy, gcc-internal-format -#| msgid "weights need to be non-negative\n" +#, gcc-internal-format msgid "weights need to be non-negative" -msgstr "los pesos tienen que ser no negativos\n" +msgstr "los pesos han de ser no negativos" #: gcov-tool.cc:424 -#, fuzzy, gcc-internal-format -#| msgid "scale needs to be non-negative\n" +#, gcc-internal-format msgid "scale needs to be non-negative" -msgstr "la escala tiene que ser no negativa\n" +msgstr "la escala ha de ser no negativa" #: gcse.cc:4194 #, gcc-internal-format, gfc-internal-format diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b2a24d2..80cc664 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,100 @@ +2025-06-12 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/120638 + * gcc.dg/pr120638.c: New test. + +2025-06-12 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/120630 + * gcc.dg/pr120630.c: New test. + * gcc.c-torture/execute/pr120630.c: New test. + +2025-06-12 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/120629 + * g++.dg/opt/pr120629.C: New test. + +2025-06-12 Pan Li <pan2.li@intel.com> + + * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i16.c: Add asm check + for vmax.vx combine. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i8.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i16.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i8.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i16.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i8.c: Ditto. + +2025-06-12 Pan Li <pan2.li@intel.com> + + * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i16.c: Add asm check + for vmax.vx combine. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i8.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i16.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i8.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i16.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i8.c: Ditto. + +2025-06-12 Pan Li <pan2.li@intel.com> + + * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i16.c: Add asm check + for max func 1 vmax.vx combine. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i8.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i16.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i8.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i16.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i8.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i16.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i32.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i64.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-2-i8.c: New test. + +2025-06-12 Pan Li <pan2.li@intel.com> + + * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i16.c: Add asm check + for max func 1 vmax.vx combine. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i8.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i16.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i8.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i16.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i32.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i64.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i8.c: Ditto. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_binary.h: Add test + helper macros. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_binary_data.h: Add test + data for run test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i16.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i32.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i64.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vmax-run-1-i8.c: New test. + +2025-06-12 Richard Sandiford <richard.sandiford@arm.com> + + PR target/120624 + * gcc.target/aarch64/sme/za_state_7.c: New test. + 2025-06-12 Georg-Johann Lay <avr@gjlay.de> PR middle-end/117811 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr120630.c b/gcc/testsuite/gcc.c-torture/execute/pr120630.c new file mode 100644 index 0000000..46cfac9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr120630.c @@ -0,0 +1,29 @@ +/* PR middle-end/120630 */ + +__attribute__((noipa)) int +foo (const char *x, ...) +{ + return *x; +} + +int a, b, c; +unsigned d = 1; + +int +main () +{ + if (a) + foo ("0"); + int e = -1; + if (a < 1) + { + e = c; + if (c) + while (1) + ; + } + b = (~e + 0UL) / -1; + if (d > b) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr120630.c b/gcc/testsuite/gcc.dg/pr120630.c new file mode 100644 index 0000000..14b0aaf --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr120630.c @@ -0,0 +1,25 @@ +/* PR middle-end/120630 */ +/* { dg-do run } */ +/* { dg-options "-O3 -fno-tree-loop-im -fno-tree-loop-optimize -fno-tree-ch" } */ + +int a, c, d; + +void +foo (int b) +{ + a = b; +} + +int +main () +{ + while (d) + ; + for (c = 0; c > -3; c--) + { + long f = c; + foo (f >> 2); + } + if (a != -1) + __builtin_abort (); +} diff --git a/gcc/testsuite/gcc.dg/pr120638.c b/gcc/testsuite/gcc.dg/pr120638.c new file mode 100644 index 0000000..4a057a0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr120638.c @@ -0,0 +1,31 @@ +/* PR tree-optimization/120638 */ +/* { dg-do run } */ +/* { dg-options "-O2 -ffast-math" } */ + +extern float sqrtf (float x); + +__attribute__((noipa)) float +foo (unsigned int s) +{ + return 0.5f / sqrtf (1.f + s); +} + +__attribute__((noipa)) float +bar (float s) +{ + if (s < 0.0 || s > 65535.0f) + __builtin_unreachable (); + return 0.5f / sqrtf (1.f + s); +} + +int +main () +{ + if (__builtin_fabsf (foo (3) - 0.25f) > 0.00390625f + || __builtin_fabsf (foo (15) - 0.125f) > 0.00390625f + || __builtin_fabsf (foo (63) - 0.0625f) > 0.00390625f + || __builtin_fabsf (bar (3.0f) - 0.25f) > 0.00390625f + || __builtin_fabsf (bar (15.0f) - 0.125f) > 0.00390625f + || __builtin_fabsf (bar (63.0f) - 0.0625f) > 0.00390625f) + __builtin_abort (); +} diff --git a/gcc/tree-ssa-math-opts.cc b/gcc/tree-ssa-math-opts.cc index 7e819f3..4cfcc42 100644 --- a/gcc/tree-ssa-math-opts.cc +++ b/gcc/tree-ssa-math-opts.cc @@ -1053,6 +1053,7 @@ pass_cse_reciprocals::execute (function *fun) continue; gimple_replace_ssa_lhs (call, arg1); + reset_flow_sensitive_info (arg1); if (gimple_call_internal_p (call) != (ifn != IFN_LAST)) { auto_vec<tree, 4> args; diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 9e0070d..8873fa4 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,77 @@ +2025-06-12 Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> + + PR libstdc++/119496 + * include/bits/stl_algo.h: Adjust calls to requested_size. + * include/bits/stl_tempbuf.h (requested_size): Rename with + an _M_ prefix. + * testsuite/17_intro/names.cc: Add a #define for + requested_size. + +2025-06-12 Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> + + * include/bits/formatfwd.h (format_kind): Move the definition + (and some supporting code) from <format>. + * include/std/format (format_kind): Likewise. + * include/bits/version.def (optional_range_support): Add + the feature-testing macro. + * include/bits/version.h: Regenerate. + * include/std/optional (iterator, const_iterator, begin, end): + Add range support. + (enable_view): Specialize for std::optional. + (format_kind): Specialize for std::optional. + * testsuite/20_util/optional/range.cc: New test. + * testsuite/20_util/optional/version.cc: Test the new + feature-testing macro. + +2025-06-12 Tomasz Kamiński <tkaminsk@redhat.com> + + * include/bits/chrono_io.h (_ChronoFormats::_S_ftz) + (_ChronoFormats::_S_ft, _ChronoFormats::_S_t): Define. + (__formatter_chrono::_M_format_to_ostream): Remove handling for + time_points. + (std::formatter<chrono::hh_mm_ss<_Dur>, _CharT>) + (std::formatter<chrono::sys_time<_Dur>, _CharT>) + (std::formatter<chrono::utc_time<_Dur>, _CharT>) + (std::formatter<chrono::tai_time<_Dur>, _CharT>) + (std::formatter<chrono::gps_time<_Dur>, _CharT>) + (std::formatter<chrono::file_time<_Dur>, _CharT>) + (std::formatter<chrono::local_time<_Dur>, _CharT>) + (std::formatter<chrono::__detail::__local_time_fmt<_Dur>, _CharT>) + (std::formatter<chrono::zoned_time<_Dur>, _CharT>): + Define __defSpec, and pass it as argument to _M_prase and + constructor of __formatter_chrono. + +2025-06-12 Tomasz Kamiński <tkaminsk@redhat.com> + + * include/bits/chrono_io.h (__format::_ChronoFormats): Define. + (__formatter_chrono::__formatter_chrono()) + (__formatter_chrono::__formatter_chrono(_ChronoSpec<_CharT>)): Define. + (__formatter_chrono::_M_parse): Add parameter with default spec, + and merge it with new values. Handle '%\0' as weekday index + specifier. + (__formatter_chrono::_M_a_A, __formatter_chrono::_M_b_B) + (__formatter_chrono::_M_C_y_Y, __formatter_chrono::_M_d_e) + (__formatter_chrono::_M_F): Support _M_debug flag. + (__formatter_chrono::_M_wi, __formatter_chrono::_S_weekday_index): + Define. + (std::formatter<chrono::day, _CharT>) + (std::formatter<chrono::month, _CharT>) + (std::formatter<chrono::year, _CharT>) + (std::formatter<chrono::weekday, _CharT>) + (std::formatter<chrono::weekday_indexed, _CharT>) + (std::formatter<chrono::weekday_last, _CharT>) + (std::formatter<chrono::month_day, _CharT>) + (std::formatter<chrono::month_day_last, _CharT>) + (std::formatter<chrono::month_weekday, _CharT>) + (std::formatter<chrono::month_weekday_last, _CharT>) + (std::formatter<chrono::year_month, _CharT>) + (std::formatter<chrono::year_month_day, _CharT>) + (std::formatter<chrono::year_month_day_last, _CharT>) + (std::formatter<chrono::year_month_weekday, _CharT>) + (std::formatter<chrono::year_month_weekday_last, _CharT>): + Define __defSpec, and pass it as argument to _M_parse and + constructor of __formatter_chrono. + 2025-06-12 Tomasz Kamiński <tkaminsk@redhat.com> * include/std/mdspan (__mdspan::__mapping_alike): Rename template diff --git a/libstdc++-v3/include/bits/chrono_io.h b/libstdc++-v3/include/bits/chrono_io.h index 69cf2a6..247d40c 100644 --- a/libstdc++-v3/include/bits/chrono_io.h +++ b/libstdc++-v3/include/bits/chrono_io.h @@ -245,8 +245,23 @@ namespace __format static consteval _String_view + _S_ftz() noexcept + { return _GLIBCXX_WIDEN("%F %T %Z"); } + + static consteval + _String_view + _S_ft() noexcept + { return _S_ftz().substr(0, 5); } + + static consteval + _String_view _S_f() noexcept - { return _GLIBCXX_WIDEN("%F"); } + { return _S_ftz().substr(0, 2); } + + static consteval + _String_view + _S_t() noexcept + { return _S_ftz().substr(3, 2); } static consteval _String_view @@ -828,58 +843,17 @@ namespace __format __os.imbue(_M_locale(__fc)); if constexpr (__is_specialization_of<_Tp, __local_time_fmt>) - { - // Format as "{:L%F %T}" - auto __days = chrono::floor<chrono::days>(__t._M_time); - __os << chrono::year_month_day(__days) << ' ' - << chrono::hh_mm_ss(__t._M_time - __days); - - // For __local_time_fmt the __is_neg flags says whether to - // append " %Z" to the result. - if (__is_neg) - { - if (!__t._M_abbrev) [[unlikely]] - __format::__no_timezone_available(); - else if constexpr (is_same_v<_CharT, char>) - __os << ' ' << *__t._M_abbrev; - else - { - __os << L' '; - for (char __c : *__t._M_abbrev) - __os << __c; - } - } - } + __builtin_trap(); + else if constexpr (__is_specialization_of<_Tp, __utc_leap_second>) + __builtin_trap(); + else if constexpr (chrono::__is_time_point_v<_Tp>) + __builtin_trap(); else { - if constexpr (__is_specialization_of<_Tp, __utc_leap_second>) - __os << __t._M_date << ' ' << __t._M_time; - else if constexpr (chrono::__is_time_point_v<_Tp>) - { - // Need to be careful here because not all specializations - // of chrono::sys_time can be written to an ostream. - // For the specializations of time_point that can be - // formatted with an empty chrono-specs, either it's a - // sys_time with period greater or equal to days: - if constexpr (is_convertible_v<_Tp, chrono::sys_days>) - __os << _S_date(__t); - // Or a local_time with period greater or equal to days: - else if constexpr (is_convertible_v<_Tp, chrono::local_days>) - __os << _S_date(__t); - else // Or it's formatted as "{:L%F %T}": - { - auto __days = chrono::floor<chrono::days>(__t); - __os << chrono::year_month_day(__days) << ' ' - << chrono::hh_mm_ss(__t - __days); - } - } - else - { - if constexpr (chrono::__is_duration_v<_Tp>) - if (__is_neg) [[unlikely]] - __os << _S_plus_minus[1]; - __os << __t; - } + if constexpr (chrono::__is_duration_v<_Tp>) + if (__is_neg) [[unlikely]] + __os << _S_plus_minus[1]; + __os << __t; } auto __str = std::move(__os).str(); @@ -2430,7 +2404,7 @@ namespace __format { constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) - { return _M_f._M_parse(__pc, __format::_TimeOfDay); } + { return _M_f._M_parse(__pc, __format::_TimeOfDay, __defSpec); } template<typename _Out> typename basic_format_context<_Out, _CharT>::iterator @@ -2439,7 +2413,15 @@ namespace __format { return _M_f._M_format(__t, __fc); } private: - __format::__formatter_chrono<_CharT> _M_f; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + __res._M_localized = true; + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_t(); + return __res; + }(); + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; }; #if _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI @@ -2484,7 +2466,7 @@ namespace __format constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) { - auto __next = _M_f._M_parse(__pc, __format::_ZonedDateTime); + auto __next = _M_f._M_parse(__pc, __format::_ZonedDateTime, __defSpec); if constexpr (!__stream_insertable) if (_M_f._M_spec._M_chrono_specs.empty()) __format::__invalid_chrono_spec(); // chrono-specs can't be empty @@ -2502,7 +2484,22 @@ namespace __format = requires (basic_ostream<_CharT>& __os, chrono::sys_time<_Duration> __t) { __os << __t; }; - __format::__formatter_chrono<_CharT> _M_f; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + if constexpr (!__stream_insertable) + return __res; + else if constexpr (is_convertible_v<_Duration, chrono::days>) + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_f(); + else + { + __res._M_localized = true; + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_ft(); + } + return __res; + }(); + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; }; template<typename _Duration, __format::__char _CharT> @@ -2511,11 +2508,11 @@ namespace __format { constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) - { return _M_f._M_parse(__pc, __format::_ZonedDateTime); } + { return _M_f._M_parse(__pc, __format::_ZonedDateTime, __defSpec); } template<typename _Out> - typename basic_format_context<_Out, _CharT>::iterator - format(const chrono::utc_time<_Duration>& __t, + typename basic_format_context<_Out, _CharT>::iterator + format(const chrono::utc_time<_Duration>& __t, basic_format_context<_Out, _CharT>& __fc) const { // Adjust by removing leap seconds to get equivalent sys_time. @@ -2536,7 +2533,15 @@ namespace __format private: friend formatter<chrono::__detail::__utc_leap_second<_Duration>, _CharT>; - __format::__formatter_chrono<_CharT> _M_f; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + __res._M_localized = true; + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_ft(); + return __res; + }(); + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; }; template<typename _Duration, __format::__char _CharT> @@ -2545,11 +2550,11 @@ namespace __format { constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) - { return _M_f._M_parse(__pc, __format::_ZonedDateTime); } + { return _M_f._M_parse(__pc, __format::_ZonedDateTime, __defSpec); } template<typename _Out> - typename basic_format_context<_Out, _CharT>::iterator - format(const chrono::tai_time<_Duration>& __t, + typename basic_format_context<_Out, _CharT>::iterator + format(const chrono::tai_time<_Duration>& __t, basic_format_context<_Out, _CharT>& __fc) const { // Convert to __local_time_fmt with abbrev "TAI" and offset 0s. @@ -2567,7 +2572,15 @@ namespace __format } private: - __format::__formatter_chrono<_CharT> _M_f; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + __res._M_localized = true; + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_ft(); + return __res; + }(); + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; }; template<typename _Duration, __format::__char _CharT> @@ -2576,11 +2589,11 @@ namespace __format { constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) - { return _M_f._M_parse(__pc, __format::_ZonedDateTime); } + { return _M_f._M_parse(__pc, __format::_ZonedDateTime, __defSpec); } template<typename _Out> - typename basic_format_context<_Out, _CharT>::iterator - format(const chrono::gps_time<_Duration>& __t, + typename basic_format_context<_Out, _CharT>::iterator + format(const chrono::gps_time<_Duration>& __t, basic_format_context<_Out, _CharT>& __fc) const { // Convert to __local_time_fmt with abbrev "GPS" and offset 0s. @@ -2598,7 +2611,15 @@ namespace __format } private: - __format::__formatter_chrono<_CharT> _M_f; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + __res._M_localized = true; + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_ft(); + return __res; + }(); + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; }; template<typename _Duration, __format::__char _CharT> @@ -2606,11 +2627,11 @@ namespace __format { constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) - { return _M_f._M_parse(__pc, __format::_ZonedDateTime); } + { return _M_f._M_parse(__pc, __format::_ZonedDateTime, __defSpec); } template<typename _Out> - typename basic_format_context<_Out, _CharT>::iterator - format(const chrono::file_time<_Duration>& __t, + typename basic_format_context<_Out, _CharT>::iterator + format(const chrono::file_time<_Duration>& __t, basic_format_context<_Out, _CharT>& __fc) const { using namespace chrono; @@ -2618,24 +2639,45 @@ namespace __format } private: - __format::__formatter_chrono<_CharT> _M_f; - }; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + __res._M_localized = true; + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_ft(); + return __res; + }(); + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; + }; template<typename _Duration, __format::__char _CharT> struct formatter<chrono::local_time<_Duration>, _CharT> { constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) - { return _M_f._M_parse(__pc, __format::_DateTime); } + { return _M_f._M_parse(__pc, __format::_DateTime, __defSpec); } template<typename _Out> - typename basic_format_context<_Out, _CharT>::iterator - format(const chrono::local_time<_Duration>& __t, + typename basic_format_context<_Out, _CharT>::iterator + format(const chrono::local_time<_Duration>& __t, basic_format_context<_Out, _CharT>& __fc) const { return _M_f._M_format(__t, __fc); } private: - __format::__formatter_chrono<_CharT> _M_f; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + if constexpr (is_convertible_v<_Duration, chrono::days>) + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_f(); + else + { + __res._M_localized = true; + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_ft(); + } + return __res; + }(); + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; }; template<typename _Duration, __format::__char _CharT> @@ -2643,16 +2685,24 @@ namespace __format { constexpr typename basic_format_parse_context<_CharT>::iterator parse(basic_format_parse_context<_CharT>& __pc) - { return _M_f._M_parse(__pc, __format::_ZonedDateTime); } + { return _M_f._M_parse(__pc, __format::_ZonedDateTime, __defSpec); } template<typename _Out> - typename basic_format_context<_Out, _CharT>::iterator - format(const chrono::__detail::__local_time_fmt<_Duration>& __t, + typename basic_format_context<_Out, _CharT>::iterator + format(const chrono::__detail::__local_time_fmt<_Duration>& __t, basic_format_context<_Out, _CharT>& __fc) const - { return _M_f._M_format(__t, __fc, /* use %Z for {} */ true); } + { return _M_f._M_format(__t, __fc); } private: - __format::__formatter_chrono<_CharT> _M_f; + static constexpr __format::_ChronoSpec<_CharT> __defSpec = [] + { + __format::_ChronoSpec<_CharT> __res{}; + __res._M_localized = true; + __res._M_chrono_specs = __format::_ChronoFormats<_CharT>::_S_ftz(); + return __res; + }(); + + __format::__formatter_chrono<_CharT> _M_f{__defSpec}; }; #if _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI @@ -2661,8 +2711,8 @@ namespace __format : formatter<chrono::__detail::__local_time_fmt_for<_Duration>, _CharT> { template<typename _Out> - typename basic_format_context<_Out, _CharT>::iterator - format(const chrono::zoned_time<_Duration, _TimeZonePtr>& __tp, + typename basic_format_context<_Out, _CharT>::iterator + format(const chrono::zoned_time<_Duration, _TimeZonePtr>& __tp, basic_format_context<_Out, _CharT>& __fc) const { using _Ltf = chrono::__detail::__local_time_fmt_for<_Duration>; @@ -2682,8 +2732,8 @@ namespace __format : formatter<chrono::utc_time<_Duration>, _CharT> { template<typename _Out> - typename basic_format_context<_Out, _CharT>::iterator - format(const chrono::__detail::__utc_leap_second<_Duration>& __t, + typename basic_format_context<_Out, _CharT>::iterator + format(const chrono::__detail::__utc_leap_second<_Duration>& __t, basic_format_context<_Out, _CharT>& __fc) const { return this->_M_f._M_format(__t, __fc); } }; diff --git a/libstdc++-v3/include/bits/formatfwd.h b/libstdc++-v3/include/bits/formatfwd.h index 777e629..314b55d 100644 --- a/libstdc++-v3/include/bits/formatfwd.h +++ b/libstdc++-v3/include/bits/formatfwd.h @@ -162,6 +162,32 @@ namespace __format using __maybe_const = __conditional_t<formattable<const _Tp, _CharT>, const _Tp, _Tp>; } + + // [format.range], formatting of ranges + // [format.range.fmtkind], variable template format_kind + enum class range_format { + disabled, + map, + set, + sequence, + string, + debug_string + }; + + /** @brief A constant determining how a range should be formatted. + * + * The primary template of `std::format_kind` cannot be instantiated. + * There is a partial specialization for input ranges and you can + * specialize the variable template for your own cv-unqualified types + * that satisfy the `ranges::input_range` concept. + * + * @since C++23 + */ + template<typename _Rg> + constexpr auto format_kind = []{ + static_assert(false, "cannot use primary template of 'std::format_kind'"); + return type_identity<_Rg>{}; + }(); #endif // format_ranges _GLIBCXX_END_NAMESPACE_VERSION diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h index 98c2249..3f4674d 100644 --- a/libstdc++-v3/include/bits/stl_algo.h +++ b/libstdc++-v3/include/bits/stl_algo.h @@ -2511,7 +2511,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2) // [first,middle) and [middle,last). _TmpBuf __buf(__first, std::min(__len1, __len2)); - if (__builtin_expect(__buf.size() == __buf.requested_size(), true)) + if (__builtin_expect(__buf.size() == __buf._M_requested_size(), true)) std::__merge_adaptive (__first, __middle, __last, __len1, __len2, __buf.begin(), __comp); else if (__builtin_expect(__buf.begin() == 0, false)) @@ -5024,7 +5024,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO // so the buffer only needs to fit half the range at once. _TmpBuf __buf(__first, (__last - __first + 1) / 2); - if (__builtin_expect(__buf.requested_size() == __buf.size(), true)) + if (__builtin_expect(__buf._M_requested_size() == __buf.size(), true)) std::__stable_sort_adaptive(__first, __first + _DistanceType(__buf.size()), __last, __buf.begin(), __comp); diff --git a/libstdc++-v3/include/bits/stl_tempbuf.h b/libstdc++-v3/include/bits/stl_tempbuf.h index 7a7619e..8cc7b11 100644 --- a/libstdc++-v3/include/bits/stl_tempbuf.h +++ b/libstdc++-v3/include/bits/stl_tempbuf.h @@ -227,7 +227,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// Returns the size requested by the constructor; may be >size(). size_type - requested_size() const + _M_requested_size() const { return _M_original_len; } /// As per Table mumble. diff --git a/libstdc++-v3/include/bits/version.def b/libstdc++-v3/include/bits/version.def index 7cf62e9..880586e 100644 --- a/libstdc++-v3/include/bits/version.def +++ b/libstdc++-v3/include/bits/version.def @@ -852,6 +852,14 @@ ftms = { }; ftms = { + name = optional_range_support; + values = { + v = 202406; + cxxmin = 26; + }; +}; + +ftms = { name = destroying_delete; values = { v = 201806; diff --git a/libstdc++-v3/include/bits/version.h b/libstdc++-v3/include/bits/version.h index 9f4cf9a..4300adb 100644 --- a/libstdc++-v3/include/bits/version.h +++ b/libstdc++-v3/include/bits/version.h @@ -955,6 +955,16 @@ #endif /* !defined(__cpp_lib_optional) && defined(__glibcxx_want_optional) */ #undef __glibcxx_want_optional +#if !defined(__cpp_lib_optional_range_support) +# if (__cplusplus > 202302L) +# define __glibcxx_optional_range_support 202406L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_optional_range_support) +# define __cpp_lib_optional_range_support 202406L +# endif +# endif +#endif /* !defined(__cpp_lib_optional_range_support) && defined(__glibcxx_want_optional_range_support) */ +#undef __glibcxx_want_optional_range_support + #if !defined(__cpp_lib_destroying_delete) # if (__cplusplus >= 202002L) && (__cpp_impl_destroying_delete) # define __glibcxx_destroying_delete 201806L diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format index 04fb23e..46bd5d5 100644 --- a/libstdc++-v3/include/std/format +++ b/libstdc++-v3/include/std/format @@ -5483,32 +5483,6 @@ namespace __format #endif #if __glibcxx_format_ranges // C++ >= 23 && HOSTED - // [format.range], formatting of ranges - // [format.range.fmtkind], variable template format_kind - enum class range_format { - disabled, - map, - set, - sequence, - string, - debug_string - }; - - /** @brief A constant determining how a range should be formatted. - * - * The primary template of `std::format_kind` cannot be instantiated. - * There is a partial specialization for input ranges and you can - * specialize the variable template for your own cv-unqualified types - * that satisfy the `ranges::input_range` concept. - * - * @since C++23 - */ - template<typename _Rg> - constexpr auto format_kind = []{ - static_assert(false, "cannot use primary template of 'std::format_kind'"); - return type_identity<_Rg>{}; - }(); - /// @cond undocumented template<typename _Tp> consteval range_format diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional index a616dc0..2ae71f1 100644 --- a/libstdc++-v3/include/std/optional +++ b/libstdc++-v3/include/std/optional @@ -36,6 +36,7 @@ #define __glibcxx_want_freestanding_optional #define __glibcxx_want_optional +#define __glibcxx_want_optional_range_support #define __glibcxx_want_constrained_equality #include <bits/version.h> @@ -57,6 +58,11 @@ #if __cplusplus > 202002L # include <concepts> #endif +#ifdef __cpp_lib_optional_range_support // C++ >= 26 +# include <bits/formatfwd.h> +# include <bits/ranges_base.h> +# include <bits/stl_iterator.h> +#endif namespace std _GLIBCXX_VISIBILITY(default) { @@ -858,6 +864,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION public: using value_type = _Tp; +#ifdef __cpp_lib_optional_range_support // >= C++26 + using iterator = __gnu_cxx::__normal_iterator<_Tp*, optional>; + using const_iterator = __gnu_cxx::__normal_iterator<const _Tp*, optional>; +#endif constexpr optional() noexcept { } @@ -1158,6 +1168,33 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } } +#ifdef __cpp_lib_optional_range_support // >= C++26 + // Iterator support. + constexpr iterator begin() noexcept + { + return iterator( + this->_M_is_engaged() ? std::addressof(this->_M_get()) : nullptr + ); + } + + constexpr const_iterator begin() const noexcept + { + return const_iterator( + this->_M_is_engaged() ? std::addressof(this->_M_get()) : nullptr + ); + } + + constexpr iterator end() noexcept + { + return begin() + has_value(); + } + + constexpr const_iterator end() const noexcept + { + return begin() + has_value(); + } +#endif // __cpp_lib_optional_range_support + // Observers. constexpr const _Tp* operator->() const noexcept @@ -1772,6 +1809,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template <typename _Tp> optional(_Tp) -> optional<_Tp>; #endif +#ifdef __cpp_lib_optional_range_support // >= C++26 + template<typename _Tp> + inline constexpr bool + ranges::enable_view<optional<_Tp>> = true; + + template<typename _Tp> + inline constexpr auto + format_kind<optional<_Tp>> = range_format::disabled; +#endif // __cpp_lib_optional_range_support + #undef _GLIBCXX_USE_CONSTRAINTS_FOR_OPTIONAL _GLIBCXX_END_NAMESPACE_VERSION diff --git a/libstdc++-v3/testsuite/17_intro/names.cc b/libstdc++-v3/testsuite/17_intro/names.cc index f32205d..e94da9d 100644 --- a/libstdc++-v3/testsuite/17_intro/names.cc +++ b/libstdc++-v3/testsuite/17_intro/names.cc @@ -404,4 +404,8 @@ # endif #endif +// PR libstdc++/119496 +// _Temporary_buffer used to have a member with this name +#define requested_size 1 + #include <bits/stdc++.h> diff --git a/libstdc++-v3/testsuite/20_util/optional/range.cc b/libstdc++-v3/testsuite/20_util/optional/range.cc new file mode 100644 index 0000000..e77dc21 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/optional/range.cc @@ -0,0 +1,163 @@ +// { dg-do compile { target c++26 } } + +#include <concepts> +#include <format> +#include <iterator> +#include <optional> +#include <ranges> +#include <string_view> +#include <vector> + +#include <testsuite_hooks.h> + +template<typename O> +constexpr +void +test_range_concepts() +{ + static_assert(std::ranges::contiguous_range<O>); + static_assert(std::ranges::sized_range<O>); + static_assert(std::ranges::common_range<O>); + static_assert(!std::ranges::borrowed_range<O>); + + // an optional<const T> is not assignable, and therefore does not satisfy ranges::view + using T = typename O::value_type; + constexpr bool is_const_opt = std::is_const_v<T>; + static_assert(std::ranges::view<O> == !is_const_opt); + static_assert(std::ranges::viewable_range<O> == !is_const_opt); +} + +template<typename O> +constexpr +void +test_iterator_concepts() +{ + using T = typename O::value_type; + using iterator = typename O::iterator; + static_assert(std::contiguous_iterator<iterator>); + static_assert(std::is_same_v<typename std::iterator_traits<iterator>::value_type, std::remove_cv_t<T>>); + static_assert(std::is_same_v<std::iter_value_t<iterator>, std::remove_cv_t<T>>); + static_assert(std::is_same_v<typename std::iterator_traits<iterator>::reference, T&>); + static_assert(std::is_same_v<std::iter_reference_t<iterator>, T&>); + + using const_iterator = typename O::const_iterator; + static_assert(std::contiguous_iterator<const_iterator>); + static_assert(std::is_same_v<typename std::iterator_traits<const_iterator>::value_type, std::remove_cv_t<T>>); + static_assert(std::is_same_v<std::iter_value_t<const_iterator>, std::remove_cv_t<T>>); + static_assert(std::is_same_v<typename std::iterator_traits<const_iterator>::reference, const T&>); + static_assert(std::is_same_v<std::iter_reference_t<const_iterator>, const T&>); +} + +template<typename O> +constexpr +void +test_empty() +{ + O empty; + VERIFY(!empty); + VERIFY(empty.begin() == empty.end()); + VERIFY(std::as_const(empty).begin() == std::as_const(empty).end()); + VERIFY(std::ranges::empty(empty)); + VERIFY(std::ranges::empty(std::as_const(empty))); + VERIFY(std::ranges::empty(empty | std::views::as_const)); + VERIFY(std::ranges::size(empty) == 0); + VERIFY(std::ranges::size(std::as_const(empty)) == 0); + + size_t count = 0; + for (const auto& x : empty) + ++count; + VERIFY(count == 0); +} + +template<typename O, typename T> +constexpr +void +test_non_empty(const T& value) +{ + O non_empty = std::make_optional(value); + VERIFY(non_empty); + VERIFY(*non_empty == value); + VERIFY(non_empty.begin() != non_empty.end()); + VERIFY(non_empty.begin() < non_empty.end()); + VERIFY(std::as_const(non_empty).begin() != std::as_const(non_empty).end()); + VERIFY(std::as_const(non_empty).begin() < std::as_const(non_empty).end()); + VERIFY(!std::ranges::empty(non_empty)); + VERIFY(!std::ranges::empty(std::as_const(non_empty))); + VERIFY(!std::ranges::empty(non_empty | std::views::as_const)); + VERIFY(std::ranges::size(non_empty) == 1); + VERIFY(std::ranges::size(std::as_const(non_empty)) == 1); + + size_t count = 0; + for (const auto& x : non_empty) + ++count; + VERIFY(count == 1); + + if constexpr (!std::is_const_v<typename O::value_type>) { + for (auto& x : non_empty) + x = T{}; + VERIFY(non_empty); + VERIFY(*non_empty == T{}); + } +} + +template<typename T> +constexpr +void +test(const T& value) +{ + using O = std::optional<T>; + test_range_concepts<O>(); + test_iterator_concepts<O>(); + test_empty<O>(); + test_non_empty<O>(value); + static_assert(!std::formattable<O, char>); + static_assert(!std::formattable<O, wchar_t>); + static_assert(std::format_kind<O> == std::range_format::disabled); +} + +constexpr +void +range_chain_example() // from P3168 +{ + std::vector<int> v{2, 3, 4, 5, 6, 7, 8, 9, 1}; + auto test = [](int i) -> std::optional<int> { + switch(i) { + case 1: + case 3: + case 7: + case 9: + return i * 2; + default: + return {}; + } + }; + + auto result = v + | std::views::transform(test) + | std::views::filter([](auto x) { return bool(x); }) + | std::views::transform([](auto x){ return *x; }) + | std::ranges::to<std::vector>(); + + bool ok = result == std::vector<int>{6, 14, 18, 2}; + VERIFY(ok); +} + +constexpr +bool +all_tests() +{ + test(42); + int i = 42; + test(&i); + test(std::string_view("test")); + test(std::vector<int>{1, 2, 3, 4}); + test(std::optional<int>(42)); + test<const int>(42); + + range_chain_example(); + + return true; +} + +static_assert(all_tests()); + diff --git a/libstdc++-v3/testsuite/20_util/optional/version.cc b/libstdc++-v3/testsuite/20_util/optional/version.cc index 657a399..ba44aa5 100644 --- a/libstdc++-v3/testsuite/20_util/optional/version.cc +++ b/libstdc++-v3/testsuite/20_util/optional/version.cc @@ -21,8 +21,17 @@ #endif #endif +#if __cplusplus > 202302L +# ifndef __cpp_lib_optional_range_support +# error "Feature test macro for optional range support is missing in <version>" +# elif __cpp_lib_optional_range_support != 202406L +# error "Feature test macro for optional range support has wrong value for C++26 in <version>" +# endif +#endif + #undef __cpp_lib_optional #undef __cpp_lib_freestanding_optional +#undef __cpp_lib_optional_range_support #include <optional> #if __cplusplus >= 202302L @@ -32,3 +41,12 @@ # error "Feature test macro for freestanding std::optional has wrong value in <optional>" #endif #endif + +#if __cplusplus > 202302L +# ifndef __cpp_lib_optional_range_support +# error "Feature test macro for optional range support is missing in <optional>" +# endif +# if __cpp_lib_optional_range_support != 202406L +# error "Feature test macro for optional range support has wrong value for C++26 in <optional>" +# endif +#endif |