diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | contrib/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/ChangeLog | 54 | ||||
-rw-r--r-- | gcc/DATESTAMP | 2 | ||||
-rw-r--r-- | gcc/c-family/ChangeLog | 15 | ||||
-rw-r--r-- | gcc/c/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cobol/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/cobol/cbldiag.h | 4 | ||||
-rw-r--r-- | gcc/cobol/parse.y | 4 | ||||
-rw-r--r-- | gcc/cobol/scan.l | 2 | ||||
-rw-r--r-- | gcc/cobol/scan_ante.h | 2 | ||||
-rw-r--r-- | gcc/cobol/show_parse.h | 2 | ||||
-rw-r--r-- | gcc/cobol/util.cc | 4 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 45 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 97 | ||||
-rw-r--r-- | libcpp/ChangeLog | 12 | ||||
-rw-r--r-- | libgcc/ChangeLog | 14 | ||||
-rw-r--r-- | libgcobol/ChangeLog | 12 | ||||
-rw-r--r-- | libgcobol/Makefile.am | 1 | ||||
-rw-r--r-- | libgcobol/Makefile.in | 4 | ||||
-rw-r--r-- | libgcobol/libgcobol.cc | 68 | ||||
-rw-r--r-- | libgcobol/stringbin.cc | 330 | ||||
-rw-r--r-- | libgcobol/stringbin.h | 42 | ||||
-rw-r--r-- | libstdc++-v3/ChangeLog | 6 |
24 files changed, 681 insertions, 67 deletions
@@ -1,3 +1,7 @@ +2025-08-07 Pengfei Li <Pengfei.Li2@arm.com> + + * MAINTAINERS: Add myself. + 2025-08-05 Thomas Schwinge <tschwinge@baylibre.com> * .gitignore: Remove 'libgrust/*/target/'. diff --git a/contrib/ChangeLog b/contrib/ChangeLog index f4f48e5..5370de6 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,11 @@ +2025-08-07 Tobias Burnus <tburnus@baylibre.com> + + PR other/120237 + * download_prerequisites: Update to download GMP 6.3.0 (before 6.2.1), + MPFR 4.2.2 (before 4.1.0), and MPC 1.3.1 (before 1.2.1). + * prerequisites.md5: Update hash. + * prerequisites.sha512: Likewise. + 2025-07-28 David Malcolm <dmalcolm@redhat.com> * gcc-changelog/git_commit.py: Add "diagnostics" to bug diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b600551..fab0d36 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,57 @@ +2025-08-07 Richard Sandiford <richard.sandiford@arm.com> + + PR target/121414 + * config/aarch64/aarch64.cc (aarch64_is_variant_pcs): New function, + split out from... + (aarch64_asm_output_variant_pcs): ...here. Handle various types + of SME function type. + +2025-08-07 Richard Sandiford <richard.sandiford@arm.com> + + PR rtl-optimization/120718 + * simplify-rtx.cc (simplify_context::simplify_gen_subreg): + Remove MODE_COMPOSITE_P condition. + +2025-08-07 Richard Biener <rguenther@suse.de> + + PR tree-optimization/121405 + * tree-ssa-sccvn.cc (visit_nary_op): Handle BIT_FIELD_REF + with reference def by looking up a combination of both. + +2025-08-07 Pengfei Li <Pengfei.Li2@arm.com> + + * tree-vect-data-refs.cc (vect_compute_data_ref_alignment): + Allow DR target alignment to be a poly_int. + (vect_enhance_data_refs_alignment): Support peeling and + versioning for VLA modes. + * tree-vect-loop-manip.cc (get_misalign_in_elems): Remove + power-of-two rounding in peeling. + (vect_create_cond_for_align_checks): Update alignment check + logic for poly_int mask. + (vect_create_cond_for_vla_spec_read): New runtime checks. + (vect_loop_versioning): Support new runtime checks. + * tree-vect-loop.cc (_loop_vec_info::_loop_vec_info): Add a new + loop_vinfo field. + (vectorizable_induction): Fix wrong IV offset issue. + * tree-vect-stmts.cc (get_load_store_type): Refactor + vectorizable checks for speculative loads. + * tree-vectorizer.h (LOOP_VINFO_MAX_SPEC_READ_AMOUNT): New + macro for new runtime checks. + (LOOP_REQUIRES_VERSIONING_FOR_SPEC_READ): Likewise + (LOOP_REQUIRES_VERSIONING): Update macro for new runtime checks. + +2025-08-07 Jakub Jelinek <jakub@redhat.com> + + PR preprocessor/120778 + * doc/invoke.texi (Wkeyword-macro): Document. + +2025-08-07 Stefan Schulze Frielinghaus <stefansf@gcc.gnu.org> + + * config/s390/s390.cc (print_operand): Allow arbitrary wide_int + constants for _BitInt. + (s390_bitint_type_info): Implement target hook + TARGET_C_BITINT_TYPE_INFO. + 2025-08-06 Uros Bizjak <ubizjak@gmail.com> PR target/96226 diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index d4024d7..1f2f1bb 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20250807 +20250808 diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 2abe6df..ee84aa6 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,18 @@ +2025-08-07 Jakub Jelinek <jakub@redhat.com> + + PR c++/117783 + * c-cppbuiltin.cc (c_cpp_builtins): Change __cpp_structured_bindings + predefined value for C++26 from 202403L to 202411L. + +2025-08-07 Jakub Jelinek <jakub@redhat.com> + + PR preprocessor/120778 + * c.opt (Wkeyword-macro): New option. + * c.opt.urls: Regenerate. + * c-common.h (cxx_dialect): Comment formatting fix. + * c-opts.cc (c_common_post_options): Default to + -Wkeyword-macro for C++26 if pedantic. + 2025-08-06 Alexandre Oliva <oliva@adacore.com> * c-attribs.cc (handle_hardbool_attribute): Create distinct diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 2e5c896..87a18c9 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2025-08-07 Jakub Jelinek <jakub@redhat.com> + + PR preprocessor/120778 + * c-decl.cc (c_init_decl_processing): Mark cpp nodes corresponding + to keywords as NODE_WARN if warn_keyword_macro. + 2025-08-06 Alexandre Oliva <oliva@adacore.com> * c-tree.h (C_BOOLEAN_TYPE_P): Cover hardbools as well. diff --git a/gcc/cobol/ChangeLog b/gcc/cobol/ChangeLog index 35d645c..8c47213 100644 --- a/gcc/cobol/ChangeLog +++ b/gcc/cobol/ChangeLog @@ -1,3 +1,13 @@ +2025-08-07 Robert Dubner <rdubner@symas.com> + + * cbldiag.h (location_dump): Source code formatting. + * parse.y: error_msg formatting. + * scan.l: Remove UTF-8 character from regex pattern. + * scan_ante.h (numstr_of): error_msg formatting. + * show_parse.h (class ANALYZE): Suppress cppcheck error. + * util.cc (cbl_field_t::report_invalid_initial_value): + error_msg formatting. + 2025-08-02 Jakub Jelinek <jakub@redhat.com> * parse.y (intrinsic): Use %td format specifier with no cast on diff --git a/gcc/cobol/cbldiag.h b/gcc/cobol/cbldiag.h index dd16190..2554deb 100644 --- a/gcc/cobol/cbldiag.h +++ b/gcc/cobol/cbldiag.h @@ -122,8 +122,8 @@ static void location_dump( const char func[], int line, const char tag[], const LOC& loc) { extern int yy_flex_debug; // cppcheck-suppress shadowVariable if( yy_flex_debug ) { - const char *detail = gcobol_getenv("update_location"); // cppcheck-suppress knownConditionTrueFalse - if( detail ) { + const char *detail = gcobol_getenv("update_location"); + if( detail ) { // cppcheck-suppress knownConditionTrueFalse fprintf(stderr, "%s:%d: %s location (%d,%d) to (%d,%d)\n", func, line, tag, loc.first_line, loc.first_column, loc.last_line, loc.last_column); diff --git a/gcc/cobol/parse.y b/gcc/cobol/parse.y index fae96ed..59cc64d 100644 --- a/gcc/cobol/parse.y +++ b/gcc/cobol/parse.y @@ -10336,8 +10336,8 @@ intrinsic: function_udf if( p != NULL ) { auto loc = symbol_field_location(field_index(p->field)); error_msg(loc, "FUNCTION %qs has " - "inconsistent parameter type %td (%qs)", - keyword_str($1), p - args.data(), name_of(p->field) ); + "inconsistent parameter type %ld (%qs)", + keyword_str($1), (long)(p - args.data()), name_of(p->field) ); YYERROR; } $$ = is_numeric(args[0].field)? diff --git a/gcc/cobol/scan.l b/gcc/cobol/scan.l index ba4c044..5773f09 100644 --- a/gcc/cobol/scan.l +++ b/gcc/cobol/scan.l @@ -123,7 +123,7 @@ NUMEDCHAR [BPVZ90/,]+{COUNT}? NUMEDCHARS {NUMEDCHAR}([.]?{NUMEDCHAR})* NUMED ([+-]{NUMEDCHARS}+)|({NUMEDCHARS}+[+-]) CURRENCY [A-Zfhijklmoqtuwy\x80-\xFF]{-}[ABCDEGNPRSVXZ] -NUMEDCUR (([.]?[-$0B/Z*+,P9()V+–]|{CURRENCY}+|{COUNT})+([.][$0B/Z*+P9()V+\–])*)+ +NUMEDCUR (([.]?[$0B/Z*+,P9()V+-]|{CURRENCY}+|{COUNT})+([.][$0B/Z*+P9()V+-])*)+ NUMEDITED {NUMED}|{NUMEDCUR} EDITED {ALPHED}|{NUMED}|{NUMEDCUR} diff --git a/gcc/cobol/scan_ante.h b/gcc/cobol/scan_ante.h index 31093a6..c00826d 100644 --- a/gcc/cobol/scan_ante.h +++ b/gcc/cobol/scan_ante.h @@ -149,7 +149,7 @@ numstr_of( const char string[], radix_t radix = decimal_e ) { } auto nx = std::count_if(input, p, fisdigit); if( 36 < nx ) { - error_msg(yylloc, "significand of %s has more than 36 digits (%td)", input, nx); + error_msg(yylloc, "significand of %s has more than 36 digits (%ld)", input, (long)nx); return NO_CONDITION; } diff --git a/gcc/cobol/show_parse.h b/gcc/cobol/show_parse.h index bd0e16f..e1a8cb2 100644 --- a/gcc/cobol/show_parse.h +++ b/gcc/cobol/show_parse.h @@ -500,7 +500,7 @@ class ANALYZE int level; inline static int analyze_level=1; public: - ANALYZE(const char *func_) : func(func_) + ANALYZE(const char *func_) : func(func_) // cppcheck-suppress noExplicitConstructor { level = 0; if( getenv("Analyze") ) diff --git a/gcc/cobol/util.cc b/gcc/cobol/util.cc index aed9483..2a7bf2b 100644 --- a/gcc/cobol/util.cc +++ b/gcc/cobol/util.cc @@ -1049,8 +1049,8 @@ cbl_field_t::report_invalid_initial_value(const YYLTYPE& loc) const { return TOUPPER(ch) == 'E'; } ); if( !has_exponent && data.precision() < pend - p ) { - error_msg(loc, "%s cannot represent VALUE %qs exactly (max %c%td)", - name, data.initial, '.', pend - p); + error_msg(loc, "%s cannot represent VALUE %qs exactly (max %c%ld)", + name, data.initial, '.', (long)(pend - p)); } } } diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8e9b8ea..061c4e4 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,48 @@ +2025-08-07 Patrick Palka <ppalka@redhat.com> + + * call.cc (extract_call_expr): Remove handling of C++20 + rewritten comparison operators. + +2025-08-07 Jakub Jelinek <jakub@redhat.com> + + PR c++/117783 + * parser.cc: Implement C++26 P1061R10 - Structured Bindings can + introduce a Pack. + (cp_parser_range_for): Also handle TREE_VEC as DECL_VALUE_EXPR + instead of ARRAY_REF. + (cp_parser_decomposition_declaration): Use sb-identifier-list instead + of identifier-list in comments. Parse structured bindings with + structured binding pack. Don't emit pedwarn about structured + binding attributes in structured bindings inside of a condition. + (cp_convert_omp_range_for): Also handle TREE_VEC as DECL_VALUE_EXPR + instead of ARRAY_REF. + * decl.cc (get_tuple_element_type): Change i argument type from + unsigned to unsigned HOST_WIDE_INT. + (get_tuple_decomp_init): Likewise. + (set_sb_pack_name): New function. + (cp_finish_decomp): Handle structured binding packs. + * pt.cc (tsubst_pack_expansion): Handle structured binding packs + and capture proxies for them. Formatting fixes. + (tsubst_decl): For structured binding packs don't tsubst TREE_TYPE + first, instead recreate the type after r is created. + (tsubst_omp_for_iterator): Also handle TREE_VEC as DECL_VALUE_EXPR + instead of ARRAY_REF. + (tsubst_expr): Handle sizeof... on non-dependent structure binding + packs. + (value_dependent_expression_p): Return false for sizeof... on + non-dependent structure binding packs. + (instantiation_dependent_r): Don't recurse on sizeof... on + non-dependent structure binding packs. + * constexpr.cc (potential_constant_expression_1): Also handle + TREE_VEC on DECL_VALUE_EXPR of structure binding packs. + +2025-08-07 Jakub Jelinek <jakub@redhat.com> + + PR preprocessor/120778 + * lex.cc (cxx_init): Mark cpp nodes corresponding + to keywords, identifiers with special meaning and standard + attribute identifiers as NODE_WARN if warn_keyword_macro. + 2025-08-06 Patrick Palka <ppalka@redhat.com> PR c++/121231 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index df2c843..ee43695 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,100 @@ +2025-08-07 Jakub Jelinek <jakub@redhat.com> + + PR c++/117783 + * g++.dg/cpp26/decomp13.C: New test. + * g++.dg/cpp26/decomp14.C: New test. + * g++.dg/cpp26/decomp15.C: New test. + * g++.dg/cpp26/decomp16.C: New test. + * g++.dg/cpp26/decomp17.C: New test. + * g++.dg/cpp26/decomp18.C: New test. + * g++.dg/cpp26/decomp19.C: New test. + * g++.dg/cpp26/decomp20.C: New test. + * g++.dg/cpp26/decomp21.C: New test. + * g++.dg/cpp26/feat-cxx26.C (__cpp_structured_bindings): Expect + 202411 rather than 202403. + +2025-08-07 Richard Sandiford <richard.sandiford@arm.com> + + PR target/121414 + * gcc.target/aarch64/sme/pr121414_1.c: New test. + +2025-08-07 Richard Sandiford <richard.sandiford@arm.com> + + PR rtl-optimization/120718 + * gcc.target/aarch64/sve/acle/general/pr120718.c: New test. + +2025-08-07 Richard Biener <rguenther@suse.de> + + PR tree-optimization/121405 + * gcc.dg/tree-ssa/ssa-fre-107.c: New testcase. + * gcc.target/i386/pr90579.c: Adjust. + +2025-08-07 Pengfei Li <Pengfei.Li2@arm.com> + + * gcc.target/aarch64/sve/peel_ind_11.c: New test. + * gcc.target/aarch64/sve/peel_ind_11_run.c: New test. + * gcc.target/aarch64/sve/peel_ind_12.c: New test. + * gcc.target/aarch64/sve/peel_ind_12_run.c: New test. + * gcc.target/aarch64/sve/peel_ind_13.c: New test. + * gcc.target/aarch64/sve/peel_ind_13_run.c: New test. + +2025-08-07 Jakub Jelinek <jakub@redhat.com> + + PR preprocessor/120778 + * g++.dg/DRs/dr2577-1.C: New test. + * g++.dg/DRs/dr2577-2.C: New test. + * g++.dg/DRs/dr2577-2.h: New file. + * g++.dg/DRs/dr2577-3.C: New test. + * g++.dg/DRs/dr2577-3.h: New file. + +2025-08-07 Jakub Jelinek <jakub@redhat.com> + + PR preprocessor/120778 + * g++.dg/DRs/dr2575.C: New test. + +2025-08-07 Jakub Jelinek <jakub@redhat.com> + + PR preprocessor/120778 + * g++.dg/DRs/dr2576.C: New test. + +2025-08-07 Jakub Jelinek <jakub@redhat.com> + + PR preprocessor/120778 + * gcc.dg/Wkeyword-macro-1.c: New test. + * gcc.dg/Wkeyword-macro-2.c: New test. + * gcc.dg/Wkeyword-macro-3.c: New test. + * gcc.dg/Wkeyword-macro-4.c: New test. + * gcc.dg/Wkeyword-macro-5.c: New test. + * gcc.dg/Wkeyword-macro-6.c: New test. + * gcc.dg/Wkeyword-macro-7.c: New test. + * gcc.dg/Wkeyword-macro-8.c: New test. + * gcc.dg/Wkeyword-macro-9.c: New test. + * g++.dg/warn/Wkeyword-macro-1.C: New test. + * g++.dg/warn/Wkeyword-macro-2.C: New test. + * g++.dg/warn/Wkeyword-macro-3.C: New test. + * g++.dg/warn/Wkeyword-macro-4.C: New test. + * g++.dg/warn/Wkeyword-macro-5.C: New test. + * g++.dg/warn/Wkeyword-macro-6.C: New test. + * g++.dg/warn/Wkeyword-macro-7.C: New test. + * g++.dg/warn/Wkeyword-macro-8.C: New test. + * g++.dg/warn/Wkeyword-macro-9.C: New test. + * g++.dg/warn/Wkeyword-macro-10.C: New test. + * g++.dg/opt/pr82577.C: Don't #define register to nothing for + C++17 and later. Instead define reg macro to nothing for C++17 + and later or to register and use it instead of register. + * g++.dg/modules/atom-preamble-3.C: Add -Wno-keyword-macro to + dg-additional-options. + * g++.dg/template/sfinae17.C (static_assert): Rename macro to ... + (my_static_assert): ... this. + (main): Use my_static_assert instead of static_assert. + +2025-08-07 Stefan Schulze Frielinghaus <stefansf@gcc.gnu.org> + + * gcc.target/s390/bitint-1.c: New test. + * gcc.target/s390/bitint-2.c: New test. + * gcc.target/s390/bitint-3.c: New test. + * gcc.target/s390/bitint-4.c: New test. + 2025-08-06 Sam James <sam@gentoo.org> * g++.dg/cpp26/constexpr-new3.C: Escape '[' and ']'. diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 7deda4b..874a08a 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,15 @@ +2025-08-07 Jakub Jelinek <jakub@redhat.com> + + PR preprocessor/120778 + * include/cpplib.h (struct cpp_options): Add cpp_warn_keyword_macro. + (enum cpp_warning_reason): Add CPP_W_KEYWORD_MACRO enumerator. + (cpp_keyword_p): New inline function. + * directives.cc (do_undef): Support -Wkeyword-macro diagnostics. + * macro.cc (warn_of_redefinition): Ignore NODE_WARN flag on nodes + registered for -Wkeyword-macro. + (_cpp_create_definition): Support -Wkeyword-macro diagnostics. + Formatting fixes. + 2025-08-05 Jakub Jelinek <jakub@redhat.com> PR preprocessor/120778 diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 882117d..c4cba3b 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,17 @@ +2025-08-07 Stefan Schulze Frielinghaus <stefansf@gcc.gnu.org> + + * config/s390/libgcc-glibc.ver: Export _BitInt support + functions. + * config/s390/t-softfp (softfp_extras): Add fixtfbitint + floatbitinttf. + +2025-08-07 Stefan Schulze Frielinghaus <stefansf@gcc.gnu.org> + + * config.host: Include makefiles t-softfp for -m64. + * config/s390/sfp-exceptions.c: New file. + * config/s390/sfp-machine.h: New file. + * config/s390/t-softfp: New file. + 2025-08-06 Jakub Jelinek <jakub@redhat.com> PR libgcc/121397 diff --git a/libgcobol/ChangeLog b/libgcobol/ChangeLog index 91a3b86..203a0e7 100644 --- a/libgcobol/ChangeLog +++ b/libgcobol/ChangeLog @@ -1,3 +1,15 @@ +2025-08-07 Robert Dubner <rdubner@symas.com> + + * Makefile.am: Include new stringbin.cc file. + * Makefile.in: Regenerated. + * libgcobol.cc (__gg__power_of_ten): Improve error message. + (__gg__binary_to_string): Deleted. + (__gg__binary_to_string_internal): Deleted. + (int128_to_field): Use new conversion routine. + (__gg__move): Use new conversion routine. + * stringbin.cc: New file. Implements new conversion routine. + * stringbin.h: New file. Likewise. + 2025-07-13 Robert Dubner <rdubner@symas.com> * common-defs.h (PTRCAST): Moved here from libgcobol.h. diff --git a/libgcobol/Makefile.am b/libgcobol/Makefile.am index 0a17d20..1e3d3432 100644 --- a/libgcobol/Makefile.am +++ b/libgcobol/Makefile.am @@ -42,6 +42,7 @@ libgcobol_la_SOURCES = \ intrinsic.cc \ io.cc \ libgcobol.cc \ + stringbin.cc \ valconv.cc WARN_CFLAGS = -W -Wall -Wwrite-strings diff --git a/libgcobol/Makefile.in b/libgcobol/Makefile.in index 5fdc42c..42dc823 100644 --- a/libgcobol/Makefile.in +++ b/libgcobol/Makefile.in @@ -178,7 +178,7 @@ libgcobol_la_LIBADD = @BUILD_LIBGCOBOL_TRUE@am_libgcobol_la_OBJECTS = charmaps.lo \ @BUILD_LIBGCOBOL_TRUE@ constants.lo gfileio.lo gmath.lo \ @BUILD_LIBGCOBOL_TRUE@ intrinsic.lo io.lo libgcobol.lo \ -@BUILD_LIBGCOBOL_TRUE@ valconv.lo +@BUILD_LIBGCOBOL_TRUE@ stringbin.lo valconv.lo libgcobol_la_OBJECTS = $(am_libgcobol_la_OBJECTS) @BUILD_LIBGCOBOL_TRUE@am_libgcobol_la_rpath = -rpath $(toolexeclibdir) AM_V_P = $(am__v_P_@AM_V@) @@ -404,6 +404,7 @@ gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER) @BUILD_LIBGCOBOL_TRUE@ intrinsic.cc \ @BUILD_LIBGCOBOL_TRUE@ io.cc \ @BUILD_LIBGCOBOL_TRUE@ libgcobol.cc \ +@BUILD_LIBGCOBOL_TRUE@ stringbin.cc \ @BUILD_LIBGCOBOL_TRUE@ valconv.cc @BUILD_LIBGCOBOL_TRUE@WARN_CFLAGS = -W -Wall -Wwrite-strings @@ -526,6 +527,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/intrinsic.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/io.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgcobol.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stringbin.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/valconv.Plo@am__quote@ .cc.o: diff --git a/libgcobol/libgcobol.cc b/libgcobol/libgcobol.cc index c3d78d4..a7b4b55 100644 --- a/libgcobol/libgcobol.cc +++ b/libgcobol/libgcobol.cc @@ -72,6 +72,8 @@ #include <sys/time.h> #include <execinfo.h> #include "exceptl.h" +#include "stringbin.h" + /* BSD extension. */ #if !defined(LOG_PERROR) @@ -798,7 +800,7 @@ __gg__power_of_ten(int n) fprintf(stderr, "Trying to raise 10 to %d as an int128, which we can't do.\n", n); - fprintf(stderr, "The problem is in %s.\n", __func__); + fprintf(stderr, "The problem is in %s %s:%d.\n", __func__, __FILE__, __LINE__); abort(); } if( n <= MAX_POWER ) @@ -875,56 +877,6 @@ __gg__scale_by_power_of_ten_2(__int128 value, int N) return value; } -extern "C" -bool -__gg__binary_to_string(char *result, int digits, __int128 value) - { - // The result is not terminated, because this routine is used - // to put information directly into cblc_field_t::data - // Our caller has to keep track of whether value was negative. - - // Note that this routine operates in the source code-set space; that is - // the result comes back with zero as an ASCII 0x30, not an EBCDIC 0xF0 - - if( value < 0 ) - { - value = -value; - } - result += digits-1 ; - while( digits-- ) - { - *result-- = value%10 + ascii_zero; - value /= 10; - } - // Should value be non-zero, it means we potentially have a size error - return value != 0; - } - -extern "C" -bool -__gg__binary_to_string_internal(char *result, int digits, __int128 value) - { - // The result is not terminated, because this routine is used - // to put information directly into cblc_field_t::data - // Our caller has to keep track of whether value was negative. - - // Note that this routine operates in the source code-set space; that is - // the result comes back with zero as an ASCII 0x30, not an EBCDIC 0xF0 - - if( value < 0 ) - { - value = -value; - } - result += digits-1 ; - while( digits-- ) - { - *result-- = (value%10) + internal_zero; - value /= 10; - } - // Should value be non-zero, it means we potentially have a size error - return value != 0; - } - static bool value_is_too_big(const cblc_field_t *var, __int128 value, @@ -1617,9 +1569,13 @@ int128_to_field(cblc_field_t *var, // Note that sending a signed value to an alphanumeric strips off // any plus or minus signs. + memset(location, 0, length); size_error = __gg__binary_to_string_internal( - PTRCAST(char, location), - length, value); + PTRCAST(char, location), + length > MAX_FIXED_POINT_DIGITS + ? MAX_FIXED_POINT_DIGITS + : length, + value); break; case FldNumericDisplay: @@ -1708,7 +1664,7 @@ int128_to_field(cblc_field_t *var, // At this point, value is scaled to the target's rdigits - size_error = __gg__binary_to_string(ach, var->digits, value); + size_error = __gg__binary_to_string_ascii(ach, var->digits, value); ach[var->digits] = NULLCH; // Convert that string according to the PICTURE clause @@ -1749,7 +1705,7 @@ int128_to_field(cblc_field_t *var, case FldAlphaEdited: { char ach[128]; - size_error = __gg__binary_to_string(ach, length, value); + size_error = __gg__binary_to_string_ascii(ach, length, value); ach[length] = NULLCH; // Convert that string according to the PICTURE clause @@ -6126,7 +6082,7 @@ __gg__move( cblc_field_t *fdest, // Convert it to the full complement of digits available // from the source...but no more - __gg__binary_to_string(ach, source_digits, value); + __gg__binary_to_string_ascii(ach, source_digits, value); // Binary to string returns ASCII characters: for(int i=0; i<source_digits; i++) diff --git a/libgcobol/stringbin.cc b/libgcobol/stringbin.cc new file mode 100644 index 0000000..d35ea82 --- /dev/null +++ b/libgcobol/stringbin.cc @@ -0,0 +1,330 @@ +/* + * Copyright (c) 2021-2025 Symas Corporation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of the Symas Corporation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <algorithm> +#include <cctype> +#include <cstdio> +#include <cstdlib> +#include <cstring> +#include <ctime> +#include <set> +#include <stack> +#include <string> +#include <unordered_map> +#include <vector> + +#include <dirent.h> +#include <dlfcn.h> +#include <err.h> +#include <fcntl.h> +#include <fenv.h> +#include <math.h> // required for fpclassify(3), not in cmath +#include <setjmp.h> +#include <signal.h> +#include <syslog.h> +#include <unistd.h> +#include <stdarg.h> +#if __has_include(<errno.h>) +# include <errno.h> // for program_invocation_short_name +#endif + +#include "config.h" +#include "libgcobol-fp.h" + +#include "ec.h" +#include "common-defs.h" +#include "io.h" +#include "gcobolio.h" +#include "libgcobol.h" +#include "gfileio.h" +#include "charmaps.h" +#include "valconv.h" +#include <sys/mman.h> +#include <sys/resource.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <sys/time.h> +#include <execinfo.h> +#include "exceptl.h" +#include "stringbin.h" + +/* This routine evolved from a primitive binary-to-string routine that simply + peeled digits off the bottom of an __int128 by using + + value % 10 + '0'; + value /= 10; + + That turns out to be unnecessarily slow. + + The routine implemented here uses a divide-and-conquer approach to + minimimizing the number of operations, and when you get down to two + digits it does a divide-by-100 and uses the remainder in a table lookup + to get the digits. */ + +/* These static tables are born of a pathologic desire to avoid calculations. + Whether that paranoia is justified (perhaps "digit%10 + '0';" ) would + actually be faster) is currently untested. But I figured this would be + pretty darn fast. + + Use them when you know the index is between zero and one hundred. */ + +static const char digit_low[100] = + { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + }; + +static const char digit_high[100] = + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + }; + +static char combined_string[128]; +static char zero_char; + +typedef struct + { + int start; + int run; + union + { + unsigned __int128 val128; + uint64_t val64; + uint32_t val32; + uint16_t val16; + uint8_t val8; + }; + } COMBINED; + +static +void +string_from_combined(const COMBINED &combined) + { + COMBINED left; + COMBINED right; + + uint16_t v16; + + switch(combined.run) + { + case 1: + // We know that val8 is a single digit + combined_string[combined.start] = combined.val8 + zero_char;; + break; + + case 2: + // We know that val8 has two digits + combined_string[combined.start] = digit_high[combined.val8] + zero_char; + combined_string[combined.start+1] = digit_low [combined.val8] + zero_char; + break; + + case 3: + // We know that val16 has three digits. + v16 = combined.val16; + combined_string[combined.start] = v16 / 100 + zero_char; + v16 %= 100; + combined_string[combined.start+1] = v16 / 10 + zero_char; + combined_string[combined.start+2] = v16 % 10 + zero_char; + break; + + case 4: + // We know that val16 has four digits: + v16 = combined.val16; + combined_string[combined.start] = v16 / 1000 + zero_char; + v16 %= 1000; + combined_string[combined.start+1] = v16 / 100 + zero_char; + v16 %= 100; + combined_string[combined.start+2] = v16 / 10 + zero_char; + combined_string[combined.start+3] = v16 % 10 + zero_char; + break; + + case 5: + case 6: + case 7: + case 8: + // We know that val32 can be treated as two 4-digit pieces + left.start = combined.start; + left.run = combined.run - 4; + left.val16 = combined.val32 / 10000; + + right.start = combined.start+left.run; + right.run = 4; + right.val16 = combined.val32 % 10000; + + string_from_combined(left); + string_from_combined(right); + break; + + case 9: + // We break val32 into a 1-digit piece, and an 8-digit piece: + left.start = combined.start; + left.run = combined.run - 8; + left.val32 = combined.val32 / 100000000; + + right.start = combined.start+left.run; + right.run = 8; + right.val32 = combined.val32 % 100000000; + + string_from_combined(left); + string_from_combined(right); + break; + + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + // We know we can treat val64 as two 9-digit pieces: + left.start = combined.start; + left.run = combined.run - 9; + left.val32 = combined.val64 / 1000000000; + + right.start = combined.start+left.run; + right.run = 9; + right.val32 = combined.val64 % 1000000000; + + string_from_combined(left); + string_from_combined(right); + break; + + case 19: + // We split off the bottom nine digits + left.start = combined.start; + left.run = combined.run - 9; + left.val64 = combined.val64 / 1000000000; + + right.start = combined.start+left.run; + right.run = 9; + right.val32 = combined.val64 % 1000000000; + + string_from_combined(left); + string_from_combined(right); + break; + + default: + // For twenty or more digits we peel eighteen digits at a time off the + // right side: + left.start = combined.start; + left.run = combined.run - 18; + left.val128 = combined.val128 / 1000000000000000000ULL; + + right.start = combined.start+left.run; + right.run = 18; + right.val64 = combined.val128 % 1000000000000000000ULL; + + string_from_combined(left); + string_from_combined(right); + break; + } + } + +bool +__gg__binary_to_string_ascii(char *result, int digits, __int128 value) + { + zero_char = ascii_zero; + + // Note that this routine does not terminate the generated string with a + // NUL. This routine is sometimes used to generate a NumericDisplay string + // of digits in place, with no terminator. + __int128 mask = __gg__power_of_ten(digits); + + COMBINED combined; + if( value < 0 ) + { + value = -value; + } + + // A non-zero retval means the number was too big to fit into the desired + // number of digits: + bool retval = !!(value / mask); + + // mask off the bottom digits to avoid garbage when value is too large + value %= mask; + + combined.start = 0; + combined.run = digits; + combined.val128 = value; + string_from_combined(combined); + memcpy(result, combined_string, digits); + return retval; + } + +bool +__gg__binary_to_string_internal(char *result, int digits, __int128 value) + { + zero_char = internal_zero; + + // Note that this routine does not terminate the generated string with a + // NUL. This routine is sometimes used to generate a NumericDisplay string + // of digits in place, with no terminator. + __int128 mask = __gg__power_of_ten(digits); + + COMBINED combined; + if( value < 0 ) + { + value = -value; + } + + // A non-zero retval means the number was too big to fit into the desired + // number of digits: + bool retval = !!(value / mask); + + // mask off the bottom digits to avoid garbage when value is too large + value %= mask; + + combined.start = 0; + combined.run = digits; + combined.val128 = value; + string_from_combined(combined); + memcpy(result, combined_string, digits); + return retval; + } + diff --git a/libgcobol/stringbin.h b/libgcobol/stringbin.h new file mode 100644 index 0000000..0276704 --- /dev/null +++ b/libgcobol/stringbin.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2021-2025 Symas Corporation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of the Symas Corporation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef STRINGBIN_H_ +#define STRINGBIN_H_ + +extern "C" +bool __gg__binary_to_string_ascii(char *result, + int digits, + __int128 value); +extern "C" +bool __gg__binary_to_string_internal( char *result, + int digits, + __int128 value); + +#endif diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 09ee090..72a8610 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2025-08-07 Gerald Pfeifer <gerald@pfeifer.com> + + * doc/xml/manual/build_hacking.xml: Switch gcc.gnu.org installation + docs to https. + * doc/html/manual/appendix_porting.html: Regenerate. + 2025-08-05 Jakub Jelinek <jakub@redhat.com> PR libstdc++/121373 |