Re: [racket-users] Re: Strange behaviour of ptr-ref + ptr-add(?)

2020-05-10 Thread Laurent
Awesome, thanks Matthew!

On Sun, May 10, 2020 at 2:05 PM Matthew Flatt  wrote:

> Although `_double*` isn't currently meant to be handled there ---
> there's no `ptr-ref/_double` specialization --- you're right that the
> problem is in the `ptr-ref/double` and similar specializations in CS.
>
> I've pushed a repair.
>
> Thanks for the report, Laurent!
>
> At Sun, 10 May 2020 13:57:50 +0200, Jens Axel Søgaard wrote:
> > I can confirm that the bug is present in the latest snapshot of Racket CS
> > on macOS.
> >
> > FWIW  _double* is missing in this list, but I am not sure it whether it
> is
> > supposed to be handled here.
> >
> https://github.com/racket/racket/blob/920c899ba866ce59a0387862286521e3cc1dabfb/
> > racket/src/schemify/ptr-ref-set.rkt#L46
> >
> > /Jens Axel
> >
> > Den søn. 10. maj 2020 kl. 10.51 skrev Laurent  >:
> >
> > > Correction:
> > > It's not Mac vs Linux, it's Racket BC (works) vs CS (doesn't work)
> > >
> > > On Sun, May 10, 2020 at 9:49 AM Laurent 
> wrote:
> > >
> > >> Hi all,
> > >>
> > >> We're trying to figure out why the last case below doesn't work on
> > >> Linux, but works on MacOS. Does anyone have an explanation?
> > >> The docs suggest that _double* shouldn't be different from _double for
> > >> _reading_ values.
> > >>
> > >> More precisely,
> > >>
> > >> #lang racket
> > >> (require ffi/unsafe)
> > >>
> > >> (define N 10)
> > >> (define pt (malloc N _double 'atomic-interior))
> > >> (for ([i (in-range N)])
> > >>   (ptr-set! pt _double* i (+ 2. i)))
> > >>
> > >> ;; works
> > >> (for/list ([i (in-range N)])
> > >>   (ptr-ref pt _double i))
> > >>
> > >> ;; works
> > >> (for/list ([i (in-range N)])
> > >>   (ptr-ref (ptr-add pt i _double) _double*))
> > >>
> > >> ;; doesn't work!
> > >> (for/list ([i (in-range N)])
> > >>   (ptr-ref (ptr-add pt i _double) _double))
> > >>
> > >> --
> > >> Output:
> > >> (2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0)
> > >> (2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0)
> > >> (2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0)
> > >>
> > >> --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Racket Users" group.
> > > To unsubscribe from this group and stop receiving emails from it, send
> an
> > > email to racket-users+unsubscr...@googlegroups.com.
> > > To view this discussion on the web visit
> > >
> >
> https://groups.google.com/d/msgid/racket-users/CABNTSaFmfgTpTrWzfcxL%2BxQCqtge5
> > Ls1eKW%2Bp0ftd%3D0q554ALg%40mail.gmail.com
> > >
> > <
> https://groups.google.com/d/msgid/racket-users/CABNTSaFmfgTpTrWzfcxL%2BxQCqtge
> > 5Ls1eKW%2Bp0ftd%3D0q554ALg%
> 40mail.gmail.com?utm_medium=email&utm_source=footer>
> > > .
> > >
> >
> >
> > --
> > --
> > Jens Axel Søgaard
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups
> > "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an
> > email to racket-users+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/racket-users/CABefVgzNsmOEx3LV%3DvmV--gu3UD6k
> > HZsRCfPQm0kn32Vo_ziKw%40mail.gmail.com.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/5eb7fc00.1c69fb81.a8f09.1621SMTPIN_ADDED_MISSING%40gmr-mx.google.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CABNTSaEvYoB%3DY8-NNLgD2GnHmcUXTqQhfS4drxgzFA%3D07Cuj-g%40mail.gmail.com.


Re: [racket-users] Re: Strange behaviour of ptr-ref + ptr-add(?)

2020-05-10 Thread Matthew Flatt
Although `_double*` isn't currently meant to be handled there ---
there's no `ptr-ref/_double` specialization --- you're right that the
problem is in the `ptr-ref/double` and similar specializations in CS.

I've pushed a repair.

Thanks for the report, Laurent!

At Sun, 10 May 2020 13:57:50 +0200, Jens Axel Søgaard wrote:
> I can confirm that the bug is present in the latest snapshot of Racket CS
> on macOS.
> 
> FWIW  _double* is missing in this list, but I am not sure it whether it is
> supposed to be handled here.
> https://github.com/racket/racket/blob/920c899ba866ce59a0387862286521e3cc1dabfb/
> racket/src/schemify/ptr-ref-set.rkt#L46
> 
> /Jens Axel
> 
> Den søn. 10. maj 2020 kl. 10.51 skrev Laurent :
> 
> > Correction:
> > It's not Mac vs Linux, it's Racket BC (works) vs CS (doesn't work)
> >
> > On Sun, May 10, 2020 at 9:49 AM Laurent  wrote:
> >
> >> Hi all,
> >>
> >> We're trying to figure out why the last case below doesn't work on
> >> Linux, but works on MacOS. Does anyone have an explanation?
> >> The docs suggest that _double* shouldn't be different from _double for
> >> _reading_ values.
> >>
> >> More precisely,
> >>
> >> #lang racket
> >> (require ffi/unsafe)
> >>
> >> (define N 10)
> >> (define pt (malloc N _double 'atomic-interior))
> >> (for ([i (in-range N)])
> >>   (ptr-set! pt _double* i (+ 2. i)))
> >>
> >> ;; works
> >> (for/list ([i (in-range N)])
> >>   (ptr-ref pt _double i))
> >>
> >> ;; works
> >> (for/list ([i (in-range N)])
> >>   (ptr-ref (ptr-add pt i _double) _double*))
> >>
> >> ;; doesn't work!
> >> (for/list ([i (in-range N)])
> >>   (ptr-ref (ptr-add pt i _double) _double))
> >>
> >> --
> >> Output:
> >> (2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0)
> >> (2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0)
> >> (2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0)
> >>
> >> --
> > You received this message because you are subscribed to the Google Groups
> > "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to racket-users+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit
> > 
> https://groups.google.com/d/msgid/racket-users/CABNTSaFmfgTpTrWzfcxL%2BxQCqtge5
> Ls1eKW%2Bp0ftd%3D0q554ALg%40mail.gmail.com
> > 
>  5Ls1eKW%2Bp0ftd%3D0q554ALg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> > .
> >
> 
> 
> -- 
> -- 
> Jens Axel Søgaard
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CABefVgzNsmOEx3LV%3DvmV--gu3UD6k
> HZsRCfPQm0kn32Vo_ziKw%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/5eb7fc00.1c69fb81.a8f09.1621SMTPIN_ADDED_MISSING%40gmr-mx.google.com.


Re: [racket-users] Re: Strange behaviour of ptr-ref + ptr-add(?)

2020-05-10 Thread Laurent
Bug report here:
https://github.com/racket/racket/issues/3173

On Sun, May 10, 2020 at 12:58 PM Jens Axel Søgaard 
wrote:

> I can confirm that the bug is present in the latest snapshot of Racket CS
> on macOS.
>
> FWIW  _double* is missing in this list, but I am not sure it whether it is
> supposed to be handled here.
>
> https://github.com/racket/racket/blob/920c899ba866ce59a0387862286521e3cc1dabfb/racket/src/schemify/ptr-ref-set.rkt#L46
>
> /Jens Axel
>
> Den søn. 10. maj 2020 kl. 10.51 skrev Laurent :
>
>> Correction:
>> It's not Mac vs Linux, it's Racket BC (works) vs CS (doesn't work)
>>
>> On Sun, May 10, 2020 at 9:49 AM Laurent  wrote:
>>
>>> Hi all,
>>>
>>> We're trying to figure out why the last case below doesn't work on
>>> Linux, but works on MacOS. Does anyone have an explanation?
>>> The docs suggest that _double* shouldn't be different from _double for
>>> _reading_ values.
>>>
>>> More precisely,
>>>
>>> #lang racket
>>> (require ffi/unsafe)
>>>
>>> (define N 10)
>>> (define pt (malloc N _double 'atomic-interior))
>>> (for ([i (in-range N)])
>>>   (ptr-set! pt _double* i (+ 2. i)))
>>>
>>> ;; works
>>> (for/list ([i (in-range N)])
>>>   (ptr-ref pt _double i))
>>>
>>> ;; works
>>> (for/list ([i (in-range N)])
>>>   (ptr-ref (ptr-add pt i _double) _double*))
>>>
>>> ;; doesn't work!
>>> (for/list ([i (in-range N)])
>>>   (ptr-ref (ptr-add pt i _double) _double))
>>>
>>> --
>>> Output:
>>> (2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0)
>>> (2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0)
>>> (2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0)
>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to racket-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/racket-users/CABNTSaFmfgTpTrWzfcxL%2BxQCqtge5Ls1eKW%2Bp0ftd%3D0q554ALg%40mail.gmail.com
>> 
>> .
>>
>
>
> --
> --
> Jens Axel Søgaard
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CABNTSaFY5Xn8DvhTekTSkWx7%3DkW3yvSrZTMZ605zSRvw_CM1eQ%40mail.gmail.com.


Re: [racket-users] Re: Strange behaviour of ptr-ref + ptr-add(?)

2020-05-10 Thread Jens Axel Søgaard
I can confirm that the bug is present in the latest snapshot of Racket CS
on macOS.

FWIW  _double* is missing in this list, but I am not sure it whether it is
supposed to be handled here.
https://github.com/racket/racket/blob/920c899ba866ce59a0387862286521e3cc1dabfb/racket/src/schemify/ptr-ref-set.rkt#L46

/Jens Axel

Den søn. 10. maj 2020 kl. 10.51 skrev Laurent :

> Correction:
> It's not Mac vs Linux, it's Racket BC (works) vs CS (doesn't work)
>
> On Sun, May 10, 2020 at 9:49 AM Laurent  wrote:
>
>> Hi all,
>>
>> We're trying to figure out why the last case below doesn't work on
>> Linux, but works on MacOS. Does anyone have an explanation?
>> The docs suggest that _double* shouldn't be different from _double for
>> _reading_ values.
>>
>> More precisely,
>>
>> #lang racket
>> (require ffi/unsafe)
>>
>> (define N 10)
>> (define pt (malloc N _double 'atomic-interior))
>> (for ([i (in-range N)])
>>   (ptr-set! pt _double* i (+ 2. i)))
>>
>> ;; works
>> (for/list ([i (in-range N)])
>>   (ptr-ref pt _double i))
>>
>> ;; works
>> (for/list ([i (in-range N)])
>>   (ptr-ref (ptr-add pt i _double) _double*))
>>
>> ;; doesn't work!
>> (for/list ([i (in-range N)])
>>   (ptr-ref (ptr-add pt i _double) _double))
>>
>> --
>> Output:
>> (2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0)
>> (2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0)
>> (2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0)
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/CABNTSaFmfgTpTrWzfcxL%2BxQCqtge5Ls1eKW%2Bp0ftd%3D0q554ALg%40mail.gmail.com
> 
> .
>


-- 
-- 
Jens Axel Søgaard

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CABefVgzNsmOEx3LV%3DvmV--gu3UD6kHZsRCfPQm0kn32Vo_ziKw%40mail.gmail.com.


[racket-users] Re: Strange behaviour of ptr-ref + ptr-add(?)

2020-05-10 Thread Laurent
Correction:
It's not Mac vs Linux, it's Racket BC (works) vs CS (doesn't work)

On Sun, May 10, 2020 at 9:49 AM Laurent  wrote:

> Hi all,
>
> We're trying to figure out why the last case below doesn't work on
> Linux, but works on MacOS. Does anyone have an explanation?
> The docs suggest that _double* shouldn't be different from _double for
> _reading_ values.
>
> More precisely,
>
> #lang racket
> (require ffi/unsafe)
>
> (define N 10)
> (define pt (malloc N _double 'atomic-interior))
> (for ([i (in-range N)])
>   (ptr-set! pt _double* i (+ 2. i)))
>
> ;; works
> (for/list ([i (in-range N)])
>   (ptr-ref pt _double i))
>
> ;; works
> (for/list ([i (in-range N)])
>   (ptr-ref (ptr-add pt i _double) _double*))
>
> ;; doesn't work!
> (for/list ([i (in-range N)])
>   (ptr-ref (ptr-add pt i _double) _double))
>
> --
> Output:
> (2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0)
> (2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0)
> (2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0)
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CABNTSaFmfgTpTrWzfcxL%2BxQCqtge5Ls1eKW%2Bp0ftd%3D0q554ALg%40mail.gmail.com.