gfxgfx
 
Please login or register.

Login with username, password and session length
 
gfx gfx
gfx
1619 Posts in 535 Topics by 781 Members - Latest Member: chekyl43 January 27, 2023, 03:14:45 PM
*
gfx* Home | Help | Search | Login | Register | gfx
gfx
Absoft User Forum  |  Support  |  General  |  Compiler failure on correct syntax
gfx
gfxgfx
 

Author Topic: Compiler failure on correct syntax  (Read 10076 times)

rboone

  • Newbie
  • *
  • Posts: 11
Compiler failure on correct syntax
« on: March 06, 2008, 12:02:12 PM »
Folks,

I now know these forums are sparsely populated, but I keep running into a frustrating problem,
and need to look for answers somewhere.  I use ABSOFT Fortran 10.1, and find the Windows
level compiler crash the most frustrating aspect.  The question at hand ... I have a parameter
file that needs to be read in, and so I use a series of read statements with typical and implied
do loops.  I can include a number of these and the routine will compile.  But if I include too many
(like in the attached example), it will fail, with the Windows crash of AF90FE.EXE.  *** I can
go in and comment out ANY TWO of these read lines and the module will compile. *** And if I uncomment
them, it fails again.

Of course there is a great deal of code I'm not showing, especially the "metrics" structure, but
intuitively I don't think that matters - my question is more generic than that.  What would cause
the compiler to fail with a given number of statements, but compile when ANY two read statements
were commented out?  Clearly its not the syntax of the statements, given that any statement
may be commented out to make it compile.  I've got optimization turned off, and the do-loops aren't
imbedded, so it shouldn't be reaching a limit of the compiler.  I know lots of work-arounds, of course,
but really need to nail-down this frustrating aspect of the compiler.  Any suggestions as to what to
look for would be appreciated.

Thanks,
R Boone



