aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
AgeCommit message (Collapse)AuthorFilesLines
2024-12-31Daily bump.GCC Administrator1-0/+16
2024-12-30Fortran: Implement f_c_string function.Steven G. Kargl7-9/+230
Fortran 2023 has added the new intrinsic function F_C_STRING to convert fortran strings of default character kind to a null terminated C string. Contributions from Steve Kargl, Harald Anlauf, FX Coudert, Mikael Morin, and Jerry DeLisle. PR fortran/117643 gcc/fortran/ChangeLog: * check.cc (gfc_check_f_c_string): Check arguments of f_c_string(). * gfortran.h (enum gfc_isym_id): New symbol GFC_ISYM_F_C_STRING. * intrinsic.cc (add_functions): Add the ISO C Binding routine f_c_string(). Wrap nearby long line to less than 80 characters. * intrinsic.h (gfc_check_f_c_string): Prototype for gfc_check_f_c_string(). * iso-c-binding.def (NAMED_FUNCTION): Declare for ISO C Binding routine f_c_string(). * primary.cc (gfc_match_rvalue): Fix comment that has been untrue since 2011. Add ISOCBINDING_F_C_STRING to conditional. * trans-intrinsic.cc (conv_trim): Specialized version of trim() for f_c_string(). (gfc_conv_intrinsic_function): Use GFC_ISYM_F_C_STRING to trigger in-lining. gcc/testsuite/ChangeLog: * gfortran.dg/f_c_string1.f90: New test. * gfortran.dg/f_c_string2.f90: New test.
2024-12-24Daily bump.GCC Administrator1-0/+19
2024-12-23Fortran: fix NULL without MOLD argument to scalar DT pointer dummy [PR118179]Harald Anlauf1-1/+2
Commit r15-6408 overlooked the case of passing NULL without MOLD argument to a derived type pointer dummy argument without specified intent. Since it is prohibited to modify the dummy argument, we treat it as if intent(in) were specified and suppress copying back of the pointer address. PR fortran/118179 gcc/fortran/ChangeLog: * trans-expr.cc (conv_null_actual): Suppress copying back of pointer address for unspecified intent. gcc/testsuite/ChangeLog: * gfortran.dg/null_actual_7.f90: Extend testcase to also cover scalar variants with pointer or allocatable dummy with or without specified intent.
2024-12-23Fortran: Bugs found in class_transformational_1/2.f90[PR116254/118059].Paul Thomas2-20/+30
2024-12-23 Paul Thomas <pault@gcc.gnu.org> gcc/fortran/ChangeLog PR fortran/116254 * trans-array.cc (gfc_trans_create_temp_array): Make sure that transformational intrinsics of class objects that change rank, most particularly spread, go through the correct code path. Re- factor so that changes to the dtype are done on the temporary before the class data of the result points to it. PR fortran/118059 * trans-expr.cc (arrayfunc_assign_needs_temporary): Character array function expressions assigned to an unlimited polymorphic variable require a temporary.
2024-12-23Daily bump.GCC Administrator1-0/+82
2024-12-22Fortran: fix front-end GMP memleaksHarald Anlauf2-15/+31
gcc/fortran/ChangeLog: * check.cc (gfc_check_random_seed): Clear gmp variables returned by gfc_array_size. * expr.cc (gfc_check_pointer_assign): Likewise.
2024-12-22Fortran: Replace getting of coarray data with accessor-based version. [PR107635]Andre Vehreschild7-231/+1137
Getting coarray data from remote images was slow, inefficient and did not work for object files that where not compiled with coarray support for derived types with allocatable/pointer components. The old approach emulated accessing data through a whole structure ref, which was error prone for corner cases. Furthermore was did it have a runtime complexity of O(N), where N is the number of allocatable/pointer components and descriptors involved. Each of those needed communication twice. The new approach creates a routine for each access into a coarray object putting all required operations there. Looking a tree-dump one will see those small routines. But this time it is just compiled fortran with all the knowledge of the compiler of bounds and so on. New paradigms will be available out of the box. Furthermore is the complexity of the communication reduced to be O(1). E.g. the mpi implementation sends one message for the parameters of the access and one message back with the results without caring about the number of allocatable/pointer/descriptor components in the access. Identification of access routines is done be adding them to a hash map, where the hash is the same on all images. Translating the hash to an index, which is the same on all images again, allows for fast calls of the access routines. Resolving the hash to an index is cached at runtime, preventing additional hash map lookups. A hashmap was use because not all processor OS combinations may use the same address for the access routine. gcc/fortran/ChangeLog: PR fortran/107635 * gfortran.h (gfc_add_caf_accessor): New function. * gfortran.texi: Document new API routines. * resolve.cc (get_arrayspec_from_expr): Synthesize the arrayspec resulting from an expression, i.e. not only the rank, but also the bounds. (remove_coarray_from_derived_type): Remove coarray ref from a derived type to access it in access routine. (convert_coarray_class_to_derived_type): Same but for classes. The result is a derived type. (split_expr_at_caf_ref): Split an expression at the coarray reference to move the reference after the coarray ref into the access routine. (check_add_new_component): Helper to add variables as components to derived type transfered to the access routine. (create_get_parameter_type): Create the derived type to transfer addressing data to the access routine. (create_get_callback): Create the access routine. (add_caf_get_intrinsic): Use access routine instead of old caf_get. * trans-decl.cc (gfc_build_builtin_function_decls): Register new API routines. (gfc_create_module_variable): Use renamed flag. (gfc_emit_parameter_debug_info): (struct caf_accessor): Linked list of hash-access routine pairs. (gfc_add_caf_accessor): Add a hash-access routine pair to above linked list. (create_caf_accessor_register): Add all registered hash-access routine pairs to the current caf_init. (generate_coarray_init): Use routine above. (gfc_generate_module_vars): Use renamed flag. (generate_local_decl): Same. (gfc_generate_function_code): Same. (gfc_process_block_locals): Same. * trans-intrinsic.cc (conv_shape_to_cst): Build the product of a shape. (gfc_conv_intrinsic_caf_get): Create call to access routine. (conv_caf_send): Adapt to caf_get using less arguments. (gfc_conv_intrinsic_function): Same. * trans.cc (gfc_trans_force_lval): Helper to ensure that an expression can be used as an lvalue-ref. * trans.h (gfc_trans_force_lval): See above. libgfortran/ChangeLog: * caf/libcaf.h (_gfortran_caf_register_accessor): New function to register access routines at runtime. (_gfortran_caf_register_accessors_finish): New function to finish registration of access routine and sort hash map. (_gfortran_caf_get_remote_function_index): New function to convert an hash to an index. (_gfortran_caf_get_by_ct): New function to get data from a remote image using the access routine given by an index. * caf/single.c (struct accessor_hash_t): Hashmap type. (_gfortran_caf_send): Fixed formatting. (_gfortran_caf_register_accessor): Register a hash accessor routine. (hash_compare): Compare two hashes for sort() and bsearch(). (_gfortran_caf_register_accessors_finish): Sort the hashmap to allow bsearch()'s quick lookup. (_gfortran_caf_get_remote_function_index): Map a hash to an index. (_gfortran_caf_get_by_ct): Get data from a remote image using the index provided by get_remote_function_index(). gcc/testsuite/ChangeLog: * gfortran.dg/coarray_atomic_5.f90: Adapted to look for get_by_ct. * gfortran.dg/coarray_lib_comm_1.f90: Same. * gfortran.dg/coarray_stat_function.f90: Same.
2024-12-22Fortran: Remove adding and removing of caf_get. [PR107635]Andre Vehreschild6-131/+158
Preparatory work for PR107635. During resolve prevent adding caf_get calls for expressions on the left-hand-side of an assignment and removing them later on again. Furthermore has the caf_token in a component become a pointer to the component and not the backend_decl of the caf-component. In some cases the caf_token was added as last component in a derived type and not as the next one following the component that it was needed to be associated to. gcc/fortran/ChangeLog: PR fortran/107635 * gfortran.h (gfc_comp_caf_token): Convenient macro for accessing caf_token's tree. * resolve.cc (gfc_resolve_ref): Backup caf_lhs when resolving expr in array_ref. (remove_caf_get_intrinsic): Removed. (resolve_variable): Set flag caf_lhs when resolving lhs of assignment to prevent insertion of caf_get. (resolve_lock_unlock_event): Same, but the lhs is the parameter. (resolve_ordinary_assign): Move conversion to caf_send to resolve_codes. (resolve_codes): Adress caf_get and caf_send here. (resolve_fl_derived0): Set component's caf_token when token is necessary. * trans-array.cc (gfc_conv_array_parameter): Get a coarray for expression that have a corank. (structure_alloc_comps): Use macro to get caf_token's tree. (gfc_alloc_allocatable_for_assignment): Same. * trans-expr.cc (gfc_get_ultimate_alloc_ptr_comps_caf_token): Same. (gfc_trans_structure_assign): Same. * trans-intrinsic.cc (conv_expr_ref_to_caf_ref): Same. (has_ref_after_cafref): New function to figure that after a reference of a coarray another reference is present. (conv_caf_send): Get rhs from correct place, when caf_get is not removed. * trans-types.cc (gfc_get_derived_type): Get caf_token from component and no longer guessing.
2024-12-22Daily bump.GCC Administrator1-0/+13
2024-12-21Fortran: fix passing of NULL() to assumed-rank, derived type dummy [PR104819]Harald Anlauf2-11/+80
PR fortran/104819 gcc/fortran/ChangeLog: * interface.cc (compare_parameter): For the rank check, NULL() inherits the rank of a provided MOLD argument. (gfc_compare_actual_formal): Adjust check of NULL() actual argument against formal to accept F2008 enhancements (allocatable dummy). NULL() with MOLD argument retains a pointer/allocatable attribute. * trans-expr.cc (conv_null_actual): Implement passing NULL() to derived-type dummy with pointer/allocatable attribute, and ensure that the actual rank is passed to an assumed-rank dummy. (gfc_conv_procedure_call): Use it. gcc/testsuite/ChangeLog: * gfortran.dg/null_actual_7.f90: New test.
2024-12-21Daily bump.GCC Administrator1-0/+34
2024-12-20Fortran: Fix hyphenation errors in the manualSandra Loosemore2-41/+41
When looking through the gfortran manual, I noted some problems with hyphens being used where they're not correct or necessary, e.g. "non-standard" vs "nonstandard", "null-pointer" vs "null pointer" (as a noun), etc. I've made a pass through the documentation to correct at least some of those uses. gcc/fortran/ChangeLog * gfortran.texi: Get rid of some unnecessary hyphens throughout the file. * invoke.texi: Likewise.
2024-12-20Fortran: Use the present tense for the manual.Sandra Loosemore2-137/+147
The present tense is preferred for expressing facts or enduring behavior. Thus we should say "option X does Y" instead of "option X will do Y", reserving the future tense for things that happen at some later time (such as in a future release of GCC, or at run time as explicitly contrasted with compile time). This set of edits is largely mechanical substitution of phrasing involving "will". I also fixed a few more markup problems noted while editing nearby text and fixed a few instances of awkward wording. gcc/fortran/ChangeLog * gfortran.texi: Use the present tense throughout; fix some markup issues and awkward wording. * invoke.texi: Likewise.
2024-12-20Fortran: Fixes for markup, typos, and indexing in manualSandra Loosemore2-145/+183
While working on something else I noticed there were numerous places in the GNU Fortran manual with incorrect/missing Texinfo markup. I made a pass through about the first third of the manual (not yet the coarray API or intrinsics documentation) to fix at least some of those issues, plus some typos and missing @cindex entries. There shouldn't be any semantic changes to the documentation in this patch. gcc/fortran/ChangeLog * gfortran.texi: Fix markup, typos, and indexing throughout the file. * invoke.texi: Likewise.
2024-12-20Fortran: Clean up -funderscoring and -fsecond-underscore docs [PR51820]Sandra Loosemore1-16/+15
This is a long-standing documentation bug in the Fortran manual, initially reported in 2012 as PR51820, with a quick fix applied later for PR109216. The patch here incorporates more of the discussion from the original issue. gcc/fortran/ChangeLog PR fortran/51820 PR fortran/89632 PR fortran/109216 * invoke.texi (Code Gen Options): Further cleanups of the discussion of what -funderscoring and -fsecond-underscore do.
2024-12-20Fortran: potential aliasing of complex pointer inquiry references [PR118120]Harald Anlauf1-6/+11
PR fortran/118120 PR fortran/113928 gcc/fortran/ChangeLog: * trans-array.cc (symbols_could_alias): If one symbol refers to a complex type and the other to a real type of the same kind, do not a priori exclude the possibility of aliasing. gcc/testsuite/ChangeLog: * gfortran.dg/aliasing_complex_pointer.f90: New test.
2024-12-18Daily bump.GCC Administrator1-0/+15
2024-12-17Documentation: Make OpenMP/OpenACC docs easier to find [PR26154]Sandra Loosemore2-29/+31
PR c/26154 is one of our oldest documentation issues. The only discussion of OpenMP support in the GCC manual is buried in the "C Dialect Options" section, with nothing at all under "Extensions". The Fortran manual does have separate sections for OpenMP and OpenACC extensions so I have copy-edited/adapted that text for similar sections in the GCC manual, as well as breaking out the OpenMP and OpenACC options into their own section (they apply to all of C, C++, and Fortran). I also updated the information about what versions of OpenMP and OpenACC are supported and removed some redundant text from the Fortran manual to prevent it from getting out of sync on future updates, and inserted some cross-references to the new sections elsewhere. gcc/c-family/ChangeLog PR c/26154 * c.opt.urls: Regenerated. gcc/ChangeLog PR c/26154 * common.opt.urls: Regenerated. * doc/extend.texi (C Extensions): Adjust menu for new sections. (Attribute Syntax): Mention OpenMP directives. (Pragmas): Mention OpenMP and OpenACC directives. (OpenMP): New section. (OpenACC): New section. * doc/invoke.texi (Invoking GCC): Adjust menu for new section. (Option Summary): Move OpenMP and OpenACC options to their own category. (C Dialect Options): Move documentation for -foffload, -fopenacc, -fopenacc-dim, -fopenmp, -fopenmd-simd, and -fopenmp-target-simd-clone to... (OpenMP and OpenACC Options): ...this new section. Light copy-editing of the option descriptions. gcc/fortran/ChangeLog: PR c/26154 * gfortran.texi (Standards): Remove redundant info about OpenMP/OpenACC standard support. (OpenMP): Copy-editing and update version info. (OpenACC): Likewise. * lang.opt.urls: Regenerated.
2024-12-17Fortran: Fix associate with derived type array construtor [PR117347]Andre Vehreschild1-0/+1
gcc/fortran/ChangeLog: PR fortran/117347 * primary.cc (gfc_match_varspec): Add array constructors for guessing their type like with unresolved function calls. gcc/testsuite/ChangeLog: * gfortran.dg/associate_71.f90: New test.
2024-12-17Daily bump.GCC Administrator1-0/+6
2024-12-16diagnostics: move libgdiagnostics dc from sinks into diagnostic_managerDavid Malcolm1-1/+3
libgdiagnostics was written before the fixes for PR other/116613 allowed a diagnostic_context to have multiple output sinks. Hence each libgdiagnostics sink had its own diagnostic_context with just one diagnostic_output_format. This wart is no longer necessary and makes it harder to move state into the manager/context; in particular for quoting source code from the .sarif file (PR sarif-replay/117943). Simplify, by making libgdiagnostics' implementation more similar to GCC's implementation, by moving the diagnostic_context from sink into diagnostic_manager. Doing so requires generalizing where the diagnostic_source_printing_options comes from in class diagnostic_text_output_format: for GCC we use the instance within the diagnostic_context, whereas for libgdiagnostics each diagnostic_text_sink has its own instance. No functional change intended. gcc/c-family/ChangeLog: PR sarif-replay/117943 * c-format.cc (selftest::test_type_mismatch_range_labels): Use dc.m_source_printing. * c-opts.cc (c_diagnostic_text_finalizer): Use source-printing options from text_output. gcc/cp/ChangeLog: PR sarif-replay/117943 * error.cc (auto_context_line::~auto_context_line): Use source-printing options from text_output. gcc/ChangeLog: PR sarif-replay/117943 * diagnostic-format-text.cc (diagnostic_text_output_format::append_note): Use source-printing options from text_output. (diagnostic_text_output_format::update_printer): Copy source-printing options from dc. (default_diagnostic_text_finalizer): Use source-printing options from text_output. * diagnostic-format-text.h (diagnostic_text_output_format::diagnostic_text_output_format): Add optional diagnostic_source_printing_options param, using the context's if null. (diagnostic_text_output_format::get_source_printing_options): New accessor. (diagnostic_text_output_format::m_source_printing): New field. * diagnostic-path.cc (event_range::print): Use source-printing options from text_output. (selftest::test_interprocedural_path_1): Use source-printing options from dc. * diagnostic-show-locus.cc (gcc_rich_location::add_location_if_nearby): Likewise. (diagnostic_context::maybe_show_locus): Add "opts" param and use in place of m_source_printing. Pass it to source_policy ctor. (diagnostic_source_print_policy::diagnostic_source_print_policy): Add overload taking a const diagnostic_source_printing_options &. * diagnostic.cc (diagnostic_context::initialize): Pass nullptr for source options when creating text sink, so that it uses the dc's options. (diagnostic_context::dump): Add an "output sinks:" heading and print "(none)" if there aren't any. (diagnostic_context::set_output_format): Split out code into... (diagnostic_context::remove_all_output_sinks): ...this new function. * diagnostic.h (diagnostic_source_print_policy::diagnostic_source_print_policy): Add overload taking a const diagnostic_source_printing_options &. (diagnostic_context::maybe_show_locus): Add "opts" param. (diagnostic_context::remove_all_output_sinks): New decl. (diagnostic_context::m_source_printing): New field. (diagnostic_show_locus): Add "opts" param and pass to maybe_show_locus. * libgdiagnostics.cc (sink::~sink): Delete. (sink::begin_group): Delete. (sink::end_group): Delete. (sink::emit): Delete. (sink::m_dc): Drop field. (diagnostic_text_sink::on_begin_text_diagnostic): Delete. (diagnostic_text_sink::get_source_printing_options): Use m_souece_printing. (diagnostic_text_sink::m_current_logical_loc): Drop field. (diagnostic_text_sink::m_inner_sink): New field. (diagnostic_text_sink::m_source_printing): New field. (diagnostic_manager::diagnostic_manager): Update for changes to fields. Initialize m_dc. (diagnostic_manager::~diagnostic_manager): Call diagnostic_finish. (diagnostic_manager::get_file_cache): Drop. (diagnostic_manager::get_dc): New accessor. (diagnostic_manager::begin_group): Reimplement. (diagnostic_manager::end_group): Reimplement. (diagnostic_manager::get_prev_diag_logical_loc): New accessor. (diagnostic_manager::m_dc): New field. (diagnostic_manager::m_file_cache): Drop field. (diagnostic_manager::m_edit_context): Convert to a std::unique_ptr so that object can be constructed after m_dc is initialized. (diagnostic_manager::m_prev_diag_logical_loc): New field. (diagnostic_text_sink::diagnostic_text_sink): Reimplement. (get_color_rule): Delete. (diagnostic_text_sink::set_colorize): Reimplement. (diagnostic_text_sink::text_starter): New. (sarif_sink::sarif_sink): Reimplement. (diagnostic_manager::write_patch): Update for change to m_edit_context. (diagnostic_manager::emit): Update now that each sink has a corresponding diagnostic_output_format object within m_dc. gcc/fortran/ChangeLog: PR sarif-replay/117943 * error.cc (gfc_diagnostic_text_starter): Use source-printing options from text_output. gcc/testsuite/ChangeLog: PR sarif-replay/117943 * gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc (custom_diagnostic_text_finalizer): Use source-printing options from text_output. * gcc.dg/plugin/diagnostic_plugin_xhtml_format.cc (xhtml_builder::make_element_for_diagnostic): Use source-printing options from diagnostic_context. * gcc.dg/plugin/expensive_selftests_plugin.cc (test_richloc): Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-12-16Daily bump.GCC Administrator1-0/+6
2024-12-15Fortran: Pointer fcn results must not be finalized [PR117897]Paul Thomas1-1/+8
2024-12-15 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/117897 * trans-expr.cc (gfc_trans_assignment_1): RHS pointer function results must not be finalized. gcc/testsuite/ PR fortran/117897 * gfortran.dg/finalize_59.f90: New test.
2024-12-13Daily bump.GCC Administrator1-0/+9
2024-12-12Fortran: Fix testsuite regressions after r15-5083 [PR117797]Paul Thomas1-35/+26
2024-12-12 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/117797 * trans-array.cc (class_array_element_size): New function. (gfc_get_array_span): Refactor, using class_array_element_size to return the span for descriptors that are the _data component of a class expression and then class dummy references. Revert the conditions to those before r15-5083 tidying up using 'sym'. gcc/testsuite/ PR fortran/117797 * gfortran.dg/pr117797.f90: New test.
2024-12-12Daily bump.GCC Administrator1-0/+7
2024-12-11Fortran: Add DECL_EXPR for variable length assoc name [PR117901]Paul Thomas1-0/+14
2024-12-11 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/117901 * trans-stmt.cc (trans_associate_var): A variable character length array associate name must generate a DECL expression for the data pointer type. gcc/testsuite/ PR fortran/117901 * gfortran.dg/pr117901.f90: New test.
2024-12-10Daily bump.GCC Administrator1-0/+18
2024-12-09Fortran: fix two minor front-end GMP memleaksHarald Anlauf1-2/+2
gcc/fortran/ChangeLog: * expr.cc (find_array_section): Do not initialize GMP variables twice.
2024-12-09Fortran: Fix testsuite regressions after r15-5897 [PR116261/PR117901]Paul Thomas3-6/+9
2024-12-09 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/116261 * trans-array.cc (gfc_array_init_size): New arg 'explicit_ts', to suppress the use of the expr3 element size in the descriptor dtype. (gfc_array_allocate): New arg 'explicit_ts', used in call to gfc_array_init_size. * trans-array.h : Modify prototype for gfc_array_allocate for new bool argument. * trans-stmt.cc (gfc_trans_allocate): Set new argument if the typespec is explicit. gcc/testsuite/ PR fortran/117901 * gfortran.dg/class_transformational_1.f90: Temporary fix for ICE with some compile options by setting dummy arg of 'unlimited rebar' to be allocatable.
2024-12-04Daily bump.GCC Administrator1-0/+37
2024-12-03Fortran: Fix class transformational intrinsic calls [PR102689]Paul Thomas2-35/+179
2024-12-03 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/102689 * trans-array.cc (get_array_ref_dim_for_loop_dim): Use the arg1 class container carried in ss->info as the seed for a lhs in class valued transformational intrinsic calls that are not the rhs of an assignment. Otherwise, the lhs variable expression is taken from the loop chain. For this latter case, the _vptr and _len fields are set. (gfc_trans_create_temp_array): Use either the lhs expression seeds to build a class variable that will take the returned descriptor as its _data field. In the case that the arg1 expr. is used, 'atmp' must be marked as unused, a typespec built with the correct rank and the _vptr and _len fields set. The element size is provided for the temporary allocation and to set the descriptor span. (gfc_array_init_size): When an intrinsic type scalar expr3 is used in allocation of a class array, use its element size in the descriptor dtype. * trans-expr.cc (gfc_conv_class_to_class): Class valued transformational intrinsics return the pointer to the array descriptor as the _data field of a class temporary. Extract directly and return the address of the class temporary. (gfc_conv_procedure_call): store the expression for the first argument of a class valued transformational intrinsic function in the ss info class_container field. Later, use its type as the element type in the call to gfc_trans_create_temp_array. (fcncall_realloc_result): Add a dtype argument and use it in the descriptor, when available. (gfc_trans_arrayfunc_assign): For class lhs, build a dtype with the lhs rank and the rhs element size and use it in the call to fcncall_realloc_result. gcc/testsuite/ PR fortran/102689 * gfortran.dg/class_transformational_1.f90: New test for class- valued reshape. * gfortran.dg/class_transformational_2.f90: New test for other class_valued transformational intrinsics.
2024-12-03OpenMP: 'allocate' directive - fixes for 'alignof' and [[omp::decl]]Tobias Burnus1-3/+0
Fixed a check to permit [[omp::decl(allocate,...)]] parsing in C. Additionaly, we discussed that 'allocate align' should not affect 'alignof' to avoid issues like with: int a; _Alignas(_Alignof(a)) int b; #pragma omp allocate(a) align(128) _Alignas(_Alignof(a)) int c; Thus, the alignment is no longer set in the C and Fortran front ends, but for static variables now in varpool_node::finalize_decl. (For stack variables, the alignment is handled in gimplify_bind_expr.) NOTE: 'omp allocate' is not yet supported in C++. gcc/c/ChangeLog: * c-parser.cc (c_parser_omp_allocate): Only check scope if not in_omp_decl_attribute. Remove setting the alignment. gcc/ChangeLog: * cgraphunit.cc (varpool_node::finalize_decl): Set alignment based on OpenMP's 'omp allocate' attribute/directive. gcc/fortran/ChangeLog: * trans-decl.cc (gfc_finish_var_decl): Remove setting the alignment. libgomp/ChangeLog: * libgomp.texi (Memory allocation): Mention (non-)effect of 'align' on _Alignof. * testsuite/libgomp.c/allocate-7.c: New test. gcc/testsuite/ChangeLog: * c-c++-common/gomp/allocate-18.c: Check that alignof is unaffected by 'omp allocate'. * c-c++-common/gomp/allocate-19.c: Likewise.
2024-11-30Daily bump.GCC Administrator1-0/+5
2024-11-29fortran: Add default to switch in gfc_trans_transfer [PR117843]Andrew Pinski1-0/+2
This fixes a bootstrap failure due to a warning on enum values not being handled. In this case, it is just checking two values and the rest should are not handled so adding a default case fixes the issue. Pushed as obvious. PR fortran/117843 gcc/fortran/ChangeLog: * trans-io.cc (gfc_trans_transfer): Add default case. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2024-11-29Daily bump.GCC Administrator1-0/+19
2024-11-28Fortran: Check for impure subroutine.Steven G. Kargl1-0/+18
PR fortran/117765 gcc/fortran/ChangeLog: * resolve.cc (pure_subroutine): Check for an impure subroutine call in a BLOCK construct nested within a DO CONCURRENT block. gcc/testsuite/ChangeLog: * gfortran.dg/impure_fcn_do_concurrent.f90: Update test to catch calls to an impure subroutine.
2024-11-28Fortran: fix crash with bounds check writing array section [PR117791]Harald Anlauf1-0/+20
PR fortran/117791 gcc/fortran/ChangeLog: * trans-io.cc (gfc_trans_transfer): When an array index depends on a function evaluation or an expression, do not use optimized array I/O of an array section and fall back to normal scalarization. gcc/testsuite/ChangeLog: * gfortran.dg/bounds_check_array_io.f90: New test.
2024-11-27diagnostics: replace %<%s%> with %qs [PR104896]David Malcolm1-11/+11
No functional change intended. gcc/analyzer/ChangeLog: PR c/104896 * sm-malloc.cc: Replace "%<%s%>" with "%qs" in message wording. gcc/c-family/ChangeLog: PR c/104896 * c-lex.cc (c_common_lex_availability_macro): Replace "%<%s%>" with "%qs" in message wording. * c-opts.cc (c_common_handle_option): Likewise. * c-warn.cc (warn_parm_array_mismatch): Likewise. gcc/ChangeLog: PR c/104896 * common/config/ia64/ia64-common.cc (ia64_handle_option): Replace "%<%s%>" with "%qs" in message wording. * common/config/rs6000/rs6000-common.cc (rs6000_handle_option): Likewise. * config/aarch64/aarch64.cc (aarch64_validate_sls_mitigation): Likewise. (aarch64_override_options): Likewise. (aarch64_process_target_attr): Likewise. * config/arm/aarch-common.cc (aarch_validate_mbranch_protection): Likewise. * config/pru/pru.cc (pru_insert_attributes): Likewise. * config/riscv/riscv-target-attr.cc (riscv_target_attr_parser::parse_arch): Likewise. * omp-general.cc (oacc_verify_routine_clauses): Likewise. * tree-ssa-uninit.cc (maybe_warn_read_write_only): Likewise. (maybe_warn_pass_by_reference): Likewise. gcc/cp/ChangeLog: PR c/104896 * cvt.cc (maybe_warn_nodiscard): Replace "%<%s%>" with "%qs" in message wording. gcc/fortran/ChangeLog: PR c/104896 * resolve.cc (resolve_operator): Replace "%<%s%>" with "%qs" in message wording. gcc/go/ChangeLog: PR c/104896 * gofrontend/embed.cc (Gogo::initializer_for_embeds): Replace "%<%s%>" with "%qs" in message wording. * gofrontend/expressions.cc (Selector_expression::lower_method_expression): Likewise. * gofrontend/gogo.cc (Gogo::set_package_name): Likewise. (Named_object::export_named_object): Likewise. * gofrontend/parse.cc (Parse::struct_type): Likewise. (Parse::parameter_list): Likewise. gcc/rust/ChangeLog: PR c/104896 * backend/rust-compile-expr.cc (CompileExpr::compile_integer_literal): Replace "%<%s%>" with "%qs" in message wording. (CompileExpr::compile_float_literal): Likewise. * backend/rust-compile-intrinsic.cc (Intrinsics::compile): Likewise. * backend/rust-tree.cc (maybe_warn_nodiscard): Likewise. * checks/lints/rust-lint-scan-deadcode.h: Likewise. * lex/rust-lex.cc (Lexer::parse_partial_unicode_escape): Likewise. (Lexer::parse_raw_byte_string): Likewise. * lex/rust-token.cc (Token::get_str): Likewise. * metadata/rust-export-metadata.cc (PublicInterface::write_to_path): Likewise. * parse/rust-parse.cc (peculiar_fragment_match_compatible_fragment): Likewise. (peculiar_fragment_match_compatible): Likewise. * resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): Likewise. * resolve/rust-ast-resolve-toplevel.h: Likewise. * resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): Likewise. * rust-session-manager.cc (validate_crate_name): Likewise. (Session::load_extern_crate): Likewise. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise. (TypeCheckExpr::resolve_fn_trait_call): Likewise. * typecheck/rust-hir-type-check-implitem.cc (TypeCheckImplItemWithTrait::visit): Likewise. * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::validate_trait_impl_block): Likewise. * typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::visit): Likewise. * typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Likewise. * typecheck/rust-tyty.cc (BaseType::bounds_compatible): Likewise. * typecheck/rust-unify.cc (UnifyRules::emit_abi_mismatch): Likewise. * util/rust-attributes.cc (AttributeChecker::visit): Likewise. libcpp/ChangeLog: PR c/104896 * pch.cc (cpp_valid_state): Replace "%<%s%>" with "%qs" in message wording. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-11-28Daily bump.GCC Administrator1-0/+10
2024-11-27Fortran: Fix non_overridable typebound proc problems [PR84674/117768].Paul Thomas2-8/+14
2024-11-27 Paul Thomas <pault@gcc.gnu.org> gcc/fortran/ChangeLog PR fortran/84674 * class.cc (add_proc_comp): If the component points to a tbp that is abstract, do not return since the new version is more likely to be usable. PR fortran/117768 * resolve.cc (resolve_fl_derived): Remove the condition that rejected a completely empty derived type extension. gcc/testsuite/ChangeLog PR fortran/117768 * gfortran.dg/pr117768.f90: New test.
2024-11-27Daily bump.GCC Administrator1-0/+23
2024-11-26Fortran: fix minor front-end memleaksHarald Anlauf2-1/+7
gcc/fortran/ChangeLog: * expr.cc (find_inquiry_ref): Fix memleak introduced by scanning the reference chain to find and simplify inquiry references. * symbol.cc (gfc_copy_formal_args_intr): Free formal namespace when not needed to avoid a front-end memleak.
2024-11-26Fortran: passing inquiry ref of complex array to assumed rank dummy [PR117774]Harald Anlauf1-1/+4
PR fortran/117774 gcc/fortran/ChangeLog: * trans-expr.cc (gfc_conv_procedure_call): When passing an array to an assumed-rank dummy, terminate search for array reference of actual argument before an inquiry reference (e.g. INQUIRY_RE, INQUIRY_IM) so that bounds update works properly. gcc/testsuite/ChangeLog: * gfortran.dg/assumed_rank_25.f90: New test.
2024-11-26Fortran: Partial reversion of r15-5083 [PR117763]Paul Thomas1-6/+10
2024-11-26 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/117763 * trans-array.cc (gfc_get_array_span): Guard against derefences of 'expr'. Clean up some typos. Use 'gfc_get_vptr_from_expr' for clarity and apply a functional reversion of last section that deals with class dummies. gcc/testsuite/ PR fortran/117763 * gfortran.dg/pr117763.f90: New test.
2024-11-26Daily bump.GCC Administrator1-0/+7
2024-11-25Fortran: Check IMPURE in BLOCK inside DO CONCURRENT.Steve Kargl1-0/+18
PR fortran/117765 gcc/fortran/ChangeLog: * resolve.cc (check_pure_function): Check the stack to see if the function is in a nested BLOCK and, if that block is inside a DO_CONCURRENT, issue an error. gcc/testsuite/ChangeLog: * gfortran.dg/impure_fcn_do_concurrent.f90: New test.
2024-11-25Daily bump.GCC Administrator1-0/+16
2024-11-24Fortran: Fix segfault in allocation of unlimited poly array [PR85869]Paul Thomas1-1/+2
2024-11-24 Paul Thomas <pault@gcc.gnu.org> gcc/fortran/ChangeLog PR fortran/85869 * trans-expr.cc (trans_class_vptr_len_assignment): To access the '_len' field, re must be unlimited polymorphic. gcc/testsuite/ PR fortran/85869 * gfortran.dg/pr85869.f90: Comment out test of component refs.