[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 19991220: CRAY SV1 (UNICOS 10.0.0.6): non-constant array size in ncx_cray.c



Fabien,

> To: address@hidden
> From: Fabien Durand <address@hidden>
> Organization: .
> Keywords: 199912201654.JAA02346

In the above message, you wrote:

> I am trying to install NetCDF on a CRAY SV1 (UNICOS 10.0.0.6). I had no 
> problems 
> to go through the "CONFIGURE" stage. Of course, I moved "ncx_cray.c" to 
> "ncx.c". 
> But when running "make", the following bug came out : 
> -----------------------------------------------------------------------
> 
> jedi-ci:/tmp/durandf/netcdf-3.5/src $ make
> 
> Making `all' in directory /tmp/durandf/netcdf-3.5/src/libsrc
> 
>         c89 -c -O -I.  -DNDEBUG attr.c
>         c89 -c -O -I.  -DNDEBUG dim.c
>         c89 -c -O -I.  -DNDEBUG error.c
>         c89 -c -O -I.  -DNDEBUG -DVERSION=`cat ../VERSION` libvers.c
>         c89 -c -O -I.  -DNDEBUG nc.c
>         c89 -c -O -I.  -DNDEBUG ncio.c
>         c89 -c -O -I.  -DNDEBUG ncx.c
> CC-28 c89: ERROR File = ncx.c, Line = 3457
>   The expression used must have a constant value.
> 
>                 word xbuf[nelems];
>                           ^
> 
> CC-28 c89: ERROR File = ncx.c, Line = 3646
>   The expression used must have a constant value.
> 
>                 word xbuf[nelems];
>                           ^
> 
> 2 errors detected in the compilation of "ncx.c".
> Make: "c89 -c -O -I.  -DNDEBUG ncx.c": Error code 1
> cmd-2436 make: Stop.
> Make: "cd libsrc && \
>     echo "Making \`all' in directory `pwd`" && \
>     echo "" && \
>     make all || exit 1": Error code 1
> Make: "subdir=`echo libsrc/all | sed 's,/.*,,'`; \
> target=`echo libsrc/all | sed 's,.*/,,'`; \
> make SUBDIR=$subdir TGET=$target subdir_target": Error code 1
> cmd-2436 make: Stop.
> ---------------------------------------------------------
> Do you know how to overcome that ?
> Thank you,
> 
> 
> Fabien Durand
> LEGOS/GRGS
> 14 Avenue E.Belin
> 31400 Toulouse
> FRANCE
> tel 33 5 61 33 29 56
> email : address@hidden

Looks like we made a mistake.  Fortunately, the fix appears to be easy.

Would you please apply the enclosed patch to your file
"libsrc/ncx_cray.c", copy the patched file to "ncx.c", and then attempt
to rebuild the package.

Please let me know how it works.

Regards,
Steve Emmerson   <http://www.unidata.ucar.edu>

--------Patch to file "libsrc/ncx_cray.c":
Index: ncx_cray.c
===================================================================
RCS file: /upc/share/CVS/netcdf-3/libsrc/ncx_cray.c,v
retrieving revision 1.56
diff -c -w -r1.56 ncx_cray.c
*** ncx_cray.c  1998/03/06 01:32:58     1.56
--- ncx_cray.c  1999/12/20 17:53:56
***************
*** 3417,3426 ****
        if(noff != 0)
        {
                /* (*xpp) not word aligned, forced to make a copy */
!               word xbuf[nelems];
                (void) memcpy(xbuf, *xpp, nelems * X_SIZEOF_DOUBLE);
                ierr = IEG2CRAY(&Cray2_F64, &nelems, xbuf,
                        &Zero, tp, &UnitStride);
        }
        else
        {
--- 3417,3427 ----
        if(noff != 0)
        {
                /* (*xpp) not word aligned, forced to make a copy */
!               word *xbuf = (word*)malloc(nelems*sizeof(word));
                (void) memcpy(xbuf, *xpp, nelems * X_SIZEOF_DOUBLE);
                ierr = IEG2CRAY(&Cray2_F64, &nelems, xbuf,
                        &Zero, tp, &UnitStride);
+               (void)free(xbuf);
        }
        else
        {
***************
*** 3454,3460 ****
        if(noff != 0)
        {
                /* (*xpp) not word aligned, forced to make a copy */
!               word xbuf[nelems];
                const word *wp = xbuf;
                const word *const end = &wp[nelems];
  
--- 3455,3461 ----
        if(noff != 0)
        {
                /* (*xpp) not word aligned, forced to make a copy */
!               word *xbuf = (word*)malloc(nelems*sizeof(word));
                const word *wp = xbuf;
                const word *const end = &wp[nelems];
  
***************
*** 3466,3471 ****
--- 3467,3473 ----
                        cget_double_double(wp, tp);
                }
  
+               (void)free(xbuf);
        }
        else
        {
***************
*** 3604,3614 ****
        if(noff != 0)
        {
                /* (*xpp) not word aligned, forced to make a copy */
!               word xbuf[nelems];
                ierr = CRAY2IEG(&Cray2_F64, &nelems, xbuf,
                        &Zero, tp, &UnitStride);
                assert(ierr >= 0);
                (void) memcpy(*xpp, xbuf, nelems * X_SIZEOF_DOUBLE);
        }
        else
        {
--- 3606,3617 ----
        if(noff != 0)
        {
                /* (*xpp) not word aligned, forced to make a copy */
!               word *xbuf = (word*)malloc(nelems*sizeof(word));
                ierr = CRAY2IEG(&Cray2_F64, &nelems, xbuf,
                        &Zero, tp, &UnitStride);
                assert(ierr >= 0);
                (void) memcpy(*xpp, xbuf, nelems * X_SIZEOF_DOUBLE);
+               (void)free(xbuf);
        }
        else
        {
***************
*** 3643,3649 ****
        if(noff != 0)
        {
                /* (*xpp) not word aligned, forced to make a copy */
!               word xbuf[nelems];
                word *wp = xbuf;
                const word *const end = &wp[nelems];
  
--- 3646,3652 ----
        if(noff != 0)
        {
                /* (*xpp) not word aligned, forced to make a copy */
!               word *xbuf = (word*)malloc(nelems*sizeof(word));
                word *wp = xbuf;
                const word *const end = &wp[nelems];
  
***************
*** 3656,3661 ****
--- 3659,3665 ----
                }
  
                (void) memcpy(*xpp, xbuf, nelems * X_SIZEOF_DOUBLE);
+               (void)free(xbuf);
        }
        else
        {