QUESTION: strange behaviour of typedef enum and __attribute__((packed)) using sh-hms-g++ 3.0.3

William A. Gatliff bgat@billgatliff.com
Wed Dec 11 07:35:00 GMT 2002


Fabio:


What does this do (works fine on arm-elf gcc-3.2.1)?


   enum em_e {em_f1 = 0, em_f2, em_f3} __attribute__((packed));
   typedef enum em_e em_t;

   enum em_e e;
   em_t t;

   void foo(void)
   {
      e = em_f1;
      t = em_f2;
   }


[I'm suspicious of the C syntax for your declaration.]

Also: if gcc can express an enumeration in one byte, I think the
aligned(1) is redundant.  I would also expect misaligned allocations,
since the SH doesn't care about alignment for chars.


b.g.
-- 
Bill Gatliff
Do you do embedded GNU?  I do!
http://billgatliff.com

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com



More information about the crossgcc mailing list