public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/29899] New: [Segfault] Fortran entry point caught from C function
@ 2006-11-19 16:33 jkb at systella dot fr
2006-11-20 0:35 ` [Bug fortran/29899] " pinskia at gcc dot gnu dot org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: jkb at systella dot fr @ 2006-11-19 16:33 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 5929 bytes --]
Hello,
I work for a long time on a programming language and it is written in C, F77
and F90. I can build this code with all release of gcc/gfortran before the
4.1.x.
I have tried to found a bug in my code without any success, thus, I write this
bug report.
Test program:
schroedinger:[~/test] > gcc -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu
--enable-libstdcxx-debug --enable-mpfr --with-tune=i686
--enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.1.2 20061028 (prerelease) (Debian 4.1.1-19)
schroedinger:[~/test] > gfortran -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu
--enable-libstdcxx-debug --enable-mpfr --with-tune=i686
--enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.1.2 20061028 (prerelease) (Debian 4.1.1-19)
schroedinger:[~/test] > cat a.c
#include <stdlib.h>
//#define integer4 int
typedef long int integer4;
void rluxgo_(integer4 *luxuriance, integer4 *racine, integer4 *k1,
integer4 *k2);
int main (void)
{
integer4 k1, k2, luxuriance, racine;
k1 = 0;
k2 = 0;
printf("%d\n", sizeof(k1));
luxuriance = 4;
racine = (integer4) time(NULL);
rluxgo_ (&luxuriance, &racine, &k1, &k2);
}
schroedinger:[~/test] > cat ranlux.f
subroutine RANLUX(RVEC, LENV)
implicit none
integer*4 I
integer*4 I24
integer*4 IN24
integer*4 ICONS
integer*4 IGIGA
integer*4 ILX
integer*4 INNER
integer*4 INOUT
integer*4 INS
integer*4 INSEED
integer*4 IOUTER
...
entry RLUXAT(LOUT,INOUT,K1,K2)
LOUT = LUXLEV
INOUT = INSEED
K1 = KOUNT
K2 = MKOUNT
return
entry RLUXGO(LUX,INS,K1,K2)
if (LUX.lt.0) then
LUXLEV = LXDFLT
else if (LUX.le.MAXLEV) then
LUXLEV = LUX
else if ((LUX.lt.24).or.(LUX.gt.2000)) then
LUXLEV = MAXLEV
else
LUXLEV = LUX
do ILX = 0, MAXLEV
if (LUX.eq.(NDSKIP(ILX) + 24)) then
LUXLEV = ILX
end if
end do
end if
if (LUXLEV.le.MAXLEV) then
NSKIP = NDSKIP(LUXLEV)
else
NSKIP = LUXLEV - 24
end if
IN24 = 0
...
end subroutine
schroedinger:[~/test] > gfortran a.c ranlux.f
schroedinger:[~/test] > ./a.out
4
schroedinger:[~/test] >
You can found the complete ranlux.f subroutine at
http://www.systella.fr/~bertrand/rpl2/download/rpl-4.00pre8q.tar.bz2
Calling a Fortran entry point from C seems to work. But if I call the same
entry point (or another) from the C function :
void
instruction_rand(struct_processus *s_etat_processus)
{
integer4 k1;
integer4 k2;
integer4 luxuriance;
integer4 nombre_valeurs;
integer4 racine;
struct_objet *s_objet;
(*s_etat_processus).erreur_execution = d_ex;
if ((*s_etat_processus).affichage_arguments == 'Y')
{
printf("\n RAND ");
if ((*s_etat_processus).langue == 'F')
{
printf("(variable aléatoire uniforme)\n\n");
}
else
{
printf("(uniform random number)\n\n");
}
printf("-> 1: %s\n", d_REL);
return;
}
printf("Ici\n");
if (test_cfsf(s_etat_processus, 31) == d_vrai)
{
if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
{
return;
}
}
printf("Là\n");
if ((*s_etat_processus).initialisation_generateur_aleatoire == d_faux)
{
k1 = 0;
k2 = 0;
printf("%d\n", sizeof(k1));
luxuriance = 4;
racine = (integer4) time(NULL);
rluxat_(&luxuriance, &racine, &k1, &k2);
printf("Encore ici\n");
...
I obtain a superb segmentation fault:
rayleigh:[~/gopher/rpl2/rpl-4.00pre8r/src] > LANG=C ./rpl -isd
+++RPL/2 version 4.00pre8r (Sunday 11/19/06, 16:46:42 CET)
+++Copyright (C) 1989 to 2005, 2006 BERTRAND Joël
+++This is a free software with absolutely no warranty.
+++For details, type 'warranty'.
+++rand
Ici
Là
4
Erreur de segmentation
rayleigh:[~/gopher/rpl2/rpl-4.00pre8r/src] >
I have tried to debug the core dump without any success. The good values are
sent to the Fortran code. In my code, I use some system calls (sigaction to
manage stacks), but I don't understand the mistake. I'm not sure it is a bug in
gfortran, but I don't found any bug in my code.
All sources are available at
http://www.systella.fr/~bertrand/rpl2/download/rpl-4.00pre8q.tar.bz2
Regards,
JKB
--
Summary: [Segfault] Fortran entry point caught from C function
Product: gcc
Version: 4.1.2
Status: UNCONFIRMED
Severity: critical
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jkb at systella dot fr
GCC build triplet: i586-pc-linux-gnu
GCC host triplet: i586-pc-linux-gnu
GCC target triplet: i486-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29899
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/29899] [Segfault] Fortran entry point caught from C function
2006-11-19 16:33 [Bug fortran/29899] New: [Segfault] Fortran entry point caught from C function jkb at systella dot fr
@ 2006-11-20 0:35 ` pinskia at gcc dot gnu dot org
2006-11-20 9:25 ` jkb at systella dot fr
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-11-20 0:35 UTC (permalink / raw)
To: gcc-bugs
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|critical |normal
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29899
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/29899] [Segfault] Fortran entry point caught from C function
2006-11-19 16:33 [Bug fortran/29899] New: [Segfault] Fortran entry point caught from C function jkb at systella dot fr
2006-11-20 0:35 ` [Bug fortran/29899] " pinskia at gcc dot gnu dot org
@ 2006-11-20 9:25 ` jkb at systella dot fr
2007-02-03 10:43 ` fxcoudert at gcc dot gnu dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: jkb at systella dot fr @ 2006-11-20 9:25 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from jkb at systella dot fr 2006-11-20 09:24 -------
Hello,
When I have post this report, I have made a mistake. I have written my test
routine without any changes. Of course, the prototype of rluxat_ and rluxgo_
are the same and if I replace rluxat_ by rluxgo_, I reveive the same
segmentation fault.
Regards,
JKB
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29899
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/29899] [Segfault] Fortran entry point caught from C function
2006-11-19 16:33 [Bug fortran/29899] New: [Segfault] Fortran entry point caught from C function jkb at systella dot fr
2006-11-20 0:35 ` [Bug fortran/29899] " pinskia at gcc dot gnu dot org
2006-11-20 9:25 ` jkb at systella dot fr
@ 2007-02-03 10:43 ` fxcoudert at gcc dot gnu dot org
2007-04-02 22:28 ` burnus at gcc dot gnu dot org
2007-04-13 14:06 ` fxcoudert at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-02-03 10:43 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from fxcoudert at gcc dot gnu dot org 2007-02-03 10:43 -------
I've tried a few times to look into it, but the .tar.bz2 code on your server is
just too large, and the example you posted here doesn't compile. Could you try
the following:
* upgrade to gfortran-4.2 or later (you can download gfortran-4.3 binaries
from http://gcc.gnu.org/wiki/GFortranBinaries) and see if your bug is fixed
* reduce your testcase to something we can investigate
Merci !
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29899
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/29899] [Segfault] Fortran entry point caught from C function
2006-11-19 16:33 [Bug fortran/29899] New: [Segfault] Fortran entry point caught from C function jkb at systella dot fr
` (2 preceding siblings ...)
2007-02-03 10:43 ` fxcoudert at gcc dot gnu dot org
@ 2007-04-02 22:28 ` burnus at gcc dot gnu dot org
2007-04-13 14:06 ` fxcoudert at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-04-02 22:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from burnus at gcc dot gnu dot org 2007-04-02 23:28 -------
> You can found the complete ranlux.f subroutine at
> http://www.systella.fr/~bertrand/rpl2/download/rpl-4.00pre8q.tar.bz2
The program does not compile for me:
gfortran ./src/fonctions_speciales.conv.f90
./src/fonctions_speciales.conv.f90:62.48:
type(GSL_SF_RESULT), intent(out) :: RESULTAT
1
Error: the type of 'resultat' at (1) has not been declared within the interface
./src/fonctions_speciales.conv.f90:59.59:
integer function gsl_sf_lngamma_sgn_e_wrapper(X, RESULTAT, SIGNE)
1
Error: Symbol 'resultat' at (1) has no IMPLICIT type
./src/fonctions_speciales.conv.f90:67.47:
ERREUR_GAMMA = gsl_sf_lngamma_sgn_e_wrapper(X, STRUCT_RESULTAT, &
1
Error: Type/rank mismatch in argument 'resultat' at (1)
NSG f95:
Error: ./src/fonctions_speciales.conv.f90, line 62: RESULTAT is of undefined
derived type GSL_SF_RESULT
detected at ::@RESULTAT
Error: ./src/fonctions_speciales.conv.f90, line 64: Derived type GSL_SF_RESULT
used but not defined
detected at FUNCTION@<end-of-statement>
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29899
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/29899] [Segfault] Fortran entry point caught from C function
2006-11-19 16:33 [Bug fortran/29899] New: [Segfault] Fortran entry point caught from C function jkb at systella dot fr
` (3 preceding siblings ...)
2007-04-02 22:28 ` burnus at gcc dot gnu dot org
@ 2007-04-13 14:06 ` fxcoudert at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-04-13 14:06 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from fxcoudert at gcc dot gnu dot org 2007-04-13 15:06 -------
Closing as we have no way to reproduce the bug. Please reopen the PR with more
information when you can.
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29899
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-04-13 14:06 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-19 16:33 [Bug fortran/29899] New: [Segfault] Fortran entry point caught from C function jkb at systella dot fr
2006-11-20 0:35 ` [Bug fortran/29899] " pinskia at gcc dot gnu dot org
2006-11-20 9:25 ` jkb at systella dot fr
2007-02-03 10:43 ` fxcoudert at gcc dot gnu dot org
2007-04-02 22:28 ` burnus at gcc dot gnu dot org
2007-04-13 14:06 ` fxcoudert 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).