* [Bug fortran/31346] wrong values for ubound and size of deferred shape arrays
2007-03-25 12:37 [Bug fortran/31346] New: wrong values for ubound and size of deferred shape arrays mikael dot morin at tele2 dot fr
@ 2007-03-25 12:39 ` mikael dot morin at tele2 dot fr
2007-03-25 12:41 ` mikael dot morin at tele2 dot fr
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: mikael dot morin at tele2 dot fr @ 2007-03-25 12:39 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from mikael dot morin at tele2 dot fr 2007-03-25 14:38 -------
Created an attachment (id=13283)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13283&action=view)
program showing the bug
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31346
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/31346] wrong values for ubound and size of deferred shape arrays
2007-03-25 12:37 [Bug fortran/31346] New: wrong values for ubound and size of deferred shape arrays mikael dot morin at tele2 dot fr
2007-03-25 12:39 ` [Bug fortran/31346] " mikael dot morin at tele2 dot fr
@ 2007-03-25 12:41 ` mikael dot morin at tele2 dot fr
2007-03-26 4:58 ` mikael dot morin at tele2 dot fr
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: mikael dot morin at tele2 dot fr @ 2007-03-25 12:41 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1474 bytes --]
------- Comment #2 from mikael dot morin at tele2 dot fr 2007-03-25 14:41 -------
$ FC=gfortran; $FC -v; $FC -o test test.f; echo; ./test
Lecture des spécification à partir de
/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/specs
Target: x86_64-pc-linux-gnu
Configuré avec: /usr/src/gcc-4.1.2/configure --host=x86_64-pc-linux-gnu
--prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man
--enable-threads=posix --with-system-zlib --enable-languages=f95
--disable-multilib
Modèle de thread: posix
version gcc 4.1.2
size= 5
size= 25
ubound= 5
ubound= 5 5
size= 0
size= 0
ubound= 0
ubound= 2193121 0
FC=/usr/local/bin/gfortran; $FC -v; $FC -o test test.f; echo; ./test
Utilisation des specs internes.
Target: x86_64-unknown-linux-gnu
Configuré avec: ../gcc-4.3-20070316/configure --enable-languages=fortran
--disable-multilib
Modèle de thread: posix
version gcc 4.3.0 20070316 (experimental)
size= 5
size= 25
ubound= 5
ubound= 5 5
size= -250
size= 0
ubound= 0
ubound= 5222132 0
--
mikael dot morin at tele2 dot fr changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |4.1.2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31346
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/31346] wrong values for ubound and size of deferred shape arrays
2007-03-25 12:37 [Bug fortran/31346] New: wrong values for ubound and size of deferred shape arrays mikael dot morin at tele2 dot fr
2007-03-25 12:39 ` [Bug fortran/31346] " mikael dot morin at tele2 dot fr
2007-03-25 12:41 ` mikael dot morin at tele2 dot fr
@ 2007-03-26 4:58 ` mikael dot morin at tele2 dot fr
2007-03-26 6:19 ` pault at gcc dot gnu dot org
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: mikael dot morin at tele2 dot fr @ 2007-03-26 4:58 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from mikael dot morin at tele2 dot fr 2007-03-26 05:58 -------
Created an attachment (id=13286)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13286&action=view)
the working case
The problem arise when the subroutine is not defined in a contains statement in
the main program.
I haven't seen anything in the Fortran 2003 standard forcing the subroutines to
be in the contains statement.
But even if it is the case, the compiler should report an error.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31346
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/31346] wrong values for ubound and size of deferred shape arrays
2007-03-25 12:37 [Bug fortran/31346] New: wrong values for ubound and size of deferred shape arrays mikael dot morin at tele2 dot fr
` (2 preceding siblings ...)
2007-03-26 4:58 ` mikael dot morin at tele2 dot fr
@ 2007-03-26 6:19 ` pault at gcc dot gnu dot org
2007-04-07 16:04 ` tobi at gcc dot gnu dot org
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-03-26 6:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pault at gcc dot gnu dot org 2007-03-26 07:19 -------
(In reply to comment #3)
> I haven't seen anything in the Fortran 2003 standard forcing the subroutines to
> be in the contains statement.
In this case the interface is said to be implicit and the standard does not
require the programme to do the right thing. Use an INTERFACE, as below, or put
the subroutine in a module. In either case the interface will be made
explicit.
> But even if it is the case, the compiler should report an error.
This is not a requirement of the standard but is a long standing regression,
relative to g77.
Confirmed and marked as "diagnostic"
Nous t'en remercions
Cordialement
Paul
program test
interface
subroutine test1(x,y)
real(kind=8), dimension(:) :: x
real(kind=8), dimension(:,:) :: y
end subroutine
end interface
real(kind=8), dimension(5) :: test_array
real(kind=8), dimension(5,5) :: test_array2
real(kind=8) :: taille
write(6,*) 'size=', size(test_array)
write(6,*) 'size=', size(test_array2)
write(6,*) 'ubound=', ubound(test_array)
write(6,*) 'ubound=', ubound(test_array2)
call test1(test_array, test_array2)
end program
>
--
pault at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |diagnostic
Known to fail|4.1.2 |4.3.0 4.2.0
Last reconfirmed|0000-00-00 00:00:00 |2007-03-26 07:19:26
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31346
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/31346] wrong values for ubound and size of deferred shape arrays
2007-03-25 12:37 [Bug fortran/31346] New: wrong values for ubound and size of deferred shape arrays mikael dot morin at tele2 dot fr
` (3 preceding siblings ...)
2007-03-26 6:19 ` pault at gcc dot gnu dot org
@ 2007-04-07 16:04 ` tobi at gcc dot gnu dot org
2007-10-02 11:27 ` fxcoudert at gcc dot gnu dot org
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: tobi at gcc dot gnu dot org @ 2007-04-07 16:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from tobi at gcc dot gnu dot org 2007-04-07 17:04 -------
(In reply to comment #4)
> (In reply to comment #3)
> > But even if it is the case, the compiler should report an error.
>
> This is not a requirement of the standard but is a long standing regression,
> relative to g77.
Really? From how I read the standard (F2K draft), UBOUND(ARRAY, DIM) has (in
this case) "a value equal to the upper bound for subscript DIM of ARRAY". I
can't see it allowing returning random values such as 2193121.
--
tobi at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tobi at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31346
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/31346] wrong values for ubound and size of deferred shape arrays
2007-03-25 12:37 [Bug fortran/31346] New: wrong values for ubound and size of deferred shape arrays mikael dot morin at tele2 dot fr
` (4 preceding siblings ...)
2007-04-07 16:04 ` tobi at gcc dot gnu dot org
@ 2007-10-02 11:27 ` fxcoudert at gcc dot gnu dot org
2007-11-12 1:14 ` fxcoudert at gcc dot gnu dot org
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-10-02 11:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from fxcoudert at gcc dot gnu dot org 2007-10-02 11:27 -------
(In reply to comment #5)
> Really? From how I read the standard (F2K draft), UBOUND(ARRAY, DIM) has (in
> this case) "a value equal to the upper bound for subscript DIM of ARRAY". I
> can't see it allowing returning random values such as 2193121.
The program shown is not valid Fortran, the processor can do whatever it wants.
A most sensible choice would be to reject it, of course: that's what g95 does
(and g77 also, according to Paul) but others have chosen to segfault (Intel,
Sun).
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
GCC build triplet|x86_64-linux-gnu |
GCC host triplet|x86_64-linux-gnu |
GCC target triplet|x86_64-linux-gnu |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31346
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/31346] wrong values for ubound and size of deferred shape arrays
2007-03-25 12:37 [Bug fortran/31346] New: wrong values for ubound and size of deferred shape arrays mikael dot morin at tele2 dot fr
` (5 preceding siblings ...)
2007-10-02 11:27 ` fxcoudert at gcc dot gnu dot org
@ 2007-11-12 1:14 ` fxcoudert at gcc dot gnu dot org
2009-12-20 20:10 ` tkoenig at gcc dot gnu dot org
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-11-12 1:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from fxcoudert at gcc dot gnu dot org 2007-11-12 01:14 -------
I don't see how this can be a regression wrt g77, which doesn't have
assumed-shape arrays or even UBOUND!
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31346
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/31346] wrong values for ubound and size of deferred shape arrays
2007-03-25 12:37 [Bug fortran/31346] New: wrong values for ubound and size of deferred shape arrays mikael dot morin at tele2 dot fr
` (6 preceding siblings ...)
2007-11-12 1:14 ` fxcoudert at gcc dot gnu dot org
@ 2009-12-20 20:10 ` tkoenig at gcc dot gnu dot org
2010-05-23 22:34 ` dfranke at gcc dot gnu dot org
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2009-12-20 20:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from tkoenig at gcc dot gnu dot org 2009-12-20 20:10 -------
We fail to catch the invalid code
$ cat whole.f90
program main
real, dimension(2) :: a
call foo(a)
end program main
subroutine foo(a)
real, dimension(:) :: a
end subroutine foo
$ gfortran -fwhole-file -O3 whole.f90
$
--
tkoenig at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tkoenig at gcc dot gnu dot
| |org
OtherBugsDependingO| |40011
nThis| |
Severity|normal |enhancement
Known to fail|4.3.0 4.2.0 |4.3.0 4.2.0 4.5.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31346
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/31346] wrong values for ubound and size of deferred shape arrays
2007-03-25 12:37 [Bug fortran/31346] New: wrong values for ubound and size of deferred shape arrays mikael dot morin at tele2 dot fr
` (7 preceding siblings ...)
2009-12-20 20:10 ` tkoenig at gcc dot gnu dot org
@ 2010-05-23 22:34 ` dfranke at gcc dot gnu dot org
2010-05-23 22:35 ` [Bug fortran/31346] wrong values for ubound and size of deferred shape arrays without explicit interface dfranke at gcc dot gnu dot org
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2010-05-23 22:34 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from dfranke at gcc dot gnu dot org 2010-05-23 22:34 -------
*** Bug 36553 has been marked as a duplicate of this bug. ***
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dominiq at lps dot ens dot
| |fr
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31346
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/31346] wrong values for ubound and size of deferred shape arrays without explicit interface
2007-03-25 12:37 [Bug fortran/31346] New: wrong values for ubound and size of deferred shape arrays mikael dot morin at tele2 dot fr
` (8 preceding siblings ...)
2010-05-23 22:34 ` dfranke at gcc dot gnu dot org
@ 2010-05-23 22:35 ` dfranke at gcc dot gnu dot org
2010-05-25 18:10 ` dfranke at gcc dot gnu dot org
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2010-05-23 22:35 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from dfranke at gcc dot gnu dot org 2010-05-23 22:35 -------
The dupe had accepts-invalid, adding it here. Pushing back from enhancement to
normal.
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|enhancement |normal
Keywords| |accepts-invalid
Known to fail|4.3.0 4.2.0 4.5.0 |4.3.0 4.2.0 4.5.0 4.6.0
Summary|wrong values for ubound and |wrong values for ubound and
|size of deferred shape |size of deferred shape
|arrays |arrays without explicit
| |interface
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31346
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/31346] wrong values for ubound and size of deferred shape arrays without explicit interface
2007-03-25 12:37 [Bug fortran/31346] New: wrong values for ubound and size of deferred shape arrays mikael dot morin at tele2 dot fr
` (9 preceding siblings ...)
2010-05-23 22:35 ` [Bug fortran/31346] wrong values for ubound and size of deferred shape arrays without explicit interface dfranke at gcc dot gnu dot org
@ 2010-05-25 18:10 ` dfranke at gcc dot gnu dot org
2010-07-18 20:50 ` dfranke at gcc dot gnu dot org
2010-07-18 21:13 ` dfranke at gcc dot gnu dot org
12 siblings, 0 replies; 14+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2010-05-25 18:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from dfranke at gcc dot gnu dot org 2010-05-25 18:10 -------
Subject: Bug 31346
Author: dfranke
Date: Tue May 25 18:10:01 2010
New Revision: 159838
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159838
Log:
gcc/fortran/:
2010-05-25 Daniel Franke <franke.daniel@gmail.com>
PR fortran/30668
PR fortran/31346
PR fortran/34260
* resolve.c (resolve_global_procedure): Add check for global
procedures with implicit interfaces and assumed-shape or optional
dummy arguments. Verify that function return type, kind and string
lengths match.
gcc/testsuite/:
2010-05-25 Daniel Franke <franke.daniel@gmail.com>
PR fortran/30668
PR fortran/31346
PR fortran/34260
* gfortran.dg/pr40999.f: Fix function type.
* gfortran.dg/whole_file_5.f90: Likewise.
* gfortran.dg/whole_file_6.f90: Likewise.
* gfortran.dg/whole_file_16.f90: New.
* gfortran.dg/whole_file_17.f90: New.
* gfortran.dg/whole_file_18.f90: New.
Added:
trunk/gcc/testsuite/gfortran.dg/whole_file_16.f90
trunk/gcc/testsuite/gfortran.dg/whole_file_17.f90
trunk/gcc/testsuite/gfortran.dg/whole_file_18.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/resolve.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/pr40999.f
trunk/gcc/testsuite/gfortran.dg/whole_file_5.f90
trunk/gcc/testsuite/gfortran.dg/whole_file_6.f90
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31346
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/31346] wrong values for ubound and size of deferred shape arrays without explicit interface
2007-03-25 12:37 [Bug fortran/31346] New: wrong values for ubound and size of deferred shape arrays mikael dot morin at tele2 dot fr
` (10 preceding siblings ...)
2010-05-25 18:10 ` dfranke at gcc dot gnu dot org
@ 2010-07-18 20:50 ` dfranke at gcc dot gnu dot org
2010-07-18 21:13 ` dfranke at gcc dot gnu dot org
12 siblings, 0 replies; 14+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2010-07-18 20:50 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from dfranke at gcc dot gnu dot org 2010-07-18 20:49 -------
Subject: Bug 31346
Author: dfranke
Date: Sun Jul 18 20:49:30 2010
New Revision: 162287
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162287
Log:
gcc/fortran/:
2010-07-18 Daniel Franke <franke.daniel@gmail.com>
Paul Thomas <pault@gcc.gnu.org>
PR fortran/30668
PR fortran/31346
PR fortran/34260
* resolve.c (resolve_global_procedure): Improved checking if an
explicit interface is required.
PR fortran/40011
* resolve.c (resolve_global_procedure): Resolve the gsymbol's
namespace before trying to reorder the gsymbols.
gcc/testsuite/:
2010-07-18 Daniel Franke <franke.daniel@gmail.com>
Paul Thomas <pault@gcc.gnu.org>
PR fortran/30668
PR fortran/31346
PR fortran/34260
PR fortran/40011
* gfortran.dg/pr40999.f: Fix function type.
* gfortran.dg/whole_file_5.f90: Likewise.
* gfortran.dg/whole_file_6.f90: Likewise.
* gfortran.dg/whole_file_16.f90: New.
* gfortran.dg/whole_file_17.f90: New.
* gfortran.dg/whole_file_18.f90: New.
* gfortran.dg/whole_file_19.f90: New.
Added:
branches/gcc-4_5-branch/gcc/testsuite/gfortran.dg/whole_file_16.f90
branches/gcc-4_5-branch/gcc/testsuite/gfortran.dg/whole_file_17.f90
branches/gcc-4_5-branch/gcc/testsuite/gfortran.dg/whole_file_18.f90
branches/gcc-4_5-branch/gcc/testsuite/gfortran.dg/whole_file_19.f90
Modified:
branches/gcc-4_5-branch/gcc/fortran/ChangeLog
branches/gcc-4_5-branch/gcc/fortran/resolve.c
branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
branches/gcc-4_5-branch/gcc/testsuite/gfortran.dg/pr40999.f
branches/gcc-4_5-branch/gcc/testsuite/gfortran.dg/whole_file_5.f90
branches/gcc-4_5-branch/gcc/testsuite/gfortran.dg/whole_file_6.f90
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31346
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/31346] wrong values for ubound and size of deferred shape arrays without explicit interface
2007-03-25 12:37 [Bug fortran/31346] New: wrong values for ubound and size of deferred shape arrays mikael dot morin at tele2 dot fr
` (11 preceding siblings ...)
2010-07-18 20:50 ` dfranke at gcc dot gnu dot org
@ 2010-07-18 21:13 ` dfranke at gcc dot gnu dot org
12 siblings, 0 replies; 14+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2010-07-18 21:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #13 from dfranke at gcc dot gnu dot org 2010-07-18 21:13 -------
Fixed in trunk and 4.5. Closing.
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.5.1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31346
^ permalink raw reply [flat|nested] 14+ messages in thread