Skip to content
Snippets Groups Projects
  1. Jan 31, 2025
    • Patrick Palka's avatar
      libstdc++: Fix return value of vector::insert_range · ee797739
      Patrick Palka authored
      
      In some cases we're wrongly returning an iterator to (one past) the last
      element inserted instead of to the first element inserted.
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/stl_bvector.h (vector<bool>::insert_range):
      	Consistently return an iterator pointing to the first element
      	inserted.
      	* include/bits/vector.tcc (vector::insert_range): Likewise.
      	* testsuite/23_containers/vector/bool/modifiers/insert/insert_range.cc:
      	Verify insert_range return values.
      	* testsuite/23_containers/vector/modifiers/insert/insert_range.cc:
      	Likewise.
      
      Reviewed-by: default avatarJonathan Wakely <jwakely@redhat.com>
      ee797739
    • Harald Anlauf's avatar
      Fortran: host association issue with symbol in COMMON block [PR108454] · d6418fe2
      Harald Anlauf authored
      When resolving a flavorless symbol that is already registered with a COMMON
      block, and which neither has the intrinsic, generic, or external attribute,
      skip searching among interfaces to avoid false resolution to a derived type
      of the same name.
      
      	PR fortran/108454
      
      gcc/fortran/ChangeLog:
      
      	* resolve.cc (resolve_common_blocks): Initialize variable.
      	(resolve_symbol): If a symbol is already registered with a COMMON
      	block, do not search for an interface with the same name.
      
      gcc/testsuite/ChangeLog:
      
      	* gfortran.dg/common_29.f90: New test.
      d6418fe2
    • Paul-Antoine Arras's avatar
      OpenMP/Fortran: Add missing pop_state in parse_omp_dispatch [PR118714] · af51fe95
      Paul-Antoine Arras authored
      When the ST_NONE case is taken, the function returns immediately. Not calling
      pop_state causes a dangling pointer.
      
      	PR fortran/118714
      
      gcc/fortran/ChangeLog:
      
      	* parse.cc (parse_omp_dispatch): Add missing pop_state.
      af51fe95
    • Marek Polacek's avatar
      c++: wrong-code with consteval constructor [PR117501] · 0d977004
      Marek Polacek authored
      
      We've had a wrong-code problem since r14-4140, due to which we
      forget to initialize a variable.
      
      In consteval39.C, we evaluate
      
          struct QQQ q;
        <<cleanup_point <<< Unknown tree: expr_stmt
          QQQ::QQQ (&q, TARGET_EXPR <D.2687, <<< Unknown tree: aggr_init_expr
            5
            __ct_comp
            D.2687
            (struct basic_string_view *) <<< Unknown tree: void_cst >>>
            (const char *) "" >>>>) >>>>>;
      
      into
      
          struct QQQ q;
        <<cleanup_point <<< Unknown tree: expr_stmt
          {.data={._M_len=42, ._M_str=0}} >>>>>;
      
      and then the useless expr_stmt is dropped on the floor, so q isn't
      initialized.  As pre-r14-4140, we need to handle constructors specially.
      
      With this patch, we generate:
      
          struct QQQ q;
        <<cleanup_point <<< Unknown tree: expr_stmt
          q = {.data={._M_len=42, ._M_str=0}} >>>>>;
      
      initializing q properly.
      
      	PR c++/117501
      
      gcc/cp/ChangeLog:
      
      	* cp-gimplify.cc (cp_build_init_expr_for_ctor): New.
      	(cp_fold_immediate_r): Call it.
      	(cp_fold): Break out code into cp_build_init_expr_for_ctor.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/cpp2a/consteval39.C: New test.
      	* g++.dg/cpp2a/consteval40.C: New test.
      
      Reviewed-by: default avatarJason Merrill <jason@redhat.com>
      0d977004
    • Vladimir N. Makarov's avatar
      [PR116234][LRA]: Check debug insn when looking at one insn pseudo occurrence · decc6c0d
      Vladimir N. Makarov authored
        LRA can change reg class to NO_REGS when pseudo referred in one
      insn.  Checking the references did not take into account that referring
      insn can be a debug insn.  This resulted in different code generation
      with and without debug info generation.  The patch fixes this pitfall.
      
      gcc/ChangeLog:
      
      	PR rtl-optimization/116234
      	* lra-constraints.cc (multiple_insn_refs_p): New function.
      	(curr_insn_transform): Use it.
      
      gcc/testsuite/ChangeLog:
      
      	PR rtl-optimization/116234
      	* gfortran.target/aarch64/aarch64.exp: New.
      	* gfortran.target/aarch64/pr116234.f: New.
      decc6c0d
    • Eric Botcazou's avatar
      Fix wrong elaboration for allocator at library level of dynamic library · 3b497270
      Eric Botcazou authored
      The problem was preexisting for class-wide allocators, but now occurs for
      allocators of controlled types too, because of the recent overhaul of the
      finalization machinery.
      
      gcc/ada/
      	* gcc-interface/utils.cc (gnat_pushdecl): Clear TREE_PUBLIC on
      	functions really nested in another function.
      3b497270
    • Jakub Jelinek's avatar
      testsuite: Add testcase for already fixed PR [PR117498] · 9fc06830
      Jakub Jelinek authored
      This wrong-code issue has been fixed with r15-7249.
      We still emit warnings which are questionable and perhaps we'd
      get better generated code if niters determined the loop has only a single
      iteration without UB and we'd punt on vectorizing it (or unrolling).
      
      2025-01-31  Jakub Jelinek  <jakub@redhat.com>
      
      	PR middle-end/117498
      	* gcc.c-torture/execute/pr117498.c: New test.
      9fc06830
    • H.J. Lu's avatar
      force-indirect-call-2.c: Allow indirect branch via GOT · 5f345581
      H.J. Lu authored
      
      r15-1619-g3b9b8d6cfdf593 changed the codegen from
      
      f2:
      	.cfi_startproc
      	pushq	%rbx
      	.cfi_def_cfa_offset 16
      	.cfi_offset 3, -16
      	movq	f1@GOTPCREL(%rip), %rbx
      	call	*%rbx
      	leaq	f3(%rip), %rax
      	call	*%rax
      	movq	%rbx, %rax
      	popq	%rbx
      	.cfi_def_cfa_offset 8
      	jmp	*%rax
      	.cfi_endproc
      
      to
      
      f2:
      	.cfi_startproc
      	subq	$8, %rsp
      	.cfi_def_cfa_offset 16
      	call	*f1@GOTPCREL(%rip)
      	leaq	f3(%rip), %rax
      	call	*%rax
      	addq	$8, %rsp
      	.cfi_def_cfa_offset 8
      	jmp	*f1@GOTPCREL(%rip)
      	.cfi_endproc
      
      Since it is OK to indirect call via memory for -mforce-indirect-call,
      allow indirect branch via GOT.
      
      	PR target/115673
      	* gcc.target/i386/force-indirect-call-2.c: Allow indirect branch
      	via GOT.
      
      Signed-off-by: default avatarH.J. Lu <hjl.tools@gmail.com>
      5f345581
    • Richard Biener's avatar
      debug/100530 - Revert QUAL_ADDR_SPACE handling from dwarf2out.cc · 319f1d04
      Richard Biener authored
      The bug clearly shows that r8-4385-ga297ccb52e0c89 was wrong in
      enabling handling of address-space qualification as DWARF type
      qualifiers as the code isn't prepared to it actually be not handled
      and ends up changing a lesser qualified (without address-space)
      type DIE in ways tripping asserts.  The following reverts that
      part which then causes the DIE for the same type with address-space
      qualifiers removed to be re-used since there's currently no code
      to encode address-spaces within dwarf2out.cc or in the DWARF spec.
      
      r8-4385-ga297ccb52e0c89 did not come with a testcase nor a good
      description of the bug fixed - I've verified const qualification
      mixed with address-spaces creates the expected DWARF.
      
      	PR debug/100530
      	* dwarf2out.cc (modified_type_die): Do not claim we handle
      	address-space qualification with dwarf_qual_info[].
      
      	* gcc.target/i386/pr100530.c: New testcase.
      319f1d04
    • Jakub Jelinek's avatar
      niter: Make build_cltz_expr more robust [PR118689] · 85e1714b
      Jakub Jelinek authored
      Since my r15-7223 the niter analysis can recognize one loop during bootstrap
      as being ctz like.
      The patch just turned
      @@ -2173,7 +2173,7 @@ PROC m2pim_NumberIO_BinToStr (CARDINAL x
         _T535_44 = &buf[i.40_2]{lb: 1 sz: 4};
         _T536_45 = x_21 & 1;
         *_T535_44 = _T536_45;
      -  _T537_47 = x_21 / 2;
      +  _T537_47 = x_21 >> 1;
         x_48 = _T537_47;
         # DEBUG x => x_48
         if (x_48 != 0)
      which is not a big deal for the number_of_iterations_cltz optimization, it
      recognizes both right shift by 1 and unsigned division by 2 (and similarly
      for clz left shift by 1 or multiplication by 2).
      But starting with forwprop1 that change also resulted in
      @@ -1875,9 +1875,9 @@ PROC m2pim_NumberIO_BinToStr (CARDINAL x
         i.40_2 = (INTEGER) _T530_34;
         _T536_45 = x_21 & 1;
         MEM <CARDINAL[1:64]> [(CARDINAL *)&buf][i.40_2]{lb: 1 sz: 4} = _T536_45;
      -  _T537_47 = x_21 / 2;
      +  _T537_47 = x_21 >> 1;
         # DEBUG x => _T537_47
      -  if (x_21 > 1)
      +  if (_T537_47 != 0)
           goto <bb 3>; [INV]
         else
           goto <bb 8>; [INV]
      and apparently it is only the latter form that number_of_iterations_cltz
      pattern matches, not the former (after all, that was the exact reason
      for r15-7223).
      The problem is that build_cltz_expr assumes if IFN_C[LT]Z can't be used it
      can use the __builtin_c[lt]z{,l,ll} builtins, and while most of the FEs do
      create them, modula 2 does not.
      
      The following patch just lets us punt if the FE doesn't build those builtins.
      I've filed a PR against modula2 so that they add the builtins too.
      
      2025-01-31  Jakub Jelinek  <jakub@redhat.com>
      
      	PR tree-optimization/118689
      	PR modula2/115032
      	* tree-ssa-loop-niter.cc (build_cltz_expr): Return NULL_TREE if fn is
      	NULL and use_ifn is false.
      85e1714b
    • Richard Biener's avatar
      Do not rely on non-SLP analysis for SLP outer loop vectorization · 9e3ceed8
      Richard Biener authored
      We end up relying on non-SLP analysis of the inner loop LC PHI to
      set the vectorizationb method for SLP since vectorizable_reduction
      claims responsibility.  The following fixes this.
      
      	* tree-vect-loop.cc (vect_analyze_loop_operations): Only
      	call vectorizable_lc_phi when not PURE_SLP.
      	(vectorizable_reduction): Do not claim having handled
      	the inner loop LC PHI for outer loop vectorization.
      9e3ceed8
    • GCC Administrator's avatar
      Daily bump. · c8cc6863
      GCC Administrator authored
      c8cc6863
  2. Jan 30, 2025
    • Ian Lance Taylor's avatar
      libbacktrace: add casts to avoid undefined shifts · 5d43c3f0
      Ian Lance Taylor authored
      Patch from pgerell@github.
      
      	* elf.c (elf_fetch_bits): Add casts to avoid potentially shifting
      	a value farther than its type size.
      	(elf_fetch_bits_backward): Likewise.
      	(elf_uncompress_lzma_block): Likewise.
      	(elf_uncompress_lzma): Likewise.
      5d43c3f0
    • Alexandre Oliva's avatar
      [testsuite] require profiling support [PR113689] · dd5978b2
      Alexandre Oliva authored
      pr113689 testcases use -fprofile without testing for profiling
      support.  Fix them.
      
      
      for  gcc/testsuite/ChangeLog
      
      	PR target/113689
      	* gcc.target/i386/pr113689-1.c: Require profiling support.
      	* gcc.target/i386/pr113689-2.c: Likewise.
      	* gcc.target/i386/pr113689-3.c: Likewise.
      dd5978b2
    • Alexandre Oliva's avatar
      [testsuite] require -Ofast for vect-ifcvt-18 even without avx · 2ca288d3
      Alexandre Oliva authored
      The test expects transformations that depend on -Ofast on x86*, but
      that option is only passed when the avx_runtime is available.
      
      Split -Ofast out of the avx conditional, so that it is passed on the
      same targets that expect the transformation.
      
      
      for  gcc/testsuite/ChangeLog
      
      	* gcc.dg/vect/vect-ifcvt-18.c: Split -Ofast out of
      	avx_runtime.
      2ca288d3
    • Georg-Johann Lay's avatar
      AVR: Provide built-ins for strlen where the string lives in some AS. · 1e819a99
      Georg-Johann Lay authored
      This patch adds built-in functions __builtin_avr_strlen_flash,
      __builtin_avr_strlen_flashx and __builtin_avr_strlen_memx.
      Purpose is that higher-level functions can use __builtin_constant_p
      on strlen without raising a diagnostic due to -Waddr-space-convert.
      
      gcc/
      	* config/avr/builtins.def (STRLEN_FLASH, STRLEN_FLASHX)
      	(STRLEN_MEMX): New DEF_BUILTIN's.
      	* config/avr/avr.cc (avr_ftype_strlen): New static function.
      	(avr_builtin_supported_p): New built-ins are not for AVR_TINY.
      	(avr_init_builtins) <strlen_flash_node, strlen_flashx_node,
      	strlen_memx_node>: Provide new fntypes.
      	(avr_fold_builtin) [AVR_BUILTIN_STRLEN_FLASH]
      	[AVR_BUILTIN_STRLEN_FLASHX, AVR_BUILTIN_STRLEN_MEMX]: Fold if
      	possible.
      	* doc/extend.texi (AVR Built-in Functions): Document
      	__builtin_avr_strlen_flash, __builtin_avr_strlen_flashx,
      	__builtin_avr_strlen_memx.
      libgcc/
      	* config/avr/t-avr (LIB1ASMFUNCS): Add _strlen_memx.
      	* config/avr/lib1funcs.S <L_strlen_memx, __strlen_memx>: Implement.
      1e819a99
    • Georg-Johann Lay's avatar
      AVR: Only provide a built-in when it is available. · cde452e2
      Georg-Johann Lay authored
      Some built-ins are not available for C++ since they are using
      named address-spaces or fixed-point types.
      
      gcc/
      	* config/avr/builtins.def (AVR_FIRST_C_ONLY_BUILTIN_ID): New macro.
      	* config/avr/avr-protos.h (avr_builtin_supported_p): New.
      	* config/avr/avr.cc (avr_builtin_supported_p): New function.
      	(avr_init_builtins): Only provide a built-in when it is supported.
      	* config/avr/avr-c.cc (avr_cpu_cpp_builtins): Only define the
      	__BUILTIN_AVR_<NAME> build-in defines when the associated built-in
      	function is supported.
      	* doc/extend.texi (AVR Built-in Functions): Add a note that
      	following built-ins are supported for only for GNU-C.
      cde452e2
    • Sandra Loosemore's avatar
      OpenMP: Update documentation of metadirective implementation status. · 4e6fd85b
      Sandra Loosemore authored
      libgomp/ChangeLog
      	* libgomp.texi (OpenMP 5.0): Mark metadirective and declare variant
      	as implemented.
      	(OpenMP 5.1): Mark target_device as supported.
      	Add changed interaction between declare target and OpenMP context
      	and dynamic selector support.
      	(OpenMP 5.2): Mark otherwise clause as supported, note that
      	default is also still accepted.
      4e6fd85b
    • Sandra Loosemore's avatar
      OpenMP: Fortran support for metadirectives and dynamic selectors · 8fbccdb3
      Sandra Loosemore authored
      
      gcc/fortran/ChangeLog
      	PR middle-end/112779
      	PR middle-end/113904
      	* decl.cc (gfc_match_end): Handle COMP_OMP_BEGIN_METADIRECTIVE and
      	COMP_OMP_METADIRECTIVE.
      	* dump-parse-tree.cc (show_omp_node): Handle EXEC_OMP_METADIRECTIVE.
      	(show_code_node): Likewise.
      	* gfortran.h (enum gfc_statement): Add ST_OMP_METADIRECTIVE,
      	ST_OMP_BEGIN_METADIRECTIVE, and ST_OMP_END_METADIRECTIVE.
      	(struct gfc_omp_clauses): Rename target_first_st_is_teams to
      	target_first_st_is_teams_or_meta.
      	(struct gfc_omp_variant): New.
      	(gfc_get_omp_variant): New.
      	(struct gfc_st_label): Add omp_region field.
      	(enum gfc_exec_op): Add EXEC_OMP_METADIRECTIVE.
      	(struct gfc_code): Add omp_variants fields.
      	(gfc_free_omp_variants): Declare.
      	(match_omp_directive): Declare.
      	(is_omp_declarative_stmt): Declare.
      	* io.cc (format_asterisk): Adjust initializer.
      	* match.h (gfc_match_omp_begin_metadirective): Declare.
      	(gfc_match_omp_metadirective): Declare.
      	* openmp.cc (gfc_omp_directives): Uncomment metadirective.
      	(gfc_match_omp_eos): Adjust to match context selectors.
      	(gfc_free_omp_variants): New.
      	(gfc_match_omp_clauses): Remove context_selector parameter and adjust
      	to use gfc_match_omp_eos instead.
      	(match_omp): Adjust call to gfc_match_omp_clauses.
      	(gfc_match_omp_context_selector): Add metadirective_p parameter and
      	adjust error-checking.  Adjust matching of simd clauses.
      	(gfc_match_omp_context_selector_specification): Adjust parameters
      	so it can be used for metadirective as well as declare variant.
      	(match_omp_metadirective): New.
      	(gfc_match_omp_begin_metadirective): New.
      	(gfc_match_omp_metadirective): New.
      	(resolve_omp_metadirective): New.
      	(resolve_omp_target): Handle metadirectives.
      	(gfc_resolve_omp_directive): Handle EXEC_OMP_METADIRECTIVE.
      	* parse.cc (gfc_matching_omp_context_selector): New.
      	(gfc_in_omp_metadirective_body): New.
      	(gfc_omp_region_count): New.
      	(decode_omp_directive): Handle ST_OMP_BEGIN_METADIRECTIVE and
      	ST_OMP_METADIRECTIVE.
      	(match_omp_directive): New.
      	(case_omp_structured_block): Define.
      	(case_omp_do): Define.
      	(gfc_ascii_statement): Handle ST_OMP_BEGIN_METADIRECTIVE,
      	ST_OMP_END_METADIRECTIVE, and ST_OMP_METADIRECTIVE.
      	(accept_statement):  Handle ST_OMP_METADIRECTIVE and
      	ST_OMP_BEGIN_METADIRECTIVE.
      	(gfc_omp_end_stmt): New, split from...
      	(parse_omp_do): ...here, and...
      	(parse_omp_structured_block): ...here.  Handle metadirectives,
      	plus "allocate", "atomic", and "dispatch" which were missing.
      	(parse_omp_oacc_atomic): Handle "end metadirective".
      	(parse_openmp_allocate_block): Likewise.
      	(parse_omp_dispatch): Likewise.
      	(parse_omp_metadirective_body): New.
      	(parse_executable): Handle metadirective.  Use new case macros
      	defined above.
      	(gfc_parse_file): Initialize metadirective state.
      	(is_omp_declarative_stmt): New.
      	* parse.h (enum gfc_compile_state): Add COMP_OMP_METADIRECTIVE
      	and COMP_OMP_BEGIN_METADIRECTIVE.
      	(gfc_omp_end_stmt): Declare.
      	(gfc_matching_omp_context_selector): Declare.
      	(gfc_in_omp_metadirective_body): Declare.
      	(gfc_omp_metadirective_region_count): Declare.
      	* resolve.cc (gfc_resolve_code): Handle EXEC_OMP_METADIRECTIVE.
      	* st.cc (gfc_free_statement): Likewise.
      	* symbol.cc (compare_st_labels): Handle labels within a metadirective
      	body.
      	(gfc_get_st_label): Likewise.
      	* trans-decl.cc (gfc_get_label_decl): Encode the metadirective region
      	in the label_name.
      	* trans-openmp.cc (gfc_trans_omp_directive): Handle
      	EXEC_OMP_METADIRECTIVE.
      	(gfc_trans_omp_set_selector): New, split/adapted from code....
      	(gfc_trans_omp_declare_variant): ...here.
      	(gfc_trans_omp_metadirective): New.
      	* trans-stmt.h 	(gfc_trans_omp_metadirective): Declare.
      	* trans.cc (trans_code): Handle EXEC_OMP_METADIRECTIVE.
      
      gcc/testsuite/ChangeLog
      	PR middle-end/112779
      	PR middle-end/113904
      	* gfortran.dg/gomp/metadirective-1.f90: New.
      	* gfortran.dg/gomp/metadirective-10.f90: New.
      	* gfortran.dg/gomp/metadirective-11.f90: New.
      	* gfortran.dg/gomp/metadirective-12.f90: New.
      	* gfortran.dg/gomp/metadirective-13.f90: New.
      	* gfortran.dg/gomp/metadirective-2.f90: New.
      	* gfortran.dg/gomp/metadirective-3.f90: New.
      	* gfortran.dg/gomp/metadirective-4.f90: New.
      	* gfortran.dg/gomp/metadirective-5.f90: New.
      	* gfortran.dg/gomp/metadirective-6.f90: New.
      	* gfortran.dg/gomp/metadirective-7.f90: New.
      	* gfortran.dg/gomp/metadirective-8.f90: New.
      	* gfortran.dg/gomp/metadirective-9.f90: New.
      	* gfortran.dg/gomp/metadirective-construct.f90: New.
      	* gfortran.dg/gomp/metadirective-no-score.f90: New.
      	* gfortran.dg/gomp/pure-1.f90 (func_metadirective): New.
      	(func_metadirective_2): New.
      	(func_metadirective_3): New.
      	* gfortran.dg/gomp/pure-2.f90 (func_metadirective): Delete.
      
      libgomp/ChangeLog
      	PR middle-end/112779
      	PR middle-end/113904
      	* testsuite/libgomp.fortran/metadirective-1.f90: New.
      	* testsuite/libgomp.fortran/metadirective-2.f90: New.
      	* testsuite/libgomp.fortran/metadirective-3.f90: New.
      	* testsuite/libgomp.fortran/metadirective-4.f90: New.
      	* testsuite/libgomp.fortran/metadirective-5.f90: New.
      	* testsuite/libgomp.fortran/metadirective-6.f90: New.
      
      Co-Authored-By: default avatarKwok Cheung Yeung <kcy@codesourcery.com>
      Co-Authored-By: default avatarSandra Loosemore <sandra@codesourcery.com>
      Co-Authored-By: default avatarTobias Burnus <tobias@codesourcery.com>
      Co-Authored-By: default avatarPaul-Antoine Arras <pa@codesourcery.com>
      8fbccdb3
    • Jakub Jelinek's avatar
      s390: Fix up *vec_cmpgt{,u}<mode><mode>_nocc_emu splitters [PR118696] · 6a6df260
      Jakub Jelinek authored
      The following testcase is miscompiled on s390x-linux with e.g. -march=z13
      (both -O0 and -O2) starting with r15-7053.
      The problem is in the splitters which emulate TImode/V1TImode GT and GTU
      comparisons.
      For GT we want to do
      (ior (gt (hi op1) (hi op2))
           (and (eq (hi op1) (hi op2)) (gtu (lo op1) (lo op2))))
      and for GTU similarly except for gtu instead of gt in there.
      Now, the splitter emulation is using V2DImode comparisons where on s390x
      the hi part is in the first element of the vector, lo part in the second,
      and for the gtu case it swaps the elements of the vector.
      So, we get the right result in the first element of the result vector.
      But vrepg was then broadcasting the second element of the result vector
      rather than the first, and the value of the second element of the vector
      is instead
      (ior (gt (lo op1) (lo op2))
           (and (eq (lo op1) (lo op2)) (gtu (hi op1) (hi op2))))
      so something not really usable for the emulated comparison.
      
      The following patch fixes that.  The testcase tries to test behavior of
      double-word smin/smax/umin/umax with various cases of the halves of both
      operands (one that is sometimes EQ, sometimes GT, sometimes LT, sometimes
      GTU, sometimes LTU).
      
      2025-01-30  Jakub Jelinek  <jakub@redhat.com>
      	    Stefan Schulze Frielinghaus  <stefansf@gcc.gnu.org>
      
      	PR target/118696
      	* config/s390/vector.md (*vec_cmpgt<mode><mode>_nocc_emu,
      	*vec_cmpgtu<mode><mode>_nocc_emu): Duplicate the first rather than
      	second V2DImode element.
      
      	* gcc.dg/pr118696.c: New test.
      	* gcc.target/s390/vector/pr118696.c: New test.
      	* gcc.target/s390/vector/vec-abs-emu.c: Expect vrepg with 0 as last
      	operand rather than 1.
      	* gcc.target/s390/vector/vec-max-emu.c: Likewise.
      	* gcc.target/s390/vector/vec-min-emu.c: Likewise.
      6a6df260
    • Patrick Palka's avatar
      c++: remove LAMBDA_EXPR_CAPTURES_THIS_P · ba6cac82
      Patrick Palka authored
      
      This unused accessor is just a simple alias of LAMBDA_EXPR_THIS_CAPTURE
      and contrary to its documentation doesn't use TREE_LANG_FLAG_0.  Might
      as well remove it.
      
      gcc/cp/ChangeLog:
      
      	* cp-tree.h (LAMBDA_EXPR_CAPTURES_THIS_P): Remove.
      
      Reviewed-by: default avatarJason Merrill <jason@redhat.com>
      ba6cac82
    • Iain Sandoe's avatar
      c++: Update const_decl handling after r15-7259 [PR118673]. · c5667a1e
      Iain Sandoe authored
      
      Objective-C++ uses CONST_DECLs to hold constant string objects
      these should also be treated as mergable lvalues.
      
      	PR c++/118673
      
      gcc/cp/ChangeLog:
      
      	* tree.cc (lvalue_kind): Mark CONST_DECLs as mergable
      	when they are also TREE_STATIC.
      
      Signed-off-by: default avatarIain Sandoe <iain@sandoe.co.uk>
      c5667a1e
    • Richard Biener's avatar
      middle-end/118695 - missed misalign handling in MEM_REF expansion · 9ba2de71
      Richard Biener authored
      When MEM_REF expansion of a non-MEM falls back to a stack temporary
      we fail to handle the case where the offset adjusted reference to
      the temporary is not aligned according to the requirement of the
      mode.  We have to go through bitfield extraction or movmisalign
      in this case.  Fortunately there's a helper for this.
      
      This fixes an ICE observed on arm which has sanity checks in its
      move patterns for this.
      
      	PR middle-end/118695
      	* expr.cc (expand_expr_real_1): When expanding a MEM_REF
      	to a non-MEM by committing it to a stack temporary make
      	sure to handle misaligned accesses correctly.
      
      	* gcc.dg/pr118695.c: New testcase.
      9ba2de71
    • Jonathan Wakely's avatar
      libstdc++: Use safe integer comparisons in std::latch [PR98749] · 34d8c842
      Jonathan Wakely authored
      The std::latch::max() function assumes that the returned value can be
      represented by ptrdiff_t, which is true when __platform_wait_t is int
      (e.g. on Linux) but not when it's unsigned long, which is the case for
      most other 64-bit targets. We should use the smaller of PTRDIFF_MAX and
      std::numeric_limits<__platform_wait_t>::max(). Use std::cmp_less to do a
      safe comparison that works for all types. We can also use std::cmp_less
      and std::cmp_equal in std::latch::count_down so that we don't need to
      deal with comparisons between signed and unsigned.
      
      Also add a missing precondition check to constructor and fix the
      existing check in count_down which was duplicated by mistake.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/98749
      	* include/std/latch (latch::max()): Ensure the return value is
      	representable as the return type.
      	(latch::latch(ptrdiff_t)): Add assertion.
      	(latch::count_down): Fix copy & pasted duplicate assertion. Use
      	std::cmp_equal to compare __platform_wait_t and ptrdiff_t
      	values.
      	(latch::_M_a): Use defined constant for alignment.
      	* testsuite/30_threads/latch/1.cc: Check max(). Check constant
      	initialization works for values in the valid range. Check
      	alignment.
      34d8c842
    • Tobias Burnus's avatar
      OpenMP: append_args clause fixes + Fortran support · bea86e82
      Tobias Burnus authored
      This fixes a large number of smaller and larger issues with the append_args
      clause to 'declare variant' and adds Fortran support for it; it also contains
      a larger number of testcases.
      
      In particular, for Fortran, it also handles passing allocatable, pointer,
      optional arguments to an interop dummy argument with or without value
      attribute.  And it changes the internal representation such that dumping the
      tree does not lead to an ICE.
      
      gcc/c/ChangeLog:
      
      	* c-parser.cc (c_finish_omp_declare_variant): Modify how
      	append_args is saved internally.
      
      gcc/cp/ChangeLog:
      
      	* parser.cc (cp_finish_omp_declare_variant): Modify how append_args
      	is saved internally.
      	* pt.cc (tsubst_attribute): Likewise.
      	(tsubst_omp_clauses): Remove C_ORT_OMP_DECLARE_SIMD from interop
      	handling as no longer called for it.
      	* decl.cc (omp_declare_variant_finalize_one): Update append_args
      	changes; fixes for ADL input.
      
      gcc/fortran/ChangeLog:
      
      	* gfortran.h (gfc_omp_declare_variant): Add append_args_list.
      	* openmp.cc (gfc_parser_omp_clause_init_modifiers): New;
      	splitt of from ...
      	(gfc_match_omp_init): ... here; call it.
      	(gfc_match_omp_declare_variant): Update to handle append_args
      	clause; some syntax handling fixes.
      	* trans-openmp.cc (gfc_trans_omp_declare_variant): Handle
      	append_args clause; add some diagnostic.
      
      gcc/ChangeLog:
      
      	* gimplify.cc (gimplify_call_expr): For OpenMP's append_args clause
      	processed by 'omp dispatch', update for internal-representation
      	changes; fix handling of hidden arguments, add some comments and
      	handle Fortran's value dummy and optional/pointer/allocatable actual
      	args.
      
      libgomp/ChangeLog:
      
      	* libgomp.texi (Impl. Status): Update for accumpulated changes
      	related to 'dispatch' and interop.
      
      gcc/testsuite/ChangeLog:
      
      	* c-c++-common/gomp/append-args-1.c: Update dg-*.
      	* c-c++-common/gomp/append-args-3.c: Likewise.
      	* g++.dg/gomp/append-args-1.C: Likewise.
      	* gfortran.dg/gomp/adjust-args-1.f90: Likewise.
      	* gfortran.dg/gomp/adjust-args-3.f90: Likewise.
      	* gfortran.dg/gomp/declare-variant-2.f90: Likewise.
      	* c-c++-common/gomp/append-args-6.c: New test.
      	* c-c++-common/gomp/append-args-7.c: New test.
      	* c-c++-common/gomp/append-args-8.c: New test.
      	* c-c++-common/gomp/append-args-9.c: New test.
      	* g++.dg/gomp/append-args-4.C: New test.
      	* g++.dg/gomp/append-args-5.C: New test.
      	* g++.dg/gomp/append-args-6.C: New test.
      	* g++.dg/gomp/append-args-7.C: New test.
      	* gcc.dg/gomp/append-args-1.c: New test.
      	* gfortran.dg/gomp/append_args-1.f90: New test.
      	* gfortran.dg/gomp/append_args-2.f90: New test.
      	* gfortran.dg/gomp/append_args-3.f90: New test.
      	* gfortran.dg/gomp/append_args-4.f90: New test.
      bea86e82
    • Richard Biener's avatar
      middle-end/118692 - ICE with out-of-bound ref expansion · 6b56e645
      Richard Biener authored
      The following guards the BIT_FIELD_REF expansion fallback for
      MEM_REFs of entities expanded to register (or constant) further,
      avoiding large out-of-bound offsets by, when the access does not
      overlap the base object, expanding the offset as if it were zero.
      
      	PR middle-end/118692
      	* expr.cc (expand_expr_real_1): When expanding a MEM_REF
      	as BIT_FIELD_REF avoid large offsets for accesses not
      	overlapping the base object.
      
      	* gcc.dg/pr118692.c: New testcase.
      6b56e645
    • Richard Biener's avatar
      tree-optimization/114052 - consider infinite sub-loops when lowering iter bound · d1c7837d
      Richard Biener authored
      When we walk stmts to find always executed stmts with UB in the last
      iteration to be able to reduce the iteration count by one we fail
      to consider infinite subloops in the last iteration that would make
      such stmt not execute.  The following adds this.
      
      	PR tree-optimization/114052
      	* tree-ssa-loop-niter.cc (maybe_lower_iteration_bound): Check
      	for infinite subloops we might not exit.
      
      	* gcc.dg/pr114052-1.c: New testcase.
      d1c7837d
    • Richard Sandiford's avatar
      pair-fusion: Check for invalid use arrays [PR118320] · f559ac89
      Richard Sandiford authored
      As Andrew says in the bugzilla comments, this PR is about a case where
      we tried to fuse two stores of x0, one in which x0 was defined and one
      in which it was undefined.  merge_access_arrays failed on the conflict,
      but the failure wasn't caught.
      
      Normally the hazard detection code would fail if the instructions
      had incompatible uses.  However, an undefined use doesn't impose
      many restrictions on movements.  I think this is likely to be the
      only case where hazard detection isn't enough.
      
      As Andrew notes in bugzilla, it might be possible to allow uses
      of defined and undefined values to be merged to the defined value.
      But that sounds dangerous in the general case, as an rtl-ssa-level
      decision.  We might run the risk of turning conditional UB into
      unconditional UB.  And LLVM proves that the definition of "undef"
      isn't simple.
      
      gcc/
      	PR rtl-optimization/118320
      	* pair-fusion.cc (pair_fusion_bb_info::fuse_pair): Commonize
      	the merge of input_uses and return early if it fails.
      
      gcc/testsuite/
      	PR rtl-optimization/118320
      	* g++.dg/torture/pr118320.C: New test.
      f559ac89
    • Jeff Law's avatar
      [PR testsuite/116860] Testsuite adjustment for recently added tests · 15dba7df
      Jeff Law authored
      There's two new tests that are dependent on logical-op-non-short-circuit
      settings.  The BZ is reported against ppc64 and ppc64le, but also applies to a
      goodly number of the other targets.
      
      The "regression" fix is trivial, just add the appropriate param to force the
      behavior we're expecting.  I'm committing that fix momentarily.  It's been
      verified on ppc64, ppc64le and x86_64 as well as the various embedded targets
      in my tester where many FAILS flip to PASS.
      
      I'm leaving the bug open without the regression marker as Jakub has noted a
      couple of improvements that we can and probably should make.
      
      	PR target/116860
      gcc/testsuite
      	* gcc.dg/tree-ssa/fold-xor-and-or.c: Set logical-op-non-short-circuit.
      	* gcc.dg/tree-ssa/fold-xor-or.c: Similarly.
      15dba7df
    • GCC Administrator's avatar
      Daily bump. · 0942ee32
      GCC Administrator authored
      0942ee32
  3. Jan 29, 2025
    • Gaius Mulley's avatar
      PR modula2/116073 invalid rtl sharing compiling FileSystem.mod caused by ext-dce · 62abe069
      Gaius Mulley authored
      
      The bug fixes to PR modula2/118010 and PR modula2/118183 uncovered a bug
      in the procedure interface to lseek which uses SYSTEM.COFF_T rather than
      SYSTEM.CSSIZE_T.  This patch sets the default size for COFF_T to the same
      as CSSIZE_T.
      
      gcc/ChangeLog:
      	PR modula2/118010
      	PR modula2/118183
      	PR modula2/116073
      	* doc/gm2.texi (-fm2-file-offset-bits=): Change the default size
      	description to CSSIZE_T.
      	Add COFF_T to the list of data types exported by SYSTEM.def.
      
      gcc/m2/ChangeLog:
      	PR modula2/118010
      	PR modula2/118183
      	PR modula2/116073
      	* gm2-compiler/M2Options.mod (OffTBits): Assign to 0.
      	* gm2-gcc/m2type.cc (build_m2_specific_size_type): Ensure that
      	layout_type is called before returning c.
      	(build_m2_offt_type_node): If GetFileOffsetBits returns 0 then
      	use the type size of ssize_t.
      
      gcc/testsuite/ChangeLog:
      
      	PR modula2/118010
      	PR modula2/118183
      	PR modula2/116073
      	* gm2/pim/run/pass/printtypesize.mod: New test.
      
      Signed-off-by: default avatarGaius Mulley <gaiusmod2@gmail.com>
      62abe069
    • Arsen Arsenović's avatar
      d: give dependency files better filenames [PR118477] · d9ac0ad1
      Arsen Arsenović authored
      
      Currently, the dependency files for root-file.o and common-file.o were
      both d/.deps/file.Po, which would cause parallel builds to fail
      sometimes with:
      
        make[3]: Leaving directory '/var/tmp/portage/sys-devel/gcc-14.1.1_p20240511/work/build/gcc'
        make[3]: Entering directory '/var/tmp/portage/sys-devel/gcc-14.1.1_p20240511/work/build/gcc'
        mv: cannot stat 'd/.deps/file.TPo': No such file or directory
        make[3]: *** [/var/tmp/portage/sys-devel/gcc-14.1.1_p20240511/work/gcc-14-20240511/gcc/d/Make-lang.in:421: d/root-file.o] Error 1 shuffle=131581365
      
      Also, this means that dependencies of one of root-file or common-file
      are missing when developing.  After this patch, those two files get
      assigned dependency files d/.deps/root-file.Po and
      d/.deps/common-file.Po respectively, so match the actual object
      files in the d/ subdirectory.
      
      There are other files with similar conflicts (mangle-package.o,
      visitor-package.o for instance).
      
      2025-01-29  Arsen Arsenović  <arsen@aarsen.me>
      	    Jakub Jelinek  <jakub@redhat.com>
      
      	PR d/118477
      	* Make-lang.in (DCOMPILE, DPOSTCOMPILE): Use $(basename $(@F))
      	instead of $(*F).
      
      Co-Authored-By: default avatarJakub Jelinek <jakub@redhat.com>
      d9ac0ad1
    • Richard Sandiford's avatar
      pair-fusion: A couple of fixes for sp updates [PR118429] · a0a202d0
      Richard Sandiford authored
      The PR showed two issues with pair-fusion.  The first is that the pass
      treated stack pointer deallocations as ordinary register updates, and so
      might move them earlier than another stack access (through a different
      base register) that doesn't alias the pair candidate.
      
      The simplest fix for that seems to be to prevent the stack deallocation
      from being moved.  This part might (or might not) be a latent source of
      wrong code and so worth backporting in some form.  (The patch as-is
      won't work for GCC 14.)
      
      The second issue only started with r15-6551, which added a memory
      write to stack allocations and deallocations.  We should use the
      existing tombstone mechanism to preserve the associated memory
      definition.  (Deleting definitions immediately would have quadratic
      complexity in the worst case.)
      
      gcc/
      	PR rtl-optimization/118429
      	* pair-fusion.cc (latest_hazard_before): Add an extra parameter
      	to say whether the instruction is a load or a store.  If the
      	instruction is not a load or store and has memory side effects,
      	prevent it from being moved earlier.
      	(pair_fusion::find_trailing_add): Update call accordingly.
      	(pair_fusion_bb_info::fuse_pair): If the trailng addition had
      	a memory side-effect, use a tombstone to preserve it.
      
      gcc/testsuite/
      	PR rtl-optimization/118429
      	* gcc.c-torture/compile/pr118429.c: New test.
      a0a202d0
    • Georg-Johann Lay's avatar
      AVR: Allow to share libgcc's __negsi2. · eacb85eb
      Georg-Johann Lay authored
      libgcc has a module for __negsi2:  REG_22:SI := - REG_22:SI.
      This patch adds a pattern that allows to share that function
      provided optimize_size.
      
      gcc/
      	* config/avr/avr.md (*negsi2.libgcc): New insn.
      eacb85eb
    • Marek Polacek's avatar
      c++: add fixed test [PR57533] · 2a77afa0
      Marek Polacek authored
      Fixed by r11-2412.
      
      	PR c++/57533
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/eh/throw5.C: New test.
      2a77afa0
    • Siddhesh Poyarekar's avatar
      testsuite/118127: Pass fortran tests on ppc64le for IEEE128 long doubles · d4d4e874
      Siddhesh Poyarekar authored
      
      Denormal behaviour is well defined for IEEE128 long doubles, so
      XFAIL some gfortran tests only for targets with the IBM128 long double
      ABI.
      
      gcc/testsuite/ChangeLog:
      
      	PR testsuite/118127
      	* lib/target-supports.exp
      	(check_effective_target_long_double_is_ibm128): New
      	procedure.
      	* gfortran.dg/default_format_2.f90: xfail for
      	long_double_is_ibm128.
      	* gfortran.dg/default_format_denormal_2.f90: Likewise.
      	* gfortran.dg/large_real_kind_form_io_2.f90: Likewise.
      
      Signed-off-by: default avatarSiddhesh Poyarekar <siddhesh@gotplt.org>
      d4d4e874
    • Yoshinori Sato's avatar
      [PATCH] RX: Restrict displacement ranges in "Q" constraint · 43188215
      Yoshinori Sato authored
      When using the "Q" constraint in the inline assembler, the displacement value
      could exceed the range specified by the instruction.
      To avoid this issue, a displacement range check is added to the "Q" constraint.
      
      gcc/
      	* config/rx/constraints.md (Q): Also check that the address
      	passes rx_is_restricted_memory-address.
      43188215
    • Patrick Palka's avatar
      libstdc++: Fix views::transform(move_only_fn{}) forwarding [PR118413] · 09d1cbee
      Patrick Palka authored
      
      The range adaptor perfect forwarding simplification mechanism is currently
      only enabled for trivially copyable bound arguments, to prevent undesirable
      copies of complex objects.  But "trivially copyable" is the wrong property
      to check for here, since a move-only type with a trivial move constructor
      is considered trivially copyable, and after P2492R2 we can't assume copy
      constructibility of the bound arguments.  This patch makes the mechanism
      more specifically check for trivial copy constructibility instead so
      that it's properly disabled for move-only bound arguments.
      
      	PR libstdc++/118413
      
      libstdc++-v3/ChangeLog:
      
      	* include/std/ranges (views::__adaptor::_Partial): Adjust
      	constraints on the "simple" partial specializations to require
      	is_trivially_copy_constructible_v instead of
      	is_trivially_copyable_v.
      	* testsuite/std/ranges/adaptors/adjacent_transform/1.cc (test04):
      	Extend P2494R2 test.
      	* testsuite/std/ranges/adaptors/transform.cc (test09): Likewise.
      
      Reviewed-by: default avatarJonathan Wakely <jwakely@redhat.com>
      09d1cbee
    • Andrew Pinski's avatar
      split-path: Small fix for poor_ifcvt_pred (tsvc s258) [PR118505] · dc6b949c
      Andrew Pinski authored
      
      After r15-3436-gb2b20b277988ab, poor_ifcvt_pred returns false for
      the case where the statement could trap but in this case trapping
      instructions cannot be made unconditional so it is a poor ifcvt.
      
      This fixes a small preformance regression with TSVC s258 at
      `-O3 -ftrapping-math` on aarch64 where ifcvt would not happen
      and we would still have a branch.
      
      On a specific aarch64, we go from 0.145s down to 0.118s.
      
      Bootstrapped and tested on x86_64-linux-gnu.
      
      gcc/ChangeLog:
      
      	PR tree-optimization/118505
      	* gimple-ssa-split-paths.cc (poor_ifcvt_pred): Return
      	true for trapping statements.
      
      Signed-off-by: default avatarAndrew Pinski <quic_apinski@quicinc.com>
      dc6b949c
    • Andrew Pinski's avatar
      split-path: CALL_EXPR can't show up in gimple_assign · eafdce17
      Andrew Pinski authored
      
      While working on split path, I noticed that poor_ifcvt_candidate_code
      would check for CALL_EXPR but that can't show up in gimple_assign
      so this removes that check.
      
      This could be a very very small compile time improvement.
      
      Bootstrapped and tested on x86_64-linux-gnu.
      
      gcc/ChangeLog:
      
      	* gimple-ssa-split-paths.cc (poor_ifcvt_candidate_code): Remove CALL_EXPR handling.
      
      Signed-off-by: default avatarAndrew Pinski <quic_apinski@quicinc.com>
      eafdce17
Loading