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

--- Comment #12 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:1b5b02be5740b69f670b1591ac63eb6a69ff1f79

commit r15-9317-g1b5b02be5740b69f670b1591ac63eb6a69ff1f79
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Tue Apr 8 15:57:45 2025 +0200

    cobol: Further fixes for cobol cross-compilation from 32-bit arches
[PR119364]

    On top of
    https://gcc.gnu.org/pipermail/gcc-patches/2025-April/680256.html
    patch this brings make check-cobol when using the cross compiler from
    32-bit host to x86_64-linux to the following:
      Running /home/jakub/src/gcc/gcc/testsuite/cobol.dg/dg.exp ...
      FAIL: cobol.dg/group1/declarative_1.cob   -O0  execution test
      FAIL: cobol.dg/group1/declarative_1.cob   -O1  execution test
      FAIL: cobol.dg/group1/declarative_1.cob   -O2  execution test
      FAIL: cobol.dg/group1/declarative_1.cob   -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions  execution test
      FAIL: cobol.dg/group1/declarative_1.cob   -O3 -g  execution test
      FAIL: cobol.dg/group1/declarative_1.cob   -Os  execution test

                      === cobol Summary ===

      # of expected passes            3123
      # of unexpected failures        6
      # of expected failures          6
    (which has some analysis but not a fix yet).

    This patch fixes various cases where host size of various types
    (void *, int, size_t, unsigned char) is used in place where
    size of those types in bytes on the target should be used instead.
    At least the size of void * and size_t actually differns between
    ilp32 hosts and lp64 targets, int could be different in theory as well
    but we actually don't support 16-bit ints on the host side and only support
    lp64 targets right now for cobol, and finally sizeof(unsigned char) is
    always 1, so there is no point to multiply by that and it is still
    wrong to use host sizeof for the target decisions.

    2025-04-08  Jakub Jelinek  <ja...@redhat.com>

            PR cobol/119364
            * genapi.cc (function_handle_from_name): Use sizeof_pointer.
            (parser_file_add): Use int_size_in_bytes(VOID_P) and
            int_size_in_bytes(int).
            (inspect_tally): Use int_size_in_bytes(VOID_P).
            (inspect_replacing): Likewise.
            (gg_array_of_field_pointers): Likewise.
            (gg_array_of_file_pointers): Likewise.
            (parser_set_pointers): Use sizeof_pointer.
            * cobol1.cc (create_our_type_nodes_init): Use
            int_size_in_bytes(SIZE_T) and int_size_in_bytes(VOID_P).
            * gengen.cc (gg_array_of_size_t): Use int_size_in_bytes(SIZE_T).
            (gg_array_of_bytes): Just use N, don't multiply it by
            sizeof(unsigned char).
            * parse.y: Include tree.h.  Use int_size_in_bytes(ptr_type_node).

Reply via email to