subroutine Initialize_Metrics
   ! Reads in the metric values for the model.
   ! RBB  02/20/2008.  Last changed:  RBB  03/05/2008
   use Parameter_Values
   use Structure_Definitions
   implicit none
   integer :: i, imnth, iage

   ! Read in the metrics use to represent households in the community   
   open(SHORT_USE_FILE, FILE=app_path(1:len_trim(app_path))//METRICS_FILE, ACTION='READ', IOSTAT=ioerr)
   if (ioerr == 0) then
      read(SHORT_USE_FILE, *) Metrics%adult_equivalent_count
      do i=1,Metrics%adult_equivalent_count
         read(SHORT_USE_FILE, *) Metrics%adult_equivalents(i)                   
      end do
      read(SHORT_USE_FILE, *) Metrics%calorie_content_count
      do i=1,Metrics%calorie_content_count
         read(SHORT_USE_FILE, *) Metrics%calorie_content(i)                     
      end do
      read(SHORT_USE_FILE, *) Metrics%calories_required_count
      do i=1,Metrics%calories_required_count
         read(SHORT_USE_FILE, *) Metrics%calories_required(i)                   
      end do
      ! The variable names in the following lines are self-explanatory
      read(SHORT_USE_FILE, *) (Metrics%milk_sell_price(imnth),imnth=1,12)   
      read(SHORT_USE_FILE, *) (Metrics%milk_buy_price(imnth),imnth=1,12)   
      read(SHORT_USE_FILE, *) (Metrics%tea_buy_price(imnth),imnth=1,12)   
      read(SHORT_USE_FILE, *) (Metrics%maize_sell_price(imnth),imnth=1,12)   
      read(SHORT_USE_FILE, *) (Metrics%maize_buy_price(imnth),imnth=1,12)   
      read(SHORT_USE_FILE, *) (Metrics%beans_sell_price(imnth),imnth=1,12)   
      read(SHORT_USE_FILE, *) (Metrics%beans_buy_price(imnth),imnth=1,12)   
      read(SHORT_USE_FILE, *) (Metrics%tomato_sell_price(imnth),imnth=1,12)   
      read(SHORT_USE_FILE, *) (Metrics%tomato_buy_price(imnth),imnth=1,12)   
      read(SHORT_USE_FILE, *) (Metrics%onion_sell_price(imnth),imnth=1,12)   
      read(SHORT_USE_FILE, *) (Metrics%onion_buy_price(imnth),imnth=1,12)   
      do iage=1,5
         read(SHORT_USE_FILE, *) (Metrics%cattle_sell_price(iage,imnth),imnth=1,12)
      end do
      do iage=1,5
         read(SHORT_USE_FILE, *) (Metrics%cattle_buy_price(iage,imnth),imnth=1,12)
      end do
      do iage=1,5
         read(SHORT_USE_FILE, *) (Metrics%goat_sell_price(iage,imnth),imnth=1,12)
      end do
      do iage=1,5
         read(SHORT_USE_FILE, *) (Metrics%goat_buy_price(iage,imnth),imnth=1,12)
      end do
      do iage=1,5
         read(SHORT_USE_FILE, *) (Metrics%sheep_sell_price(iage,imnth),imnth=1,12)
      end do
      do iage=1,5
         read(SHORT_USE_FILE, *) (Metrics%sheep_buy_price(iage,imnth),imnth=1,12)
      end do
      read(SHORT_USE_FILE, *) (Metrics%milk_vs_condition(i),i=1,4)           
      read(SHORT_USE_FILE, *) (Metrics%cattle_meat_expected(i),i=1,5)         
      read(SHORT_USE_FILE, *) (Metrics%goat_meat_expected(i),i=1,5)           
      read(SHORT_USE_FILE, *) (Metrics%sheep_meat_expected(i),i=1,5)         
      read(SHORT_USE_FILE, *) Metrics%cattle_prop_nonedible
      read(SHORT_USE_FILE, *) Metrics%goat_prop_nonedible
      read(SHORT_USE_FILE, *) Metrics%sheep_prop_nonedible
      read(SHORT_USE_FILE, *) (Metrics%meat_vs_condition(i),i=1,4)           
      read(SHORT_USE_FILE, *) (Metrics%maize_vs_rainfall(i),i=1,4)           
      read(SHORT_USE_FILE, *) (Metrics%beans_vs_rainfall(i),i=1,4)         
      read(SHORT_USE_FILE, *) (Metrics%livestock_sales_triggers(i),i=1,2)   
      read(SHORT_USE_FILE, *) (Metrics%livestock_buy_triggers(i),i=1,2)   
      read(SHORT_USE_FILE, *) (Metrics%cattle_vs_hsi(i),i=1,4)               
      read(SHORT_USE_FILE, *) (Metrics%goat_vs_hsi(i),i=1,4)                 
      read(SHORT_USE_FILE, *) (Metrics%sheep_vs_hsi(i),i=1,4)                 
      read(SHORT_USE_FILE, *) (Metrics%rainfall_season(i),i=1,12)           
      read(SHORT_USE_FILE, *) Metrics%grazing_orbit                                 
      read(SHORT_USE_FILE, *) (Metrics%return_home(i),i=1,12)               
      read(SHORT_USE_FILE, *) (Metrics%long_hsid_vs_si(i),i=1,4)             
      read(SHORT_USE_FILE, *) Metrics%group_ranch_coeff(1), Metrics%group_ranch_coeff(2)
      read(SHORT_USE_FILE, *) (Metrics%distance_house_vs_si(i),i=1,4)   
      read(SHORT_USE_FILE, *) (Metrics%distance_camp_vs_si(i),i=1,4)     
      read(SHORT_USE_FILE, *) (Metrics%cattle_vs_si(i),i=1,4)                 
      read(SHORT_USE_FILE, *) (Metrics%goat_vs_si(i),i=1,4)                   
      read(SHORT_USE_FILE, *) (Metrics%sheep_vs_si(i),i=1,4)                 
      close(SHORT_USE_FILE)
   else
      write(ECHO_FILE,*) 'An error occurred opening file: ',METRICS_FILE, '.  The error code was: ', ioerr
   end if
   
end subroutine
« Last Edit: March 06, 2008, 12:26:48 PM by rboone »

rboone

  • Newbie
  • *
  • Posts: 11
Re: Compiler failure on correct syntax
« Reply #1 on: March 06, 2008, 12:43:54 PM »
A brief follow-up.  I had mentioned work-arounds.  One is to include in the center of the read statements
some other syntax.  In the following snippet, with the reads from the above post, IAGE will never be
greater than 25, but including the following lines allows the module to compile.   Really bizarre!

Thanks,
R Boone


      <SNIP>
      read(SHORT_USE_FILE, *) (Metrics%livestock_sales_triggers(i),i=1,2)     ! Two values
      read(SHORT_USE_FILE, *) (Metrics%livestock_buy_triggers(i),i=1,2)       ! Two values
      if (iage > 10000) write(*,*) ' '
      if (iage > 10000) write(*,*) ' '
      if (iage > 10000) write(*,*) ' '
      if (iage > 10000) write(*,*) ' '
      if (iage > 10000) write(*,*) ' '     
      if (iage > 10000) write(*,*) ' '
      if (iage > 10000) write(*,*) ' '
      if (iage > 10000) write(*,*) ' '
      if (iage > 10000) write(*,*) ' '
      if (iage > 10000) write(*,*) ' '     
      if (iage > 10000) write(*,*) ' '
      if (iage > 10000) write(*,*) ' '
      if (iage > 10000) write(*,*) ' '
      if (iage > 10000) write(*,*) ' '
      if (iage > 10000) write(*,*) ' '     
      read(SHORT_USE_FILE, *) (Metrics%cattle_vs_hsi(i),i=1,4)       
      read(SHORT_USE_FILE, *) (Metrics%goat_vs_hsi(i),i=1,4)         
      <SNIP>

Jeremy

  • Guest
Re: Compiler failure on correct syntax
« Reply #2 on: March 06, 2008, 03:16:27 PM »
I am not fond of unsolved mysteries as well.  Lets take a second look at this issue.  I still have your old e-mails with your program.  As we last were, I could compile your program without any errors on my Windows XP 32-bit box with Absoft Pro Fortran v10.1.  I am not using any special compiler options when I do this.  What compiler options are you using when the error occurs?

rboone

  • Newbie
  • *
  • Posts: 11
Re: Compiler failure on correct syntax
« Reply #3 on: March 06, 2008, 07:08:23 PM »
Oh, as a scientist I love unsolved mysteries, but indeed, this is a little more random than I would enjoy  :)   Thanks again for the help, Jeremy.
Compilation flags?  Well, I use your IDE, and use the defaults on most things.  I could past the MAKEFILE automatically made if that would
be helpful.  Otherwise, on all the program files, I have set the F90 debug options to "Yes", so that it does array checking and such.  The
remaining options are all at their default values - warning level 3, free format, INTEGER*4, no optimization, etc.

