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

--- Comment #18 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Rainer Orth <r...@gcc.gnu.org>:

https://gcc.gnu.org/g:12d6fa2a21140166181ae3be7711d60e62c569d7

commit r16-467-g12d6fa2a21140166181ae3be7711d60e62c569d7
Author: Rainer Orth <r...@cebitec.uni-bielefeld.de>
Date:   Thu May 8 09:29:56 2025 +0200

    cobol: Initialize regmatch_t portably [PR119217]

    The dts.h initialization of regmatch_t currently breaks Solaris
compilation:

    In file included from /vol/gcc/src/hg/master/local/gcc/cobol/lexio.h:208,
                     from /vol/gcc/src/hg/master/local/gcc/cobol/lexio.cc:36:
    /vol/gcc/src/hg/master/local/gcc/cobol/dts.h: In constructor
âdts::csub_match::csub_match(const char*)â:
    /vol/gcc/src/hg/master/local/gcc/cobol/dts.h:36:35: error: invalid
conversion from âintâ to âconst char*â [-fpermissive]
       36 |       static regmatch_t empty = { -1, -1 };
          |                                   ^~
          |                                   |
          |                                   int

    The problem is that Solaris regmatch_t has additional members before
    rm_so and rm_eo, as is always allowed by POSIX.1

    typedef struct {
            const char      *rm_sp, *rm_ep; /* Start pointer, end pointer */
            regoff_t        rm_so, rm_eo;   /* Start offset, end offset */
            int             rm_ss, rm_es;   /* Used internally */
    } regmatch_t;

    so the initialization doesn't do what it's supposed to do.

    Fixed by initializing the rm_so and rm_eo members explicitly.

    Bootstrapped without regressions on amd64-pc-solaris2.11,
    sparcv9-sun-solaris2.11, and x86_64-pc-linux-gnu.

    2025-04-08  Rainer Orth  <r...@cebitec.uni-bielefeld.de>

            gcc/cobol:
            PR cobol/119217
            * dts.h (csub_match): Initialize rm_so, rm_eo fields explicitly.

Reply via email to