This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/57711] Accepts non-matching invalid dummy procedure as actual argument


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

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Dmitry Kabanov from comment #4)
> Regarding the bug in JAC/DUMMY_JAC: I think for one-dimensional arrays there
> is no difference between ASSUMED-SIZE and ASSUMED-SHAPE.

That's wrong:

- Assumed-size ("var(*)", "var(5,*)") and explicit size ("var(2,3)", "var(n,m)"
[the latter: automatic arrays]) pass a pointer to the data.
- Assumed-shape and deferred-shape ("var(:)") [and assumed-rank] pass a pointer
to an array descriptor (dope vector), which contains the array bounds - and a
pointer to the data.

Thus, mixing arrays from the first group with arrays from the second group does
not work. Thus, for procedures passed as argument (as your (dummy_)jac) the
array type has to be the same. And for normal array arguments, the compiler has
to know the interface* - otherwise it assumes that it is in the first group.
For array arguments, the compiler automatically converts between the two
groups.

(* know = its in a MODULE, in an internal procedure ("contains") or in an
INTERFACE block.)


> Anyway, the code compiles with gfortran 4.6.3.

My point was that they have a different internal representation. Thus, it will
fail at run time as soon as you access the array - either by having the wrong
value or by crashing.

Hence, you really should ensure that DUMMY_JAC and JAC either use both
assumed-shape arrays - or both assumed-size/explicit-size. (Mixing the latter
is fine in practice [if the compiler doesn't complain], even if it is not
permitted by the standard.)

If you corrected that bug, it should compile with both GCC 4.6 and GCC 4.7.


> I haven't found in press release of 4.7 any
> info confirming that gfortran changed its behavior regarding that matter
> intentionally. Is there any way to list all tasks which were included in
> some particular version of gfortran?

That change falls into the category bug fix/diagnostic improvement. The release
notes only list major, user visible changes:
http://gcc.gnu.org/gcc-4.7/changes.html

All changes are in the ChangeLog files. For the Fortran front end (w/o library
changes), you can find them at
http://gcc.gnu.org/viewcvs/gcc/trunk/gcc/fortran/ for the current development
version - and for GCC 4.7 at
http://gcc.gnu.org/viewcvs/gcc/branches/gcc-4_7-branch/gcc/fortran/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]