Problems with common blocks in subprograms

I am writing an f90 program and have been using named common blocks to create global variable across all program units.

after adding a few variables to the named block I suddenly have alignment problems in subprogram units. The data is shifted. I have tried new block names, and adding more blocks to pick the shifted data but to no avail.

No what’s wrong? I don’t.


Can you post a minimal example? When thing that can get you into trouble is if all common block declarations are not the same? Often common block declarations are put in an include file so all scopes use the correct definition.

Since you’re using f90 and using common blocks to share data between subroutines and functions, consider using a module and module data instead. This will provide an easy single definition of the common data and provide better type checking.