Randy

Jeremy

  • Guest
Re: Compiler failure on correct syntax
« Reply #4 on: March 07, 2008, 01:54:34 PM »
Yes, your makefile would tell me what you are using to compile your program.  You can post the makefile or send it to me via e-mail using the e-mail address below.

rboone

  • Newbie
  • *
  • Posts: 11
Re: Compiler failure on correct syntax
« Reply #5 on: March 10, 2008, 11:56:29 PM »
The MAKEFILE is attached below.    Randy


#
# Absoft Developer Tools Interface requires use of this makefile.
#
MKDIR=if not exist "$(OBJDIR)\nul" mkdir
RMDIR=erase /F /S /Q

#
# Variables for the compiler(s) and linker
#
ABSOFT_F95=f95
ABSOFT_F77=f95
VAST_PREPROCESSOR=vastfp.exe
RC=rc.exe
CL=cl.exe
ABSOFT_F95_LINKER=f95
DUMMY=

#
# Flags
#
ABSOFT_F95_FLAGS=-m32
ABSOFT_F77_FLAGS=-m32 -f77_compat
RC_FLAGS=
CL_FLAGS=-O2
ABSOFT_F95_LINKER_FLAGS=-m32 -O2

#
# Name of the executable
#
TARGET=Decuma.exe
OUTDIR=.
OBJDIR=.\Release

#
# Files for this executable
#
VAST_PREPROCESSOR_FILES=
ABSOFT_F95_FILES="Decuma.f95" "Parameters_and_Values.f95" "Structure_Definitions.f95" "Initialize_Model.f95" "Distribute_Animals.f95" "Model_Animal_Dynamics.f95" "Model_House_Dynamics.f95" "Misc_Procedures.f95" "Output_Routines.f95"
ABSOFT_F77_FILES=
CL_FILES=
ABSOFT_F95_LINKER_FILES=
RC_FILES=

#
# Rules and dependencies for the executable
#
SRCFILES=$(ABSOFT_F95_FILES)
OBJFILES="$(OBJDIR)\Decuma.obj" "$(OBJDIR)\Parameters_and_Values.obj" "$(OBJDIR)\Structure_Definitions.obj" "$(OBJDIR)\Initialize_Model.obj" "$(OBJDIR)\Distribute_Animals.obj" "$(OBJDIR)\Model_Animal_Dynamics.obj" "$(OBJDIR)\Model_House_Dynamics.obj" "$(OBJDIR)\Misc_Procedures.obj" "$(OBJDIR)\Output_Routines.obj"
all: "$(OUTDIR)\$(TARGET)"

"$(OUTDIR)\$(TARGET)": "$(OBJDIR)" $(OBJFILES) $(USER_LIBS) $(MODFILES) $(RC_FILES)
   $(ABSOFT_F95_LINKER) $(ABSOFT_F95_LINKER_FLAGS) $(LPATHS) $(OBJFILES) $(ABSOFT_F95_LINKER_FILES) $(LIBS) -o "$(OUTDIR)\$(TARGET)"


"$(OBJDIR)\Decuma.obj": "Decuma.f95"
   $(ABSOFT_F95) -c -nowdir -m32 -Rp -Rc -Rs -Rb -o "$(OBJDIR)\Decuma.obj" "Decuma.f95"

"$(OBJDIR)\Parameters_and_Values.obj": "Parameters_and_Values.f95"
   $(ABSOFT_F95) -c -nowdir -m32 -Rp -Rc -Rs -Rb -o "$(OBJDIR)\Parameters_and_Values.obj" "Parameters_and_Values.f95"

