public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114439] New: [14 Regression] icu4c-73.2 build failure: invalid initializer for array member
@ 2024-03-23  9:58 slyfox at gcc dot gnu.org
  2024-03-23 12:12 ` [Bug c++/114439] " slyfox at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: slyfox at gcc dot gnu.org @ 2024-03-23  9:58 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114439
           Summary: [14 Regression] icu4c-73.2 build failure: invalid
                    initializer for array member
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at gcc dot gnu.org
  Target Milestone: ---

Initially observed build failure on icu4c-73.2 using gcc
r14-9636-gc2e28df90a1640 .

The build fails there as:

regexst.cpp: In constructor
'icu_73::RegexStaticSets::RegexStaticSets(UErrorCode*)':
regexst.cpp:75:52: error: invalid initializer for array member
'icu_73::UnicodeSet icu_73::RegexStaticSets::fPropSets [13]'
   75 | RegexStaticSets::RegexStaticSets(UErrorCode *status) {
      |                                                    ^
regexst.cpp:75:52: error: invalid initializer for array member
'icu_73::Regex8BitSet icu_73::RegexStaticSets::fPropSets8 [13]'
regexst.cpp:75:52: error: invalid initializer for array member
'icu_73::UnicodeSet icu_73::RegexStaticSets::fRuleSets [3]'

Minimized example:

$ cat regexst.cpp.cpp
struct UnicodeSet {
  int *list = stackList;
  int stackList[];
};
struct RegexStaticSets {
  RegexStaticSets() {}
  UnicodeSet fPropSets[2]{};
};

$ g++-14 -std=c++11 -c regexst.cpp.cpp -o bug.o
regexst.cpp.cpp: In constructor 'RegexStaticSets::RegexStaticSets()':
regexst.cpp.cpp:6:21: error: invalid initializer for array member 'UnicodeSet
RegexStaticSets::fPropSets [2]'
    6 |   RegexStaticSets() {}
      |                     ^

For comparison gcc-13 looks fine:

$ g++-13 -std=c++11 -c regexst.cpp.cpp -o bug.o

Compiler version:

$ g++-14 -v
Using built-in specs.
COLLECT_GCC=/<<NIX>>/gcc-14.0.1/bin/g++
COLLECT_LTO_WRAPPER=/<<NIX>>/gcc-14.0.1/libexec/gcc/x86_64-unknown-linux-gnu/14.0.1/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../source/configure --prefix=/<<NIX>>/gcc-14.0.1
--with-gmp-include=/<<NIX>>/gmp-6.3.0-dev/include
--with-gmp-lib=/<<NIX>>/gmp-6.3.0/lib
--with-mpfr-include=/<<NIX>>/mpfr-4.2.1-dev/include
--with-mpfr-lib=/<<NIX>>/mpfr-4.2.1/lib --with-mpc=/<<NIX>>/libmpc-1.3.1
--with-native-system-header-dir=/<<NIX>>/glibc-2.39-dev/include
--with-build-sysroot=/
--with-gxx-include-dir=/<<NIX>>/gcc-14.0.1/include/c++/14.0.1/
--program-prefix= --enable-lto --disable-libstdcxx-pch
--without-included-gettext --with-system-zlib --enable-checking=release
--enable-static --enable-languages=c,c++ --disable-multilib --enable-plugin
--disable-libcc1 --with-isl=/<<NIX>>/isl-0.20 --disable-bootstrap
--build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu
--target=x86_64-unknown-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.1 99999999 (experimental) (GCC)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/114439] [14 Regression] icu4c-73.2 build failure: invalid initializer for array member
  2024-03-23  9:58 [Bug c++/114439] New: [14 Regression] icu4c-73.2 build failure: invalid initializer for array member slyfox at gcc dot gnu.org
@ 2024-03-23 12:12 ` slyfox at gcc dot gnu.org
  2024-03-23 17:10 ` [Bug c++/114439] [14 Regression] icu4c-73.2 build failure: invalid initializer for array member with initialization of array of struct containing flexible arrays since r14-962 pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: slyfox at gcc dot gnu.org @ 2024-03-23 12:12 UTC (permalink / raw)
  To: gcc-bugs

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

Sergei Trofimovich <slyfox at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #1 from Sergei Trofimovich <slyfox at gcc dot gnu.org> ---
Bisected down to r14-9622-gd1d8fd2884b445 "c++: direct-init of an array of
class type [PR59465]".

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/114439] [14 Regression] icu4c-73.2 build failure: invalid initializer for array member with initialization of array of struct containing flexible arrays since r14-962
  2024-03-23  9:58 [Bug c++/114439] New: [14 Regression] icu4c-73.2 build failure: invalid initializer for array member slyfox at gcc dot gnu.org
  2024-03-23 12:12 ` [Bug c++/114439] " slyfox at gcc dot gnu.org
