Analyzers
Talk to fellow users of Intel Analyzer tools (Intel VTune™ Profiler, Intel Advisor)
4995 Discussions

Not detecting simple memory issue?

linfa
Beginner
775 Views
I am evaluating Intel Inspector XE2011 ( build 134657) . It seems it didn't detect some simple memory issues. I have 3 tests in my code ( see below ), and only the first one is detected. Could someone help me to see what's wrong?

I build the fortran code using visual studio 2005 + Intel fortran 10.0.0.26. I ran Intel Inspector XE2011 from VS2005. I removed Intel Fortran Compier XE and installed the old version. Other XE components are untouched


Any ideas are apprecated. Thanks.


My Analysis setting is
-------------------
checked detect memory leaks
checked detect resource leaks
checked detect invalid/uninitialized access
checked analyze stack accesses
checked enable enhanced dangling pointer check
bype limit before reallocation 1MB
checked enable guard zones
guard zone byte size 32bytes
stack frame depth 12
remove duplicates





Below is my testing code
-----------------------
program testfortran

implicit none
integer ivar, niarray, nrarray
integer iarray(8)
real rvar,rarray(8)

! Variables

! Body of testfortran
print *, 'Hello World'

call testpurify (ivar,iarray,8,rvar,rarray,8)

end program testfortran

c=======================================================================
subroutine testpurify (ivar,iarray,niarray,rvar,rarray,nrarray)
implicit none
c
integer ivar,niarray,nrarray
integer iarray(*)
real rvar,rarray(nrarray)

integer istack,ia,iar(2)
integer ptestp
c
c
write(*,*)'00-testpurify'
c
c standard mem issue
c
write(*,*)'01-use uninit stack var'
ia=istack

write(*,*)'02-use uninit array arg'
ia=iar(2)

write(*,*)'03-pass arg mem access'
iarray(niarray+1)=2

return
end

0 Kudos
13 Replies
Rob5
New Contributor II
775 Views

Linfa,

I was able to compile the code and run Intel Inspector XE analysis on it. Inspector XE found several memory issues. I did compile with Intel Visual Fortran 64 Compiler XE version 12.0.0.104. Can you attach a screen shot of the Inspector XE Summary tab showing the error you did find and I can compare what is missing and go from there.

If you wish the information / screenshot to be private, you can mark the post as private and the thread will nolonger be public.

Thanks
Rob
Intel Support

0 Kudos
linfa
Beginner
775 Views
Hi Rob,

I tried Inspector with Intel Fortran XE 12.0.2.154 but I got nothing. I am not sure if I missed something or not. I use the same setup as I had in the previous post in this thread except for converting the project file.

Any ideas are appreciated. Thanks.

Linfa
0 Kudos
Rob5
New Contributor II
775 Views

Linfa,

Can you let me know the Intel Inspector XE command line being ran? From the GUI, click the Show command line" button. This will tell me exactly what and how the analysis is being ran.

If you run one of the other Memory analysis types (Memory leaks, Detect, Locate), do you get different behavior?

Thanks
Rob
Intel Support

0 Kudos
linfa
Beginner
775 Views
Hi Rob,

here it is

inspxe-cl --collect "Memory Errors Analysis 0" -mrte-mode=native -suppressions=delete --search-dir sym=E:/users/linfa/workarea/Work/Intel_Inspector/testfortran/testfortran.sln -- E:\users\linfa\workarea\Work\Intel_Inspector\testfortran\x64\Debug\testfortran.exe



I tried all types of memory analysis as you suggested, and still have "no problems deteced"


Linfa
0 Kudos
linfa
Beginner
775 Views
Hi Rob,

Do you know if there is a log of the installation? I am wondering if there is any error during the installation which is not visible from the GUI


Linfa
0 Kudos
Rob5
New Contributor II
775 Views

Linfa,

Can you run the following from the command line and reply with the output?

inspxe-cl --collect mi1 -result-dir c:\temp -- E:\users\linfa\workarea\Work\Intel_Inspector\testfortran\x64\Debug\testfortran.exe

For the -result-dir c:\temp parameter above, if c:\temp does not exist, then enter a directory that does exist and is not protected or create c:\temp.

Thanks
Rob
Intel Support

0 Kudos
linfa
Beginner
775 Views
Hi Rob,

Here is the results.

C:\Program Files (x86)\Intel>inspxe-cl --collect mi1 -result-dir c:\temp -- E:\u
sers\linfa\workarea\Work\Intel_Inspector\testfortran\x64\Debug\testfortran.exe
Used suppression file(s): []
Hello World
00-testpurify
01-use uninit stack var
02-use uninit array arg
03-pass arg mem access

4 new problem(s) found
3 Kernel resource leak problem(s) detected
1 Memory leak problem(s) detected


I am wondering why I could not get these messages in the GUI run.

However, the results are not correct. There are no memeory and resource leaking issues in the source code at all. All I have is the uninitialized variable and array bound issues...
0 Kudos
Rob5
New Contributor II
775 Views

Linfa,

It looks like you are running a Custom Inspector that was named "Memory Errors Analysis 0" versus the predefined memory analysis types. Is this correct? If so, can you attempt to run the pre-defined Memory analysis called Locate Memory Problems otherwise known as mi3. With this pre-defined Memory analysis the command line start out like inspxe-cl --collect mi3 followed by any parameters and the executable to be analyzed.

With mi3 memory analysis, I receive an error Initialized memory access that points to ia=istack. I believe this is at least one of the errors you are looking for. Is this correct?

Thanks
Rob

0 Kudos
linfa
Beginner
775 Views
Hi Rob,

Thanks for your suggestions. However, I could not found anything by mi3

