public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/65086] New: Segfault: Invalid copy-out of temporary as argument is in read-only memory
@ 2015-02-17 7:58 burnus at gcc dot gnu.org
2015-09-08 11:33 ` [Bug fortran/65086] " dominiq at lps dot ens.fr
0 siblings, 1 reply; 2+ messages in thread
From: burnus at gcc dot gnu.org @ 2015-02-17 7:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65086
Bug ID: 65086
Summary: Segfault: Invalid copy-out of temporary as argument is
in read-only memory
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
>From James Van Buskirk's example in the comp.lang.fortran thread "Is INTENT
(IN) ever used to control code generation?" /
https://groups.google.com/d/msg/comp.lang.fortran/nzq3Sad_zQE/APiZzlGdNPQJ
The following program segfaults at run time, unless INTENT(IN) is specified for
sub4. The problem is the copy-out part as the original variable is in read-only
memory.
"Both gfortran and ifort throw an error at runtime for the above program with
the INTENT(IN) statements commented out, but ifort runs to completion if either
or both of them are in effect whereas gfortran only works if the INTENT(IN)
statement in subroutine sub4 is in effect."
And:
"But as the standard is written it seems the Fortran processor has to do this
comparison before it can copy out, which seems absolutely horrible to me,
[...]"
Bob replies: "Why does it seem horrible? Oracle Solaris Studio Fortran uses
this implementation."
module mod1
implicit none
character(*), parameter :: x = 'This is a constant string.'
end module mod1
module mod2
implicit none
contains
subroutine sub1(x)
character(*) x
call sub2(x,len(x))
end subroutine sub1
subroutine sub2(x,size)
integer size
character x(size)
call sub3(x)
end subroutine sub2
subroutine sub3(x)
character x(:)
!INTENT(IN) :: x
call sub4(x(1::2))
end subroutine sub3
subroutine sub4(x)
!INTENT(IN) :: x ! REQUIRED
character x(*)
end subroutine sub4
end module mod2
program main
use mod1
use mod2
implicit none
write(*,'(a)') x
call sub1(x)
write(*,'(a)') x
end program main
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug fortran/65086] Segfault: Invalid copy-out of temporary as argument is in read-only memory
2015-02-17 7:58 [Bug fortran/65086] New: Segfault: Invalid copy-out of temporary as argument is in read-only memory burnus at gcc dot gnu.org
@ 2015-09-08 11:33 ` dominiq at lps dot ens.fr
0 siblings, 0 replies; 2+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-09-08 11:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65086
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-09-08
Ever confirmed|0 |1
--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed from 4.8 up to trunk (6.0).
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-09-08 11:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-17 7:58 [Bug fortran/65086] New: Segfault: Invalid copy-out of temporary as argument is in read-only memory burnus at gcc dot gnu.org
2015-09-08 11:33 ` [Bug fortran/65086] " 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).