https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126391
--- Comment #2 from Simon Sobisch <simonsobisch at gnu dot org> ---
The reproducer can even be smaller:
IDENTIFICATION DIVISION.
PROGRAM-ID. prog.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 FLD PIC 9.
PROCEDURE DIVISION.
bug SECTION.
COMPUTE FLD ROUNDED = FLD
ON SIZE ERROR MOVE 1 TO FLD
END-COMPUTE.
GOBACK.
... but: it only occurs if you compile with gcobc - or simply add "-include
/opt/gcobol/share/cobol/udf/stored-char-length.cbl"
/opt/gcobol/libexec/gcc/x86_64-pc-linux-gnu/17.0.0/cobol1 /home/so/bug.cob
-quiet -o /dev/null -include
/opt/gcobol/share/cobol/udf/stored-char-length.cbl
during RTL pass: expand
/home/so/bug.cob: In function ‘prog’:
/home/so/bug.cob:10:12: internal compiler error: in expand_expr_real_1, at
expr.cc:11729
10 | COMPUTE W120-BETR ROUNDED = W120-BETR
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11 | ON SIZE ERROR MOVE 1 TO W120-BETR
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x26cbb15 internal_error(char const*, ...)
/home/so/gcc-cobol/gcc/diagnostic-global-context.cc:787
0xa5e439 fancy_abort(char const*, int, char const*)
/home/so/gcc-cobol/gcc/diagnostics/context.cc:1813
0xd493d5 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
/home/so/gcc-cobol/gcc/expr.cc:11723
0xd55b3b expand_expr(tree_node*, rtx_def*, machine_mode, expand_modifier)
/home/so/gcc-cobol/gcc/expr.h:323
0xd55b3b expand_assignment(tree_node*, tree_node*, bool)
/home/so/gcc-cobol/gcc/expr.cc:6461
0xc132d5 expand_call_stmt
/home/so/gcc-cobol/gcc/cfgexpand.cc:3233
0xc132d5 expand_gimple_stmt_1
/home/so/gcc-cobol/gcc/cfgexpand.cc:4273
0xc132d5 expand_gimple_stmt
/home/so/gcc-cobol/gcc/cfgexpand.cc:4420
0xc1972f expand_gimple_basic_block
/home/so/gcc-cobol/gcc/cfgexpand.cc:6537
0xc1b867 execute
/home/so/gcc-cobol/gcc/cfgexpand.cc:7288
/opt/gcobol/libexec/gcc/x86_64-pc-linux-gnu/17.0.0/cobol1
/home/so/src/SY903.cob -quiet -o /dev/null -include
/opt/gcobol/share/cobol/udf/stored-char-length.cbl