aboutsummaryrefslogtreecommitdiff
path: root/gcc/cobol
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cobol')
-rw-r--r--gcc/cobol/ChangeLog79
-rw-r--r--gcc/cobol/Make-lang.in20
-rw-r--r--gcc/cobol/cobol1.cc23
-rw-r--r--gcc/cobol/gcobolspec.cc131
-rw-r--r--gcc/cobol/genapi.cc42
-rw-r--r--gcc/cobol/gengen.cc5
-rw-r--r--gcc/cobol/parse.y6
-rw-r--r--gcc/cobol/symbols.cc8
8 files changed, 147 insertions, 167 deletions
diff --git a/gcc/cobol/ChangeLog b/gcc/cobol/ChangeLog
index 0b85ff2..a792b3a 100644
--- a/gcc/cobol/ChangeLog
+++ b/gcc/cobol/ChangeLog
@@ -1,3 +1,82 @@
+2025-04-09 Bob Dubner <rdubner@symas.com>
+
+ PR cobol/119682
+ * genapi.cc: (cobol_compare): Change the call to __gg__compare().
+
+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-07 Iain Sandoe <iain@sandoe.co.uk>
+
+ * symbols.cc : Remove trailing // on standard_internal.
+ (cbl_field_t::internalize): Print a warning if we fail to
+ initialise iconv.
+
+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-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-06 Iain Sandoe <iain@sandoe.co.uk>
+
+ PR cobol/119414
+ * gcobolspec.cc (append_rdynamic,
+ append_allow_multiple_definition, append_fpic): Remove.
+ (lang_specific_driver): Remove platform-specific command
+ line option handling.
+
+2025-04-05 Iain Sandoe <iain@sandoe.co.uk>
+
+ * 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.
+
+2025-04-04 Bob Dubner <rdubner@symas.com>
+
+ * cobol1.cc: Eliminate cobol_langhook_post_options.
+ * symbols.cc: Definition of RETURN-CODE special register sets
+ ::attr member to signable_e.
+
+2025-04-04 Bob Dubner <rdubner@symas.com>
+
+ * 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.
+
2025-04-03 Jakub Jelinek <jakub@redhat.com>
PR cobol/119242
diff --git a/gcc/cobol/Make-lang.in b/gcc/cobol/Make-lang.in
index 990d51a..422ebe2 100644
--- a/gcc/cobol/Make-lang.in
+++ b/gcc/cobol/Make-lang.in
@@ -40,6 +40,8 @@ GCOBOL_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gcobol|sed '$(
GCOBC_INSTALL_NAME := $(shell echo gcobc|sed '$(program_transform_name)')
GCOBC_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gcobc|sed '$(program_transform_name)')
+GCOBOL_HTML_FILES = $(addprefix $(build_htmldir)/gcobol/,gcobol.html gcobol-io.html)
+
cobol: cobol1$(exeext)
cobol.serial = cobol1$(exeext)
.PHONY: cobol
@@ -88,9 +90,7 @@ cobol1_OBJS = \
# so that the .h files can be found.
cobol/charmaps.cc cobol/valconv.cc: cobol/%.cc: $(LIB_SOURCE)/%.cc
- -l='ec\|common-defs\|io\|gcobolio\|gfileio\|charmaps'; \
- l=$$l'\|valconv\|exceptl'; \
- sed -e '/^#include/s,"\('$$l'\)\.h","../../libgcobol/\1.h",' $^ > $@
+ sed -e '/^#include/s,"\([^"]*[^g"].h\)","../../libgcobol/\1",' $^ > $@
LIB_SOURCE_H=$(wildcard $(LIB_SOURCE)/*.h)
@@ -303,8 +303,8 @@ cobol.install-pdf: installdirs gcobol.pdf gcobol-io.pdf
cobol.install-plugin:
-cobol.install-html: installdirs gcobol.html gcobol-io.html
- $(INSTALL_DATA) gcobol.html gcobol-io.html $(DESTDIR)$(htmldir)/
+cobol.install-html: installdirs $(GCOBOL_HTML_FILES)
+ $(INSTALL_DATA) $(GCOBOL_HTML_FILES) $(DESTDIR)$(htmldir)/
cobol.info:
cobol.srcinfo:
@@ -323,14 +323,16 @@ gcobol-io.pdf: $(srcdir)/cobol/gcobol.3
groff -mdoc -T pdf $^ > $@~
@mv $@~ $@
-cobol.html: gcobol.html gcobol-io.html
-cobol.srchtml: gcobol.html gcobol-io.html
+cobol.html: $(GCOBOL_HTML_FILES)
+cobol.srchtml: $(GCOBOL_HTML_FILES)
ln $^ $(srcdir)/cobol/
-gcobol.html: $(srcdir)/cobol/gcobol.1
+$(build_htmldir)/gcobol/gcobol.html: $(srcdir)/cobol/gcobol.1
+ $(mkinstalldirs) $(build_htmldir)/gcobol
mandoc -T html $^ > $@~
@mv $@~ $@
-gcobol-io.html: $(srcdir)/cobol/gcobol.3
+$(build_htmldir)/gcobol/gcobol-io.html: $(srcdir)/cobol/gcobol.3
+ $(mkinstalldirs) $(build_htmldir)/gcobol
mandoc -T html $^ > $@~
@mv $@~ $@
diff --git a/gcc/cobol/cobol1.cc b/gcc/cobol/cobol1.cc
index d175ab1..1e690ff 100644
--- a/gcc/cobol/cobol1.cc
+++ b/gcc/cobol/cobol1.cc
@@ -166,8 +166,8 @@ create_our_type_nodes_init()
long_double_ten_node = build_real_from_int_cst(
LONGDOUBLE,
build_int_cst_type(INT,10));
- sizeof_size_t = build_int_cst_type(SIZE_T, sizeof(size_t));
- sizeof_pointer = build_int_cst_type(SIZE_T, sizeof(void *));
+ sizeof_size_t = build_int_cst_type(SIZE_T, int_size_in_bytes(SIZE_T));
+ sizeof_pointer = build_int_cst_type(SIZE_T, int_size_in_bytes(VOID_P));
bool_true_node = build2(EQ_EXPR,
integer_type_node,
@@ -646,22 +646,6 @@ cobol_get_sarif_source_language(const char *)
return "cobol";
}
-bool
-cobol_langhook_post_options(const char**)
- {
- // This flag, when set to 0, results in calls to gg_exit working properly.
- // I don't know why it is necessary. There is something going on with the
- // definition of __gg__data_return_code in constants.cc, and with how it
- // is used through var_decl_return_code in genapi.cc. Without it, the value
- // delivered to exit@PLT is zero, and not __gg__data_return_code
- // Dubner, 2025-04-04.
- flag_strict_aliasing = 0;
-
- /* Returning false means that the backend should be used. */
- return false;
- }
-
-
#undef LANG_HOOKS_BUILTIN_FUNCTION
#undef LANG_HOOKS_GETDECLS
#undef LANG_HOOKS_GLOBAL_BINDINGS_P
@@ -676,7 +660,6 @@ cobol_langhook_post_options(const char**)
////#undef LANG_HOOKS_TYPE_FOR_SIZE
#undef LANG_HOOKS_SET_DECL_ASSEMBLER_NAME
#undef LANG_HOOKS_GET_SARIF_SOURCE_LANGUAGE
-#undef LANG_HOOKS_POST_OPTIONS
// We use GCC in the name, not GNU, as others do,
// because "GnuCOBOL" refers to a different GNU project.
@@ -702,8 +685,6 @@ cobol_langhook_post_options(const char**)
#define LANG_HOOKS_GET_SARIF_SOURCE_LANGUAGE cobol_get_sarif_source_language
-#define LANG_HOOKS_POST_OPTIONS cobol_langhook_post_options
-
struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
#include "gt-cobol-cobol1.h"
diff --git a/gcc/cobol/gcobolspec.cc b/gcc/cobol/gcobolspec.cc
index 63f48aa..4df9f8d 100644
--- a/gcc/cobol/gcobolspec.cc
+++ b/gcc/cobol/gcobolspec.cc
@@ -57,10 +57,6 @@ along with GCC; see the file COPYING3. If not see
int lang_specific_extra_outfiles = 0;
-#ifndef MATH_LIBRARY
-#define MATH_LIBRARY "m"
-#endif
-
#ifndef DL_LIBRARY
#define DL_LIBRARY "dl"
#endif
@@ -73,12 +69,16 @@ int lang_specific_extra_outfiles = 0;
#define COBOL_LIBRARY "gcobol"
#endif
+#define SPEC_FILE "libgcobol.spec"
+
/* The original argument list and related info is copied here. */
static const struct cl_decoded_option *original_options;
/* The new argument list will be built here. */
static std::vector<cl_decoded_option>new_opt;
+static bool need_libgcobol = true;
+
// #define NOISY 1
static void
@@ -126,41 +126,6 @@ add_arg_lib(const char *library, bool force_static ATTRIBUTE_UNUSED)
#endif
}
-static void
-append_rdynamic()
- {
- // This is a bit ham-handed, but I was in a hurry.
- struct cl_decoded_option decoded = {};
- decoded.opt_index = OPT_rdynamic;
- decoded.orig_option_with_args_text = "-rdynamic";
- decoded.canonical_option[0] = "-rdynamic";
- decoded.canonical_option_num_elements = 1;
- decoded.value = 1;
- append_arg(decoded);
- return;
- }
-
-static void
-append_allow_multiple_definition()
- {
- append_option (OPT_Wl_, "--allow-multiple-definition", 1);
- return;
- }
-
-static void
-append_fpic()
- {
- // This is a bit ham-handed, but I was in a hurry.
- struct cl_decoded_option decoded = {};
- decoded.opt_index = OPT_rdynamic;
- decoded.orig_option_with_args_text = "-fPIC";
- decoded.canonical_option[0] = "-fPIC";
- decoded.canonical_option_num_elements = 1;
- decoded.value = 1;
- append_arg(decoded);
- return;
- }
-
void
lang_specific_driver (struct cl_decoded_option **in_decoded_options,
unsigned int *in_decoded_options_count,
@@ -188,20 +153,13 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
bool saw_OPT_c = false;
bool saw_OPT_shared = false;
- bool saw_OPT_pic = false;
- bool saw_OPT_PIC = false;
bool verbose = false;
// These flags indicate whether we need various libraries
- bool need_libgcobol = true;
- bool need_libmath = (MATH_LIBRARY[0] != '\0');
bool need_libdl = (DL_LIBRARY[0] != '\0');
bool need_libstdc = (STDCPP_LIBRARY[0] != '\0');
- // bool need_libquadmath = (QUADMATH_LIBRARY[0] != '\0');
- bool need_rdynamic = true;
- bool need_allow_multiple_definition = true;
// Separate flags for a couple of static libraries
bool static_libgcobol = false;
@@ -292,37 +250,10 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
saw_OPT_shared = true;
break;
- case OPT_fpic:
- saw_OPT_pic = true;
- break;
-
- case OPT_fPIC:
- saw_OPT_PIC = true;
- break;
-
- case OPT_c:
- // With this option, no libraries need be loaded
+ case OPT_c:
+ // Note -c specially.
saw_OPT_c = true;
- need_libgcobol = false;
- need_libmath = false;
- need_libdl = false;
- need_libstdc = false;
- // need_libquadmath = false;
- need_rdynamic = false;
- break;
-
- case OPT_rdynamic:
- need_rdynamic = false;
- break;
-
- case OPT_Wl_:
- if( strstr(decoded_options[i].orig_option_with_args_text,
- "--allow-multiple-definitions") )
- {
- need_allow_multiple_definition = false;
- }
- break;
-
+ // FALLTHROUGH
case OPT_nostdlib:
case OPT_nodefaultlibs:
case OPT_r:
@@ -331,11 +262,8 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
case OPT_E:
// With these options, no libraries need be loaded
need_libgcobol = false;
- need_libmath = false;
need_libdl = false;
need_libstdc = false;
- // need_libquadmath = false;
- need_rdynamic = false;
break;
case OPT_static_libgcobol:
@@ -345,11 +273,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
case OPT_l:
n_infiles += 1;
- if(strcmp(decoded_options[i].arg, MATH_LIBRARY) == 0)
- {
- need_libmath = false;
- }
- else if(strcmp(decoded_options[i].arg, DL_LIBRARY) == 0)
+ if(strcmp(decoded_options[i].arg, DL_LIBRARY) == 0)
{
need_libdl = false;
}
@@ -455,10 +379,8 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
if( n_infiles == 0 )
{
need_libgcobol = false;
- need_libmath = false;
need_libdl = false;
need_libstdc = false;
- // need_libquadmath = false;
}
/* Second pass through arglist, transforming arguments as appropriate. */
@@ -588,11 +510,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
{
add_arg_lib(COBOL_LIBRARY, static_libgcobol);
}
- if( need_libmath)
- {
- add_arg_lib(MATH_LIBRARY, static_in_general);
- }
- if( need_libdl )
+ if( need_libdl )
{
add_arg_lib(DL_LIBRARY, static_in_general);
}
@@ -601,21 +519,6 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
add_arg_lib(STDCPP_LIBRARY, static_in_general);
}
- if( saw_OPT_shared && !saw_OPT_pic && !saw_OPT_PIC )
- {
- append_fpic();
- }
-
- if( need_rdynamic )
- {
- append_rdynamic();
- }
-
- if( need_allow_multiple_definition && (n_infiles || n_outfiles) )
- {
- append_allow_multiple_definition();
- }
-
if( prior_main )
{
char ach[] = "\"-main\" without a source file";
@@ -654,14 +557,12 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
*in_decoded_options = new_options;
}
-/*
- * Called before linking.
- * Returns 0 on success and -1 on failure.
- * Unused.
- */
+/* Called before linking. Returns 0 on success and -1 on failure. */
int
-lang_specific_pre_link( void )
- {
- return 0;
- }
+lang_specific_pre_link (void)
+{
+ if (need_libgcobol)
+ do_spec ("%:include(libgcobol.spec)");
+ return 0;
+}
diff --git a/gcc/cobol/genapi.cc b/gcc/cobol/genapi.cc
index fbe0bbc..fdf76aa 100644
--- a/gcc/cobol/genapi.cc
+++ b/gcc/cobol/genapi.cc
@@ -787,13 +787,13 @@ function_handle_from_name(cbl_refer_t &name,
{
gg_memcpy(gg_get_address_of(function_handle),
member(name.field->var_decl_node, "data"),
- build_int_cst_type(SIZE_T, sizeof(void *)));
+ sizeof_pointer);
}
else
{
gg_memcpy(gg_get_address_of(function_handle),
qualified_data_source(name),
- build_int_cst_type(SIZE_T, sizeof(void *)));
+ sizeof_pointer);
}
return function_handle;
}
@@ -2028,10 +2028,12 @@ cobol_compare( tree return_int,
{
// None of our explicit comparisons up above worked, so we revert to the
// general case:
- int leftflags = (left_side_ref.all ? REFER_T_MOVE_ALL : 0)
- + (left_side_ref.addr_of ? REFER_T_ADDRESS_OF : 0);
- int rightflags = (right_side_ref.all ? REFER_T_MOVE_ALL : 0)
- + (right_side_ref.addr_of ? REFER_T_ADDRESS_OF : 0);
+ int leftflags = (left_side_ref.all ? REFER_T_MOVE_ALL : 0)
+ + (left_side_ref.addr_of ? REFER_T_ADDRESS_OF : 0)
+ + (left_side_ref.refmod.from ? REFER_T_REFMOD : 0);
+ int rightflags = (right_side_ref.all ? REFER_T_MOVE_ALL : 0)
+ + (right_side_ref.addr_of ? REFER_T_ADDRESS_OF : 0)
+ + (right_side_ref.refmod.from ? REFER_T_REFMOD : 0);
gg_assign( return_int, gg_call_expr(
INT,
"__gg__compare",
@@ -2045,6 +2047,7 @@ cobol_compare( tree return_int,
build_int_cst_type(INT, rightflags),
integer_zero_node,
NULL_TREE));
+ compared = true;
}
// gg_printf(" result is %d\n", return_int, NULL_TREE);
@@ -8917,8 +8920,8 @@ parser_file_add(struct cbl_file_t *file)
gg_assign(array_of_keys,
gg_cast(build_pointer_type(cblc_field_p_type_node),
gg_malloc(build_int_cst_type(SIZE_T,
- (number_of_key_fields+1)
- *sizeof(void *)))));
+ (number_of_key_fields+1)
+ *int_size_in_bytes(VOID_P)))));
strcpy(achName, "_");
strcat(achName, file->name);
@@ -8929,8 +8932,8 @@ parser_file_add(struct cbl_file_t *file)
gg_assign(key_numbers,
gg_cast(build_pointer_type(INT),
gg_malloc(build_int_cst_type(SIZE_T,
- (number_of_key_fields+1)
- *sizeof(int)))));
+ (number_of_key_fields+1)
+ *int_size_in_bytes(INT)))));
strcpy(achName, "_");
strcat(achName, file->name);
@@ -8942,7 +8945,7 @@ parser_file_add(struct cbl_file_t *file)
gg_cast(build_pointer_type(INT),
gg_malloc(build_int_cst_type(SIZE_T,
(number_of_key_fields+1)
- *sizeof(int)))));
+ *int_size_in_bytes(INT)))));
size_t index = 0;
for( size_t i=0; i<file->nkey; i++ )
@@ -9686,7 +9689,9 @@ inspect_tally(bool backward,
gg_assign(int_size, build_int_cst_type(INT, n_integers));
gg_assign(integers,
gg_cast(SIZE_T_P,
- gg_realloc(integers, n_integers * sizeof(void *))));
+ gg_realloc(integers,
+ n_integers
+ * int_size_in_bytes(VOID_P))));
}
ELSE
{
@@ -9837,7 +9842,9 @@ inspect_replacing(int backward,
gg_assign(int_size, build_int_cst_type(INT, n_integers));
gg_assign(integers,
gg_cast(SIZE_T_P,
- gg_realloc(integers, n_integers * sizeof(void *))));
+ gg_realloc(integers,
+ n_integers
+ * int_size_in_bytes(VOID_P))));
}
ELSE
{
@@ -11074,7 +11081,9 @@ gg_array_of_field_pointers( size_t N,
cbl_field_t **fields )
{
tree retval = gg_define_variable(build_pointer_type(cblc_field_p_type_node));
- gg_assign(retval, gg_cast(build_pointer_type(cblc_field_p_type_node), gg_malloc( build_int_cst_type(SIZE_T, N * sizeof(void *)))));
+ gg_assign(retval, gg_cast(build_pointer_type(cblc_field_p_type_node),
+ gg_malloc(build_int_cst_type(SIZE_T,
+ N * int_size_in_bytes(VOID_P)))));
for(size_t i=0; i<N; i++)
{
gg_assign(gg_array_value(retval, i), gg_get_address_of(fields[i]->var_decl_node));
@@ -11566,7 +11575,8 @@ gg_array_of_file_pointers( size_t N,
{
tree retval = gg_define_variable(build_pointer_type(cblc_file_p_type_node));
gg_assign(retval, gg_cast( build_pointer_type(cblc_file_p_type_node),
- gg_malloc( build_int_cst_type(SIZE_T, N * sizeof(void *)))));
+ gg_malloc( build_int_cst_type(SIZE_T,
+ N * int_size_in_bytes(VOID_P)))));
for(size_t i=0; i<N; i++)
{
gg_assign(gg_array_value(retval, i), gg_get_address_of(files[i]->var_decl_node));
@@ -12853,7 +12863,7 @@ parser_set_pointers( size_t ntgt, cbl_refer_t *tgts, cbl_refer_t source )
COBOL_FUNCTION_RETURN_TYPE);
gg_memcpy(qualified_data_dest(tgts[i]),
gg_get_address_of(function_handle),
- build_int_cst_type(SIZE_T, sizeof(void *)));
+ sizeof_pointer);
}
else
{
diff --git a/gcc/cobol/gengen.cc b/gcc/cobol/gengen.cc
index e7a4e3c..f182f7f 100644
--- a/gcc/cobol/gengen.cc
+++ b/gcc/cobol/gengen.cc
@@ -3355,7 +3355,8 @@ tree
gg_array_of_size_t( size_t N, size_t *values)
{
tree retval = gg_define_variable(build_pointer_type(SIZE_T));
- gg_assign(retval, gg_cast(build_pointer_type(SIZE_T), gg_malloc( build_int_cst_type(SIZE_T, N * sizeof(size_t)))));
+ tree sz = build_int_cst_type(SIZE_T, N * int_size_in_bytes(SIZE_T));
+ gg_assign(retval, gg_cast(build_pointer_type(SIZE_T), gg_malloc(sz)));
for(size_t i=0; i<N; i++)
{
gg_assign(gg_array_value(retval, i), build_int_cst_type(SIZE_T, values[i]));
@@ -3367,7 +3368,7 @@ tree
gg_array_of_bytes( size_t N, unsigned char *values)
{
tree retval = gg_define_variable(UCHAR_P);
- gg_assign(retval, gg_cast(UCHAR_P, gg_malloc( build_int_cst_type(SIZE_T, N * sizeof(unsigned char)))));
+ gg_assign(retval, gg_cast(UCHAR_P, gg_malloc( build_int_cst_type(SIZE_T, N))));
for(size_t i=0; i<N; i++)
{
gg_assign(gg_array_value(retval, i), build_int_cst_type(UCHAR, values[i]));
diff --git a/gcc/cobol/parse.y b/gcc/cobol/parse.y
index 3f28201..61ffa7c 100644
--- a/gcc/cobol/parse.y
+++ b/gcc/cobol/parse.y
@@ -33,6 +33,7 @@
#include "coretypes.h"
#include "../../libgcobol/io.h"
#include "../../libgcobol/ec.h"
+ #include "tree.h"
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
@@ -3822,7 +3823,8 @@ data_clauses: data_clause
if( yydebug ) {
yywarn("expanding %s size from %u bytes to %zu "
"because it redefines %s with USAGE POINTER",
- field->name, field->size(), sizeof(void*),
+ field->name, field->size(),
+ (size_t)int_size_in_bytes(ptr_type_node),
redefined->name);
}
field->embiggen();
@@ -4282,7 +4284,7 @@ usage_clause1: usage COMPUTATIONAL[comp] native
if( gcobol_feature_embiggen() && redefined &&
is_numeric(redefined->type) && redefined->size() == 4) {
// For now, we allow POINTER to expand a 32-bit item to 64 bits.
- field->data.capacity = sizeof(void *);
+ field->data.capacity = int_size_in_bytes(ptr_type_node);
dbgmsg("%s: expanding #%zu %s capacity %u => %u", __func__,
field_index(redefined), redefined->name,
redefined->data.capacity, field->data.capacity);
diff --git a/gcc/cobol/symbols.cc b/gcc/cobol/symbols.cc
index 2373bfe..4067459 100644
--- a/gcc/cobol/symbols.cc
+++ b/gcc/cobol/symbols.cc
@@ -2350,7 +2350,7 @@ symbol_table_init(void) {
0, {}, {2,2,2,0, NULL}, NULL },
{ 0, FldNumericBin5, FldInvalid, 0, 0, 0, 0, nonarray, 0, "UPSI-0",
0, {}, {2,2,4,0, NULL}, NULL },
- { 0, FldNumericBin5, FldInvalid, 0, 0, 0, 0, nonarray, 0, "RETURN-CODE",
+ { 0, FldNumericBin5, FldInvalid, signable_e, 0, 0, 0, nonarray, 0, "RETURN-CODE",
0, {}, {2,2,4,0, NULL}, NULL },
{ 0, FldNumericBin5, FldInvalid, 0, 0, 0, 0, nonarray, 0, "LINAGE-COUNTER",
0, {}, {2,2,4,0, NULL}, NULL },
@@ -3567,7 +3567,7 @@ cbl_field_t::is_ascii() const {
* compilation, if it moves off the default, it adjusts only once, and
* never reverts.
*/
-static const char standard_internal[] = "CP1252//";
+static const char standard_internal[] = "CP1252";
extern os_locale_t os_locale;
static const char *
@@ -3595,6 +3595,10 @@ cbl_field_t::internalize() {
static iconv_t cd = iconv_open(tocode, fromcode);
static const size_t noconv = size_t(-1);
+ if (cd == (iconv_t)-1) {
+ yywarn("failed iconv_open tocode = '%s' fromcode = %s", tocode, fromcode);
+ }
+
// Sat Mar 16 11:45:08 2024: require temporary environment for testing
if( getenv( "INTERNALIZE_NO") ) return data.initial;