LOGO
General Discussion Undecided where to post - do it here.

Reply to Thread New Thread
Old 12-21-2006, 08:38 PM   #1
VipInoLo

Join Date
Oct 2005
Posts
568
Senior Member
Default ****ing Fortran
own goal
VipInoLo is offline


Old 12-21-2006, 08:42 PM   #2
Nfvzjvcl

Join Date
Oct 2005
Posts
470
Senior Member
Default
I'm assuming IRCON is some function/procedure you wrote.

I'm also assuming it is expecting a memory address, eg a variable name, rather than just a number.

Thus it's trying to access 0x7 in memory, which is outside of its segment, triggering a segfault.
Nfvzjvcl is offline


Old 12-21-2006, 08:50 PM   #3
khjhkfggt

Join Date
Oct 2005
Posts
396
Senior Member
Default
(by the way, this is obviously not a real program; I hit a segfault and manage to reduce it down to this simple example)
khjhkfggt is offline


Old 12-21-2006, 08:54 PM   #4
Hammaduersnes

Join Date
Oct 2005
Posts
701
Senior Member
Default
(also note that I've fixed the problem by simply using variable names everywhere I call a function, but it still bothers me; this makes no sense)
Hammaduersnes is offline


Old 12-21-2006, 09:09 PM   #5
Abofedrorobox

Join Date
Dec 2005
Posts
465
Senior Member
Default
g77
Abofedrorobox is offline


Old 12-21-2006, 09:14 PM   #6
adsexpist

Join Date
Oct 2005
Posts
339
Senior Member
Default
Do you have another compiler or version of the compiler to try? It looks fine to me, but I've not done Fortran in a while now and most of my stuff was not Fortran 77.
adsexpist is offline


Old 12-21-2006, 09:23 PM   #7
exeftWabreava

Join Date
Oct 2005
Posts
563
Senior Member
Default
I sent this to a friend of mine on the IBM Fortran compiler devteam, we'll see what he says.
exeftWabreava is offline


Old 12-21-2006, 09:25 PM   #8
StivRichardOff

Join Date
Oct 2005
Posts
433
Senior Member
Default
Seriously. This is weird.
StivRichardOff is offline


Old 12-21-2006, 09:35 PM   #9
ClorrerVeks

Join Date
Oct 2005
Posts
446
Senior Member
Default
If this is really a compiler bug then it's my first.

YAYYYYYYYYY
ClorrerVeks is offline


Old 12-21-2006, 09:40 PM   #10
Lictimind

Join Date
Oct 2005
Posts
682
Senior Member
Default
Oh well. It only took 3 hours to chase this down.

Maybe I should learn not to code for 12 hours straight without a single compile/test run...
Lictimind is offline


Old 12-21-2006, 09:42 PM   #11
massons

Join Date
Oct 2005
Posts
383
Senior Member
Default
I pinged another IBMer I knew. Turns out this program runs fine in IBM's compiler on AIX and Linux. Looks like a compiler bug in g77.

As for your issue, I can't recreate it with our compilers. I got another IBMer buddy of mine to look into it and he also couldn't see any problems. It seems the only difference is that IRCON receives integer literal in the second case. Sorry I couldn't be of more help here.
massons is offline


Old 12-21-2006, 11:21 PM   #12
apannamma

Join Date
Oct 2005
Posts
409
Senior Member
Default
Originally posted by KrazyHorse
Thanks, Asher.

Is this the sort of problem you compsci geeks get off on?

We prefer the performance type problems. If we can improve performance by 1%, look out...
apannamma is offline


Old 12-21-2006, 11:56 PM   #13
Noilemaillilm

Join Date
Nov 2005
Posts
443
Senior Member
Default
****ing frog tranny
hm...
Noilemaillilm is offline


Old 12-22-2006, 02:06 AM   #14
occurrini

Join Date
Oct 2005
Posts
427
Senior Member
Default
According to the Fortran language spec, that should be permissable.

It's just a bit obscure, which means it doesn't surprise me that g77, being a hulking piece of ****, can't handle it.
occurrini is offline


Old 12-22-2006, 02:09 AM   #15
acneman

Join Date
Nov 2005
Posts
554
Senior Member
Default
It still causes segfault if you properly assign return value.

The reason my code does not properly assign return value is that this is just a simple example. I deleted all the parts which were not relevant.

I didn't think you would want to read through 50 lines of common block declarations and 1000 lines of some fairly abtruse physics thinking in order to see the problem.

That's also the reason the code doesn't do anything useful in its current form.
acneman is offline


Old 12-22-2006, 02:18 AM   #16
Tibaveriafark

Join Date
Nov 2005
Posts
419
Senior Member
Default
Yeah, I get it, but it doesn't seem smart to write the compiler that way.

From what I recall I can do that all day long in C and not have any troubles.
Tibaveriafark is offline


Old 12-22-2006, 02:25 AM   #17
Z3s9vQZj

Join Date
Oct 2005
Posts
399
Senior Member
Default
See, you've lost me. I have no idea what a stack is.

Nor do I particularly want to know. All I know is that FORTRAN sucks.

SUUUUUUUCCCCCCKKKKKKS

Z3s9vQZj is offline


Old 12-22-2006, 02:30 AM   #18
JulieSmithdccd

Join Date
Oct 2005
Posts
592
Senior Member
Default
Originally posted by KrazyHorse
Nor do I particularly want to know. All I know is that FORTRAN sucks.

SUUUUUUUCCCCCCKKKKKKS

I sign that not hesitating. I haven't used it since the mid 80's. And I hated F77 (always used Fortran IV and the nice three way IF).

Third post in a row... and they actually count, too.

Good night!
JulieSmithdccd is offline


Old 12-22-2006, 02:40 AM   #19
pipitous

Join Date
Oct 2005
Posts
597
Senior Member
Default
Originally posted by KrazyHorse
See, you've lost me. I have no idea what a stack is.
pipitous is offline


Old 12-22-2006, 02:46 AM   #20
usadatronourl

Join Date
Oct 2005
Posts
394
Senior Member
Default
The corresponding C code would not be less efficient, given similar compiler settings (optimization). The most remarkable difference would be, that in C (at least with the default "cdecl" calling convention) the direct value 7 is passed on the stack, while in this Fortran version a pointer to a memory location containing 7 is passed there. In terms of performance that makes no difference, both (direct value and address) are numbers, and of the same width too.

Plain C is certainly not perfect, but for a good and careful programmer it is a mighty tool, as he has control over practically everything. C++, if properly used, produces safer and better readable code at the cost of a bit performance (the overhead is slightly greater). Yet more "comfortable" languages like C#, Java et al. (I call them languages for the lazy) give up a yet greater deal of performance and control in exchange for yet more safety and comfort.

In the end it matters what your program is supposed to do. If you write a GUI (lots of graphics, little or no performance issues), the usage of C would be quite painful. C++ and a good class library would be better, but best would be C# or Java. If you write compact and fast code without a big interface (like firmware or embedded applications), C++ should be the best tool, perhaps even plain C. If you do OS core programming, you usually deal with a stripped down version (no full featured library) of C.
usadatronourl is offline



Reply to Thread New Thread

« Previous Thread | Next Thread »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

All times are GMT +1. The time now is 06:30 AM.
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 PL2
Design & Developed by Amodity.com
Copyright© Amodity