On 17 July 2015 at 17:09, Maxim Uvarov <[email protected]> wrote:
> On 07/17/15 17:54, Benoît Ganne wrote:
>>>
>>> in CI arm compilation fails. Looks like it came with gcc update. Any
>>> thought what happed with arm compiler?
>>
>>
>> Based on gcc message, my guess is that it does not like casting from
>> uint8_t* to uint32_t* because it could be a problem when you dereference the
>> pointer. If your platform does not support unaligned accesses, you're
>> screwed.
>> The portable way of fixing that is usually to use memcpy() (which should
>> be optimized by gcc builtins anyway), or to use packed structures casts
>> (which will lead gcc to generate the correct code for the platform).
>> I think ODP should have those accessors for potentially unaligned memory,
>> as in the Linux kernel:
>> http://www.cs.fsu.edu/~baker/devices/lxr/http/source/linux/include/linux/unaligned/packed_struct.h
>>
>> ben
>
>
> Accessors sounds like good idea.  I thought gcc will alight such things
> automatically. But if compilation in different modules than gcc can not know
> how to alight all the code. Yes in that case we should hit it which alight
> is needed.

gcc might not know data structures might cross byte boundaries.
It's not a compiler specific issue, and its not something gcc can help
with except warn about it.

So Benoît explanation seems spot on.

Cheers,
Anders

>
> Maxim.
>
>
>>
>>> static inline int verify_pmr_ipsec_spi(uint8_t *pkt_addr ODP_UNUSED,
>>>                         odp_packet_hdr_t *pkt_hdr ODP_UNUSED,
>>>                         pmr_term_value_t *term_value ODP_UNUSED)
>>> {
>>>      uint32_t *spi;
>>>
>>>      if (!pkt_hdr->input_flags.ipsec)
>>>          return 0;
>>>
>>>      spi = (uint32_t *)(pkt_addr + pkt_hdr->l4_offset);
>>>
>>> *11:30:42*  In file included from odp_classification.c:17:0:
>>> *11:30:42*  ./include/odp_classification_inlines.h: In function
>>> 'verify_pmr_ipsec_spi':
>>> *11:30:42*  ./include/odp_classification_inlines.h:197:8: error: cast
>>> increases required alignment of target type [-Werror=cast-align]
>>> *11:30:42*     spi = (uint32_t *)(pkt_addr + pkt_hdr->l4_offset);
>>> *11:30:42*           ^
>>>
>>> Thanks,
>>> Maxim.
>>>
>>> _______________________________________________
>>> lng-odp mailing list
>>> [email protected]
>>> https://lists.linaro.org/mailman/listinfo/lng-odp
>>
>>
>
> _______________________________________________
> lng-odp mailing list
>
> [email protected]
> https://lists.linaro.org/mailman/listinfo/lng-odp
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to