https://gcc.gnu.org/g:78b9e69e11069564e2e8941477092c5810e33f5d
commit r17-6558-g78b9e69e11069564e2e8941477092c5810e33f5d Author: Robert Dubner <[email protected]> Date: Sat Nov 21 09:51:06 2026 -0500 cobol: Repairs to edge-case bugs. ISO doesn't allow a refmodded string as a target; IBM, MF, and GnuCOBOL do. -Wrefmod was added to handle that. The lexer and parser wasn't handling missing closing parentheses, or missing closing double quotes, or missing closing single quotes. These changes repair that. ADD CORRESPONDING and SUBTRACT CORRESPONDING now reject senders and receivers that are not groups. gcc/cobol/ChangeLog: * cbldiag.h (enum cbl_diag_id_t): -Wrefmod. * cobol1.cc (cobol_langhook_handle_option): Likewise. * gcobol.1: Likewise. * lang-specs.h: Likewise. * lang.opt: Likewise. * lexio.cc (cobol_filename): Handle missing closing characters. (mapped_file): Likewise. (lexer_input_close): Likewise. (lexer_input): Likewise. * lexio.h (lexer_input_close): Likewise. * messages.cc: -Wrefmod. * parse.y: Fix ADD/SUBTRACT CORRESPONDING; handle IF <object class> properly. * parse_ante.h (struct arith_t): handle IF <object class>. (struct ast_op_t): Likewise. (class eval_subject_t): Likewise. (valid_sign_condition): Likewise. (valid_class_condition): Likewise. * scan.l: Handle missing closing characters. * scan_ante.h (skip_string): Handle missing closing characters. (is_refmod): -Wrefmod. * symbols.h (struct cbl_refer_t): handle IF <object class>. * util.cc (parse_file): Handle missing closing characters. gcc/testsuite/ChangeLog: * cobol.dg/group2/COMPUTE_multiplication_to_FIX4.cob: Use NUMVAL to convert a numeric-edited value to a numeric value. Diff: --- gcc/cobol/cbldiag.h | 1 + gcc/cobol/cobol1.cc | 4 + gcc/cobol/gcobol.1 | 3 + gcc/cobol/lang-specs.h | 1 + gcc/cobol/lang.opt | 5 ++ gcc/cobol/lexio.cc | 24 +++++- gcc/cobol/lexio.h | 2 + gcc/cobol/messages.cc | 1 + gcc/cobol/parse.y | 97 ++++++++++++++++++---- gcc/cobol/parse_ante.h | 96 +++++++++++++++++++-- gcc/cobol/scan.l | 7 +- gcc/cobol/scan_ante.h | 6 +- gcc/cobol/symbols.h | 2 + gcc/cobol/util.cc | 3 +- .../group2/COMPUTE_multiplication_to_FIX4.cob | 6 +- 15 files changed, 224 insertions(+), 34 deletions(-) diff --git a/gcc/cobol/cbldiag.h b/gcc/cobol/cbldiag.h index f8aac9d16bff..bfa8f3d071b0 100644 --- a/gcc/cobol/cbldiag.h +++ b/gcc/cobol/cbldiag.h @@ -192,6 +192,7 @@ enum cbl_diag_id_t : uint64_t { IbmEqualAssignE, IbmLengthOf, IbmProcedurePointer, + IbmRefmod, IbmSectionNegE, IbmSectionRangeE, IbmSectionSegmentW, diff --git a/gcc/cobol/cobol1.cc b/gcc/cobol/cobol1.cc index 3c34d1f8d796..17da0f191966 100644 --- a/gcc/cobol/cobol1.cc +++ b/gcc/cobol/cobol1.cc @@ -783,6 +783,10 @@ cobol_langhook_handle_option (size_t scode, cobol_warning(ParUnresolvedProcE, procedure_not_found, warning_as_error); return true; + case OPT_Wrefmod: + cobol_warning(IbmRefmod, cobol_refmod, warning_as_error); + return true; + case OPT_Wreplace_error: cobol_warning(LexReplaceE, replace_error, warning_as_error); return true; diff --git a/gcc/cobol/gcobol.1 b/gcc/cobol/gcobol.1 index 185b00c6641a..f9bcd02527c5 100644 --- a/gcc/cobol/gcobol.1 +++ b/gcc/cobol/gcobol.1 @@ -83,6 +83,7 @@ .Op Fl Wno-preprocessor-error .Op Fl Wno-procedure-not-found .Op Fl Wno-procedure-pointer +.Op Fl Wno-refmod .Op Fl Wno-replace-error .Op Fl Wno-redefines-first .Op Fl Wno-redefines-table @@ -747,6 +748,8 @@ Warn if PROCEDURE POINTER is used. Warn if a referenced procedure is not found (instead of error). .It Fl Wno-redefines-grow Warn if REDEFINES data item is larger. +.It Fl Wno-refmod +Allow a reference-modified STRING target without selecting the IBM, MF, or GNU dialect. .It Fl Wno-replace-error Warn if REPLACE cannot be processed (instead of error). .It Fl Wno-segment-error diff --git a/gcc/cobol/lang-specs.h b/gcc/cobol/lang-specs.h index a5ed3fb9322f..5be15a07a72d 100644 --- a/gcc/cobol/lang-specs.h +++ b/gcc/cobol/lang-specs.h @@ -82,6 +82,7 @@ "%{Wvalue-clause} %{Wno-value-clause} " "%{Winspect-trailing} %{Wno-inspect-trailing} " "%{Wlength-of} %{Wno-length-of} " + "%{Wrefmod} %{Wno-refmod} " "%{Wlevel-1-occurs} %{Wno-level-1-occurs} " "%{Wlevel-78} %{Wno-level-78} " "%{Wlevel-78-defined} %{Wno-level-78-defined} " diff --git a/gcc/cobol/lang.opt b/gcc/cobol/lang.opt index 5872f68b70f9..8fa81de36af3 100644 --- a/gcc/cobol/lang.opt +++ b/gcc/cobol/lang.opt @@ -304,6 +304,11 @@ Wprocedure-pointer Cobol Warning Var(procedure_pointer, 1) Init(1) Warn if PROCEDURE POINTER is used. +; IbmRefmod +Wrefmod +Cobol Warning Var(cobol_refmod, 1) Init(1) +Warn if a STRING target is reference-modified. + ; IbmSectionSegmentW Wsegment Cobol Warning Var(cobol_segment, 1) Init(1) diff --git a/gcc/cobol/lexio.cc b/gcc/cobol/lexio.cc index f789fe2d2bd5..fc4c8eee83fb 100644 --- a/gcc/cobol/lexio.cc +++ b/gcc/cobol/lexio.cc @@ -1282,14 +1282,15 @@ bytespan_t::append( const char *input, const char *eoinput ) { const char * cobol_filename(); +static std::map<int, filespan_t> lexer_inputs; + static filespan_t& mapped_file( FILE *input ) { - static std::map<int, filespan_t> inputs; int fd = fileno(input); gcc_assert(fd > 0); - filespan_t& mfile = inputs[fd]; + filespan_t& mfile = lexer_inputs[fd]; if( mfile.data ) { return mfile; } @@ -1325,6 +1326,16 @@ static void unmap_file( filespan_t& mfile ) { mfile = filespan_t(); } +int +lexer_input_close( FILE *input ) { + auto p = lexer_inputs.find(fileno(input)); + if( p != lexer_inputs.end() ) { + if( p->second.data ) unmap_file(p->second); + lexer_inputs.erase(p); + } + return fclose(input); +} + extern int yylineno; static void @@ -1362,7 +1373,14 @@ lexer_input( char buf[], int max_size, FILE *input ) { filespan_t& mfile( mapped_file(input) ); if( mfile.cur == mfile.eodata ) { - if( mfile.cur ) unmap_file(mfile); + if( mfile.cur && !mfile.nada() ) { + unmap_file(mfile); + // Lookahead can reach EOF before Flex finishes consuming pushed-back + // characters. Keep an exhausted sentinel so a subsequent read does + // not map the same input again and restart it from the beginning. + mfile.use_nada(); + mfile.cur = mfile.eodata; + } return 0; } diff --git a/gcc/cobol/lexio.h b/gcc/cobol/lexio.h index e920bec3b304..b0c82c17b4fb 100644 --- a/gcc/cobol/lexio.h +++ b/gcc/cobol/lexio.h @@ -44,6 +44,8 @@ #define SPACE ' ' bool lexer_echo(); +// Release cached input, including persistent EOF, before closing the stream. +int lexer_input_close( FILE *input ); bool is_reference_format(); static inline bool isquote( char ch ) { diff --git a/gcc/cobol/messages.cc b/gcc/cobol/messages.cc index 98fab8437396..a328965c8910 100644 --- a/gcc/cobol/messages.cc +++ b/gcc/cobol/messages.cc @@ -131,6 +131,7 @@ std::set<cbl_diag_t> cbl_diagnostics { { IbmLengthOf, "-Wlength-of", diagnostics::kind::error, dialect_ibm_mf_gnu }, { IbmEqualAssignE, "-Wequal-assign", diagnostics::kind::error, dialect_ibm_e }, { IbmProcedurePointer, "-Wprocedure-pointer", diagnostics::kind::error, dialect_ibm_mf_gnu }, + { IbmRefmod, "-Wrefmod", diagnostics::kind::error, dialect_ibm_mf_gnu }, { IbmSectionNegE, "-Wsegment-negative", diagnostics::kind::error, dialect_ibm_e }, { IbmSectionRangeE, "-Wsegment-error", diagnostics::kind::error, dialect_ibm_e }, { IbmSectionSegmentW, "-Wsegment", diagnostics::kind::warning, dialect_ibm_e }, diff --git a/gcc/cobol/parse.y b/gcc/cobol/parse.y index c84896182302..df63853d5c11 100644 --- a/gcc/cobol/parse.y +++ b/gcc/cobol/parse.y @@ -6159,9 +6159,26 @@ add_body: sum TO rnames } | CORRESPONDING sum TO rnames { + bool valid = true; + const auto& src = $sum->refers.front(); + const auto& tgt = rhs.front().refer; + if( is_literal(src.field) ) { + error_msg(src.loc, "syntax error, unexpected numeric literal"); + valid = false; + } else if( src.field->type != FldGroup ) { + error_msg(src.loc, "%s does not name a group", src.name()); + valid = false; + } + if( tgt.field->type != FldGroup ) { + error_msg(tgt.loc, "%s does not name a group", tgt.name()); + valid = false; + } + if( !valid ) { + rhs.clear(); + YYERROR; + } corresponding_fields_t pairs = - corresponding_arith_fields( $sum->refers.front().field, - rhs.front().refer.field ); + corresponding_arith_fields( src.field, tgt.field ); if( pairs.empty() ) { cbl_message( @$, ParNoCorrespondingW, "%s and %s have no corresponding fields", @@ -6358,6 +6375,20 @@ compute_expr: _EQ expr { dialect_ok(@1, IbmEqualAssignE, "EQUAL as assignment operator" ); } + bool valid = true; + for( const auto& op : $expr->as_deque() ) { + if( op.term.field && !is_numeric(op.term.field) ) { + error_msg(op.term.loc, "%qs (%s) is not numeric", + nice_name_of(op.term.field), + cbl_field_type_name(op.term.field->type)); + valid = false; + } + } + if( !valid ) { + $expr->reset(); + rhs.clear(); + YYERROR; + } current.compute_begin(); $$ = $expr; } @@ -6856,10 +6887,7 @@ simple_cond: kind_of_name $$ = new_reference(new_temporary(FldConditional)); relop_t op = static_cast<relop_t>($op); cbl_field_t *zero = constant_of(constant_index(ZERO)); - if( $1->field->type == FldPointer ) { - error_msg(@cexpr, "cannot compare %qs (%s) to zero", - nice_name_of($1->field), - cbl_field_type_name($1->field->type)); + if( !valid_sign_condition(@cexpr, *$cexpr) ) { YYERROR; } ast_relop(@$, $$->cond(), *$1, op, zero); @@ -6884,7 +6912,12 @@ kind_of_name: cexpr might_be variable_type enum classify_t type = classify_of($3); assert(type != ClassInvalidType ); - parser_classify( $$, *$1, type ); + auto operand = $1; + if( !valid_class_condition(@1, *operand, type) ) { + YYERROR; + } + + parser_classify( $$, *operand, type ); if( $2 == NOT ) { parser_logop($$, NULL, not_op, $$); } @@ -7123,7 +7156,10 @@ value: value POW factor $$ = &$1->push_op('^', *$3); } | '-' value[operand] %prec NEG { $$ = &$operand->push_op('!'); } - | '+' factor %prec NEG { $$ = $2;} + | '+' factor %prec NEG { + $$ = $2; + $$->mark_arithmetic_expression(); + } | factor ; @@ -7301,6 +7337,9 @@ eval_obj_col: ANY { relop_str(op), ev.subject_count()); YYERROR; } + if( !valid_sign_condition(@1, *ev.subject_reference()) ) { + YYERROR; + } ev.decide(op, zero, false); } | bool_expr { @@ -8053,7 +8092,10 @@ sum: num_operand { $$ = new refer_list_t($num_operand); } ; num_operand: scalar - | signed_literal { $$ = new_reference($1); } + | signed_literal { + $$ = new_reference($1); + $$->loc = @1; + } | function_call ; @@ -8848,9 +8890,26 @@ subtract_body: sum FROM rnames } | CORRESPONDING sum FROM rnames { + bool valid = true; + const auto& src = $sum->refers.front(); + const auto& tgt = rhs.front().refer; + if( is_literal(src.field) ) { + error_msg(src.loc, "syntax error, unexpected numeric literal"); + valid = false; + } else if( src.field->type != FldGroup ) { + error_msg(src.loc, "%s does not name a group", src.name()); + valid = false; + } + if( tgt.field->type != FldGroup ) { + error_msg(tgt.loc, "%s does not name a group", tgt.name()); + valid = false; + } + if( !valid ) { + rhs.clear(); + YYERROR; + } corresponding_fields_t pairs = - corresponding_arith_fields( $sum->refers.front().field, - rhs.front().refer.field ); + corresponding_arith_fields( src.field, tgt.field ); if( pairs.empty() ) { cbl_message(@$, ParNoCorrespondingW, "%qs and %qs have no corresponding fields", @@ -11142,6 +11201,10 @@ end_string: %empty %prec LITERAL string_body: str_delimiteds[inputs] str_into[into] { statement_begin(@$, STRING_kw); + if( $into.first->is_refmod_reference() ) { + dialect_ok($into.first->loc, IbmRefmod, + "reference-modified target"); + } $$.inputs = $inputs; $$.into = $into; } @@ -13923,7 +13986,8 @@ ast_op_t:: op_ok( const cbl_loc_t& loc, char op, const ast_op_t *rhstack ) } } - error_msg(loc, "%qs is not numeric", rhs.field->name); + error_msg(loc, "%qs (%s) is not numeric", + nice_name_of(rhs.field), cbl_field_type_name(rhs.field->type)); return false; } return true; @@ -13957,7 +14021,7 @@ ast_relop( const cbl_loc_t& loc, cbl_field_t *tgt, static void ast_add( arith_t *arith ) { - arith->numeric_ok(true); + if( !arith->numeric_ok(true) ) return; size_t nC = arith->tgts.size(), nA = arith->A.size(); std::vector <cbl_num_result_t> C(nC); cbl_num_result_t *pC; @@ -13975,7 +14039,7 @@ ast_add( arith_t *arith ) { static bool ast_subtract( arith_t *arith ) { - arith->numeric_ok(true); + if( !arith->numeric_ok(true) ) return false; size_t nC = arith->tgts.size(), nA = arith->A.size(), nB = arith->B.size(); std::vector <cbl_refer_t> A(nA); std::vector <cbl_refer_t> B(nB); @@ -13994,7 +14058,7 @@ ast_subtract( arith_t *arith ) { static bool ast_multiply( arith_t *arith ) { - arith->numeric_ok(); + if( !arith->numeric_ok() ) return false; size_t nC = arith->tgts.size(), nA = arith->A.size(), nB = arith->B.size(); std::vector <cbl_refer_t> A(nA); std::vector <cbl_refer_t> B(nB); @@ -14013,7 +14077,7 @@ ast_multiply( arith_t *arith ) { static bool ast_divide( arith_t *arith ) { - arith->numeric_ok(); + if( !arith->numeric_ok() ) return false; size_t nC = arith->tgts.size(), nA = arith->A.size(), nB = arith->B.size(); std::vector <cbl_refer_t> A(nA); std::vector <cbl_refer_t> B(nB); @@ -14023,7 +14087,6 @@ ast_divide( arith_t *arith ) { cbl_refer_t *pB = use_any(arith->B, B); cbl_num_result_t *pC = use_any(arith->tgts, C); - arith->numeric_ok(); parser_divide( nC, pC, nA, pA, nB, pB, arith->remainder, arith->on_error, arith->not_error ); diff --git a/gcc/cobol/parse_ante.h b/gcc/cobol/parse_ante.h index 72114454427a..2aa9378dcbd0 100644 --- a/gcc/cobol/parse_ante.h +++ b/gcc/cobol/parse_ante.h @@ -638,11 +638,20 @@ struct arith_t { return "???"; } - void numeric_ok( bool index_acceptable = false ) { - are_numeric(locs.A, A, false); - are_numeric(locs.B, B, index_acceptable); - are_numeric(locs.tgts, tgts, index_acceptable); - is_numeric(locs.remainder, cbl_num_result_t{prohibited_e,remainder}, false); + bool numeric_ok( bool index_acceptable = false ) { + bool ok = are_numeric(locs.A, A, false); + ok = are_numeric(locs.B, B, index_acceptable) && ok; + for( const auto& tgt : tgts ) { + // Without GIVING, a receiving field also supplies an input value. + if( format != giving_e && tgt.refer.field + && !::is_numeric(tgt.refer.field) ) { + ok = is_numeric(tgt.refer.loc, tgt.refer, index_acceptable) && ok; + } else { + ok = is_numeric(tgt.refer.loc, tgt, index_acceptable) && ok; + } + } + return is_numeric(locs.remainder, + cbl_num_result_t{prohibited_e,remainder}, false) && ok; } protected: @@ -676,7 +685,7 @@ struct arith_t { static bool are_numeric( const cbl_loc_t& loc, const T& args, bool index_acceptable ) { bool ok = true; for (const auto& elem : args) { - ok = ok && is_numeric(loc, elem, index_acceptable); + ok = is_numeric(loc, elem, index_acceptable) && ok; } return ok; } @@ -704,6 +713,10 @@ struct ast_op_t : private std::stack<rpn_t>{ static bool op_ok( const cbl_loc_t& loc, char op, const ast_op_t *rhs ); + void mark_arithmetic_expression() { + if( c.size() == 1 ) top().term.arithmetic_expression = true; + } + cbl_refer_t * expr( cbl_refer_t * term ) { dbgmsg("ast_op_t::%s:%d: %s", __func__, __LINE__, field_str(term->field)); push( rpn_t(*term) ); @@ -726,7 +739,9 @@ struct ast_op_t : private std::stack<rpn_t>{ } cbl_refer_t * compute( ast_op_t *operand ) { - return c.size() == 1 ? &operand->top().term : compute(); + auto result = c.size() == 1 ? &operand->top().term : compute(); + result->arithmetic_expression |= c.size() != 1; + return result; } /* @@ -891,6 +906,9 @@ class eval_subject_t { if( pcol == columns.end() ) return nullptr; return pcol->field; } + const cbl_refer_t *subject_reference() const { + return pcol == columns.end() ? nullptr : &*pcol; + } size_t subject_count() const { return columns.size(); } size_t object_count() { return std::distance(columns.begin(), pcol); } @@ -2851,6 +2869,70 @@ static relop_t relop_invert(relop_t op); static enum classify_t classify_of( int token ); +static bool +valid_sign_condition( const cbl_loc_t& loc, const cbl_refer_t& operand ) { + const auto field = operand.field; + // The field overload of is_numeric also recognizes figurative ZERO. + // INDEX is computable, but is not a numeric sign-condition operand. + if( !operand.is_pointer() && !operand.is_refmod_reference() + && field->level != 88 && field->type != FldIndex + && is_numeric(field) ) { + return true; + } + error_msg(loc, "%qs (%s) is not a valid operand for a sign condition; " + "a numeric operand is required", + nice_name_of(field), cbl_field_type_name(field->type)); + return false; +} + +static bool +valid_class_condition( const cbl_loc_t& loc, const cbl_refer_t& operand, + classify_t type ) { + const char *name; + switch( type ) { + case ClassNumericType: name = "NUMERIC"; break; + case ClassAlphabeticType: name = "ALPHABETIC"; break; + case ClassLowerType: name = "ALPHABETIC-LOWER"; break; + case ClassUpperType: name = "ALPHABETIC-UPPER"; break; + default: return true; // Preserve DBCS and KANJI handling. + } + + auto field = operand.field; + if( operand.arithmetic_expression ) { + error_msg(loc, "arithmetic expression is not a valid operand for IS %s", + name); + return false; + } + bool invalid = is_literal(field) + || operand.is_pointer() || field->type == FldIndex; + if( operand.is_refmod_reference() ) { + // Only character representations can supply a character reference. + switch( field->type ) { + case FldGroup: + case FldAlphanumeric: + case FldAlphaEdited: + case FldNumericDisplay: + case FldNumericEdited: + break; + default: + invalid = true; + break; + } + } + if( type != ClassNumericType ) { + // Reference modification supplies character data, including when the + // underlying item is numeric-edited. is_numeric handles numeric DISPLAY + // reference modification as well. + invalid |= !operand.is_refmod_reference() + && (is_numeric(operand) || field->type == FldNumericEdited); + } + if( invalid ) { + error_msg(loc, "%qs (%s) is not a valid operand for IS %s", + field->name, cbl_field_type_str(field->type) + 3, name); + } + return !invalid; +} + static void subscript_dimension_error( cbl_loc_t loc, size_t, const cbl_refer_t *name ); /* diff --git a/gcc/cobol/scan.l b/gcc/cobol/scan.l index c7afdd262a70..5e2e4d90cec9 100644 --- a/gcc/cobol/scan.l +++ b/gcc/cobol/scan.l @@ -2915,7 +2915,12 @@ BASIS { yy_push_state(basis); return BASIS; } <<EOF>> { error_msg(yylloc, "syntax error: unterminated string %<%s%>", tmpstring); - return NO_CONDITION; + // No token remains to recover from at physical EOF. + // Leave the quote state so subsequent requests cannot + // report the same unterminated literal indefinitely. + tmpstring = NULL; + yy_pop_state(); + return YYEOF; } } diff --git a/gcc/cobol/scan_ante.h b/gcc/cobol/scan_ante.h index dd77268b8a18..01cb985b6d49 100644 --- a/gcc/cobol/scan_ante.h +++ b/gcc/cobol/scan_ante.h @@ -980,11 +980,11 @@ skip_string(char delimiter) { int ch; std::string found; - while ((ch = yyinput()) != EOF ) { + while ((ch = yyinput()) != 0 && ch != EOF ) { dbgmsg("%s:%d: input '%c'", __func__, __LINE__, ch); found += ch; if (ch == delimiter) { - if( (ch = yyinput()) == EOF ) break; + if( (ch = yyinput()) == 0 || ch == EOF ) break; dbgmsg("%s:%d: input '%c'", __func__, __LINE__, ch); if (ch == delimiter) { found += ch; @@ -1025,6 +1025,8 @@ is_refmod() { int input() { int ch = yyinput(); dbgmsg("%s:%d: input '%c'", __func__, __LINE__, ch); + // Flex returns zero at end of input, rather than stdio's EOF. + if( ch == 0 ) return EOF; if( ch != EOF) text += ch; return ch; } diff --git a/gcc/cobol/symbols.h b/gcc/cobol/symbols.h index 415a4a7905d0..b3a7ffada9e9 100644 --- a/gcc/cobol/symbols.h +++ b/gcc/cobol/symbols.h @@ -1039,6 +1039,7 @@ struct cbl_refer_t { cbl_field_t *field; cbl_label_t *prog_func; bool all, addr_of; + bool arithmetic_expression = false; std::vector<cbl_refer_t> subscripts; // indices cbl_span_t refmod; // substring bounds @@ -1085,6 +1086,7 @@ struct cbl_refer_t { prog_func = that.prog_func; all = that.all; addr_of = that.addr_of; + arithmetic_expression = that.arithmetic_expression; subscripts = that.subscripts; refmod = that.refmod; return *this; diff --git a/gcc/cobol/util.cc b/gcc/cobol/util.cc index 1355e62ba4f3..e77e6ed73fe5 100644 --- a/gcc/cobol/util.cc +++ b/gcc/cobol/util.cc @@ -3915,6 +3915,7 @@ parse_file( const char filename[] ) if( input_filenames.option() == 'M' ) { input_filenames.print(); + lexer_input_close(yyin); return 0; } @@ -3932,7 +3933,7 @@ parse_file( const char filename[] ) parser_leave_file(); - fclose (yyin); + lexer_input_close(yyin); if( erc ) { error_at (UNKNOWN_LOCATION, "failed compiling %s", filename); diff --git a/gcc/testsuite/cobol.dg/group2/COMPUTE_multiplication_to_FIX4.cob b/gcc/testsuite/cobol.dg/group2/COMPUTE_multiplication_to_FIX4.cob index 23e20dadbf97..2ad8a3a3d3e0 100644 --- a/gcc/testsuite/cobol.dg/group2/COMPUTE_multiplication_to_FIX4.cob +++ b/gcc/testsuite/cobol.dg/group2/COMPUTE_multiplication_to_FIX4.cob @@ -77,15 +77,15 @@ *> FIX8NUMEDT DISPLAY "COMPUTE FIX4DISPLAY = FIX8NUMEDT without SIZE ERROR" - COMPUTE FIX4DISPLAY = FIX8NUMEDT + COMPUTE FIX4DISPLAY = FUNCTION NUMVAL(FIX8NUMEDT) DISPLAY "FIX4DISPLAY is " FIX4DISPLAY DISPLAY "Should be 5678" DISPLAY "." DISPLAY "COMPUTE FIX4DISPLAY = FIX8NUMEDT with SIZE ERROR" - COMPUTE FIX4DISPLAY = FIX8NUMEDT + COMPUTE FIX4DISPLAY = FUNCTION NUMVAL(FIX8NUMEDT) MOVE 9876 TO FIX4DISPLAY - COMPUTE FIX4DISPLAY = FIX8NUMEDT + COMPUTE FIX4DISPLAY = FUNCTION NUMVAL(FIX8NUMEDT) ON SIZE ERROR Display "Proper size error" NOT ON SIZE ERROR Display "Improper no error" END-COMPUTE
