public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32323]  New: Accepts invalid vector subscript actual argument for intent(out) dummy argument
@ 2007-06-13 16:30 terry at chem dot gu dot se
  2007-06-13 18:04 ` [Bug fortran/32323] " burnus at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: terry at chem dot gu dot se @ 2007-06-13 16:30 UTC (permalink / raw)
  To: gcc-bugs

[tjf@fkpc167]$ cat run.f90
module mod
implicit none
contains
subroutine aa(v)
integer,dimension(:),intent(out)::v
write(*,*)size(v)
v=0
end subroutine aa
end module mod

program ff
use mod
implicit none
integer,dimension(10)::w
w=1
call aa(w((/3,2,1/)))
write(*,*)w
end

[tjf@fkpc167]$ gfortran -v -Wall -W --std=f95 --pedantic -O -fbounds-check
run.f90
Driving: gfortran -v -Wall -W -std=f95 -pedantic -O -fbounds-check run.f90
-lgfortranbegin -lgfortran -lm -shared-libgcc
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ./configure --disable-multilib --enable-languages=fortran
Thread model: posix
gcc version 4.2.0 20070501 (prerelease)
 /usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.2.0/f951 run.f90 -quiet
-dumpbase run.f90 -mtune=generic -auxbase run -O -Wall -W -pedantic -std=f95
-version -fbounds-check -I
/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/finclude -o /tmp/ccFuwYwj.s
GNU F95 version 4.2.0 20070501 (prerelease) (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.2.0 20070501 (prerelease).
GGC heuristics: --param ggc-min-expand=89 --param ggc-min-heapsize=112193
 as --traditional-format -V -Qy -o /tmp/ccIcA5Sy.o /tmp/ccFuwYwj.s
GNU assembler version 2.17.50 (x86_64-linux-gnu) using BFD version 2.17.50
20070103 Ubuntu
 /usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.2.0/collect2 --eh-frame-hdr
-m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2
/usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o
/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/crtbegin.o
-L/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.2.0
-L/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/../../../../lib64
-L/lib/../lib64 -L/usr/lib/../lib64
-L/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/../../.. /tmp/ccIcA5Sy.o
-lgfortranbegin -lgfortran -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc
/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/crtend.o
/usr/lib/../lib64/crtn.o
[tjf@fkpc167]$ ./a.out
           3
           1           1           1           1           1           1       
   1           1           1           1



For those that care, both ifort and g95 correctly identify this as invalid
code.

(Maybe I can get one right today!  ;-)


-- 
           Summary: Accepts invalid vector subscript actual argument for
                    intent(out) dummy argument
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: terry at chem dot gu dot se
  GCC host triplet: x86_64-unknown-linux-gnu


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


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

* [Bug fortran/32323] Accepts invalid vector subscript actual argument for intent(out) dummy argument
  2007-06-13 16:30 [Bug fortran/32323] New: Accepts invalid vector subscript actual argument for intent(out) dummy argument terry at chem dot gu dot se
@ 2007-06-13 18:04 ` burnus at gcc dot gnu dot org
  2007-06-13 19:31 ` patchapp at dberlin dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-06-13 18:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2007-06-13 18:03 -------
Thanks for finding this bug! I think it is the following in the Fortran 2003
standard:

"12.4.1.2 Actual arguments associated with dummy data objects"
"If a nonpointer dummy argument has INTENT (OUT) or INTENT (INOUT), the actual
argument shall be definable."
"If the actual argument is an array section having a vector subscript, the
dummy argument is not definable and shall not have the INTENT (OUT), INTENT
(INOUT), VOLATILE, or ASYNCHRONOUS attributes."

Thus we also also need to check for VOLATILE instead of
INTENT(IN)/INTENT(INOUT).

Note that array sections without vector subscripts such as
   call aa(w(3:1))
are allowed!


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   GCC host triplet|x86_64-unknown-linux-gnu    |
           Keywords|                            |accepts-invalid
   Last reconfirmed|0000-00-00 00:00:00         |2007-06-13 18:03:56
               date|                            |
   Target Milestone|---                         |4.3.0


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


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

* [Bug fortran/32323] Accepts invalid vector subscript actual argument for intent(out) dummy argument
  2007-06-13 16:30 [Bug fortran/32323] New: Accepts invalid vector subscript actual argument for intent(out) dummy argument terry at chem dot gu dot se
  2007-06-13 18:04 ` [Bug fortran/32323] " burnus at gcc dot gnu dot org
@ 2007-06-13 19:31 ` patchapp at dberlin dot org
  2007-06-13 20:13 ` burnus at gcc dot gnu dot org
  2007-06-13 20:15 ` burnus at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: patchapp at dberlin dot org @ 2007-06-13 19:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from patchapp at dberlin dot org  2007-06-13 19:30 -------
Subject: Bug number PR32323

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-06/msg00910.html


-- 


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


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

* [Bug fortran/32323] Accepts invalid vector subscript actual argument for intent(out) dummy argument
  2007-06-13 16:30 [Bug fortran/32323] New: Accepts invalid vector subscript actual argument for intent(out) dummy argument terry at chem dot gu dot se
  2007-06-13 18:04 ` [Bug fortran/32323] " burnus at gcc dot gnu dot org
  2007-06-13 19:31 ` patchapp at dberlin dot org
@ 2007-06-13 20:13 ` burnus at gcc dot gnu dot org
  2007-06-13 20:15 ` burnus at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-06-13 20:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2007-06-13 20:12 -------
Subject: Bug 32323

Author: burnus
Date: Wed Jun 13 20:12:40 2007
New Revision: 125684

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=125684
Log:
2007-06-13  Tobias Burnus  <burnus@net-b.de>

        PR fortran/32323
        * interface.c (has_vector_section): New.
        (compare_actual_formal): Check for array sections with vector
subscript.

2007-06-13  Tobias Burnus  <burnus@net-b.de>

        PR fortran/32323
        * gfortran.dg/actual_array_vect_1.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/actual_array_vect_1.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/interface.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/32323] Accepts invalid vector subscript actual argument for intent(out) dummy argument
  2007-06-13 16:30 [Bug fortran/32323] New: Accepts invalid vector subscript actual argument for intent(out) dummy argument terry at chem dot gu dot se
                   ` (2 preceding siblings ...)
  2007-06-13 20:13 ` burnus at gcc dot gnu dot org
@ 2007-06-13 20:15 ` burnus at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-06-13 20:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from burnus at gcc dot gnu dot org  2007-06-13 20:14 -------
Fixed in 4.3.
As it is neither a regression nor a wrong-code bug, it will not be fixed for
4.2.1 or 4.1.3.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2007-06-13 20:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-13 16:30 [Bug fortran/32323] New: Accepts invalid vector subscript actual argument for intent(out) dummy argument terry at chem dot gu dot se
2007-06-13 18:04 ` [Bug fortran/32323] " burnus at gcc dot gnu dot org
2007-06-13 19:31 ` patchapp at dberlin dot org
2007-06-13 20:13 ` burnus at gcc dot gnu dot org
2007-06-13 20:15 ` burnus 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).