This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: proposed testsuite entry. Re: new #pragma pack failure



  In message <20000910230622.A5931@rjlhome.sco.com>you write:
  > OK.  You talked me into it.  The following testcase will fail with the
  > current tree and will pass with Zack's patch above installed.  It will
  > also fail if pragma pack doesn't actually work.  
  > 
  > This is hardly general purpose code, but it should at least share my
  > pragma pack joys with many of my other IA32 brethren.  We could make it
  > a _better_ test as long as we're inclined to test IA32 only by testing
  > against struct sizes that we divinely known to be true instead of
  > testing only the relative sizes of the structs.
  > 
  > 
  > I propose installing this as gcc.dg/pragma-align.c:
  > 
  > 
  > /* Prove that HANDLE_SYSTEMV_PRAGMA alignment handling works somewhat. */
  > 
  > /* { dg-do compile { target i?86-*-linux* i?86-*-*bsd* i?86-*-sco3.2v5* } }
  >  */
  > 
  > struct {
  >         char one;
  >         long two;
  > } defaultalign;
  > 
  > #pragma pack(4)
  > struct {
  >         char one;
  >         long two;
  > } sixteen;
  > 
  > #pragma pack(1)
  > struct {
  >         char one;
  >         long two;
  > } two;
  > 
  > #pragma pack(2)
  > struct {
  >         char one;
  >         long two;
  > } three;
  > 
  > #pragma pack()
  > struct {
  >         char one;
  >         long two;
  > } resetalign;
  > 
  > main()
  > {
  >         if(sizeof(sixteen) < sizeof(defaultalign)) abort();
  >         if(sizeof(two) >= sizeof(defaultalign)) abort();
  >         if(sizeof(three) <= sizeof(two)) abort();
  >         if(sizeof(resetalign) != sizeof(defaultalign)) abort();
  > }
Looks good to me too.  Can you please install this new test?
THanks,
jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]