public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/22275] New: bitfield layout change (regression?)
@ 2005-07-02  9:00 marcus at jet dot franken dot de
  2005-07-02  9:00 ` [Bug c/22275] " marcus at jet dot franken dot de
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: marcus at jet dot franken dot de @ 2005-07-02  9:00 UTC (permalink / raw)
  To: gcc-bugs

the following testcase is extracted from WINE. 
 
It is to some degree problematic because "BOOL" is a signed int, 
but we use 1 bit wide bitfields here. 
 
Also the ":0" might be a GNU extension. 
 
The problem is that with gcc 3.3.5: 
gcc -O2 -o xx xx.c ; ./xx 
<no output> 
 
but with gcc 4.1 branch: 
/home/marcus/projects/gcc/BIN/bin/gcc -O2 -march=i586 -mtune=i586   xx.c   -o 
xx; ./xx 
xx: xx.c:24: main: Assertion `sizeof(CABINETSTATE) == 8' failed. 
 
so the layout and final size of this struct changed.

-- 
           Summary: bitfield layout change (regression?)
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: marcus at jet dot franken dot de
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22275


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug c/22275] bitfield layout change (regression?)
  2005-07-02  9:00 [Bug c/22275] New: bitfield layout change (regression?) marcus at jet dot franken dot de
@ 2005-07-02  9:00 ` marcus at jet dot franken dot de
  2005-07-02 15:08 ` [Bug middle-end/22275] [3.4/4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 17+ messages in thread
From: marcus at jet dot franken dot de @ 2005-07-02  9:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From marcus at jet dot franken dot de  2005-07-02 09:00 -------
Created an attachment (id=9193)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9193&action=view)
xx.c

testcase extracted from WINE

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22275


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug middle-end/22275] [3.4/4.0/4.1 Regression] bitfield layout change (regression?)
  2005-07-02  9:00 [Bug c/22275] New: bitfield layout change (regression?) marcus at jet dot franken dot de
  2005-07-02  9:00 ` [Bug c/22275] " marcus at jet dot franken dot de
@ 2005-07-02 15:08 ` pinskia at gcc dot gnu dot org
  2005-07-22 21:16 ` pinskia at gcc dot gnu dot org
  2005-09-27 16:23 ` mmitchel at gcc dot gnu dot org
  3 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-02 15:08 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-02 15:08 -------
3.4.0 also fails on your test so it is not the bit-field changes in 4.0.0 which caused this.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
          Component|c                           |middle-end
           Keywords|                            |ABI
      Known to fail|                            |3.4.0 4.0.0 4.1.0
            Summary|bitfield layout change      |[3.4/4.0/4.1 Regression]
                   |(regression?)               |bitfield layout change
                   |                            |(regression?)
   Target Milestone|---                         |3.4.5


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22275


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug middle-end/22275] [3.4/4.0/4.1 Regression] bitfield layout change (regression?)
  2005-07-02  9:00 [Bug c/22275] New: bitfield layout change (regression?) marcus at jet dot franken dot de
  2005-07-02  9:00 ` [Bug c/22275] " marcus at jet dot franken dot de
  2005-07-02 15:08 ` [Bug middle-end/22275] [3.4/4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
@ 2005-07-22 21:16 ` pinskia at gcc dot gnu dot org
  2005-09-27 16:23 ` mmitchel at gcc dot gnu dot org
  3 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-22 21:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-22 21:13 -------
Moving to 4.0.2 pre Mark.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4.5                       |4.0.2


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22275


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug middle-end/22275] [3.4/4.0/4.1 Regression] bitfield layout change (regression?)
  2005-07-02  9:00 [Bug c/22275] New: bitfield layout change (regression?) marcus at jet dot franken dot de
                   ` (2 preceding siblings ...)
  2005-07-22 21:16 ` pinskia at gcc dot gnu dot org
