Skip to content
Snippets Groups Projects
  1. Nov 07, 2023
    • Kwok Cheung Yeung's avatar
      openmp: Add support for the 'indirect' clause in C/C++ · a49c7d31
      Kwok Cheung Yeung authored
      This adds support for the 'indirect' clause in the 'declare target'
      directive.  Functions declared as indirect may be called via function
      pointers passed from the host in offloaded code.
      
      Virtual calls to member functions via the object pointer in C++ are
      currently not supported in target regions.
      
      2023-11-07  Kwok Cheung Yeung  <kcy@codesourcery.com>
      
      gcc/c-family/
      	* c-attribs.cc (c_common_attribute_table): Add attribute for
      	indirect functions.
      	* c-pragma.h (enum parma_omp_clause): Add entry for indirect clause.
      
      gcc/c/
      	* c-decl.cc (c_decl_attributes): Add attribute for indirect
      	functions.
      	* c-lang.h (c_omp_declare_target_attr): Add indirect field.
      	* c-parser.cc (c_parser_omp_clause_name): Handle indirect clause.
      	(c_parser_omp_clause_indirect): New.
      	(c_parser_omp_all_clauses): Handle indirect clause.
      	(OMP_DECLARE_TARGET_CLAUSE_MASK): Add indirect clause to mask.
      	(c_parser_omp_declare_target): Handle indirect clause.  Emit error
      	message if device_type or indirect clauses used alone.  Emit error
      	if indirect clause used with device_type that is not 'any'.
      	(OMP_BEGIN_DECLARE_TARGET_CLAUSE_MASK): Add indirect clause to mask.
      	(c_parser_omp_begin): Handle indirect clause.
      	* c-typeck.cc (c_finish_omp_clauses): Handle indirect clause.
      
      gcc/cp/
      	* cp-tree.h (cp_omp_declare_target_attr): Add indirect field.
      	* decl2.cc (cplus_decl_attributes): Add attribute for indirect
      	functions.
      	* parser.cc (cp_parser_omp_clause_name): Handle indirect clause.
      	(cp_parser_omp_clause_indirect): New.
      	(cp_parser_omp_all_clauses): Handle indirect clause.
      	(handle_omp_declare_target_clause): Add extra parameter.  Add
      	indirect attribute for indirect functions.
      	(OMP_DECLARE_TARGET_CLAUSE_MASK): Add indirect clause to mask.
      	(cp_parser_omp_declare_target): Handle indirect clause.  Emit error
      	message if device_type or indirect clauses used alone.  Emit error
      	if indirect clause used with device_type that is not 'any'.
      	(OMP_BEGIN_DECLARE_TARGET_CLAUSE_MASK): Add indirect clause to mask.
      	(cp_parser_omp_begin): Handle indirect clause.
      	* semantics.cc (finish_omp_clauses): Handle indirect clause.
      
      gcc/
      	* lto-cgraph.cc (enum LTO_symtab_tags): Add tag for indirect
      	functions.
      	(output_offload_tables): Write indirect functions.
      	(input_offload_tables): read indirect functions.
      	* lto-section-names.h (OFFLOAD_IND_FUNC_TABLE_SECTION_NAME): New.
      	* omp-builtins.def (BUILT_IN_GOMP_TARGET_MAP_INDIRECT_PTR): New.
      	* omp-offload.cc (offload_ind_funcs): New.
      	(omp_discover_implicit_declare_target): Add functions marked with
      	'omp declare target indirect' to indirect functions list.
      	(omp_finish_file): Add indirect functions to section for offload
      	indirect functions.
      	(execute_omp_device_lower): Redirect indirect calls on target by
      	passing function pointer to BUILT_IN_GOMP_TARGET_MAP_INDIRECT_PTR.
      	(pass_omp_device_lower::gate): Run pass_omp_device_lower if
      	indirect functions are present on an accelerator device.
      	* omp-offload.h (offload_ind_funcs): New.
      	* tree-core.h (omp_clause_code): Add OMP_CLAUSE_INDIRECT.
      	* tree.cc (omp_clause_num_ops): Add entry for OMP_CLAUSE_INDIRECT.
      	(omp_clause_code_name): Likewise.
      	* tree.h (OMP_CLAUSE_INDIRECT_EXPR): New.
      	* config/gcn/mkoffload.cc (process_asm): Process offload_ind_funcs
      	section.  Count number of indirect functions.
      	(process_obj): Emit number of indirect functions.
      	* config/nvptx/mkoffload.cc (ind_func_ids, ind_funcs_tail): New.
      	(process): Emit offload_ind_func_table in PTX code.  Emit indirect
      	function names and count in image.
      	* config/nvptx/nvptx.cc (nvptx_record_offload_symbol): Mark
      	indirect functions in PTX code with IND_FUNC_MAP.
      
      gcc/testsuite/
      	* c-c++-common/gomp/declare-target-7.c: Update expected error message.
      	* c-c++-common/gomp/declare-target-indirect-1.c: New.
      	* c-c++-common/gomp/declare-target-indirect-2.c: New.
      	* g++.dg/gomp/attrs-21.C (v12): Update expected error message.
      	* g++.dg/gomp/declare-target-indirect-1.C: New.
      	* gcc.dg/gomp/attrs-21.c (v12): Update expected error message.
      
      include/
      	* gomp-constants.h (GOMP_VERSION): Increment to 3.
      	(GOMP_VERSION_SUPPORTS_INDIRECT_FUNCS): New.
      
      libgcc/
      	* offloadstuff.c (OFFLOAD_IND_FUNC_TABLE_SECTION_NAME): New.
      	(__offload_ind_func_table): New.
      	(__offload_ind_funcs_end): New.
      	(__OFFLOAD_TABLE__): Add entries for indirect functions.
      
      libgomp/
      	* Makefile.am (libgomp_la_SOURCES): Add target-indirect.c.
      	* Makefile.in: Regenerate.
      	* libgomp-plugin.h (GOMP_INDIRECT_ADDR_MAP): New define.
      	(GOMP_OFFLOAD_load_image): Add extra argument.
      	* libgomp.h (struct indirect_splay_tree_key_s): New.
      	(indirect_splay_tree_node, indirect_splay_tree,
      	indirect_splay_tree_key): New.
      	(indirect_splay_compare): New.
      	* libgomp.map (GOMP_5.1.1): Add GOMP_target_map_indirect_ptr.
      	* libgomp.texi (OpenMP 5.1): Update documentation on indirect
      	calls in target region and on indirect clause.
      	(Other new OpenMP 5.2 features): Add entry for virtual function calls.
      	* libgomp_g.h (GOMP_target_map_indirect_ptr): Add prototype.
      	* oacc-host.c (host_load_image): Add extra argument.
      	* target.c (gomp_load_image_to_device): If the GOMP_VERSION is high
      	enough, read host indirect functions table and pass to
      	load_image_func.
      	* config/accel/target-indirect.c: New.
      	* config/linux/target-indirect.c: New.
      	* config/gcn/team.c (build_indirect_map): Add prototype.
      	(gomp_gcn_enter_kernel): Initialize support for indirect
      	function calls on GCN target.
      	* config/nvptx/team.c (build_indirect_map): Add prototype.
      	(gomp_nvptx_main): Initialize support for indirect function
      	calls on NVPTX target.
      	* plugin/plugin-gcn.c (struct gcn_image_desc): Add field for
      	indirect functions count.
      	(GOMP_OFFLOAD_load_image): Add extra argument.  If the GOMP_VERSION
      	is high enough, build address translation table and copy it to target
      	memory.
      	* plugin/plugin-nvptx.c (nvptx_tdata): Add field for indirect
      	functions count.
      	(GOMP_OFFLOAD_load_image): Add extra argument.  If the GOMP_VERSION
      	is high enough, Build address translation table and copy it to target
      	memory.
      	* testsuite/libgomp.c-c++-common/declare-target-indirect-1.c: New.
      	* testsuite/libgomp.c-c++-common/declare-target-indirect-2.c: New.
      	* testsuite/libgomp.c++/declare-target-indirect-1.C: New.
      a49c7d31
    • Tobias Burnus's avatar
      OpenMP: invoke.texi - mention C attribute syntax for -fopenmp(-simd) · 75e5a467
      Tobias Burnus authored
      gcc/ChangeLog:
      
      	* doc/invoke.texi (-fopenmp, -fopenmp-simd): Adjust wording for
      	attribute syntax supported also in C.
      75e5a467
    • Richard Sandiford's avatar
      aarch64: Add a %Z operand modifier for SVE registers · f40eac53
      Richard Sandiford authored
      This patch adds a %Z operand modifier that prints registers as SVE z
      registers.  The SME patches need this, but so do Tamar's patches.
      I'm separating this out to unblock those.
      
      We should probably document the [wxbhsdqZ] modifiers as
      user-facing, but doing that for all of them is a separate patch.
      
      gcc/
      	* config/aarch64/aarch64.cc (aarch64_print_operand): Add a %Z
      	modifier for SVE registers.
      f40eac53
    • Joseph Myers's avatar
      c: Refer more consistently to C23 not C2X · 094a609c
      Joseph Myers authored
      Continuing the move to refer to C23 in place of C2X throughout the
      source tree, update documentation, diagnostics, comments, variable and
      function names, etc., to use the C23 name.
      
      Testsuite updates are left for a future patch, except for testcases
      that test diagnostics that previously mentioned C2X (but in those
      testcases, sometimes other comments are updated, not just the
      diagnostic expectations).
      
      Bootstrapped with no regressions for x86_64-pc-linux-gnu.
      
      gcc/
      	* builtins.def (DEF_C2X_BUILTIN): Rename to DEF_C23_BUILTIN and
      	use flag_isoc23 and function_c23_misc.
      	* config/rl78/rl78.cc (rl78_option_override): Compare
      	lang_hooks.name with "GNU C23" not "GNU C2X".
      	* coretypes.h (function_c2x_misc): Rename to function_c23_misc.
      	* doc/cpp.texi (@code{__has_attribute}): Refer to C23 instead of
      	C2x.
      	* doc/extend.texi: Likewise.
      	* doc/invoke.texi: Likewise.
      	* dwarf2out.cc (highest_c_language, gen_compile_unit_die): Compare
      	against and return "GNU C23" language string instead of "GNU C2X".
      	* ginclude/float.h: Refer to C23 instead of C2X in comments.
      	* ginclude/stdint-gcc.h: Likewise.
      	* glimits.h: Likewise.
      	* tree.h: Likewise.
      
      gcc/ada/
      	* gcc-interface/utils.cc (flag_isoc2x): Rename to flag_isoc23.
      
      gcc/c-family/
      	* c-common.cc (flag_isoc2x): Rename to flag_isoc23.
      	(c_common_reswords): Use D_C23 instead of D_C2X.
      	* c-common.h: Refer throughout to C23 instead of C2X in comments.
      	(D_C2X): Rename to D_C23.
      	(flag_isoc2x): Rename to flag_isoc23.
      	* c-cppbuiltin.cc (builtin_define_float_constants): Use
      	flag_isoc23 instead of flag_isoc2x.  Refer to C23 instead of C2x
      	in comments.
      	* c-format.cc: Use STD_C23 instead of STD_C2X and flag_isoc23
      	instead of flag_isoc2x.  Refer to C23 instead of C2X in comments.
      	* c-format.h: Use STD_C23 instead of STD_C2X.
      	* c-lex.cc: Use warn_c11_c23_compat instead of warn_c11_c2x_compat
      	and flag_isoc23 instead of flag_isoc2x.  Refer to C23 instead of
      	C2X in diagnostics.
      	* c-opts.cc: Use flag_isoc23 instead of flag_isoc2x.  Refer to C23
      	instead of C2X in comments.
      	(set_std_c2x): Rename to set_std_c23.
      	* c.opt (Wc11-c23-compat): Use CPP(cpp_warn_c11_c23_compat)
      	CppReason(CPP_W_C11_C23_COMPAT) Var(warn_c11_c23_compat) instead
      	of CPP(cpp_warn_c11_c2x_compat) CppReason(CPP_W_C11_C2X_COMPAT)
      	Var(warn_c11_c2x_compat).
      
      gcc/c/
      	* c-decl.cc: Use flag_isoc23 instead of flag_isoc2x and c23_auto_p
      	instead of c2x_auto_p.  Refer to C23 instead of C2X in diagnostics
      	and comments.
      	* c-errors.cc: Use flag_isoc23 instead of flag_isoc2x and
      	warn_c11_c23_compat instead of warn_c11_c2x_compat.  Refer to C23
      	instead of C2X in comments.
      	* c-parser.cc: Use flag_isoc23 instead of flag_isoc2x,
      	warn_c11_c23_compat instead of warn_c11_c2x_compat, c23_auto_p
      	instead of c2x_auto_p and D_C23 instead of D_C2X.  Refer to C23
      	instead of C2X in diagnostics and comments.
      	* c-tree.h: Refer to C23 instead of C2X in comments.
      	(struct c_declspecs): Rename c2x_auto_p to c23_auto_p.
      	* c-typeck.cc: Use flag_isoc23 instead of flag_isoc2x and
      	warn_c11_c23_compat instead of warn_c11_c2x_compat.  Refer to C23
      	instead of C2X in diagnostics and comments.
      
      gcc/fortran/
      	* gfortran.h (gfc_real_info): Refer to C23 instead of C2X in
      	comment.
      
      gcc/lto/
      	* lto-lang.cc (flag_isoc2x): Rename to flag_isoc23.
      
      gcc/testsuite/
      	* gcc.dg/binary-constants-2.c: Refer to C23 instead of C2X.
      	* gcc.dg/binary-constants-3.c: Likewise.
      	* gcc.dg/bitint-23.c: Likewise.
      	* gcc.dg/bitint-26.c: Likewise.
      	* gcc.dg/bitint-27.c: Likewise.
      	* gcc.dg/c11-attr-syntax-1.c: Likewise.
      	* gcc.dg/c11-attr-syntax-2.c: Likewise.
      	* gcc.dg/c11-floatn-1.c: Likewise.
      	* gcc.dg/c11-floatn-2.c: Likewise.
      	* gcc.dg/c11-floatn-3.c: Likewise.
      	* gcc.dg/c11-floatn-4.c: Likewise.
      	* gcc.dg/c11-floatn-5.c: Likewise.
      	* gcc.dg/c11-floatn-6.c: Likewise.
      	* gcc.dg/c11-floatn-7.c: Likewise.
      	* gcc.dg/c11-floatn-8.c: Likewise.
      	* gcc.dg/c2x-attr-syntax-4.c: Likewise.
      	* gcc.dg/c2x-attr-syntax-6.c: Likewise.
      	* gcc.dg/c2x-attr-syntax-7.c: Likewise.
      	* gcc.dg/c2x-binary-constants-2.c: Likewise.
      	* gcc.dg/c2x-floatn-5.c: Likewise.
      	* gcc.dg/c2x-floatn-6.c: Likewise.
      	* gcc.dg/c2x-floatn-7.c: Likewise.
      	* gcc.dg/c2x-floatn-8.c: Likewise.
      	* gcc.dg/c2x-nullptr-4.c: Likewise.
      	* gcc.dg/c2x-qual-2.c: Likewise.
      	* gcc.dg/c2x-qual-3.c: Likewise.
      	* gcc.dg/c2x-qual-6.c: Likewise.
      	* gcc.dg/cpp/c11-warning-1.c: Likewise.
      	* gcc.dg/cpp/c11-warning-2.c: Likewise.
      	* gcc.dg/cpp/c11-warning-3.c: Likewise.
      	* gcc.dg/cpp/c2x-warning-2.c: Likewise.
      	* gcc.dg/cpp/gnu11-elifdef-3.c: Likewise.
      	* gcc.dg/cpp/gnu11-elifdef-4.c: Likewise.
      	* gcc.dg/cpp/gnu11-warning-1.c: Likewise.
      	* gcc.dg/cpp/gnu11-warning-2.c: Likewise.
      	* gcc.dg/cpp/gnu11-warning-3.c: Likewise.
      	* gcc.dg/cpp/gnu2x-warning-2.c: Likewise.
      	* gcc.dg/dfp/c11-constants-1.c: Likewise.
      	* gcc.dg/dfp/c11-constants-2.c: Likewise.
      	* gcc.dg/dfp/c2x-constants-2.c: Likewise.
      	* gcc.dg/dfp/constants-pedantic.c: Likewise.
      	* gcc.dg/pr30260.c: Likewise.
      	* gcc.dg/system-binary-constants-1.c: Likewise.
      
      libcpp/
      	* directives.cc: Refer to C23 instead of C2X in diagnostics and
      	comments.
      	(STDC2X): Rename to STDC23.
      	* expr.cc: Use cpp_warn_c11_c23_compat instead of
      	cpp_warn_c11_c2x_compat and CPP_W_C11_C23_COMPAT instead of
      	CPP_W_C11_C2X_COMPAT.  Refer to C23 instead of C2X in diagnostics
      	and comments.
      	* include/cpplib.h: Refer to C23 instead of C2X in diagnostics and
      	comments.
      	(CLK_GNUC2X): Rename to CLK_GNUC23.
      	(CLK_STDC2X): Rename to CLK_STDC23.
      	(CPP_W_C11_C2X_COMPAT): Rename to CPP_W_C11_C23_COMPAT.
      	* init.cc: Use GNUC23 instead of GNUC2X, STDC23 instead of STDC2X
      	and cpp_warn_c11_c23_compat instead of cpp_warn_c11_c2x_compat.
      	* lex.cc (maybe_va_opt_error): Refer to C23 instead of C2X in
      	diagnostic.
      	* macro.cc (_cpp_arguments_ok): Refer to C23 instead of C2X in
      	comment.
      094a609c
    • Juzhe-Zhong's avatar
      test: Fix FAIL of pr65518.c for RVV[PR112420] · beb1e2bf
      Juzhe-Zhong authored
      	PR target/112420
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/vect/pr65518.c: Fix check for RVV.
      beb1e2bf
    • Richard Biener's avatar
      libstdc++/112351 - deal with __gthread_once failure during locale init · 7562f089
      Richard Biener authored
      The following makes the C++98 locale init path follow the way the
      C++11 performs initialization.  This way we deal with pthread_once
      failing, falling back to non-threadsafe initialization which, given we
      initialize from the library, should be serialized by the dynamic
      loader already.
      
      	PR libstdc++/112351
      libstdc++-v3/
      	* src/c++98/locale.cc (locale::facet::_S_initialize_once):
      	Check whether _S_c_locale is already initialized.
      	(locale::facet::_S_get_c_locale): Always perform non-threadsafe
      	init when threadsafe init failed.
      7562f089
    • Robin Dapp's avatar
      testsuite/vect: Make check more accurate. · dd5c3ca9
      Robin Dapp authored
      Similar to before this modifies a check so we do only match a
      vectorization attempt if it succeeded.  On riscv we potentially try
      several modes if which some may fail.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/vect/vect-cond-reduc-4.c: Make check more accurate.
      dd5c3ca9
    • Robin Dapp's avatar
      testsuite: Change expectation for bb-slp-over-widen-n.c · 7aacbd44
      Robin Dapp authored
      This patch makes sure we check for
        note: Basic block will be vectorized using SLP
      instead of
        optimized: basic block
      which will also match
        optimized: basic block part
      of which there are many more in an RVV dump.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/vect/bb-slp-over-widen-1.c: Change test expectation.
      	* gcc.dg/vect/bb-slp-over-widen-2.c: Ditto.
      7aacbd44
    • Juzhe-Zhong's avatar
      RISC-V: Add RISC-V into vect_cmdline_needed · 204186ba
      Juzhe-Zhong authored
      Like all other targets, we add RISC-V into vect_cmdline_needed.
      
      This patch fixes following FAILs:
      
      FAIL: gcc.dg/tree-ssa/gen-vect-11b.c scan-tree-dump-times vect "vectorized 0 loops" 1
      FAIL: gcc.dg/tree-ssa/gen-vect-11c.c scan-tree-dump-times vect "vectorized 0 loops" 1
      FAIL: gcc.dg/tree-ssa/gen-vect-26.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1
      FAIL: gcc.dg/tree-ssa/gen-vect-28.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1
      
      gcc/testsuite/ChangeLog:
      
      	* lib/target-supports.exp: Add RISC-V.
      204186ba
    • Alexandre Oliva's avatar
      testsuite: check for and use -mno-strict-align where needed · e87bc7dc
      Alexandre Oliva authored
      Various tests fail on powerpc if the toolchain is configured to enable
      -mstrict-align by default.  This patch introduces -mno-strict-align on
      tests found to fail that way, when the target supports this option.
      
      I suppose !non_strict_align could be used to skip tests, instead of or
      in addition to this tweak, and that might be desirable if they still
      fail on targets that do no support -mno-strict-align, but I haven't
      observed such scenarios.
      
      
      The p9-vec-length tests expect vectorization on loop bodies and
      epilogues that reference arrays that are not known to be more aligned
      than their small element types.
      
      Though VSX vectors work best with 32- or 64-bit alignment, unaligned
      vector loads and stores are expected by the tests.  However, with
      -mstrict-align by default, vector loads and stores not known to be
      aligned end up open coded, which doesn't match the asm output
      expectations coded in the tests.
      
      
      
      for  gcc/ChangeLog
      
      	* doc/sourcebuild.texi (opt_mstrict_align): New target.
      
      for  gcc/testsuite/ChangeLog
      
      	* lib/target-supports.exp
      	(check_effective_target_opt_mstrict_align): New.
      	* gcc.dg/strlenopt-80.c: Add -mno-strict-align if supported.
      	* gcc.target/powerpc/prefix-ds-dq.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-epil-1.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-epil-2.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-epil-3.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-epil-4.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-epil-5.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-epil-6.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-epil-7.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-epil-8.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-epil-run-1.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-epil-run-2.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-epil-run-3.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-epil-run-4.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-epil-run-5.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-epil-run-6.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-epil-run-7.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-epil-run-8.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-full-1.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-full-2.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-full-3.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-full-4.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-full-5.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-full-6.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-full-7.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-full-8.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-full-run-1.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-full-run-2.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-full-run-3.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-full-run-4.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-full-run-5.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-full-run-6.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-full-run-7.c: Likewise.
      	* gcc.target/powerpc/p9-vec-length-full-run-8.c: Likewise.
      e87bc7dc
    • Christoph Müllner's avatar
      RISC-V: Use stdint-gcc.h in xtheadmemidx-helpers.h · 74b35716
      Christoph Müllner authored
      
      stdint.h can be replaced with stdint-gcc.h to resolve some missing
      system headers in non-multilib installations.
      
      Signed-off-by: default avatarChristoph Müllner <christoph.muellner@vrull.eu>
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/xtheadmemidx-helpers.h:
      	Replace stdint.h with stdint-gcc.h.
      74b35716
    • Christoph Müllner's avatar
      RISC-V: Add ABI requirement for XTheadFMemIdx tests · 41690331
      Christoph Müllner authored
      
      The XTheadFMemIdx tests set the required ABI for RV32, but not
      for RV64, which has the effect that the tests are expected to
      succeed for RV64/LP64.  Let's set the ABI to LP64D in these
      tests to clarify the requirements.
      
      Signed-off-by: default avatarChristoph Müllner <christoph.muellner@vrull.eu>
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/xtheadfmemidx-index-update.c: Add ABI.
      	* gcc.target/riscv/xtheadfmemidx-index-xtheadbb-update.c: Likewise.
      	* gcc.target/riscv/xtheadfmemidx-index-xtheadbb.c: Likewise.
      	* gcc.target/riscv/xtheadfmemidx-index.c: Likewise.
      	* gcc.target/riscv/xtheadfmemidx-uindex-update.c: Likewise.
      	* gcc.target/riscv/xtheadfmemidx-uindex-xtheadbb-update.c: Likewise.
      	* gcc.target/riscv/xtheadfmemidx-uindex-xtheadbb.c: Likewise.
      	* gcc.target/riscv/xtheadfmemidx-uindex.c: Likewise.
      41690331
    • Eric Botcazou's avatar
      ada: Fix debug info for aliased packed array with unconstrained nominal subtype · b6ba22ca
      Eric Botcazou authored
      The front-end now rewrites it as a renaming when it is initialized with a
      function call and the same processing must be applied in the renaming case
      as in the regular case for this kind of special objects.
      
      gcc/ada/
      
      	* gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Variable>: Apply the
      	specific rewriting done for an aliased object with an unconstrained
      	array nominal subtype in the renaming case too.
      b6ba22ca
    • Eric Botcazou's avatar
      ada: Fix spurious -Wstringop-overflow with link time optimization · c210397b
      Eric Botcazou authored
      It comes from an incomplete optimization performed by LTO that is caused by
      an obsolete transformation done in Gigi, which is redundant with the common
      uniquization of constant CONSTRUCTORs now performed during gimplification.
      
      gcc/ada/
      
      	* gcc-interface/trans.cc (gnat_gimplify_expr) <CALL_EXPR>: Delete.
      c210397b
    • Bob Duff's avatar
      ada: Compiler crash on early alignment clause · 756e05d1
      Bob Duff authored
      This patch fixes a bug: if "for T'Alignment use..." is followed
      by "for T use (<enum rep>);" the compiler crashes. A workaround is
      to move the alignment clause after the enumeration rep clause.
      
      gcc/ada/
      
      	* sem_ch13.ads (Set_Enum_Esize): Do not set alignment.
      	* sem_ch13.adb (Set_Enum_Esize): Do not set alignment. Archaeology
      	seems to show that this line of code dates from when "Alignment =
      	0" meant "the Alignment is not known at compile time" and "the
      	Alignment is not yet known at compile time" as well as "the
      	Alignment is zero". In any case, it seems to be unnecessary, and
      	in this case harmful, because gigi would crash. Alignment_Clause
      	is set (because there is one), so gigi would query the Alignment,
      	but Alignment was destroyed.
      756e05d1
    • Julien Bortolussi's avatar
      ada: Update the logo in the gnat doc · 09e5e68c
      Julien Bortolussi authored
      Update the logo and the background color in the top right corner of the
      GNAT User’s Guide for Native Platforms
      
      gcc/ada/
      
      	* doc/share/conf.py: Changed the background color and the logo.
      09e5e68c
    • Eric Botcazou's avatar
      ada: Fix incorrect resolution of overloaded function call in instance · 003fe135
      Eric Botcazou authored
      The problem occurs when the function call is the operand of an equality
      operator, the type used to do the comparison is declared outside of the
      generic construct but visible inside it, and this generic construct also
      declares two functions with the same profile except for the result type,
      one result type being the aforementioned type, the other being derived
      from this type but not visible inside the generic construct.  When the
      second operand is either a literal or also overloaded, the call may be
      resolved to the second function instead of the first in instances.
      
      gcc/ada/
      
      	* gen_il-fields.ads (Opt_Field_Enum): Add Compare_Type.
      	* gen_il-gen-gen_nodes.adb (N_Op_Eq): Likewise.
      	(N_Op_Ge): Likewise.
      	(N_Op_Gt): Likewise.
      	(N_Op_Le): Likewise.
      	(N_Op_Lt): Likewise.
      	(N_Op_Ne): Likewise.
      	* sinfo.ads (Compare_Type): Document new field.
      	* sem_ch4.adb (Analyze_Comparison_Equality_Op): If the entity is
      	already present, set the Compare_Type on overloaded operands if it
      	is present on the node.
      	* sem_ch12.adb (Check_Private_View): Look into the Compare_Type
      	instead of the Etype for comparison operators.
      	(Copy_Generic_Node): Remove obsolete code for comparison
      	operators.
      	(Save_Global_References.Save_References): Do not walk into the
      	descendants of N_Implicit_Label_Declaration nodes.
      	(Save_Global_References.Set_Global_Type): Look into the
      	Compare_Type instead of the Etype for comparison operators.
      	* sem_res.adb (Resolve_Comparison_Op): Set Compare_Type.
      	(Resolve_Equality_Op): Likewise.
      003fe135
    • Ronan Desplanques's avatar
      ada: Fix Ada.Directories.Modification_Time on Windows · 63eaa7ee
      Ronan Desplanques authored
      Before this patch, Ada.Directories.Modification_Time called
      GetFileAttributesExA under the hood on Windows. That would sometimes
      fail to work with files whose names were non-ASCII.
      
      This patch replaces the call to GetFileAttributesExA with a call to
      GetFileAttributesEx preceded by an encoding scheme conversion, as is
      done in other functions of the run-time library. This fixes the issues
      that were observed with the previous implementations.
      
      gcc/ada/
      
      	* adaint.c (__gnat_file_time): Fix Windows version.
      63eaa7ee
    • Eric Botcazou's avatar
      ada: Elide temporary for aliased array with unconstrained nominal subtype · a2e4afc6
      Eric Botcazou authored
      When the array is initialized with the result of a call to a function whose
      result type is unconstrained, then the result is allocated with its bounds,
      so the array can be rewritten as a renaming of the result in this case too.
      
      gcc/ada/
      
      	* exp_ch3.adb (Expand_N_Object_Declaration): Fold initialization
      	expression of Nominal_Subtype_Is_Constrained_Array constant into
      	the computation of Rewrite_As_Renaming and remove the constant.
      	Set it to True for an aliased array with unconstrained nominal
      	subtype if the subtype of the expression is also unconstrained.
      a2e4afc6
    • Piotr Trojanek's avatar
      ada: Fix expansion of type aspects with handling of aspects · de4f7051
      Piotr Trojanek authored
      The new handling of aspects stores the aspect expression as the
      Expression_Copy of the aspect and not as the Entity of the aspect
      identified. This has been changed for most of the aspects, but not for
      Type_Invariant and Default_Initial_Condition, which have custom
      expansion. Apparently this change only affects GNATprove and not GNAT.
      
      gcc/ada/
      
      	* exp_util.adb (Add_Own_DIC, Add_Own_Invariants): Store the aspect
      	expression in Expression_Copy.
      de4f7051
    • Yannick Moy's avatar
      ada: Rename Is_Limited_View to reflect actual query · 36fcb4b9
      Yannick Moy authored
      Function Sem_Aux.Is_Limited_View returns whether the type is
      "inherently limited" in a slightly different way from the "immutably
      limited" definition in Ada 2012. Rename for clarity.
      
      gcc/ada/
      
      	* exp_aggr.adb: Apply the renaming.
      	* exp_ch3.adb: Same.
      	* exp_ch4.adb: Same.
      	* exp_ch6.adb: Same.
      	* exp_ch7.adb: Same.
      	* exp_util.adb: Same.
      	* freeze.adb: Same.
      	* sem_aggr.adb: Same.
      	* sem_attr.adb: Same.
      	* sem_aux.adb: Alphabetize Is_Limited_Type. Rename.
      	* sem_aux.ads: Same.
      	* sem_ch3.adb: Apply the renaming.
      	* sem_ch6.adb: Same.
      	* sem_ch8.adb: Same.
      	* sem_prag.adb: Same.
      	* sem_res.adb: Same.
      	* sem_util.adb: Same.
      36fcb4b9
    • Viljar Indus's avatar
      ada: Implement Aspects as fields under nodes · 76bf4321
      Viljar Indus authored
      In the previous implementation Aspect Specifications were
      stored in a separate table and not directly under each node.
      This implementation included a lot of extra code that needed
      to be maintained manually.
      
      The new implementation stores Aspect_Specfications as a syntactic
      field under each node. This removes the extra code that was needed
      to store, traverse and clone aspects for nodes.
      
      gcc/ada/
      
      	* aspects.adb (Exchange_Aspects): Removed. This method was
      	typically called after a Rewrite method. Now since the Rewrite
      	switches the aspects between the new and the old node it is no
      	longer needed.
      	(Has_Aspects): Converted to a utility method that performs the same
      	before as the previous Has_Aspects field did. Meaning it shows whether
      	a node actually has aspects or not.
      	(Copy_Aspects): New utility method that performs a deep copy of the
      	From nodes aspects.
      	(Aspect_Specfications): Removed. No longer needed. Replaced
      	by the primitive operation for the Aspect_Specification fields.
      	(Set_Aspect_Specifications): Likewise.
      	(Aspect_Specifications_Hash_Table): Remove the table and all the
      	utility methods for storing the old aspects.
      	* aspects.ads: Likewise.
      	* atree.adb (Copy_Separate_Tree): Remove custom code for aspects.
      	(New_Copy): Likewise.
      	(Replace): Likewise.
      	(Rewrite): Likewise.
      	* exp_ch3.adb (Expand_N_Object_Declaration): Keep the aspects from the old node.
      	* exp_ch6.adb (Validate_Subprogram_Calls): Previously aspects were ignored
      	because they were not on the tree. Explicitly ignore them here
      	when traversing the tree.
      	* exp_unst.adb (Build_Tables): Likewise
      	* gen_il-fields.ads: Remove Has_Aspects and add
      	Aspect_Specifications fields.
      	* gen_il-gen-gen_nodes.adb: Add Aspect_Specification fields
      	for all nodes that can have aspects. Additionally add
      	Expression_Copy for Aspect_Speficiations to avoid reusing
      	the Associated_Node for generic instantiation and aspect
      	analysis.
      	* ghost.adb (Remove_Ignored_Ghost_Node): Remove call to Remove_Aspects.
      	The rewritten node is a Null_Statement that cannot have aspects
      	and there is not anything to gain from removing them from the
      	Orignal_Node of N since it technically is not part of the active
      	tree.
      	* inline.adb (Process_Formals_In_Aspects): Simplify code for node traversal.
      	* par-ch13.adb: Avoid setting the parent explicitly for the
      	Aspect_Specifications list. This is done explicitly in the setter.
      	* par-ch6.adb: Likewise.
      	* par_sco.adb (Traverse_Aspects): Handle early return.
      	* sem_ch10.adb: Simplify code for Analyze_Aspect_Specifications.
      	* sem_ch11.adb: Likewise.
      	* sem_ch12.adb (Analyze_Formal_Derived_Interface_Type): Keep the aspects from
      	the orignal node after rewrite.
      	(Analyze_Formal_Derived_Type): Likewise.
      	(Analyze_Formal_Interface_Type): Likewise.
      	(Analyze_Formal_Object_Declaration): Simplify code for
      	Analyze_Aspect_Specifications.
      	(Analyze_Formal_Package_Declaration): Likewise.
      	(Analyze_Formal_Subprogram_Declaration): Likewise.
      	(Analyze_Formal_Type_Declaration): Likewise.
      	(Analyze_Generic_Package_Declaration): Remove Exchange_Aspects.
      	The new node already has the correct aspects after the rewrite.
      	Also simplify code for Analyze_Aspect_Specifications.
      	(Analyze_Generic_Subprogram_Declaration): Likewise.
      	(Analyze_Package_Instantiation): Simplify code for
      	Analyze_Aspect_Specifications.
      	(Build_Instance_Compilation_Unit_Nodes): Remove explicit copy of
      	aspects that is no longer needed.
      	(Save_References): Update the traversal code to handle
      	Aspect_Specifications in the tree.
      	(Copy_Generic_Node): Remove explicit copy for aspects. New_Copy
      	took care of that already.
      	* sem_ch13.adb (Analyze_Aspect_Specifications): Add early return to simplify
      	code for its calls. Avoid reusing the Entity(Associated_Node)
      	field for storing the original expression. Instead use the
      	new Expression_Copy field since Entity(Associated_Node) is
      	also used in generic instantiation.
      	(Analyze_Aspects_On_Subprogram_Body_Or_Stub): Simlify call
      	to Analyze_Aspect_Specifications.
      	(Check_Aspect_At_End_Of_Declarations): Use Expression_Copy
      	instead of Entity.
      	(Check_Aspect_At_Freeze_Point): Likewise.
      	* sem_ch3.adb: Simplify calls to Analyze_Aspect_Specifications.
      	* sem_ch6.adb (Analyze_Abstract_Subprogram_Declaration): Simplify call to
      	Analyze_Aspect_Specifications.
      	(Analyze_Expression_Function): Keep the aspects from the
      	original node after a rewrite.
      	(Analyze_Generic_Subprogram_Body): Remove Exchange aspects
      	that is no longer needed. Simplify call to
      	Analyze_Aspect_Specifications.
      	(Analyze_Null_Procedure): Keep the aspects from the
      	original node after a rewrite.
      	(Analyze_Subprogram_Body_Helper): Simplify calls to
      	Analyze_Aspect_Specifications.
      	(Analyze_Subprogram_Declaration): Likewise.
      	* sem_ch7.adb (Analyze_Package_Body_Helper): Remove Exchange aspects
      	that is no longer needed. Simplify call to
      	Analyze_Aspect_Specifications.
      	(Analyze_Package_Declaration): Simplify call to
      	Analyze_Aspect_Specifications.
      	(Analyze_Private_Type_Declaration): Likewise.
      	* sem_ch8.adb: Simplify calls to
      	Analyze_Aspect_Specifications.
      	* sem_ch9.adb (Analyze_Entry_Body): Simplify call to
      	Analyze_Aspects_On_Subprogram_Body_Or_Stub.
      	(Analyze_Entry_Declaration): Simplify call to
      	Analyze_Aspect_Specifications.
      	(Analyze_Protected_Body): Likewise.
      	(Analyze_Protected_Type_Declaration): Likewise.
      	(Analyze_Single_Protected_Declaration): Keep the aspects from
      	the original node after a rewrite. Simplify call to
      	Analyze_Aspect_Specifications.
      	(Analyze_Single_Task_Declaration): Likewise.
      	(Analyze_Task_Body): Simplify call to
      	Analyze_Aspect_Specifications.
      	(Analyze_Task_Type_Declaration): Simplify calls to
      	Analyze_Aspect_Specifications.
      	* sem_dim.adb: Remove explicitly setting the parents
      	for the Aspect_Specification list.
      	* sem_disp.adb: Remove the with that is no longer
      	required since Aspect_Specifications is a node operation now.
      	* sem_util.adb (Copy_Node_With_Replacement): Remove explicit code for aspects.
      	* treepr.adb (Print_Field): Remove the version that was used for printing
      	aspects.
      	(Print_Node): Remove aspect specific code.
      76bf4321
    • Eric Botcazou's avatar
      ada: Minor tweaks for comparison operators · de4588f3
      Eric Botcazou authored
      No functional changes.
      
      gcc/ada/
      
      	* gen_il-gen-gen_nodes.adb (N_Op_Boolean): Fix description.
      	* sem_ch4.adb (Analyze_Comparison_Equality_Op): Tidy up.
      	* sem_ch12.adb (Copy_Generic_Node): Use N_Op_Compare subtype.
      de4588f3
    • Piotr Trojanek's avatar
      ada: Cleanup "not Present" on List_Id · 598409d3
      Piotr Trojanek authored
      gcc/ada/
      
      	* exp_ch6.adb, exp_disp.adb, sem_ch13.adb, sem_ch3.adb: Fix newly
      	detected violations.
      598409d3
    • Piotr Trojanek's avatar
      ada: Cleanup more "not Present" · afb52e6e
      Piotr Trojanek authored
      We had a GNATcheck rule that suggests replacing "not Present (...)" with
      "No (...)", but it only detected calls with a parameter of type Node_Id.
      Now this rules also detects parameters of type Elist_Id.
      
      gcc/ada/
      
      	* sem_ch3.adb, sem_ch4.adb, sem_eval.adb: Fix newly detected
      	violations.
      afb52e6e
    • Ronan Desplanques's avatar
      ada: Fix documentation of -gnatwc · f9e0e67b
      Ronan Desplanques authored
      -gnatwc has been correctly emitting warnings for expressions outside
      of tests for a while, but its documentation in the user's guide had
      never been updated to reflect that. Also, the documentation used
      "conditional expressions" to designate boolean expressions, but
      "conditional expressions" has been defined by Ada 2012 to designate
      if expressions and case expressions. This patch fixes those issues.
      
      gcc/ada/
      
      	* doc/gnat_ugn/building_executable_programs_with_gnat.rst: Fix
      	-gnatwc documentation.
      	* gnat_ugn.texi: Regenerate.
      f9e0e67b
    • Steve Baird's avatar
      ada: New Local_Restrictions and User_Aspect aspects. · 9daee425
      Steve Baird authored
      A GNAT-defined aspect, Local_Restrictions, is defined.
      This provides a way of enforcing a given restriction for an individual
      subprogram (and its call-closure) without requiring that the entire
      program satisfy the restriction.
      A GNAT-defined aspect, User_Aspect, is defined.
      This (along with the new User_Aspect_Definition configuration pragma) provides
      a way of naming a set of aspect specifications which can then be applied
      to multiple declarations without textual repetition of the set.
      
      gcc/ada/
      
      	* local_restrict.ads: A new package. Declares Local_Restriction
      	enumeration type and provides operations to check for local
      	restriction violations.
      	* local_restrict.adb: Corresponding package body. Replace "not
      	Present (X)" calls with "No (X)" calls.
      	* aspects.ads: Add a new enumeration elements,
      	Aspect_Local_Restrictions and Aspect_User_Aspect, to the Aspect_Id
      	enumeration type. Update Aspect_Id-indexed aggregates. Add nested
      	package User_Aspect_Support to manage two pieces of state. One is
      	a map from identifiers to User_Aspect_Definition pragmas (updated
      	when such a pragma is encountered). The other is an
      	access-to-subprogram variable that is introduced in order to keep
      	the bulk of semantics out of the closure of package Aspects while
      	allowing a call from aspects.adb to the sem_ch13 procedure that
      	analyzes a User_Aspect aspect specification.
      	* aspects.adb (Find_Aspect): Cope with a case of a block statement
      	with an empty parent. It is not clear whether this is papering
      	over a compiler bug. Add indirect call through the aforementioned
      	access-to-subprogram variable when Find_Aspect enounters an
      	unanalyzed User_Aspect aspect specification. If Find_Aspect is
      	called looking for aspect Foo, then a User_Aspect specification
      	might generate (during analysis) a Foo aspect specification. So
      	the Find_Aspect call needs to trigger that analysis if it has not
      	already taken place. Provide a body for package
      	User_Aspect_Support. Replace "not Present (X)" call with "No (X)"
      	call.
      	* freeze.adb (Freeze_Subprogram): Check local restriction
      	compatibility when a dispatching operation is overridden.
      	* par-prag.adb: Add support for parsing a User_Aspect_Definition
      	pragma.
      	* restrict.ads: We'd like to have the body of package Restrict
      	include a call to a procedure declared in package Local_Restrict.
      	Doing that in the obvious way pulls most of semantics into the
      	closure of package Restrict, and that turns out to cause problems.
      	So we introduce a level of indirection and instead call through an
      	access-to-subprogram value. In this unit, we declare the
      	access-to-subprogram type and object.
      	* restrict.adb (Check Restriction): When a construct is
      	encountered that could violate a global restriction (depending on
      	whether the given restriction is in effect), Check_Restriction is
      	called. At this point, we also check for a violation of any
      	corresponding local restriction that is in effect. For reasons
      	described above, this check is performed via an indirect call.
      	* sem_ch13.ads (Parse_Aspect_Local_Restrictions): A new function,
      	similar to the existing Parse_Aspect_Xxx subprograms.
      	* sem_ch13.adb: Perform semantic analysis of Local_Restrictions
      	and User_Aspect aspect specifications. Declare and call new
      	Validate_Aspect_Local_Restrictions and
      	Analyze_User_Aspect_Aspect_Specification procedures (a reference
      	to the latter is registered during package elaboration). In
      	Analyze_Aspect_Specifications, do not set the Analyzed flag of a
      	User_Aspect aspect specification. Replace "not Present (X)" call
      	with "No (X)" call. Replace 'Image with 'Img in a case where the
      	prefix of the attribute reference is an object; this is done to
      	accomodate older compilers.
      	* sem_ch6.adb (Check_Subtype_Conformant): Include in subtype
      	conformance check a check for overriding-related compatibility of
      	local restrictions.
      	* sem_ch8.adb (Analyze_Subprogram_Renaming): In the case of an
      	instance of a generic that takes a formal subprogram, check that
      	formal and actual are compatible with respect to local
      	restrictions.
      	* sem_prag.adb: Add support for User_Aspect_Definition pragma.
      	* sem_res.adb (Resolve_Call): Check caller/callee compatibility
      	with respect to local restrictions.
      	* snames.ads-tmpl: Add Name_Local_Restrictions, Name_User_Aspect,
      	and Name_User_Aspect_Definition constants.
      	* doc/gnat_rm/implementation_defined_aspects.rst: Document new
      	aspects.
      	* doc/gnat_rm/implementation_defined_pragmas.rst: Document new
      	pragma.
      	* doc/gnat_ugn/the_gnat_compilation_model.rst: Add
      	User_Aspect_Definition to list of GNAT pragmas.
      	* gcc-interface/Make-lang.in: Add local_restrict.o.
      	* gnat-style.texi: Regenerate.
      	* gnat_rm.texi: Regenerate.
      	* gnat_ugn.texi: Regenerate.
      9daee425
    • Bob Duff's avatar
      ada: Error in prefix-notation call · 7c09fcfc
      Bob Duff authored
      The compiler gives a wrong error for a call of the form X.Y(...)
      when Y is inherited indirectly via an interface.
      
      gcc/ada/
      
      	* sem_ch4.adb (Is_Private_Overriding): Return True in the case
      	where a primitive operation is publicly inherited but privately
      	overridden.
      7c09fcfc
    • Piotr Trojanek's avatar
      ada: Remove duplicated code for expansion of packed array assignments · fe11fa6b
      Piotr Trojanek authored
      Expansion of assignments to packed array objects has two cases and
      had duplicated code for both these cases.
      
      gcc/ada/
      
      	* exp_pakd.adb (Expand_Bit_Packed_Element_Set): Remove code from the
      	ELSE branch, because it was is identical to code before the IF
      	statements itself.
      fe11fa6b
    • Piotr Trojanek's avatar
      ada: Simplify expansion of packed array assignments · dedaaa81
      Piotr Trojanek authored
      When expanding assignment to a packed array object, e.g. a formal
      parameter with mode OUT that might have unconstrained type, we took the
      component type and component size from the constrained actual subtype.
      It is simpler to take these properties from the nominal type of the
      assigned object.
      
      Semantics is unaffected, because constraining the array doesn't change
      the type or size of the array components.
      
      gcc/ada/
      
      	* exp_pakd.adb (Expand_Bit_Packed_Element_Set): Change Ctyp and Csiz
      	from variables to constants and compute them using the nominal type
      	of the assigned array object.
      dedaaa81
    • Piotr Trojanek's avatar
      ada: Fix extra whitespace after END keywords · 7385cd35
      Piotr Trojanek authored
      Style cleanup.
      
      gcc/ada/
      
      	* exp_pakd.adb, libgnarl/s-osinte__android.ads,
      	libgnarl/s-osinte__linux.ads, libgnarl/s-osinte__qnx.ads,
      	libgnarl/s-osinte__rtems.ads, libgnat/s-gearop.adb,
      	libgnat/s-poosiz.adb, sem_util.adb: Fix style.
      7385cd35
    • Piotr Trojanek's avatar
      ada: Avoid extra conversion in expansion of packed array assignments · aeca5b95
      Piotr Trojanek authored
      Expansion of assignments to packed array objects with string literals on
      the right-hand side, created an unnecessary conversion, i.e.:
      
        ... :=
          component_type
            (declare
               temp : component_type := "string_literal";
             begin
               temp)
      
      Now the expansion omits the outer type conversion.
      
      Cleanup; behavior is unaffected.
      
      gcc/ada/
      
      	* exp_pakd.adb (Expand_Bit_Packed_Element_Set): Simplify handling of
      	assignments with string literals.
      aeca5b95
    • Piotr Trojanek's avatar
      ada: Simplify handling of known values in expansion of packed arrays · 9eb5deb4
      Piotr Trojanek authored
      If an expression value is not known at compile time, it can be
      represented with No_Uint and doesn't require a dedicated flag.
      
      Code cleanup; behavior is unaffected.
      
      gcc/ada/
      
      	* exp_pakd.adb (Expand_Bit_Packed_Element_Set): Remove Rhs_Val_Known;
      	represent unknown value by assigning Rhs_Val with No_Uint.
      9eb5deb4
    • Piotr Trojanek's avatar
      ada: Change local variables to constants in expansion of packed arrays · 68040a69
      Piotr Trojanek authored
      Cleanup; semantics is unaffected.
      
      gcc/ada/
      
      	* exp_pakd.adb
      	(Expand_Bit_Packed_Element_Set): Change local Decl object from
      	variable to constant.
      	(Setup_Inline_Packed_Array_Reference): Likewise for Csiz.
      68040a69
    • Piotr Trojanek's avatar
      ada: Fix style in declaration of routine for expansion of packed arrays · 3335c4cd
      Piotr Trojanek authored
      Style cleanup.
      
      gcc/ada/
      
      	* exp_pakd.adb (Setup_Inline_Packed_Array_Reference): Remove extra
      	whitespace from the list of parameters.
      3335c4cd
    • Piotr Trojanek's avatar
      ada: Cleanup getting of actual subtypes · 98787e9c
      Piotr Trojanek authored
      Avoid potentially unnecessary call to Etype.
      
      gcc/ada/
      
      	* sem_util.adb (Get_Actual_Subtype_If_Available): Only call Etype
      	when necessary.
      98787e9c
    • Piotr Trojanek's avatar
      ada: Fix handling of actual subtypes for expanded names · b618441a
      Piotr Trojanek authored
      gcc/ada/
      
      	* sem_util.adb
      	(Get_Actual_Subtype,Get_Actual_Subtype_If_Available): Fix handling
      	of expanded names.
      b618441a
    • Viljar Indus's avatar
      ada: Simplify code for Ignore_Style_Checks_Pragmas · a4a24e58
      Viljar Indus authored
      gcc/ada/
      
      	* sem_prag.adb: (Analyze_Pragma): Reduce the number of nested if
      	statements.
      a4a24e58
    • Viljar Indus's avatar
      ada: Fix scope of semantic style_check pragmas · 95b8d1b5
      Viljar Indus authored
      Restore the original state of Style_Check pragmas before analyzing
      each compilation unit to avoid Style_Check pragmas from unit affecting
      the style checks of a different unit.
      
      gcc/ada/
      
      	* sem_ch10.adb: (Analyze_Compilation_Unit): Restore the orignal
      	state of style check pragmas at the end of the analysis.
      95b8d1b5
    • Eric Botcazou's avatar
      ada: Fix internal error on address of element of packed array component · 5a2d82e0
      Eric Botcazou authored
      This occurs when the component is part of a discriminated type and its
      offset depends on a discriminant, the problem being that the front-end
      generates an incomplete Bit_Position attribute reference.
      
      gcc/ada/
      
      	* exp_pakd.adb (Get_Base_And_Bit_Offset): Use the full component
      	reference instead of just the selector name for 'Bit_Position.
      5a2d82e0
Loading