[Mono-dev] NRE when using pointers on armhf

Slide slide.o.mix at gmail.com
Thu Mar 26 21:37:59 UTC 2015


Yes, I can tell that the pointer is unaligned, I was wondering why I would
get a NullReferenceException for an unaligned access. I would assume that
mono sets up some handler or something that catches unaligned exceptions?
Maybe not?

On Thu, Mar 26, 2015 at 2:23 PM Brandon Perry <bperry.volatile at gmail.com>
wrote:

> Could also cast to an IntPtr and check the Size property, which would
> return the number of bytes in the pointer?
>
>
> https://msdn.microsoft.com/en-us/library/system.intptr.size%28v=vs.110%29.aspx
>
> Might be misunderstanding the issue though.
>
> On Thu, Mar 26, 2015 at 4:20 PM, Zoltan Varga <vargaz at gmail.com> wrote:
>
>> Hi,
>>
>>   You can check whenever the pointer is aligned by converting it into an
>> int.
>>
>>              Zoltan
>>
>> On Thu, Mar 26, 2015 at 4:53 PM, Slide <slide.o.mix at gmail.com> wrote:
>>
>>> That's a good point! Can you tell me where in the mono code that the
>>> unaligned accesses are handled? I'd just like to confirm.
>>>
>>> Thanks!
>>>
>>> slide
>>>
>>> On Thu, Mar 26, 2015 at 1:13 PM Zoltan Varga <vargaz at gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>>  arm might require aligned reads, i.e. 'p' should be 4 byte aligned in
>>>> this case.
>>>>
>>>>           Zoltan
>>>>
>>>> On Thu, Mar 26, 2015 at 3:28 PM, Slide <slide.o.mix at gmail.com> wrote:
>>>>
>>>>> I am trying to compile and use the ZeroC Ice remoting library for
>>>>> armhf to run on my RaPi 2. The compilation goes fine, but when running the
>>>>> test suite I am getting a NullReferenceException on the pointer assignment
>>>>> in the following code:
>>>>>
>>>>> fixed(byte* p = &_bytes[_position])
>>>>> {
>>>>>     *((float*)p) = _valBytes.floatVal; // exception here
>>>>> }
>>>>>
>>>>> This same code works on x86_64, so I am assuming there is something
>>>>> that is missing in the armhf implementation.
>>>>>
>>>>> Is there something I can do to debug what might be missing and provide
>>>>> a patch? I've never done work on the mono runtime itself.
>>>>>
>>>>> Thanks,
>>>>>
>>>>> slide
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Mono-devel-list mailing list
>>>>> Mono-devel-list at lists.ximian.com
>>>>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>>>>
>>>>>
>>>>
>>
>> _______________________________________________
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>
>>
>
>
> --
> http://volatile-minds.blogspot.com -- blog
> http://www.volatileminds.net -- website
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20150326/50907f57/attachment.html>


More information about the Mono-devel-list mailing list