SIGBUS on ( double * )

BogDan Vatra taipanromania at gmail.com
Thu Oct 24 11:36:31 UTC 2013


Hi Marco,

On intel is ok to access unaligned memory, but not on ARM, I always
use memcpy to be 100% sure it works.
I have no idea if  -malign-double will fix your problem, you can try
it but ... IMHO using memcpy is the safest way.

Cheers,
BogDan.

2013/10/23 Marco Bernasocchi <marco at bernawebdesign.ch>:
> Hi Bogdan, thanks for the quick response. So I was dreaming about the fact
> that it used to work? and that it might be a compiler flag?
>
> so is my only option memcpy? here [0] they talk about -malign-double, could
> it be of any help?
>
> ciao and thanks a lot
> Marco
>
> [0]
> http://software.intel.com/en-us/blogs/2011/08/18/understanding-x86-vs-arm-memory-alignment-on-android
>
>
> On 10/23/2013 07:32 PM, BogDan Vatra wrote:
>>
>> Hi,
>>
>> It happens because you are trying to access unaligned memory which on arm
>> is not allowed.
>>
>> Cheers,
>> BogDan.
>> Pe 23.10.2013 20:12, "Marco Bernasocchi" <marco at bernawebdesign.ch> a
>> scris:
>>
>>> Hi all, I often get SIGBUS when my code (qgis.org) hits stuff like this:
>>>
>>> GEOSCoordSeq_getX( cs, j, ( double * )&mGeometry[position] );
>>>
>>> if I change the call to use memcpy like
>>>
>>> double a;
>>> memcpy( a, &mGeometry[position])
>>> GEOSCoordSeq_getX( cs, j, &a )
>>>
>>> then all works correctly, the issue is that I've a lot of those calls and
>>> If I'm not wrong in the past it used to work). could this be because of a
>>> compiler setting? I'm using necessitas Qt sdk with ndk r8b1 compiling
>>> both
>>> with -mthumb and without has the same issue.
>>>
>>> thanks a lot
>>> Marco
>>> --
>>> Marco Bernasocchi
>>> http://opengis.ch
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "android-qt" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to
>>> android-qt+unsubscribe@**googlegroups.com<android-qt%2Bunsubscribe at googlegroups.com>
>>> .
>>> For more options, visit
>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>> .
>>>
>>
>
>
> --
> Marco Bernasocchi
> http://opengis.ch


More information about the Necessitas-devel mailing list