"$(OBJDIR)\Structure_Definitions.obj": "Structure_Definitions.f95"
   $(ABSOFT_F95) -c -nowdir -m32 -Rp -Rc -Rs -Rb -o "$(OBJDIR)\Structure_Definitions.obj" "Structure_Definitions.f95"

"$(OBJDIR)\Initialize_Model.obj": "Initialize_Model.f95"
   $(ABSOFT_F95) -c -nowdir -m32 -Rp -Rc -Rs -Rb -o "$(OBJDIR)\Initialize_Model.obj" "Initialize_Model.f95"

"$(OBJDIR)\Distribute_Animals.obj": "Distribute_Animals.f95"
   $(ABSOFT_F95) -c -nowdir -m32 -Rp -Rc -Rs -Rb -o "$(OBJDIR)\Distribute_Animals.obj" "Distribute_Animals.f95"

"$(OBJDIR)\Model_Animal_Dynamics.obj": "Model_Animal_Dynamics.f95"
   $(ABSOFT_F95) -c -nowdir -m32 -Rp -Rc -Rs -Rb -o "$(OBJDIR)\Model_Animal_Dynamics.obj" "Model_Animal_Dynamics.f95"

"$(OBJDIR)\Model_House_Dynamics.obj": "Model_House_Dynamics.f95"
   $(ABSOFT_F95) -c -nowdir -m32 -Rp -Rc -Rs -Rb -o "$(OBJDIR)\Model_House_Dynamics.obj" "Model_House_Dynamics.f95"

"$(OBJDIR)\Misc_Procedures.obj": "Misc_Procedures.f95"
   $(ABSOFT_F95) -c -nowdir -m32 -Rp -Rc -Rs -Rb -o "$(OBJDIR)\Misc_Procedures.obj" "Misc_Procedures.f95"

"$(OBJDIR)\Output_Routines.obj": "Output_Routines.f95"
   $(ABSOFT_F95) -c -nowdir -m32 -Rp -Rc -Rs -Rb -o "$(OBJDIR)\Output_Routines.obj" "Output_Routines.f95"

"$(OBJDIR)":
   $(MKDIR) "$(OBJDIR)"
#
# Clean Rules
#
clean:
    if exist "$(OBJDIR)" $(RMDIR) "$(OBJDIR)"
    if exist "$(OBJDIR)" rmdir "$(OBJDIR)"

#
# Define necessary macros for dependency scanning.
#
MKDEP=amakedepend
MKDEP_FLAGS= -quiet "-pre$(OBJDIR)\"\" -Y -modInfo -errdel -f90 -f makefile
#
# Generate dependencies for the project
#
ScanAll: "$(OUTDIR)" "$(OBJDIR)" MakeDepsAll

#
# Scan for all F77, F95, and c/c++ dependencies
#
MakeDepsAll:
   $(MKDEP) "@C:\FSav_DRU\DecumaV1\Release\mkdep_F95"
# DO NOT DELETE THIS LINE - makedepend depends upon it.


".\Release\Parameters_and_Values.obj"&: ".\Release\parameter_values.mod"

".\Release\Structure_Definitions.obj"&: ".\Release\structure_definitions.mod"







# Defined Module: .\Release\parameter_values.mod
# Defined Module: .\Release\structure_definitions.mod
".\Release\Decuma.obj": ".\Release\parameter_values.mod"


".\Release\Structure_Definitions.obj": ".\Release\parameter_values.mod"

".\Release\Initialize_Model.obj": ".\Release\parameter_values.mod"
".\Release\Initialize_Model.obj": ".\Release\structure_definitions.mod"

".\Release\Distribute_Animals.obj": ".\Release\parameter_values.mod"
".\Release\Distribute_Animals.obj": ".\Release\structure_definitions.mod"
# Undefined Module: windows.mod


".\Release\Model_Animal_Dynamics.obj": ".\Release\parameter_values.mod"
".\Release\Model_Animal_Dynamics.obj": ".\Release\structure_definitions.mod"
# Undefined Module: windows.mod


".\Release\Model_House_Dynamics.obj": ".\Release\parameter_values.mod"
".\Release\Model_House_Dynamics.obj": ".\Release\structure_definitions.mod"

".\Release\Misc_Procedures.obj": ".\Release\parameter_values.mod"
".\Release\Misc_Procedures.obj": ".\Release\structure_definitions.mod"
# Undefined Module: windows.mod


".\Release\Output_Routines.obj": ".\Release\parameter_values.mod"
".\Release\Output_Routines.obj": ".\Release\structure_definitions.mod"

Absoft User Forum  |  Support  |  General  |  Compiler failure on correct syntax
 

gfxgfx
gfx gfx
Powered by MySQL Powered by PHP Valid XHTML 1.0! Valid CSS!