The issue you are describing, where array variables are not accessible during debugging, despite the code running correctly, is likely related to a combination of the debugging environment and the Fortran compiler settings. Here are some potential causes and solutions to help resolve the issue:
Ensure that debugging symbols are properly generated for your code. You might have lost these settings accidentally.
Go to Project Properties in Visual Studio.
Navigate to Fortran > Debugging.
Ensure that the "Generate Debug Information" option is enabled. It should typically be set to Full (/debug:full).
Even though you mentioned optimizations are disabled, it's good to double-check because optimizations can affect variable visibility in the debugger.
In Project Properties, go to Fortran > Optimization.
Ensure that "Optimization" is set to Disabled (/O0).
Ensure you are using the Intel Debugger or a compatible debugger for Fortran. If you’re using the default Microsoft debugger, it might not handle Fortran constructs properly.
Check Tools > Options > Debugging in Visual Studio and make sure the correct debugger is being used.
If you have access to Intel's debugger (part of OneAPI), try explicitly selecting it.
If the variable cel is global, and the debugger cannot access it:
Ensure cel is explicitly declared as global in your code (e.g., using COMMON, MODULE, or USE statements).
If using MODULE, make sure the module is being compiled correctly and is visible to the debugger.
Sometimes, large or complex global variables may not appear correctly due to debugger limitations. To mitigate this, consider simplifying or restructuring the way global variables are accessed.
Occasionally, build artifacts can cause issues. Perform a clean build of your project:
Select Build > Clean Solution in Visual Studio.
Then, rebuild your project with Build > Rebuild Solution.
Debugging large or derived types (like your cel(i)%nn) can sometimes fail due to:
Corruption in the debugging database files (.pdb files). Delete these files and rebuild the solution.
Array bounds checking might be disabled, causing confusion in how the debugger maps memory.
Enable array bounds checking in Fortran > Run-Time settings.
Updates or changes in the Intel OneAPI Fortran compiler could cause unexpected behavior. Make sure your compiler is up-to-date:
Visit the Intel OneAPI website to check for updates.
Alternatively, revert to an earlier version of the compiler if the issue began after an update.
While not ideal, if the debugger consistently fails to show specific variables, use print statements as a workaround. Sometimes, restructuring code or simplifying expressions can also help the debugger handle variables better.
Enable detailed runtime debugging by adding flags like /traceback or /check:bounds in your compiler options. These can provide more context and help isolate the issue.
If the issue persists, consider contacting Intel’s support team or posting on their official forums. Include details like:
Intel Fortran compiler version.
Visual Studio version.
A minimal reproducer code, if possible.