@ 2024-03-23 17:10 ` pinskia at gcc dot gnu.org
  2024-03-23 19:15 ` [Bug c++/114439] [14 Regression] icu4c-73.2 build failure: invalid initializer for array member with initialization of array of struct containing " pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-23 17:10 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu.org
            Summary|[14 Regression] icu4c-73.2  |[14 Regression] icu4c-73.2
                   |build failure: invalid      |build failure: invalid
                   |initializer for array       |initializer for array
                   |member                      |member with initialization
                   |                            |of array of struct
                   |                            |containing flexible arrays
                   |                            |since r14-962
           Keywords|                            |rejects-valid
   Target Milestone|---                         |14.0

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/114439] [14 Regression] icu4c-73.2 build failure: invalid initializer for array member with initialization of array of struct containing arrays since r14-962
  2024-03-23  9:58 [Bug c++/114439] New: [14 Regression] icu4c-73.2 build failure: invalid initializer for array member slyfox at gcc dot gnu.org
  2024-03-23 12:12 ` [Bug c++/114439] " slyfox at gcc dot gnu.org
  2024-03-23 17:10 ` [Bug c++/114439] [14 Regression] icu4c-73.2 build failure: invalid initializer for array member with initialization of array of struct containing flexible arrays since r14-962 pinskia at gcc dot gnu.org
@ 2024-03-23 19:15 ` pinskia at gcc dot gnu.org
  2024-03-24 15:01 ` [Bug c++/114439] [14 Regression] icu4c-73.2 build failure: invalid initializer for array member with initialization of array of struct containing arrays since r14-9622 xry111 at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-23 19:15 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-03-23
             Status|UNCONFIRMED                 |NEW
            Summary|[14 Regression] icu4c-73.2  |[14 Regression] icu4c-73.2
                   |build failure: invalid      |build failure: invalid
                   |initializer for array       |initializer for array
                   |member with initialization  |member with initialization
                   |of array of struct          |of array of struct
                   |containing flexible arrays  |containing arrays since
                   |since r14-962               |r14-962
     Ever confirmed|0                           |1

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed. The array inside UnicodeSet does not need to be flexible to have
this rejected.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/114439] [14 Regression] icu4c-73.2 build failure: invalid initializer for array member with initialization of array of struct containing arrays since r14-9622
  2024-03-23  9:58 [Bug c++/114439] New: [14 Regression] icu4c-73.2 build failure: invalid initializer for array member slyfox at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-03-23 19:15 ` [Bug c++/114439] [14 Regression] icu4c-73.2 build failure: invalid initializer for array member with initialization of array of struct containing " pinskia at gcc dot gnu.org
@ 2024-03-24 15:01 ` xry111 at gcc dot gnu.org
  2024-03-25 14:35 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: xry111 at gcc dot gnu.org @ 2024-03-24 15:01 UTC (permalink / raw)
  To: gcc-bugs

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

Xi Ruoyao <xry111 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1

