Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GOCART develop crashing with out of bounds error after updates #156

Closed
bena-nasa opened this issue May 26, 2022 · 8 comments
Closed

GOCART develop crashing with out of bounds error after updates #156

bena-nasa opened this issue May 26, 2022 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@bena-nasa
Copy link
Contributor

bena-nasa commented May 26, 2022

After the PR merged into develop today, when I tried using the gocart develop branch, it crashed with this out of bounds error when using the "debug" build:

forrtl: severe (408): fort: (3): Subscript #3 of the array DPFLI has value 0 which is less than the lower bound of 1
Image              PC                Routine            Line        Source
GEOSgcm.x          000000000F493DCF  Unknown               Unknown  Unknown
GEOSgcm.x          000000000146F764  gocart2g_process_        6302  GOCART2G_Process.F90
GEOSgcm.x          0000000001158F67  su2g_gridcompmod_        1078  SU2G_GridCompMod.F90
libesmf.so         00002AAAAB40A9E4  _ZN5ESMCI6FTable1     Unknown  Unknown

The odd thing is that if you examine the code, it seems like it should be protected from getting there

6299 if(LH .lt. 1) continue
6300
6301 do k = LH, km
6302 qls(k) = dpfli(i,j,k)/pdog(i,j,k)*rhoa(i,j,k)
6303 end do

I tried changing the continue to cycle, thinking that maybe it was that but same behaviour. Will continue investigating.

@bena-nasa bena-nasa self-assigned this May 26, 2022
@bena-nasa bena-nasa added the bug Something isn't working label May 26, 2022
@tclune
Copy link
Contributor

tclune commented May 26, 2022

Next step is to either explicitly print the lbounds of the arrays involved or to run under the debugger to see the same.

Am guessing that dpfli might be an "edge" variable which starts at 0? Not that this would explain things.

Also - please edit your initial message above to include compiler + version. Am suspecting a compiler bug.

@bena-nasa
Copy link
Contributor Author

Hmm, maybe the cycle did do, I think I was rebuilding in the optimized build. Just rebuilt the debugged build and put the cycles in and it runs. So either it was the continue or we have a Heisenbug. I take a fresh look at this in the morning.

@tclune
Copy link
Contributor

tclune commented May 26, 2022

Hmm - I'd not even noticed that it said continue rather than cycle. The former should have been a syntax error, so maybe you ran without a new executable until that was fixed?

@weiyuan-jiang
Copy link
Contributor

weiyuan-jiang commented May 27, 2022

@tclune @bena-nasa I might introduce this bug. Let me take a took. It may be "exit" instead of cycle

@bena-nasa
Copy link
Contributor Author

Yep, there were 4 continue statements that should have been cycle. Will make PR to fix

@weiyuan-jiang
Copy link
Contributor

@bena-nasa @tclune I am sorry I messed up with C++'s "continue". The four "continue" statement should be 'cycle'.

bena-nasa added a commit that referenced this issue May 27, 2022
@bena-nasa bena-nasa mentioned this issue May 27, 2022
@tclune
Copy link
Contributor

tclune commented May 27, 2022

No problem. It is just unfortunate that it is not a syntax error. Usually such other-language constructs are caught by the compiler.

@mathomp4
Copy link
Member

No problem. It is just unfortunate that it is not a syntax error. Usually such other-language constructs are caught by the compiler.

Now that I understand the issue (I totally missed it yesterday looking at it with Ben because I guess I was in Python land...where continue is the right thing), it is annoying this isn't caught by the compiler. But, well, per the Standard:

1 Execution of a CONTINUE statement has no effect.

Since CONTINUE literally does nothing, I guess you can have them anywhere as long as it doesn't have a label at the front!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants