[Bug fortran/61147] New: Incorrect behavior using function that returns deferred length character pointer

Thomas.L.Clune at nasa dot gov gcc-bugzilla@gcc.gnu.org
Sun May 11 18:59:00 GMT 2014


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61147

            Bug ID: 61147
           Summary: Incorrect behavior using function that returns
                    deferred length character pointer
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Thomas.L.Clune at nasa dot gov

Created attachment 32777
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32777&action=edit
short reproducer

The attached reproducer manipulates a deferred length character component in a
data structure.   The function toPointer() returns a pointer to the internal
component, but evidently evaluates to in incorrect length.  In this particular
case, the length shows as 0 instead of 3, but variants have shown other
behavior.



bash-3.2$ gfortran -v functionPointer.F90 
Driving: gfortran -mmacosx-version-min=10.8.5 -v functionPointer.F90 -l
gfortran -shared-libgcc
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin12/4.9.0/lto-wrapper
Target: x86_64-apple-darwin12
Configured with:
/opt/local/var/macports/build/_opt_mports_dports_lang_gcc49/gcc49/work/gcc-4.9-20140406/configure
--prefix=/opt/local --build=x86_64-apple-darwin12
--enable-languages=c,c++,objc,obj-c++,fortran,java
--libdir=/opt/local/lib/gcc49 --includedir=/opt/local/include/gcc49
--infodir=/opt/local/share/info --mandir=/opt/local/share/man
--datarootdir=/opt/local/share/gcc-4.9 --with-local-prefix=/opt/local
--with-system-zlib --disable-nls --program-suffix=-mp-4.9
--with-gxx-include-dir=/opt/local/include/gcc49/c++/ --with-gmp=/opt/local
--with-mpfr=/opt/local --with-mpc=/opt/local --with-cloog=/opt/local
--enable-cloog-backend=isl --disable-cloog-version-check
--enable-stage1-checking --disable-multilib --enable-lto
--enable-libstdcxx-time --with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld
--with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket
--with-pkgversion='MacPorts gcc49 4.9-20140406_0'
Thread model: posix
gcc version 4.9.0 20140406 (experimental) (MacPorts gcc49 4.9-20140406_0) 
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.8.5' '-v' '-shared-libgcc'
'-mtune=core2'
 /opt/local/libexec/gcc/x86_64-apple-darwin12/4.9.0/f951 functionPointer.F90
-cpp=/var/folders/n1/j8dsqkvd1935f8myzbps0b6c0ytd28/T//ccvt1YpC.f90 -quiet -v
-D__DYNAMIC__ functionPointer.F90 -fPIC -quiet -dumpbase functionPointer.F90
-mmacosx-version-min=10.8.5 -mtune=core2 -auxbase functionPointer -version
-fintrinsic-modules-path
/opt/local/lib/gcc49/gcc/x86_64-apple-darwin12/4.9.0/finclude -o
/var/folders/n1/j8dsqkvd1935f8myzbps0b6c0ytd28/T//ccxFRujW.s
GNU Fortran (MacPorts gcc49 4.9-20140406_0) version 4.9.0 20140406
(experimental) (x86_64-apple-darwin12)
    compiled by GNU C version 4.9.0 20140406 (experimental), GMP version 6.0.0,
MPFR version 3.1.1-p2, MPC version 1.0.2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
ignoring nonexistent directory
"/opt/local/lib/gcc49/gcc/x86_64-apple-darwin12/4.9.0/../../../../../x86_64-apple-darwin12/include"
#include "..." search starts here:
#include <...> search starts here:
 /opt/local/lib/gcc49/gcc/x86_64-apple-darwin12/4.9.0/finclude
 /opt/local/lib/gcc49/gcc/x86_64-apple-darwin12/4.9.0/include
 /opt/local/include
 /opt/local/lib/gcc49/gcc/x86_64-apple-darwin12/4.9.0/include-fixed
 /usr/include
