public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/36947] New: accepts-invalid
@ 2008-07-27 3:58 w6ws at earthlink dot net
2008-07-27 4:22 ` [Bug fortran/36947] Attributes not fully checked comparing actual vs dummy procedure w6ws at earthlink dot net
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: w6ws at earthlink dot net @ 2008-07-27 3:58 UTC (permalink / raw)
To: gcc-bugs
The following test case demonstrates a problem with gfortran, and several
other, compilers that are not properly checking intents. This happens when
using an interface block to define a dummy argument for passing subprograms.
The interface of the actual routine being passed is not fully compared to the
dummy argument definition, the code compiles without warning, and bad results
occur at runtime.
NAG is one of a very few compilers that detect the error at run time.
module testsub
contains
subroutine test(sub)
interface
subroutine sub(x)
integer, intent(in), optional:: x
end subroutine
end interface
print *, "In test(), about to call sub()"
call sub()
end subroutine
end module
module sub
contains
subroutine subActual(x)
! actual subroutine's argment is different in intent and optional
integer, intent(inout):: x
print *, "In subActual():", x
end subroutine
end module
program interfaceCheck
use testsub
use sub
integer :: a
call test(subActual)
end program
--
Summary: accepts-invalid
Product: gcc
Version: 4.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: w6ws at earthlink dot net
GCC build triplet: Attributes not fully checked comparing actual vs dummy
procedure
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36947
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/36947] Attributes not fully checked comparing actual vs dummy procedure
2008-07-27 3:58 [Bug fortran/36947] New: accepts-invalid w6ws at earthlink dot net
@ 2008-07-27 4:22 ` w6ws at earthlink dot net
2008-07-27 7:24 ` burnus at gcc dot gnu dot org
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: w6ws at earthlink dot net @ 2008-07-27 4:22 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from w6ws at earthlink dot net 2008-07-27 04:22 -------
Fixed summary and keyword fields
--
w6ws at earthlink dot net changed:
What |Removed |Added
----------------------------------------------------------------------------
GCC build triplet|Attributes not fully checked|
|comparing actual vs dummy |
|procedure |
Keywords| |accepts-invalid
Summary|accepts-invalid |Attributes not fully checked
| |comparing actual vs dummy
| |procedure
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36947
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/36947] Attributes not fully checked comparing actual vs dummy procedure
2008-07-27 3:58 [Bug fortran/36947] New: accepts-invalid w6ws at earthlink dot net
2008-07-27 4:22 ` [Bug fortran/36947] Attributes not fully checked comparing actual vs dummy procedure w6ws at earthlink dot net
@ 2008-07-27 7:24 ` burnus at gcc dot gnu dot org
2008-07-27 13:53 ` w6ws at earthlink dot net
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-07-27 7:24 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from burnus at gcc dot gnu dot org 2008-07-27 07:23 -------
Currently, in interface.c's compare_parameter the checking is done via
compare_interfaces. However, this function is used to check for problems with
generic interfaces and from that point of view the two procedures are not
distinguishable.
One way is to check is to add a loop as "else" branch and to check there for
INTENT and OPTIONAL of each argument. This also allows for a better error
message than the "Type/rank mismatch in argument".
If actual-argument procedure itself takes procedures as argument, one can check
recursively, which will be more work; I think for such kind of nesting no
checking is done currently.
(I thought that there was a PR already, but I cannot find it - maybe it does
not exist.)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36947
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/36947] Attributes not fully checked comparing actual vs dummy procedure
2008-07-27 3:58 [Bug fortran/36947] New: accepts-invalid w6ws at earthlink dot net
2008-07-27 4:22 ` [Bug fortran/36947] Attributes not fully checked comparing actual vs dummy procedure w6ws at earthlink dot net
2008-07-27 7:24 ` burnus at gcc dot gnu dot org
@ 2008-07-27 13:53 ` w6ws at earthlink dot net
2008-08-03 8:34 ` alex at ozo dot com
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: w6ws at earthlink dot net @ 2008-07-27 13:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from w6ws at earthlink dot net 2008-07-27 13:52 -------
Subject: Re: Attributes not fully checked comparing actual
vs dummy procedure
burnus at gcc dot gnu dot org wrote:
> If actual-argument procedure itself takes procedures as argument, one can check
> recursively, which will be more work; I think for such kind of nesting no
> checking is done currently.
Good point.
> (I thought that there was a PR already, but I cannot find it - maybe it does
> not exist.)
There are several 'accept-invalid' PRs that seem to deal with similar issues,
but I did not see any that specifically addressed this one.
BTW, I meant to say that the NAG compiler finds the problem at *compile* time.
So run-time never happens. Almost every other compiler I have tried ignores
the problem, and a SEGV usually occurs at run-time.
Thank you for looking into this!
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36947
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/36947] Attributes not fully checked comparing actual vs dummy procedure
2008-07-27 3:58 [Bug fortran/36947] New: accepts-invalid w6ws at earthlink dot net
` (2 preceding siblings ...)
2008-07-27 13:53 ` w6ws at earthlink dot net
@ 2008-08-03 8:34 ` alex at ozo dot com
2008-08-03 8:44 ` alex at ozo dot com
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: alex at ozo dot com @ 2008-08-03 8:34 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from alex at ozo dot com 2008-08-03 08:33 -------
trying to compile ath9k for mips or mipsel under openwrt toolchain with
gcc-4.2.4 produces the following error:
make[3]: Entering directory `/extra3/openwrt/ar71xx/trunk/package/ath9k'
make -C "/extra3/openwrt/ar71xx/trunk/build_dir/linux-ar71xx/linux-2.6.26"
ARCH="mips" CROSS_COMPILE="mips-linux-uclibc-"
SUBDIRS="/extra3/openwrt/ar71xx/trunk/build_dir/linux-ar71xx/ath9k-20080731/drivers/net/wireless/ath9k"
EXTRA_CFLAGS=" -DCONFIG_ATH9K=1 "
LINUXINCLUDE="-I/extra3/openwrt/ar71xx/trunk/staging_dir/mips/usr/include/mac80211
-I/extra3/openwrt/ar71xx/trunk/build_dir/linux-ar71xx/linux-2.6.26/include
-include linux/autoconf.h" CONFIG_ATH9K=m modules
make[4]: Entering directory
`/extra3/openwrt/ar71xx/trunk/build_dir/linux-ar71xx/linux-2.6.26'
CC [M]
/extra3/openwrt/ar71xx/trunk/build_dir/linux-ar71xx/ath9k-20080731/drivers/net/wireless/ath9k/hw.o
/extra3/openwrt/ar71xx/trunk/build_dir/linux-ar71xx/ath9k-20080731/drivers/net/wireless/ath9k/hw.c:
In function 'ath9k_hw_spur_mitigate':
/extra3/openwrt/ar71xx/trunk/build_dir/linux-ar71xx/ath9k-20080731/drivers/net/wireless/ath9k/hw.c:4906:
internal compiler error: in expand_expr_real_1, at expr.c:8760
Please submit a full bug report,
with preprocessed source if appropriate.
a snapshot of the ath9k used is here:
http://wifi.ozo.com/airo/openwrt/source/ath9k
a relative ticket on the ath9k is here:
https://lists.ath9k.org/pipermail/ath9k-devel/2008-August/000082.html
gcc-3.4.6 compiles fine for mips & mipsel targets. gcc-4.2.4 also compiles fine
for x86 target.
--
alex at ozo dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |alex at ozo dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36947
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/36947] Attributes not fully checked comparing actual vs dummy procedure
2008-07-27 3:58 [Bug fortran/36947] New: accepts-invalid w6ws at earthlink dot net
` (3 preceding siblings ...)
2008-08-03 8:34 ` alex at ozo dot com
@ 2008-08-03 8:44 ` alex at ozo dot com
2009-03-29 8:26 ` fxcoudert at gcc dot gnu dot org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: alex at ozo dot com @ 2008-08-03 8:44 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from alex at ozo dot com 2008-08-03 08:43 -------
please discard the above entry and accept my apologies as this is my first
attempt to report a bug issue using bugzilla.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36947
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/36947] Attributes not fully checked comparing actual vs dummy procedure
2008-07-27 3:58 [Bug fortran/36947] New: accepts-invalid w6ws at earthlink dot net
` (4 preceding siblings ...)
2008-08-03 8:44 ` alex at ozo dot com
@ 2009-03-29 8:26 ` fxcoudert at gcc dot gnu dot org
2009-05-18 9:19 ` janus at gcc dot gnu dot org
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2009-03-29 8:26 UTC (permalink / raw)
To: gcc-bugs
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2009-03-29 08:26:27
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36947
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/36947] Attributes not fully checked comparing actual vs dummy procedure
2008-07-27 3:58 [Bug fortran/36947] New: accepts-invalid w6ws at earthlink dot net
` (5 preceding siblings ...)
2009-03-29 8:26 ` fxcoudert at gcc dot gnu dot org
@ 2009-05-18 9:19 ` janus at gcc dot gnu dot org
2009-05-18 9:36 ` janus at gcc dot gnu dot org
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-05-18 9:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from janus at gcc dot gnu dot org 2009-05-18 09:19 -------
Subject: Bug 36947
Author: janus
Date: Mon May 18 09:19:20 2009
New Revision: 147655
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=147655
Log:
2009-05-18 Janus Weil <janus@gcc.gnu.org>
PR fortran/36947
PR fortran/40039
* expr.c (gfc_check_pointer_assign): Check intents when comparing
interfaces.
* gfortran.h (typedef struct gfc_intrinsic_arg): Add 'intent' member.
(gfc_compare_interfaces): Additional argument.
* interface.c (operator_correspondence): Add check for equality of
intents, and new argument 'intent_check'.
(gfc_compare_interfaces): New argument 'intent_check', which is passed
on to operator_correspondence.
(check_interface1): Don't check intents when comparing interfaces.
(compare_parameter): Do check intents when comparing interfaces.
* intrinsic.c (add_sym): Add intents for arguments of intrinsic
procedures.
(add_sym_1,add_sym_1s,add_sym_1m,add_sym_2,add_sym_2s,add_sym_3,
add_sym_3ml,add_sym_3red,add_sym_3s,add_sym_4): Use INTENT_IN by
default.
(add_sym_1_intent,add_sym_1s_intent,add_sym_2s_intent,add_sym_3s_intent)
: New functions to add intrinsic symbols, specifying custom intents.
(add_sym_4s,add_sym_5s): Add new arguments to specify intents.
(add_functions,add_subroutines): Add intents for various intrinsics.
* resolve.c (check_generic_tbp_ambiguity): Don't check intents when
comparing interfaces.
* symbol.c (gfc_copy_formal_args_intr): Copy intent.
2009-05-18 Janus Weil <janus@gcc.gnu.org>
PR fortran/36947
PR fortran/40039
* gfortran.dg/interface_27.f90: New.
* gfortran.dg/interface_28.f90: New.
* gfortran.dg/proc_ptr_11.f90: Fixing invalid test case.
* gfortran.dg/proc_ptr_result_1.f90: Ditto.
Added:
trunk/gcc/testsuite/gfortran.dg/interface_27.f90
trunk/gcc/testsuite/gfortran.dg/interface_28.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/expr.c
trunk/gcc/fortran/gfortran.h
trunk/gcc/fortran/interface.c
trunk/gcc/fortran/intrinsic.c
trunk/gcc/fortran/resolve.c
trunk/gcc/fortran/symbol.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/proc_ptr_11.f90
trunk/gcc/testsuite/gfortran.dg/proc_ptr_result_1.f90
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36947
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/36947] Attributes not fully checked comparing actual vs dummy procedure
2008-07-27 3:58 [Bug fortran/36947] New: accepts-invalid w6ws at earthlink dot net
` (6 preceding siblings ...)
2009-05-18 9:19 ` janus at gcc dot gnu dot org
@ 2009-05-18 9:36 ` janus at gcc dot gnu dot org
2009-05-18 15:36 ` w6ws at earthlink dot net
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-05-18 9:36 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from janus at gcc dot gnu dot org 2009-05-18 09:36 -------
The commit in comment #6 implements the checking for intents.
ToDo:
* check for OPTIONAL
* better error messages
* recursive check (see comment #2)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36947
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/36947] Attributes not fully checked comparing actual vs dummy procedure
2008-07-27 3:58 [Bug fortran/36947] New: accepts-invalid w6ws at earthlink dot net
` (7 preceding siblings ...)
2009-05-18 9:36 ` janus at gcc dot gnu dot org
@ 2009-05-18 15:36 ` w6ws at earthlink dot net
2009-06-12 20:50 ` janus at gcc dot gnu dot org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: w6ws at earthlink dot net @ 2009-05-18 15:36 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from w6ws at earthlink dot net 2009-05-18 15:36 -------
Subject: Re: Attributes not fully checked comparing actual
vs dummy procedure
Janus,
janus at gcc dot gnu dot org wrote:
> ------- Comment #7 from janus at gcc dot gnu dot org 2009-05-18 09:36 -------
> The commit in comment #6 implements the checking for intents.
>
> ToDo:
>
> * check for OPTIONAL
> * better error messages
> * recursive check (see comment #2)
I was going to comment that OPTIONAL should be checked too, but you
beat me to it.
We have been having problems with both OPTIONAL and INTENT not being
checked by various compilers. NAG, of course, does a better job than
most in this area. It is good to see gfortran learn about this checking
too.
Thank you for your hard work on this!
Walter
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36947
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/36947] Attributes not fully checked comparing actual vs dummy procedure
2008-07-27 3:58 [Bug fortran/36947] New: accepts-invalid w6ws at earthlink dot net
` (8 preceding siblings ...)
2009-05-18 15:36 ` w6ws at earthlink dot net
@ 2009-06-12 20:50 ` janus at gcc dot gnu dot org
2009-06-16 9:06 ` janus at gcc dot gnu dot org
2009-06-16 9:14 ` janus at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-06-12 20:50 UTC (permalink / raw)
To: gcc-bugs
--
janus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |janus at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Last reconfirmed|2009-03-29 08:26:27 |2009-06-12 20:50:39
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36947
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/36947] Attributes not fully checked comparing actual vs dummy procedure
2008-07-27 3:58 [Bug fortran/36947] New: accepts-invalid w6ws at earthlink dot net
` (9 preceding siblings ...)
2009-06-12 20:50 ` janus at gcc dot gnu dot org
@ 2009-06-16 9:06 ` janus at gcc dot gnu dot org
2009-06-16 9:14 ` janus at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-06-16 9:06 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from janus at gcc dot gnu dot org 2009-06-16 09:06 -------
Subject: Bug 36947
Author: janus
Date: Tue Jun 16 09:06:13 2009
New Revision: 148519
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=148519
Log:
2009-06-16 Janus Weil <janus@gcc.gnu.org>
PR fortran/36947
PR fortran/40039
* expr.c (gfc_check_pointer_assign): Call 'gfc_compare_interfaces' with
error message.
* gfortran.h (gfc_compare_interfaces): Additional argument.
* interface.c (operator_correspondence): Removed.
(gfc_compare_interfaces): Additional argument to return error message.
Directly use the code from 'operator_correspondence' instead of calling
the function. Check for OPTIONAL. Some rearrangements.
(check_interface1): Call 'gfc_compare_interfaces' without error
message.
(compare_parameter): Call 'gfc_compare_interfaces' with error message.
* resolve.c (check_generic_tbp_ambiguity): Call
'gfc_compare_interfaces'
without error message.
2009-06-16 Janus Weil <janus@gcc.gnu.org>
PR fortran/36947
PR fortran/40039
* gfortran.dg/dummy_procedure_1.f90: Extended test case.
* gfortran.dg/interface_20.f90: Modified error messages.
* gfortran.dg/interface_21.f90: Ditto.
* gfortran.dg/interface_26.f90: Ditto.
* gfortran.dg/interface_27.f90: Ditto.
* gfortran.dg/interface_28.f90: Extended test case.
* gfortran.dg/interface_29.f90: New.
* gfortran.dg/proc_decl_7.f90: Modified error messages.
* gfortran.dg/proc_decl_8.f90: Ditto.
* gfortran.dg/proc_ptr_11.f90: Ditto.
* gfortran.dg/proc_ptr_15.f90: Ditto.
Added:
trunk/gcc/testsuite/gfortran.dg/interface_29.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/expr.c
trunk/gcc/fortran/gfortran.h
trunk/gcc/fortran/interface.c
trunk/gcc/fortran/resolve.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/dummy_procedure_1.f90
trunk/gcc/testsuite/gfortran.dg/interface_20.f90
trunk/gcc/testsuite/gfortran.dg/interface_21.f90
trunk/gcc/testsuite/gfortran.dg/interface_26.f90
trunk/gcc/testsuite/gfortran.dg/interface_27.f90
trunk/gcc/testsuite/gfortran.dg/interface_28.f90
trunk/gcc/testsuite/gfortran.dg/proc_decl_7.f90
trunk/gcc/testsuite/gfortran.dg/proc_decl_8.f90
trunk/gcc/testsuite/gfortran.dg/proc_ptr_11.f90
trunk/gcc/testsuite/gfortran.dg/proc_ptr_15.f90
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36947
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/36947] Attributes not fully checked comparing actual vs dummy procedure
2008-07-27 3:58 [Bug fortran/36947] New: accepts-invalid w6ws at earthlink dot net
` (10 preceding siblings ...)
2009-06-16 9:06 ` janus at gcc dot gnu dot org
@ 2009-06-16 9:14 ` janus at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-06-16 9:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from janus at gcc dot gnu dot org 2009-06-16 09:14 -------
>From the ToDo items in comment #7, r148519 fixes the first two (check for
optional and better error messages). The remaining item (recursive check) is
tracked by PR 40453, so I think this PR can be closed.
--
janus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36947
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2009-06-16 9:14 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-27 3:58 [Bug fortran/36947] New: accepts-invalid w6ws at earthlink dot net
2008-07-27 4:22 ` [Bug fortran/36947] Attributes not fully checked comparing actual vs dummy procedure w6ws at earthlink dot net
2008-07-27 7:24 ` burnus at gcc dot gnu dot org
2008-07-27 13:53 ` w6ws at earthlink dot net
2008-08-03 8:34 ` alex at ozo dot com
2008-08-03 8:44 ` alex at ozo dot com
2009-03-29 8:26 ` fxcoudert at gcc dot gnu dot org
2009-05-18 9:19 ` janus at gcc dot gnu dot org
2009-05-18 9:36 ` janus at gcc dot gnu dot org
2009-05-18 15:36 ` w6ws at earthlink dot net
2009-06-12 20:50 ` janus at gcc dot gnu dot org
2009-06-16 9:06 ` janus at gcc dot gnu dot org
2009-06-16 9:14 ` janus 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).