Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Nasty dialog bug

nvaneck
New Contributor I
1,209 Views
The following code turns the varaible FATAL undefined after execution of the dlginit call. This is a show stopper for me as I was intending to get a release out today, so I'm hoping someone can provide a clue or suggestion

. This is the minimal code I can use to get the problem. It does not happen in unoptimized code. The dialogs all worked fine in all previous releases over the past several years.

Just specifying "favor small code" generates the problem. No optimization, then no problem. I have 30 similar programs using many dialogs. In one test with the full code, successive dlgset calls turned fatal true, then false, then undefined, then true. When returning to the main program, debug said fatal was true, but IF (fatal) did not branch. Using relaes 10.1 fortran. It always stops with an access violation on FATAL.


PROGRAM OSIRIS
FATAL=.FALSE.
CALL EXPORT(FATAL)
end

SUBROUTINE EXPORT(fatal)
USE IFLOGM
INCLUDE 'RESOURCE.FD'
TYPE (DIALOG) DLG

LOGICAL(4) RETLOG,FATAL

RETLOG=DLGINIT(IDD_EXPORT,DLG)
END

Neal Van Eck
0 Kudos
12 Replies
nvaneck
New Contributor I
1,209 Views
I have replaced the EXPORT dialog with a default blank one and still get the problem, so that code is really all that is to get the problem.
0 Kudos
Les_Neilson
Valued Contributor II
1,209 Views
Quoting - nvaneck

PROGRAM OSIRIS
FATAL=.FALSE.
CALL EXPORT(FATAL)
end


Neal Van Eck

Assuming the code snippet is correct. In your main program the variable FATAL not explicity defined as logical and therefor is default real.

Les
0 Kudos
nvaneck
New Contributor I
1,209 Views
Quoting - Les Neilson

Assuming the code snippet is correct. In your main program the variable FATAL not explicity defined as logical and therefor is default real.

Les

0 Kudos
nvaneck
New Contributor I
1,209 Views
Quoting - Les Neilson

Assuming the code snippet is correct. In your main program the variable FATAL not explicity defined as logical and therefor is default real.

Les

Sorry; it is in the real code, and I must have left it out wehen I cut lines out. It does not affect the problem.
0 Kudos
anthonyrichards
New Contributor III
1,209 Views
Quoting - nvaneck

Sorry; it is in the real code, and I must have left it out wehen I cut lines out. It does not affect the problem.

That is hardly complete code, as it is missing DlgSetSub, DlgModal, DlgUninit etc.
What version compiler are you using? Please post more code, including some example dialog resource.
0 Kudos
nvaneck
New Contributor I
1,209 Views
Quoting - anthonyrichards

That is hardly complete code, as it is missing DlgSetSub, DlgModal, DlgUninit etc.
What version compiler are you using? Please post more code, including some example dialog resource.

That is the complete code. I removed all that other stuff to get the smallest sample that gets the problem. You are looking at all the code except the dialog, which as I said, is a default one from the resource editor.

One should be able to enter that code, use a default dialog, and get the problem. No other code is necessary. I reduced it as much as possible as Steve always asks to get the minimum example. It just has to execute the dlginit to get the problem None of that other stuff needs to execute.

This code is all that is in the project, using Fortran release 10.1.
0 Kudos
Steven_L_Intel1
Employee
1,209 Views

You did not declare FATAL as LOGICAL in the main program, so what you get is a REAL value of 0. I doubt that is exactly relevant to the problem, though.

I can't reproduce this using 10.1 (or 11.1.) Could you attach a ZIP of a complete solution (clean it first) that demonstrates the problem?
0 Kudos
nvaneck
New Contributor I
1,209 Views

You did not declare FATAL as LOGICAL in the main program, so what you get is a REAL value of 0. I doubt that is exactly relevant to the problem, though.

I can't reproduce this using 10.1 (or 11.1.) Could you attach a ZIP of a complete solution (clean it first) that demonstrates the problem?

Right. I've since tried several different project settings, some work, many don't; otpimizing for SIMD extensions sometinmes exists immediately, even thought they are used in the whole project for 45 other programs.It's almost random with different options, but no optimization always works, sometimes favor small size works.I'm running on an AMD Phenom II 945 under windows 764-bit if that's relevant.

Using minimize size, favor fast code use intel 4 and compaible proceesors (no SIMD extensions) and requiring the same exhibits the problem. Adding using SIMD3 extensions runs and has the problem also.
0 Kudos
Steven_L_Intel1
Employee
1,209 Views

Please attach a ZIP of a complete solution that shows the problem. (Do a Build > Clean first.) Also, please add code to your test case that demonstrates the corruption of FATAL.
0 Kudos
nvaneck
New Contributor I
1,209 Views

Please attach a ZIP of a complete solution that shows the problem. (Do a Build > Clean first.) Also, please add code to your test case that demonstrates the corruption of FATAL.

Steve, I have found what is happening and it a mistake on my part. The debug under optimization pointed exactly to a line testing FATAL, which it indicated was undefined. I cast about for nearby lines that could be troubleand found an error. I believe FATAL was undefined because the optimizer put it on the stack--could this be why? Anyway, that fooled me.

I apologise for the trouble, but I am much relieved to have resolved this.


Thanks!
0 Kudos
Steven_L_Intel1
Employee
1,209 Views

I had not realized you were debugging optimized code - that can lead to all sorts of strange effects. The variable may have been in a register or the optimizer decided it wasn't "live" at that point. I'm glad you solved it.
0 Kudos
nvaneck
New Contributor I
1,209 Views

I had not realized you were debugging optimized code - that can lead to all sorts of strange effects. The variable may have been in a register or the optimizer decided it wasn't "live" at that point. I'm glad you solved it.

Yes, well it didn't show up unoptimized, and the actual problem was one routine away from the actual break. Got my new MicrOsiris release out in good time:)

Thanks again for helping out.
0 Kudos
Reply