Skip to content
Snippets Groups Projects
  1. May 05, 2021
    • Tom Tromey's avatar
      libcc1: use GCC_FE_VERSION_1 in C++ plugin · b65c0bcb
      Tom Tromey authored
      The C++ plugin defaults to version 0 of the base compiler API.
      However, this is a mistake -- version 1 was introduced before the C++
      API was even implemented.  This switches the default to version 1.
      Note that the compiler-side plugin will accept this version, so it
      should remain compatible.
      
      libcc1
      
      	* libcp1.cc (vtable): Use GCC_FE_VERSION_1.
      
      
      b65c0bcb
    • Tom Tromey's avatar
      libcc1: share GDB plugin code · 1a51cb29
      Tom Tromey authored
      The two GDB plugins in libcc1 share a fair amount of code.  This was
      done by copy-and-paste, though in reality the underlying code is
      nearly identical.
      
      libcc1
      
      	* libcp1.cc (struct libcp1): Derive from base_gdb_plugin.  Remove
      	shared code.
      	(class libcp1_connection): Remove.
      	(rpc): Remove.
      	(libcp1_set_verbose, libcp1_compile): Update.
      	(cp_call_binding_oracle, cp_call_symbol_address)
      	(cp_call_enter_scope, cp_call_leave_scope): Update.
      	* libcc1.cc (struct libcc1): Derive from base_gdb_plugin.  Remove
      	shared code.
      	(class libcc1_connection): Remove.
      	(c_call_binding_oracle, c_call_symbol_address): Update.
      	(rpc): Remove.
      	(libcc1_set_verbose, libcc1_compile): Update.
      	* gdbctx.hh: New file.
      
      
      1a51cb29
    • Tom Tromey's avatar
      libcc1: share basic context code · 06248232
      Tom Tromey authored
      Both plugins in libcc1 share a fair amount of boilerplate.  They both
      share error-emission code, context management code, and tree GC code.
      This patch unifies these two bodies of code, avoiding needless
      duplication.
      
      libcc1
      
      	* libcc1plugin.cc: Move code to context.cc.
      	* libcp1plugin.cc: Move code to context.cc.
      	* context.hh: New file.
      	* context.cc: New file.
      	* Makefile.in: Rebuild.
      	* Makefile.am (AM_CPPFLAGS): Add more gcc flags.
      	(CPPFLAGS_FOR_C, CPPFLAGS_FOR_CXX): Update.
      	(libcc1plugin_la_SOURCES): Add context.hh, context.cc.
      	(libcp1plugin_la_SOURCES): Likewise.
      
      
      06248232
    • Tom Tromey's avatar
      libcc1: use static_assert · 0ed83e1d
      Tom Tromey authored
      This changes one spot in libcc1 to use static_assert rather than the
      old-style array declaration.
      
      libcc1
      
      	* libcp1plugin.cc: Use static assert.
      
      
      0ed83e1d
    • Tom Tromey's avatar
      libcc1: use foreach · 7c4e5d5e
      Tom Tromey authored
      This changes libcc1 to ues foreach in a couple of spots.
      
      libcc1
      
      	* libcp1plugin.cc (plugin_context::mark): Use foreach.
      	* libcc1plugin.cc (plugin_context::mark): Use foreach.
      
      
      7c4e5d5e
    • Tom Tromey's avatar
      libcc1: unify compiler handling · 1d9c9726
      Tom Tromey authored
      Both libcc1 plugins have nearly identical copies of code to find the
      underlying compiler.  This seemed wasteful to me, so this patch
      unifies the copies.
      
      Two minor API changes were needed.
      
      First, the old code used a back-link from the compiler object to the
      plugin object to check the 'verbose' setting.  This patch adds a
      'verbose' setting directly to the compiler object instead.
      
      Second, the 'find' method implicitly knew which compiler base name
      ("gcc" or "g++") to use.  This patch makes this a parameter that is
      passed in by the plugin.
      
      libcc1
      
      	* libcp1.cc (compiler, compiler_triplet_regexp)
      	(compiler_driver_filename): Remove.
      	(libcp1::libcp1): Update.
      	(make_regexp, libcp1::compiler::find)
      	(libcp1::compiler_triplet_regexp::find)
      	(libcp1::compiler_driver_filename::find): Remove.
      	(libcp1_set_verbose, libcp1_set_arguments)
      	(libcp1_set_triplet_regexp, libcp1_set_driver_filename): Update.
      	* libcc1.cc (compiler, compiler_triplet_regexp)
      	(compiler_driver_filename): Remove.
      	(libcc1::libcc1): Update.
      	(make_regexp, libcc1::compiler::find)
      	(libcc1::compiler_triplet_regexp::find)
      	(libcc1::compiler_driver_filename::find): Remove.
      	(libcc1_set_verbose, libcc1_set_arguments)
      	(libcc1_set_triplet_regexp, libcc1_set_driver_filename): Update.
      	* compiler.cc: New file.
      	* compiler.hh: New file.
      	* Makefile.in: Rebuild.
      	* Makefile.am (libcc1_la_SOURCES): Add compiler.hh, compiler.cc.
      
      1d9c9726
    • Tom Tromey's avatar
      libcc1: use unique_ptr more · 30c9604c
      Tom Tromey authored
      This changes libcc1 to use unique_ptr in a few more places, removing
      some manual memory management.
      
      libcc1
      
      	* libcp1.cc (struct libcp1) <connection, compilerp>: Use
      	unique_ptr.
      	(~libcp1): Remove.
      	(libcp1_compile, libcp1_set_triplet_regexp)
      	(libcp1_set_driver_filename): Update.
      	* libcc1.cc (struct libcc1) <connection, compilerp>: Use
      	unique_ptr.
      	(~libcc1): Remove.
      	(libcc1_set_triplet_regexp, libcc1_set_driver_filename)
      	(libcc1_compile): Update.
      
      
      30c9604c
    • Tom Tromey's avatar
      libcc1: add more uses of 'deleter' · 0f237df2
      Tom Tromey authored
      This changes libcc1 to use the 'deleter' template in a few more
      places.  The template and basic specializations are moved to a new
      header, then some unmarshall functions are changed to use this code.
      This change avoids the need to repeat cleanup code in the
      unmarshallers.
      
      libcc1
      
      	* rpc.hh (deleter): Move template and some specializations to
      	deleter.hh.
      	(argument_wrapper<const T *>): Use cc1_plugin::unique_ptr.
      	* marshall.cc (cc1_plugin::unmarshall): Use
      	cc1_plugin::unique_ptr.
      	* marshall-cp.hh (deleter): New specializations.
      	(unmarshall): Use cc1_plugin::unique_ptr.
      	* deleter.hh: New file.
      
      
      0f237df2
    • Tom Tromey's avatar
      libcc1: add deleter objects · 0d5a0b9a
      Tom Tromey authored
      This adds deleter objects for various kinds of protocol pointers to
      libcc1.  Existing specializations of argument_wrapper are then
      replaced with a single specialization that handles all pointer types
      via the appropriate deleter.  The result here is a bit nicer because
      the argument_wrapper boilerplate code is completely shared, leaving
      just the memory-management detail to the particular specializations.
      
      libcc1
      
      	* rpc.hh (struct deleter): New template class and
      	specializations.
      	(argument_wrapper): Remove specializations.  Add specialization
      	for any pointer type.
      
      
      0d5a0b9a
    • Tom Tromey's avatar
      libcc1: use std::vector when building function types · e702c60e
      Tom Tromey authored
      This changes libcc1 to use std::vector in the code that builds
      function types.  This avoids some explicit memory management.
      
      libcc1
      
      	* libcp1plugin.cc (plugin_build_function_type): Use std::vector.
      	* libcc1plugin.cc (plugin_build_function_type): Use std::vector.
      
      
      e702c60e
    • Tom Tromey's avatar
      libcc1: use variadic templates for "rpc" · 410d5719
      Tom Tromey authored
      This changes libcc1 to use variadic templates for the "rpc" functions.
      This simplifies the code and removes some possibility for mistakes.
      
      libcc1
      
      	* libcp1.cc (rpc): Use variadic template.  Remove overloads.
      	* libcc1.cc (rpc): Use variadic template.  Remove overloads.
      
      
      410d5719
    • Tom Tromey's avatar
      libcc1: use variadic templates for "call" · dc6be7c0
      Tom Tromey authored
      This changes libcc1 to use variadic templates for the "call"
      functions.  The primary benefit is that this simplifies the code.
      
      libcc1
      
      	* rpc.hh (call): Use variadic template.  Remove overloads.
      	* marshall.hh (marshall): Add base overload.  Use variadic
      	template.
      
      
      dc6be7c0
    • Tom Tromey's avatar
      libcc1: delete copy constructor and assignment operators · c10a3b13
      Tom Tromey authored
      Change libcc1 to use "= delete" for the copy constructor and
      assignment operator, rather than the old approach of private methods
      that are nowhere defined.
      
      libcc1
      
      	* rpc.hh (argument_wrapper): Use delete for copy constructor.
      	* connection.hh (class connection): Use delete for copy
      	constructor.
      	* callbacks.hh (class callbacks): Use delete for copy constructor.
      
      
      c10a3b13
    • Tom Tromey's avatar
      libcc1: inline some simple methods · 41f43816
      Tom Tromey authored
      This changes libcc1 to inline a trivial method and to use the default
      constructor.
      
      libcc1
      
      	* connection.hh (~connection): Use default.
      	(print): Inline.
      	* connection.cc (cc1_plugin::connection::~connection)
      	(cc1_plugin::connection::print): Remove definitions.
      
      
      41f43816
    • Tom Tromey's avatar
      libcc1: use "override" · e1f5252e
      Tom Tromey authored
      This changes libcc1 to use "override" where appropriate.
      
      libcc1
      
      	* libcp1.cc (class compiler_triplet_regexp)
      	(class compiler_driver_filename, class libcp1_connection): Use
      	"override".
      	* libcc1.cc (class compiler_triplet_regexp)
      	(class compiler_driver_filename, class libcc1_connection): Use
      	"override".
      
      
      e1f5252e
    • Tom Tromey's avatar
      libcc1: use templates to unmarshall enums · 25d1a6ec
      Tom Tromey authored
      Now that C++11 can be used in GCC, libcc1 can be changed to use
      templates and type traits to handle unmarshalling all kinds of enums.
      
      libcc1
      
      	* marshall.hh (cc1_plugin::unmarshall): Use type traits.
      	* marshall-cp.hh (cc1_plugin::unmarshall): Remove overloads.
      	* marshall-c.hh: Remove.
      	* libcc1plugin.cc: Update includes.
      	* libcc1.cc: Update includes.
      
      
      25d1a6ec
    • Corentin Gay's avatar
      ctype support for libstdc++ on VxWorks · 523ca640
      Corentin Gay authored
      for  libstdc++-v3/ChangeLog
      
      	* acinclude.m4: Add VxWorks-specific case for the
      	configuration of ctypes.
      	* configure: Regenerate.
      	* config/locale/vxworks/ctype_members.cc: Add VxWorks-specific
      	version.
      	* config/os/vxworks/ctype_base.h: Adjust for VxWorks7+.
      	* config/os/vxworks/ctype_configure_char.cc: Likewise.
      	* config/os/vxworks/ctype_inline.h: Likewise.
      	* testsuite/28_regex/traits/char/isctype.cc: Defines
      	NEWLINE_IN_CLASS_BLANK if the target is VxWorks.
      	* testsuite/28_regex/traits/wchar_t/isctype.cc: Likewise.
      523ca640
    • Alexandre Oliva's avatar
      restore EH on x86-vx7r2 · 9aed32cc
      Alexandre Oliva authored
      x86-vx7r2 needs svr4_dbx_register_map, but the default in i386/i386.h
      was dbx_register_map, partially swapping ebp and esp in unwind info.
      
      i386/vxworks.h had a correct overrider, but it was conditional for
      vxworks < 7.  This patch reenables the overrider unconditionally.
      
      
      for  gcc/ChangeLog
      
      	* config/i386/vxworks.h (DBX_REGISTER_NUMBER): Make it
      	unconditional.
      9aed32cc
    • GCC Administrator's avatar
      Daily bump. · 99e8df7a
      GCC Administrator authored
      99e8df7a
  2. May 04, 2021
    • Jonathan Wakely's avatar
      libstdc++: Fix null dereferences in std::promise · 058d6ace
      Jonathan Wakely authored
      This fixes some ubsan errors in std::promise:
      
      future:1153:34: runtime error: member call on null pointer of type 'struct element_type'
      future:1153:34: runtime error: member access within null pointer of type 'struct element_type'
      
      The problem is that the check for a null pointer is done inside the
      _State::__Setter function, which is only evaluated after evaluating the
      _M_future->_M_set_result postfix-expression.
      
      This change adds a new promise::_M_state() helper for accessing
      _M_future, and moves the check for no shared state into there, instead
      of inside the __setter functions. The __setter functions are made
      always_inline, to avoid the situation where the linker selects the old
      version of set_value (without the _S_check call) and the new version of
      __setter (without the _S_check call) and so there is no check. With the
      always_inline attribute the old version of set_value will either inline
      the old __setter or call an extern definition of it, and the new
      set_value will do the check itself, so both versions do the check.
      
      libstdc++-v3/ChangeLog:
      
      	* include/std/future (promise::set_value): Check for existence
      	of shared state before dereferncing it.
      	(promise::set_exception, promise::set_value_at_thread_exit)
      	(promise::set_exception_at_thread_exit): Likewise.
      	(promise<R&>::set_value, promise<R&>::set_exception)
      	(promise<R&>::set_value_at_thread_exit)
      	(promise<R&>::set_exception_at_thread_exit): Likewise.
      	(promise<void>::set_value, promise<void>::set_exception)
      	(promise<void>::set_value_at_thread_exit)
      	(promise<void>::set_exception_at_thread_exit): Likewise.
      	* testsuite/30_threads/promise/members/at_thread_exit2.cc:
      	Remove unused variable.
      058d6ace
    • Jonathan Wakely's avatar
      libstdc++: Fix undefined behaviour in std::string · 789c57bc
      Jonathan Wakely authored
      This fixes a ubsan error when constructing a string with a null pointer:
      
      bits/basic_string.h:534:21: runtime error: applying non-zero offset 18446744073709551615 to null pointer
      
      The _M_construct function only cares whether the second pointer is
      non-null, so create a non-null value without undefined arithmetic.
      
      We can also pass the random_access_iterator_tag directly to the
      _M_construct function, to avoid going via the tag dispatching
      _M_construct_aux, because we know we have pointers not integers here.
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/basic_string.h (basic_string(const CharT*, const A&)):
      	Do not do arithmetic on null pointer.
      789c57bc
    • Jonathan Wakely's avatar
      libstdc++: Fix null dereference in pb_ds containers · ca871701
      Jonathan Wakely authored
      This fixes ubsan errors:
      
      ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp:533:15: runtime error: member access within null pointer of type 'struct entry'
      
      libstdc++-v3/ChangeLog:
      
      	* include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp
      	(find_key_pointer(key_const_reference, false_type))
      	(find_key_pointer(key_const_reference, true_type)): Do not
      	dereference null pointer.
      ca871701
    • Jonathan Wakely's avatar
      libstdc++ Fix undefined behaviour in testsuite · 6fb8b670
      Jonathan Wakely authored
      Fix some test bugs found by ubsan.
      
      libstdc++-v3/ChangeLog:
      
      	* testsuite/20_util/from_chars/3.cc: Use unsigned type to avoid
      	overflow.
      	* testsuite/24_iterators/reverse_iterator/2.cc: Do not add
      	non-zero value to null pointer.
      	* testsuite/25_algorithms/copy_backward/move_iterators/69478.cc:
      	Use past-the-end iterator for result.
      	* testsuite/25_algorithms/move_backward/69478.cc: Likewise.
      	* testsuite/25_algorithms/move_backward/93872.cc: Likewise.
      6fb8b670
    • David Edelsohn's avatar
      aix: encode function section · 8b5b814d
      David Edelsohn authored
      AIX XCOFF symbols can be labels or qualnames (names with an appended
      mapping class).  CSECTs must be declared with a mapping class.
      Within an assembler file, the symbol names with and without the mapping
      class are unique.  An object file symbol table only presents the symbol
      name without the mapping class, but the section of the symbol depends on
      the mapping class.
      
      The AIX XCOFF assembly language does not support first class aliases.
      GCC implements symbol aliases by emitting additional labels for the function
      or object.  When GCC encodes sections for a DECL, it must distinguish
      between the primary definition and the aliases, which don't have a
      mapping class encoding.
      
      	.globl foo[DS]
      	.globl .foo
      	.globl foo1
      	.globl .foo1
      	.csect foo[DS]
      foo:
      foo1:
      	.long .foo, TOC[tc0] 0
      	.csect .foo[PR]
      .foo:
      .foo1:
      
      The CSECT foo[DS] and label foo are distinct.  foo1 is another label (alias)
      for foo, and .foo1 is another label (alias) for .foo.  foo is the function
      descriptor and .foo is the code.
      
      This patch adds the [DS] mapping class to the encoding of FUNCTION_DECL
      but ensures that mapping class is not added to function aliases.
      
      rs6000_output_mi_thunk is updated to emit the function name that matches
      the behavior of GCC final.c for normal functions: get_fnname_from_decl based
      on the RTL name, not the DECL name.
      
      	* config/rs6000/rs6000-call.c (rs6000_output_mi_thunk): Use
      	get_fnname_from_decl for name of thunk.
      	* config/rs6000/rs6000.c (rs6000_declare_alias): Use assemble_name
      	and ASM_OUTPUT_LABEL.
      	(rs6000_xcoff_declare_function_name): Use assemble_name and
      	ASM_OUTPUT_LABEL.
      	(rs6000_xcoff_declare_object_name): Use ASM_OUTPUT_LABEL.
      	(rs6000_xcoff_encode_section_info): Don't add mapping class
      	for aliases.  Always add [DS] mapping class to primary
      	FUNCTION_DECL.
      	(rs6000_asm_weaken_decl): Don't explicitly add [DS].
      8b5b814d
    • Martin Sebor's avatar
      PR middle-end/100307 - spurious -Wplacement-new with negative pointer offset · 158cdc7b
      Martin Sebor authored
      gcc/ChangeLog:
      
      	PR middle-end/100307
      	* builtins.c (compute_objsize_r): Clear base0 for pointers.
      
      gcc/testsuite/ChangeLog:
      
      	PR middle-end/100307
      	* g++.dg/warn/Wplacement-new-size-9.C: New test.
      	* gcc.dg/tree-ssa/builtin-sprintf-warn-26.c: New test.
      158cdc7b
    • Martin Sebor's avatar
      Adjust strings in dg-warning directives (PR testsuite/100412). · 78624756
      Martin Sebor authored
      gcc/testsuite/ChangeLog:
      	* gcc.dg/Wvla-parameter-3.c: Use unique strings in directive names.
      78624756
    • Martin Sebor's avatar
      Adjust strings in dg-warning directives (PR testsuite/100412). · 141cce5c
      Martin Sebor authored
      gcc/testsuite/ChangeLog:
      	* gcc.dg/Wvla-parameter-2.c: Use unique strings in directive names.
      141cce5c
    • Jeff Law's avatar
      Make bfin-elf build again · b50ccaf6
      Jeff Law authored
      gcc/
      	* config/bfin/bfin.h (NOTICE_UPDATE_CC): Remove.
      b50ccaf6
    • Robin Dapp's avatar
      s390/testsuite: Fix oscbreak-1.c. · e4c707d2
      Robin Dapp authored
      Checking for an osc break is somewhat brittle especially with many
      passes potentially introducing new insns and moving them around.
      Therefore, only compile the test with -O1 -fschedule-insns in order
      to limit the influence of other passes.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/s390/oscbreak-1.c: Compile with -O1
      	-fschedule-insns
      e4c707d2
    • Segher Boessenkool's avatar
      Remove CC0 · bd1cd0d0
      Segher Boessenkool authored
      This removes CC0 and all directly related infrastructure.
      
      CC_STATUS, CC_STATUS_MDEP, CC_STATUS_MDEP_INIT, and NOTICE_UPDATE_CC
      are deleted and poisoned.  CC0 is only deleted (some targets use that
      name for something else).  HAVE_cc0 is automatically generated, and we
      no longer will do that after this patch.
      
      CC_STATUS_INIT is suggested in final.c to also be useful for ports that
      are not CC0, and at least arm seems to use it for something.  So I am
      leaving that alone, but most targets that have it could remove it.
      
      2021-05-04  Segher Boessenkool  <segher@kernel.crashing.org>
      
      	* caller-save.c: Remove CC0.
      	* cfgcleanup.c: Remove CC0.
      	* cfgrtl.c: Remove CC0.
      	* combine.c: Remove CC0.
      	* compare-elim.c: Remove CC0.
      	* conditions.h: Remove CC0.
      	* config/h8300/h8300.h: Remove CC0.
      	* config/h8300/h8300-protos.h: Remove CC0.
      	* config/h8300/peepholes.md: Remove CC0.
      	* config/i386/x86-tune-sched.c: Remove CC0.
      	* config/m68k/m68k.c: Remove CC0.
      	* config/rl78/rl78.c: Remove CC0.
      	* config/sparc/sparc.c: Remove CC0.
      	* config/xtensa/xtensa.c: Remove CC0.
      	(gen_conditional_move):  Use pc_rtx instead of cc0_rtx in a piece of
      	RTL where that is used as a placeholder only.
      	* cprop.c: Remove CC0.
      	* cse.c: Remove CC0.
      	* cselib.c: Remove CC0.
      	* df-problems.c: Remove CC0.
      	* df-scan.c: Remove CC0.
      	* doc/md.texi: Remove CC0.  Adjust an example.
      	* doc/rtl.texi: Remove CC0.  Adjust an example.
      	* doc/tm.texi: Regenerate.
      	* doc/tm.texi.in: Remove CC0.
      	* emit-rtl.c: Remove CC0.
      	* final.c: Remove CC0.
      	* fwprop.c: Remove CC0.
      	* gcse-common.c: Remove CC0.
      	* gcse.c: Remove CC0.
      	* genattrtab.c: Remove CC0.
      	* genconfig.c: Remove CC0.
      	* genemit.c: Remove CC0.
      	* genextract.c: Remove CC0.
      	* gengenrtl.c: Remove CC0.
      	* genrecog.c: Remove CC0.
      	* haifa-sched.c: Remove CC0.
      	* ifcvt.c: Remove CC0.
      	* ira-costs.c: Remove CC0.
      	* ira.c: Remove CC0.
      	* jump.c: Remove CC0.
      	* loop-invariant.c: Remove CC0.
      	* lra-constraints.c: Remove CC0.
      	* lra-eliminations.c: Remove CC0.
      	* optabs.c: Remove CC0.
      	* postreload-gcse.c: Remove CC0.
      	* postreload.c: Remove CC0.
      	* print-rtl.c: Remove CC0.
      	* read-rtl-function.c: Remove CC0.
      	* reg-notes.def: Remove CC0.
      	* reg-stack.c: Remove CC0.
      	* reginfo.c: Remove CC0.
      	* regrename.c: Remove CC0.
      	* reload.c: Remove CC0.
      	* reload1.c: Remove CC0.
      	* reorg.c: Remove CC0.
      	* resource.c: Remove CC0.
      	* rtl.c: Remove CC0.
      	* rtl.def: Remove CC0.
      	* rtl.h: Remove CC0.
      	* rtlanal.c: Remove CC0.
      	* sched-deps.c: Remove CC0.
      	* sched-rgn.c: Remove CC0.
      	* shrink-wrap.c: Remove CC0.
      	* simplify-rtx.c: Remove CC0.
      	* system.h: Remove CC0.  Poison NOTICE_UPDATE_CC, CC_STATUS_MDEP_INIT,
      	CC_STATUS_MDEP, and CC_STATUS.
      	* target.def: Remove CC0.
      	* valtrack.c: Remove CC0.
      	* var-tracking.c: Remove CC0.
      bd1cd0d0
    • Richard Biener's avatar
      tree-optimization/100414 - compute dominance info in phiopt · 7a389766
      Richard Biener authored
      phiopt now has dominator queries but fails to compute dominance
      info.
      
      2021-05-04  Richard Biener  <rguenther@suse.de>
      
      	PR tree-optimization/100414
      	* tree-ssa-phiopt.c (get_non_trapping): Do not compute dominance
      	info here.
      	(tree_ssa_phiopt_worker): But unconditionally here.
      
      	* gcc.dg/pr100414.c: New testcase.
      7a389766
    • Tobias Burnus's avatar
      OpenMP: Support complex/float in && and || reduction · 1580fc76
      Tobias Burnus authored
      C/C++ permit logical AND and logical OR also with floating-point or complex
      arguments by doing an unequal zero comparison; the result is an 'int' with
      value one or zero.  Hence, those are also permitted as reduction variable,
      even though it is not the most sensible thing to do.
      
      gcc/c/ChangeLog:
      
      	* c-typeck.c (c_finish_omp_clauses): Accept float + complex
      	for || and && reductions.
      
      gcc/cp/ChangeLog:
      
      	* semantics.c (finish_omp_reduction_clause): Accept float + complex
      	for || and && reductions.
      
      gcc/ChangeLog:
      
      	* omp-low.c (lower_rec_input_clauses, lower_reduction_clauses): Handle
      	&& and || with floating-point and complex arguments.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/gomp/clause-1.c: Use 'reduction(&:..)' instead of '...(&&:..)'.
      
      libgomp/ChangeLog:
      
      	* testsuite/libgomp.c-c++-common/reduction-1.c: New test.
      	* testsuite/libgomp.c-c++-common/reduction-2.c: New test.
      	* testsuite/libgomp.c-c++-common/reduction-3.c: New test.
      1580fc76
    • Nick Clifton's avatar
      Replace AC_PROG_CC with AC_PROG_CC_C99 in top level configure file. · 91743432
      Nick Clifton authored
      2021-05-04  Nick Clifton  <nickc@redhat.com>
      
      	* configure.ac (AC_PROG_CC): Replace with AC_PROG_CC_C99.
      	* configure: Regenerate.
      91743432
    • Jonathan Wakely's avatar
      libstdc++: Do not use deduced return type for std::visit [PR 100384] · af5b2b91
      Jonathan Wakely authored
      This avoids errors outside the immediate context when std::visit is an
      overload candidate because of ADL, but not actually viable.
      
      The solution is to give std::visit a non-deduced return type. New
      helpers are introduced for that, and existing ones refactored slightly.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/100384
      	* include/std/variant (__get_t): New alias template yielding the
      	return type of std::get<N> on a variant.
      	(__visit_result_t): New alias template yielding the result of
      	std::visit.
      	(__same_types): Move into namespace __detail::__variant.
      	(__check_visitor_results): Likewise. Use __invoke_result_t and
      	__get_t.
      	(__check_visitor_result): Remove.
      	(visit): Use __visit_result_t for return type.
      	* testsuite/20_util/variant/100384.cc: New test.
      af5b2b91
    • Jonathan Wakely's avatar
      libstdc++: Remove _GLIBCXX_USE_INT128 autoconf macro · ad0a3be4
      Jonathan Wakely authored
      We don't need to decide whether to use __int128 when running configure,
      we can do so at compilation time by seeing if __SIZEOF_INT128__ is
      defined and if it's greater than __SIZEOF_LONG_LONG__.
      
      This removes another unnecessary architecture-specific config macro in
      <bits/c++config.h>, so the same header can work for 32-bit or 64-bit
      compilation on AIX.
      
      libstdc++-v3/ChangeLog:
      
      	* acinclude.m4 (GLIBCXX_ENABLE_INT128_FLOAT128): Remove
      	checks for __int128 and rename to GLIBCXX_ENABLE_FLOAT128.
      	* config.h.in: Regenerate.
      	* configure: Regenerate.
      	* configure.ac: Adjust to use GLIBCXX_ENABLE_FLOAT128.
      	* include/bits/random.h (_Select_uint_least_t<s, 1>):
      	Use __SIZEOF_INT128__ to decide whether to use __int128.
      	* include/std/charconv (__to_chars_unsigned_type): Likewise.
      ad0a3be4
    • Eric Botcazou's avatar
      Reuse non-gimple_reg variable for inlining · 93f8cb49
      Eric Botcazou authored
      When a call to a function is inlined and takes a parameter whose type is not
      gimple_reg, a local variable is created in the caller to hold a copy of the
      argument passed in the call with the following comment:
      
            /* We may produce non-gimple trees by adding NOPs or introduce
               invalid sharing when operand is not really constant.
               It is not big deal to prohibit constant propagation here as
               we will constant propagate in DOM1 pass anyway.  *
      
      Of course the second sentence of the comment does not apply to non-gimple_reg
      values, unless they get SRAed later, because we don't do constant propagation
      for them.  This for example prevents two identical calls to a pure function
      from being merged in the attached Ada testcase.
      
      Therefore the attached patch attempts to reuse a read-only or non-addressable
      local DECL of the caller, the hitch being that expand_call_inline needs to be
      prevented from creating a CLOBBER for the case where it ends uo being reused.
      
      gcc/
      	* tree-inline.c (insert_debug_decl_map): Delete.
      	(copy_debug_stmt): Minor tweak.
      	(setup_one_parameter): Do not use a variable if the value is either
      	a read-only DECL or a non-addressable local variable in the caller.
      	In this case, insert the debug-only variable in the map manually.
      	(expand_call_inline): Do not generate a CLOBBER for these values.
      	* tree-inline.h (debug_map): Minor tweak.
      93f8cb49
    • Eric Botcazou's avatar
      Fix libiberty link failures in LTO mode for MinGW · f418bc3c
      Eric Botcazou authored
      The test for the presence of variables (really symbols) does not work
      when you add -Ox -flto to CFLAGS:
      
        for v in $vars; do
          AC_MSG_CHECKING([for $v])
          AC_CACHE_VAL(libiberty_cv_var_$v,
            [AC_LINK_IFELSE([AC_LANG_PROGRAM([[int *p;]],[[extern int $v [];
                                               p = $v;]])],
                            [eval "libiberty_cv_var_$v=yes"],
                            [eval "libiberty_cv_var_$v=no"])])
          if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then
            AC_MSG_RESULT(yes)
            AC_DEFINE_UNQUOTED($n)
          else
            AC_MSG_RESULT(no)
          fi
        done
      
      because the assignment to 'p' is optimized away by LTO.  This is visible
      on MinGW platforms in the form of a link failure for sys_siglist.
      
      There is another link failures for stpcpy: the symbol is both referenced
      by libiberty's pex-win32.c and provided by libiberty's stpcpy.c, so it
      needs to have a linkage to be resolved in LTO mode.
      
      libiberty/
      	* configure.ac: Make test for variables more robust.
      	* configure: Regenerate.
      gcc/
      	* builtins.c (builtin_with_linkage_p): Return true for stp[n]cpy.
      	* symtab.c (symtab_node::output_to_lto_symbol_table_p): Tidy up.
      f418bc3c
    • Richard Biener's avatar
      Restrict gcc.dg/tree-ssa/ssa-dse-26.c · 1b0f5700
      Richard Biener authored
      This restricts the testcase to the target where it exposes the
      situation fixed with g:e9d297a1
      which targets BIT_FIELD_REFs created by fold_truth_andor.
      
      This avoids strange dejagnu limits with overly long target lists
      and simplifies the tests.
      
      2021-05-04  Richard Biener  <rguenther@suse.de>
      
      	* gcc.dg/tree-ssa/ssa-dse-26.c: Skip on !lp64 targets,
      	simplify dump scanning down to one case.
      1b0f5700
    • Richard Biener's avatar
      tree-optimization/100329 - avoid reassociating asm goto defs · a310bb73
      Richard Biener authored
      This avoids reassociating asm goto defs because we have no idea
      on which outgoing edge to insert defs.
      
      2021-05-04  Richard Biener  <rguenther@suse.de>
      
      	PR tree-optimization/100329
      	* tree-ssa-reassoc.c (can_reassociate_p): Do not reassociate
      	asm goto defs.
      	(insert_stmt_after): Assert we're not running into asm goto.
      
      	* gcc.dg/torture/pr100329.c: New testcase.
      a310bb73
    • Richard Biener's avatar
      tree-optimization/100398 - avoid DSE of control flow stmt · 2326627e
      Richard Biener authored
      The following makes sure to preserve control altering stmts
      when removing trivially dead stmts in DSE.
      
      2021-05-04  Richard Biener  <rguenther@suse.de>
      
      	PR tree-optimization/100398
      	* tree-ssa-dse.c (pass_dse::execute): Preserve control
      	altering stmts.
      
      	* gcc.dg/torture/pr100398.c: New testcase.
      2326627e
Loading