1. 21 Aug, 2018 30 commits
    • [Ada] Spurious "Duplicated symbol" error with discriminated tasks · 2e5df295
      This patch fixes a spurious error in a program that contains a
      discriminated task type and several of its subtype in the same
      declarative part, when the corresponding discriminant constraints are
      expressions.
      
      2018-08-21  Ed Schonberg  <schonberg@adacore.com>
      
      gcc/ada/
      
      	* sem_util.ads, sem_util.adb (New_External_Entity): Type of
      	Suffix_Index must be Int, not Nat, so that a negative value can
      	be used to generate a unique name for an external object, as
      	specified in Tbuild.New_External_Name.
      	(Scope_Within): Handle private type whose completion is a
      	synchronized type (For unnesting).
      	* itypes.ads, itypes.adb (Create_Itype): Ditto
      	* sem_ch3.adb (Constrain_Corresponding_Record): Generate a
      	unique name for the created subtype, because there may be
      	several discriminated tasks present in the same scope, and each
      	needs its distinct corresponding record subtype.
      
      gcc/testsuite/
      
      	* gnat.dg/task1.adb, gnat.dg/task1.ads, gnat.dg/task1_pkg.adb,
      	gnat.dg/task1_pkg.ads: New testcase.
      
      From-SVN: r263716
      Ed Schonberg committed
    • [Ada] Define versions of dimension system for Float and Long_Float · c4b9b291
      The dimension system in System.Dim.Mks is based on Long_Long_Float,
      which may not be convenient to people who want to use Float or
      Long_Float as basis. These new files provide units that define the
      dimension system based on Float in System.Dim.Float_Mks and on
      Long_Float in System.Dim.Long_Mks.
      
      Child packages Other_Prefixes and Mks_IO are also defined appropriately,
      with new instantiations for the various sizes of floating-point types.
      
      2018-08-21  Yannick Moy  <moy@adacore.com>
      
      gcc/ada/
      
      	* doc/gnat_ugn/gnat_and_program_execution.rst: Update
      	documentation of dimensionality analysis.
      	* gnat_ugn.texi: Regenerate.
      	* Makefile.rtl, impunit.adb: Consider the new units.
      	* libgnat/s-dfmkio.ads, libgnat/s-dfmopr.ads,
      	libgnat/s-diflmk.ads: New units based on Float.
      	* libgnat/s-dilomk.ads, libgnat/s-dlmkio.ads,
      	libgnat/s-dlmopr.ads: New units based on Long_Float.
      	* libgnat/s-dmotpr.ads: Rename to libgnat/s-dgmgop.ads and turn
      	into an instance of
      	System.Dim.Generic_Mks.Generic_Other_Prefixes.
      	* libgnat/s-dimmks.ads: Rename to libgnat/s-digemk.ads and turn
      	into an instance of System.Dim.Generic_Mks.
      
      From-SVN: r263715
      Yannick Moy committed
    • [Ada] General purpose doubly linked list for compiler and tool use · 2201fa7b
      This patch adds unit GNAT.Lists which currently contains the
      implementation of a general purpose doubly linked list intended for use
      by the compiler and the tools around it.
      
      2018-08-21  Hristian Kirtchev  <kirtchev@adacore.com>
      
      gcc/ada/
      
      	* impunit.adb: Add g-lists to the set of non-implementation
      	units.
      	* libgnat/g-lists.adb, libgnat/g-lists.ads: New unit.
      	* Makefile.rtl: Add g-lists to the set of non-tasking units.
      	* gcc-interface/Make-lang.in: Add g-lists to the set of files
      	used by gnat1.
      
      gcc/testsuite/
      
      	* gnat.dg/linkedlist.adb: New testcase.
      
      From-SVN: r263714
      Hristian Kirtchev committed
    • [Ada] Fix scope computation for entry bodies and accept alternatives · c36d21ee
      2018-08-21  Ed Schonberg  <schonberg@adacore.com>
      
      gcc/ada/
      
      	* exp_ch9.adb (Reset_Scopes): Do not recurse into type
      	declarations when resetting the scope of entities declared the
      	procedures generated for entry bodies and accept alternatives.
      	Use the entity of the procedure declaration, not its body, as
      	the new scope.
      
      From-SVN: r263713
      Ed Schonberg committed
    • [Ada] Crash on entry in generic with dynamic elaboration checks · 3f99a611
      This patch modifies the set of attributes that applies to entries and
      entry families to include elaboration entities used by the
      access-before-elaboration mechanism.
      
      2018-08-21  Hristian Kirtchev  <kirtchev@adacore.com>
      
      gcc/ada/
      
      	* einfo.adb (Elaboration_Entity): Include entries and entry
      	families in the set of legal entities.
      	(Elaboration_Entity_Required): Include entries and entry
      	families in the set of legal entities.
      	(Set_Elaboration_Entity): Include entries and entry families in
      	the set of legal entities.
      	(Set_Elaboration_Entity_Required): Include entries and entry
      	families in the set of legal entities.
      	(Write_Field13_Name): Update the output of attribute
      	Elaboration_Entity.
      	* einfo.ads: Attributes Elaboration_Entity and
      	Elaboration_Entity_Required now apply to entries and entry
      	families.
      
      gcc/testsuite/
      
      	* gnat.dg/elab6.adb, gnat.dg/elab6.ads, gnat.dg/elab6_pkg.adb,
      	gnat.dg/elab6_pkg.ads: New testcase.
      
      From-SVN: r263712
      Hristian Kirtchev committed
    • [Ada] Set_Targ: add a CodePeer annotation · 83fadfd9
      2018-08-21  Arnaud Charlet  <charlet@adacore.com>
      
      gcc/ada/
      
      	* set_targ.adb: Mark some CodePeer message as Intentional.
      
      From-SVN: r263711
      Arnaud Charlet committed
    • [Ada] Compiler abort on call to expr. function for default discriminant · 8a2f6bbe
      If a discriminant specification has a default that is a call to an
      expression function, that function has to be frozen at the point of a
      call to the initialization procedure for an object of the record type,
      even though the call does not appear to come from source.
      
      2018-08-21  Ed Schonberg  <schonberg@adacore.com>
      
      gcc/ada/
      
      	* sem_res.adb (Resolve_Call): Force the freezing of an
      	expression function that is called to provide a default value
      	for a defaulted discriminant in an object initialization.
      
      gcc/testsuite/
      
      	* gnat.dg/expr_func5.adb: New testcase.
      
      From-SVN: r263710
      Ed Schonberg committed
    • [Ada] Dynamically resizable, load factor-based hash table · d8251d00
      This patch introduces a dynamically resizable, load factor-based hash
      table in unit GNAT.Dynamic_HTables.
      
      2018-08-21  Hristian Kirtchev  <kirtchev@adacore.com>
      
      gcc/ada/
      
      	* libgnat/g-dynhta.adb, libgnat/g-dynhta.ads: New package
      	Dynamic_HTable.
      
      gcc/testsuite/
      
      	* gnat.dg/dynhash.adb: New testcase.
      
      From-SVN: r263709
      Hristian Kirtchev committed
    • [Ada] Enumeration types with non-standard representation · f20b5ef4
      The compiler may report errors on enumeration types with non-standard
      representation (i.e. at least one literal has a representation value
      different from its 'Pos value) processing attribute 'Enum_Rep.
      
      It may also generate wrong code for the evaluation of 'Enum_Rep raising
      Constraint_Error at runtime.
      
      2018-08-21  Javier Miranda  <miranda@adacore.com>
      
      gcc/ada/
      
      	* checks.ads (Determine_Range): Adding documentation.
      	* checks.adb (Determine_Range): Don't deal with enumerated types
      	with non-standard representation.
      	(Convert_And_Check_Range): For conversion of enumeration types
      	with non standard representation to an integer type perform a
      	direct conversion to the target integer type.
      
      gcc/testsuite/
      
      	* gnat.dg/enum4.adb: New testcase.
      
      From-SVN: r263708
      Javier Miranda committed
    • [Ada] Handle pragmas that come from aspects for GNATprove · b7e875ce
      In GNATprove we appear to abuse a routine related to cross-references and
      expect it to deliver exact results, which is not what it was designed for.
      
      This patch is a temporary solution to avoid crashes in GNATprove; it doesn't
      affect the frontend or other backends, because this code is used exclusively
      by GNATprove (it is located in the frontend for technical reasons). No tests
      provided.
      
      2018-08-21  Piotr Trojanek  <trojanek@adacore.com>
      
      gcc/ada/
      
      	* lib-xref.ads, lib-xref-spark_specific.adb
      	(Enclosing_Subprogram_Or_Library_Package): Now roughtly works
      	for pragmas that come from aspect specifications.
      
      From-SVN: r263707
      Piotr Trojanek committed
    • [Ada] Add sa_messages.ad[sb] for SPARK 2014 · d40800cf
      These new source files will make it possible to build SPARK 2014 from
      a snapshot of GCC FSF sources.
      
      2018-08-21  Pierre-Marie de Rodat  <derodat@adacore.com>
      
      gcc/ada/
      
      	* sa_messages.ads, sa_messages.adb: New source files.
      
      From-SVN: r263706
      Pierre-Marie de Rodat committed
    • * testsuite/18_support/new_nothrow.cc: XFAIL on AIX. · bce17c39
      From-SVN: r263703
      David Edelsohn committed
    • Update global reviewers list · 3d20537c
      2018-08-21  Richard Sandiford  <richard.sandiford@arm.com>
      
      	* MAINTAINERS: Add self to global reviewers list.
      
      From-SVN: r263702
      Richard Sandiford committed
    • tree.c (find_decls_types_r): Do not check for redundant typedefs. · f4290962
      
      	* tree.c (find_decls_types_r): Do not check for redundant typedefs.
      	* tree.h (is_redundant_typedef): Remove.
      	* dwarf2out.c (is_redundant_typedef): Turn into static function.
      
      From-SVN: r263699
      Jan Hubicka committed
    • [Ada] Bump copyright notices to 2018 · b6490084
      2018-08-21  Pierre-Marie de Rodat  <derodat@adacore.com>
      
      gcc/ada/
      
      	* libgnarl/a-intnam__dragonfly.ads,
      	libgnarl/s-osinte__dragonfly.adb,
      	libgnarl/s-osinte__dragonfly.ads, libgnarl/s-osinte__gnu.adb,
      	libgnarl/s-osinte__gnu.ads, libgnarl/s-osinte__hpux-dce.adb,
      	libgnarl/s-osinte__hpux-dce.ads,
      	libgnarl/s-taprop__hpux-dce.adb,
      	libgnarl/s-taspri__hpux-dce.ads: Bump copyright notices to 2018.
      
      From-SVN: r263698
      Pierre-Marie de Rodat committed
    • tree.c (free_lang_data_in_decl): Remove types from DECL_CONTEXT when possible. · 143b379d
      
      	* tree.c (free_lang_data_in_decl): Remove types from DECL_CONTEXT
      	when possible.
      
      From-SVN: r263697
      Jan Hubicka committed
    • Fix DSE big-endian subreg crash on AArch64. · daa97158
      This patch fixes an ICE that would happen when extract_low_bits
      is called with modes for which you can't extract a valid subreg.
      e.g. taking a 32 bytes subreg from a 48 byte mode.
      
      The ICE happens because convert_modes which eventually calls
      simplify_gen_subreg does not expect the convertion to fail.
      
      The assert in gen_lowpart_general would then be hit.  The patch
      changes it to validate the subreg before trying to convert the
      modes.  If the subreg is not possible we return NULL_RTX and bail
      out early.
      
      gcc/ChangeLog:
      
      2018-08-21  Tamar Christina  <tamar.christina@arm.com>
      
      	* expmed.c (extract_low_bits): Reject invalid subregs early.
      
      gcc/testsuite/ChangeLog:
      
      2018-08-21  Tamar Christina  <tamar.christina@arm.com>
      
      	* gcc.target/aarch64/large_struct_copy.c: New test.
      
      From-SVN: r263696
      Tamar Christina committed
    • Remove redundant { dg-do run } directives in tests · 25d40363
      These tests accidentally had two dg-do directives. Only the second one
      is needed.
      
      	* testsuite/26_numerics/bit/bitops.count/countl_one.cc: Remove
      	redundant dg-do directive.
      	* testsuite/26_numerics/bit/bitops.count/countl_zero.cc: Likewise.
      	* testsuite/26_numerics/bit/bitops.count/countr_one.cc: Likewise.
      	* testsuite/26_numerics/bit/bitops.count/countr_zero.cc: Likewise.
      	* testsuite/26_numerics/bit/bitops.count/popcount.cc: Likewise.
      
      From-SVN: r263695
      Jonathan Wakely committed
    • Restrict the pr86763 test to *-*-linux* targets · 2b96783a
      clock_gettime is not available on some baremetal targets
      and may require -lrt on some non-linux targets.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/torture/pr86763.C: Restrict to *-*-linux*.
      
      From-SVN: r263694
      Szabolcs Nagy committed
    • re PR middle-end/86121 (missing -Wstringop-overflow on strcpy followed by strcat) · 7d4ae1fb
      2018-08-21  Bernd Edlinger  <bernd.edlinger@hotmail.de>
      
              PR middle-end/86121
              * tree-ssa-strlen.c (adjust_last_stmt): Avoid folding away undefined
              behaviour.
      
      testsuite:
      2018-08-21  Bernd Edlinger  <bernd.edlinger@hotmail.de>
      
              PR middle-end/86121
              * gcc.dg/Wstringop-overflow-6.c: Remove xfail.
      
      From-SVN: r263693
      Bernd Edlinger committed
    • vxworks: don't define vxworks_asm_out_constructor when using .init_array · eae016fc
      When the compiler is configured with --enable-initfini-array,
      config/initfini-array.h gets included after config/vxworks.h by tm.h, so
      the definitions of TARGET_ASM_CONSTRUTOR/TARGET_ASM_DESTRUCTOR in
      vxworks.h get undone in initfini-array.h. Hence, we might as well not
      define the vxworks_asm_out_* functions.
      
      From-SVN: r263692
      Rasmus Villemoes committed
    • vxworks: enable use of .init_array/.fini_array for cdtors · ace193dc
      The target OS actually runs all function pointers found in the _ctors
      array when the module is loaded. So it is not that hard to make use of
      the "modern" .init_array/.fini_array mechanism - it mostly just requires
      a linker script adding the _ctors and _dtors symbols and terminating
      LONG(0) entries.
      
      Assume that if the user passed --enable-initfini-array when building
      gcc, the rest of the toolchain (including the link spec and linker
      script) is set up appropriately.
      
      Note that configuring with --enable-initfini-array may prevent the -mrtp
      mode from working, due to the (unconditional) use of .init_array.*
      sections instead of .ctors.* - however, that is the case regardless of this
      patch.
      
      From-SVN: r263691
      Rasmus Villemoes committed
    • libgcc: add crt{begin,end} for powerpc-wrs-vxworks target · 9a5b8df7
      In order to allow ZCX on VxWorks, we need the frame_dummy function to do
      the register_frame_info(). So make sure crtbegin.o and crtend.o are
      available for use with a custom spec file.
      
      From-SVN: r263690
      Rasmus Villemoes committed
    • vxworks: add target/h/wrn/coreip to the set of system include paths · 6b19ff66
      In order to build crtstuff.c, I need to ensure the headers in
      target/h/wrn/coreip are also searched. Of course, that can be done
      similar to how wrn/coreip gets manually added for libgcc, e.g. by adding
      
        CRTSTUFF_T_CFLAGS += -I$(WIND_BASE)/target/h -I$(WIND_BASE)/target/h/wrn/coreip
      
      But without target/h/wrn/coreip in the default search path, all
      user-code that include <unistd.h> (crtstuff.c just being one such
      example) will have to manually add an -isystem
      flag adding the wrn/coreip directory: unistd.h include ioLib.h, which
      has
      
      #include "net/uio.h"
      
      and that header is found in target/h/wrn/coreip. In other words, the
      VxWorks system headers (at least for VxWorks 5.5) are written in a way
      that assumes wrn/coreip is in the search path, so I think it makes sense
      to have that by default.
      
      It will change the search order for existing setups that pass
      -I.../target/h/wrn/coreip (without -nostdinc), since that flag will now
      be ignored. I can't know whether that will break anything, but I do
      believe it makes sense to have the defaults actually usable without
      expecting all invocations to add -I/-isystem flags.
      
      From-SVN: r263689
      Rasmus Villemoes committed
    • gimple-ssa-sprintf.c (decl_constant_value): Remove. · 6b2ffa6a
      2018-08-21  Bernd Edlinger  <bernd.edlinger@hotmail.de>
      
              * gimple-ssa-sprintf.c (decl_constant_value): Remove.
              (get_format_string): Refer to c_getstr.
      
      From-SVN: r263688
      Bernd Edlinger committed
    • [debug] Add debug and earlydebug dumps · efd9eb29
      With the introduction of early debug, we've added a phase in the compiler which
      produces information which is not visible, unless we run the compiler in the
      debugger and call debug_dwarf from dwarf2out_early_finish or some such.
      
      This patch adds dumping of "early" and "final" debug info, into .earlydebug
      and .debug dump files, enabled by -fdump-earlydebug and -fdumpdebug, such that
      we can follow f.i. the upper bound of a vla type from early debug:
      ...
                DW_AT_upper_bound: location descriptor:
                  (0x7f0d645b7550) DW_OP_GNU_variable_value , 0
      ...
      to final debug:
      ...
                DW_AT_upper_bound: location descriptor:
                  (0x7f0d645b7550) DW_OP_fbreg 18446744073709551592, 0
                  (0x7f0d645b7a00) DW_OP_deref 8, 0
      ...
      to -dA annotated assembly file:
      ...
              .uleb128 0x3    # DW_AT_upper_bound
              .byte   0x91    # DW_OP_fbreg
              .sleb128 -24
              .byte   0x6     # DW_OP_deref
      ...
      
      The .debug file shows the same information as the annotated assembly, but in
      the same format as the "early" debug info.
      
      Bootstrapped and reg-tested on x86_64.
      
      2018-08-21  Tom de Vries  <tdevries@suse.de>
      
      	* cgraph.h (debuginfo_early_init, debuginfo_init, debuginfo_fini)
      	(debuginfo_start, debuginfo_stop, debuginfo_early_start)
      	(debuginfo_early_stop): Declare.
      	* cgraphunit.c (debuginfo_early_init, debuginfo_init, debuginfo_fini)
      	(debuginfo_start, debuginfo_stop, debuginfo_early_start)
      	(debuginfo_early_stop): New function.
      	(symbol_table::finalize_compilation_unit): Call debuginfo_early_start
      	and debuginfo_early_stop.
      	* dwarf2out.c (dwarf2out_finish, dwarf2out_early_finish): Dump dwarf.
      	* toplev.c (compile_file): Call debuginfo_start and debuginfo_stop.
      	(general_init): Call debuginfo_early_init.
      	(finalize): Call debuginfo_fini.
      	(do_compile): Call debuginfo_init.
      	* doc/invoke.texi (@gccoptlist): Add -fdump-debug and
      	-fdump-early-debug.
      	(@item -fdump-debug, @item -fdump-earlydebug): Add.
      
      	* lto.c (lto_main):  Call debuginfo_early_start and
      	debuginfo_early_stop.
      
      	* gcc.c-torture/unsorted/dump-noaddr.x: Use -gno-record-gcc-switches
      	to avoid mismatch in .debug and .earlydebug dump files.
      
      From-SVN: r263687
      Tom de Vries committed
    • [debug] Respect fdump-noaddr and fdump-unnumbered in print_die · 916f27ad
      2018-08-21  Tom de Vries  <tdevries@suse.de>
      
      	* dwarf2out.c (print_dw_val, print_loc_descr, print_die): Handle
      	flag_dump_noaddr and flag_dump_unnumbered.
      
      From-SVN: r263686
      Tom de Vries committed
    • wide-int-range.cc (wide_int_range_abs): New. · 70eff705
      	* wide-int-range.cc (wide_int_range_abs): New.
      	(wide_int_range_order_set): Rename from wide_int_range_min_max.
      	* wide-int-range.h (wide_int_range_abs): New.
      	(wide_int_range_min_max): New.
      	* tree-vrp.c (extract_range_from_unary_expr): Rewrite ABS_EXPR
      	case to call wide_int_range_abs.
      	Rewrite MIN/MAX_EXPR to call wide_int_range_min_max.
      	(extract_range_from_abs_expr): Delete.
      
      From-SVN: r263685
      Aldy Hernandez committed
    • Daily bump. · 316a03a6
      From-SVN: r263683
      GCC Administrator committed
    • [libiberty patch] PEX-unix forking · 5c12a855
      https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01170.html
      	* pex-unix.c (pex_child_error): Delete.
      	(pex_unix_exec_child): Commonize error paths to single message &
      	exit.
      
      From-SVN: r263679
      Nathan Sidwell committed
  2. 20 Aug, 2018 10 commits
    • re PR target/87033 (The compiler does not generate the LWAX instruction) · a7e94dc0
      [gcc]
      2018-08-20  Michael Meissner  <meissner@linux.ibm.com>
      
      	PR target/87033
      	* config/rs6000/rs6000.md (extendsi<mode>2): Change constraints
      	from 'Y' to 'YZ' to enable the LWAX instruction to be generated
      	for indexed loads.
      
      [gcc/testsuite]
      2018-08-20  Michael Meissner  <meissner@linux.ibm.com>
      
      	PR target/87033
      	* gcc.target/powerpc/pr87033.c: New test.
      
      From-SVN: r263678
      Michael Meissner committed
    • [PATCH] fix some build breakage · fe7a679e
      https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01214.html
      	* config/s390/s390-c (s390_macro_to_expand): Use cpp_macro_p.
      	* config/spu/spu-c.c (spu_macro_to_expand): Likewise.
      
      Co-Authored-By: Jeff Law <law@redhat.com>
      
      From-SVN: r263677
      Nathan Sidwell committed
    • PR tree-optimization/87034 - missing -Wformat-overflow on a sprintf %s with a wide string · 56c6d267
      gcc/testsuite/ChangeLog:
      	* gcc.dg/builtin-sprintf-warn-20.c: New test.
      
      From-SVN: r263676
      Martin Sebor committed
    • Add support for grouping of related diagnostics (PR other/84889) · 097f82ec
      We often emit logically-related groups of diagnostics.
      
      A relatively simple case is this:
      
        if (warning_at (body_loc, OPT_Wmultistatement_macros,
                        "macro expands to multiple statements"))
          inform (guard_loc, "some parts of macro expansion are not guarded by "
                  "this %qs clause", guard_tinfo_to_string (keyword));
      
      where the "note" diagnostic issued by the "inform" call
      is guarded by the -Wmultistatement_macros warning.
      
      More complicated examples can be seen in the C++ frontend,
      where e.g. print_z_candidates can lead to numerous "note"
      diagnostics being emitted.
      
      I'm looking at various ways to improve how we handle such related
      diagnostics, but, prior to this patch, there was no explicit
      relationship between these diagnostics: the diagnostics subsystem
      had no way of "knowing" that these were related.
      
      This patch introduces a simple way to group the diagnostics:
      an auto_diagnostic_group class: all diagnostics emitted within
      the lifetime of an auto_diagnostic_group instance are logically
      grouped.
      
      Hence in the above example, the two diagnostics can be grouped
      by simply adding an auto_diagnostic_group instance:
      
        auto_diagnostic_group d;
        if (warning_at (body_loc, OPT_Wmultistatement_macros,
                        "macro expands to multiple statements"))
          inform (guard_loc, "some parts of macro expansion are not guarded by "
                  "this %qs clause", guard_tinfo_to_string (keyword));
      
      Some more awkard cases are of the form:
      
        if (some_condition
            && warning_at (...)
            && more_conditions)
          inform (...);
      
      which thus need restructuring to:
      
        if (some_condition)
          {
            auto_diagnostic_group d;
            warning_at (...);
            if (more_conditions)
              inform (...);
          }
      
      so that the lifetime of the auto_diagnostic_group groups the
      warning_at and the inform call.
      
      Nesting is handled by simply tracking a nesting depth within the
      diagnostic_context.: all diagnostics are treated as grouped until the
      final auto_diagnostic_group is popped.
      
      diagnostic.c uses this internally, so that all diagnostics are part of
      a group - those that are "by themselves" are treated as being part of
      a group with one element.
      
      The diagnostic_context gains optional callbacks for displaying the
      start of a group (when the first diagnostic is emitted within it), and
      the end of a group (for when the group was non-empty); these callbacks
      are unused by default, but a test plugin demonstrates them (and verifies
      that the machinery is working).
      
      As noted above, I'm looking at various ways to use the grouping to
      improve how we output the diagnostics.
      
      FWIW, I experimented with a more involved implementation, of the form:
      
        diagnostic_group d;
        if (d.warning_at (body_loc, OPT_Wmultistatement_macros,
                          "macro expands to multiple statements"))
          d.inform (guard_loc, "some parts of macro expansion are not guarded by "
                    "this %qs clause", guard_tinfo_to_string (keyword));
      
      which had the advantage of allowing auto-detection of the places where
      groups were needed (by converting ::warning_at's return type to bool),
      but it was a much more invasive patch, especially when dealing with
      the places in the C++ frontend that can emit numerous notes after
      an error or warning (and thus having to pass the group around)
      Hence I went with this simpler approach.
      
      gcc/c-family/ChangeLog:
      	PR other/84889
      	* c-attribs.c (common_handle_aligned_attribute): Add
      	auto_diagnostic_group instance.
      	* c-indentation.c (warn_for_misleading_indentation): Likewise.
      	* c-opts.c (c_common_post_options): Likewise.
      	* c-warn.c (warn_logical_not_parentheses): Likewise.
      	(warn_duplicated_cond_add_or_warn): Likewise.
      	(warn_for_multistatement_macros): Likewise.
      
      gcc/c/ChangeLog:
      	PR other/84889
      	* c-decl.c (pushtag): Add auto_diagnostic_group instance.
      	(diagnose_mismatched_decls): Likewise, in various places.
      	(warn_if_shadowing): Likewise.
      	(implicit_decl_warning): Likewise.
      	(implicitly_declare): Likewise.
      	(undeclared_variable): Likewise.
      	(declare_label): Likewise.
      	(grokdeclarator): Likewise.
      	(start_function): Likewise.
      	* c-parser.c (c_parser_declaration_or_fndef): Likewise.
      	(c_parser_parameter_declaration): Likewise.
      	(c_parser_binary_expression): Likewise.
      	* c-typeck.c (c_expr_sizeof_expr): Likewise.
      	(parser_build_binary_op): Likewise.
      	(build_unary_op): Likewise.
      	(error_init): Likewise.
      	(pedwarn_init): Likewise.
      	(warning_init): Likewise.
      	(convert_for_assignment): Likewise.
      
      gcc/cp/ChangeLog:
      	PR other/84889
      	* call.c (build_user_type_conversion_1): Add auto_diagnostic_group
      	instance(s).
      	(print_error_for_call_failure): Likewise.
      	(build_op_call_1): Likewise.
      	(build_conditional_expr_1): Likewise.
      	(build_new_op_1): Likewise.
      	(build_op_delete_call): Likewise.
      	(convert_like_real): Likewise.
      	(build_over_call): Likewise.
      	(build_new_method_call_1): Likewise.
      	(joust): Likewise.
      	* class.c (check_tag): Likewise.
      	(finish_struct_anon_r): Likewise.
      	(one_inherited_ctor): Likewise.
      	(finalize_literal_type_property): Likewise.
      	(explain_non_literal_class): Likewise.
      	(find_flexarrays): Likewise.
      	(resolve_address_of_overloaded_function): Likewise.
      	* constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
      	(is_valid_constexpr_fn): Likewise.
      	(cx_check_missing_mem_inits): Likewise.
      	* cp-gimplify.c (cp_genericize_r): Likewise.
      	* cvt.c (maybe_warn_nodiscard): Likewise.
      	* decl.c (warn_extern_redeclared_static): Likewise.
      	(check_redeclaration_exception_specification): Likewise.
      	(check_no_redeclaration_friend_default_args): Likewise.
      	(duplicate_decls): Likewise.
      	(redeclaration_error_message): Likewise.
      	(warn_misplaced_attr_for_class_type): Likewise.
      	* decl2.c (finish_static_data_member_decl): Likewise.
      	(no_linkage_error): Likewise.
      	(cp_warn_deprecated_use): Likewise.
      	* error.c (qualified_name_lookup_error): Likewise.
      	* friend.c (make_friend_class): Likewise.
      	(do_friend): Likewise.
      	* init.c (perform_member_init): Likewise.
      	(build_new_1): Likewise.
      	(build_vec_delete_1): Likewise.
      	(build_delete): Likewise.
      	* lex.c (unqualified_name_lookup_error): Likewise.
      	* name-lookup.c (check_extern_c_conflict): Likewise.
      	(inform_shadowed): New function.
      	(check_local_shadow): Add auto_diagnostic_group instances,
      	replacing goto "inform_shadowed" label with call to subroutine.
      	(set_local_extern_decl_linkage): Add auto_diagnostic_group
      	instance(s).
      	* parser.c (cp_parser_diagnose_invalid_type_name): Likewise.
      	(cp_parser_namespace_name): Likewise.
      	* pt.c (check_specialization_namespace): Likewise.
      	(check_template_variable): Likewise.
      	(warn_spec_missing_attributes): Likewise.
      	(check_explicit_specialization): Likewise.
      	(process_partial_specialization): Likewise.
      	(lookup_template_class_1): Likewise.
      	(finish_template_variable): Likewise.
      	(do_auto_deduction): Likewise.
      	* search.c (check_final_overrider): Likewise.
      	(look_for_overrides_r): Likewise.
      	* tree.c (maybe_warn_parm_abi): Likewise.
      	* typeck.c (cxx_sizeof_expr): Likewise.
      	(cp_build_function_call_vec): Likewise.
      	(cp_build_binary_op): Likewise.
      	(convert_for_assignment): Likewise.
      	(maybe_warn_about_returning_address_of_local): Likewise.
      	* typeck2.c (abstract_virtuals_error_sfinae): Likewise.
      	(check_narrowing): Likewise.
      
      gcc/ChangeLog:
      	PR other/84889
      	* attribs.c (diag_attr_exclusions): Add auto_diagnostic_group instance.
      	(decl_attributes): Likewise.
      	* calls.c (maybe_warn_nonstring_arg): Add auto_diagnostic_group
      	instance.
      	* cgraphunit.c (maybe_diag_incompatible_alias): Likewise.
      	* diagnostic-core.h (class auto_diagnostic_group): New class.
      	* diagnostic.c (diagnostic_initialize): Initialize the new fields.
      	(diagnostic_report_diagnostic): Handle the first diagnostics within
      	a group.
      	(emit_diagnostic): Add auto_diagnostic_group instance.
      	(inform): Likewise.
      	(inform_n): Likewise.
      	(warning): Likewise.
      	(warning_at): Likewise.
      	(warning_n): Likewise.
      	(pedwarn): Likewise.
      	(permerror): Likewise.
      	(error): Likewise.
      	(error_n): Likewise.
      	(error_at): Likewise.
      	(sorry): Likewise.
      	(fatal_error): Likewise.
      	(internal_error): Likewise.
      	(internal_error_no_backtrace): Likewise.
      	(auto_diagnostic_group::auto_diagnostic_group): New ctor.
      	(auto_diagnostic_group::~auto_diagnostic_group): New dtor.
      	* diagnostic.h (struct diagnostic_context): Add fields
      	"diagnostic_group_nesting_depth",
      	"diagnostic_group_emission_count", "begin_group_cb",
      	"end_group_cb".
      	* gimple-ssa-isolate-paths.c (find_implicit_erroneous_behavior):
      	Add auto_diagnostic_group instance(s).
      	(find_explicit_erroneous_behavior): Likewise.
      	* gimple-ssa-warn-alloca.c (pass_walloca::execute): Likewise.
      	* gimple-ssa-warn-restrict.c (maybe_diag_offset_bounds): Likewise.
      	* gimplify.c (warn_implicit_fallthrough_r): Likewise.
      	(gimplify_va_arg_expr): Likewise.
      	* hsa-gen.c (HSA_SORRY_ATV): Likewise.
      	(HSA_SORRY_AT): Likewise.
      	* ipa-devirt.c (compare_virtual_tables): Likewise.
      	(warn_odr): Likewise.
      	* multiple_target.c (expand_target_clones): Likewise.
      	* opts-common.c (cmdline_handle_error): Likewise.
      	* reginfo.c (globalize_reg): Likewise.
      	* substring-locations.c (format_warning_n_va): Likewise.
      	* tree-inline.c (expand_call_inline): Likewise.
      	* tree-ssa-ccp.c (pass_post_ipa_warn::execute): Likewise.
      	* tree-ssa-loop-niter.c
      	(do_warn_aggressive_loop_optimizations): Likewise.
      	* tree-ssa-uninit.c (warn_uninit): Likewise.
      	* tree.c (warn_deprecated_use): Likewise.
      
      gcc/testsuite/ChangeLog:
      	PR other/84889
      	* gcc.dg/plugin/diagnostic-group-test-1.c: New test.
      	* gcc.dg/plugin/diagnostic_group_plugin.c: New test.
      	* gcc.dg/plugin/plugin.exp (plugin_test_list): Add the new tests.
      
      From-SVN: r263675
      David Malcolm committed
    • x86: Always update EH return address in word_mode · a31505a3
      On x86, return address is always popped in word_mode.  eh_return needs
      to put EH return address in word_mode on stack.
      
      gcc/
      
      	PR target/87014
      	* config/i386/i386.md (eh_return): Always update EH return
      	address in word_mode.
      
      gcc/testsuite/
      
      	PR target/87014
      	* g++.dg/torture/pr87014.C: New file.
      
      From-SVN: r263672
      H.J. Lu committed
    • targhooks.c (std_gimplify_va_arg_expr): Properly handle case of when… · 846d943b
      targhooks.c (std_gimplify_va_arg_expr): Properly handle case of when TARGET_SPLIT_COMPLEX_ARG is defined.
      
      	* targhooks.c (std_gimplify_va_arg_expr): Properly handle case of when
      	TARGET_SPLIT_COMPLEX_ARG is defined.
      
      From-SVN: r263671
      Chung-Lin Tang committed
    • [CPP PATCH] node field bits · a5a35247
      https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01171.html
      	* include/cpplib.h: Fixup some whitespace.
      	(cpp_hashnode): Reduce type to 2 bit & flags to 8.
      
      From-SVN: r263669
      Nathan Sidwell committed
    • [CPP PATCH] node type · a570d97f
      https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01164.html
      	* include/cpplib.h (NODE_BUILTIN, NODE_MACRO_ARG): Delete.
      	Renumber others.
      	(enum node_type): Replace NT_MACRO with NT_USER_MACRO,
      	NT_BUILTIN_MACRO, NT_MACRO_ARG.  Delete NT_ASSERTION.
      	(NTV_MACRO, NTV_ANSWER, NTV_BUILTIN, NTV_ARGUMENT, NTV_NONE):
      	Delete.
      	(CPP_HASHNODE_VALUE_IDX): Delete.
      	(union _cpp_hashnode_value): GTY tag from enum node_type directly.
      	(struct cpp_hashnode): Adjust GTY desc for value field.
      	(cpp_user_macro_p, cpp_builtin_macro_p, cpp_macro_p): Adjust.
      	* directives.c (undefine_macros): Clear value.anwers, adjust flag
      	clearing.
      	(_cpp_test_assertion): No need to check NT_ASSERTION.
      	(do_assert, do_unassert): Likewise.
      	* init.c (cpp_init_special_builtins): Set type not flags.
      	* macro.c (struct macro_arg_saved_data): Add type field.
      	(cpp_get_token_1): Check type not NT_VOID.
      	(_cpp_free_definition): Adjust flag clearing.  Nullify
      	value.answers.
      	(_cpp_save_parameter, _cpp_unsave_parameters): Save and restore
      	type.
      	(lex_expansion_token): Check type not flags.
      	(_cpp_create_definition): Set type to NT_USER_MACRO.
      	(_cpp_notify_macro_use): Adjust type checking.
      	* pch.c (write_macdef, count_defs, write_defs, cpp_valid_state)
      	(save_macros): Adjust node type/flag handling.
      	* traditional.c (_cpp_scan_out_logical_line): Check type not flags.
      
      From-SVN: r263667
      Nathan Sidwell committed
    • [CPP PATCH] Fix warning & other cleanups. · 7692e253
      https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01162.html
      	* directives.c (do_undef): Use cpp_macro_p & cpp_builtin_macro_p.
      	* include/cpplib.h (enum cpp_macro_kind): Remove trailing comma.
      	(cpp_fun_like_macro_p): Make inline, define.
      	* macro.c (cpp_define_lazily): Use UCHAR_MAX.
      	(cpp_fun_like_macro_p): Delete.
      
      From-SVN: r263666
      Nathan Sidwell committed
    • expr.c (store_field): Change gcc_assert to gcc_checking_assert. · e11b709d
      2018-08-20  Bernd Edlinger  <bernd.edlinger@hotmail.de>
       
      	* expr.c (store_field): Change gcc_assert to gcc_checking_assert.
      
      From-SVN: r263665
      Bernd Edlinger committed