https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122316
Bug ID: 122316
Summary: "Assertion `e && e->type == SymField' failed" on
invalid code
Product: gcc
Version: 15.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: cobol
Assignee: unassigned at gcc dot gnu.org
Reporter: simonsobisch at gnu dot org
Target Milestone: ---
IDENTIFICATION DIVISION.
PROGRAM-ID. prog.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT file2 ASSIGN DISK.
DATA DIVISION.
FILE SECTION.
FD file1.
01 file1-rec PIC X.
SD files.
01 files-rec.
05 sort-key PIC X.
FD file2.
01 file2-rec PIC X.
PROCEDURE DIVISION.
WRITE file1-rec.
RELEASE files.
STOP RUN.
results in
<source>:9:12: error: file name not found
9 | FD file1.
| ^
<source>:17:27: error: file1-rec is not defined
17 | WRITE file1-rec.
| ^
<source>:17:18: error: no record name 'file1-rec'
17 | WRITE file1-rec.
| ^
cobol1: ../../gcc-trunk-20251017/gcc/cobol/symbols.h:2031: cbl_field_t*
cbl_field_of(symbol_elem_t*): Assertion `e && e->type == SymField' failed.
cobol1: internal compiler error: Aborted
0x25825a8 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
???:0
0x257739b internal_error(char const*, ...)
???:0
0x7aaf69a969fc pthread_kill
???:0
0x7aaf69a42475 raise
???:0
0x7aaf69a287f2 abort
???:0
0x7aaf69a39e95 __assert_fail
???:0
0xaf8096 yyparse()
???:0
0xb7aa34 cobol_parse_files(int, char const**)
???:0
GCC 15.1.0 had output
"(null):0: confused by earlier errors, bailing out"
The internal abort is in since GCC 15.2