public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32707] New: mismatched character lengths in array
@ 2007-07-09 19:02 vivekrao4 at yahoo dot com
2007-07-09 19:05 ` [Bug fortran/32707] " vivekrao4 at yahoo dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: vivekrao4 at yahoo dot com @ 2007-07-09 19:02 UTC (permalink / raw)
To: gcc-bugs
For the following invalid code
program xtrim_array
implicit none
character (len=4) :: xx(2)
xx = [trim("boy "),trim("girl")] ! invalid -- elements have different lengths
print*,"xx = '" // xx(1) // "' '" // xx(2) // "'"
end program xtrim_array
compiling and running with gfortran gives
gfortran -v -O0 -Wall -fbounds-check -static -g xtrim_array.f90
Driving: gfortran -v -O0 -Wall -fbounds-check -static -g xtrim_array.f90
-lgfortranbegin -lgfortran
Using built-in specs.
Target: i386-pc-mingw32
Configured with: ../trunk/configure --prefix=/mingw
--enable-languages=c,fortran --with-gmp=/home/coudert/local --disable-nls
--with-ld=/mingw/bin/ld --with-as=/mingw/bin/as --disable-werror
--enable-bootstrap --enable-threads --build=i386-pc-mingw32 --disable-shared
--enable-libgomp
Thread model: win32
gcc version 4.3.0 20070706 (experimental)
c:/programs/gfortran/bin/../libexec/gcc/i386-pc-mingw32/4.3.0/f951.exe
xtrim_array.f90 -quiet -dumpbase xtrim_array.f90 -mtune=i386 -auxbase
xtrim_array -g -O0 -Wall -version -fbounds-check -fintrinsic-modules-path
c:/programs/gfortran/bin/../lib/gcc/i386-pc-mingw32/4.3.0/finclude -o
C:\DOCUME~1\vrao\LOCALS~1\Temp/ccaETULf.s
GNU F95 version 4.3.0 20070706 (experimental) (i386-pc-mingw32)
compiled by GNU C version 4.3.0 20070706 (experimental), GMP version
4.2.1, MPFR version 2.2.1.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
as -o C:\DOCUME~1\vrao\LOCALS~1\Temp/ccg74eom.o
C:\DOCUME~1\vrao\LOCALS~1\Temp/ccaETULf.s
c:/programs/gfortran/bin/../libexec/gcc/i386-pc-mingw32/4.3.0/collect2.exe
-Bstatic c:/programs/g95/lib/crt2.o
c:/programs/gfortran/bin/../lib/gcc/i386-pc-mingw32/4.3.0/crtbegin.o
-Lc:/programs/gfortran/bin/../lib/gcc/i386-pc-mingw32/4.3.0
-Lc:/programs/gfortran/bin/../lib/gcc -Lc:/programs/g95/lib
-Lc:/programs/gfortran/bin/../lib/gcc/i386-pc-mingw32/4.3.0/../../..
C:\DOCUME~1\vrao\LOCALS~1\Temp/ccg74eom.o -lgfortranbegin -lgfortran -lmingw32
-lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32
-lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt
c:/programs/gfortran/bin/../lib/gcc/i386-pc-mingw32/4.3.0/crtend.o
U:\vrao\fortran>a
xx = 'boy ' 'girl'
It would be nice if gfortran gave a compile-time or run-time error.
Mingw G95 Jun 30 2007 with the default options says
In file xtrim_array.f90:4
xx = [trim("boy "),trim("girl")] ! invalid -- elements have different lengths
1
Error: Element in character array constructor at (1) has length 4 instead of 3
--
Summary: mismatched character lengths in array
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: vivekrao4 at yahoo dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32707
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/32707] mismatched character lengths in array
2007-07-09 19:02 [Bug fortran/32707] New: mismatched character lengths in array vivekrao4 at yahoo dot com
@ 2007-07-09 19:05 ` vivekrao4 at yahoo dot com
2007-07-10 8:16 ` dfranke at gcc dot gnu dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: vivekrao4 at yahoo dot com @ 2007-07-09 19:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from vivekrao4 at yahoo dot com 2007-07-09 19:05 -------
Gfortran also does not warn about the simpler code
program xtrim_array
! check if compiler catches character array constructor with elements of
different sizes
implicit none
character (len=4) :: xx(2)
xx = ["boy","girl"]
print*,"xx = '" // xx(1) // "' '" // xx(2) // "'"
end program xtrim_array
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32707
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/32707] mismatched character lengths in array
2007-07-09 19:02 [Bug fortran/32707] New: mismatched character lengths in array vivekrao4 at yahoo dot com
2007-07-09 19:05 ` [Bug fortran/32707] " vivekrao4 at yahoo dot com
@ 2007-07-10 8:16 ` dfranke at gcc dot gnu dot org
2007-08-12 10:24 ` [Bug fortran/32707] Warn on " fxcoudert at gcc dot gnu dot org
2009-01-03 21:16 ` dfranke at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-07-10 8:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from dfranke at gcc dot gnu dot org 2007-07-10 08:16 -------
See also: PR29267.
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dfranke at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32707
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/32707] Warn on mismatched character lengths in array
2007-07-09 19:02 [Bug fortran/32707] New: mismatched character lengths in array vivekrao4 at yahoo dot com
2007-07-09 19:05 ` [Bug fortran/32707] " vivekrao4 at yahoo dot com
2007-07-10 8:16 ` dfranke at gcc dot gnu dot org
@ 2007-08-12 10:24 ` fxcoudert at gcc dot gnu dot org
2009-01-03 21:16 ` dfranke at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-08-12 10:24 UTC (permalink / raw)
To: gcc-bugs
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|enhancement |normal
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |accepts-invalid, diagnostic
Last reconfirmed|0000-00-00 00:00:00 |2007-08-12 10:24:31
date| |
Summary|mismatched character lengths|Warn on mismatched character
|in array |lengths in array
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32707
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/32707] Warn on mismatched character lengths in array
2007-07-09 19:02 [Bug fortran/32707] New: mismatched character lengths in array vivekrao4 at yahoo dot com
` (2 preceding siblings ...)
2007-08-12 10:24 ` [Bug fortran/32707] Warn on " fxcoudert at gcc dot gnu dot org
@ 2009-01-03 21:16 ` dfranke at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2009-01-03 21:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from dfranke at gcc dot gnu dot org 2009-01-03 21:12 -------
Fixed in trunk. Both testcases give:
$> gfortran-svn pr32707.f90
pr32707.f90:5.12:
xx = ["boy","girl"]
1
Error: Different CHARACTER lengths (3/4) in array constructor at (1)
Testcases are already present in the testsuite. Closing.
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Known to fail| |4.3.2
Known to work| |4.4.0
Resolution| |FIXED
Target Milestone|--- |4.4.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32707
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-01-03 21:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-09 19:02 [Bug fortran/32707] New: mismatched character lengths in array vivekrao4 at yahoo dot com
2007-07-09 19:05 ` [Bug fortran/32707] " vivekrao4 at yahoo dot com
2007-07-10 8:16 ` dfranke at gcc dot gnu dot org
2007-08-12 10:24 ` [Bug fortran/32707] Warn on " fxcoudert at gcc dot gnu dot org
2009-01-03 21:16 ` dfranke at gcc dot gnu dot 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).