invalid memory access by Fortran intrinsic date_and_time

invalid memory access by Fortran intrinsic date_and_time

Alexis R.'s picture

Apologies if this is FAQ, but the following code when compiled with -g and -O0 has a "Invalid memory access problem" on line 4 - is there an explanation for this? I think the Fortran is kosher, and this is an intrinsic function.

program test
 implicit none
 integer :: date_values(8)
 call date_and_time(values=date_values)
 print '(a,8(i0,x))', 'date values = ', date_values
end program test

This is with composer XE update 3 and inspector XE update 2, under Fedora 13. The Memory Error Analysis preset I used was "Locate Memory Problems".

Similarly, the inspector finds an "Invalid memory access problem" on line 6 of this test program:

program test
 implicit none
 character(len=4), parameter :: var_name = 'TERM'
 character(len=11) :: var_value
 integer :: ierr
 call get_environment_variable(var_name,value=var_value,status=ierr)
 if (ierr .ne. 0) then
  print *, 'error when getting env var: ', ierr
 endif
 print '(4a)', 'environment variable ', var_name, ' = ', trim(adjustl(var_value))
end program test
5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Peter Wang (Intel)'s picture

I cannot reproduce this problem. Save test case 1 to test_insp.f90, test case 2 to test_insp1.f90

[root@NHM02 problem_report]# ifort --version
ifort (IFORT) 12.0.3 20110309
Copyright (C) 1985-2011 Intel Corporation. All rights reserved.

[root@NHM02 problem_report]# ifort -g test_insp.f90 -o test_insp

[root@NHM02 problem_report]# ifort -g test_insp1.f90 -o test_insp1

[root@NHM02 problem_report]# inspxe-cl -version
Intel Inspector XE 2011 Update 1 (build 131372) Command Line tool
Copyright (C) 2009-2010 Intel Corporation. All rights reserved.

[root@NHM02 problem_report]# ifort -g test_insp.f90 -o test_insp
[root@NHM02 problem_report]# inspxe-cl -collect mi3 -- ./test_insp
Used suppression file(s): []
date values = 2011 4 25 480 15 38 44 454

0 new problem(s) found

[root@NHM02 problem_report]# inspxe-cl -collect mi3 -- ./test_insp1
Used suppression file(s): []
environment variable TERM = xterm

0 new problem(s) found

Regards, Peter

Alexis R.'s picture

Insteresting... As you will see below, with exactly the same commands and the same versions of Composer & Inspector, I get different results. Please advise what steps to take next to debug this.

$ ifort --version
ifort (IFORT) 12.0.3 20110309
Copyright (C) 1985-2011 Intel Corporation.  All rights reserved.

$ ifort -g test_date.f90 -o test_date
$ inspxe-cl -version
Intel Inspector XE 2011 Update 1 (build 131372) Command Line tool
Copyright (C) 2009-2010 Intel Corporation. All rights reserved.
$ inspxe-cl -collect mi3 -- ./test_date
Used suppression file(s): []
date values = 2011 4 25 -240 9 47 22 60
  
1 new problem(s) found 
    1 Invalid memory access problem(s) detected 
$ ifort -g test_env.f90 -o test_env
$ inspxe-cl -collect mi3 -- ./test_env
Used suppression file(s): []
environment variable TERM = xterm
  
2 new problem(s) found 
    1 Invalid memory access problem(s) detected 
    1 Invalid partial memory access problem(s) detected 
Alexis R.'s picture

Peter, Any news on this? On my part I have found that running Inspector as root on the same files gives different results, with only the "Invalid partial memory access" error in the test_env case. In the test_date case though, I got exactly the same output as above when running as root. It would be good to get some feedback on this.

Peter Wang (Intel)'s picture
Best Reply

The problem has been solved in latest Update 3 - please download new package from Intel Registration Center, Download Site. Regards, Peter

Login to leave a comment.