public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/27948]  New: MS -bitfield struct layout test fails
@ 2006-06-08  7:57 dannysmith at users dot sourceforge dot net
  2006-06-08 14:17 ` [Bug middle-end/27948] [4.2 Regression] " pinskia at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: dannysmith at users dot sourceforge dot net @ 2006-06-08  7:57 UTC (permalink / raw)
  To: gcc-bugs

Since this revision:

2006-06-04 Eric Christopher <echristo@apple.com>

        * stor-layout.c (start_record_layout): Initialize
remaining_in_alignment.
        (debug_rli): Output value for remaining_in_alignment.
        (update_alignment_for_field): Unconditionalize
        ms_bitfield_layout_p code. Handle non-bitfield fields. Remove
        extra alignment code.
        (place_field): Don't realign if ms_bitfield_layout_p. Unconditionalize
        ms_bitfield_layout_p code. Rewrite handling of structure fields.
        * tree.h (record_layout_info_s): Remove prev_packed.
        * doc/extend.texi (ms_struct): Add documentation of format.


The ms-bitfield test gcc.dg/bf-ms-layout.c fails.

In particular, the 0-size bitfield  in
struct six { 
  char a :8;
  int :0;       /* not ignored; prior field IS a bitfield, causes
                   struct alignment as well. */
  char b;
  char c;
} ;

is being ignored

I have reconfirmed that that the test does indeed pass with MS VC6 compiler.

Danny


-- 
           Summary: MS -bitfield struct layout test fails
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dannysmith at users dot sourceforge dot net
 GCC build triplet: i686-pc-mingw32
  GCC host triplet: i686-pc-mingw32
GCC target triplet: i686-pc-mingw32


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


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

* [Bug middle-end/27948] [4.2 Regression] MS -bitfield struct layout test fails
  2006-06-08  7:57 [Bug c/27948] New: MS -bitfield struct layout test fails dannysmith at users dot sourceforge dot net
@ 2006-06-08 14:17 ` pinskia at gcc dot gnu dot org
  2006-06-08 18:14 ` echristo at apple dot com
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-06-08 14:17 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |middle-end
           Keywords|                            |ABI, wrong-code
            Summary|MS -bitfield struct layout  |[4.2 Regression] MS -
                   |test fails                  |bitfield struct layout test
                   |                            |fails
   Target Milestone|---                         |4.2.0


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


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

* [Bug middle-end/27948] [4.2 Regression] MS -bitfield struct layout test fails
  2006-06-08  7:57 [Bug c/27948] New: MS -bitfield struct layout test fails dannysmith at users dot sourceforge dot net
  2006-06-08 14:17 ` [Bug middle-end/27948] [4.2 Regression] " pinskia at gcc dot gnu dot org
@ 2006-06-08 18:14 ` echristo at apple dot com
  2006-06-08 22:39 ` dannysmith at users dot sourceforge dot net
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: echristo at apple dot com @ 2006-06-08 18:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from echristo at apple dot com  2006-06-08 18:11 -------
Can you get me the size of that structure according to MS VC?


-- 


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


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

* [Bug middle-end/27948] [4.2 Regression] MS -bitfield struct layout test fails
  2006-06-08  7:57 [Bug c/27948] New: MS -bitfield struct layout test fails dannysmith at users dot sourceforge dot net
  2006-06-08 14:17 ` [Bug middle-end/27948] [4.2 Regression] " pinskia at gcc dot gnu dot org
  2006-06-08 18:14 ` echristo at apple dot com
