Hi! I am using the gfortran compiler in Ubuntu 8.10 (gfortran 4.3.2).
I ran into a bug with calling mkdtemp(3) via the BIND(C) feature. In some way gfortran truncates the string on return from the Fortran subroutine. All results seems to be Ok inside the Fortran subroutine but the caller does not get the proper value? Please look at the examples below and mkdtemp(3) as they explain better than I can with my poor English. :-) Wrong results from gfortran: na56:1d_longtime>gfortran -o callbug callbug.f90 na56:1d_longtime>./callbug ctemp = /tmp/foo.XXXXXX ctemp after call: /tmp/foo.HMq3kW template = [/tmp/foo.HMq3kW] template = .HMq3kW na56:1d_longtime> Correct results from sunstudio 12 na56:1d_longtime>sunf95 -o callbug callbug.f90 na56:1d_longtime>./callbug ctemp = /tmp/foo.XXXXXX ctemp after call: /tmp/foo.lEniI6 template = [/tmp/foo.lEniI6] template = /tmp/foo.lEniI6 na56:1d_longtime> I will attach the source code in another post. Thank you for a great compiler! Henrik Holst -- Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.3.2-1ubuntu11' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu Thread model: posix gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu11) -- Summary: string truncated on return from subroutine (calling mkdtemp bind(c)) Product: gcc Version: 4.3.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: holst at matmech dot com GCC target triplet: i486-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38082