PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

Compiler setting to catch defined but unset variables

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Debugging and Profiling
View previous topic :: View next topic  
Author Message
kp_8000



Joined: 06 Aug 2013
Posts: 2

PostPosted: Tue Aug 06, 2013 3:18 am    Post subject: Compiler setting to catch defined but unset variables Reply with quote

Hi,

I compile a section of code with the following options:

mpif90 -g -C -v -byteswapio -c -Mbounds -Mchkptr -Mchkstk -Mextend -Mfree -Ktrap=fp -i4 -r8 -mcmodel=medium mycode.f

The code runs fine, but I've just noticed that within the code there is a variable that is defined but not set. When it is later used it is taking a value of zero.

e.g.

REAL Variable_A
REAL Variable_B
REAL Variable_C


Variable_A=10

Variable_C = Variable_A + Variable_B

So Variable_A is set to 10 and then used but Variable_B is used (read from) but not set (written to).

I would like to know if there is a compiler option available that would catch such a mistake.

The real code is rather longer so it's not always so easy to spot these mistakes!

Thanks in advance for your help,
K
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6206
Location: The Portland Group Inc.

PostPosted: Tue Aug 06, 2013 8:23 am    Post subject: Reply with quote

Hi K,

There isn't a compiler setting for this but I have found Valgrind (www.valgrind.org) a usefull utility when finding UMRs (unitialized memory reads).

Hope this helps,
Mat
Back to top
View user's profile
kp_8000



Joined: 06 Aug 2013
Posts: 2

PostPosted: Wed Aug 07, 2013 7:26 am    Post subject: Reply with quote

Thanks, I'll give that a try...
K
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Debugging and Profiling All times are GMT - 7 Hours
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 © phpBB Group