Fixes Inlining of Matmul With -fno-automatic in Fortran
This commit fixes an issue where allocatable arrays used for front-end optimization caused problems when inlining matmul with the `-fno-automatic` flag.
A bug prevented inlining of matmul (matrix multiplication) in Fortran when using allocatable arrays together with the -fno-automatic flag. The fix ensures that symbols are explicitly marked as automatic, which resolves the issue. This affects users who rely on inlining for performance and who also use -fno-automatic to avoid stack allocation of local variables.
In Details
This commit addresses PR fortran/106546 and relates to front-end optimization in the Fortran compiler (frontend-passes.cc). When -fno-automatic is specified, the compiler needs to handle allocatable arrays correctly during inlining. The fix explicitly sets the automatic attribute on symbols created by create_var and create_do_loop within the front-end, which resolves the problem with matmul inlining.
For Context
In Fortran, the -fno-automatic flag tells the compiler not to allocate local variables on the stack. This can sometimes improve performance or be necessary for compatibility with certain environments. This commit fixes a bug that occurred when this flag was used in conjunction with matmul (a built-in function for matrix multiplication) and allocatable arrays (arrays whose size is determined at runtime). The compiler wasn't correctly inlining the matmul function in this scenario, leading to suboptimal performance. The fix ensures that the compiler correctly handles these cases.