How can initialization of a parameter (constant) with hex values be done? I.e. I would like to write "parameter (xx = z'ff')" or integer, parameter :: zz=z'022' but the compiler complains over "BOZ used outside a data statement"
You need to give some details, including a small program, the compiler command line you used, and the output of gfortran -v. Because it works for me. laptop:kargl[6] cat > a.f program z integer j parameter (j = z'ff') print *, j end program z ^Dlaptop:kargl[7] laptop:kargl[7] gfc43 -o z a.f laptop:kargl[8] ./z 255
(In reply to comment #1) > You need to give some details, including a small program, > the compiler command line you used, and the output of > gfortran -v. > > Because it works for me. > > laptop:kargl[6] cat > a.f > program z > integer j > parameter (j = z'ff') > print *, j > end program z > ^Dlaptop:kargl[7] > laptop:kargl[7] gfc43 -o z a.f > laptop:kargl[8] ./z > 255 > (In reply to comment #1) > You need to give some details, including a small program, > the compiler command line you used, and the output of > gfortran -v. > > Because it works for me. > > laptop:kargl[6] cat > a.f > program z > integer j > parameter (j = z'ff') > print *, j > end program z > ^Dlaptop:kargl[7] > laptop:kargl[7] gfc43 -o z a.f > laptop:kargl[8] ./z > 255 > >gfortran -v Using built-in specs. Target: sparc-sun-solaris2.8 Configured with: /t3-0/shared/gnu/gcc-4.3.3/configure --prefix=/t3-0/shared/gnu/gcc-trunk --srcdir=/t3-0/shared/gnu/gcc-4.3.3 --enable-languages=c,fortran --with-mpfr=/usr/local --with-gmp=/usr/local --with-pkgversion=432 Thread model: posix gcc version 4.3.3 (432) program: >cat rv1.f SUBROUTINE SLSYNOF(TSN,UFD,STATUS) INCLUDE 'rvp.mnc' ! -- DO something RETURN END includefile: >cat rvp.mnc ! includefile PARAMETER (SL_I4NOVALUE = Z'80000000') ! INTEGER :: SL_I4NOVALUE ! DATA SL_I4NOVALUE / Z'80000000'/ ! PARAMETER (SL_I4NOVALUE = SL_I4NOVALUED ) ! integer, parameter :: ipm = 2 ! data ipm /z'033'/ running: >gfortran -g -std=f95 -ffree-form -frange-check -c rv1.f90 -o rv1.o rvp.mnc:3.43: Included at rv1.f90:2: PARAMETER (SL_I4NOVALUE = Z'80000000') 1 Error: Fortran 2003: BOZ used outside a DATA statement at (1)
Subject: Re: parameter (constant) and initialization with hex values On Thu, Feb 26, 2009 at 02:59:05PM -0000, rvatne at gmail dot com wrote: > > running: > >gfortran -g -std=f95 -ffree-form -frange-check -c rv1.f90 -o rv1.o > rvp.mnc:3.43: > Included at rv1.f90:2: > > PARAMETER (SL_I4NOVALUE = Z'80000000') > 1 > Error: Fortran 2003: BOZ used outside a DATA statement at (1) > You got exactly what you asked the compiler to do. Remove the -std=f95 option if you don't want to enforce the Fortran 95 standard.
*** Bug 39313 has been marked as a duplicate of this bug. ***
BOZ are allowed in data statements only in Fortran 95.