public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/48890] New: length of a character derived-type component
@ 2011-05-05 20:00 mhp77 at gmx dot at
  2013-02-26 16:04 ` [Bug fortran/48890] " dominiq at lps dot ens.fr
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: mhp77 at gmx dot at @ 2011-05-05 20:00 UTC (permalink / raw)
  To: gcc-bugs

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: unassigned@gcc.gnu.org
        ReportedBy: mhp77@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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/48890] length of a character derived-type component
  2011-05-05 20:00 [Bug fortran/48890] New: length of a character derived-type component mhp77 at gmx dot at
@ 2013-02-26 16:04 ` dominiq at lps dot ens.fr
  2015-05-03 21:35 ` [Bug fortran/48890] [F95] Wrong length of a character component of named constant derived-type fxcoudert at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-02-26 16:04 UTC (permalink / raw)
  To: gcc-bugs


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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-02-26
                 CC|                            |burnus@net-b.de
     Ever Confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2013-02-26 16:03:22 UTC ---
I confirm this behavior from 4.2.4 to trunk (and g95). It looks like a bug as I
did not find anything in the f2008 standard allowing this behavior (but I may
have missed some fine prints).


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/48890] [F95] Wrong length of a character component of named constant derived-type
  2011-05-05 20:00 [Bug fortran/48890] New: length of a character derived-type component mhp77 at gmx dot at
  2013-02-26 16:04 ` [Bug fortran/48890] " dominiq at lps dot ens.fr
@ 2015-05-03 21:35 ` fxcoudert at gcc dot gnu.org
  2015-05-04  8:24 ` burnus at gcc dot gnu.org
  2015-05-04  9:48 ` tkoenig at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2015-05-03 21:35 UTC (permalink / raw)
  To: gcc-bugs

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

Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|4.6.1                       |6.0
             Blocks|                            |32834
            Summary|length of a character       |[F95] Wrong length of a
                   |derived-type component with |character component of
                   |PARAMETER                   |named constant derived-type

--- Comment #3 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
It's a "Fortran 95"-only issue! See the variant below:

   implicit none
   type :: a_t
      character(len=10) :: s = "x"
   end type a_t
   type(a_t), parameter :: foo = a_t("")
   print *, len(foo%s), len_trim(foo%s)
   end


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32834
[Bug 32834] [Meta-bug] 'Fortran 95'-only failures


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/48890] [F95] Wrong length of a character component of named constant derived-type
  2011-05-05 20:00 [Bug fortran/48890] New: length of a character derived-type component mhp77 at gmx dot at
  2013-02-26 16:04 ` [Bug fortran/48890] " dominiq at lps dot ens.fr
  2015-05-03 21:35 ` [Bug fortran/48890] [F95] Wrong length of a character component of named constant derived-type fxcoudert at gcc dot gnu.org
@ 2015-05-04  8:24 ` burnus at gcc dot gnu.org
  2015-05-04  9:48 ` tkoenig at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2015-05-04  8:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Francois-Xavier Coudert from comment #3)
> It's a "Fortran 95"-only issue! See the variant below:

Why? I don't see ad hoc anything which makes this a F95-only bug. It looks to
me like a general (g)Fortran bug (F90, F95, F2003, F2008, F2018).


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/48890] [F95] Wrong length of a character component of named constant derived-type
  2011-05-05 20:00 [Bug fortran/48890] New: length of a character derived-type component mhp77 at gmx dot at
                   ` (2 preceding siblings ...)
  2015-05-04  8:24 ` burnus at gcc dot gnu.org
@ 2015-05-04  9:48 ` tkoenig at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2015-05-04  9:48 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tkoenig at gcc dot gnu.org

--- Comment #5 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #4)
> (In reply to Francois-Xavier Coudert from comment #3)
> > It's a "Fortran 95"-only issue! See the variant below:
> 
> Why? I don't see ad hoc anything which makes this a F95-only bug. It looks
> to me like a general (g)Fortran bug (F90, F95, F2003, F2008, F2018).

This means that this is a bug that is exposed by using only F95 features.
These should receive high priority because we can not yet claim
conformance to a standard > F95.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-05-04  9:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-05 20:00 [Bug fortran/48890] New: length of a character derived-type component mhp77 at gmx dot at
2013-02-26 16:04 ` [Bug fortran/48890] " dominiq at lps dot ens.fr
2015-05-03 21:35 ` [Bug fortran/48890] [F95] Wrong length of a character component of named constant derived-type fxcoudert at gcc dot gnu.org
2015-05-04  8:24 ` burnus at gcc dot gnu.org
2015-05-04  9:48 ` tkoenig at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).