diff options
author | amylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-08-23 12:27:53 +0000 |
---|---|---|
committer | amylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-08-23 12:27:53 +0000 |
commit | 2fd8477885f6e126171141ad7d315bd8386a2629 (patch) | |
tree | efb0232bd620d3f2ac48704c6333162375b44560 /gcc/stor-layout.c | |
parent | a1db3a6a2a654de91b45ed6d648a1b588ab640f0 (diff) | |
download | gcc-2fd8477885f6e126171141ad7d315bd8386a2629.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103394 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r-- | gcc/stor-layout.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 321a4d24ca4..0ec818d7fbd 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -1407,8 +1407,15 @@ finalize_type_size (tree type) && TREE_CODE (type) != QUAL_UNION_TYPE && TREE_CODE (type) != ARRAY_TYPE))) { - TYPE_ALIGN (type) = GET_MODE_ALIGNMENT (TYPE_MODE (type)); - TYPE_USER_ALIGN (type) = 0; + unsigned mode_align = GET_MODE_ALIGNMENT (TYPE_MODE (type)); + + /* 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. */ |