public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32884] New: ICE: Accessing non-local variable in PURE function
@ 2007-07-24 17:19 burnus at gcc dot gnu dot org
2007-07-24 17:33 ` [Bug fortran/32884] " burnus at gcc dot gnu dot org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-07-24 17:19 UTC (permalink / raw)
To: gcc-bugs
Using the following invalid program, one gets an ICE
NAG f95: Assignment to Z in PURE procedure BAR
gfortran: segmentation fault.
subroutine foo ()
integer :: z
contains
pure function bar (a)
integer, intent(in) :: a
integer :: bar
z = 45 ! <<<<<<<<<<<
bar = a
end function bar
end subroutine foo
--
Summary: ICE: Accessing non-local variable in PURE function
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: ice-on-invalid-code
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: burnus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32884
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/32884] ICE: Accessing non-local variable in PURE function
2007-07-24 17:19 [Bug fortran/32884] New: ICE: Accessing non-local variable in PURE function burnus at gcc dot gnu dot org
@ 2007-07-24 17:33 ` burnus at gcc dot gnu dot org
2007-07-24 18:29 ` burnus at gcc dot gnu dot org
2007-07-24 18:53 ` burnus at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-07-24 17:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from burnus at gcc dot gnu dot org 2007-07-24 17:33 -------
Seemingly the error is detected and only on writing the error the segmentation
fault occurs:
==494== Invalid read of size 8
==494== at 0x41D398: show_locus (error.c:171)
==494== by 0x41D29D: error_print (error.c:521)
==494== by 0x41DB1E: gfc_error (error.c:759)
==494== by 0x45B930: resolve_code (resolve.c:5871)
==494== by 0x45BB10: resolve_codes (resolve.c:8472)
==494== by 0x45BACF: resolve_codes (resolve.c:8464)
==494== by 0x45BB54: gfc_resolve (resolve.c:8491)
==494== by 0x44E507: gfc_parse_file (parse.c:3271)
==494== by 0x472FBD: gfc_be_parse_file (f95-lang.c:301)
==494== by 0x6B4BC3: toplev_main (toplev.c:1044)
==494== by 0x52BEB43: (below main) (in /lib64/libc-2.6.so)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32884
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/32884] ICE: Accessing non-local variable in PURE function
2007-07-24 17:19 [Bug fortran/32884] New: ICE: Accessing non-local variable in PURE function burnus at gcc dot gnu dot org
2007-07-24 17:33 ` [Bug fortran/32884] " burnus at gcc dot gnu dot org
@ 2007-07-24 18:29 ` burnus at gcc dot gnu dot org
2007-07-24 18:53 ` burnus at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-07-24 18:29 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from burnus at gcc dot gnu dot org 2007-07-24 18:28 -------
Others cannot reproduce it (on i686 & x86_64), but here I can with gfortran-4.1
& 4.2 of SUSE, with the vanilla 4.2 and with 4.3.
The problem is for whatever reason the "&code->expr->where" argument to
gfc_error(). In error_print the "loc" argument is not NULL, but loc->lb->*
point to invalid locations, which gave an memory access error (segfault) in
show_locus when accessing lb->file.
484 loc = va_arg (argp, locus *);
486 if (have_l1)
(gdb) p loc
$8 = (locus *) 0xfdc13a
(gdb) p loc->lb
$9 = (gfc_linebuf *) 0x610072616200736e
(gdb) p loc->lb->file
Cannot access memory at address 0x6100726162007376
(gdb) p loc->lb->line
Cannot access memory at address 0x610072616200738a
(gdb) p loc->lb->file
Cannot access memory at address 0x6100726162007376
But no problem for others.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32884
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/32884] ICE: Accessing non-local variable in PURE function
2007-07-24 17:19 [Bug fortran/32884] New: ICE: Accessing non-local variable in PURE function burnus at gcc dot gnu dot org
2007-07-24 17:33 ` [Bug fortran/32884] " burnus at gcc dot gnu dot org
2007-07-24 18:29 ` burnus at gcc dot gnu dot org
@ 2007-07-24 18:53 ` burnus at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-07-24 18:53 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 736 bytes --]
------- Comment #3 from burnus at gcc dot gnu dot org 2007-07-24 18:53 -------
This is a translation bug:
msgid "Cannot assign to variable '%s' in PURE procedure at %L"
msgstr "In PURE-Prozedur bei %L kann nicht an Variable »%s« zugewiesen werden"
As %L / %s is reverted, gfortran crashes.
Solution: Replace %L ... %s by %2$L ... %1$s
I reported the bug to the DE language team.
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32884
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-07-24 18:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-24 17:19 [Bug fortran/32884] New: ICE: Accessing non-local variable in PURE function burnus at gcc dot gnu dot org
2007-07-24 17:33 ` [Bug fortran/32884] " burnus at gcc dot gnu dot org
2007-07-24 18:29 ` burnus at gcc dot gnu dot org
2007-07-24 18:53 ` 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).