@ 2006-06-08 22:39 ` dannysmith at users dot sourceforge dot net
  2006-06-08 22:40 ` echristo at apple dot com
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dannysmith at users dot sourceforge dot net @ 2006-06-08 22:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from dannysmith at users dot sourceforge dot net  2006-06-08 22:32 -------
(In reply to comment #1)
> Can you get me the size of that structure according to MS VC?

With version 12.00.8804 of MS cl.exe, sizeof (struct six) == 8, as  tested in
the testcase. 

Danny


-- 


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


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

* [Bug middle-end/27948] [4.2 Regression] MS -bitfield struct layout test fails
  2006-06-08  7:57 [Bug c/27948] New: MS -bitfield struct layout test fails dannysmith at users dot sourceforge dot net
                   ` (2 preceding siblings ...)
  2006-06-08 22:39 ` dannysmith at users dot sourceforge dot net
@ 2006-06-08 22:40 ` echristo at apple dot com
  2006-06-08 23:57 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: echristo at apple dot com @ 2006-06-08 22:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from echristo at apple dot com  2006-06-08 22:39 -------
Verified. Investigating. The alignment should be 8 from what I can see:

a -> 1st byte
int :0 -> align to 4th byte
b -> 5th byte
c -> 6th byte
align structure to 8th byte because of int :0.


-- 

echristo at apple dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |echristo at apple dot com
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-06-08 22:39:05
               date|                            |


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


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

* [Bug middle-end/27948] [4.2 Regression] MS -bitfield struct layout test fails
  2006-06-08  7:57 [Bug c/27948] New: MS -bitfield struct layout test fails dannysmith at users dot sourceforge dot net
                   ` (3 preceding siblings ...)
  2006-06-08 22:40 ` echristo at apple dot com
@ 2006-06-08 23:57 ` pinskia at gcc dot gnu dot org
  2006-06-08 23:58 ` echristo at apple dot com
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-06-08 23:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2006-06-08 23:47 -------
Can I also recommend that gcc.dg/bf-ms-layout.c (and all the ms struct layout
tests if there is another one) be changed to run on PPC-darwin and x86 with the
pragam's for ms_struct?


-- 


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


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

* [Bug middle-end/27948] [4.2 Regression] MS -bitfield struct layout test fails
  2006-06-08  7:57 [Bug c/27948] New: MS -bitfield struct layout test fails dannysmith at users dot sourceforge dot net
                   ` (4 preceding siblings ...)
  2006-06-08 23:57 ` pinskia at gcc dot gnu dot org
@ 2006-06-08 23:58 ` echristo at apple dot com
  2006-06-09  0:01 ` echristo at apple dot com
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: echristo at apple dot com @ 2006-06-08 23:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from echristo at apple dot com  2006-06-08 23:57 -------
FWIW btw, the edge case only occurs when the bitfield is the full length of the
array size.

Guh.


-- 


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


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

* [Bug middle-end/27948] [4.2 Regression] MS -bitfield struct layout test fails
  2006-06-08  7:57 [Bug c/27948] New: MS -bitfield struct layout test fails dannysmith at users dot sourceforge dot net
                   ` (5 preceding siblings ...)
  2006-06-08 23:58 ` echristo at apple dot com
@ 2006-06-09  0:01 ` echristo at apple dot com
  2006-06-09  4:48 ` echristo at apple dot com
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: echristo at apple dot com @ 2006-06-09  0:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from echristo at apple dot com  2006-06-09 00:00 -------
Think I've got a patch. testing.


-- 


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


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

* [Bug middle-end/27948] [4.2 Regression] MS -bitfield struct layout test fails
  2006-06-08  7:57 [Bug c/27948] New: MS -bitfield struct layout test fails dannysmith at users dot sourceforge dot net
                   ` (6 preceding siblings ...)
  2006-06-09  0:01 ` echristo at apple dot com
@ 2006-06-09  4:48 ` echristo at apple dot com
  2006-06-12  6:54 ` echristo at gcc dot gnu dot org
  2006-06-12  6:58 ` echristo at apple dot com
  9 siblings, 0 replies; 11+ messages in thread
From: echristo at apple dot com @ 2006-06-09  4:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from echristo at apple dot com  2006-06-09 01:12 -------
Confirmed. Patch appears to work. I'll submit it a bit later. Short, one liner.


-- 


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


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

* [Bug middle-end/27948] [4.2 Regression] MS -bitfield struct layout test fails
  2006-06-08  7:57 [Bug c/27948] New: MS -bitfield struct layout test fails dannysmith at users dot sourceforge dot net
                   ` (7 preceding siblings ...)
  2006-06-09  4:48 ` echristo at apple dot com
@ 2006-06-12  6:54 ` echristo at gcc dot gnu dot org
  2006-06-12  6:58 ` echristo at apple dot com
  9 siblings, 0 replies; 11+ messages in thread
From: echristo at gcc dot gnu dot org @ 2006-06-12  6:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from echristo at gcc dot gnu dot org  2006-06-12 06:53 -------
Subject: Bug 27948

Author: echristo
Date: Mon Jun 12 06:53:33 2006
New Revision: 114562

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114562
Log:
2006-06-11  Eric Christopher  <echristo@apple.com>

        PR middle-end/27948
        * stor-layout.c (place_field): Remove check for
        remaining_in_alignment when aligning at the end of a run.

2006-06-11  Eric Christopher  <echristo@apple.com>

        PR middle-end/27948
        * gcc.dg/bf-ms-layout.c: Run on darwin.
        * gcc.dg/bf-no-ms-layout: Ditto.
        * gcc.dg/attr-ms_struct-2.c: New.
        * gcc.dg/bf-ms-layout-2.c: Ditto.


Added:
    trunk/gcc/testsuite/gcc.dg/attr-ms_struct-2.c
    trunk/gcc/testsuite/gcc.dg/bf-ms-layout-2.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/stor-layout.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/bf-ms-layout.c
    trunk/gcc/testsuite/gcc.dg/bf-no-ms-layout.c


-- 


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


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

* [Bug middle-end/27948] [4.2 Regression] MS -bitfield struct layout test fails
  2006-06-08  7:57 [Bug c/27948] New: MS -bitfield struct layout test fails dannysmith at users dot sourceforge dot net
                   ` (8 preceding siblings ...)
  2006-06-12  6:54 ` echristo at gcc dot gnu dot org
@ 2006-06-12  6:58 ` echristo at apple dot com
  9 siblings, 0 replies; 11+ messages in thread
From: echristo at apple dot com @ 2006-06-12  6:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from echristo at apple dot com  2006-06-12 06:54 -------
2006-06-11  Eric Christopher  <echristo@apple.com>                              

        PR middle-end/27948                                                     
        * stor-layout.c (place_field): Remove check for                         
        remaining_in_alignment when aligning at the end of a run.

2006-06-11  Eric Christopher  <echristo@apple.com>                              

        PR middle-end/27948                                                     
        * gcc.dg/bf-ms-layout.c: Run on darwin.                                 
        * gcc.dg/bf-no-ms-layout: Ditto.                                        
        * gcc.dg/attr-ms_struct-2.c: New.                                       
        * gcc.dg/bf-ms-layout-2.c: Ditto.


-- 

echristo at apple dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2006-06-12  6:54 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-08  7:57 [Bug c/27948] New: MS -bitfield struct layout test fails dannysmith at users dot sourceforge dot net
2006-06-08 14:17 ` [Bug middle-end/27948] [4.2 Regression] " pinskia at gcc dot gnu dot org
2006-06-08 18:14 ` echristo at apple dot com
2006-06-08 22:39 ` dannysmith at users dot sourceforge dot net
2006-06-08 22:40 ` echristo at apple dot com
2006-06-08 23:57 ` pinskia at gcc dot gnu dot org
2006-06-08 23:58 ` echristo at apple dot com
2006-06-09  0:01 ` echristo at apple dot com
2006-06-09  4:48 ` echristo at apple dot com
2006-06-12  6:54 ` echristo at gcc dot gnu dot org
2006-06-12  6:58 ` echristo at apple dot com

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).