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]
Other format: [Raw text]

Re: s390{,x} ABI incompatibility between gcc 4.0 and 4.1


Jakub Jelinek wrote:

I have looked just at one failure, but maybe all of them are the same thing.
typedef char __attribute__((vector_size (16))) v16qi;
int i = __alignof__ (v16qi);

with GCC 4.0 sets i to 8 (s390{,x} have BIGGEST_ALIGNMENT 64), but
GCC 4.1 sets i to 16.
The changes that created this binary incompatibility are
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23467
I think.  layout_type sets TYPE_ALIGN to 128 bits (size of v16qi)
and in 4.0 and earlier finalize_type_size used to decrease the size
to GET_MODE_ALIGNMENT (TImode), which is 64 on s390{,x}.

Was this change intentional? If yes, I think it should be documented in 4.1
release notes, but I still hope it wasn't intentional.


No, it wasn't. The change was supposed to affect structures only.
As I understand the documentation ,the expected behaviour would be to limit the alignment
to BIGGEST_ALIGNMENT, unless the user has specified a larger alignment with the
aligned attribute.


One possible solution appears to be along the lines of
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/stor-layout.c.diff?cvsroot=gcc&r1=1.239&r2=1.240 ,
but with the comment changed to explain what we want to preserve now.


However, I think it is probably better to start out with the right alignment, by fix this code
in layout_type to take BIGGEST_ALIGNMENT into account:
case VECTOR_TYPE:
...
/* Always naturally align vectors. This prevents ABI changes
depending on whether or not native vector modes are supported. */
TYPE_ALIGN (type) = tree_low_cst (TYPE_SIZE (type), 0);





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