Commit 39d67d5b by J"orn Rennecke Committed by Joern Rennecke

re PR middle-end/23467 (alignment of member doesn't always carry over to alignment of struct.)

gcc:
        PR middle-end/23467
        * stor-layout.c (finalize_type_size): Dont override
        existing alignment with a smaller alignment from the mode.
testsuite:
        PR middle-end/23467
        * gcc.c-torture/execute/pr23467.c: New test.

From-SVN: r103394
parent 9191d641
2005-08-23 J"orn Rennecke <joern.rennecke@st.com>
PR middle-end/23467
* stor-layout.c (finalize_type_size): Dont override
existing alignment with a smaller alignment from the mode.
2005-08-23 Sebastian Pop <pop@cri.ensmp.fr> 2005-08-23 Sebastian Pop <pop@cri.ensmp.fr>
* lambda-code.c (lambda_vector_lexico_pos): Moved... * lambda-code.c (lambda_vector_lexico_pos): Moved...
......
...@@ -1407,8 +1407,15 @@ finalize_type_size (tree type) ...@@ -1407,8 +1407,15 @@ finalize_type_size (tree type)
&& TREE_CODE (type) != QUAL_UNION_TYPE && TREE_CODE (type) != QUAL_UNION_TYPE
&& TREE_CODE (type) != ARRAY_TYPE))) && TREE_CODE (type) != ARRAY_TYPE)))
{ {
TYPE_ALIGN (type) = GET_MODE_ALIGNMENT (TYPE_MODE (type)); unsigned mode_align = GET_MODE_ALIGNMENT (TYPE_MODE (type));
TYPE_USER_ALIGN (type) = 0;
/* Don't override a larger alignment requirement coming from a user
alignment of one of the fields. */
if (mode_align >= TYPE_ALIGN (type))
{
TYPE_ALIGN (type) = mode_align;
TYPE_USER_ALIGN (type) = 0;
}
} }
/* Do machine-dependent extra alignment. */ /* Do machine-dependent extra alignment. */
......
2005-08-23 J"orn Rennecke <joern.rennecke@st.com>
PR middle-end/23467
* gcc.c-torture/execute/pr23467.c: New test.
2005-08-23 Jakub Jelinek <jakub@redhat.com> 2005-08-23 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/22043 PR tree-optimization/22043
......
struct s1
{
int __attribute__ ((aligned (8))) a;
};
struct
{
char c;
struct s1 m;
} v;
int
main (void)
{
if ((int)&v.m & 7)
abort ();
exit (0);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment