Topic: Bug or newbie error???

This happens when I'm debugging.  On the Launch options, I have a file name, "1hrTime IntErosion.WDC" (with the quote marks) and a working directory of C:\USDA Projects\Data Files\ .  The file name is retrieved, but it is also repeated 235 times without blanks separating them, which causes the program to think it has one looooong file name and it can't find it, so the program crashes.

Also for background:  The program works fine in the old Compaq Fortran, which has to be run in a virtual machine running XP with compatibility set to Win 95.  I'm trying to move it up to gFortran to be able to take advantage of some of the newer features.

Re: Bug or newbie error???

Don,

What call are you using to retrieve the filename from the command line?  I'm not sure why you'd see the filename repeated over and over again.

Jeff Armstrong
Approximatrix, LLC

Re: Bug or newbie error???

Here is the code used:

numArgs = Command_Argument_Count()  ! How many command line arguments?
If (numArgs <= 0) Then        ! Must have at least 1
    nError = 1                ! No arguments means a fatal error.
    Return
End If
!
Call GETARG(1, image) ! Pull the file name from the command line

length = Len_Trim(image)

If (length > 256) length = 256 ! Maximum of 256 characters in file name

File_In = image(1:length)     ! Associate input file with a unit

Open (UNIT=nRead,FILE=File_In,ACTION='READ',STATUS='OLD',IOSTAT=IOErr)

If (IOErr > 0) Then           ! Was association successful?
    nError = 2                ! No--fata error.
    Return
End If


If you need more, let me know.
And P.S. Jeff
Thanks for the super quick reply.
Don

Re: Bug or newbie error???

Don,

Are you seeing something like the following?

http://i.imgur.com/w9YQrg1.png

The debugger is actually saying that it found your filename followed by 234 spaces.  Note that the actual structure of the value is:

'1hrTime IntErosion.WDC',' ' <repeats 234 times>

In the value above, your filename is correctly read, and it is surrounded by single quotes as reported by the debugger.  The debugger goes on to say that, after your filename, there appears to be 234 space.  After the comma, a single space appears in single quotes, and that is all that is being repeated.

The spaces are repeated because Fortran doesn't really have a way to mark the end of a string.  Usually, though, it uses spaces to fill in the unused portion of a string.  The Compaq debugger may have stripped the information about trailing spaces when reporting the value.

When I print the value of image while debugging, I do get the proper filename.

Jeff Armstrong
Approximatrix, LLC

Re: Bug or newbie error???

Okay, newbie error - I misread what was repeating.  So, now it would seem it isn't finding the file.  I have the working directory pointing to "C:\USDA Project\Data Files" with quotes and (another assumption) I thought it would look in that directory for the file.  Am I mistaken?

Re: Bug or newbie error???

Addendum:

I moved the file to the project directory.  It found it without problems.  So, now I'm wondering why....
Don

Re: Bug or newbie error???

Don,

I think there might be a bug concerning the working directory.  If you don't put the working directory in quotes, it should work.  The bug is, of course, that it shouldn't matter, especially when so many other places require quotes around paths.

Jeff Armstrong
Approximatrix, LLC

Re: Bug or newbie error???

I'll give it a try.  Might be awhile, tho.  Other things pressing.
Don

Re: Bug or newbie error???

I tried with no quotes and it worked - for a while.  Then it started saying it couldn't find the file.  Then I commented out some formats that weren't being used, cleaned and re-built the executable.  No errors or warnings.  But now when I try to launch, I get a Simply Fortran Error - the process failed to start.  Any ideas?

Re: Bug or newbie error???

Addendum:  Just tried to debug and it appears to work - at least it took me to my first breakpoint.

Re: Bug or newbie error???

Don,

Was the "process failed to launch" error accompanied by a numeric code by any chance?  Are you using Simply Fortran's internal console or the external console (switchable from Launch Options)?

I would warn against using complex (meaning spaces and parentheses) paths when working with source code generally.  The compilers are quite adverse to such complex paths, although Simply Fortran does attempt to jump through hoops to avoid issues. Sometimes the issues persist, however.  We try to fix each as they are reported.

Jeff Armstrong
Approximatrix, LLC

Re: Bug or newbie error???

Jeff,
There wasn't an error code - just the message. I didn't select either console, so I guess it was the default.  What is the difference?
Don

Re: Bug or newbie error???

I went back, took the spaces out of the directory and re-built the project.  I also checked External Console, launched and got the following: "The following floating-point exception is signalling IEEE_DENORMAL"  Do you know what this means?

Re: Bug or newbie error???

Don,

Using the internal console (default) or the external console leads to the program being launched in slightly different ways.  I was just wondering where to start looking for a bug.  I'll have a look at the internal console code.

The informational warning you're seeing, (and it's not an error, just information) means that a number was calculated that was, in absolute value terms, so small that it could not be represented by the standard floating point values due to the magnitude of its exponent.  Again, the message is informational.  You should be able to disable it using:

-ffpe-trap=none

in your Fortran compiler flags (accessible via "Options..." in the Project menu, then click the "Compiler Flags" tag).

Jeff Armstrong
Approximatrix, LLC

Re: Bug or newbie error???

Hi Jeff,
I put in the -ffpe-trap=none as you suggested, but now it says "Fatal error: Argument to -ffpe-summary is not valid: none".  (I checked to make sure there were no embedded spaces.)  And the code giving the "IEEE_DENORMAL" is "Real(8), Allocatable :: H1C" - not an arithmetic statement.

Also, when debugging, how do you see the value of a variable in a structure?  For example, I have an inflow and outflow hydrograph.  The number of points in the inflow hydrograph is referenced as "Hin%nHydPts" and the points in the outflow is "Hout%nHydPts". When I add "Hin%nHydPts" to the watch list, its value shows as indeterminate.  Is there a way to show it value?

Also, just for info, the old Compaq Fortran debugger had a neat feature.  You could point at a variable with the mouse and it would show you the value.  Do you think that could be added to Simply Fortran?  It would cut down on the number of watch statements.

Don

Re: Bug or newbie error???

Don,

I apologize for my last post.  What you actually want is:

-ffpe-summary=none

That should suppress the runtime warning.

You should be able to view variables in a derived type exactly as you've stated.  If these aren't working in watch statements, it is a bug.  One note, though, is that you can't currently view the internals of allocated arrays.  Are you having trouble viewing members of a derived type?

You can view the value of any variable or expression by highlighting it and then hovering your mouse over the highlighted text.  By allowing highlighting, you can quickly view expressions rather than just variables.

Jeff Armstrong
Approximatrix, LLC

Re: Bug or newbie error???

Hi Jeff,

That took care of the error. 

I tried highlighting a non-structured variable and it does show the contents.  Still doesn't work with variables in structures - says "indeterminate" both in Watch and highlighted.

In debug mode, the program still stops at the first allocatable statement.  If I hit continue, it then goes to my first breakpoint.  Not a big problem but ????

Don

Re: Bug or newbie error???

Don,

When debugging, the debugger should stop at the first executable Fortran statement, which might be what you're seeing.  You can disable this by opening Debugger Options from the Options menu and unchecking "Break on Start."

I'll have to look into what's wrong with viewing derived types in the debugger.  I had thought everything was working well with them.

Jeff Armstrong
Approximatrix, LLC

Re: Bug or newbie error???

Hi Jeff,
Me again. Three things.

1.  When I try to Launch a program, it tells me "The process failed to start." with no warnings or other explanation, but the debug works correctly.

2.  It seems to lose the entered working directory for output.  For example, my working directory is C:\SF Projects\Data Files and the executable is in C:\SF Projects\WinDAM C\ as WinDamSim.EXE.  It takes the input file from the working directory, but the output file is built in C:\SF Projects\WinDAM C\.   This isn't a problem for debugging, but for actual runs, the output needs to go to the working directory.

3. When I highlight a structure element, I still get indeterminate as the value.

Don

Re: Bug or newbie error???

Jeff,
I told you wrong before.  It appears to ignoring the entered working directory entirely.  I had a copy of the input file in the .exe directory and that was where it was picking it up and storing the output.
Don

Re: Bug or newbie error???

One more thing - no, not a problem this time, just a question.  A lot of the programs I'm trying to import to Simply Fortran were built with the Compaq compiler and, evidently, it used a different tab character than Simply.  And most are composed of 60 to 100 subroutines in addition to the main one.  Now to the question.  Is there a way to convert all the tabs in all of the programs to spaces in one operation?  I know how to convert one program at a time, but I'm lazy!  Sure would be a time saver for me.
Don

Re: Bug or newbie error???

1.  When I try to Launch a program, it tells me "The process failed to start." with no warnings or other explanation, but the debug works correctly.

2.  It seems to lose the entered working directory for output.  For example, my working directory is C:\SF Projects\Data Files and the executable is in C:\SF Projects\WinDAM C\ as WinDamSim.EXE.  It takes the input file from the working directory, but the output file is built in C:\SF Projects\WinDAM C\.   This isn't a problem for debugging, but for actual runs, the output needs to go to the working directory.

Both these symptoms suggest to me that your working directory does not exist, or at least Simply Fortran cannot find it.  It could be that there is a minor typo in your working directory or a bug exists.  The debugger will actually launch fine and throw an internal error when the directory is not found, but it will proceed with the debugging session.  I'm adding some code now that will warn users if the directory does not exist at the time of launch.

3. When I highlight a structure element, I still get indeterminate as the value.

Still looking into it.

Compaq compiler and, evidently, it used a different tab character than Simply ...  Is there a way to convert all the tabs in all of the programs to spaces in one operation?

It's not that Compaq and Simply Fortran use different tab characters.  Simply Fortran is actually enforcing the standard that no tabs be allowed whereas Compaq allowed them for some reason.  A bulk replace is not possible with Simply Fortran or the tools included.  You could do so with Windows batch files; a Google search turns up some answers.  However, if your code is fixed-format Fortran, and the first tab character indents 7 spaces while subsequent tabs indent a different amount, you'll need a more elaborate replacement scheme than what Windows batch could provide.  I would personally try using a scripting language to do so (Python, Perl, etc.).

Jeff Armstrong
Approximatrix, LLC

Re: Bug or newbie error???

Don,

There is a new build on the Download page that may fix some of the debug issues and should now warn if the working directory is invalid.  Hopefully that fixes a few of your problems.  Thank you for reporting them, of course!

Jeff Armstrong
Approximatrix, LLC

Re: Bug or newbie error???

Thanks, Jeff.  I think I'm starting to get the hang of it now.  Now for one I think may be a compiler problem.

When I build my project in 64-bit mode, both run and debug go through to completion. However, when I use 32-bit, the debug runs to completion but the run version blows up. In essence, two calculated values are supposed to converge within a given limit.  If they don't converge within 100 iterations, the program considers it a fatal error, prints a message and quits.

The reason I think it's a compiler error is because a friend of mine is a CIS professor at KSU and he gets the same results using Eclipse.  Have you had this happen before?

Don

Re: Bug or newbie error???

Don,

I've seen similar behavior before, but not this specific circumstance.  You might try enabling some additional runtime checks to see if anything suspect is occurring that isn't caught by the compiler.  The runtime diagnostics can be enabled from the "Fortran" tab in Project Options.

Are you by chance using an exponential in your code anywhere?  That function in particular seems to be problematic under a variety of circumstances.

Jeff Armstrong
Approximatrix, LLC