https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126616

            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=0x7ffff689a010, bytes=4, value=<optimized out>,
signable=<optimized out>) at /home/so/gcc-cobol/libgcobol/libgcobol.cc:1632
1632            store_unaligned<uint32_t>(dest, static_cast<uint32_t>(uvalue));
(gdb) bt

#0  binary_to_native_binary (dest=0x7ffff689a010, bytes=4, value=<optimized
out>, signable=<optimized out>) at
/home/so/gcc-cobol/libgcobol/libgcobol.cc:1632
#1  int128_to_field (var=0x7fffe45ded80 <errno_cblc_field>,
location=0x7ffff689a010 "\003", length=4, value=<optimized out>,
source_rdigits=<error reading variable: dwarf2_find_location_expression:
Corrupted DWARF expression.>, 
    rounded=truncation_e, compute_error=0x7ffffffa8914) at
/home/so/gcc-cobol/libgcobol/libgcobol.cc:2353
#2  0x00007ffff7b92dba in __gg__move (fdest=0x7fffe45ded80 <errno_cblc_field>,
dest_offset=0, dest_size=4, fsource=0x7b7c00 <__ggsr__zeros>,
source_offset=<optimized out>, source_size=<optimized out>, source_flags=256,
rounded=truncation_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 program
visible in the stack - but where in that program did we originate from)?

Reply via email to