Thomas: >>I think there was some other problem mentioned on this
mailing list that was caused by -O2...<<

Yes, don't compile pico lisp on a Ubuntu version newer than Feisty,
the result is highly unstable with O2, seems to be working with O1
though.

In any case I just don't compile pico lisp on newer versions, I've got
a virtual machine with Feisty which I use basically only to compile
pico lisp on.

/Henrik


On Sat, Jul 18, 2009 at 2:40 PM, Jon Kleiser<jon.klei...@usit.uio.no> wrote=
:
> Hi,
>
> I have confirmed that this results in an immediate crash when I use Pico
> Lisp 2.3.6 or newer on my Mac. However, I'm not sure what I can do furthe=
r
> to reveal what causes the memory to be overwritten. Any ideas?
>
> /Jon
>
> On 6/26/09 10:13 AM, Alexander Burger wrote:
>>
>> Hi all,
>>
>> now Randall and I made some experiments. I inserted the following code
>> on top of "gltst.l"
>>
>> ################################################################
>> (load "@simul/gl/lib.l")
>> (load "@lib/gcc.l")
>>
>> (gcc "chk" NIL 'heapCrc)
>>
>> any heapCrc(any ex __attribute__((unused))) {
>> =A0 int c, i;
>> =A0 int crc =3D 0;
>> =A0 heap *h =3D Heaps;
>> =A0 char *p;
>>
>> =A0 do {
>> =A0 =A0 =A0p =3D (char*)h->cells;
>> =A0 =A0 =A0do {
>> =A0 =A0 =A0 =A0 c =3D *p;
>> =A0 =A0 =A0 =A0 for (i =3D 0; i < 8; ++i) {
>> =A0 =A0 =A0 =A0 =A0 =A0if ((c ^ crc) & 1)
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 crc ^=3D 0x14002; =A0/* Polynom x**16 + x**1=
5 + x**2 + 1 */
>> =A0 =A0 =A0 =A0 =A0 =A0c >>=3D 1, =A0crc >>=3D 1;
>> =A0 =A0 =A0 =A0 }
>> =A0 =A0 =A0} while (++p < (char*)(h->cells + CELLS));
>> =A0 } while (h =3D h->next);
>> =A0 printf("%d\n", crc);
>> =A0 return T;
>> }
>>
>> /**/
>>
>> # Pre-load functions to avoid later heap usage
>> (mapc getd
>> =A0 (quote
>> =A0 =A0 =A0glut:Init glut:InitDisplayMode glut:InitWindowSize glut:Creat=
eWindow
>> =A0 =A0 =A0gl:ClearColor gl:MatrixMode gl:LoadIdentity gl:Ortho ) )
>>
>> (setq Mode (| GLUT_SINGLE GLUT_RGB))
>>
>> (prog =A0# Pre-allocate heap
>> =A0 (heapCrc)
>> =A0 (glut:Init)
>> =A0 ...
>> ################################################################
>>
>> The intention was to repeatedly calculate the CRC sum over the Lisp
>> heaps (a linked list of malloc'ed memory blocks), to find out if and
>> when memory is overwritten by one of the graphics functions.
>>
>> The code defines a 'heapCrc' function which prints the CRC sum, to be
>> compared to subsequent calls. The pre-loading of ot the 'glut:xxx" and
>> 'gl:xxx' functions, and the constant 'Mode' is necessary because
>> otherwise the heap would be changed by such side-effects.
>>
>>
>> Now, the interesting thing is: It crashes immediately! That is, it is
>> 'heapCrc' itself that crashes (is this correct, Randall?). One of the
>> heap links must be broken, as the CRC calculation does not do anything
>> dangerous per se.
>>
>> It is not clear for me if the memory is overwritten by the OpenGL
>> function, or already by the dlopen/dlsym mechanism when PicoLisp loads
>> the library. The latter case would mean that other dynamically loaded C
>> functions (including 'heapCrc') would also corrupt the system.
>>
>> Perhaps somebody else likes to experiment with this (if time and a Mac
>> is available)?
>>
>> Cheers,
>> - Alex
>
> --
> UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=3dunsubscribe
>
-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to