[
https://issues.apache.org/jira/browse/QPID-5129?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13764655#comment-13764655
]
Steve Huston commented on QPID-5129:
------------------------------------
Yes, it defeats an important check. If the alignment really is ok, and you know
it always will be, you can safely do it.
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0360f/CDFEJCBH.html
I worked on a separate project that dealt with ARM and spent a fair amount of
time writing code to avoid this problem. I didn't read the Qpid store code in
question, but if you know that you'll be properly aligned you can get away with
the cast. Better, though, if possible, is to define an overlay struct/union
instead of adding counts to pointers to avoid portability issues.
> Legacy store fails to compile on ARM due to alignment issues
> ------------------------------------------------------------
>
> Key: QPID-5129
> URL: https://issues.apache.org/jira/browse/QPID-5129
> Project: Qpid
> Issue Type: Bug
> Components: C++ Broker
> Affects Versions: 0.24
> Reporter: Darryl L. Pierce
> Assignee: Kim van der Riet
> Priority: Blocker
>
> When compiling on ARM (ARM hfp) the following occurs:
> {noformat}
> [ 85%] Building CXX object
> src/CMakeFiles/legacystore.dir/qpid/legacystore/jrnl/deq_rec.o
> cd /builddir/build/BUILD/qpid-0.24/cpp/src && /usr/bin/c++
> -DXQ_EFFECTIVE_BOOLEAN_VALUE_HPP -D_IN_QPID_BROKER -Dlegacystore_EXPORTS -O2
> -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong
> --param=ssp-buffer-size=4 -grecord-gcc-switches -march=armv7-a
> -mfpu=vfpv3-d16 -mfloat-abi=hard -fvisibility-inlines-hidden -Werror
> -pedantic -Wall -Wextra -Wno-shadow -Wpointer-arith -Wcast-qual -Wcast-align
> -Wno-long-long -Wvolatile-register-var -Winvalid-pch -Wno-system-headers
> -Woverloaded-virtual -fPIC -I/builddir/build/BUILD/qpid-0.24/cpp/src
> -I/builddir/build/BUILD/qpid-0.24/cpp/src/../include
> -I/builddir/build/BUILD/qpid-0.24/cpp/src/qpid/legacystore -pthread -o
> CMakeFiles/legacystore.dir/qpid/legacystore/jrnl/deq_rec.o -c
> /builddir/build/BUILD/qpid-0.24/cpp/src/qpid/legacystore/jrnl/deq_rec.cpp
> /builddir/build/BUILD/qpid-0.24/cpp/src/qpid/legacystore/jrnl/deq_rec.cpp: In
> member function 'virtual u_int32_t
> mrg::journal::deq_rec::decode(mrg::journal::rec_hdr&, void*, u_int32_t,
> u_int32_t)':
> /builddir/build/BUILD/qpid-0.24/cpp/src/qpid/legacystore/jrnl/deq_rec.cpp:273:63:
> error: cast from 'char*' to 'u_int64_t* {aka long long unsigned int*}'
> increases required alignment of target type [-Werror=cast-align]
> _deq_hdr._deq_rid = *(u_int64_t*)((char*)rptr + rd_cnt);
> ^
> /builddir/build/BUILD/qpid-0.24/cpp/src/qpid/legacystore/jrnl/deq_rec.cpp:278:65:
> error: cast from 'char*' to 'std::size_t* {aka unsigned int*}' increases
> required alignment of target type [-Werror=cast-align]
> _deq_hdr._xidsize = *(std::size_t*)((char*)rptr + rd_cnt);
> ^
> cc1plus: all warnings being treated as errors
> make[2]: Leaving directory `/builddir/build/BUILD/qpid-0.24/cpp'
> make[2]: *** [src/CMakeFiles/legacystore.dir/qpid/legacystore/jrnl/deq_rec.o]
> Error 1
> make[1]: *** [src/CMakeFiles/legacystore.dir/all] Error 2
> {noformat}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]