This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/85285] [6/7/8 Regression] ICE with flexible array in union


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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2018-04-08
                 CC|                            |msebor at gcc dot gnu.org
      Known to work|                            |5.4.0
     Ever confirmed|0                           |1
      Known to fail|                            |6.4.0, 7.3.0, 8.0

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed.  r231665 (gcc 6.0.0) is the first revision to ICE:

r231665 | msebor | 2015-12-15 16:04:08 -0500 (Tue, 15 Dec 2015) | 71 lines

2015-12-15  Martin Sebor  <msebor@redhat.com>

        c++/42121
        c++/68478
        c++/68613
        c++/68689
        c++/68710
        * class.c (walk_subobject_offsets): Avoid assuming type domain
        is non-null or has an upper bound.
        (layout_class_type): Include type size in error message.
        (flexmems_t): New type.
        (field_nonempty_p, find_flexarrays, diagnose_flexarrays)
        (check_flexarrays): New functions.
        (finish_struct_1): Call check_flexarrays.
        * decl.c (compute_array_index_type): Distinguish flexible array
        members from zero-length arrays.
        (grokdeclarator): Reject flexible array members in unions.  Avoid
        rejecting members of incomplete types that are flexible array members.
        * error.c (dump_type_suffix): Handle flexible array members with null
        upper bound.
        * init.c (perform_member_init): Same.
        * pt.c (instantiate_class_template_1): Allow flexible array members.
        (tsubst): Handle flexible array members with null upper bound.
        * typeck2.c (digest_init_r): Warn for initialization of flexible
        array members.
        (process_init_constructor_record): Handle flexible array members.
...


Prior to GCC rejected the test case with:

pr85285.C: In instantiation of ‘union A<int []>::<anonymous>’:
pr85285.C:3:3:   required from ‘struct A<int []>’
pr85285.C:9:10:   required from here
pr85285.C:5:7: error: ‘A<T>::<anonymous union>::x’ has incomplete type
     T x;
       ^

pr85285.C:5:7: error: invalid use of array with unspecified bounds

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]