public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/55428] New: -mms-bitfields hides -mno-align-double option
@ 2012-11-21 14:43 kasberger at heidenhain dot de
  2012-11-21 15:21 ` [Bug c/55428] " mikpe at it dot uu.se
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: kasberger at heidenhain dot de @ 2012-11-21 14:43 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55428
           Summary: -mms-bitfields hides -mno-align-double option
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: kasberger@heidenhain.de


i686-pc-linux-gbu-gcc -mno-align-double -mms-bitfields test.cpp

("-mno-align-double" is the equivalent to /zp4)

This command line ignores the "-mno-align-double" option.
With -mno-align-double standalone it will do the correct double alignments but
no the ms bitfield alignment (What is expected)
If I add -mms-bitfields the alignment for bitfields will be correct but the
"-mno-align-double" is now gone

Here the program I have tested. Is it possible to achieve binary compatibility
to ms compiler with option /zp4 enabled


i686-pc-linux-gbu-gcc -mno-align-double -mms-bitfields test.cpp
test.cpp:48:58: warning: large integer implicitly truncated to unsigned type
[-Woverflow]
test.cpp:54:54: warning: large integer implicitly truncated to unsigned type
[-Woverflow]

i686-pc-linux-gbu-gcc -mno-align-double test.cpp
test.cpp:52:53: warning: large integer implicitly truncated to unsigned type
[-Woverflow]
test.cpp:58:53: warning: large integer implicitly truncated to unsigned type
[-Woverflow]

i686-pc-linux-gbu-gcc -mms-bitfields test.cpp
test.cpp:48:58: warning: large integer implicitly truncated to unsigned type
[-Woverflow]
test.cpp:54:54: warning: large integer implicitly truncated to unsigned type
[-Woverflow]



// 8
typedef struct _jhtest1 {
             unsigned long bf_1 : 12; 
             unsigned long : 0; 
             unsigned long bf_2 : 12; 
 } jhtest1;

//??
typedef struct _jhtest2 {
                  char foo : 4; 
                  short : 0; 
                  char bar; 
 } jhtest2;

//??
typedef struct _jhtest3 {
                 char foo : 4; 
                 short : 0; 
                 double bar; 
 } jhtest3;

//4
typedef struct _jhtest4 {
                    char foo : 6; 
                    long : 0; 
    } jhtest4;

// 2
typedef struct _jhtest5 {
                  char foo; 
                  long : 0; 
                  char bar; 
     } jhtest5;

typedef struct _jhtest {
    double xx;
    char y;
    double yy;
    long z;
} jhtest;



unsigned char jh_double = (sizeof (double) == 8 )?1:1111111;

unsigned char jh_test0 = (sizeof (jhtest) == (8*2+8) )?1:1111111;

unsigned char jh_test1 = (sizeof (jhtest1) == 8 )?1:1111111;

unsigned char jh_test2 = (sizeof (jhtest2) == 4 )?1:1111111;  // VC++

unsigned char jh_test3 = (sizeof (jhtest3) == 12 )?1:1111111;

unsigned char jh_test4 = (sizeof (jhtest4) == 4 )?1:1111111;

unsigned char jh_test5 = (sizeof (jhtest5) == 2 )?1:1111111; // VC++

int main()
{
}


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

end of thread, other threads:[~2023-07-07 10:29 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-21 14:43 [Bug c/55428] New: -mms-bitfields hides -mno-align-double option kasberger at heidenhain dot de
2012-11-21 15:21 ` [Bug c/55428] " mikpe at it dot uu.se
2012-11-21 15:30 ` ktietz at gcc dot gnu.org
2012-11-26  6:38 ` kasberger at heidenhain dot de
2012-11-26  7:22 ` kasberger at heidenhain dot de
2012-11-26  9:52 ` [Bug target/55428] " kasberger at heidenhain dot de
2012-11-29  9:21 ` kasberger at heidenhain dot de
2012-11-29  9:24 ` ktietz at gcc dot gnu.org
2022-01-10  8:21 ` [Bug target/55428] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
2022-01-17 15:21 ` rguenth at gcc dot gnu.org
2022-05-27  9:34 ` [Bug target/55428] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:30 ` jakub at gcc dot gnu.org
2023-07-07 10:29 ` [Bug target/55428] [11/12/13/14 " rguenth at gcc dot gnu.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).