Skip to content
Snippets Groups Projects
  1. Mar 20, 2023
    • Harald Anlauf's avatar
      Fortran: fix documentation of -fno-underscoring [PR109216] · 6c2b28e4
      Harald Anlauf authored
      gcc/fortran/ChangeLog:
      
      	PR fortran/109216
      	* invoke.texi: Correct documentation of how underscores are appended
      	to external names.
      6c2b28e4
    • Marek Polacek's avatar
      c++: explicit ctor and list-initialization [PR109159] · a226590f
      Marek Polacek authored
      When I implemented explicit(bool) in r9-3735, I added this code to
      add_template_candidate_real:
      +  /* Now the explicit specifier might have been deduced; check if this
      +     declaration is explicit.  If it is and we're ignoring non-converting
      +     constructors, don't add this function to the set of candidates.  */
      +  if ((flags & LOOKUP_ONLYCONVERTING) && DECL_NONCONVERTING_P (fn))
      +    return NULL;
      but as this test demonstrates, that's incorrect when we're initializing
      from a {}: for list-initialization we consider explicit constructors and
      complain if one is chosen.
      
      	PR c++/109159
      
      gcc/cp/ChangeLog:
      
      	* call.cc (add_template_candidate_real): Add explicit decls to the
      	set of candidates when the initializer is a braced-init-list.
      
      libstdc++-v3/ChangeLog:
      
      	* testsuite/20_util/pair/cons/explicit_construct.cc: Adjust dg-error.
      	* testsuite/20_util/tuple/cons/explicit_construct.cc: Likewise.
      	* testsuite/23_containers/span/explicit.cc: Likewise.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/cpp0x/explicit16.C: New test.
      a226590f
    • Jakub Jelinek's avatar
      c++: Drop TREE_READONLY on vars (possibly) initialized by tls wrapper [PR109164] · 0a846340
      Jakub Jelinek authored
      The following two testcases are miscompiled, because we keep TREE_READONLY
      on the vars even when they are (possibly) dynamically initialized by a TLS
      wrapper function.  Normally cp_finish_decl drops TREE_READONLY from vars
      which need dynamic initialization, but for TLS we do this kind of
      initialization upon every access to those variables.  Keeping them
      TREE_READONLY means e.g. PRE can hoist loads from those before loops
      which contain the TLS wrapper calls, so we can access the TLS variables
      before they are initialized.
      
      2023-03-20  Jakub Jelinek  <jakub@redhat.com>
      
      	PR c++/109164
      	* cp-tree.h (var_needs_tls_wrapper): Declare.
      	* decl2.cc (var_needs_tls_wrapper): No longer static.
      	* decl.cc (cp_finish_decl): Clear TREE_READONLY on TLS variables
      	for which a TLS wrapper will be needed.
      
      	* g++.dg/tls/thread_local13.C: New test.
      	* g++.dg/tls/thread_local13-aux.cc: New file.
      	* g++.dg/tls/thread_local14.C: New test.
      	* g++.dg/tls/thread_local14-aux.cc: New file.
      0a846340
    • Michael Meissner's avatar
      Rework 128-bit complex multiply and divide. · c67f312d
      Michael Meissner authored
      This patch reworks how the complex multiply and divide built-in functions are
      done.  Previously GCC created built-in declarations for doing long double complex
      multiply and divide when long double is IEEE 128-bit.  However, it did not
      support __ibm128 complex multiply and divide if long double is IEEE 128-bit.
      
      This code does not create the built-in declaration with the changed name.
      Instead, it uses the TARGET_MANGLE_DECL_ASSEMBLER_NAME hook to change the name
      before it is written out to the assembler file like it now does for all of the
      other long double built-in functions.
      
      2023-03-20   Michael Meissner  <meissner@linux.ibm.com>
      
      gcc/
      
      	PR target/109067
      	* config/rs6000/rs6000.cc (create_complex_muldiv): Delete.
      	(init_float128_ieee): Delete code to switch complex multiply and divide
      	for long double.
      	(complex_multiply_builtin_code): New helper function.
      	(complex_divide_builtin_code): Likewise.
      	(rs6000_mangle_decl_assembler_name): Add support for mangling the name
      	of complex 128-bit multiply and divide built-in functions.
      
      gcc/testsuite/
      
      	PR target/109067
      	* gcc.target/powerpc/divic3-1.c: New test.
      	* gcc.target/powerpc/divic3-2.c: Likewise.
      	* gcc.target/powerpc/mulic3-1.c: Likewise.
      	* gcc.target/powerpc/mulic3-2.c: Likewise.
      c67f312d
    • Harald Anlauf's avatar
      Fortran: simplification of NEAREST for large argument [PR109186] · 4410a08b
      Harald Anlauf authored
      gcc/fortran/ChangeLog:
      
      	PR fortran/109186
      	* simplify.cc (gfc_simplify_nearest): Fix off-by-one error in setting
      	up real kind-specific maximum exponent for mpfr.
      
      gcc/testsuite/ChangeLog:
      
      	PR fortran/109186
      	* gfortran.dg/nearest_6.f90: New test.
      4410a08b
    • Peter Bergner's avatar
      rs6000: Don't ICE when compiling the __builtin_vec_xst_trunc built-in [PR109178] · fbd50e86
      Peter Bergner authored
      When we expand the __builtin_vec_xst_trunc built-in, we use the wrong mode
      for the MEM operand which causes an unrecognizable insn ICE.  The solution
      is to use the correct TMODE mode.
      
      2023-03-20  Peter Bergner  <bergner@linux.ibm.com>
      
      gcc/
      	PR target/109178
      	* config/rs6000/rs6000-builtin.cc (stv_expand_builtin): Use tmode.
      
      gcc/testsuite/
      	PR target/109178
      	* gcc.target/powerpc/pr109178.c: New test.
      fbd50e86
    • Jakub Jelinek's avatar
      testsuite: Fix up 20230313.C test · e19234f4
      Jakub Jelinek authored
      I've noticed this testcase FAILs on i686-linux with
      -fstack-protector-strong.
      
      sizeof (auto_vec<int, 8>) == 16, which in this case contains
      4-byte m_vec (which points to to m_auto), then 8-byte m_auto
      which contains just 8-byte m_vecpfx and finally 1 byte m_data,
      rest is padding.  We then try to push 2 ints to it, so 8 bytes,
      starting at the end of m_vecpfx aka address of m_data, but there
      is just 1 byte + 3 bytes of padding.
      In the lp64 case, I think sizeof (auto_vec<int, 8>) == 24,
      because there is 8-byte m_vec, 8-byte m_vecpfx and 1-byte m_char
      all with 8-byte alignment.
      
      2023-03-20  Jakub Jelinek  <jakub@redhat.com>
      
      	* g++.dg/torture/20230313.C (auto_vec): Change m_data type
      	from char to char [2 * sizeof (int)].
      e19234f4
    • Jonathan Wakely's avatar
      libstdc++: Remove template-head from std::expected<void> ctor [PR109182] · 5194ad19
      Jonathan Wakely authored
      The presence of a template-head on this constructor is a copy & paste
      error from the primary template.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/109182
      	* include/std/expected (expected<void>::expected(in_place_t)):
      	Remove template-head.
      5194ad19
    • Paul Thomas's avatar
      Fortran: Allow external function from in an associate block [PR87127] · 5889c7bd
      Paul Thomas authored
      2023-03-20  Paul Thomas  <pault@gcc.gnu.org>
      
      gcc/fortran
      	PR fortran/87127
      	* resolve.cc (check_host_association): If an external function
      	is typed but not declared explicitly to be external, change the
      	old symbol from a variable to an external function.
      
      gcc/testsuite/
      	PR fortran/87127
      	* gfortran.dg/external_procedures_4.f90: New test.
      5889c7bd
    • GCC Administrator's avatar
      Daily bump. · 09abeb73
      GCC Administrator authored
      09abeb73
  2. Mar 19, 2023
    • Harald Anlauf's avatar
      Fortran: procedures with BIND(C) attribute require explicit interface [PR85877] · 5426ab34
      Harald Anlauf authored
      gcc/fortran/ChangeLog:
      
      	PR fortran/85877
      	* resolve.cc (resolve_fl_procedure): Check for an explicit interface
      	of procedures with the BIND(C) attribute (F2018:15.4.2.2).
      
      gcc/testsuite/ChangeLog:
      
      	PR fortran/85877
      	* gfortran.dg/pr85877.f90: New test.
      5426ab34
    • Thomas Koenig's avatar
      Mention undefined behavior on integer overflow. · 655689f6
      Thomas Koenig authored
      gcc/fortran/ChangeLog:
      
      	* gfortran.texi: Mention behavior on overflow.
      655689f6
    • Xin Liu's avatar
      Re: [PATCH] Testsuite: Disable micromips for MSA tests · 14361c5a
      Xin Liu authored
      gcc/testsuite
      	* gcc.target/mips/mips.exp (mips-dg-options): Disable micromips
      	for MSA tests.
      14361c5a
    • Gaius Mulley's avatar
      [modula2] target independent doc and tools rebuilt · 8804eb0b
      Gaius Mulley authored
      
      The target independent documentation needs to be rebuilt together with the
      bootstrap tools after the library changes and after the <* noreturn *>
      attribute has been implemented.
      
      gcc/m2/ChangeLog:
      
      	* Make-maintainer.in (gm2.maintainer-clean): Remove.
      	(gm2.maintainer-help): Add gm2.maintainer-tools,
      	gm2.maintainer-doc.  Remove gm2.maintainer-clean.
      	Change target-independent directory to target-independent/m2.
      	* gm2-compiler/ppg.mod: Correct __FILE_ typo to __FILE__.
      	* gm2-compiler/M2Options.def (SetAutoInit): Update comment.
      	* gm2-compiler/M2Options.mod (SetAutoInit): Update comment.
      	* gm2-gcc/m2color.cc (m2color_colorize_start): Rename name_len
      	to _name_high.
      	* gm2-gcc/m2color.def (colorize_start): change ARRAY OF CHAR to
      	ADDRESS and add _name_high.
      	* gm2-gcc/m2decl.cc (m2decl_BuildStartFunctionDeclaration): Change
      	int to bool.
      	* gm2-gcc/m2decl.h (m2decl_BuildStartFunctionDeclaration): Change
      	int to bool.
      	* gm2-gcc/m2expr.cc (m2expr_BuildBinarySetDo): Change int to bool.
      	(m2expr_BuildIfConstInVar): Change int to bool.
      	(m2expr_BuildIfNotConstInVar): Change int to bool.
      	(m2expr_BuildIfVarInVar): Change int to bool.
      	(m2expr_BuildIfNotVarInVar): Change int to bool.
      	(m2expr_BuildForeachWordInSetDoIfExpr): Change int to bool.
      	* gm2-gcc/m2expr.h (m2expr_BuildIfNotVarInVar): Change int to bool.
      	(m2expr_BuildIfVarInVar): Change int to bool.
      	(m2expr_BuildIfNotConstInVar): Change int to bool.
      	(m2expr_BuildIfConstInVar): Change int to bool.
      	* gm2-gcc/m2options.h (M2Options_SetAutoInit): Change int to bool.
      	(M2Options_SetNilCheck): Change int to bool.
      	(M2Options_SetReturnCheck): Change int to bool.
      	(M2Options_SetCaseCheck): Change int to bool.
      	(M2Options_SetCheckAll): Change int to bool.
      	(M2Options_SetVerboseUnbounded): Change int to bool.
      	(M2Options_SetUnboundedByReference): Change int to bool.
      	(M2Options_SetOptimizing): Change int to bool.
      	(M2Options_SetQuiet): Change int to bool.
      	(M2Options_SetCpp): Change int to bool.
      	(M2Options_SetM2g): Change int to bool.
      	(M2Options_SetLowerCaseKeywords): Change int to bool.
      	(M2Options_SetVerbose): Change int to bool.
      	* gm2-gcc/m2treelib.cc (m2treelib_get_rvalue): Change int to bool.
      	(m2treelib_get_field_no): Change int to bool.
      	(m2treelib_get_set_value): Change int to bool.
      	(m2treelib_get_set_address): Change int to bool.
      	(m2treelib_get_set_address_if_var): Change int to bool.
      	* gm2-gcc/m2treelib.def (get_set_address_if_var): Change int to bool.
      	(get_set_address): Change int to bool.
      	(get_set_value): Change int to bool.
      	(get_field_no): Change int to bool.
      	(get_rvalue): Change int to bool.
      	* gm2-gcc/m2treelib.h (m2treelib_get_field_no): Change int to bool.
      	(m2treelib_get_set_value): Change int to bool.
      	(m2treelib_get_set_address): Change int to bool.
      	(m2treelib_get_set_address_if_var): Change int to bool.
      	* gm2-gcc/m2type.cc (m2type_BuildEndFunctionType): Change int to bool.
      	* gm2-gcc/m2type.h (m2type_BuildEndFunctionType): Change int to bool.
      	* gm2-libs-ch/dtoa.cc (dtoa_calcsign): Change int to bool.
      	* gm2-libs-ch/ldtoa.cc (dtoa_calcsign): Change int to bool.
      	(ldtoa_ldtoa): Change int to bool.
      	* m2.flex (functionInfo): Change int to bool.
      	(pushFunction): Change parameter from int to bool.
      	* mc-boot/GDebug.cc (Debug_Halt): Rebuild.
      	* mc-boot/GDebug.h (Debug_Halt): Rebuild.
      	* mc-boot/GDynamicStrings.cc: Rebuild.
      	* mc-boot/GDynamicStrings.h: Rebuild.
      	* mc-boot/GFIO.cc: Rebuild.
      	* mc-boot/GM2RTS.cc: Rebuild.
      	* mc-boot/GM2RTS.h: Rebuild.
      	* mc-boot/GPushBackInput.cc: Rebuild.
      	* mc-boot/GRTExceptions.cc: Rebuild.
      	* mc-boot/GRTint.cc: Rebuild.
      	* mc-boot/GSysStorage.cc: Rebuild.
      	* mc-boot/Gdecl.cc: Rebuild.
      	* mc-boot/GsymbolKey.cc: Rebuild.
      	* mc/symbolKey.mod: Rebuild.
      	* target-independent/m2/Builtins.texi: Rebuild.
      	* target-independent/m2/SYSTEM-iso.texi: Rebuild.
      	* target-independent/m2/SYSTEM-pim.texi: Rebuild.
      	* target-independent/m2/gm2-libs.texi: Rebuild.
      	* tools-src/def2doc.py (PIM_Log): Change gm2-libs-pim to
      	gm2-lib-log.
      
      Signed-off-by: default avatarGaius Mulley <gaiusmod2@gmail.com>
      8804eb0b
    • Stafford Horne's avatar
      or1k: Do not clear existing FPU exceptions before updating · 33fb1625
      Stafford Horne authored
      We should always carry the exceptions forward.  This bug was found when
      working on testing glibc math tests, many tests were failing with
      Overflow and Underflow flags not set.  This was traced to here.
      
      libgcc/ChangeLog:
      
      	* config/or1k/sfp-machine.h (FP_HANDLE_EXCEPTIONS): Remove
      	statement clearing existing exceptions.
      33fb1625
    • Jonny Grant's avatar
      Docs: correct typo in nonnull function attribute description. · 0e38aedc
      Jonny Grant authored
      gcc/ChangeLog:
      	* doc/extend.texi (Common Function Attributes) <nonnull>:
      	Correct typo.
      0e38aedc
    • GCC Administrator's avatar
      Daily bump. · cffcb774
      GCC Administrator authored
      cffcb774
  3. Mar 18, 2023
    • David Malcolm's avatar
      analyzer: fix ICE on certain longjmp calls [PR109094] · 430d7d88
      David Malcolm authored
      
      PR analyzer/109094 reports an ICE in the analyzer seen on qemu's
      target/i386/tcg/translate.c
      
      The issue turned out to be that when handling a longjmp, the code
      to pop the frames was generating an svalue for the result_decl of any
      popped frame that had a non-void return type (and discarding it) leading
      to "uninit" poisoned_svalue_diagnostic instances being saved since the
      result_decl is only set by the greturn stmt.  Later, when checking the
      feasibility of the path to these diagnostics, m_check_expr was evaluated
      in the context of the frame of the longjmp, leading to an attempt to
      evaluate the result_decl of each intervening frames whilst in the
      context of the topmost frame, leading to an assertion failure in
      frame_region::get_region_for_local here:
      
      919		case RESULT_DECL:
      920		  gcc_assert (DECL_CONTEXT (expr) == m_fun->decl);
      921		  break;
      
      This patch updates the analyzer's longjmp implementation so that it
      doesn't attempt to generate svalues for the result_decls when popping
      frames, fixing the assertion failure (and presumably fixing "uninit"
      false positives in a release build).
      
      gcc/analyzer/ChangeLog:
      	PR analyzer/109094
      	* region-model.cc (region_model::on_longjmp): Pass false for
      	new "eval_return_svalue" param of pop_frame.
      	(region_model::pop_frame): Add new "eval_return_svalue" param and
      	use it to suppress the call to get_rvalue on the result when
      	needed by on_longjmp.
      	* region-model.h (region_model::pop_frame): Add new
      	"eval_return_svalue" param.
      
      gcc/testsuite/ChangeLog:
      	PR analyzer/109094
      	* gcc.dg/analyzer/setjmp-pr109094.c: New test.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      430d7d88
    • Jonathan Wakely's avatar
      libstdc++: Fix test for hash<coroutine_handle<P>>::operator() [PR109165] · 9b83d475
      Jonathan Wakely authored
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/109165
      	* testsuite/18_support/coroutines/hash.cc: Use const object
      	in second call.
      9b83d475
    • Paul Thomas's avatar
      Fortran: Fix bugs and missing features in finalization [PR37336] · d7caf313
      Paul Thomas authored
      2023-03-18  Paul Thomas  <pault@gcc.gnu.org>
      
      gcc/fortran
      	PR fortran/103854
      	PR fortran/96122
      	PR fortran/37336
      	* class.cc (finalize_component): Include the missing arguments
      	in the call to the component's finalizer wrapper.
      	(has_finalizer_component): Do not return true for procedure
      	pointer components.
      	(finalizer_insert_packed_call): Remove the redundant argument
      	in the call to the final subroutine.
      	(generate_finalization_wrapper): Add support for assumed rank
      	finalizers.
      	(gfc_may_be_finalized): New helper function.
      	* dump-parse-tree.cc (write_proc): Whitespace.
      	* gfortran.h : Add prototype for gfc_may_be_finalized.
      	* resolve.cc (resolve_function): Correct derived types that
      	have an incomplete namespace.
      	(resolve_where, gfc_resolve_where_code_in_forall,
      	gfc_resolve_forall_body, gfc_resolve_code): Check that the op
      	code is still EXEC_ASSIGN. If it is set lhs to must finalize.
      	(is_finalizable_type): New function.
      	(generate_component_assignments): Set must_finalize if needed.
      	(gfc_resolve_finalizers): Error if assumed rank finalizer is
      	not the only one. Warning on lack of scalar finalizer modified
      	to account for assumed rank finalizers.
      	(generate_final_call): New function.
      	(generate_component_assignments): Enclose the outermost call in
      	a block to capture automatic deallocation and final calls.
      	Set must_finalize as required to satisfy the standards. Use an
      	explicit pointer assignment for pointer components to capture
      	finalization of the target. Likewise use explicit assignment
      	for allocatable components. Do not use the temporary copy of
      	the lhs in defined assignment if the component is allocatable.
      	Put the temporary in the same namespace as the lhs symbol if
      	the component may be finalized. Remove the leading assignment
      	from the expansion of assignment of components that have their
      	own defined assignment components. Suppress finalization of
      	assignment of temporary components to the lhs. Make an explicit
      	final call for the rhs function temporary if it exists.
      	(gfc_resolve_code): Set must_finalize for assignments with an
      	array constructor on the rhs.
      	(gfc_resolve_finalizers): Ensure that an assumed rank finalizer
      	is the only finalizer for that type and correct the surprising
      	warning for the lack of a scalar finalizer.
      	(check_defined_assignments): Handle allocatable components.
      	(resolve_fl_derived): Set referenced the vtab for use
      	associated symbols.
      	(resolve_symbol): Set referenced an unreferenced symbol that
      	will be finalized.
      	* trans-array.cc (gfc_trans_array_constructor_value): Add code
      	to finalize the constructor result. Warn that this feature was
      	removed in F2018 and that it is suppressed by -std=2018.
      	(trans_array_constructor): Add finalblock, pass to previous
      	and apply to loop->post if filled.
      	(gfc_add_loop_ss_code): Add se finalblock to outer loop post.
      	(gfc_trans_array_cobounds, gfc_trans_array_bounds): Add any
      	generated finalization code to the main block.
      	(structure_alloc_comps): Add boolean argument to suppress
      	finalization and use it for calls from
      	gfc_deallocate_alloc_comp_no_caf. Otherwise it defaults to
      	false.
      	(gfc_copy_alloc_comp_no_fini): New wrapper for
      	structure_alloc_comps.
      	(gfc_alloc_allocatable_for_assignment): Suppress finalization
      	by setting new arg in call to gfc_deallocate_alloc_comp_no_caf.
      	(gfc_trans_deferred_array): Use gfc_may_be_finalized and do not
      	deallocate the components of entities with a leading '_' in the
      	name that are also marked as artificial.
      	* trans-array.h : Add the new boolean argument to the prototype
      	of gfc_deallocate_alloc_comp_no_caf with a default of false.
      	Add prototype for gfc_copy_alloc_comp_no_fini.
      	* trans-decl.cc(init_intent_out_dt): Tidy up the code.
      	* trans-expr.cc (gfc_init_se): Initialize finalblock.
      	(gfc_conv_procedure_call): Use gfc_finalize_tree_expr to
      	finalize function results. Replace in-line block for class
      	results with call to new function.
      	(gfc_conv_expr): Finalize structure constructors for F2003 and
      	F2008. Warn that this feature was deleted in F2018 and, unlike
      	array constructors, is not default. Add array constructor
      	finalblock to the post block.
      	(gfc_trans_scalar_assign): Suppress finalization by setting new
      	argument in call to gfc_deallocate_alloc_comp_no_caf. Add the
      	finalization blocks to the main block.
      	(gfc_trans_arrayfunc_assign): Use gfc_assignment_finalizer_call
      	and ensure that finalization occurs after the evaluation of the
      	rhs but using the initial value for the lhs. Finalize rhs
      	function results using gfc_finalize_tree_expr.
      	(trans_class_assignment, gfc_trans_assignment_1): As previous
      	function, taking care to order evaluation, assignment and
      	finalization correctly.
      	* trans-io.cc (gfc_trans_transfer): Add the final block.
      	* trans-stmt.cc (gfc_trans_call, gfc_trans_allocate): likewise.
      	(trans_associate_var): Nullify derived allocatable components
      	and finalize function targets with defined assignment
      	components on leaving the block scope.
      	(trans_allocate): Finalize source expressions, if required,
      	and set init_expr artificial temporarily to suppress the
      	finalization in gfc_trans_assignment.
      	* trans.cc (gfc_add_finalizer_call): Do not finalize the
      	temporaries generated in type assignment with defined
      	assignment components.
      	(gfc_assignment_finalizer_call): New function.
      	(gfc_finalize_tree_expr): New function.
      	* trans.h: Add finalblock to gfc_se. Add the prototypes for
      	gfc_finalize_tree_expr and gfc_assignment_finalizer_call.
      
      gcc/testsuite/
      	PR fortran/64290
      	* gfortran.dg/finalize_38.f90 : New test.
      	* gfortran.dg/finalize_38a.f90 : New test.
      	* gfortran.dg/allocate_with_source_25.f90 : The number of final
      	calls goes down from 6 to 4.
      	* gfortran.dg/associate_25.f90 : Remove the incorrect comment.
      	* gfortran.dg/auto_dealloc_2.f90 : Change the tree dump expr
      	but the final count remains the same.
      	* gfortran.dg/unlimited_polymorphic_8.f90 : Tree dump reveals
      	foo.1.x rather than foo.0.x
      
      	PR fortran/67444
      	* gfortran.dg/finalize_39.f90 : New test.
      
      	PR fortran/67471
      	* gfortran.dg/finalize_40.f90 : New test.
      
      	PR fortran/69298
      	PR fortran/70863
      	* gfortran.dg/finalize_41.f90 : New test.
      
      	PR fortran/71798
      	* gfortran.dg/finalize_42.f90 : New test.
      
      	PR fortran/80524
      	* gfortran.dg/finalize_43.f90 : New test.
      
      	PR fortran/82996
      	* gfortran.dg/finalize_44.f90 : New test.
      
      	PR fortran/84472
      	* gfortran.dg/finalize_45.f90 : New test.
      
      	PR fortran/88735
      	PR fortran/93691
      	* gfortran.dg/finalize_46.f90 : New test.
      
      	PR fortran/91316
      	* gfortran.dg/finalize_47.f90 : New test.
      
      	PR fortran/106576
      	* gfortran.dg/finalize_48.f90 : New test.
      
      	PR fortran/37336
      	* gfortran.dg/finalize_49.f90 : New test.
      	* gfortran.dg/finalize_50.f90 : New test.
      	* gfortran.dg/finalize_51.f90 : New test.
      d7caf313
    • GCC Administrator's avatar
      Daily bump. · 454a4d50
      GCC Administrator authored
      454a4d50
    • Peter Bergner's avatar
      lra: Ignore debug insns and notes in combine_reload_insn [PR109179] · 44a13125
      Peter Bergner authored
      We ICE in combine_reload_insn if we've deleted the TO insn operand during
      processing, because lra_get_insn_recog_data doesn't expect to see the note
      that replaces the deleted insn.  The solution here is to exit early if TO
      is a debug insn or note.
      
      2023-03-17  Peter Bergner  <bergner@linux.ibm.com>
      
      gcc/
      	PR rtl-optimization/109179
      	* lra-constraints.cc (combine_reload_insn): Enforce TO is not a debug
      	insn or note.  Move the tests earlier to guard lra_get_insn_recog_data.
      44a13125
  4. Mar 17, 2023
    • Hans-Peter Nilsson's avatar
      testsuite: Skip some gcc.dg/plugin tests for default_packed targets · ac81fea3
      Hans-Peter Nilsson authored
      Avoid unweildy structure-layout-specific message-matching
      expressions by exluding targets that lay out structures as
      if they had been specified with __attribute__ ((__packed__)),
      for tests where multiple messages depend on the structure
      layout.
      
      It's arguably a judgement call whether to skip some of these
      tests or add multiple lines of matches depending on the
      layout of structures.
      
      	* gcc.dg/plugin/infoleak-2.c,
      	gcc.dg/plugin/infoleak-CVE-2011-1078-1.c,
      	gcc.dg/plugin/infoleak-CVE-2011-1078-2.c,
      	gcc.dg/plugin/infoleak-CVE-2017-18549-1.c,
      	gcc.dg/plugin/infoleak-CVE-2017-18550-1.c,
      	gcc.dg/plugin/infoleak-antipatterns-1.c,
      	gcc.dg/plugin/infoleak-fixit-1.c: Skip for default_packed targets.
      ac81fea3
    • Jason Merrill's avatar
      c++: constant, array, lambda, template [PR108975] · 6f90de97
      Jason Merrill authored
      When a lambda refers to a constant local variable in the enclosing scope, we
      tentatively capture it, but if we end up pulling out its constant value, we
      go back at the end of the lambda and prune any unneeded captures.  Here
      while parsing the template we decided that the dim capture was unneeded,
      because we folded it away, but then we brought back the use in the template
      trees that try to preserve the source representation with added type info.
      So then when we tried to instantiate that use, we couldn't find what it was
      trying to use, and crashed.
      
      Fixed by not trying to prune when parsing a template; we'll prune at
      instantiation time.
      
      	PR c++/108975
      
      gcc/cp/ChangeLog:
      
      	* lambda.cc (prune_lambda_captures): Don't bother in a template.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/cpp0x/lambda/lambda-const11.C: New test.
      6f90de97
    • Jason Merrill's avatar
      c++: throw and private destructor [PR109172] · 89004331
      Jason Merrill authored
      Since we aren't going through the normal call machinery, we need to check
      the dtor access specifically.
      
      	PR c++/109172
      
      gcc/cp/ChangeLog:
      
      	* except.cc (build_throw): Check dtor access.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/eh/dtor4.C: New test.
      89004331
    • Jonathan Wakely's avatar
      libstdc++: Add const to hash<coroutine_handle<P>>::operator() [PR109165] · c48be829
      Jonathan Wakely authored
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/109165
      	* include/std/coroutine (hash<>::operator()): Add const.
      	* testsuite/18_support/coroutines/hash.cc: New test.
      c48be829
    • Jason Merrill's avatar
      c++: namespace-scoped friend in local class [PR69410] · ae7190e3
      Jason Merrill authored
      do_friend was only considering class-qualified identifiers for the
      qualified-id case, but we also need to skip local scope when there's an
      explicit namespace scope.
      
      	PR c++/69410
      
      gcc/cp/ChangeLog:
      
      	* friend.cc (do_friend): Handle namespace as scope argument.
      	* decl.cc (grokdeclarator): Pass down in_namespace.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/lookup/friend24.C: New test.
      ae7190e3
    • Jakub Jelinek's avatar
      tree-inline: Fix up multiversioning with vector arguments [PR105554] · 24c06560
      Jakub Jelinek authored
      The following testcase ICEs, because we call tree_function_versioning from
      old_decl which has target attributes not supporting V4DImode and so
      DECL_MODE of DECL_ARGUMENTS is BLKmode, while new_decl supports those.
      tree_function_versioning initially copies DECL_RESULT and DECL_ARGUMENTS
      from old_decl to new_decl, then calls initialize_cfun to create cfun
      and only when the cfun is created it can later actually remap_decl
      DECL_RESULT and DECL_ARGUMENTS etc.
      The problem is that initialize_cfun -> push_struct_function ->
      allocate_struct_function calls relayout_decl on DECL_RESULT and
      DECL_ARGUMENTS, which clobbers DECL_MODE of old_decl and we then ICE because
      of it.
      In particular, allocate_struct_function does:
            if (!abstract_p)
              {
                /* Now that we have activated any function-specific attributes
                   that might affect layout, particularly vector modes, relayout
                   each of the parameters and the result.  */
                relayout_decl (result);
                for (tree parm = DECL_ARGUMENTS (fndecl); parm;
                     parm = DECL_CHAIN (parm))
                  relayout_decl (parm);
      
                /* Similarly relayout the function decl.  */
                targetm.target_option.relayout_function (fndecl);
              }
      
            if (!abstract_p && aggregate_value_p (result, fndecl))
              {
       #ifdef PCC_STATIC_STRUCT_RETURN
                cfun->returns_pcc_struct = 1;
       #endif
                cfun->returns_struct = 1;
              }
      Now, in the case of tree_function_versioning, I believe all that we need
      from these is possibly the
      targetm.target_option.relayout_function (fndecl);
      call (arm only), we will remap DECL_RESULT and DECL_ARGUMENTS later on
      and copy_decl_for_dup_finish in that case will handle all we need:
        /* For vector typed decls make sure to update DECL_MODE according
           to the new function context.  */
        if (VECTOR_TYPE_P (TREE_TYPE (copy)))
          SET_DECL_MODE (copy, TYPE_MODE (TREE_TYPE (copy)));
      We don't need the cfun->returns_*struct either, because we override it
      in initialize_cfun a few lines later:
        /* Copy items we preserve during cloning.  */
      ...
        cfun->returns_struct = src_cfun->returns_struct;
        cfun->returns_pcc_struct = src_cfun->returns_pcc_struct;
      
      So, to avoid the clobbering of DECL_RESULT/DECL_ARGUMENTS of old_decl,
      the following patch arranges allocate_struct_function to be called with
      abstract_p true and calls targetm.target_option.relayout_function (fndecl);
      by hand.
      
      The removal of DECL_RESULT/DECL_ARGUMENTS copying at the start of
      initialize_cfun is removed because the only caller -
      tree_function_versioning, does that unconditionally before.
      
      2023-03-17  Jakub Jelinek  <jakub@redhat.com>
      
      	PR target/105554
      	* function.h (push_struct_function): Add ABSTRACT_P argument defaulted
      	to false.
      	* function.cc (push_struct_function): Add ABSTRACT_P argument, pass it
      	to allocate_struct_function instead of false.
      	* tree-inline.cc (initialize_cfun): Don't copy DECL_ARGUMENTS
      	nor DECL_RESULT here.  Pass true as ABSTRACT_P to
      	push_struct_function.  Call targetm.target_option.relayout_function
      	after it.
      	(tree_function_versioning): Formatting fix.
      
      	* gcc.target/i386/pr105554.c: New test.
      24c06560
    • Jakub Jelinek's avatar
      c, ubsan: Instrument even shortened divisions [PR109151] · 103d423f
      Jakub Jelinek authored
      On the following testcase, the C FE decides to shorten the division because
      it has a guarantee that INT_MIN / -1 division won't be encountered, the
      first operand is widened from narrower unsigned and/or the second operand is
      a constant other than all ones (in this case both are true).
      The problem is that the narrower type in this case is _Bool and
      ubsan_instrument_division only instruments it if op0's type is INTEGER_TYPE
      or REAL_TYPE.  Strangely this doesn't happen in C++ FE.
      Anyway, we only shorten divisions if the INT_MIN / -1 case is impossible,
      so I think we should be fine even with -fstrict-enums in C++ in case it
      shortened to ENUMERAL_TYPEs.
      
      The following patch just instruments those on the ubsan_instrument_division
      side.  Perhaps only the first hunk and testcase might be needed because
      we shouldn't shorten if the other case could be triggered.
      
      2023-03-17  Jakub Jelinek  <jakub@redhat.com>
      
      	PR c/109151
      	* c-ubsan.cc (ubsan_instrument_division): Handle all scalar integral
      	types rather than just INTEGER_TYPE.
      
      	* c-c++-common/ubsan/div-by-zero-8.c: New test.
      103d423f
    • Gaius Mulley's avatar
      PR modula2/109032 - message 'compiler checks to force' is too complicated · 6bfb5eae
      Gaius Mulley authored
      
      Correct typos and improve the descriptions of command line options.
      Improve comments in gm2-gcc/m2expr.cc.
      
      gcc/m2/ChangeLog:
      
      	PR modula2/109032
      	* gm2-gcc/m2expr.cc: Correct ? : order in comments.
      	(m2expr_BuildDivM2): Improve comment.
      	* lang.opt: Improve option descriptions.
      
      Signed-off-by: default avatarGaius Mulley <gaiusmod2@gmail.com>
      6bfb5eae
    • Vladimir N. Makarov's avatar
      LRA: Implement combining secondary memory reload and original insn · 57688950
      Vladimir N. Makarov authored
      LRA creates secondary memory reload insns but do not try to combine it
      with the original insn.  This patch implements a simple insn combining
      for such cases in LRA.
      
              PR rtl-optimization/109052
      
      gcc/ChangeLog:
      
      	* lra-constraints.cc: Include hooks.h.
      	(combine_reload_insn): New function.
      	(lra_constraints): Call it.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/i386/pr109052.c: New.
      57688950
    • Gaius Mulley's avatar
      PR modula2/109102 Wrong quotes in diagnostic · daf20b4b
      Gaius Mulley authored
      
      The backtick and single quote should be replaced with %< and %> or
      %qs.
      
      gcc/m2/ChangeLog:
      
      	PR modula2/109102
      	* gm2-gcc/m2builtins.cc (ASSERT): Change format specifier to
      	use %qs rather than quotes.
      
      Signed-off-by: default avatarGaius Mulley <gaiusmod2@gmail.com>
      daf20b4b
    • Ju-Zhe Zhong's avatar
      RISC-V: Handle undef for vector mask patterns · c413abed
      Ju-Zhe Zhong authored
      
      Add new instruction pattern for setting vector mask to undefine value,
      also merge undef and non-undef ternary operation pattern like MAC operations to
      single pattern.
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-v.cc (legitimize_move): Allow undef value
      	as legitimate value.
      	* config/riscv/riscv-vector-builtins.cc
      	(function_expander::use_ternop_insn): Fix bugs of ternary intrinsic.
      	(function_expander::use_widen_ternop_insn): Ditto.
      	* config/riscv/vector.md (@vundefined<mode>): New pattern.
      	(pred_mul_<optab><mode>_undef_merge): Remove.
      	(*pred_mul_<optab><mode>_undef_merge_scalar): Ditto.
      	(*pred_mul_<optab><mode>_undef_merge_extended_scalar): Ditto.
      	(pred_neg_mul_<optab><mode>_undef_merge): Ditto.
      	(*pred_neg_mul_<optab><mode>_undef_merge_scalar): Ditto.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/base/binop_vv_constraint-4.c: Adapt the test.
      	* gcc.target/riscv/rvv/base/binop_vv_constraint-6.c: Ditto.
      	* gcc.target/riscv/rvv/base/binop_vx_constraint-127.c: Ditto.
      	* g++.target/riscv/rvv/base/bug-1.C: New test.
      	* gcc.target/riscv/rvv/base/bug-2.c: New test.
      
      Signed-off-by: default avatarJu-Zhe Zhong <juzhe.zhong@rivai.ai>
      Co-authored-by: default avatarkito-cheng <kito.cheng@sifive.com>
      c413abed
    • Ju-Zhe Zhong's avatar
      RISC-V: Use reg_or_subregno to check regno [PR109092] · 02880e78
      Ju-Zhe Zhong authored
      gcc/ChangeLog:
      
      	PR target/109092
      	* config/riscv/riscv.md: Fix subreg bug.
      02880e78
    • Jakub Jelinek's avatar
      testsuite: Fix up forwprop-39.c testcase [PR109145] · 2bb71424
      Jakub Jelinek authored
      As written in the PR, newlib headers aren't C11 compliant in that they
      don't define CMPLXF macro, and glibc before 2.16 doesn't define that
      either.  I think it is easier to use __builtin_complex directly, over
      another patch which keeps including complex.h but defines CMPLXF if it
      isn't defined, we want to test how forwprop behaves rather than what
      complex.h defines or doesn't define.
      
      2023-03-17  Jakub Jelinek  <jakub@redhat.com>
      
      	PR testsuite/109145
      	* gcc.dg/tree-ssa/forwprop-39.c: Remove -std=c11 from dg-options.
      	Don't include complex.h.
      	(foo): Use __builtin_complex rather than CMPLXF.
      2bb71424
    • Jakub Jelinek's avatar
      openmp: Fix up handling of doacross loops with noreturn body in loops [PR108685] · 713fa5db
      Jakub Jelinek authored
      The following patch fixes an ICE with doacross loops which have a single entry
      no exit body, at least one of the ordered > collapse loops isn't guaranteed to
      have at least one iteration and the whole doacross loop is inside some other loop.
      The OpenMP constructs aren't represented by struct loop until the omp expansions,
      so for a normal doacross loop which doesn't have a noreturn body the entry_bb
      with the GOMP_FOR statement and the first bb of the body typically have the
      same loop_father, and if the doacross loop isn't inside of some other loop
      and the body is noreturn as well, both are part of loop 0.  The problematic
      case is when the entry_bb is inside of some deeper loop, but the body, because
      it falls through into EXIT, has loop 0 as loop_father.  l0_bb is created by
      splitting the entry_bb fallthru edge into l1_bb, and because the two basic blocks
      have different loop_father, a common loop is found for those (which is loop 0).
      Now, if the doacross loop has collapse == ordered or all the ordered > collapse
      loops are guaranteed to iterate at least once, all is still fine, because all
      enter the l1_bb (body), which doesn't return and so doesn't loop further either.
      But, if one of those loops could loop 0 times, the user written body wouldn't be
      reached at all, so unlike the expectations the whole construct actually wouldn't
      be noreturn if entry_bb is encountered and decides to handle at least one
      iteration.
      
      In this case, we need to fix up, move the l0_bb into the same loop as entry_bb
      (initially) and for the extra added loops put them as children of that same
      loop, rather than of loop 0.
      
      2023-03-17  Jakub Jelinek  <jakub@redhat.com>
      
      	PR middle-end/108685
      	* omp-expand.cc (expand_omp_for_ordered_loops): Add L0_BB argument,
      	use its loop_father rather than BODY_BB's loop_father.
      	(expand_omp_for_generic): Adjust expand_omp_for_ordered_loops caller.
      	If broken_loop with ordered > collapse and at least one of those
      	extra loops aren't guaranteed to have at least one iteration, change
      	l0_bb's loop_father to entry_bb's loop_father.  Set cont_bb's
      	loop_father to l0_bb's loop_father rather than l1_bb's.
      
      	* c-c++-common/gomp/doacross-8.c: New test.
      713fa5db
    • Jakub Jelinek's avatar
      gdbhooks: Update gdbhooks.py for recent tree_code_type changes [PR108634] · be6195c7
      Jakub Jelinek authored
      On Mon, Mar 13, 2023 at 04:15:12PM -0400, Jason Merrill wrote:
      > The r13-6577 change to use tree_code_type_tmpl in earlier C++ dialects broke
      > gdbhooks, which expects tree_code_type to always be available.  I considered
      > trying to make gdbhooks more robust, but it seemed simpler to define
      > tree_code_type as a reference to the template.
      
      As I said earlier, I think it is better to tweak gdbhooks.
      
      The following patch does that, I've tested it now both with gcc 12 and
      older gcc as system compiler and the patch fixed the latter while keeping
      the former working as before.
      
      2023-03-17  Jakub Jelinek  <jakub@redhat.com>
      
      	PR plugins/108634
      	* gdbhooks.py (TreePrinter.to_string): Wrap
      	gdb.parse_and_eval('tree_code_type') in a try block, parse
      	and eval 'tree_code_type_tmpl<0>::tree_code_type' instead if it
      	raises exception.  Update comments for the recent tree_code_type
      	changes.
      be6195c7
    • Iain Buclaw's avatar
      d: Merge upstream dmd, druntime 5f7552bb28, phobos 67a47cf39. · 328477f6
      Iain Buclaw authored
      D front-end changes:
      
      	- Import dmd v2.103.0-rc.1.
      
      D runtime changes:
      
      	- Import druntime v2.103.0-rc.1.
      
      Phobos changes:
      
      	- Import phobos v2.103.0-rc.1.
      
      gcc/d/ChangeLog:
      
      	* dmd/MERGE: Merge upstream dmd 5f7552bb28.
      	* dmd/VERSION: Bump version to v2.103.0-rc.1.
      
      libphobos/ChangeLog:
      
      	* libdruntime/MERGE: Merge upstream druntime 5f7552bb28.
      	* src/MERGE: Merge upstream phobos 67a47cf39.
      328477f6
    • Sandra Loosemore's avatar
      Docs: Fix formatting issues in BPF built-ins documentation. · 7ffbc74c
      Sandra Loosemore authored
      gcc/ChangeLog:
      	* doc/extend.texi (BPF Built-in Functions): Fix numerous markup
      	issues.  Add more line breaks to example so it doesn't overflow
      	the margins.
      7ffbc74c
    • Sandra Loosemore's avatar
      Docs: Fix some too-long lines in Texinfo manual. · 4ace81b6
      Sandra Loosemore authored
      gcc/ChangeLog:
      	* doc/extend.texi (Common Function Attributes) <access>: Fix bad
      	line breaks in examples.
      	<malloc>: Fix bad line breaks in running text, also copy-edit
      	for consistency.
      	(Extended Asm) <Generic Operand Modifiers>: Fix @multitable width.
      	* doc/invoke.texi (Option Summary) <Developer Options>: Fix misplaced
      	@gol.
      	(C++ Dialect Options) <-fcontracts>: Add line break in example.
      	<-Wctad-maybe-unsupported>: Likewise.
      	<-Winvalid-constexpr>: Likewise.
      	(Warning Options) <-Wdangling-pointer>: Likewise.
      	<-Winterference-size>: Likewise.
      	<-Wvla-parameter>: Likewise.
      	(Static Analyzer Options): Fix bad line breaks in running text,
      	plus add some missing markup.
      	(Optimize Options) <openacc-privatization>: Fix more bad line
      	breaks in running text.
      4ace81b6
Loading