aboutsummaryrefslogtreecommitdiff
path: root/gcc/cobol
AgeCommit message (Collapse)AuthorFilesLines
2025-04-08cobol: Further fixes for cobol cross-compilation from 32-bit arches [PR119364]Jakub Jelinek4-18/+28
On top of https://gcc.gnu.org/pipermail/gcc-patches/2025-April/680256.html patch this brings make check-cobol when using the cross compiler from 32-bit host to x86_64-linux to the following: Running /home/jakub/src/gcc/gcc/testsuite/cobol.dg/dg.exp ... FAIL: cobol.dg/group1/declarative_1.cob -O0 execution test FAIL: cobol.dg/group1/declarative_1.cob -O1 execution test FAIL: cobol.dg/group1/declarative_1.cob -O2 execution test FAIL: cobol.dg/group1/declarative_1.cob -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test FAIL: cobol.dg/group1/declarative_1.cob -O3 -g execution test FAIL: cobol.dg/group1/declarative_1.cob -Os execution test === cobol Summary === # of expected passes 3123 # of unexpected failures 6 # of expected failures 6 (which has some analysis but not a fix yet). This patch fixes various cases where host size of various types (void *, int, size_t, unsigned char) is used in place where size of those types in bytes on the target should be used instead. At least the size of void * and size_t actually differns between ilp32 hosts and lp64 targets, int could be different in theory as well but we actually don't support 16-bit ints on the host side and only support lp64 targets right now for cobol, and finally sizeof(unsigned char) is always 1, so there is no point to multiply by that and it is still wrong to use host sizeof for the target decisions. 2025-04-08 Jakub Jelinek <jakub@redhat.com> PR cobol/119364 * genapi.cc (function_handle_from_name): Use sizeof_pointer. (parser_file_add): Use int_size_in_bytes(VOID_P) and int_size_in_bytes(int). (inspect_tally): Use int_size_in_bytes(VOID_P). (inspect_replacing): Likewise. (gg_array_of_field_pointers): Likewise. (gg_array_of_file_pointers): Likewise. (parser_set_pointers): Use sizeof_pointer. * cobol1.cc (create_our_type_nodes_init): Use int_size_in_bytes(SIZE_T) and int_size_in_bytes(VOID_P). * gengen.cc (gg_array_of_size_t): Use int_size_in_bytes(SIZE_T). (gg_array_of_bytes): Just use N, don't multiply it by sizeof(unsigned char). * parse.y: Include tree.h. Use int_size_in_bytes(ptr_type_node).
2025-04-08Daily bump.GCC Administrator1-0/+22
2025-04-07cobol: Address some iconv issues.Iain Sandoe1-1/+5
Darwin/macOS installed libiconv does not accept // trailers on conversion codes; this causes the init_iconv to fail - and then that SEGVs later. Remove the trailing // as it is not needed elsewhere. Also print a warning if we fail to init the conversion. gcc/cobol/ChangeLog: * symbols.cc : Remove trailing // on standard_internal. (cbl_field_t::internalize): Print a warning if we fail to initialise iconv. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-04-07cobol: sed portability fixJakub Jelinek1-3/+1
Apparently Darwin sed doesn't like 's/\(foo\|bar\|baz\)/qux/' syntax, simplified by using a pattern which matches all libgcobol header names except possible config.h. 2025-04-07 Jakub Jelinek <jakub@redhat.com> * Make-lang.in (cobol/charmaps.cc, cobol/valconv.cc): Use a BRE only sed regex.
2025-04-07cobol: Fix up make html for COBOL [PR119227]Jakub Jelinek1-6/+10
What make html does for COBOL is quite inconsistent with all other FEs. Normally make html creates HTML/gcc-15.0.1/ subdirectory and puts there subdirectories like gcc, cpp, gccint, gfortran etc. and only those contain *.html files. COBOL puts gcobol.html and gcobol-io.html into the current directory instead. The following patch puts them into $(build_htmldir)/gcobol/ directory. 2025-04-07 Jakub Jelinek <jakub@redhat.com> PR web/119227 * Make-lang.in (GCOBOL_HTML_FILES): New variable. (cobol.install-html, cobol.html, cobol.srchtml): Use $(GCOBOL_HTML_FILES) instead of gcobol.html gcobol-io.html. (gcobol.html): Rename goal to ... ($(build_htmldir)/gcobol/gcobol.html): ... this. Run mkinstalldirs. (gcobol-io.html): Rename goal to ... ($(build_htmldir)/gcobol/gcobol-io.html): ... this. Run mkinstalldirs.
2025-04-07Daily bump.GCC Administrator1-0/+8
2025-04-06cobol, driver: Remove platform-specific options [PR119414].Iain Sandoe1-87/+3
As discussed in the PR, the options had been added during development to handle specific cases, they are no longer needed (and if they should become necessary, we will need to guard them such that individual platforms get the correct handling). PR cobol/119414 gcc/cobol/ChangeLog: * gcobolspec.cc (append_rdynamic, append_allow_multiple_definition, append_fpic): Remove. (lang_specific_driver): Remove platform-specific command line option handling. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-04-06Daily bump.GCC Administrator1-0/+8
2025-04-05cobol, driver, libgcobol: Add support for libgcobol.spec.Iain Sandoe1-28/+13
Ads support for using a library spec file (e.g. to include the target requirements for non-standard libraries - or even libm which we can now configure at the target side). gcc/cobol/ChangeLog: * gcobolspec.cc (SPEC_FILE): New. (lang_specific_driver): Make the 'need libgcobol' flag global so that the prelink callback can use it. Libm use is now handled via the library spec. (lang_specific_pre_link): Include libgcobol.spec where needed. libgcobol/ChangeLog: * Makefile.am: Add libgcobol.spec and dependency. * Makefile.in: Regenerate. * configure: Regenerate. * configure.ac: Add libgcobol.spec handling. * libgcobol.spec.in: New file. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-04-05Daily bump.GCC Administrator1-0/+18
2025-04-04cobol: Set compile-time and run-time signable_e bits the same for RETURN-CODE.Bob Dubner2-20/+1
This fix reverts the recent cobol_langhook_post_options change setting flag_strict_aliasing = 0. It isn't necessary. gcc/cobol * cobol1.cc: Eliminate cobol_langhook_post_options. * symbols.cc: Definition of RETURN-CODE special register sets ::attr member to signable_e.
2025-04-04cobol: Eliminate cobolworx UAT errors when compiling with -OsBob Dubner3-4/+46
Testcases compiled with -Os were failing because static functions and static variables were being optimized away, because of improper data type casts, and because strict aliasing (whatever that is) was resulting in some loss of data. These changes eliminate those known problems. gcc/cobol * cobol1.cc: (cobol_langhook_post_options): Implemented in order to set flag_strict_aliasing to zero. * genapi.cc: (set_user_status): Add comment. (parser_intrinsic_subst): Expand SHOW_PARSE information. (psa_global): Change names of return-code and upsi globals, (psa_FldLiteralA): Set DECL_PRESERVE_P for FldLiteralA. * gengen.cc: (show_type): Add POINTER type. (gg_define_function_with_no_parameters): Set DECL_PRESERVE_P for COBOL- style nested programs. (gg_array_of_bytes): Fix bad cast. libgcobol * charmaps.h: Change __gg__data_return_code to 'short' type. * constants.cc: Likewise.
2025-04-04Daily bump.GCC Administrator1-0/+6
2025-04-03fold-const, cobol: Add native_encode_wide_int and use it in COBOL FE [PR119242]Jakub Jelinek1-11/+5
As has been mentioned earlier, various parts of the COBOL FE and the library aren't endian clean. In the library that means that for now we have to live with no support for big endian targets, but in the FE that means that as well as not being able to build cross-compilers from big endian or pdp endian hosts to little endian targets which are otherwise supported. The following patch attempts to fix one such spot, where it wants to encode in target byte ordering wide_int constants into 1, 2, 4, 8 or 16 bytes. We could wide_int_to_tree and then native_encode_expr, but so that we don't need to build the constants, the following patch exports from fold-const.cc a helper for native_encode_int which takes type and const wide_int_ref reference rather than an expression. 2025-04-03 Jakub Jelinek <jakub@redhat.com> PR cobol/119242 gcc/ * fold-const.h (native_encode_wide_int): Declare. * fold-const.cc (native_encode_wide_int): New function. (native_encode_int): Use it. gcc/cobol/ * genapi.cc (binary_initial_from_float128): Use native_encode_wide_int.
2025-04-03Daily bump.GCC Administrator1-0/+17
2025-04-02cobol: Plug memory leak caused by intermediate_e stack-frame variables. ↵Bob Dubner5-85/+85
[PR119521] COBOL variables with attribute intermediate_e are being allocated on the stack frame, but their data was assigned using malloc(), without a corresponding call to free(). For numerics, the problem is solved with a fixed allocation of sixteen bytes for the cblc_field_t::data member (sixteen is big enough for all data types) and with a fixed allocation of 8,192 bytes for the alphanumeric type. In use, the intermediate numeric data types are "shrunk" to the minimum applicable size. The intermediate alphanumerics, generally used as destination targets for functions, are trimmed as well. gcc/cobol PR cobol/119521 * genapi.cc: (parser_division): Change comment. (parser_symbol_add): Change intermediate_t handling. * parse.y: Multiple changes to new_alphanumeric() calls. * parse_ante.h: Establish named constant for date function calls. Change declaration of new_alphanumeric() function. * symbols.cc: (new_temporary_impl): Use named constant for default size of temporary alphanumerics. * symbols.h: Establish MAXIMUM_ALPHA_LENGTH constant. libgcobol PR cobol/119521 * intrinsic.cc: (__gg__reverse): Trim final result for intermediate_e. * libgcobol.cc: (__gg__adjust_dest_size): Abort on attempt to increase the size of a result. (__gg__module_name): Formatting. __gg__reverse(): Resize only intermediates
2025-04-02cobol: Fix incorrect use of std::remove_ifJonathan Wakely1-5/+4
The call to std::remove_if used here doesn't remove any elements, it just overwrites the "removed" elements with later elements, leaving the total number of elements unchanged. Use std::list::remove_if to actually remove those unwanted elements from the list. gcc/cobol/ChangeLog: * symfind.cc (finalize_symbol_map2): Use std::list::remove_if instead of std::remove_if.
2025-04-02Daily bump.GCC Administrator1-0/+7
2025-04-01cobol: Change some dubious sprintf() calls to xasprintf in genapi.ccBob Dubner1-57/+41
These calls were into fixed-length arrays that might be too small. gcc/cobol * genapi.cc: (section_label): Use xasprintf() instead of sprintf(). (paragraph_label): Likewise. (leave_procedure): Likewise. (find_procedure): Likewise. (parser_goto): Likewise. (parser_enter_file): Likewise.
2025-03-29Daily bump.GCC Administrator1-0/+43
2025-03-29cobol: Fix up cobol/{charmaps,valconv}.cc rulesJakub Jelinek1-21/+4
sed -i is not portable, it is supported by GNU sed and perhaps some BSDs, but not elsewhere. Furthermore, I think it is far better to always use #include "../../libgcobol/something.h" paths rather than something depending on the build directory. And because we require GNU make, we don't have to have two different rules for those, can use just one for both. The l variable in there is just to make it fit into 80 columns. 2025-03-28 Jakub Jelinek <jakub@redhat.com> * Make-lang.in (cobol/charmaps.cc, cobol/valconv.cc): Used sed -e instead of cp and multiple sed -i commands. Always prefix libgcobol header names in #include directives with ../../libgcobol/ rather than something depending on $(LIB_SOURCE).
2025-03-28cobol: Confine all __int128/_Float128 references to libgcobol.Bob Dubner7-41/+12
These changes are part of the effort to make possible cross compilation for hosts that don't support __int128 or _Float128. gcc/cobol * Make-lang.in: Eliminate libgcobol.h from gcc/cobol files. * genapi.cc: Eliminate "#include libgcobol.h". (parser_display_internal): Change comment. * genmath.cc: Eliminate "#include libgcobol.h". * genutil.cc: Likewise. (get_power_of_ten): Change comment. * structs.cc: Eliminate cblc_int128_type_node. * structs.h: Likewise. * symbols.h: Receive comment from libgcobol.h libgcobol * charmaps.cc:Eliminate "#include libgcobol.h". Change comment about _Float128. * common-defs.h: Change comment about _Float128. Receive #defines from libgcobol.h. * constants.cc: Eliminate #include libgcobol.h. Eliminate other unneeded #includes. * ec.h: Receive declarations from libgcobol.h. * gcobolio.h: Likewise. * gfileio.cc: (__gg__file_init): Use file_flag_none_e instead of zero in assignment. (__gg__file_reopen): Likewise. (__io__file_open): Likewise. * gfileio.h: Receive declarations from libgcobol.h. * libgcobol.h: Numerous declarations moved elsewhere.
2025-03-28srcextra fixesJakub Jelinek1-2/+3
Here is a patch which uses sed to fix up the copies of the generated files by flex/bison in the source directories (i.e. what we ship in release tarballs). In that case the generated files are in the same directory as the files they are generated from, so there should be no absolute or relative directories, just the filenames. Furthermore, c.srcextra was duplicating the work of gcc.srcextra, there is nothing C FE specific on gengtype-lex.l. 2025-03-28 Jakub Jelinek <jakub@redhat.com> gcc/ * Makefile.in (gcc.srcextra): Use sed to turn .../gcc/gengtype-lex.l in #line directives into just gengtype-lex.l. gcc/c/ * Make-lang.in (c.srcextra): Don't depend on anything and don't copy anything. gcc/cobol/ * Make-lang.in (cobol.srcextra): Use sed to turn .../gcc/cobol/*.{y,l,h,cc} and cobol/*.{y,l,h,cc} in #line directives into just *.{y,l,h,cc}.
2025-03-28bootstrap/119513 - fix cobol bootstrap with --enable-generated-files-in-srcdirRichard Biener1-1/+1
This adds gcc/cobol/parse.o to compare_exclusions and makes sure to ignore errors when copying generated files, like it's done when copying gengtype-lex.cc. PR bootstrap/119513 * configure.ac (compare_exclusions): Add gcc/cobol/parse\$(objext). * configure: Regenerated. gcc/cobol/ * Make-lang.in (cobol.srcextra): Use cp instead of ln, ignore errors.
2025-03-28cobol: Eliminate check-cobol -Os failure in EVALUATE testcaseBob Dubner1-1/+2
The coding error was the lack of a necessary cast from unsigned char to int. gcc/cobol * genapi.cc: (create_and_call): cast unsigned char to int gcc/testsuite * cobol.dg/group2/Complex_EVALUATE__1_.cob: New EVALUTE testcase. * cobol.dg/group2/Complex_EVALUATE__2_.cob: Likewise. * cobol.dg/group2/EVALUATE_WHEN_NEGATIVE.cob: Likewise. * cobol.dg/group2/EVALUATE_condition__2_.cob: Likewise. * cobol.dg/group2/EVALUATE_doubled_WHEN.cob: Likewise. * cobol.dg/group2/EVALUATE_with_WHEN_using_condition-1.cob: Likewise. * cobol.dg/group2/Complex_EVALUATE__1_.out: Known-good data for testcase. * cobol.dg/group2/Complex_EVALUATE__2_.out: Likewise. * cobol.dg/group2/EVALUATE_WHEN_NEGATIVE.out: Likewise. * cobol.dg/group2/EVALUATE_condition__2_.out: Likewise. * cobol.dg/group2/EVALUATE_doubled_WHEN.out: Likewise. * cobol.dg/group2/EVALUATE_with_WHEN_using_condition-1.out: Likewise.
2025-03-28[COBOL] use native_encode_realRichard Biener1-7/+6
The following avoids the round-trip through a newly built tree and instead directly uses the now exported native_encode_real. gcc/cobol/ * genapi.cc (initial_from_float128): Use native_encode_real.
2025-03-28cobol: Do not include <cmath> (no longer needed)Iain Sandoe1-1/+0
Several of enumerators in parse.y conflict with ones declared in at least some versions of <cmath> .. e.g. "OVERFLOW". The header is no longer needed since the FE is not trying to do host arithmetic. gcc/cobol/ChangeLog: * cobol-system.h: Remove <cmath>. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-03-27Daily bump.GCC Administrator1-0/+28
2025-03-26cobol: Replace quadratic loop removing std::set elementsJonathan Wakely1-18/+14
There's no need to keep using std::find_if from the beginning of the container after every removal, just update the iterator after erasing an element. This is how C++20 std::erase_if is implemented. gcc/cobol/ChangeLog: * except.cc (cbl_enabled_exceptions_t::turn_on_off): Replace quadratic loop with a single pass.
2025-03-26cobol: Bring trunk in line with Dubner's test system.Bob Dubner2-4/+24
gcc/cobol * genapi.cc: (parser_display_internal): Adjust for E vs e exponent notation. * parse.y: (literal_refmod_valid): Display correct value in error message.
2025-03-26cobol: Get rid of __int128 uses in the COBOL FE [PR119242]Jakub Jelinek3-104/+20
The following patch changes some remaining __int128 uses in the FE into FIXED_WIDE_INT(128), i.e. emulated 128-bit integral type. The use of wide_int_to_tree directly from that rather than going through build_int_cst_type means we don't throw away the upper 64 bits of the values, so the emitting of constants needing full 128 bits can be greatly simplied. Plus all the #pragma GCC diagnostic ignored "-Wpedantic" spots aren't needed, we don't use the _Float128/__int128 types directly in the FE anymore. Note, PR119241/PR119242 bugs are still not fully fixed, I think the remaining problem is that several FE sources include ../../libgcobol/libgcobol.h and that header declares various APIs with __int128 and _Float128 types, so trying to build a cross-compiler on a host without __int128 and _Float128 will still fail miserably. I believe none of those APIs are actually used by the FE, so the question is what the FE needs from libgcobol.h and whether the rest could be wrapped with #ifndef IN_GCC or #ifndef IN_GCC_FRONTEND or something similar (those 2 macros are predefined when compiling the FE files). 2025-03-26 Jakub Jelinek <jakub@redhat.com> PR cobol/119242 * genutil.h (get_power_of_ten): Remove #pragma GCC diagnostic around declaration. * genapi.cc (psa_FldLiteralN): Change type of value from __int128 to FIXED_WIDE_INT(128). Remove #pragma GCC diagnostic around the declaration. Use wi::min_precision to determine minimum unsigned precision of the value. Use wi::neg_p instead of value < 0 tests and wi::set_bit_in_zero<FIXED_WIDE_INT(128)> to build sign bit. Handle field->data.capacity == 16 like 1, 2, 4 and 8, use wide_int_to_tree instead of build_int_cst. (mh_source_is_literalN): Remove #pragma GCC diagnostic around the definition. (binary_initial_from_float128): Likewise. * genutil.cc (get_power_of_ten): Remove #pragma GCC diagnostic before the definition.
2025-03-26Daily bump.GCC Administrator1-0/+83
2025-03-25cobol: Changes to eliminate _Float128 from the front end [PR119241]Bob Dubner10-303/+353
These changes switch _Float128 types to REAL_VALUE_TYPE in the front end. Some __int128 variables and function return values are changed to FIXED_WIDE_INT(128) gcc/cobol PR cobol/119241 * cdf.y: (cdfval_base_t::operator()): Return const. * cdfval.h: (struct cdfval_base_t): Add const cdfval_base_t& operator(). (struct cdfval_t): Add cdfval_t constructor. Change cdf_value definitions. * gcobolspec.cc (lang_specific_driver): Formatting fix. * genapi.cc: Include fold-const.h and realmpfr.h. (initialize_variable_internal): Use real_to_decimal instead of strfromf128. (get_binary_value_from_float): Use wide_int_to_tree instead of build_int_cst_type. (psa_FldLiteralN): Use fold_convert instead of strfromf128, real_from_string and build_real. (parser_display_internal): Rewritten to work on REAL_VALUE_TYPE rather than _Float128. (mh_source_is_literalN): Use FIXED_WIDE_INT(128) rather than __int128, wide_int_to_tree rather than build_int_cst_type, fold_convert rather than build_string_literal. (real_powi10): New function. (binary_initial_from_float128): Change type of last argument from _Float128 to REAL_VALUE_TYPE, process it using real.cc and mpfr APIs. (digits_from_float128): Likewise. (initial_from_float128): Make static. Remove value argument, add local REAL_VALUE_TYPE value variable instead, process it using real.cc and native_encode_expr APIs. (parser_symbol_add): Adjust initial_from_float128 caller. * genapi.h (initial_from_float128): Remove declaration. * genutil.cc (get_power_of_ten): Change return type from __int128 to FIXED_WIDE_INT(128), ditto for retval type, change type of pos from __int128 to unsigned long long. (scale_by_power_of_ten_N): Use wide_int_to_tree instead of build_int_cst_type. Use FIXED_WIDE_INT(128) instead of __int128 as power_of_ten variable type. (copy_little_endian_into_place): Likewise. * genutil.h (get_power_of_ten): Change return type from __int128 to FIXED_WIDE_INT(128). * parse.y (%union): Change type of float128 from _Float128 to REAL_VALUE_TYPE. (string_of): Change argument type from _Float128 to const REAL_VALUE_TYPE &, use real_to_decimal rather than strfromf128. Add another overload with tree argument type. (field: cdf): Use real_zerop rather than comparison against 0.0. (occurs_clause, const_value): Use real_to_integer. (value78): Use build_real and real_to_integer. (data_descr1): Use real_to_integer. (count): Use real_to_integer, real_from_integer and real_identical instead of direct comparison. (value_clause): Use real_from_string3 instead of num_str2i. Use real_identical instead of direct comparison. Use build_real. (allocate): Use real_isneg and real_iszero instead of <= 0 comparison. (move_tgt): Use real_to_integer, real_value_truncate, real_from_integer and real_identical instead of comparison of casts. (cce_expr): Use real_arithmetic and real_convert or real_value_negate instead of direct arithmetics on _Float128. (cce_factor): Use real_from_string3 instead of numstr2i. (literal_refmod_valid): Use real_to_integer. * symbols.cc (symbol_table_t::registers_t::registers_t): Formatting fix. (ERROR_FIELD): Likewise. (extend_66_capacity): Likewise. (cbl_occurs_t::subscript_ok): Use real_to_integer, real_from_integer and real_identical. * symbols.h (cbl_field_data_t::etc_t::value): Change type from _Float128 to tree. (cbl_field_data_t::etc_t::etc_t): Adjust defaulted argument value. (cbl_field_data_t::cbl_field_data_t): Formatting fix. Use etc() rather than etc(0). (cbl_field_data_t::value_of): Change return type from _Float128 to tree. (cbl_field_data_t::operator=): Change return and argument type from _Float128 to tree. (cbl_field_data_t::valify): Use real_from_string, real_value_truncate and build_real. (cbl_field_t::same_as): Use build_zero_cst instead of _Float128(0.0). gcc/testsuite * cobol.dg/literal1.cob: New testcase. * cobol.dg/output1.cob: Likewise Co-authored-by: Richard Biener <rguenth@suse.de> Co-authored-by: Jakub Jelinek <jakub@redhat.com> Co-authored-by: James K. Lowden <jklowden@cobolworx.com> Co-authored-by: Robert Dubner <rdubher@symas.com>
2025-03-25Daily bump.GCC Administrator1-0/+10
2025-03-24cobol: Move includes before system.hIain Sandoe1-2/+2
This just moves an include ahead of cobol-system.h which in turn includes system.h. gcc/cobol/ChangeLog: * cdf-copy.cc: Move host include before system.h Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-03-24Remove buffer overflow in cobol driverAndreas Schwab1-8/+4
PR cobol/119390 * gcobolspec.cc (lang_specific_driver): Use pointer instead of copying into fixed array.
2025-03-22Daily bump.GCC Administrator1-0/+47
2025-03-21cobol, libgcobol: Currently libgcobol depends on libstdc++.Iain Sandoe1-1/+1
We need to add libstdc++ to link lines even when the link is not '-static' since libgcobol depends on libstdc++. gcc/cobol/ChangeLog: * gcobolspec.cc (lang_specific_driver): Add libstdc++ for any link line. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-03-21cobol, driver: Handle targets without HAVE_LD_STATIC_DYNAMIC.Iain Sandoe1-4/+6
This fixes a typo where libraries were not added for targets without HAVE_LD_STATIC_DYNAMIC. It also adds the libraries in this case; typically, a target without HAVE_LD_STATIC_DYNAMIC can take the -static-libgcobol and use that to drive a spec substitution viz: %{static-libgcobol:%:replace-outfile(-lgcobol libgcobol.a%s)} which needs both the library and -static-libgcobol to be present in the driver output. gcc/cobol/ChangeLog: * gcobolspec.cc (add_arg_lib): Fix typo. (lang_specific_driver): Arrange to append both -lgcobol and -static-libgcobol for targets without HAVE_LD_STATIC_DYNAMIC. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-03-21cobol: Rename COB_{BLOCK,UNSIGNED,SIGNED} to {BLOCK,UNSIGNED,SIGNED}_kw for ↵Jakub Jelinek3-18/+18
consistency On Wed, Mar 19, 2025 at 06:03:24PM -0400, James K. Lowden wrote: > Elsewhere in the parser where there was a conflict like that, I renamed > the token. For example, the COBOL word TRUE uses a token named > TRUE_kw. I don't mind either way; your solution has less impact on the > parser. I think consistency is good and when it is a suffix rather than prefix, it also sorts alphabetically together with the actual keywords. 2025-03-21 Jakub Jelinek <jakub@redhat.com> * parse.y: Rename COB_BLOCK to BLOCK_kw, COB_SIGNED to SIGNED_kw and COB_UNSIGNED to UNSIGNED_kw. * scan.l: Likewise. * token_names.h: Regenerate.
2025-03-21move global data to symbol_table_initRichard Biener1-89/+84
The following avoids early runtime initialization of cbl_field_t objects which, when using tree to represent the current _Float128 data, segfaults as tree data like float128_type_node is not yet initialized. The solution is to move the global data to symbol_table_init which is the only user and it already has one such instance locally, the 'constants' array. * symbols.cc (empty_float, empty_comp5, empty_literal, empty_conditional, debug_registers, special_registers): Move global cbl_field_t typed data to ... (symbol_table_init): ... local scope here.
2025-03-21make sources coretypes.h and tree.h cleanRichard Biener15-31/+40
The following removes HOWEVER_GCC_DEFINES_TREE and the alternate definition of tree from symbols.h and instead ensures that both coretypes.h and tree.h are included where required. This required putting GCCs own 'NONE' in a scoped enum (see separate patch) and renaming the cobol use of UNSIGNED, SIGNED and BLOCK which conflict with enums from tree.h. There's a few things in conflict with options.h defines, notably cobol_dialect and cobol_exceptions but also yy_flex_debug (wherever that comes from). I've chosen to simply #undef those where appropriate. I've refrained from putting the coretypes.h and tree.h includes in cobol-system.h since not all files require this. This helps in making use of real.h instead of using _Float128. PR cobol/119241 gcc/cobol/ * symbols.h: Do not typedef tree. * cdf.y: Include coretypes.h and tree.h. * symbols.cc: Likewise. * symfind.cc: Likewise. * util.cc: Likewise. * parse.y: Include coretypes.h and tree.h where appropriate. Rename BLOCK to COB_BLOCK, SIGNED to COB_SIGNED, UNSIGNED to COB_UNSIGNED. * scan.l: Likewise. * token_names.h: Likewise. * cobol1.cc: Do not define HOWEVER_GCC_DEFINES_TREE. * except.cc: Likewise. * genapi.cc: Likewise. * gengen.cc: Likewise. * genmath.cc: Likewise. * genutil.cc: Likewise. * structs.cc: Likewise.
2025-03-21Daily bump.GCC Administrator1-0/+4
2025-03-20cobol: Do not overload int64_t, overload long and long long.Iain Sandoe1-1/+1
Since the type that is ued for int64_t varies between platforms trying to overload it creates ambiguous or conflicting overloads. gcc/cobol/ChangeLog: * cdfval.h (struct cdfval_t): Overload long instead of int64_t. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-03-19Daily bump.GCC Administrator1-0/+55
2025-03-18cobol: Remove dead code from the driver.Iain Sandoe1-37/+1
EXEC_LIB is no longer defined anywhere, so that the dependent code is now dead. The rpath code (if required) would need to be conditional since rpath support is not available on all hosts. Remove now and then address if/when it is needed (other drivers do not do this). gcc/cobol/ChangeLog: * gcobolspec.cc (append_rpath): Remove. (lang_specific_driver): Remove hard-wired rpath and library names. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-03-18gcc, cobol: Check for get_current_dir_name [PR119301]Iain Sandoe1-0/+19
This adds a configure check for get_current_dir_name and falls back to getcwd() if it is not available on the host. PR cobol/119301 gcc/cobol/ChangeLog: * util.cc: Check for the availability of get_current_dir_name snf fall back to getcwd() if it is not present on the host. gcc/ChangeLog: * config.in: Regenerate. * configure: Regenerate. * configure.ac: Add check for get_current_dir_name. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-03-18Populate -original dump for CobolRichard Biener1-0/+3
The following implements -fdump-tree-original dumping for cobol, mimicing what the D frontend does. gcc/cobol/ * gengen.cc (gg_finalize_function): Dump to TDI_original.
2025-03-18cobol: Bring the code base into compliance with C++14Bob Dubner14-484/+724
gcc/cobol * cdf.y: Make compatible with C++14. * copybook.h: Likewise. * dts.h: Likewise. * except.cc: Likewise. * genapi.cc: Likewise. * genutil.cc: Likewise. * genutil.h: Likewise. * lexio.cc: Likewise. * parse.y: Likewise. * parse_ante.h: Likewise. * show_parse.h: Likewise. * symbols.cc: Likewise. * symbols.h: Likewise. * util.cc: Likewise.
2025-03-18Build and install gcobol driver for the cross buildMatthias Klose1-4/+22
gcc/cobol/ 2025-03-18 Matthias Klose <doko@ubuntu.com> * Make-lang.in (GCOBC_TARGET_INSTALL_NAME, gcobol-cross): New. (cobol.all.cross): Depend on gcobol-cross. (cobol.install-common): Adjust install for the cross build. (cobol.uninstall): Use *_INSTALL_NAME for uninstall.