             apdq[mq] = apdq_trans[I_q];
         }            
 
-        for(imp = 0; imp < 2; imp++)
+        for(int imp = 0; imp < 2; imp++)
         {
             for(m = 0; m < maux; m++)
             {
-                I_aux = I + m*zs;
-                k = imp*maux + m;
+                int I_aux = I + m*zs;
+                int k = imp*maux + m;
                 aux1[k] = aux[I_aux - ys + (imp - 1)];
                 aux2[k] = aux[I_aux      + (imp - 1)];
                 aux3[k] = aux[I_aux + ys + (imp - 1)];

            apdq[mq] = apdq_trans[I_q];
        }            

        for(imp = 0; imp < 2; imp++)
        {
            for(m = 0; m < maux; m++)
            {
                I_aux = I + m*zs;
                k = imp*maux + m;
                aux1[k] = aux[I_aux - ys + (imp - 1)];
                aux2[k] = aux[I_aux      + (imp - 1)];
                aux3[k] = aux[I_aux + ys + (imp - 1)];


    double* start  = shared_mem + mwork*threadIdx.x;

    double *const ql     = start;                 /* meqn        */
    double *const qr     = ql     + meqn;         /* meqn        */
    double *const qd     = qr     + meqn;         /* meqn        */
    double *const auxl   = qd     + meqn;         /* maux        */
    double *const auxr   = auxl   + maux;         /* maux        */
    double *const auxd   = auxr   + maux;         /* maux        */
    double *const s      = auxd   + maux;         /* mwaves      */
    double *const wave   = s      + mwaves;       /* meqn*mwaves */
    double *const amdq   = wave   + meqn*mwaves;  /* meqn        */
    double *const apdq   = amdq   + meqn;         /* meqn        */
    double *const bmdq   = apdq   + meqn;         /* meqn        */
    double *const bpdq   = bmdq   + meqn;         /* meqn        */
    double *const aux1   = bpdq   + meqn;         /* 2*maux      */
    double *const aux2   = aux1   + 2*maux;       /* 2*maux      */
    double *const aux3   = aux2   + 2*maux;       /* 2*maux      */
    double *const bmasdq = aux3   + 2*maux;       /* meqn        */
    double *const bpasdq = bmasdq + meqn;         /* meqn        */


#if 0
    int mq, mw, m, k;
    int I, I_q, I_aux, I_waves, I_speeds;
    int ix,iy,ifaces_x, ifaces_y, num_ifaces;
