This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Fix display of array of unspecified length inside structures
- From: Pedro Alves <pedro at codesourcery dot com>
- To: "Pierre Muller" <pierre dot muller at ics-cnrs dot unistra dot fr>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 18 Feb 2011 15:24:45 +0000
- Subject: Re: [RFA] Fix display of array of unspecified length inside structures
- References: <00ac01cbcf5c$31f5bc00$95e13400$@muller@ics-cnrs.unistra.fr> <201102181147.52337.pedro@codesourcery.com> <00c301cbcf7b$afaa6d20$0eff4760$@muller@ics-cnrs.unistra.fr>
On Friday 18 February 2011 14:54:03, Pierre Muller wrote:
> > On Friday 18 February 2011 11:08:38, Pierre Muller wrote:
> >
> > > PS: It could be wise to add some test in the testsuite for
> > > this, but I have no idea where I could insert this kind of test,
> > > any ideas?
> >
> > Yes, please. We have surprisingly few tests for this sort of
> > thing, AFAICS. I'm not even sure this is a regression from
> > my recent changes, I think it may well not be.
>
> I checked out gdb version 7.2 shows this regression,
> as compared to Cygwin 6.8 at least...
> Which means that the regression is not really recent.
>
> This might means that we should also merge this patch to
> the branch, no?
Sound fine to me.
>
> > Zero-length arrays (as poor man's flexible arrays) are supported
> > in GNU C as an extension. To be portable, you'd
> > need to use an array of length 1 (or c99's real flexible arrays),
> > but that won't trigger the bug.
> Apparently there is also the flexible array member construct
> see
> http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Zero-Length.html
That just confirms what I said. :-) The flexible array
member construst is C99 only, so it's likely that other
compilers choke on it by default.
> > I'd point at printcmds.exp, but I'm not sure if there are compilers
> > out there that choke on the construct... There's always a
> > new test file option...
> >
> > > PS2: It is probably impossible to make such a test without
> > > alloca or some other memory allocation function, no?
> > > Are there any system restriction for this?
>
> There is a long check at start of gdb.base/funcargs.c
> but it might just be to really check that alloca really uses
> the stack...
Irk. Just use malloc then? It's not really crutial that
the test runs on all targets/hosts. As long as it runs
on the targets must people are developing on (GNU/Linux,Windows),
it's fine, we're reasonably well covered.
--
Pedro Alves