public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/18197] New: bus error on returning from a function
@ 2004-10-28 12:31 niilo dot sirola at tut dot fi
2004-10-28 12:33 ` [Bug fortran/18197] " niilo dot sirola at tut dot fi
` (4 more replies)
0 siblings, 5 replies; 16+ messages in thread
From: niilo dot sirola at tut dot fi @ 2004-10-28 12:31 UTC (permalink / raw)
To: gcc-bugs
The attached code compiles without warnings, but gives "bus error" on execution.
Used GNU Fortran 95 (GCC 4.0.0 20041027 (experimental)) on powerpc-apple-darwin7.5.0.
It seems that when crashing, the __result of function f somehow gets data address 0x0, which seems
bit abnormal. Very delicate changes in the code remove this behaviour, it seems to have something to
do with assumed-shape arrays.
Somewhat reduced testcase and a debugging session follow:
module innerfun
contains
function f(n,x) result(y)
integer, intent(in) :: n
real, dimension(:), intent(in) :: x
real, dimension(n) :: y
y = 1
end function f
end module innerfun
module outerfun
contains
subroutine foo(n,funname)
integer, intent(in) :: n
real, dimension(n) :: y
real, dimension(2) :: x
interface
function funname(n,x) result(y)
integer, intent(in) :: n
real, dimension(:), intent(in) :: x
real, dimension(n) :: y
end function funname
end interface
x = (/ 0.2, 0.3 /)
y = funname(n, x ) ! this works
y = funname(n, (/ 0.2, 0.3 /)) ! this doesn't
end subroutine foo
end module outerfun
program test
use outerfun
use innerfun
call foo(1,f)
end program test
(gdb) run
Starting program: /Users/niilo/fortran/test
Reading symbols for shared libraries . done
Program received signal EXC_BAD_ACCESS, Could not access memory.
0x00002b1c in __innerfun (__result=@0xbffff774, n=@0x14ec4, x=@0xbffff73c) at test.f90:7
7 y = 1
(gdb) print __result
$1 = (struct array1_real4 &) @0xbffff774: {
data = 0x0,
offset = 0,
dtype = 281,
dim = {{
stride = 0,
lbound = 1711407104,
ubound = 0
}}
}
(gdb) where
#0 0x00002b1c in __innerfun (__result=@0xbffff774, n=@0x14ec4, x=@0xbffff73c) at test.f90:7
#1 0x00002dd0 in __outerfun__foo (n=@0x14ec4, funname=0x2a74 <__innerfun(float)>) at test.f90:
27
#2 0x00002e84 in MAIN__ () at test.f90:35
#3 0x00002eb0 in main (argc=-1073744012, argv=0x14ec4) at ../../../gcc/libgfortran/fmain.c:18
--
Summary: bus error on returning from a function
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: niilo dot sirola at tut dot fi
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: powerpc-apple-darwin7.5.0
GCC host triplet: powerpc-apple-darwin7.5.0
GCC target triplet: powerpc-apple-darwin7.5.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18197
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/18197] bus error on returning from a function
2004-10-28 12:31 [Bug fortran/18197] New: bus error on returning from a function niilo dot sirola at tut dot fi
@ 2004-10-28 12:33 ` niilo dot sirola at tut dot fi
2004-10-28 13:26 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 16+ messages in thread
From: niilo dot sirola at tut dot fi @ 2004-10-28 12:33 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From niilo dot sirola at tut dot fi 2004-10-28 12:33 -------
*** Bug 18196 has been marked as a duplicate of this bug. ***
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18197
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/18197] bus error on returning from a function
2004-10-28 12:31 [Bug fortran/18197] New: bus error on returning from a function niilo dot sirola at tut dot fi
2004-10-28 12:33 ` [Bug fortran/18197] " niilo dot sirola at tut dot fi
@ 2004-10-28 13:26 ` pinskia at gcc dot gnu dot org
2004-12-08 23:58 ` tobi at gcc dot gnu dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-28 13:26 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-10-28 13:26 -------
Confirmed, this is a front-end issue.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |wrong-code
Last reconfirmed|0000-00-00 00:00:00 |2004-10-28 13:26:26
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18197
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/18197] bus error on returning from a function
2004-10-28 12:31 [Bug fortran/18197] New: bus error on returning from a function niilo dot sirola at tut dot fi
2004-10-28 12:33 ` [Bug fortran/18197] " niilo dot sirola at tut dot fi
2004-10-28 13:26 ` pinskia at gcc dot gnu dot org
@ 2004-12-08 23:58 ` tobi at gcc dot gnu dot org
2005-04-11 23:45 ` pinskia at gcc dot gnu dot org
2005-04-12 0:49 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 16+ messages in thread
From: tobi at gcc dot gnu dot org @ 2004-12-08 23:58 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From tobi at gcc dot gnu dot org 2004-12-08 23:58 -------
For the second call we generate:
atmp.12.dtype = 281;
atmp.12.data = 0B;
atmp.12.offset = 0;
atmp.12.dim[0].stride = 0;
... (no changes to atmp.12
funname (&atmp.12, (int4 *) n, &atmp.16);
which is clearly not correct, as atmp.12 should point to y (as it correctly does
in the first call).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18197
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/18197] bus error on returning from a function
2004-10-28 12:31 [Bug fortran/18197] New: bus error on returning from a function niilo dot sirola at tut dot fi
` (2 preceding siblings ...)
2004-12-08 23:58 ` tobi at gcc dot gnu dot org
@ 2005-04-11 23:45 ` pinskia at gcc dot gnu dot org
2005-04-12 0:49 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-11 23:45 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn| |20960
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18197
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/18197] bus error on returning from a function
2004-10-28 12:31 [Bug fortran/18197] New: bus error on returning from a function niilo dot sirola at tut dot fi
` (3 preceding siblings ...)
2005-04-11 23:45 ` pinskia at gcc dot gnu dot org
@ 2005-04-12 0:49 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-12 0:49 UTC (permalink / raw)
To: gcc-bugs
--
Bug 18197 depends on bug 20960, which changed state.
Bug 20960 Summary: bus error for return an array
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20960
What |Old Value |New Value
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18197
^ permalink raw reply [flat|nested] 16+ messages in thread
[parent not found: <bug-18197-9538@http.gcc.gnu.org/bugzilla/>]
* [Bug fortran/18197] bus error on returning from a function
[not found] <bug-18197-9538@http.gcc.gnu.org/bugzilla/>
@ 2005-10-27 16:46 ` pinskia at gcc dot gnu dot org
2005-11-07 14:49 ` tobi at gcc dot gnu dot org
` (8 subsequent siblings)
9 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-27 16:46 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pinskia at gcc dot gnu dot org 2005-10-27 16:46 -------
We get an ICE now:
t.f90:26: internal compiler error: in gfc_trans_arrayfunc_assign, at
fortran/trans-expr.c:2632
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-valid-code
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18197
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/18197] bus error on returning from a function
[not found] <bug-18197-9538@http.gcc.gnu.org/bugzilla/>
2005-10-27 16:46 ` pinskia at gcc dot gnu dot org
@ 2005-11-07 14:49 ` tobi at gcc dot gnu dot org
2005-12-06 18:04 ` eedelman at gcc dot gnu dot org
` (7 subsequent siblings)
9 siblings, 0 replies; 16+ messages in thread
From: tobi at gcc dot gnu dot org @ 2005-11-07 14:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from tobi at gcc dot gnu dot org 2005-11-07 14:49 -------
While the original problem seems to have been fixed, we have a regression here:
if we comment out the line marked as "this works" everything compiles fine and
we get an executable that works (doesn't segfault), if we comment out the line
"this doesn't" instead, the compiler triggers the assertion Andrew pointed to.
--
tobi at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tobi at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18197
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/18197] bus error on returning from a function
[not found] <bug-18197-9538@http.gcc.gnu.org/bugzilla/>
2005-10-27 16:46 ` pinskia at gcc dot gnu dot org
2005-11-07 14:49 ` tobi at gcc dot gnu dot org
@ 2005-12-06 18:04 ` eedelman at gcc dot gnu dot org
2005-12-06 19:38 ` eedelman at gcc dot gnu dot org
` (6 subsequent siblings)
9 siblings, 0 replies; 16+ messages in thread
From: eedelman at gcc dot gnu dot org @ 2005-12-06 18:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from eedelman at gcc dot gnu dot org 2005-12-06 18:03 -------
Working on a patch.
--
eedelman at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |eedelman at gcc dot gnu dot
| |org
AssignedTo|unassigned at gcc dot gnu |eedelman at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18197
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/18197] bus error on returning from a function
[not found] <bug-18197-9538@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2005-12-06 18:04 ` eedelman at gcc dot gnu dot org
@ 2005-12-06 19:38 ` eedelman at gcc dot gnu dot org
2005-12-14 6:51 ` jpr at csc dot fi
` (5 subsequent siblings)
9 siblings, 0 replies; 16+ messages in thread
From: eedelman at gcc dot gnu dot org @ 2005-12-06 19:38 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from eedelman at gcc dot gnu dot org 2005-12-06 19:38 -------
(In reply to comment #6)
> Working on a patch.
Posted a pacth here: http://gcc.gnu.org/ml/fortran/2005-12/msg00116.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18197
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/18197] bus error on returning from a function
[not found] <bug-18197-9538@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2005-12-06 19:38 ` eedelman at gcc dot gnu dot org
@ 2005-12-14 6:51 ` jpr at csc dot fi
2005-12-15 0:47 ` eedelman at gcc dot gnu dot org
` (4 subsequent siblings)
9 siblings, 0 replies; 16+ messages in thread
From: jpr at csc dot fi @ 2005-12-14 6:51 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from jpr at csc dot fi 2005-12-14 06:51 -------
(In reply to comment #7)
> (In reply to comment #6)
> > Working on a patch.
>
> Posted a pacth here: http://gcc.gnu.org/ml/fortran/2005-12/msg00116.html
>
Is anyone considering approving (or disapproving) Eriks patch? It would also
clear PR 25262 (tested), except for the part that EXTERNAL keyword propably
should not be allowed for procedures with INTERFACE.
Regards, Juha Ruokolainen
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18197
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/18197] bus error on returning from a function
[not found] <bug-18197-9538@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2005-12-14 6:51 ` jpr at csc dot fi
@ 2005-12-15 0:47 ` eedelman at gcc dot gnu dot org
2005-12-16 18:54 ` eedelman at gcc dot gnu dot org
` (3 subsequent siblings)
9 siblings, 0 replies; 16+ messages in thread
From: eedelman at gcc dot gnu dot org @ 2005-12-15 0:47 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from eedelman at gcc dot gnu dot org 2005-12-15 00:47 -------
Subject: Bug 18197
Author: eedelman
Date: Thu Dec 15 00:47:13 2005
New Revision: 108555
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=108555
Log:
fortran/
2005-12-14 Erik Edelmann <eedelman@gcc.gnu.org>
PR fortran/18197
* resolve.c (resolve_formal_arglist): Remove code to set
the type of a function symbol from it's result symbol.
testsuite/
2005-12-14 Erik Edelmann <eedelman@gcc.gnu.org>
PR fortran/18197
* gfortran.dg/dummy_functions_1.f90: New.
Added:
trunk/gcc/testsuite/gfortran.dg/dummy_functions_1.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/resolve.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18197
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/18197] bus error on returning from a function
[not found] <bug-18197-9538@http.gcc.gnu.org/bugzilla/>
` (5 preceding siblings ...)
2005-12-15 0:47 ` eedelman at gcc dot gnu dot org
@ 2005-12-16 18:54 ` eedelman at gcc dot gnu dot org
2005-12-17 19:51 ` eedelman at gcc dot gnu dot org
` (2 subsequent siblings)
9 siblings, 0 replies; 16+ messages in thread
From: eedelman at gcc dot gnu dot org @ 2005-12-16 18:54 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from eedelman at gcc dot gnu dot org 2005-12-16 18:54 -------
Subject: Bug 18197
Author: eedelman
Date: Fri Dec 16 18:54:33 2005
New Revision: 108667
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=108667
Log:
fortran/
2005-12-14 Erik Edelmann <eedelman@gcc.gnu.org>
PR fortran/18197
* resolve.c (resolve_formal_arglist): Remove code to set
the type of a function symbol from it's result symbol.
testsuite/
2005-12-14 Erik Edelmann <eedelman@gcc.gnu.org>
PR fortran/18197
* gfortran.dg/dummy_functions_1.f90: New.
Added:
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/dummy_functions_1.f90
Modified:
branches/gcc-4_1-branch/gcc/fortran/ChangeLog
branches/gcc-4_1-branch/gcc/fortran/resolve.c
branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18197
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/18197] bus error on returning from a function
[not found] <bug-18197-9538@http.gcc.gnu.org/bugzilla/>
` (6 preceding siblings ...)
2005-12-16 18:54 ` eedelman at gcc dot gnu dot org
@ 2005-12-17 19:51 ` eedelman at gcc dot gnu dot org
2005-12-17 19:55 ` eedelman at gcc dot gnu dot org
2006-01-01 5:26 ` pinskia at gcc dot gnu dot org
9 siblings, 0 replies; 16+ messages in thread
From: eedelman at gcc dot gnu dot org @ 2005-12-17 19:51 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from eedelman at gcc dot gnu dot org 2005-12-17 19:51 -------
Fixed on 4.1 and mainline.
--
eedelman at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18197
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/18197] bus error on returning from a function
[not found] <bug-18197-9538@http.gcc.gnu.org/bugzilla/>
` (7 preceding siblings ...)
2005-12-17 19:51 ` eedelman at gcc dot gnu dot org
@ 2005-12-17 19:55 ` eedelman at gcc dot gnu dot org
2006-01-01 5:26 ` pinskia at gcc dot gnu dot org
9 siblings, 0 replies; 16+ messages in thread
From: eedelman at gcc dot gnu dot org @ 2005-12-17 19:55 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from eedelman at gcc dot gnu dot org 2005-12-17 19:55 -------
*** Bug 25262 has been marked as a duplicate of this bug. ***
--
eedelman at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jpr at csc dot fi
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18197
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/18197] bus error on returning from a function
[not found] <bug-18197-9538@http.gcc.gnu.org/bugzilla/>
` (8 preceding siblings ...)
2005-12-17 19:55 ` eedelman at gcc dot gnu dot org
@ 2006-01-01 5:26 ` pinskia at gcc dot gnu dot org
9 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-01 5:26 UTC (permalink / raw)
To: gcc-bugs
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.1.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18197
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2006-01-01 5:26 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-28 12:31 [Bug fortran/18197] New: bus error on returning from a function niilo dot sirola at tut dot fi
2004-10-28 12:33 ` [Bug fortran/18197] " niilo dot sirola at tut dot fi
2004-10-28 13:26 ` pinskia at gcc dot gnu dot org
2004-12-08 23:58 ` tobi at gcc dot gnu dot org
2005-04-11 23:45 ` pinskia at gcc dot gnu dot org
2005-04-12 0:49 ` pinskia at gcc dot gnu dot org
[not found] <bug-18197-9538@http.gcc.gnu.org/bugzilla/>
2005-10-27 16:46 ` pinskia at gcc dot gnu dot org
2005-11-07 14:49 ` tobi at gcc dot gnu dot org
2005-12-06 18:04 ` eedelman at gcc dot gnu dot org
2005-12-06 19:38 ` eedelman at gcc dot gnu dot org
2005-12-14 6:51 ` jpr at csc dot fi
2005-12-15 0:47 ` eedelman at gcc dot gnu dot org
2005-12-16 18:54 ` eedelman at gcc dot gnu dot org
2005-12-17 19:51 ` eedelman at gcc dot gnu dot org
2005-12-17 19:55 ` eedelman at gcc dot gnu dot org
2006-01-01 5:26 ` pinskia 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).