diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 6377bbcf9777655a4b67900b34d98dba98c0459f..81922b0884cea602c5fc385ff5f2ba932ded11da 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -2167,7 +2167,6 @@ quickstrap: all cd $(toplevel_builddir) && $(MAKE) all-target-libgcc all.internal: start.encap rest.encap doc selftest - @echo "I AM THE ALL! CPPFLAGS ${CPPFLAGS}" # This is what to compile if making a cross-compiler. all.cross: native gcc-cross$(exeext) cpp$(exeext) specs \ libgcc-support lang.all.cross doc selftest @GENINSRC@ srcextra diff --git a/gcc/cobol/genapi.cc b/gcc/cobol/genapi.cc index 9f45af7c47896b8ea1fdaf0cc3675f082866b1fc..8d381df6ac8ef92677da606c01914cf892b5ec76 100644 --- a/gcc/cobol/genapi.cc +++ b/gcc/cobol/genapi.cc @@ -2194,6 +2194,25 @@ move_tree_to_field(cbl_field_t *field, tree psz) move_tree(wrapper, psz); } +static char * +get_literal_string(cbl_field_t *field) + { + assert(field->type == FldLiteralA); + char *buffer = NULL; + size_t buffer_length = 0; + if( buffer_length < field->data.capacity+1 ) + { + buffer_length = field->data.capacity+1; + buffer = (char *)xrealloc(buffer, buffer_length); + } + for(size_t i=0; i<field->data.capacity; i++) + { + buffer[i] = ascii_to_internal(field->data.initial[i]); + } + buffer[field->data.capacity] = '\0'; + return buffer; + } + static tree get_string_from(cbl_field_t *field) { @@ -2207,11 +2226,20 @@ get_string_from(cbl_field_t *field) { switch( field->type ) { + case FldLiteralA: + { + gg_assign(psz, gg_malloc( build_int_cst_type(SIZE_T, field->data.capacity+1))); + char *litstring = get_literal_string(field); + gg_memcpy(psz, + gg_string_literal(litstring), + build_int_cst_type(SIZE_T, field->data.capacity+1)); + break; + } + case FldGroup: case FldAlphanumeric: - case FldLiteralA: // make a copy of .data: - gg_assign(psz, gg_malloc( build_int_cst_type(SIZE_T, field->data.capacity + 1))); + gg_assign(psz, gg_malloc( build_int_cst_type(SIZE_T, field->data.capacity+1))); gg_memcpy( psz, member(field, "data"), member(field, "capacity")); @@ -3954,23 +3982,6 @@ parser_accept_command_line_count( cbl_refer_t tgt ) gg_get_address_of(tgt.refer_decl_node)); } -static char * -get_literal_string(cbl_field_t *field) - { - char *buffer = NULL; - size_t buffer_length = 0; - if( buffer_length < field->data.capacity ) - { - buffer_length = field->data.capacity; - buffer = (char *)xrealloc(buffer, buffer_length); - } - for(size_t i=0; i<field->data.capacity; i++) - { - buffer[i] = ascii_to_internal(field->data.initial[i]); - } - return buffer; - } - void parser_accept_envar( struct cbl_refer_t refer, struct cbl_refer_t envar ) { diff --git a/gcc/cobol/genutil.cc b/gcc/cobol/genutil.cc index 803e0c2e97c5aedbab233d48ee4792ba085158d9..2ece9e90f46a595bd36c169c160d4f99e01c4aa2 100644 --- a/gcc/cobol/genutil.cc +++ b/gcc/cobol/genutil.cc @@ -2460,6 +2460,21 @@ refer_fill_internal(cbl_refer_t &refer, refer_type_t refer_type) // Establish the baseline: if( refer.field->type == FldLiteralA ) { + // We need to establish a pseudo-field that is FldAlphanumeric + static tree pseudo_alpha = NULL; + if( !pseudo_alpha ) + { + pseudo_alpha = gg_define_variable( cblc_field_type_node, + "_pseudo_alpha", + vs_static); + gg_assign(member(pseudo_alpha, "type"), + build_int_cst_type(CHAR, FldAlphanumeric)); + } + gg_assign(member(pseudo_alpha, "type"), + build_int_cst_type(CHAR, FldAlphanumeric)); + gg_assign(member(refer.refer_decl_node, "field"), + gg_cast(cblc_field_p_type_node, + gg_get_address_of(pseudo_alpha))); gg_assign(member(refer.refer_decl_node, "qual_data"), gg_cast(UCHAR_P, member(refer.field->var_decl_node, "initial"))); gg_assign(member(refer.refer_decl_node, "qual_size"),