public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/65223] New: Regresion on elemental type-bound procedure's passed object with INTENT(OUT)
@ 2015-02-26 17:33 jwmwalrus at gmail dot com
2015-02-27 10:45 ` [Bug fortran/65223] " dominiq at lps dot ens.fr
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: jwmwalrus at gmail dot com @ 2015-02-26 17:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65223
Bug ID: 65223
Summary: Regresion on elemental type-bound procedure's passed
object with INTENT(OUT)
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: jwmwalrus at gmail dot com
The code below compiles just fine with gfortran 4.9, but throws an error with
gfortran 5.0:
module storage_mod
implicit none
private
save
type, public :: StorageClass
character(20) :: name = 'default'
contains
procedure :: destroy => destroyStorage
end type
contains
elemental subroutine destroyStorage(this)
class(StorageClass), intent(OUT) :: this
end subroutine
end module storage_mod
The output I get is:
$ ll `which gfortran`
lrwxrwxrwx 1 root root 12 Oct 18 04:03 /usr/bin/gfortran -> gfortran-4.9*
$ gfortran -c storage_mod.f90
$ gfortran-5.0 -c storage_mod.f90
storage_mod.f90:12:44:
elemental subroutine destroyStorage(this)
1
Error: INTENT(OUT) argument 'this' of pure procedure 'destroystorage' at (1)
may not be polymorphic
The error goes away by removing the ELEMENTAL attribute, so it seems like a
regression on valid code.
The compiler and system information is:
$ lsb_release -rd
Description: Debian GNU/Linux 8.0 (jessie)
Release: 8.0
$ gfortran-5.0 -v
Using built-in specs.
COLLECT_GCC=gfortran-5.0
COLLECT_LTO_WRAPPER=/usr/lib/gcc-snapshot/libexec/gcc/x86_64-linux-gnu/5.0.0/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 20150211-1'
--with-bugurl=file:///usr/share/doc/gcc-snapshot/README.Bugs
--enable-languages=c,ada,c++,java,go,fortran,objc,obj-c++
--prefix=/usr/lib/gcc-snapshot --enable-shared --enable-linker-build-id
--disable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --with-default-libstdcxx-abi=c++98
--enable-gnu-unique-object --disable-vtable-verify --enable-plugin
--with-system-zlib --disable-browser-plugin --enable-java-awt=gtk
--enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5.0-snap-amd64/jre
--enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5.0-snap-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5.0-snap-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --with-arch-32=i586 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic
--disable-werror --enable-checking=yes --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.0.0 20150211 (experimental) [trunk revision 220605] (Debian
20150211-1)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/65223] Regresion on elemental type-bound procedure's passed object with INTENT(OUT)
2015-02-26 17:33 [Bug fortran/65223] New: Regresion on elemental type-bound procedure's passed object with INTENT(OUT) jwmwalrus at gmail dot com
@ 2015-02-27 10:45 ` dominiq at lps dot ens.fr
2015-02-27 15:13 ` jwmwalrus at gmail dot com
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-02-27 10:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65223
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
This is the intended behavior: see the thread starting at
https://gcc.gnu.org/ml/fortran/2014-12/msg00094.html. You must use 'impure
elemental' if there is an INTENT(OUT) polymorphic argument.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/65223] Regresion on elemental type-bound procedure's passed object with INTENT(OUT)
2015-02-26 17:33 [Bug fortran/65223] New: Regresion on elemental type-bound procedure's passed object with INTENT(OUT) jwmwalrus at gmail dot com
2015-02-27 10:45 ` [Bug fortran/65223] " dominiq at lps dot ens.fr
@ 2015-02-27 15:13 ` jwmwalrus at gmail dot com
2015-02-27 15:31 ` dominiq at lps dot ens.fr
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: jwmwalrus at gmail dot com @ 2015-02-27 15:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65223
--- Comment #2 from John <jwmwalrus at gmail dot com> ---
Changing the ELEMENTAL attribute to PURE produces the same error. If that's the
intended behavior, then that's the same as saying type-bound procedures cannot
be pure.
The thread mentioned by Dominique d'Humieres seems to only apply to "unlimited
polymorphic", which is not part of the test case I posted.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/65223] Regresion on elemental type-bound procedure's passed object with INTENT(OUT)
2015-02-26 17:33 [Bug fortran/65223] New: Regresion on elemental type-bound procedure's passed object with INTENT(OUT) jwmwalrus at gmail dot com
2015-02-27 10:45 ` [Bug fortran/65223] " dominiq at lps dot ens.fr
2015-02-27 15:13 ` jwmwalrus at gmail dot com
@ 2015-02-27 15:31 ` dominiq at lps dot ens.fr
2015-10-10 14:53 ` [Bug fortran/65223] Elemental type-bound procedure's passed object with INTENT(OUT) should be accepted with -std=f2003 (?) dominiq at lps dot ens.fr
2015-10-10 15:08 ` dominiq at lps dot ens.fr
4 siblings, 0 replies; 6+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-02-27 15:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65223
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |WAITING
Last reconfirmed| |2015-02-27
CC| |janus at gcc dot gnu.org
Resolution|INVALID |---
Ever confirmed|0 |1
--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> The thread mentioned by Dominique d'Humieres seems to only apply to
> "unlimited polymorphic", which is not part of the test case I posted.
Sorry, the pointer should be
https://gcc.gnu.org/ml/fortran/2014-12/msg00098.html
The rationale refers to F08:C1278a, however in my F08 draft it is 'A local
variable of a pure subprogram, or of a BLOCK construct within a pure
subprogram, shall not have the SAVE attribute.'. The only related constraint I
can find is
C534 An assumed-size array with the INTENT (OUT) attribute shall not be
polymorphic, finalizable, of a type with an allocatable ultimate component, or
of a type for which default initialization is specied.
but this does not apply to the test in comment 0, CCed Janus.
Nevertheless replacing 'element' with 'impure elemental' allows the code to
compile.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/65223] Elemental type-bound procedure's passed object with INTENT(OUT) should be accepted with -std=f2003 (?).
2015-02-26 17:33 [Bug fortran/65223] New: Regresion on elemental type-bound procedure's passed object with INTENT(OUT) jwmwalrus at gmail dot com
` (2 preceding siblings ...)
2015-02-27 15:31 ` dominiq at lps dot ens.fr
@ 2015-10-10 14:53 ` dominiq at lps dot ens.fr
2015-10-10 15:08 ` dominiq at lps dot ens.fr
4 siblings, 0 replies; 6+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-10-10 14:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65223
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |NEW
Summary|Regresion on elemental |Elemental type-bound
|type-bound procedure's |procedure's passed object
|passed object with |with INTENT(OUT) should be
|INTENT(OUT) |accepted with -std=f2003
| |(?).
--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
AFAICT the condition
if (sym->ts.type == BT_CLASS && sym->attr.intent == INTENT_OUT)
implement the constraints C1290 (from my copy of the f2015 draft, see
fortran.dg/class_dummy_5.f90 for the rationale)
1.6.4 Fortran 2003 compatibility
...
6 Fortran 2003 permitted the function result of a pure function to be
a polymorphic allocatable variable, and to be finalizable by an impure final
subroutine. These are not permitted by this part of ISO/IEC 1539.
7 Fortran 2003 permitted an INTENT (OUT) argument of a pure subroutine to be
polymorphic; that is not permitted by this part of ISO/IEC 1539.
12.7 Pure procedures
...
C1289 An INTENT (OUT) dummy argument of a pure procedure shall not be such that
finalization of the actual argument would reference an impure procedure.
C1290 An INTENT (OUT) dummy argument of a pure procedure shall not be
polymorphic.
Since the constraints are Fortran 2008, IMO the code should compile with
-std=f2003. In addition I am not sure that constraint C1289 is implemented:
compiling
module storage_mod
implicit none
private
save
type, public :: StorageClass
character(20) :: name = 'default'
contains
procedure, nopass :: destroy => destroyStorage
end type
contains
elemental subroutine destroyStorage(this)
type(StorageClass), intent(OUT) :: this
end subroutine
end module storage_mod
end
should give an error(?).
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/65223] Elemental type-bound procedure's passed object with INTENT(OUT) should be accepted with -std=f2003 (?).
2015-02-26 17:33 [Bug fortran/65223] New: Regresion on elemental type-bound procedure's passed object with INTENT(OUT) jwmwalrus at gmail dot com
` (3 preceding siblings ...)
2015-10-10 14:53 ` [Bug fortran/65223] Elemental type-bound procedure's passed object with INTENT(OUT) should be accepted with -std=f2003 (?) dominiq at lps dot ens.fr
@ 2015-10-10 15:08 ` dominiq at lps dot ens.fr
4 siblings, 0 replies; 6+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-10-10 15:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65223
--- Comment #5 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
The patch
--- ../_clean/gcc/fortran/resolve.c 2015-10-07 02:32:16.000000000 +0200
+++ gcc/fortran/resolve.c 2015-10-10 17:01:17.000000000 +0200
@@ -415,7 +415,7 @@ resolve_formal_arglist (gfc_symbol *proc
}
/* F08:C1278a. */
- if (sym->ts.type == BT_CLASS && sym->attr.intent == INTENT_OUT)
+ if ( !gfc_notification_std (GFC_STD_F2008) && sym->ts.type ==
BT_CLASS && sym->attr.intent == INTENT_OUT)
{
gfc_error ("INTENT(OUT) argument %qs of pure procedure %qs at %L"
" may not be polymorphic", sym->name, proc->name,
allows the code to compile with -std=f2003.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-10-10 15:08 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-26 17:33 [Bug fortran/65223] New: Regresion on elemental type-bound procedure's passed object with INTENT(OUT) jwmwalrus at gmail dot com
2015-02-27 10:45 ` [Bug fortran/65223] " dominiq at lps dot ens.fr
2015-02-27 15:13 ` jwmwalrus at gmail dot com
2015-02-27 15:31 ` dominiq at lps dot ens.fr
2015-10-10 14:53 ` [Bug fortran/65223] Elemental type-bound procedure's passed object with INTENT(OUT) should be accepted with -std=f2003 (?) dominiq at lps dot ens.fr
2015-10-10 15:08 ` dominiq at lps dot ens.fr
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).