Fortran: Avoid symbol collisions with internal names
Fortran now prefixes internally generated symbols with two underscores to prevent naming conflicts.
This patch prevents naming collisions between Fortran symbols and internally generated symbols by prefixing internal symbols with two underscores. This change ensures that user-defined Fortran symbols do not inadvertently clash with symbols created internally by the compiler, avoiding potential compilation errors or unexpected behavior. A new test case is added to verify the fix.
In Details
The Fortran front end generates internal symbols during coarray processing (coarray.cc). This commit adds a __ prefix to those names, preventing conflicts with user-defined symbols during linking.
For Context
In a compiler, internal symbols are names generated by the compiler itself to represent intermediate values or data structures. These internal symbols must be distinct from symbols defined by the user in the source code to avoid naming conflicts, which can lead to compilation errors or incorrect program behavior. This is especially important when using features like coarrays, which involve compiler-generated code for parallel processing.