Rainer Orth <r...@cebitec.uni-bielefeld.de> writes: > Hi Jakub, > >> On Fri, Apr 11, 2025 at 10:50:25AM +0200, Rainer Orth wrote: >>> 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. >>> >> >>> # HG changeset patch >>> # Parent 6f227ddea0046a0164509bdb8069e96184304054 >>> cobol: Initialize regmatch_t portably [PR119217] >>> >>> diff --git a/gcc/cobol/dts.h b/gcc/cobol/dts.h >>> --- a/gcc/cobol/dts.h >>> +++ b/gcc/cobol/dts.h >>> @@ -33,7 +33,8 @@ namespace dts { >>> : input(input) >>> , first(NULL), second(NULL), matched(false) >>> { >>> - static regmatch_t empty = { -1, -1 }; >>> + static regmatch_t empty; >>> + empty.rm_so = empty.rm_eo = -1; >> >> Why not static regmatch_t empty = { .rm_so = -1, .rm_eo = -1 }; >> ? > > I tried that initially, but got warnings: > > In file included from /vol/gcc/src/hg/master/cobol/gcc/cobol/lexio.h:208, > from /vol/gcc/src/hg/master/cobol/gcc/cobol/lexio.cc:36: > /vol/gcc/src/hg/master/cobol/gcc/cobol/dts.h: In constructor > ‘dts::csub_match::csub_match(const char*)’: > /vol/gcc/src/hg/master/cobol/gcc/cobol/dts.h:36:60: warning: missing > initializer for member ‘regmatch_t::rm_sp’ [-Wmissing-field-initializers] > 36 | static regmatch_t empty = { .rm_so = -1, .rm_eo = -1 }; > | ^ > /vol/gcc/src/hg/master/cobol/gcc/cobol/dts.h:36:60: warning: missing > initializer for member ‘regmatch_t::rm_ep’ [-Wmissing-field-initializers] > /vol/gcc/src/hg/master/cobol/gcc/cobol/dts.h:36:60: warning: missing > initializer for member ‘regmatch_t::rm_ss’ [-Wmissing-field-initializers] > /vol/gcc/src/hg/master/cobol/gcc/cobol/dts.h:36:60: warning: missing > initializer for member ‘regmatch_t::rm_es’ [-Wmissing-field-initializers] > >> While the FE needs to be valid C++14, the library is GNU++17 (compiled >> by the just built GCC and not built with -pedantic*, so can use GCC >> extensions or features from C++20 that are known to be implemented there). >> >> Ah, I see dts.h include from the FE. So that would need to be >> #ifndef IN_GCC_FRONTEND >> static const regmatch_t empty = { .rm_so = -1, .rm_eo = -1 }; >> #else >> regmatch_t empty = {}; >> empty.rm_so = empty.rm_eo = -1; >> #endif > > Isn't this overkill for such a minor issue?
The question remains: how to handle this, especially for the gcc-15 branch where this issue is one of several breaking Solaris/amd64 --enable-languages=all bootstrap. Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University