Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

boz constant compiler errors

psing51
New Contributor I
1,383 Views

Hi,
While trying to compile a fortran code, i am getting multiple errors related to the boz literal constant - 

mpiifort -oo/obs_write.o -c -I./include -r8 -i4 -fno-second-underscore -march=core-avx2 -I./include -I/home/user/dep//include -I. -L/home/user/dep//lib -L/home/user/dep/src/xios-2.0//lib -I/home/user/dep/src/xios-2.0//inc -lxios -lstdc++ -I/OASIS3-MCT_4.0/DELL_ZENITH/build/lib/psmile.MPI1 -I/home/user/dep/src/xios-2.0//inc -I/OASIS3-MCT_4.0/DELL_ZENITH/build/lib/psmile.MPI1 -O3 -march=core-avx2 -g -traceback -fp-model strict -align array64byte /home/user/src/nemo/NEMOGCM/NEMO/OPA_SRC/OBS/obs_write.F90 # rc=1
[FAIL] ifort: command line warning #10006: ignoring unknown option '-fno-second-underscore'
[FAIL] /home/user/src/nemo/NEMOGCM/NEMO/OPA_SRC/OBS/obs_write.F90(362): error #5144: Invalid character_kind_parameter. No underscore
[FAIL]                   fbdata%ivlqcf(2,ik,jo,jvar) = IAND(profdata%var(jvar)%nvqc(jk),b'0000 0000 1111 1111')
[FAIL] -------------------------------------------------------------------------------------------------------^
[FAIL] /home/user/src/nemo/NEMOGCM/NEMO/OPA_SRC/OBS/obs_write.F90(362): error #5082: Syntax error, found CHARACTER_CONSTANT '0000 0000 1111 1111' when expecting one of: :: ) ( , : * . % + - [ . = ** / // .LT. < .LE. <= .EQ. == ...
[FAIL]                   fbdata%ivlqcf(2,ik,jo,jvar) = IAND(profdata%var(jvar)%nvqc(jk),b'0000 0000 1111 1111')
[FAIL] ----------------------------------------------------------------------------------^
[FAIL] /home/user/src/nemo/NEMOGCM/NEMO/OPA_SRC/OBS/obs_write.F90(737): error #5144: Invalid character_kind_parameter. No underscore
[FAIL]             fbdata%ioqcf(2,jo) = IAND(surfdata%nqc(jo),b'0000 0000 1111 1111')
[FAIL] -----------------------------------------------------------------------------^
[FAIL] /home/user/src/nemo/NEMOGCM/NEMO/OPA_SRC/OBS/obs_write.F90(737): error #5082: Syntax error, found CHARACTER_CONSTANT '0000 0000 1111 1111' when expecting one of: :: ) ( , : * . % + - [ . = ** / // .LT. < .LE. <= .EQ. == ...
[FAIL]             fbdata%ioqcf(2,jo) = IAND(surfdata%nqc(jo),b'0000 0000 1111 1111')
[FAIL] --------------------------------------------------------^
[FAIL] /home/user/src/nemo/NEMOGCM/NEMO/OPA_SRC/OBS/obs_write.F90(772): error #5144: Invalid character_kind_parameter. No underscore
[FAIL]             fbdata%ivlqcf(2,1,jo,1) = IAND(surfdata%nqc(jo),b'0000 0000 1111 1111')
[FAIL] ----------------------------------------------------------------------------------^
[FAIL] /home/user/src/nemo/NEMOGCM/NEMO/OPA_SRC/OBS/obs_write.F90(772): error #5082: Syntax error, found CHARACTER_CONSTANT '0000 0000 1111 1111' when expecting one of: :: ) ( , : * . % + - [ . = ** / // .LT. < .LE. <= .EQ. == ...
[FAIL]             fbdata%ivlqcf(2,1,jo,1) = IAND(surfdata%nqc(jo),b'0000 0000 1111 1111')
[FAIL] -------------------------------------------------------------^
[FAIL] /home/user/src/nemo/NEMOGCM/NEMO/OPA_SRC/OBS/obs_write.F90(362): error #6200: A colon (:) is not valid in this context.
[FAIL]                   fbdata%ivlqcf(2,ik,jo,jvar) = IAND(profdata%var(jvar)%nvqc(jk),b'0000 0000 1111 1111')
[FAIL] ---------------------------------------------------------------------------------^
[FAIL] /home/user/src/nemo/NEMOGCM/NEMO/OPA_SRC/OBS/obs_write.F90(362): error #6363: The intrinsic data types of the arguments must be the same.   [IAND]
[FAIL]                   fbdata%ivlqcf(2,ik,jo,jvar) = IAND(profdata%var(jvar)%nvqc(jk),b'0000 0000 1111 1111')
[FAIL] ---------------------------------------------------------------------------------^
[FAIL] /home/user/src/nemo/NEMOGCM/NEMO/OPA_SRC/OBS/obs_write.F90(737): error #6200: A colon (:) is not valid in this context.
[FAIL]             fbdata%ioqcf(2,jo) = IAND(surfdata%nqc(jo),b'0000 0000 1111 1111')
[FAIL] -------------------------------------------------------^
[FAIL] /home/user/src/nemo/NEMOGCM/NEMO/OPA_SRC/OBS/obs_write.F90(737): error #6363: The intrinsic data types of the arguments must be the same.   [IAND]
[FAIL]             fbdata%ioqcf(2,jo) = IAND(surfdata%nqc(jo),b'0000 0000 1111 1111')
[FAIL] -------------------------------------------------------^
[FAIL] /home/user/src/nemo/NEMOGCM/NEMO/OPA_SRC/OBS/obs_write.F90(772): error #6200: A colon (:) is not valid in this context.
[FAIL]             fbdata%ivlqcf(2,1,jo,1) = IAND(surfdata%nqc(jo),b'0000 0000 1111 1111')
[FAIL] ------------------------------------------------------------^
[FAIL] /home/user/src/nemo/NEMOGCM/NEMO/OPA_SRC/OBS/obs_write.F90(772): error #6363: The intrinsic data types of the arguments must be the same.   [IAND]
[FAIL]             fbdata%ivlqcf(2,1,jo,1) = IAND(surfdata%nqc(jo),b'0000 0000 1111 1111')
[FAIL] ------------------------------------------------------------^
[FAIL] compilation aborted for /home/user/src/nemo/NEMOGCM/NEMO/OPA_SRC/OBS/obs_write.F90

 the file is attached herewith. Do i need to add any compilation flag to get past this issue? 
