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

           Summary: length of a character derived-type component
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: mh...@gmx.at


Created attachment 24192
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24192
test case

Consider the following derived-type definition:

type ::  string_t
   character( len= 10 ) ::  str
end type string_t

In case of a variable of type string_t, e.g.

type( string_t ) ::  string1 =  string_t( "text" )

the length of the character component is—as expected—10. In case of a constant
of type string_t, e.g.

type( string_t ), parameter ::  string2 =  string_t( "text" )

the length of the character component is, however, as if it had been declared
with len= *.

$ gfortran-4.6 -v -o test test.f90 && ./test

Driving: gfortran-4.6 -v -o test test.f90 -l gfortran -l m -shared-libgcc

Using built-in specs.

COLLECT_GCC=gfortran-4.6

COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6.1/lto-wrapper

Target: x86_64-linux-gnu

Configured with: ../src/configure -v --with-pkgversion='Debian 4.6.0-2'
--with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr
--program-suffix=-4.6 --enable-shared --enable-multiarch
--enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls
--enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes
--enable-plugin --enable-gold --enable-ld=default --with-plugin-ld
--enable-objc-gc --with-arch-32=i586 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu

Thread model: posix

gcc version 4.6.1 20110329 (prerelease) (Debian 4.6.0-2)

COLLECT_GCC_OPTIONS='-v' '-o' 'test' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'

/usr/lib/gcc/x86_64-linux-gnu/4.6.1/f951 test.f90 -quiet -dumpbase test.f90
-mtune=generic -march=x86-64 -auxbase test -version -fintrinsic-modules-path
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/finclude -o /tmp/ccYXc4lM.s

GNU Fortran (Debian 4.6.0-2) version 4.6.1 20110329 (prerelease)
(x86_64-linux-gnu)
compiled by GNU C version 4.6.1 20110329 (prerelease), GMP version 5.0.1, MPFR
version 3.0.0-p8, MPC version 0.9

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072

GNU Fortran (Debian 4.6.0-2) version 4.6.1 20110329 (prerelease)
(x86_64-linux-gnu)
compiled by GNU C version 4.6.1 20110329 (prerelease), GMP version 5.0.1, MPFR
version 3.0.0-p8, MPC version 0.9

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072

COLLECT_GCC_OPTIONS='-v' '-o' 'test' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'

as --64 -o /tmp/ccmkcGOj.o /tmp/ccYXc4lM.s

Reading specs from /usr/lib/gcc/x86_64-linux-gnu/4.6.1/libgfortran.spec

rename spec lib to liborig

COLLECT_GCC_OPTIONS='-v' '-o' 'test' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'

COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.6.1/:/usr/lib/gcc/x86_64-linux-gnu/4.6.1/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.6.1/:/usr/lib/gcc/x86_64-linux-gnu/

LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.6.1/:/usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../../lib/:/lib/../lib/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../:/lib/:/usr/lib/:/usr/lib/x86_64-linux-gnu/

COLLECT_GCC_OPTIONS='-v' '-o' 'test' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'

/usr/lib/gcc/x86_64-linux-gnu/4.6.1/collect2 --build-id --no-add-needed
--eh-frame-hdr -m elf_x86_64 --hash-style=both -dynamic-linker
/lib64/ld-linux-x86-64.so.2 -o test
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../../lib/crt1.o
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../../lib/crti.o
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/crtbegin.o
-L/usr/lib/gcc/x86_64-linux-gnu/4.6.1
-L/usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../../lib -L/lib/../lib
-L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../..
-L/usr/lib/x86_64-linux-gnu /tmp/ccmkcGOj.o -lgfortran -lm -lgcc_s -lgcc
-lquadmath -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/crtend.o
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../../lib/crtn.o

text      10
text4

Reply via email to