@ 2005-09-27 16:23 ` mmitchel at gcc dot gnu dot org
  3 siblings, 0 replies; 17+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-09-27 16:23 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.2                       |4.0.3


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22275


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug middle-end/22275] [3.4/4.0/4.1 Regression] bitfield layout change (regression?)
       [not found] <bug-22275-3760@http.gcc.gnu.org/bugzilla/>
                   ` (10 preceding siblings ...)
  2005-11-05 19:56 ` pinskia at gcc dot gnu dot org
@ 2005-11-07 17:19 ` steven at gcc dot gnu dot org
  11 siblings, 0 replies; 17+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-11-07 17:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from steven at gcc dot gnu dot org  2005-11-07 17:19 -------
As an interesting data point: Intel's ICC 8.0 does what GCC 3.3 and earlier do,
but it seems that ICC 9.0 follow GCC 3.4 and later...


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22275


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug middle-end/22275] [3.4/4.0/4.1 Regression] bitfield layout change (regression?)
       [not found] <bug-22275-3760@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2005-11-01 16:57 ` pinskia at gcc dot gnu dot org
@ 2005-11-05 19:56 ` pinskia at gcc dot gnu dot org
  2005-11-07 17:19 ` steven at gcc dot gnu dot org
  11 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-11-05 19:56 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22275


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug middle-end/22275] [3.4/4.0/4.1 Regression] bitfield layout change (regression?)
       [not found] <bug-22275-3760@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2005-11-01 16:44 ` steven at gcc dot gnu dot org
@ 2005-11-01 16:57 ` pinskia at gcc dot gnu dot org
  2005-11-05 19:56 ` pinskia at gcc dot gnu dot org
  2005-11-07 17:19 ` steven at gcc dot gnu dot org
  11 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-11-01 16:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from pinskia at gcc dot gnu dot org  2005-11-01 16:57 -------
Related to PR 10145


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22275


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug middle-end/22275] [3.4/4.0/4.1 Regression] bitfield layout change (regression?)
       [not found] <bug-22275-3760@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2005-11-01 16:42 ` janis at gcc dot gnu dot org
@ 2005-11-01 16:44 ` steven at gcc dot gnu dot org
  2005-11-01 16:57 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-11-01 16:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from steven at gcc dot gnu dot org  2005-11-01 16:44 -------
The mail to gcc-patches for the patch identified in comment #11 is
http://gcc.gnu.org/ml/gcc-patches/2003-04/msg00209.html.


-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |steven at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22275


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug middle-end/22275] [3.4/4.0/4.1 Regression] bitfield layout change (regression?)
       [not found] <bug-22275-3760@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2005-10-31 23:14 ` steven at gcc dot gnu dot org
@ 2005-11-01 16:42 ` janis at gcc dot gnu dot org
  2005-11-01 16:44 ` steven at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: janis at gcc dot gnu dot org @ 2005-11-01 16:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from janis at gcc dot gnu dot org  2005-11-01 16:42 -------
A regression hunt identified the following patch:

r65207 | jason | 2003-04-03 18:23:04 +0000 (Thu, 03 Apr 2003) | 17 lines

        * stor-layout.c (do_type_align): New fn, split out from...
        (layout_decl): ...here.  Do all alignment calculations for
        FIELD_DECLs here.
        (update_alignment_for_field): Not here.
        (start_record_layout, debug_rli): Remove unpadded_align.
        * tree.h (struct record_layout_info_s): Remove unpadded_align.
        * c-decl.c (finish_enum): Don't set DECL_SIZE, DECL_ALIGN
        or DECL_MODE on the CONST_DECLs.
        (finish_struct): Don't mess with DECL_ALIGN.
        * cp/class.c (build_vtable): Set DECL_ALIGN here.
        (get_vtable_decl): Not here.
        (layout_vtable_decl): Or here.
        (create_vtable_ptr): Or here.
        (layout_class_type): Or here.
        (check_bitfield_decl): Don't mess with field alignment.
        * ada/misc.c (gnat_adjust_rli): #if 0.


-- 

