[RTEMS Project] #4013: Using the size of an object to deduce the alignment is broken on some architectures

RTEMS trac trac at rtems.org
Mon Jun 29 13:55:57 UTC 2020


#4013: Using the size of an object to deduce the alignment is broken on some
architectures
-----------------------------+------------------------------
 Reporter:  Sebastian Huber  |       Owner:  Sebastian Huber
     Type:  defect           |      Status:  assigned
 Priority:  normal           |   Milestone:  5.2
Component:  score            |     Version:  5
 Severity:  normal           |  Resolution:
 Keywords:                   |  Blocked By:
 Blocking:                   |
-----------------------------+------------------------------

Comment (by Sebastian Huber):

 On m68k I get for this test code
 {{{
 double d;
 int i;
 long long ll;
 }}}
 the following output
 {{{
 m68k-rtems5-gcc -S -O2 -o - test.c
 #NO_APP
         .file   "test.c"
         .text
         .globl  ll
         .section        .bss
         .align  2
         .type   ll, @object
         .size   ll, 8
 ll:
         .zero   8
         .globl  i
         .align  2
         .type   i, @object
         .size   i, 4
 i:
         .zero   4
         .globl  d
         .align  2
         .type   d, @object
         .size   d, 8
 d:
         .zero   8
         .ident  "GCC: (GNU) 10.1.0"
 }}}
 So, the alignment is 2 bytes for int, double, and long long. Also the GCC
 provides this:
 {{{
 #define __BIGGEST_ALIGNMENT__ 2
 }}}

 There is no RTEMS API to align the buffer memory to some RTEMS-defined
 boundary.

--
Ticket URL: <http://devel.rtems.org/ticket/4013#comment:8>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list