End of search list.
GNU Fortran (MacPorts gcc49 4.9-20140406_0) version 4.9.0 20140406
(experimental) (x86_64-apple-darwin12)
    compiled by GNU C version 4.9.0 20140406 (experimental), GMP version 6.0.0,
MPFR version 3.1.1-p2, MPC version 1.0.2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.8.5' '-v' '-shared-libgcc'
'-mtune=core2'
 /opt/local/bin/as -v -arch x86_64 -force_cpusubtype_ALL -o
/var/folders/n1/j8dsqkvd1935f8myzbps0b6c0ytd28/T//ccQUH7da.o
/var/folders/n1/j8dsqkvd1935f8myzbps0b6c0ytd28/T//ccxFRujW.s
Apple Inc version cctools-845, GNU assembler version 1.38
Reading specs from
/opt/local/lib/gcc49/gcc/x86_64-apple-darwin12/4.9.0/../../../libgfortran.spec
rename spec lib to liborig
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.8.5' '-v' '-shared-libgcc'
'-mtune=core2'
COMPILER_PATH=/opt/local/libexec/gcc/x86_64-apple-darwin12/4.9.0/:/opt/local/libexec/gcc/x86_64-apple-darwin12/4.9.0/:/opt/local/libexec/gcc/x86_64-apple-darwin12/:/opt/local/lib/gcc49/gcc/x86_64-apple-darwin12/4.9.0/:/opt/local/lib/gcc49/gcc/x86_64-apple-darwin12/
LIBRARY_PATH=/opt/local/lib/gcc49/gcc/x86_64-apple-darwin12/4.9.0/:/opt/local/lib/gcc49/gcc/x86_64-apple-darwin12/4.9.0/../../../:/usr/lib/
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.8.5' '-v' '-shared-libgcc'
'-mtune=core2'
 /opt/local/libexec/gcc/x86_64-apple-darwin12/4.9.0/collect2 -dynamic -arch
x86_64 -macosx_version_min 10.8.5 -weak_reference_mismatches non-weak -o a.out
-L/opt/local/lib/gcc49/gcc/x86_64-apple-darwin12/4.9.0
-L/opt/local/lib/gcc49/gcc/x86_64-apple-darwin12/4.9.0/../../..
/var/folders/n1/j8dsqkvd1935f8myzbps0b6c0ytd28/T//ccQUH7da.o -lgfortran
-no_compact_unwind -lSystem -lgcc_ext.10.5 -lgcc -lquadmath -lm -lgcc_ext.10.5
-lgcc -lSystem -v
collect2 version 4.9.0 20140406 (experimental)
/opt/local/bin/ld -dynamic -arch x86_64 -macosx_version_min 10.8.5
-weak_reference_mismatches non-weak -o a.out
-L/opt/local/lib/gcc49/gcc/x86_64-apple-darwin12/4.9.0
-L/opt/local/lib/gcc49/gcc/x86_64-apple-darwin12/4.9.0/../../..
/var/folders/n1/j8dsqkvd1935f8myzbps0b6c0ytd28/T//ccQUH7da.o -lgfortran
-no_compact_unwind -lSystem -lgcc_ext.10.5 -lgcc -lquadmath -lm -lgcc_ext.10.5
-lgcc -lSystem -v
@(#)PROGRAM:ld  PROJECT:ld64-136
configured to support archs: i386 x86_64 armv7 armv7s
Library search paths:
    /opt/local/lib/gcc49/gcc/x86_64-apple-darwin12/4.9.0
    /opt/local/lib/gcc49
    /usr/lib
    /usr/local/lib
Framework search paths:
    /Library/Frameworks/
    /System/Library/Frameworks/
 /opt/local/bin/nm -n
/var/folders/n1/j8dsqkvd1935f8myzbps0b6c0ytd28/T//ccQUH7da.o



More information about the Gcc-bugs mailing list