|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
wahorger
Joined: 13 Oct 2014 Posts: 1217 Location: Morrison, CO, USA
|
Posted: Fri Feb 03, 2017 10:38 pm Post subject: Minor compiler bug - Warning 298 |
|
|
I get the following error during the compile (/CHECKMATE).
Code: | Compiling file: main.f95
F:\Temp\main.F95(2) : warning 298 - Variable J has been used without being given an initial value
Compilation completed with no errors.
|
The code involves a data initialization of a two-dimensional array. I need to to do it this way to keep all the related data together for easier editing later. I do this in a BLOCK DATA, but this will occur in a routine/module.
The simplified code is Code: | block data cb
integer I,J
integer zones_83(2),spzon_83_projection(2),spzon_83(2),spcc_83(2,2)
common/defg/zones_83,spzon_83_projection,spzon_83,spcc_83
data (zones_83(i),spzon_83_projection(i),spzon_83(i),(spcc_83(i,j),j=1,2),i=1,2)/10*0/
|
In actuality, it's all working as one might expect, just the warning that's annoying. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Fri Feb 03, 2017 11:17 pm Post subject: |
|
|
Bill,
I remember something like this before. If I remember correctly it's that the i and j in the DATA statement are local to the statement, and so aren't I or J - nothing to do with case. A real authority like mecej4 will probably have the definition.
Do you use J later on?
Eddie |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2554 Location: Sydney
|
Posted: Sat Feb 04, 2017 2:01 am Post subject: |
|
|
It definitely is an annoying false warning. I have had other similar cases.
I tried 3 alternatives, which confirm this as a false warning.
Is it valid to define local variables in a block data sub program ? Code: | block data cb0 ! original
integer I,J
integer zones_83(2),spzon_83_projection(2),spzon_83(2),spcc_83(2,2)
common/defg/zones_83,spzon_83_projection,spzon_83,spcc_83
data (zones_83(i),spzon_83_projection(i),spzon_83(i),(spcc_83(i,j),j=1,2),i=1,2) / 10*0 /
end
block data cb1 ! swap i,j > j,i
integer I,J
integer zones_83(2),spzon_83_projection(2),spzon_83(2),spcc_83(2,2)
common/defg/zones_83,spzon_83_projection,spzon_83,spcc_83
data (zones_83(i),spzon_83_projection(i),spzon_83(i),(spcc_83(j,i),j=1,2),i=1,2) / 10*0 /
end
block data cb2 ! don't use J !!
! integer I,J
integer zones_83(2),spzon_83_projection(2),spzon_83(2),spcc_83(2,2)
common/defg/zones_83,spzon_83_projection,spzon_83,spcc_83
data zones_83,spzon_83_projection,spzon_83,spcc_83 / 10*0 /
end
|
This statement will never be executed is another common false warning, which has also been reported lately. Hopefully it is not a major problem to eradicate.
John |
|
Back to top |
|
|
wahorger
Joined: 13 Oct 2014 Posts: 1217 Location: Morrison, CO, USA
|
Posted: Sat Feb 04, 2017 5:30 am Post subject: |
|
|
Yes, apparently that is allowed in a BLOCK DATA if used like this. Just ry to set a value, and it reports that you can't do that unless it is in COMMON
Just an FYI, really. I can ignore it (or /IGNORE 298). |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Sat Feb 04, 2017 10:47 am Post subject: |
|
|
I will make a note that this needs fixing. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Mon Feb 20, 2017 4:02 pm Post subject: |
|
|
This has now been fixed for the next release (after 8.10). |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|