Please advice.

0 Kudos
1 Solution
Steve_Lionel
Black Belt
1,348 Views

The standard allows a BOZ constant as an argument to IAND: "If either I or J is a boz-literal-constant, it is first converted as if by the intrinsic function INT to type integer with the kind type parameter of the other."  BOZ constants cannot have a KIND specified.

Some more reading: Doctor Fortran in "We're All BOZos on This Bus" - Doctor Fortran (stevelionel.com)

View solution in original post

0 Kudos
3 Replies
andrew_4619
Honored Contributor II
1,375 Views

The standard conforming BOZ would be int(b'0000000011111111') , note there are no spaces in the BOZ string,  you may also need at add the kind parameter if surfdata%nqc(jo) is not of the default integer kind.

 

0 Kudos
mecej4
Black Belt
1,361 Views

There are many occurrences of b'0000 0000 1111 1111' as the second argument to IAND. As Andrew pointed out, such a BOZ constant has no type, and blanks are significant in quoted strings, which caused the error messages.

You could define

     integer, parameter :: Low16 = 255

and use Low16 as the second argument to IAND in all those places.

0 Kudos
Steve_Lionel
Black Belt
1,349 Views

The standard allows a BOZ constant as an argument to IAND: "If either I or J is a boz-literal-constant, it is first converted as if by the intrinsic function INT to type integer with the kind type parameter of the other."  BOZ constants cannot have a KIND specified.

Some more reading: Doctor Fortran in "We're All BOZos on This Bus" - Doctor Fortran (stevelionel.com)

0 Kudos
Reply