aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
AgeCommit message (Collapse)AuthorFilesLines
3 daysDaily bump.GCC Administrator1-0/+8
4 daysFortran: Fix ICE in deallocating PDTs [PR121191]Paul Thomas1-0/+18
2025-10-13 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/121191 * trans-array.cc (has_parameterized_comps): New function which checks if a derived type has parameterized components. ( gfc_deallocate_pdt_comp): Use it to prevent deallocation of PDTs if there are no parameterized components. gcc/testsuite/ PR fortran/121191 * gfortran.dg/pdt_59.f03: New test.
4 daysDaily bump.GCC Administrator1-0/+14
5 daysFortran: Fix some minor PDT parse errors [PR95543,PR103748]Paul Thomas2-2/+24
2025-10-12 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/95543 PR fortran/103748 * decl.cc (insert_parameter_exprs): Guard param->expr before using it. (gfc_get_pdt_instance): Substitute paramaters in kind default initializers. (gfc_match_decl_type_spec): Emit an error if a type paramter specification list appears in a variable declaraion with a non-parameterized type. * primary.cc (gfc_match_rvalue): Emit an error if a type spec list is empty. gcc/testsuite/ PR fortran/95543 * gfortran.dg/pdt_17.f03: Change error message. * gfortran.dg/pdt_57.f03: New test. PR fortran/103748 * gfortran.dg/pdt_58.f03: New test.
5 daysDaily bump.GCC Administrator1-0/+6
6 daysfortran: fix bootstrap after r16-4372 [PR122257]Harald Anlauf1-1/+1
PR fortran/50377 PR fortran/122257 gcc/fortran/ChangeLog: * resolve.cc (resolve_actual_arglist): Initialize variable.
6 daysDaily bump.GCC Administrator1-0/+6
7 daysFortran: improve checking of procedures passed as actual argument [PR50377]Harald Anlauf1-0/+24
Procedures passed as actual argument require either an explicit interface or must be declared EXTERNAL. Add a check and generate an error (default) or a warning when -std=legacy is specified. PR fortran/50377 gcc/fortran/ChangeLog: * resolve.cc (resolve_actual_arglist): Check procedure actual arguments. gcc/testsuite/ChangeLog: * gfortran.dg/pr41011.f: Fix invalid testcase. * gfortran.dg/actual_procedure_2.f: New test.
7 daysDaily bump.GCC Administrator1-0/+10
8 daysFortran: fix "unstable" interfaces of external procedures [PR122206]Harald Anlauf1-0/+1
In the testcase repeated invocations of a function showed an apparently unstable interface. This was caused by trying to guess an (inappropriate) interface of the external procedure after processing of the procedure arguments in gfc_conv_procedure_call. The mis-guessed interface showed up in subsequent uses of the procedure symbol in gfc_conv_procedure_call. The solution is to check for an existing interface of an external procedure before trying to wildly guess based on just the actual arguments. PR fortran/122206 gcc/fortran/ChangeLog: * trans-types.cc (gfc_get_function_type): Do not clobber an existing procedure interface. gcc/testsuite/ChangeLog: * gfortran.dg/interface_abstract_6.f90: New test.
8 daysdiagnostics: add class sink::extensionDavid Malcolm1-0/+1
This patch provides a way for plugins to add extra information to a diagnostic sink, potentially capturing more information via a "finalizer" hook. gcc/c-family/ChangeLog: * c-opts.cc: Define INCLUDE_VECTOR. gcc/cp/ChangeLog: * error.cc: Define INCLUDE_VECTOR. gcc/ChangeLog: * diagnostic-global-context.cc: Define INCLUDE_VECTOR. * diagnostics/buffering.cc: Likewise. * diagnostics/context.cc (context::finish): Call finalize_extensions on each sink. (sink::dump): Dump any extensions. (sink::finalize_extensions): New. * diagnostics/macro-unwinding.cc: Define INCLUDE_VECTOR. * diagnostics/selftest-context.cc: Likewise. * diagnostics/sink.h (class sink::extension): New. (sink::add_extension): New. (sink::finalize_extensions): New decl. (sink::m_extensions): New member. * gcc.cc: Define INCLUDE_VECTOR. * langhooks.cc: Likewise. * opts.cc: Likewise. * tree-diagnostic-client-data-hooks.cc: Likewise. * tree-diagnostic.cc: Likewise. gcc/fortran/ChangeLog: * error.cc: Define INCLUDE_VECTOR. gcc/testsuite/ChangeLog: * gcc.dg/plugin/diagnostic_group_plugin.cc: Define INCLUDE_VECTOR. * gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc: Likewise. * gcc.dg/plugin/location_overflow_plugin.cc: Likewise. libcc1/ChangeLog: * context.cc: Define INCLUDE_VECTOR. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
8 daysDaily bump.GCC Administrator1-0/+32
9 daysFortran: fix warnings for symbols with C binding and declared PRIVATE [PR49111]Harald Anlauf1-8/+10
The Fortran standard does not prohibit restricting the accessibility of a symbol by use of the PRIVATE attribute and exposing it via a C binding label. Instead of unconditionally generating a warning, only warn if the binding label is surprisingly identical to the privatized Fortran symbol and when -Wsurprising is specified. PR fortran/49111 gcc/fortran/ChangeLog: * decl.cc (verify_bind_c_sym): Modify condition for generation of accessibility warning, and adjust warning message. gcc/testsuite/ChangeLog: * gfortran.dg/binding_label_tests_9.f03: Adjust test. * gfortran.dg/module_private_2.f90: Likewise. * gfortran.dg/public_private_module_2.f90: Likewise. * gfortran.dg/binding_label_tests_35.f90: New test.
9 daysFortran: Fix PDT parameter substitution [PR93175,PR102240,PR102686]Paul Thomas5-33/+93
2025-10-08 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/93175 PR fortran/102240 PR fortran/102686 * array.cc (match_array_element_spec): For pdt templates, call gfc_correct_parm_expr to elimante extraneous symbols from the bound expressions. * decl.cc (correct_parm_expr, gfc_correct_parm_expr): New fcns that remove symbols that are not PDT parameters from the type specification expressions. (insert_parameter_exprs): Process function symbols as if they are variables in the substitution with parameter expressions. (gfc_get_pdt_instance): Make sure that the parameter list of PDT components is updated as the instance is built. Move the construction of pdt_strings down a bit in the function and remove the tie up with pdt_arrays. * gfortran.h: Add prototype for gfc_correct_parm_expr. * resolve.cc (resolve_component): Skip testing for constant specification expressions in pdt_template component string lengths and pdt_strings. * trans-array.cc (structure_alloc_comps): Remove testing for deferred parameters and instead make sure that components of PDT type have parameters substituted with the parameter exprs of the enclosing PDT. gcc/testsuite/ PR fortran/93175 PR fortran/102240 PR fortran/102686 * gfortran.dg/pdt_55.f03: New test.
9 daysDaily bump.GCC Administrator1-0/+6
10 daysFortran: Fix ICE in pdt_1[3-5].f03 with -fcheck=all [PR102901]Paul Thomas1-1/+5
2025-10-07 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/102901 * trans-array.cc (structure_alloc_comps): Do not use gfc_check_pdt_dummy with pointer or allocatable components. gcc/testsuite/ PR fortran/102901 * gfortran.dg/pdt_56.f03: Copy of pdt_13.f03 compiled with -fcheck=all.
12 daysDaily bump.GCC Administrator1-0/+13
13 daysFortran: fix issue with I/O of array pointer [PR107968]Harald Anlauf1-1/+3
PR fortran/107968 gcc/fortran/ChangeLog: * trans-io.cc (gfc_trans_transfer): Also scalarize I/O of section of an array pointer. gcc/testsuite/ChangeLog: * gfortran.dg/implied_do_io_9.f90: New test.
2025-10-03Fortran: Error in nested PDTs with undefined KIND exprs. [122109]Paul Thomas1-1/+9
2025-10-03 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/122089 * decl.cc (gfc_get_pdt_instance): If gfc_extract_int is true an error has occurred because the kind expr was not provided. Use the template in this case and return MATCH_YES. gcc/testsuite/ PR fortran/122089 * gfortran.dg/pdt_52.f03: New test. * gfortran.dg/pdt_53.f03: New test. * gfortran.dg/pdt_54.f03: New test.
2025-10-02Daily bump.GCC Administrator1-0/+14
2025-10-01Fortran: UBSAN uninitialized stride for missing optional argument [PR122080]Harald Anlauf1-0/+9
PR fortran/122080 gcc/fortran/ChangeLog: * trans-array.cc (gfc_conv_array_parameter): Wrap the derivation of bounds and strides for the descriptor of an optional dummy array argument by a test on argument presence when it is supposed to be passed to an optional argument. gcc/testsuite/ChangeLog: * gfortran.dg/ubsan/missing_optional_dummy_9.f90: New test.
2025-10-01Fortran: Generic interface checking with use associated PDTs [PR122089]Paul Thomas1-0/+2
2025-10-01 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/122089 * decl.cc (gfc_get_pdt_instance): If the pdt_template is use associated, 'module' field should be copied to this instance. gcc/testsuite/ PR fortran/122089 * gfortran.dg/pdt_51.f03: New test.
2025-10-01Daily bump.GCC Administrator1-0/+15
2025-09-30Fortran: ICE in derived type with a PDT component [PR102241,PR105380]Paul Thomas5-40/+82
2025-09-30 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/102241 * gfortran.h: Add symbol attribute 'pdt_comp'. * module.cc : Add 'pdt_comp' to 'ab_attribute' and 'attr_bits'. (mio_symbol_attribute): Set 'pdt_comp'. * resolve.cc (resolve_component): If a PDT component is found in a non-PDT type, generate the PDT instance, if necessary, and set the 'pdt_comp' attribute. Fix some whitespace issues. * trans-decl.cc (gfc_get_symbol_decl, gfc_trans_deferred_vars): If 'pdt_comp' set, initialize the PDT components. * trans-stmt.cc (gfc_trans_deallocate): Verify that a typespec parameter list is available for PDT components of ordinary derived types. gcc/testsuite/ PR fortran/105380 * gfortran.dg/pdt_49.f03: New test. PR fortran/102241 * gfortran.dg/pdt_11.f03: Deallocate 'o_fdef'. * gfortran.dg/pdt_15.f03: Reinstate final 'pop_8' and update the tree dump counts. * gfortran.dg/pdt_20.f03: Deallocate 'x'. * gfortran.dg/pdt_23.f03: Deallocate 'x'. * gfortran.dg/pdt_3.f03: Eliminate the temporary 'matrix' and use w%d directly in the allocation. Change the TODO comment and comment on memory leak in allocation. * gfortran.dg/pdt_39.f03: Comments on memory leaks. * gfortran.dg/pdt_40.f03: Deallocate 'foo' and bar%x. * gfortran.dg/pdt_50.f03: New test.
2025-09-28Daily bump.GCC Administrator1-0/+5
2025-09-27Fortran: Revert r16-4069 causing memory leaks in f951 [PR87908]Paul Thomas1-19/+0
2025-09-27 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/87908 * interface.cc (check_interface0): Revert changes. gcc/testsuite/ PR fortran/87908 * gfortran.dg/pr87908.f90: Delete.
2025-09-27Daily bump.GCC Administrator1-0/+9
2025-09-26Fortran: Fix uninitialized reads for pdt_13.f03 etc. [PR122002]Paul Thomas2-3/+4
2025-09-26 Harald Anlauf <anlauf@gcc.gnu.org> gcc/fortran PR fortran/122002 * decl.cc (gfc_get_pdt_instance): Initialize 'instance' to NULL and set 'kind_value' to zero before calling gfc_extract_int. * primary.cc (gfc_match_rvalue): Intitialize 'ctr_arglist' to NULL and test for default values if gfc_get_pdt_instance returns NULL.
2025-09-26Daily bump.GCC Administrator1-0/+6
2025-09-25Fortran: ICE in character(kind=4) deferred-length array reference [PR121939]Harald Anlauf1-0/+1
PR fortran/121939 gcc/fortran/ChangeLog: * trans-types.cc (gfc_init_types): Set string flag for all character types. gcc/testsuite/ChangeLog: * gfortran.dg/deferred_character_39.f90: Disable temporary workaround for character(kind=4) deferred-length bug.
2025-09-25Daily bump.GCC Administrator1-0/+14
2025-09-24fortran: Favor parser-generated module procedure namespaces [PR122046]Mikael Morin1-1/+14
In the testcase from the PR, an assertion triggers because the compiler tries to access the parent namespace of a contained procedure. But the namespace is the formal namespace of a module procedure symbol in a submodule, which hasn't its parent set. To add a bit of context, in submodules, module procedures inherited from their parent module have two different namespaces holding their dummy arguments. The first one is generated by the the host association of the module from the .mod file, and is made accessible in the procedure symbol's formal_ns field. Its parent field is not set. The second one is generated by the parser and contains the procedure implementation. It's accessible from the list of contained procedures in the submodule namespace. Its parent field is set. This change modifies gfc_get_procedure_ns to favor the parser-generated namespace in the submodule case where there are two namespaces to choose from. PR fortran/122046 gcc/fortran/ChangeLog: * symbol.cc (gfc_get_procedure_ns): Try to find the namespace among the list of contained namespaces before returning the value from the formal_ns field. gcc/testsuite/ChangeLog: * gfortran.dg/submodule_34.f90: New test.
2025-09-24Fortran: Fix ICE in check_interface [PR87908]Paul Thomas1-0/+19
2025-09-24 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/87908 * interface.cc (check_interface0): If a vtable is found in the interface list, check that it is either a subroutine or a function. Let resolve.cc do any further checking. gcc/testsuite/ PR fortran/87908 * gfortran.dg/pr87908.f90: New test.
2025-09-23Fortran: Check ICE in gfc_conv_array_initializer has gone [PR105380]Paul Thomas1-1/+1
2025-09-23 Paul Thomas <pault@gcc.gnu.org> gcc/fortran * ChangeLog: Correct PR number for entry on 18th Sept: 114815 to 121948. gcc/testsuite/ * ChangeLog: Ditto. PR fortran/105380 * gfortran.dg/pdt_49.f03: New test.
2025-09-23Daily bump.GCC Administrator1-0/+6
2025-09-22Fortran: Fix error recovery after missing END BLOCK [PR103508]Paul Thomas1-1/+1
2025-09-22 Steve Kargl <pault@gcc.gnu.org> gcc/fortran PR fortran/103508 * decl.cc (gfc_match_end): Remove only the current partial rather than removing the entire sibling chain. gcc/testsuite/ PR fortran/103508 * gfortran.dg/pr103508.f90: New test.
2025-09-22Daily bump.GCC Administrator1-0/+22
2025-09-21Fortran: fix frontend memory leaks for ALLOCATE with SOURCE [PR109010]Harald Anlauf1-0/+4
When running under valgrind the Fortran frontend showed several leaks involving __gmp_default_allocate for simple code such as program p real, pointer :: x(:) allocate (x, source = reshape ([1.], [1])) end as not all used components of the structure gfc_code were freed when a statement was freed. Just do so. PR fortran/109010 gcc/fortran/ChangeLog: * st.cc (gfc_free_statement): Also free components expr3 and expr4.
2025-09-21Fix test case and add errors for when -fexternal-blas64 makse no sense.Thomas Koenig3-1/+8
-fexternal-blas64 requires front-end optimization to be turned on. This patch issues a hard error if this is not the case, and also issues an error on not-64 bit systems, where specifying it would make no sense, and lead to errors. Finally, this makes sure that the test is only performed on 64-bit systems. I tried creating test cases for the hard errors for the wrong option combinations, but didn't succeed; see the thread on the gcc mailing list on that topic. These can always be added afterwards. gcc/fortran/ChangeLog: PR fortran/121161 * invoke.texi: Mention that -ffrontend-optimize is required for -fexternal-blas64. * options.cc (gfc_post_options): Fatal error if -fexternal-blas64 is specified without -ffrontend-optimize. * trans-types.cc (gfc_init_kinds): Fatal error if -fexternal-blas64 is specified on a system which does not have 64-bit ptrdiff_t. gcc/testsuite/ChangeLog: PR fortran/121161 * gfortran.dg/matmul_blas_3.f90: Add effective target lp64.
2025-09-21Fortran: fix issues with rank-2 deferred-length character arrays [PR108581]Harald Anlauf1-0/+13
PR fortran/108581 gcc/fortran/ChangeLog: * trans-array.cc (gfc_conv_expr_descriptor): Take the dynamic string length into account when deriving the dataptr offset for a deferred-length character array. gcc/testsuite/ChangeLog: * gfortran.dg/deferred_character_39.f90: New test.
2025-09-21Daily bump.GCC Administrator1-0/+8
2025-09-20Fortran: Fix regtest failure in pdt_48.f03. [PR83746]Paul Thomas1-0/+17
2025-09-20 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/83746 * trans-decl.cc (gfc_trans_deferred_vars): If a procedure with an non-allocatable, non-pointer explicit PDT result has no default initializer, the parameterized components should be allocated.
2025-09-20Daily bump.GCC Administrator1-0/+7
2025-09-19Fortran: Intrinsic functions in PDT specification exprs. [PR83746]Paul Thomas1-0/+10
2025-09-19 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/83746 * trans-array.cc (structure_alloc_comps): Add the pre and post blocks to 'fnblock' for all the evaluations of parameterized expressions in PDT component allocatation. gcc/testsuite/ PR fortran/83746 * gfortran.dg/pdt_48.f03: New test.
2025-09-19Daily bump.GCC Administrator1-0/+12
2025-09-18Fortran: Implement PDT constructors with syntax variants [PR114815]Paul Thomas3-15/+47
2025-09-18 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/114815 * decl.cc (gfc_get_pdt_instance): Copy the contents of 'tb' and not the pointer. * primary.cc (gfc_match_rvalue): If there is only one actual argument list, use if for the type spec parameter values. If this fails try the default type specification values and use the actual arguments for the component values. * resolve.cc (build_init_assign): Don't initialize implicit PDT function results. gcc/testsuite/ PR fortran/114815 * gfortran.dg/pdt_3.f03: Add missing deallocation of 'matrix'. * gfortran.dg/pdt_17.f03: Change dg-error text. * gfortran.dg/pdt_47.f03: New test.
2025-09-18Daily bump.GCC Administrator1-0/+13
2025-09-17Implement -fexternal-blas64 option.Thomas Koenig6-15/+51
Libraries like Intel MKL use 64-bit integers in their API, but gfortran up to now only provides external BLAS for matmul with 32-bit integers. This straightforward patch provides a new option -fexternal-blas64 to remedy that situation. gcc/fortran/ChangeLog: * frontend-passes.cc (optimize_namespace): Handle flag_external_blas64. (call_external_blas): If flag_external_blas is set, use gfc_integer_4_kind as the argument kind, gfc_integer_8_kind otherwise. * gfortran.h (gfc_integer_8_kind): Define. * invoke.texi: Document -fexternal-blas64. * lang.opt: Add -fexternal-blas64. * lang.opt.urls: Regenerated. * options.cc (gfc_post_options): -fexternal-blas is incompatible with -fexternal-blas64. gcc/testsuite/ChangeLog: * gfortran.dg/matmul_blas_3.f90: New test.
2025-09-16Daily bump.GCC Administrator1-0/+11
2025-09-15Fortran: Dependency check in PDT specification assignments [PR83763]Paul Thomas2-22/+38
2025-09-15 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/83763 * trans-decl.cc (gfc_trans_deferred_vars): Ensure that the parameterized components of PDTs that do not have allocatable components are deallocated on leaving scope. * trans-expr.cc (gfc_trans_assignment_1): Do a dependency check on PDT assignments. If there is a dependency between lhs and rhs, deallocate the lhs parameterized components after the rhs has been evaluated. gcc/testsuite/ PR fortran/83763 * gfortran.dg/pdt_46.f03: New test.