[Bug cobol/126616] New: cobol: SIGSEGV in libgcobol.cc: binary_to_native_binary

simonsobisch at gnu dot org via Gcc-bugs <[email protected]> Mon, 03 Aug 2026 12:27:11 +0000
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D126616

            Bug ID: 126616
           Summary: cobol: SIGSEGV in libgcobol.cc:
                    binary_to_native_binary
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: cobol
          Assignee: unassigned at gcc dot gnu.org
          Reporter: simonsobisch at gnu dot org
  Target Milestone: ---

Program received signal SIGSEGV, Segmentation fault.
binary_to_native_binary (dest=3D0x7ffff689a010, bytes=3D4, value=3D<optimiz=
ed out>,
signable=3D<optimized out>) at /home/so/gcc-cobol/libgcobol/libgcobol.cc:16=
32
1632            store_unaligned<uint32_t>(dest, static_cast<uint32_t>(uvalu=
e));
(gdb) bt

#0  binary_to_native_binary (dest=3D0x7ffff689a010, bytes=3D4, value=3D<opt=
imized
out>, signable=3D<optimized out>) at
/home/so/gcc-cobol/libgcobol/libgcobol.cc:1632
#1  int128_to_field (var=3D0x7fffe45ded80 <errno_cblc_field>,
location=3D0x7ffff689a010 "\003", length=3D4, value=3D<optimized out>,
source_rdigits=3D<error reading variable: dwarf2_find_location_expression:
Corrupted DWARF expression.>,=20
    rounded=3Dtruncation_e, compute_error=3D0x7ffffffa8914) at
/home/so/gcc-cobol/libgcobol/libgcobol.cc:2353
#2  0x00007ffff7b92dba in __gg__move (fdest=3D0x7fffe45ded80 <errno_cblc_fi=
eld>,
dest_offset=3D0, dest_size=3D4, fsource=3D0x7b7c00 <__ggsr__zeros>,
source_offset=3D<optimized out>, source_size=3D<optimized out>, source_flag=
s=3D256,
rounded=3Dtruncation_e)
    at /home/so/gcc-cobol/libgcobol/libgcobol.cc:7037

according to the debugger that happens on

           MOVE ZERO TO errno.

defined as

       77 errno                        USAGE BINARY-LONG EXTERNAL.
       77 w-errno REDEFINES errno      PIC S9(9) COMP-5.


side note: using plain system GDB there is no obvious way to get the COBOL
stacktrace (this code is in a copybook, PERFORMed multiple times in the pro=
gram
visible in the stack - but where in that program did we originate from)?=