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

Case select Warning

rahzan
New Contributor I
1,414 Views
I use a bunch of constants like SQL_F_TINYINT in a module

On a line of code which uses the module
case(SQL_F_TINYINT); sizeofCol=1
I get:
Warning: Case selection values must fit within a signed 32 bit integer. Value truncated.

Can anyone tell me what this means?
I sounds like an overflow, but how?


FYI the relevant values of the constants are

integer,parameter:: SQLSMALLINT_KIND=2
integer(SQLSMALLINT_KIND),parameter:: SQL_INTEGER = 4

integer(SQLSMALLINT_KIND),parameter::SQL_C_LONG =SQL_INTEGER
integer(SQLSMALLINT_KIND), parameter:: SQL_SIGNED_OFFSET = (-20)
integer(SQLSMALLINT_KIND),parameter::SQL_F_SLONG= (SQL_C_LONG+SQL_SIGNED_OFFSET)

Thanks in adv.
Tim

0 Kudos
11 Replies
Jugoslav_Dujic
Valued Contributor II
1,414 Views
FWIW, I occasionally get such messages when I accidentaly refer to an old (CVF 5.0D) .mod file within a new project. A rebuild takes care of it.

Jugoslav
0 Kudos
Steven_L_Intel1
Employee
1,414 Views
This might be a compiler bug we recently fixed. If you'll provide a short but complete examplr, I'll check.

Steve
0 Kudos
rahzan
New Contributor I
1,414 Views
This is the gist of the program, If I use the module as written out below, it does not produce the warning. I get
the warning if I use the module f90sqlconstants provided by Canaima which is compiled separately and used as an Object file. I do not know if I it is proper to attach the file from canaima w/o permission.
If you have the dang thing then we're cool.
Else, I will write Marco about it.

! module constants
! integer,parameter:: SQLSMALLINT_KIND=2
! integer(SQLSMALLINT_KIND),parameter:: SQL_INTEGER = 4
!
! integer(SQLSMALLINT_KIND),parameter::SQL_C_LONG =SQL_INTEGER
! integer(SQLSMALLINT_KIND), parameter:: SQL_SIGNED_OFFSET = (-20)
! integer(SQLSMALLINT_KIND),parameter::SQL_F_SLONG= (SQL_C_LONG+SQL_SIGNED_OFFSET)
! end module

use f90sqlconstants
integer(2) var
var=2
select case(var)
case(SQL_F_SLONG); write(*,*)'Jello mold'
case default
end select
end
0 Kudos
Jugoslav_Dujic
Valued Contributor II
1,414 Views
Tim, if you open the file f90sqlconstants.mod in Visual Studio (as binary file), what are bits 25-28? All my modules built with CVF6.6 have 26 2E 36 00 = "6.6"C, and I guess this is the compiler version signature (old 5.0 header files have zeros). I'd guess Canaimasoft supplied some older .mod files; if you have the sources of F90SQL, I'd suggest you recompile them and put the new .mod files back into their directory. And, yes, tell Marco about the problem.

Jugoslav
0 Kudos
Steven_L_Intel1
Employee
1,414 Views
The old module should not be a problem. We support that.

Steve
0 Kudos
Jugoslav_Dujic
Valued Contributor II
1,414 Views
Not 100% I'm affraid. OK, here we go. I have only 5.0D and 6.6B to experiment with so I can't comment on other inter-versions, but if I compile low-level modules with 5.0D first:
MODULE XFTTYPES
...
INTEGER,PARAMETER::        XPROC_DIALOG      = -1
...
END MODULE
and then higher-level modules with 6.6B:
MODULE XFTWND
USE XFTTYPES
...
CONTAINS
...
RECURSIVE INTEGER FUNCTION PXDefProc)
...
   SELECT CASE (xWnd%lpWindowProc)
   ...
   CASE (XPROC_DIALOG)  !Dialog window
         PXDefProc = 0
...
I get:
D:...SourceXFTWnd.f90(1748) : Error: The case-value is out-of-range.
      CASE (XPROC_DIALOG)  !Dialog window
------------^
that happens for negative PARAMETERs only. It's not identical as Tim's case, but looks suspiciously similar.

Jugoslav



0 Kudos
Jugoslav_Dujic
Valued Contributor II
1,414 Views
...and I'm certain I saw the same warning as Tim under similar circumstances, but at the moment I can't recall what they were exactly.
0 Kudos
rahzan
New Contributor I
1,414 Views
Ok I tried including the source and force recompiling it and the warning want away.

Jugo's msg did not say bit 25h or decimal so I could not verify his hint, for sure. if he meant hex then, yes, they were all zeros in the mod file.

Does this convince Steve?

Thanks,
tim
0 Kudos
Jugoslav_Dujic
Valued Contributor II
1,414 Views
Yes, I meant 25h.

Jugoslav (who is 1E years old :-))
0 Kudos
rahzan
New Contributor I
1,414 Views
Oh the hex of youth!
0 Kudos
Steven_L_Intel1
Employee
1,414 Views
Ok, we'll take a look. It is SUPPOSED to work.

Steve
0 Kudos
Reply