[Much time passes]

I went ahead and added this warning. I kept thinking I should write a more detailed explanation about why this is a problem, but I never got around to it. At least this let's people know that there are some dragons to be wary of.


-tim


On 5/28/07, Francesc Altet <faltet@carabos.com> wrote:
El dv 25 de 05 del 2007 a les 14:19 -0700, en/na Timothy Hochberg va
escriure:
> Don't feel bad, when I had a very similar problem early on when we
> were first adding multiple types and it mystified me for considerably
> longer than this seems to have stumped you.

Well, I wouldn't say the truth if I say that this doesn't help ;)

Anyway, I think that this piece of code is dangerous enough and in order
to avoid someone (including me!) tripping over it again, it would be
nice to apply the next 'patch':

Index: interp_body.c
===================================================================
--- interp_body.c       (revision 3053)
+++ interp_body.c       (working copy)
@@ -89,6 +89,9 @@
         unsigned int arg2 = params.program[pc+3];
         #define      arg3   params.program[pc+5]
         #define store_index params.index_data[store_in]
+        /* WARNING: From now on, only do references to params.mem[arg[123]]
+          & params.memsteps[arg[123]] inside the VEC_ARG[123] macros,
+           or you will risk accessing invalid addresses.  */
         #define reduce_ptr  (dest + flat_index(&store_index, j))
         #define i_reduce    *(long *)reduce_ptr
         #define f_reduce    *(double *)reduce_ptr

Cheers,

--
Francesc Altet    |  Be careful about using the following code --
Carabos Coop. V.  |  I've only proven that it works,
www.carabos.com   |  I haven't tested it. -- Donald Knuth

_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion



--
.  __
.   |-\
.
.  tim.hochberg@ieee.org