This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Tests gcc.dg/c99-scope-2.c and gcc.c-torture/execute/align-1.c wrong?
- To: Hans-Peter Nilsson <hp at bitrange dot com>
- Subject: Re: Tests gcc.dg/c99-scope-2.c and gcc.c-torture/execute/align-1.c wrong?
- From: Geoff Keating <geoffk at geoffk dot org>
- Date: 30 Jul 2001 10:22:43 -0700
- CC: gcc at gcc dot gnu dot org
- References: <Pine.BSF.4.30.0107300454350.51787-100000@dair.pair.com>
Hans-Peter Nilsson <hp@bitrange.com> writes:
> gcc.dg/c99-scope-2.c assumes
> sizeof (struct {int a;}) < sizeof (struct {int a; int b;})
> and gcc.c-torture/execute/align-1.c assumes
> sizeof (struct {int a;}) == sizeof (int).
>
> I believe it is valid (though not necessarily reasonable) for a
> 64-bit port with 32-bit ints to give struct {int a;}) the same
> size as struct {int a; int b;}, in this case a multiple of 64
> bits.
Yes, this is valid. I'm not sure it'd be a good idea, though.
A compiler is less useful if
struct { char a[4]; }
does not have size 4, as it makes it hard to implement certain styles
of file and network I/O.
> Or is there a language issue?
>
> Yeah, I know; no need to set STRUCTURE_SIZE_BOUNDARY high when
> padding can fix the alignment. I'm not going to push this
> issue, but AFAICT the tests are incorrectly failing.
If the tests fail for your port because of this, it's better to submit
a patch to fix them (make it '<=' and '>=' respectively), unless you'd
rather change your port to remove the excess padding.
--
- Geoffrey Keating <geoffk@geoffk.org>