- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Dear Friends:
I am about to complete a large mixed language project (C++,Fortran legacy code; I asked silly and not so silly questions before) with lots of bad/risky ingredients like lots of COMMON statement shared by C++. I am now testing the resulting program. It is running bit I have a very strange problem.
In one of the legacy FORTRAN Subroutines I have a local 4x4 matrix. The variable name is SSXY(4,4). I initially included a debug WRITE statement to watch its content. It seemed like all was working. When I deleted the debug statement, the program gives very strange results. When I include a very simple WRITE statement like:
WRITE(7,7015) SSXY(1,1)
7015 FORMAT(' ROD: SSXY(1,1) = ',E15.7)
Anywhere. It runs OK. If I put an IF block around it does go back to faulty mode.
I am now going through all the commons shared with C++ code to make sure there is no misalignment. Strange thing is the code is very stable. It never crashes either way.
I am posting this message to ask your wisdom on possible reasons and how I should go about chasing it.
Regards;
I. Konuk
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Problems that appear when you remove (or add) seemingly unrelated statements are usually due to memory corruption issues, such as mismatched arguments or writing past the end of an array. There are many other possibilities. Often the cause of the error is far removed from where it appears.
Link copiado
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Problems that appear when you remove (or add) seemingly unrelated statements are usually due to memory corruption issues, such as mismatched arguments or writing past the end of an array. There are many other possibilities. Often the cause of the error is far removed from where it appears.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Steve Lionel (Ret.) (Blackbelt) wrote:Problems that appear when you remove (or add) seemingly unrelated statements are usually due to memory corruption issues, such as mismatched arguments or writing past the end of an array. There are many other possibilities. Often the cause of the error is far removed from where it appears.
Steve:
Thank you very much again. Your advice was indeed very helpful. I am going through all CALLs. I already found one mistyping(!). The subroutine CALL is expecting a matrix. Misspelling means a scalar being passed. Just like you described.
Thank you.
Merry Christmas and happy holidays to all.
I. Konuk
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
The compiler has a feature, on by default in a Debug Visual Studio configuration, that helps with this. From the command line it is /warn:interfaces and in Visual Studio, Fortran > Diagnostics > Check routine interfaces.
You should also get in the habit of adding IMPLICIT NONE in every program unit - this will help you find misspelled variable names.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Steve:
I will do the first one right away. I have plans to do the IMPLICIT in the future as it would be too much work right now to make legacy code type safe. My goal is first to finish the full size prototype. I will try it in the future or I may just code some units (slowly) in C++.
By the way, it seems like the one and only error which I reported earlier was the culprit. Thank you again for all your valuable suggestions.
Happy holidays.
I. Konuk
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
I was wrong! The compiler found a second one. I learned and benefited from this Forum, especially you so much. I owe much gratitude. THANK YOU!
I. Konuk
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Steve,
I am running vs community edition 2017 with IVF 19 update 5. I do not have a Fortran menu off of the main menu and under project properties I do not have a diagnostics menu. I am interested in turning on the interface checking.
Michael
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Steve,
My only option is compile time diagnostics
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
That property page is long - did you scroll it? The screen shot I showed has it scrolled to the end.
Show a screen shot of what you are seeing.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
I get the options when I set diagnostics to custom. So I am good now.
Thanks.
- Subscrever fonte RSS
- Marcar tópico como novo
- Marcar tópico como lido
- Flutuar este Tópico para o utilizador atual
- Marcador
- Subscrever
- Página amigável para impressora