This is the mail archive of the gcc@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]

Re: Tests gcc.dg/c99-scope-2.c and gcc.c-torture/execute/align-1.c wrong?


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>


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