--- Comment #3 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
To me this should be a P1 as the compiler is rejecting trivial valid code...

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/114439] [14 Regression] icu4c-73.2 build failure: invalid initializer for array member with initialization of array of struct containing arrays since r14-9622
  2024-03-23  9:58 [Bug c++/114439] New: [14 Regression] icu4c-73.2 build failure: invalid initializer for array member slyfox at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-03-24 15:01 ` [Bug c++/114439] [14 Regression] icu4c-73.2 build failure: invalid initializer for array member with initialization of array of struct containing arrays since r14-9622 xry111 at gcc dot gnu.org
@ 2024-03-25 14:35 ` mpolacek at gcc dot gnu.org
  2024-03-25 22:20 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-03-25 14:35 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/114439] [14 Regression] icu4c-73.2 build failure: invalid initializer for array member with initialization of array of struct containing arrays since r14-9622
  2024-03-23  9:58 [Bug c++/114439] New: [14 Regression] icu4c-73.2 build failure: invalid initializer for array member slyfox at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-03-25 14:35 ` mpolacek at gcc dot gnu.org
@ 2024-03-25 22:20 ` cvs-commit at gcc dot gnu.org
  2024-03-25 22:20 ` mpolacek at gcc dot gnu.org
  2024-03-26  9:08 ` slyfox at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-25 22:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:de0886d48032332d10e4acb5d15c8789b281b6fe

commit r14-9658-gde0886d48032332d10e4acb5d15c8789b281b6fe
Author: Marek Polacek <polacek@redhat.com>
Date:   Mon Mar 25 15:32:20 2024 -0400

    c++: broken direct-init with trailing array member [PR114439]

    can_init_array_with_p is wrongly saying that the init for 's' here:

      struct S {
        int *list = arr;
        int arr[];
      };

      struct A {
        A() {}
        S s[2]{};
      };

    is invalid.  But as process_init_constructor_array says, for "non-constant
    initialization of trailing elements with no explicit initializers" we use
    a VEC_INIT_EXPR wrapped in a TARGET_EXPR, built in
process_init_constructor.

    Unfortunately we didn't have a test for this scenario so I didn't
    realize can_init_array_with_p must handle it.

            PR c++/114439

    gcc/cp/ChangeLog:

            * init.cc (can_init_array_with_p): Return true for a VEC_INIT_EXPR
            wrapped in a TARGET_EXPR.

    gcc/testsuite/ChangeLog:

            * g++.dg/init/array65.C: New test.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/114439] [14 Regression] icu4c-73.2 build failure: invalid initializer for array member with initialization of array of struct containing arrays since r14-9622
  2024-03-23  9:58 [Bug c++/114439] New: [14 Regression] icu4c-73.2 build failure: invalid initializer for array member slyfox at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2024-03-25 22:20 ` cvs-commit at gcc dot gnu.org
@ 2024-03-25 22:20 ` mpolacek at gcc dot gnu.org
  2024-03-26  9:08 ` slyfox at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-03-25 22:20 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/114439] [14 Regression] icu4c-73.2 build failure: invalid initializer for array member with initialization of array of struct containing arrays since r14-9622
  2024-03-23  9:58 [Bug c++/114439] New: [14 Regression] icu4c-73.2 build failure: invalid initializer for array member slyfox at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2024-03-25 22:20 ` mpolacek at gcc dot gnu.org
@ 2024-03-26  9:08 ` slyfox at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: slyfox at gcc dot gnu.org @ 2024-03-26  9:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Sergei Trofimovich <slyfox at gcc dot gnu.org> ---
The change also fixed full icu4c-73.2 build for me. Thank you!

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-03-26  9:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-23  9:58 [Bug c++/114439] New: [14 Regression] icu4c-73.2 build failure: invalid initializer for array member slyfox at gcc dot gnu.org
2024-03-23 12:12 ` [Bug c++/114439] " slyfox at gcc dot gnu.org
2024-03-23 17:10 ` [Bug c++/114439] [14 Regression] icu4c-73.2 build failure: invalid initializer for array member with initialization of array of struct containing flexible arrays since r14-962 pinskia at gcc dot gnu.org
2024-03-23 19:15 ` [Bug c++/114439] [14 Regression] icu4c-73.2 build failure: invalid initializer for array member with initialization of array of struct containing " pinskia at gcc dot gnu.org
2024-03-24 15:01 ` [Bug c++/114439] [14 Regression] icu4c-73.2 build failure: invalid initializer for array member with initialization of array of struct containing arrays since r14-9622 xry111 at gcc dot gnu.org
2024-03-25 14:35 ` mpolacek at gcc dot gnu.org
2024-03-25 22:20 ` cvs-commit at gcc dot gnu.org
2024-03-25 22:20 ` mpolacek at gcc dot gnu.org
2024-03-26  9:08 ` slyfox at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).