https://bugs.linaro.org/show_bug.cgi?id=1389

            Bug ID: 1389
           Summary: Static assertion on tick_buf_t in timer.c
           Product: OpenDataPlane
           Version: 1.0
          Hardware: Other
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: ---
         Component: Timers
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]

Overview: More detailed restatement of summary.
While building ODP(v1.0.0) encountered an assertion on the size of tick_buf_t
in timer.c.

Steps to Reproduce: Minimized, easy-to-follow steps that will trigger the bug.
Include any special setup steps.
1. Do a native build of ODP on a board which does not support atomic 64bit ops. 


Actual Results: 
Build failed due to an assertion failure.
Expected Results: 
build successfully
Additional Information:

The structure is

typedef struct tick_buf_s {
         odp_atomic_u64_t exp_tck;/* Expiration tick or TMO_xxx */
         odp_buffer_t tmo_buf;/* ODP_BUFFER_INVALID if timer not active */
 #ifdef TB_NEEDS_PAD
         uint32_t pad;/* Need to be able to access padding for successful CAS
*/
 #endif
 } tick_buf_t
 #ifdef ODP_ATOMIC_U128
 ODP_ALIGNED(16) /* 16-byte atomic operations need properly aligned addresses
*/ 
;
_ODP_STATIC_ASSERT(sizeof(tick_buf_t) == 16, "sizeof(tick_buf_t) == 16");


odp_atomic_u64_t is of type struct odp_atomic_u64_s

struct odp_atomic_u64_s {
        uint64_t v; /**< Actual storage for the atomic variable */
#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2
        /* Some architectures do not support lock-free operations on 64-bit
         * data types. We use a spin lock to ensure atomicity. */
        char lock; /**< Spin lock (if needed) used to ensure atomic access */
#endif
} ODP_ALIGNED(sizeof(uint64_t)); /* Enforce alignement! */;

So the systems which cannot do atomic 64 bit operations will have lock variable
defined which increases the size of the that structure odp_atomic_u64_s to 16
bytes due to the alignment requirements and the assertion fails since
tick_buf_s has two more variables increasing its size to 24 bytes.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to