public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/20371] New: Some corner cases of MS bitfields don't work
@ 2005-03-07 21:53 amylaar at gcc dot gnu dot org
2005-03-07 22:00 ` [Bug middle-end/20371] " amylaar at gcc dot gnu dot org
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2005-03-07 21:53 UTC (permalink / raw)
To: gcc-bugs
See comments in patch
--
Summary: Some corner cases of MS bitfields don't work
Product: gcc
Version: 3.4.3
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P2
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: amylaar at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
OtherBugsDependingO 17652
nThis:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20371
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/20371] Some corner cases of MS bitfields don't work
2005-03-07 21:53 [Bug middle-end/20371] New: Some corner cases of MS bitfields don't work amylaar at gcc dot gnu dot org
@ 2005-03-07 22:00 ` amylaar at gcc dot gnu dot org
2005-04-12 14:32 ` cvs-commit at gcc dot gnu dot org
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2005-03-07 22:00 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From amylaar at gcc dot gnu dot org 2005-03-07 22:00 -------
An analysis and a patch is here:
http://gcc.gnu.org/ml/gcc-patches/2004-12/msg00298.html
This patch has been used in the meantime in a 3.4 based compiler to
compile various software like Linux kernels etc.
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20371
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/20371] Some corner cases of MS bitfields don't work
2005-03-07 21:53 [Bug middle-end/20371] New: Some corner cases of MS bitfields don't work amylaar at gcc dot gnu dot org
2005-03-07 22:00 ` [Bug middle-end/20371] " amylaar at gcc dot gnu dot org
@ 2005-04-12 14:32 ` cvs-commit at gcc dot gnu dot org
2005-04-12 17:42 ` pinskia at gcc dot gnu dot org
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-04-12 14:32 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-04-12 14:32 -------
Subject: Bug 20371
CVSROOT: /cvs/gcc
Module name: gcc
Branch: sh-elf-4_1-branch
Changes by: amylaar@gcc.gnu.org 2005-04-12 14:32:06
Modified files:
gcc : ChangeLog stor-layout.c
Log message:
PR middle-end/20371:
* stor-layout.c (place_field): Don't adjust rli->bitpos at the end
of an MS bitfield run if we already adjusted bitpos/offset for an
alignment as large or larger than the bitfield type size.
Also set rli->remaining_in_alignment when we reset rli->prev_field.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=sh-elf-4_1-branch&r1=2.8142.2.4&r2=2.8142.2.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/stor-layout.c.diff?cvsroot=gcc&only_with_tag=sh-elf-4_1-branch&r1=1.228&r2=1.228.2.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20371
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/20371] Some corner cases of MS bitfields don't work
2005-03-07 21:53 [Bug middle-end/20371] New: Some corner cases of MS bitfields don't work amylaar at gcc dot gnu dot org
2005-03-07 22:00 ` [Bug middle-end/20371] " amylaar at gcc dot gnu dot org
2005-04-12 14:32 ` cvs-commit at gcc dot gnu dot org
@ 2005-04-12 17:42 ` pinskia at gcc dot gnu dot org
2005-04-12 18:31 ` amylaar at gcc dot gnu dot org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-12 17:42 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
OtherBugsDependingO|17652 |
nThis| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20371
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/20371] Some corner cases of MS bitfields don't work
2005-03-07 21:53 [Bug middle-end/20371] New: Some corner cases of MS bitfields don't work amylaar at gcc dot gnu dot org
` (2 preceding siblings ...)
2005-04-12 17:42 ` pinskia at gcc dot gnu dot org
@ 2005-04-12 18:31 ` amylaar at gcc dot gnu dot org
2005-04-15 15:32 ` amylaar at gcc dot gnu dot org
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2005-04-12 18:31 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From amylaar at gcc dot gnu dot org 2005-04-12 18:31 -------
The patch was posted on the 3rd December 2004, well before the
25th Febuary 2005.
--
What |Removed |Added
----------------------------------------------------------------------------
OtherBugsDependingO| |17652
nThis| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20371
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/20371] Some corner cases of MS bitfields don't work
2005-03-07 21:53 [Bug middle-end/20371] New: Some corner cases of MS bitfields don't work amylaar at gcc dot gnu dot org
` (3 preceding siblings ...)
2005-04-12 18:31 ` amylaar at gcc dot gnu dot org
@ 2005-04-15 15:32 ` amylaar at gcc dot gnu dot org
2005-04-15 22:21 ` amylaar at gcc dot gnu dot org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2005-04-15 15:32 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From amylaar at gcc dot gnu dot org 2005-04-15 15:32 -------
Created an attachment (id=8650)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8650&action=view)
Additional testcase
This is another testlet snipped out of gcc-dg-struct-layout-1-t026-01.
With the original patch, in struct S2503 field d overlaps field b,
and hence the store goes into the wrong place.
The idea of putting packed bit fields into rli->prev_field is bogus to
start with. These fields are not necesasrily aligned like the underlying type,
and packed fields are not supposed to place more restrictions on the placement
of surrounding fields than ordinary non-bitfield types. E.g. a packed
long long bitfield of size 8 is not expected to reserve more space than a
char field, even if it is followed by a non-packed bitfield of a different
type.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20371
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/20371] Some corner cases of MS bitfields don't work
2005-03-07 21:53 [Bug middle-end/20371] New: Some corner cases of MS bitfields don't work amylaar at gcc dot gnu dot org
` (4 preceding siblings ...)
2005-04-15 15:32 ` amylaar at gcc dot gnu dot org
@ 2005-04-15 22:21 ` amylaar at gcc dot gnu dot org
2005-04-29 19:58 ` amylaar at gcc dot gnu dot org
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2005-04-15 22:21 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From amylaar at gcc dot gnu dot org 2005-04-15 22:21 -------
Created an attachment (id=8651)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8651&action=view)
I'm currently testing this patch.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20371
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/20371] Some corner cases of MS bitfields don't work
2005-03-07 21:53 [Bug middle-end/20371] New: Some corner cases of MS bitfields don't work amylaar at gcc dot gnu dot org
` (5 preceding siblings ...)
2005-04-15 22:21 ` amylaar at gcc dot gnu dot org
@ 2005-04-29 19:58 ` amylaar at gcc dot gnu dot org
2005-05-04 21:51 ` cvs-commit at gcc dot gnu dot org
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2005-04-29 19:58 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From amylaar at gcc dot gnu dot org 2005-04-29 19:58 -------
Created an attachment (id=8766)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8766&action=view)
This patch fixes some more alignment inconsistencies.
--
What |Removed |Added
----------------------------------------------------------------------------
Attachment #8651 is|0 |1
obsolete| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20371
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/20371] Some corner cases of MS bitfields don't work
2005-03-07 21:53 [Bug middle-end/20371] New: Some corner cases of MS bitfields don't work amylaar at gcc dot gnu dot org
` (6 preceding siblings ...)
2005-04-29 19:58 ` amylaar at gcc dot gnu dot org
@ 2005-05-04 21:51 ` cvs-commit at gcc dot gnu dot org
2005-05-04 21:54 ` amylaar at gcc dot gnu dot org
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-05-04 21:51 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-05-04 21:51 -------
Subject: Bug 20371
CVSROOT: /cvs/gcc
Module name: gcc
Branch: sh-elf-4_1-branch
Changes by: amylaar@gcc.gnu.org 2005-05-04 21:51:35
Modified files:
gcc : ChangeLog tree.h stor-layout.c
Log message:
PR middle-end/20371:
* tree.h (record_layout_info_s): New member prev_packed.
* stor-layout.c (update_alignment_for_field): Fix comment about
KNOWN_ALIGN. For MS bitfields, if we start a new run, make sure
we start it properly aligned.
(place_field): At the beginning of a record, pass 0 as KNOWN_ALIGN
to update_alignment_for_field, and recompute it afterwards using
the alignment of the record.
When a packed bitfield precedes an MS bitfield, don't add padding
at the end of the packed bitfield on behalf of the base type of
the packed bit field.
Take possible record alignment > BIGGEST_ALIGNMENT into account
when calculating actual_align.
Only put packed bit fields into rli->prev_field if they end up
suitably aligned.
Update rli->remaining_in_alignment when we have already started a
run of bit fields and we process a packed bit field.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=sh-elf-4_1-branch&r1=2.8142.2.8&r2=2.8142.2.9
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.h.diff?cvsroot=gcc&only_with_tag=sh-elf-4_1-branch&r1=1.709&r2=1.709.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/stor-layout.c.diff?cvsroot=gcc&only_with_tag=sh-elf-4_1-branch&r1=1.228.2.1&r2=1.228.2.2
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20371
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/20371] Some corner cases of MS bitfields don't work
2005-03-07 21:53 [Bug middle-end/20371] New: Some corner cases of MS bitfields don't work amylaar at gcc dot gnu dot org
` (7 preceding siblings ...)
2005-05-04 21:51 ` cvs-commit at gcc dot gnu dot org
@ 2005-05-04 21:54 ` amylaar at gcc dot gnu dot org
2005-05-11 12:25 ` cvs-commit at gcc dot gnu dot org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2005-05-04 21:54 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From amylaar at gcc dot gnu dot org 2005-05-04 21:54 -------
I have found more problems with the ms bitfield code. An
amended patch is here:
http://gcc.gnu.org/ml/gcc-patches/2005-05/msg00339.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20371
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/20371] Some corner cases of MS bitfields don't work
2005-03-07 21:53 [Bug middle-end/20371] New: Some corner cases of MS bitfields don't work amylaar at gcc dot gnu dot org
` (8 preceding siblings ...)
2005-05-04 21:54 ` amylaar at gcc dot gnu dot org
@ 2005-05-11 12:25 ` cvs-commit at gcc dot gnu dot org
2005-05-11 13:19 ` amylaar at gcc dot gnu dot org
2005-06-05 7:47 ` pinskia at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-05-11 12:25 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-05-11 12:25 -------
Subject: Bug 20371
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: amylaar@gcc.gnu.org 2005-05-11 12:24:50
Modified files:
gcc : ChangeLog stor-layout.c tree.h
Log message:
PR middle-end/20371:
* tree.h (record_layout_info_s): New member prev_packed.
* stor-layout.c (update_alignment_for_field): Fix comment about
KNOWN_ALIGN. For MS bitfields, if we start a new run, make sure
we start it properly aligned.
(place_field): At the beginning of a record, pass 0 as KNOWN_ALIGN
to update_alignment_for_field, and recompute it afterwards using
the alignment of the record.
When a packed bitfield precedes an MS bitfield, don't add padding
at the end of the packed bitfield on behalf of the base type of
the packed bit field.
Don't adjust rli->bitpos at the end
of an MS bitfield run if we already adjusted bitpos/offset for an
alignment as large or larger than the bitfield type size.
Take possible record alignment > BIGGEST_ALIGNMENT into account
when calculating actual_align.
Only put packed buit fields into rli->prev_field if they end up
suitably aligned.
Also set rli->remaining_in_alignment when we re-set rli->prev_field.
Update rli->remaining_in_alignment when we have already started a
run of bit fields and we process a packed bit field.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8728&r2=2.8729
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/stor-layout.c.diff?cvsroot=gcc&r1=1.230&r2=1.231
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.h.diff?cvsroot=gcc&r1=1.725&r2=1.726
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20371
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/20371] Some corner cases of MS bitfields don't work
2005-03-07 21:53 [Bug middle-end/20371] New: Some corner cases of MS bitfields don't work amylaar at gcc dot gnu dot org
` (9 preceding siblings ...)
2005-05-11 12:25 ` cvs-commit at gcc dot gnu dot org
@ 2005-05-11 13:19 ` amylaar at gcc dot gnu dot org
2005-06-05 7:47 ` pinskia at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2005-05-11 13:19 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From amylaar at gcc dot gnu dot org 2005-05-11 13:19 -------
Fixed on mainline by patch applied today.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20371
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/20371] Some corner cases of MS bitfields don't work
2005-03-07 21:53 [Bug middle-end/20371] New: Some corner cases of MS bitfields don't work amylaar at gcc dot gnu dot org
` (10 preceding siblings ...)
2005-05-11 13:19 ` amylaar at gcc dot gnu dot org
@ 2005-06-05 7:47 ` pinskia at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-05 7:47 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.1.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20371
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2005-06-05 7:47 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-07 21:53 [Bug middle-end/20371] New: Some corner cases of MS bitfields don't work amylaar at gcc dot gnu dot org
2005-03-07 22:00 ` [Bug middle-end/20371] " amylaar at gcc dot gnu dot org
2005-04-12 14:32 ` cvs-commit at gcc dot gnu dot org
2005-04-12 17:42 ` pinskia at gcc dot gnu dot org
2005-04-12 18:31 ` amylaar at gcc dot gnu dot org
2005-04-15 15:32 ` amylaar at gcc dot gnu dot org
2005-04-15 22:21 ` amylaar at gcc dot gnu dot org
2005-04-29 19:58 ` amylaar at gcc dot gnu dot org
2005-05-04 21:51 ` cvs-commit at gcc dot gnu dot org
2005-05-04 21:54 ` amylaar at gcc dot gnu dot org
2005-05-11 12:25 ` cvs-commit at gcc dot gnu dot org
2005-05-11 13:19 ` amylaar at gcc dot gnu dot org
2005-06-05 7:47 ` pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).