C:\Program Files (x86)\Intel>inspxe-cl --collect mi3 -result-dir c:\temp\aa -- E
:\users\linfa\workarea\Work\Intel_Inspector\testfortran\x64\Debug\testfortran.ex
e
Used suppression file(s): []
Hello World
00-testpurify
01-use uninit stack var
02-use uninit array arg
03-pass arg mem access

0 new problem(s) found



C:\Program Files (x86)\Intel>inspxe-cl --collect mi1 -result-dir c:\temp\aa1 --
E:\users\linfa\workarea\Work\Intel_Inspector\testfortran\x64\Debug\testfortran.e
xe
Used suppression file(s): []
Hello World
00-testpurify
01-use uninit stack var
02-use uninit array arg
03-pass arg mem access

4 new problem(s) found
3 Kernel resource leak problem(s) detected
1 Memory leak problem(s) detected



Linfa
0 Kudos
Rob5
New Contributor II
775 Views

Linfa,

Can you attach the VS 2005 build log showing the compile command line, etc. and also let me know the Windows* operating system you are running?

Thanks
Rob

0 Kudos
linfa
Beginner
775 Views
Hi Rob,

It is Win7 and here is the build log (win32 and x64). I could not find any issue on both

------ Build started: Project: testfortran, Configuration: Debug|x64 ------

Compiling with Intel Fortran Compiler 10.0.026 [Intel 64]...
ifort /nologo /Zi /Od /gen-interfaces /warn:interfaces /module:&quotx64\Debug\" /object:&quotx64\Debug\" /traceback /check:bounds /libs:static /threads /dbglibs /c /extfor:F /Qvc8 /Qlocation,link,&quotC:\Program Files (x86)\Microsoft Visual Studio 8\VC\bin\x86_amd64" &quotE:\users\linfa\workarea\Work\Intel_Inspector\testfortran\testfortran.F"
Linking...
Link /OUT:&quotx64\Debug\testfortran.exe" /INCREMENTAL:NO /NOLOGO /MANIFEST /MANIFESTFILE:&quotE:\users\linfa\workarea\Work\Intel_Inspector\testfortran\x64\debug\testfortran.exe.intermediate.manifest" /DEBUG /PDB:&quotE:\users\linfa\workarea\Work\Intel_Inspector\testfortran\x64\debug\testfortran.pdb" /SUBSYSTEM:CONSOLE &quotx64\Debug\testfortran.obj"
Link: executing 'link'

Embedding manifest...
mt.exe /nologo /outputresource:&quotE:\users\linfa\workarea\Work\Intel_Inspector\testfortran\x64\debug\testfortran.exe;#1" /manifest &quotE:\users\linfa\workarea\Work\Intel_Inspector\testfortran\x64\debug\testfortran.exe.intermediate.manifest"

testfortran - 0 error(s), 0 warning(s)




------ Build started: Project: testfortran, Configuration: Debug|Win32 ------

Compiling with Intel Fortran Compiler 10.0.026 [IA-32]...
ifort /nologo /Zi /Od /gen-interfaces /warn:interfaces /module:"Debug\" /object:"Debug\" /traceback /check:bounds /libs:static /threads /dbglibs /c /extfor:F /Qvc8 /Qlocation,link,"C:\Program Files (x86)\Microsoft Visual Studio 8\VC\bin" "E:\users\linfa\workarea\Work\Intel_Inspector\testfortran\testfortran.F"
Linking...
Link /OUT:"Debug\testfortran.exe" /INCREMENTAL:NO /NOLOGO /MANIFEST /MANIFESTFILE:"E:\users\linfa\workarea\Work\Intel_Inspector\testfortran\debug\testfortran.exe.intermediate.manifest" /DEBUG /PDB:"E:\users\linfa\workarea\Work\Intel_Inspector\testfortran\debug\testfortran.pdb" /SUBSYSTEM:CONSOLE "Debug\testfortran.obj"
Link: executing 'link'

Embedding manifest...
mt.exe /nologo /outputresource:"E:\users\linfa\workarea\Work\Intel_Inspector\testfortran\debug\testfortran.exe;#1" /manifest "E:\users\linfa\workarea\Work\Intel_Inspector\testfortran\debug\testfortran.exe.intermediate.manifest"

testfortran - 0 error(s), 0 warning(s)

0 Kudos
Rob5
New Contributor II
775 Views

Linfa,

Thank you for the additional information. I have not been able to replicate the behavior and unfortunately, the cause is still not apparent. It may be a combination of Visual Studio version 2005, compiler version, hardware, etc. The release notes for Intel Inspector specify Intel Fortran Compiler 11 or higher. However, you have already attempted with the version 11 Fortran compiler with similar results. However, we may need to take a look at using version 11 or better instead of the current version 10 you are using.

To further troubleshoot the behavior, can you run the Intel Inspector XE feedback logging and attach the zipped output to the forum thread as a Private post?

This report will provide us with information about the system to further trouble shoot the root cause.

>inspxe-feedback -create-bug-report report

It will create the report file in the current directory. Make sure you can write to the current directory or specify a directory that is writable.

Be sure to attach the feedback logging as a private forum post.

Thanks
Rob

0 Kudos
Rob5
New Contributor II
775 Views

Linfa,

I was able to replicate a difference with the build options. Can you disable the Initialize stack variables to an unusual value in Microsoft Visual Studio 2005? Set this VS option to No instead of Yes /Qtrapuv. This option is in project properties under Fortran > Data.

Then re-build the project and run an analysis mi3. For the analysis also enable the option Detect resource leaks Do you obtain different results? There should be one results with reference to ia=istack

Thanks
Rob

0 Kudos
Reply