From 2bde6e8ada43a3e4c99be66865c00a3d27492ad4 Mon Sep 17 00:00:00 2001 From: "James K. Lowden" <jklowden@symas.com> Date: Thu, 18 Apr 2024 18:45:23 -0400 Subject: [PATCH] clear FldConditional attributes on re-use --- gcc/cobol/parse_ante.h | 2 +- gcc/cobol/symbols.cc | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gcc/cobol/parse_ante.h b/gcc/cobol/parse_ante.h index c8c8c1b8b467..ae35a37e3e64 100644 --- a/gcc/cobol/parse_ante.h +++ b/gcc/cobol/parse_ante.h @@ -365,7 +365,7 @@ struct evaluate_elem_t { typedef list<case_t>::iterator case_iter; case_iter pcase; -void dump() const { + void dump() const { warnx( "nother=%zu label '%s', %zu cases", nother, label.name, cases.size() ); std::for_each( cases.begin(), cases.end(), case_t::Dump ); } diff --git a/gcc/cobol/symbols.cc b/gcc/cobol/symbols.cc index 0fb7ee0889da..d02a01c3dc11 100644 --- a/gcc/cobol/symbols.cc +++ b/gcc/cobol/symbols.cc @@ -3187,7 +3187,13 @@ symbol_temporaries_free() { auto freed = std::inserter(temporaries.freed[type], temporaries.freed[type].begin()); - std::copy( used.begin(), used.end(), freed ); + std::transform( used.begin(), used.end(), freed, + []( auto field ) { + if( field->type == FldConditional ) { + field->attr &= temporary_e; + } + return field; + } ); used.clear(); } } -- GitLab