Code Comments
Programming Forum and web based access to our favorite programming groups.Hello, I would like to ask you if the following code is legal (notice the LEN type parameter of MOD_B_STRING): module mod_a implicit none character(len=100) :: mod_a_string end module mod_a module mod_b use mod_a implicit none contains subroutine mod_b_sub() character(len=len(trim(mod_a_string))+2) :: & mod_b_string mod_b_string = trim(mod_a_string) // '!!' write(*,*) mod_b_string end subroutine mod_b_sub end module mod_b program test_string use mod_a use mod_b implicit none mod_a_string = 'Hello' call mod_b_sub() end program test_string When this code is compiled with gfortran or ifort, it behaves "as expected", in that it prints Hello!! (no warning even when using all the debugging options). Also, valgrind shows no errors. With pgf, however, the code compiles with no errors but at runtime produces a huge blank output. Here, valgrind complains about "Conditional jump or move depends on uninitialised value(s)" at CALL MOD_B_SUB(). (more details: gfortran --version GNU Fortran 95 (GCC) 4.1.2 (Gentoo 4.1.2) ifort --version ifort (IFORT) 9.1 20061101 pgf95 -V pgf95 6.1-1 32-bit target on x86 Linux) Thank you! Marco Restelli
Post Follow-up to this messageOn Mon, 20 Aug 2007 06:29:51 -0700, mrestelli@gmail.com wrote (in article <1187616591.093651.68110@k79g2000hse.googlegroups.com> ): > I would like to ask you if the following code is legal (notice the > LEN type parameter of MOD_B_STRING): [code elided] Yes, that looks fine. It is even ok in f90. (This is an area where things go t progressively more liberal with each version of the standard, but this one looks ok for f90 and later). > When this code is compiled with gfortran or ifort, it behaves "as > expected", in that it prints Hello!! (no warning even when using all > the debugging options). Also, valgrind shows no errors. Good. > With pgf, however,... I'd suggest a bug report. Pgf isn't the most robust compiler out there. It i s better than it used to be, but still has plenty of room to go. -- Richard Maine | Good judgement comes from experience; email: last name at domain . net | experience comes from bad judgement. domain: summertriangle | -- Mark Twain ________________________________________ ________ Hogwasher, Premier News and Mail for OS X http://www.asar.com/cgi-bin/product.../hogwasher.html ________________________________________ ________
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.