- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When I try to start a loop as
do while (t_iter .LT. time(ubound(time)))
I get the following compiler error:
-------------- Build: Debug in NewIntegrateSEFromProfiles (compiler: Intel Fortran Compiler for Windows)---------------
ifort.exe /nologo /warn:all /debug:full /fpp /free /QxHost /O2 /module:obj\Debug\ /c main.f90 /object:obj\Debug\main.obj
ifort.exe /nologo /exe:bin\Debug\NewIntegrateSEFromProfiles.exe obj\Debug\main.obj
ifort: command line remark #10382: option '/QxHOST' setting '/QxCORE-AVX2'
main.f90(32): error #6512: A scalar-valued expression is required in this context.
do while (t_iter .LT. time(ubound(time)))
If I switch ubound() to size(), however, it works fine. Both of these functions return the same value (since the array is 1-indexed), and the first iteration returns a single boolean True, not an array. This error seems like unexpected behaviour to me.
(platform = windows 7 64 bit, ifort 18 update 1 in CodeBeans IDE)
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If there is no "dim" keyword on the UBOUND intrinsic, the result is an array. Yes, to us humans a one-element one-dimensional array looks just like a scalar, but to the Fortran standard and to the compiler, it's still an array.
It should work to say "ubound(time,1)" which will give you a scalar that is the upperbound of "time".
--Lorri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ah I see... I'm too used to being coddled by python printing a 1-item list as [1] instead of 1. Thanks

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page