segmentation fault 
Author Message
 segmentation fault

Hi,
I've a strange error message ( segmentation fault) and hope someone of you
could give me a hint.

I have the following code:
 There's a main and a subprogram, and I exchange some vectors between them
via a paramterlist. The size of the vector changes since I set in the main
program the size (gridsize).

Main
Paramater(MaxSize =30)
REAL A(Maxsize)
gridsize =1
A(1)  = 999

write(A)           !1
 Call SUB(A)
write(A)           !2

END

SUB(A)
REAL A(gridsize)
write(A)           !3
end

With this kind of code I produce a segmentation fault I don't understand.
The write command '1' shows me the the number 999, the write command '3' in
at the end of the subroutine shows me 999 and the write command '2' is
never reached by the code because of the segmentation error message.

I hope I could explain my situation detailled enought and hope get some
help.
Thanks a lot
Hans

--
Johann Wurzenberger
Inst. f. Appartebau Mech. VT. u. Feuerungstechnik, TU-Graz
Inffeldgasse 25/I A-8010 Graz Austria, Europe
Tel: (0316) 873 7986  Fax: (0316) 873 7492
---------------- it is a circle around a circle and w're within, within



Sun, 09 Nov 2003 21:00:35 GMT  
 segmentation fault

Quote:

> Hi,
> I've a strange error message ( segmentation fault) and hope someone of you
> could give me a hint.

> I have the following code:
>  There's a main and a subprogram, and I exchange some vectors between them
> via a paramterlist. The size of the vector changes since I set in the main
> program the size (gridsize).

> Main
> Paramater(MaxSize =30)
> REAL A(Maxsize)
> gridsize =1
> A(1)  = 999

> write(A)           !1
>  Call SUB(A)
> write(A)           !2

> END

> SUB(A)
> REAL A(gridsize)
> write(A)           !3
> end

> With this kind of code I produce a segmentation fault I don't understand.
> The write command '1' shows me the the number 999, the write command '3' in
> at the end of the subroutine shows me 999 and the write command '2' is
> never reached by the code because of the segmentation error message.

How does SUB know that gridsize =1? It would be better to declare
A(*) and to pass gridsize as a parameter. (Couldn't hurt to have a sanity
check somewhere that gridsize .le. maxsize.

Hope that helps

--
gus gassmann

"When in doubt, travel"
======================================================================
                     To reply, remove SPAM BLOCK



Sun, 09 Nov 2003 21:13:53 GMT  
 segmentation fault

How does SUB know that gridsize =1? It would be better to declare
A(*) and to pass gridsize as a parameter. (Couldn't hurt to have
a sanity
check somewhere that gridsize .le. maxsize.
================================================================

.. and better still to declare A(:) and have an explicit
interface.

Regards,

Mike Metcalf

--



Sun, 09 Nov 2003 21:39:32 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. visual works 3.1 image has segmentation fault on 2.4 kernel (red hat 8.0)

2. segmentation fault on gabage collect

3. Segmentation faults

4. Segmentation Fault while compiling Eiffel classes.

5. Segmentation faults

6. Segmentation fault in POPLOG Linux.

7. segmentation fault ISE Eiffel 3.3.9 wel libraries

8. Newbie question: Segmentation fault?

9. IBM Orexx for Linux and Segmentation faults

10. - regina rexx - linux segmentation fault

11. exerb with cui17z and md5 => segmentation fault

12. tr() segmentation fault

 

 
Powered by phpBB® Forum Software