forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Minor compiler bug - Warning 298

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Fri Feb 03, 2017 10:38 pm    Post subject: Minor compiler bug - Warning 298 Reply with quote

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
View user's profile Send private message Visit poster's website
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Fri Feb 03, 2017 11:17 pm    Post subject: Reply with quote

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
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Sat Feb 04, 2017 2:01 am    Post subject: Reply with quote

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
View user's profile Send private message
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Sat Feb 04, 2017 5:30 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Sat Feb 04, 2017 10:47 am    Post subject: Reply with quote

I will make a note that this needs fixing.
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Mon Feb 20, 2017 4:02 pm    Post subject: Reply with quote

This has now been fixed for the next release (after 8.10).
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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