This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
RE: gcc 2.95/C: flexible array member as error, breaks ISO C
- To: "'Martin v. Loewis'" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Subject: RE: gcc 2.95/C: flexible array member as error, breaks ISO C
- From: "Fieldhouse, Dirk" <Fieldhouse at logica dot com>
- Date: Wed, 16 Feb 2000 19:41:42 -0000
- Cc: gcc-bugs at gcc dot gnu dot org
On 14 February 2000 22:43, Martin v. Loewis
[mailto:martin@loewis.home.cs.tu-berlin.de] wrote:
>
> DF> This seems to be a bug in gcc's ISO/ANSI C compliance.
>
> Thanks for your bug report. I believe this is a known bug, since this
> feature is new in C 99, right? Please have a look at
>
> http://gcc.gnu.org/c9xstatus.html
OK, that's just right. I thought this feature seemed novel.
However your proposed work-around is specifically prohibited at ISO 6.7.5.2
(constant array dimension must be > 0). I went for
#ifdef __GNUC__
ClnpT_MacIf mac_intf_tbl[1];
#else
ClnpT_MacIf mac_intf_tbl[];
#endif
This is fine except that an array bounds check might fail.
It looks as if the C99 array handling needs some work. I wish I had time to
help.
thanks
/df
> Flexible array members are currently missing in gcc; as a work-around,
> you can use array of zero length:
>
> typedef struct {
> int* srv_status_table;
> int* srv_pkid_table;
> int num_busy_srv;
> double q_cum_pks;
> double q_cum_bits;
> List* in_queue[15];
> int num_intf;
> } AcT_Clnp_Data;
>
> > Please contact me for any further details.
>
> Thanks; unless I misinterpreted your report, we don't need more
> details at the moment. Of course, if you are willing to provide a
> patch to add the missing feature - that would be much
> appreciated. Please send them to gcc-patches@gcc.gnu.org.
>
> Regards,
> Martin
>