janis at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22275


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug middle-end/22275] [3.4/4.0/4.1 Regression] bitfield layout change (regression?)
       [not found] <bug-22275-3760@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2005-10-31 23:02 ` pinskia at gcc dot gnu dot org
@ 2005-10-31 23:14 ` steven at gcc dot gnu dot org
  2005-11-01 16:42 ` janis at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-10-31 23:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from steven at gcc dot gnu dot org  2005-10-31 23:14 -------
I have asked Janis to reghunt this one.  The bug also affects ppc.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22275


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug middle-end/22275] [3.4/4.0/4.1 Regression] bitfield layout change (regression?)
       [not found] <bug-22275-3760@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2005-10-31 17:31 ` steven at gcc dot gnu dot org
@ 2005-10-31 23:02 ` pinskia at gcc dot gnu dot org
  2005-10-31 23:14 ` steven at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-31 23:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pinskia at gcc dot gnu dot org  2005-10-31 23:02 -------
Here is a compile time testcase for easier regression hunting:
typedef int BOOL;
typedef unsigned int UINT;

#pragma pack(1)

typedef struct {
    BOOL fFullPathTitle:1;
    BOOL fSaveLocalView:1;
    BOOL fNotShell:1;
    BOOL fSimpleDefault:1;
    BOOL fDontShowDescBar:1;
    BOOL fNewWindowMode:1;
    BOOL fShowCompColor:1;
    BOOL fDontPrettyNames:1;
    BOOL fAdminsCreateCommonGroups:1;
    UINT fUnusedFlags:7;
    UINT :0;
    UINT fMenuEnumFilter;
} CABINETSTATE;

int f[sizeof(CABINETSTATE) == 8? 1 : -1];


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22275


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug middle-end/22275] [3.4/4.0/4.1 Regression] bitfield layout change (regression?)
       [not found] <bug-22275-3760@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2005-10-31  7:44 ` mark at codesourcery dot com
@ 2005-10-31 17:31 ` steven at gcc dot gnu dot org
  2005-10-31 23:02 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-10-31 17:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from steven at gcc dot gnu dot org  2005-10-31 17:31 -------
Right, I didn't know this wasn't opened until July of this year, sorry.
I should have looked.

I still am not sure whether this does break a documented ABI.  Relevant
texts in C99 are 6.2.6.1 sub 4, and 6.7.2.1 sub 3.

The test case satisfies 6.7.2.1 sub 3, as far as I can tell:
"The expression that specifies the width of a bit-field shall be an
integer constant expression that has nonnegative value that shall not
exceed the number of bits in an object of the type that is specified
if the colon and expression are omitted. If the value is zero, the
declaration shall have no declarator."

Then, 6.2.6.1 sub 4 says:
"Values stored in bit-fields consist of m bits, where m is the size
specified for the bit-field.  The object representation is the set
of m bits the bit-field comprises in the addressable storage unit
holding it."

In our case, we have m==0.  As far as I can tell (but I'm not exactly
a C language lawyer ;-) the standard doesn't say anything about signed
or unsigned bit-fields.

