LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-15-2015, 10:58 AM   #16
AlexBB
Member
 
Registered: Mar 2014
Posts: 464

Original Poster
Rep: Reputation: Disabled

suicidaleggroll, I now have time to implement your suggestion to get rid of the COMMON blocks. I started with compiling and running the code you posted. Here, I need an explanation about the command line parameters/command options you used. I found one of them here. And that is -fbounds-check which appears to be a deprecated form of -fcheck=bounds, the latter being a new variant.

Code:
$ gfortran -Wall -fbounds-check -c subs.f90
$ gfortran -Wall -fbounds-check main.f90 subs.o
However I could not find -Wall & -c options. What are they?

Your command line options provide a "cleaner" compilation output. When I apply
Code:
gfortran sub_mod.f90
command I get two dozen lines like this"

Code:
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 0 has invalid symbol index 11
With your options it just compiles. So, what are the options: -Wall & -c ?

I may have other questions later. Appreciate your help. Thanks, - Alex

Last edited by AlexBB; 05-16-2015 at 09:05 PM.
 
Old 05-18-2015, 10:18 AM   #17
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
-Wall is short for warn all. From the man page:
Code:
       -Wall
           Enables commonly used warning options pertaining to usage that we
           recommend avoiding and that we believe are easy to avoid.  This
           currently includes -Waliasing, -Wampersand, -Wconversion,
           -Wsurprising, -Wc-binding-type, -Wintrinsics-std, -Wno-tabs,
           -Wintrinsic-shadow, -Wline-truncation, -Wtarget-lifetime,
           -Wreal-q-constant and -Wunused
-c tells it to compile only, and skips the linker. From the man page for gcc (for some reason it's not in the gfortran man page?):
Code:
       -c  Compile or assemble the source files, but do not link.  The linking
           stage simply is not done.  The ultimate output is in the form of an
           object file for each source file.

           By default, the object file name for a source file is made by
           replacing the suffix .c, .i, .s, etc., with .o.
You can't run just:
Code:
gfortran sub_mod.f90
because sub_mod.f90 is not a full program, it's just a module that needs to be linked into a larger program. When you build it with -c it just compiles it and generates the module file required to compile main.f90.
 
1 members found this post helpful.
Old 05-24-2015, 09:14 AM   #18
AlexBB
Member
 
Registered: Mar 2014
Posts: 464

Original Poster
Rep: Reputation: Disabled
Thank you, egg roll. I mark this thread as solved. I did simplify my program by removing quite a few COMMON statements. I am now on a roll, <not an egg roll, though :-)> and want to finish the whole project but the time will come for me to clean the whole thing up and I may as well kill other COMMON 's. Thanks for the explanations. - Alex

Last edited by AlexBB; 05-25-2015 at 12:35 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Can the truecrypt password be derived from the key? Ulysses_ Linux - Security 20 01-03-2015 11:35 AM
ISO-derived software: Could it be compromised? 0XYGEN Linux - Security 4 06-12-2011 12:31 AM
[SOLVED] Derived classes in C++ brazilnut Programming 8 05-16-2010 06:50 AM
C++: derived class? unihiekka Programming 4 02-03-2009 09:40 AM
Derived work and documentation under GPL v2 klnasveschuk Linux - General 2 02-06-2006 05:25 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration