Fortran Why is gfortran on my mac continuously printing 'y' instead of 'Hello'?

  • Thread starter Thread starter Nicolaus
  • Start date Start date
  • Tags Tags
    Gfortran Mac
AI Thread Summary
The discussion centers on an issue encountered when running a Fortran program using gfortran on a Mac. The user reports that executing a simple program results in an infinite output of the letter "y." A key insight shared is that the program may not be executing as intended because "test" is a common command in Unix-based systems, including macOS. It is suggested to rename the program to avoid conflicts with existing commands. This situation is noted as a common experience for programmers working in Unix-like environments.
Nicolaus
Messages
73
Reaction score
0
I just downloaded gfortran on my mac and I'm having an issue running the program.
For example, when I run the following using .f90,

program test
write (*,*) "Hello"
end program test

the computer, seemingly infinitely, spews out y's:
y
y
y
y
y
y
y
..
 
Technology news on Phys.org
This is a guess, but it once caught me out on a Unix system, and the Mac OS is basically unix plus a lot of advertising hype :smile:

There is a unix command called "test" (in fact several different commands all called "test", depending what shell you are running etc). So you might not be running your program at all!

Try renaming it "mytest" or whatever.
 
AlephZero's guess is a very solid one.

Up to my experience every programmer working on *nix-style systems sooner or later runs into this, so
"Welcome to the club, Nikolaus!" :smile:
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...

Similar threads

Back
Top