So how should we interpret this...


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22275


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug middle-end/22275] [3.4/4.0/4.1 Regression] bitfield layout change (regression?)
       [not found] <bug-22275-3760@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2005-10-31  7:21 ` steven at gcc dot gnu dot org
@ 2005-10-31  7:44 ` mark at codesourcery dot com
  2005-10-31 17:31 ` steven at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: mark at codesourcery dot com @ 2005-10-31  7:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from mark at codesourcery dot com  2005-10-31 07:44 -------
Subject: Re:  [3.4/4.0/4.1 Regression] bitfield layout
 change (regression?)

steven at gcc dot gnu dot org wrote:
> ------- Comment #6 from steven at gcc dot gnu dot org  2005-10-31 07:21 -------
> This was not a show stopper for GCC 3.4 and GCC 4.0.  Why is it a show stopper
> now for GCC 4.1?
> 
> And we can't unconditionally change it back now.  We already have GCC 3.4 and
> 4.0 based compilers in production environments.

I suspect you didn't realize that the PR wasn't opened until July; I had
no knowledge of it when 3.4 or 4.0 were released.  If I had, I would
have declared it a showstopper then.

Now, it's a showstopper to figure out what happened and make an informed
decision.  If we conform to a published ABI where we did not before,
maybe we do nothing; this is a bug fix.  If we now fail to conform to a
published ABI, maybe we add a switch.  But, we certainly have to
evaluate it before the release.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22275


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug middle-end/22275] [3.4/4.0/4.1 Regression] bitfield layout change (regression?)
       [not found] <bug-22275-3760@http.gcc.gnu.org/bugzilla/>
  2005-10-17 15:09 ` steven at gcc dot gnu dot org
  2005-10-31  3:57 ` mmitchel at gcc dot gnu dot org
@ 2005-10-31  7:21 ` steven at gcc dot gnu dot org
  2005-10-31  7:44 ` mark at codesourcery dot com
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-10-31  7:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from steven at gcc dot gnu dot org  2005-10-31 07:21 -------
This was not a show stopper for GCC 3.4 and GCC 4.0.  Why is it a show stopper
now for GCC 4.1?

And we can't unconditionally change it back now.  We already have GCC 3.4 and
4.0 based compilers in production environments.


-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark at codesourcery dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22275


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug middle-end/22275] [3.4/4.0/4.1 Regression] bitfield layout change (regression?)
       [not found] <bug-22275-3760@http.gcc.gnu.org/bugzilla/>
  2005-10-17 15:09 ` steven at gcc dot gnu dot org
@ 2005-10-31  3:57 ` mmitchel at gcc dot gnu dot org
  2005-10-31  7:21 ` steven at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-10-31  3:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from mmitchel at gcc dot gnu dot org  2005-10-31 03:57 -------
This is a showstopper; we need to at least understand why this changed and
whether or not we should change it back.


-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P1


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22275


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug middle-end/22275] [3.4/4.0/4.1 Regression] bitfield layout change (regression?)
       [not found] <bug-22275-3760@http.gcc.gnu.org/bugzilla/>
@ 2005-10-17 15:09 ` steven at gcc dot gnu dot org
  2005-10-31  3:57 ` mmitchel at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-10-17 15:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from steven at gcc dot gnu dot org  2005-10-17 15:09 -------
If you add a line to the test case:

  printf ("%d\n", offsetof (CABINETSTATE, fMenuEnumFilter));

you get 2 for GCC 4.1, and 4 for GCC 3.3.

So this is definitely an ABI change.


-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-10-17 15:09:33
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22275


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2005-11-07 17:19 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-02  9:00 [Bug c/22275] New: bitfield layout change (regression?) marcus at jet dot franken dot de
2005-07-02  9:00 ` [Bug c/22275] " marcus at jet dot franken dot de
2005-07-02 15:08 ` [Bug middle-end/22275] [3.4/4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
2005-07-22 21:16 ` pinskia at gcc dot gnu dot org
2005-09-27 16:23 ` mmitchel at gcc dot gnu dot org
     [not found] <bug-22275-3760@http.gcc.gnu.org/bugzilla/>
2005-10-17 15:09 ` steven at gcc dot gnu dot org
2005-10-31  3:57 ` mmitchel at gcc dot gnu dot org
2005-10-31  7:21 ` steven at gcc dot gnu dot org
2005-10-31  7:44 ` mark at codesourcery dot com
2005-10-31 17:31 ` steven at gcc dot gnu dot org
2005-10-31 23:02 ` pinskia at gcc dot gnu dot org
2005-10-31 23:14 ` steven at gcc dot gnu dot org
2005-11-01 16:42 ` janis at gcc dot gnu dot org
2005-11-01 16:44 ` steven at gcc dot gnu dot org
2005-11-01 16:57 ` pinskia at gcc dot gnu dot org
2005-11-05 19:56 ` pinskia at gcc dot gnu dot org
2005-11-07 17:19 ` steven 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).