stor-layout.c (start_record_layout): maximum_field_alignment overrides STRUCTURE_SIZE_BOUNDARY.

2006-10-23  Paul Brook  <paul@codesourcery.com>

	gcc/
	* stor-layout.c (start_record_layout): maximum_field_alignment
	overrides STRUCTURE_SIZE_BOUNDARY.

	gcc/testsuite/
	* gcc.dg/pragma-pack-5.c: New test.

From-SVN: r117977
This commit is contained in:
Paul Brook 2006-10-23 16:36:51 +00:00 committed by Paul Brook
parent 6915c1cea2
commit 353293e7f7
4 changed files with 28 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2006-10-23 Paul Brook <paul@codesourcery.com>
* stor-layout.c (start_record_layout): maximum_field_alignment
overrides STRUCTURE_SIZE_BOUNDARY.
2006-10-23 Ulrich Weigand <uweigand@de.ibm.com>
* config/s390/predicates.md ("bras_sym_operand"): Do not accept

View File

@ -531,7 +531,15 @@ start_record_layout (tree t)
#ifdef STRUCTURE_SIZE_BOUNDARY
/* Packed structures don't need to have minimum size. */
if (! TYPE_PACKED (t))
rli->record_align = MAX (rli->record_align, (unsigned) STRUCTURE_SIZE_BOUNDARY);
{
unsigned tmp;
/* #pragma pack overrides STRUCTURE_SIZE_BOUNDARY. */
tmp = (unsigned) STRUCTURE_SIZE_BOUNDARY;
if (maximum_field_alignment != 0)
tmp = MIN (tmp, maximum_field_alignment);
rli->record_align = MAX (rli->record_align, tmp);
}
#endif
rli->offset = size_zero_node;

View File

@ -1,3 +1,7 @@
2006-10-23 Paul Brook <paul@codesourcery.com>
* gcc.dg/pragma-pack-5.c: New test.
2006-10-23 Ulrich Weigand <uweigand@de.ibm.com>
* g++.dg/other/s390-1.C: New testcase.

View File

@ -0,0 +1,10 @@
/* Check that pragma pack overrides STRUCTURE_SIZE_BOUNDARY. */
/* { dg-do compile } */
#pragma pack(1)
struct S
{
char a;
};
int test[sizeof(struct S) == 1 ? 1: -1];