How is lang.opt processed?

James E Wilson wilson@specifixinc.com
Thu Mar 10 21:10:00 GMT 2005


Steve Kargl wrote:
> I'm looking to the broken behavior of gfortran with its
> -r8, -i8, and -d8 options.  gfortran/lang.opt contains

You can't choose any name for front-end options.  There are complicated 
rules for determining whether an option is for the gcc driver or 
preprocessor or front-end or back-end or assembler or linker or collect 
or something else.  If you deviate from these rules, you are asking for 
trouble.

Front-end options should always start with -f.

I would guess the problem is with the specs.  An option won't work 
unless the gcc driver knows that the option should be passed to g95.

The -d8 option "works" because it conflicts with the -d* debugging 
options which are already being passed to g95.  Note however that all 
-d* options are reserved for debugging dumps, and if some time in the 
future we decide to add a -d8 debugging dump, then the fortran front end 
option name will have to change.  It should have never been called -d8 
in the first place.  See the "%{d*}" in cc1_options.

The -i8 and -r8 options meanwhile do not work because there is no spec 
to handle them.  You would have to add %{i8} and %{r8} to 
fortran/lang-specs.h.  However, if you do this, then you are creating a 
liability for yourself.  The problem is that there may exist some target 
that requires passing i8 or r8 to the preprocessor or linker or some 
other subprogram, and in that case, you have an unresolvable conflict. 
It is unlikely that such a target exists, but there is no way to prove 
that there are none or never will be one.  If such a conflict does 
arise, it will be arguable who is wrong, and we will have a mess.  Note 
that -i* is normally reserved for preprocessor options, and -r is a 
linker option.

Meanwhile, we know that -f is safe, because all -f* options are reserved 
for the compiler front-end.  If we find a target that requires a -fr8 
linker option, then that target linker is by definition broken, and it 
isn't your problem.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



More information about the Gcc mailing list