Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29571 Discussions

Memory error from PRINT * under Fedora core 2

Anonymous19
Beginner
773 Views

I have the file tst.f90, which only contains the code

PROGRAM TEST
  PRINT *
END PROGRAM TEST

I compile this, using ifort version 9.0, as

ifort tst.f90 -oftest

If I test the generated executable ftest for bad memory behaviour with Valgrind's memory checking tool, using the command

valgrind --tool=memcheck ftest

I get the following output:

==31819== Memcheck, a memory error detector for x86-linux.
==31819== Copyright (C) 2002-2004, and GNU GPL'd, by Julian Seward et al.
==31819== Using valgrind-2.2.0, a program supervision framework for x86-linux.
==31819== Copyright (C) 2000-2004, and GNU GPL'd, by Julian Seward et al.
==31819== For more details, rerun with: -v
==31819==
==31819== Invalid read of size 4
==31819==    at 0x805AF02: unaligned_bigint (in /.automount/funsrv1/root/home/dtaylor/IDAM_DEV/ftest)
==31819==    by 0x805AEA2: hash (in /.automount/funsrv1/root/home/dtaylor/IDAM_DEV/ftest)
==31819==    by 0x805AC83: for__add_to_lf_table (in /.automount/funsrv1/root/home/dtaylor/IDAM_DEV/ftest)
==31819==    by 0x805FA41: for__open_proc. (in /.automount/funsrv1/root/home/dtaylor/IDAM_DEV/ftest)
==31819==  Address 0x1BAFF09C is 1 bytes after a block of size 11 alloc'd
==31819==    at 0x1B904A80: malloc (vg_replace_malloc.c:131)
==31819==    by 0x804ED6A: for__get_vm (in /.automount/funsrv1/root/home/dtaylor/IDAM_DEV/ftest)
==31819==    by 0x805E855: for__open_proc. (in /.automount/funsrv1/root/home/dtaylor/IDAM_DEV/ftest)
==31819==    by 0x805CB0B: for__open_default (in /.automount/funsrv1/root/home/dtaylor/IDAM_DEV/ftest)

==31819==
==31819== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 16 from 1)
==31819== malloc/free: in use at exit: 0 bytes in 0 blocks.
==31819== malloc/free: 7 allocs, 7 frees, 5270 bytes allocated.
==31819== For a detailed leak analysis,  rerun with: --leak-check=yes
==31819== For counts of detected errors, rerun with: -v

This looks to me like a bug in the way ifort handles its print statements, at least under this OS. Is this right?

 

Cheers,

Dave

0 Kudos
1 Reply
Steven_L_Intel1
Employee
773 Views
I don't know. I have seen, on Windows, that MSVC's debug error checking can get confused by the way that Fortran manages memory. I would suggest that you file an inquiry to Intel Premier Support so that the developers can take a look.
0 Kudos
Reply