1. 27 Nov, 2018 8 commits
    • [libbacktrace] Don't point to released memory in backtrace_vector_release · 6d760a01
      When backtrace_vector_release is called with vec.size == 0, it releases the
      memory pointed at by vec.base.
      
      Set vec.base set to NULL if vec.size == 0 to ensure we don't point to released
      memory.
      
      Bootstrapped and reg-tested on x86_64.
      
      2018-11-27  Tom de Vries  <tdevries@suse.de>
      
      	* mmap.c (backtrace_vector_release): Same.
      	* unittest.c (test1): Add check.
      
      From-SVN: r266505
      Tom de Vries committed
    • [libbacktrace] Avoid realloc with size == 0 in backtrace_vector_release · 0c155f24
      As of C17, realloc with size 0 is marked as an obsolescent feature.
      
      Fix this in backtrace_vector_release by using free instead.
      
      Bootstrapped and reg-tested on x86_64.
      
      2018-11-27  Tom de Vries  <tdevries@suse.de>
      
      	* alloc.c (backtrace_vector_release): Handle vec->size == 0 using free
      	instead of realloc.
      	* Makefile.am (check_PROGRAMS): Add unittest.
      	* Makefile.in: Regenerate.
      	* unittest.c: New file.
      
      From-SVN: r266504
      Tom de Vries committed
    • [RS6000] libgcc cfi · 1ea7ea18
      There are a few places in libgcc assembly where we don't emit call
      frame information for functions, potentially breaking unwinding from
      asynchronous signal handlers.  This patch fixes them.  Although I
      patch tramp.S there is no attempt made to provide CFI for the actual
      trampoline on the stack.  Doing that would require generating CFI at
      run time and both registering and deregistering it, which is probably
      not worth doing since it would significantly slow down the call.
      
      	* config/rs6000/morestack.S (__stack_split_initialize),
      	(__morestack_get_guard, __morestack_set_guard),
      	(__morestack_make_guard): Provide CFI covering these functions.
      	* config/rs6000/tramp.S (__trampoline_setup): Likewise.
      
      From-SVN: r266503
      Alan Modra committed
    • [RS6000] PowerPC -mcpu=native support · 28a09576
      The -mcpu=native support has bit-rotted a little, in particular the
      fallback when the native cpu couldn't be determined.  This patch fixes
      the bit-rot and reorganizes ASM_CPU_SPEC so that it should be a little
      easier to keep the -mcpu=native data up to date.
      
      The patch also changes the fix for PR63177 (-mpower9-vector being
      passed by the user when the default is -mpower8) to also apply when
      -mcpu=powerpc64le and -mcpu=native is given.  I'll note that the hack
      for PR63177 should probably be extended to lots of other options, if
      we're going to continue supporting all those sub-architecture options
      (-mpower9-vector, -mpower8-vector, -mcrypto, -mdirect-move, -mhtm,
      -mvsx and others) in the positive sense.  I think those should have
      only been supported in their -mno- variants..
      
      	* config/rs6000/aix71.h (ASM_SPEC): Don't select default -maix64
      	cpu here.
      	(ASM_CPU_SPEC): Do so here.  Rewrite using if .. else if .. specs
      	form.  Error on missing -mcpu case.
      	* config/rs6000/driver-rs6000.c (asm_names <_AIX>): Update NULL case.
      	(asm_names <!_AIX>): Add missing cpus.  Update NULL case.  Apply
      	PR63177 fix for -mcpu=power8 and -mcpu=powerpc64le.
      	* config/rs6000/rs6000.h (ASM_CPU_SPEC): Rewrite using if ..
      	else if .. specs form.  Error on missing -mcpu case.  Don't output
      	duplicate -maltivec.  Apply PR63177 fix for -mcpu=powerpc64le.
      
      From-SVN: r266502
      Alan Modra committed
    • Fix missing dump_impl_location_t values, using a new dump_metadata_t · 3da39f52
      The dump_* API attempts to capture emission location metadata for the
      various dump messages, but looking in -fsave-optimization-record shows
      that many dump messages are lacking useful impl_location values, instead
      having this location within dumpfile.c:
      
                  "impl_location": {
                      "file": "../../src/gcc/dumpfile.c",
                      "function": "ensure_pending_optinfo",
                      "line": 1169
                  },
      
      The problem is that the auto-capturing of dump_impl_location_t is tied to
      dump_location_t, and this is tied to the dump_*_loc calls.  If a message
      comes from a dump_* call without a "_loc" suffix (e.g. dump_printf), the
      current code synthesizes the dump_location_t within
      dump_context::ensure_pending_optinfo, and thus saves the useless
      impl_location seen above.
      
      This patch fixes things by changing the dump_* API so that, rather than
      taking a dump_flags_t, they take a new class dump_metadata_t, which is
      constructed from a dump_flags_t, but captures the emission location.
      
      Hence e.g.:
      
        dump_printf (MSG_NOTE, "some message\n");
      
      implicitly builds a dump_metadata_t wrapping the MSG_NOTE and the
      emission location.  If there are several dump_printf calls without
      a dump_*_loc call, the emission location within the optinfo is that
      of the first dump call within it.
      
      The patch updates selftest::test_capture_of_dump_calls to verify
      that the impl location of various dump_* calls is captured.  I also
      verified things manually.
      
      gcc/ChangeLog:
      	* dump-context.h (dump_context::dump_loc): Convert 1st param from
      	dump_flags_t to const dump_metadata_t &.  Convert 2nd param from
      	const dump_location_t & to const dump_user_location_t &.
      	(dump_context::dump_loc_immediate): Convert 2nd param from
      	const dump_location_t & to const dump_user_location_t &.
      	(dump_context::dump_gimple_stmt): Convert 1st param from
      	dump_flags_t to const dump_metadata_t &.
      	(dump_context::void dump_gimple_stmt_loc): Likewise; convert
      	2nd param from const dump_location_t & to
      	const dump_user_location_t &.
      	(dump_context::dump_gimple_expr): Convert 1st param from
      	dump_flags_t to const dump_metadata_t &.
      	(dump_context::dump_gimple_expr_loc): Likewise; convert
      	2nd param from const dump_location_t & to
      	const dump_user_location_t &.
      	(dump_context::dump_generic_expr): Convert 1st param from
      	dump_flags_t to const dump_metadata_t &.
      	(dump_context::dump_generic_expr_loc): Likewise; convert
      	2nd param from const dump_location_t & to
      	const dump_user_location_t &.
      	(dump_context::dump_printf_va): Convert 1st param from
      	dump_flags_t to const dump_metadata_t &.
      	(dump_context::dump_printf_loc_va): Likewise; convert
      	2nd param from const dump_location_t & to
      	const dump_user_location_t &.
      	(dump_context::dump_dec): Convert 1st param from
      	dump_flags_t to const dump_metadata_t &.
      	(dump_context::dump_symtab_node): Likewise.
      	(dump_context::begin_scope): Split out 2nd param into
      	user and impl locations.
      	(dump_context::ensure_pending_optinfo): Add metadata param.
      	(dump_context::begin_next_optinfo): Replace dump_location_t param
      	with metadata and user location.
      	* dumpfile.c (dump_context::dump_loc): Convert 1st param from
      	dump_flags_t to const dump_metadata_t &.  Convert 2nd param from
      	const dump_location_t & to const dump_user_location_t &.
      	(dump_context::dump_loc_immediate): Convert 2nd param from
      	const dump_location_t & to const dump_user_location_t &.
      	(dump_context::dump_gimple_stmt): Convert 1st param from
      	dump_flags_t to const dump_metadata_t &.
      	(dump_context::void dump_gimple_stmt_loc): Likewise; convert
      	2nd param from const dump_location_t & to
      	const dump_user_location_t &.
      	(dump_context::dump_gimple_expr): Convert 1st param from
      	dump_flags_t to const dump_metadata_t &.
      	(dump_context::dump_gimple_expr_loc): Likewise; convert
      	2nd param from const dump_location_t & to
      	const dump_user_location_t &.
      	(dump_context::dump_generic_expr): Convert 1st param from
      	dump_flags_t to const dump_metadata_t &.
      	(dump_context::dump_generic_expr_loc): Likewise; convert
      	2nd param from const dump_location_t & to
      	const dump_user_location_t &.
      	(dump_context::dump_printf_va): Convert 1st param from
      	dump_flags_t to const dump_metadata_t &.
      	(dump_context::dump_printf_loc_va): Likewise; convert
      	2nd param from const dump_location_t & to
      	const dump_user_location_t &.
      	(dump_context::dump_dec): Convert 1st param from
      	dump_flags_t to const dump_metadata_t &.
      	(dump_context::dump_symtab_node): Likewise.
      	(dump_context::begin_scope): Split out 2nd param into
      	user and impl locations.
      	(dump_context::ensure_pending_optinfo): Add metadata param.
      	(dump_context::begin_next_optinfo): Replace dump_location_t param
      	with metadata and user location.
      	(dump_gimple_stmt): Convert 1st param from dump_flags_t to
      	const dump_metadata_t &.
      	(dump_gimple_stmt_loc): Likewise; convert 2nd param from
      	const dump_location_t & to const dump_user_location_t &.
      	(dump_gimple_expr): Convert 1st param from dump_flags_t to
      	const dump_metadata_t &.
      	(dump_gimple_expr_loc): Likewise; convert 2nd param from
      	const dump_location_t & to const dump_user_location_t &.
      	(dump_generic_expr): Convert 1st param from dump_flags_t to
      	const dump_metadata_t &.
      	(dump_generic_expr_loc): Likewise; convert 2nd param from
      	const dump_location_t & to const dump_user_location_t &.
      	(dump_printf): Convert 1st param from dump_flags_t to
      	const dump_metadata_t &.
      	(dump_printf_loc): Likewise; convert 2nd param from
      	const dump_location_t & to const dump_user_location_t &.
      	(dump_dec): Convert 1st param from dump_flags_t to
      	const dump_metadata_t &.
      	(dump_symtab_node): Likewise.
      	(dump_begin_scope): Split out 2nd param into user and impl
      	locations.
      	(selftest::assert_impl_location_eq): New function.
      	(ASSERT_IMPL_LOCATION_EQ): New macro.
      	(selftest::test_impl_location): Update to use
      	ASSERT_IMPL_LOCATION_EQ.
      	(selftest::test_capture_of_dump_calls): Convert "loc" to
      	dump_user_location_t.  Add ASSERT_IMPL_LOCATION_EQ throughout,
      	verifying line numbers of dump emissions.
      	* dumpfile.h (class dump_metadata_t): New class.
      	(dump_printf): Convert 1st param from dump_flags_t to
      	const dump_metadata_t &.
      	(dump_printf_loc): Likewise; convert 2nd param from
      	const dump_location_t & to const dump_user_location_t &.
      	(dump_generic_expr_loc): Likewise.
      	(dump_generic_expr): Convert 1st param from dump_flags_t to
      	const dump_metadata_t &.
      	(dump_gimple_stmt_loc): Likewise; convert 2nd param from
      	const dump_location_t & to const dump_user_location_t &.
      	(dump_gimple_stmt): Convert 1st param from dump_flags_t to
      	const dump_metadata_t &.
      	(dump_gimple_expr_loc): Likewise; convert 2nd param from
      	const dump_location_t & to const dump_user_location_t &.
      	(dump_gimple_expr): Convert 1st param from dump_flags_t to
      	const dump_metadata_t &.
      	(dump_symtab_node): Likewise.
      	(dump_dec): Likewise.
      	(dump_begin_scope): Split out 2nd param into user and impl
      	locations.
      	(auto_dump_scope::auto_dump_scope): Split "loc" param into a user
      	location and impl_location, and capture the impl_location.
      	(AUTO_DUMP_SCOPE): Rename param from LOC to USER_LOC.
      	* loop-unroll.c (report_unroll): Update for changes to
      	dump_printf_loc and dump_printf.
      	* opt-problem.cc (opt_problem::opt_problem): Update for change to
      	dump_loc.
      	* optinfo-emit-json.cc
      	(selftest::test_building_json_from_dump_calls): Convert "loc" from
      	dump_location_t to dump_user_location_t.
      	* optinfo.cc (optinfo::emit_for_opt_problem): Update for change in
      	dump_loc_immediate.
      	* profile.c (compute_branch_probabilities): Update for change to
      	dump_printf_loc.
      	* selftest.h (ASSERT_STR_CONTAINS_AT): New macro.
      	* tree-vect-slp.c (vect_print_slp_tree): Update for change to
      	dump_printf_loc.
      
      From-SVN: r266501
      David Malcolm committed
    • Tweak directives in GCC tests for msp430-elf · 27c16e61
      2018-11-27  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
      
      	Tweak directives in GCC tests for msp430-elf
      
      	gcc/ChangeLog:
      
      	* doc/sourcebuild.texi: Document check_effective_target_int_eq_float
      	and check_effective_target_ptr_eq_long.
      
      	gcc/testsuite/ChangeLog:
      
      	* lib/target-supports.exp
      	(check_effective_target_logical_op_short_circuit): Add msp430.
      	(check_effective_target_int_eq_float): New. 
      	(check_effective_target_ptr_eq_long): New. 
      	* c-c++-common/pr41779.c: Require int_eq_float for dg-warning tests.
      	* c-c++-common/pr57371-2.c: XFAIL optimized dump scan when
      	sizeof (float) != sizeof (int).
      	* gcc.dg/pr84670-4.c: Require ptr_eq_long.
      	* gcc.dg/pr85859.c: Likewise.
      	* gcc.dg/Wno-frame-address.c: Skip for msp430-elf.
      	* gcc.dg/torture/stackalign/builtin-apply-2.c: Likewise.
      	* gcc.dg/ifcvt-4.c: Likewise.
      	* gcc.dg/pr34856.c: Likewise.
      	* gcc.dg/builtin-apply2.c: Likewise.
      	* gcc.dg/tree-ssa/ssa-dse-26.c: Likewise.
      	* gcc.dg/attr-alloc_size-11.c: Remove dg-warning XFAIL for msp430.
      	* gcc.dg/tree-ssa/20040204-1.c: Likewise.
      	* gcc.dg/compat/struct-by-value-16a_x.c: Build at -O1 for msp430
      	so it fits.
      	* gcc.dg/lto/20091013-1_0.c: Require ptr_eq_long.
      	* gcc.dg/lto/20091013-1_1.c: Remove xfail-if for when
      	sizeof(void *) != sizeof(long).
      	* gcc.dg/lto/20091013-1_2.c: Likewise.
      	* gcc.dg/tree-ssa/loop-1.c: Fix expected dg-final behaviour for msp430.
      	* gcc.dg/tree-ssa/gen-vect-25.c: Likewise.
      	* gcc.dg/tree-ssa/gen-vect-11.c: Likewise.
      	* gcc.dg/tree-ssa/loop-35.c: Likewise.
      	* gcc.dg/tree-ssa/pr23455.c: Likewise.
      	* gcc.dg/weak/typeof-2.c: Likewise.
      	* gcc.target/msp430/interrupt_fn_placement.c: Skip for 430 ISA.
      	* gcc.target/msp430/pr78818-data-region.c: Fix scan-assembler text.
      	* gcc.target/msp430/pr79242.c: Don't skip for -msmall.
      	* gcc.target/msp430/special-regs.c: Use "__asm__" instead of "asm".
      
      From-SVN: r266500
      Jozef Lawrynowicz committed
    • Daily bump. · 660254d3
      From-SVN: r266499
      GCC Administrator committed
    • [RS6000] rs6000/sysv4.h using gnu-user.h · 62045234
      This patch removes some duplication in rs6000/sysv4.h of macros found
      in gnu-user.h that we want for linux.  Including gnu-user.h will mean
      powerpc doesn't miss updates to that file.
      
      	* config.gcc (powerpc*-*-freebsd*, powerpc-*-netbsd*),
      	(powerpc-*-eabisimaltivec*, powerpc-*-eabisim*, powerpc-*-elf*),
      	(powerpc-*-eabialtivec*, powerpc-*-eabi*, powerpc-*-rtems*),
      	(powerpc-wrs-vxworks*, powerpc-*-lynxos*, powerpcle-*-elf*),
      	(powerpcle-*-eabisim*, powerpcle-*-eabi*): Add gnu-user.h to tm_file.
      	* config/rs6000/freebsd.h (CPLUSPLUS_CPP_SPEC),
      	(LINK_GCC_C_SEQUENCE_SPEC): Undef.
      	(ASM_APP_ON, ASM_APP_OFF): Don't define.
      	* config/rs6000/freebsd64.h (ASM_APP_ON, ASM_APP_OFF): Don't define.
      	* config/rs6000/lynx.h (ASM_APP_ON, ASM_APP_OFF): Don't define.
      	* config/rs6000/linux64.h (LINK_GCC_C_SEQUENCE_SPEC): Define.
      	* config/rs6000/netbsd.h (CPLUSPLUS_CPP_SPEC),
      	(LINK_GCC_C_SEQUENCE_SPEC): Undef.
      	* config/rs6000/rtems.h (LINK_GCC_C_SEQUENCE_SPEC): Define.
      	* config/rs6000/sysv4.h (GNU_USER_TARGET_CRTI): Redefine.
      	(GNU_USER_TARGET_CRTN): Redefine.
      	(CC1_SPEC): Use GNU_USER_TARGET_CC1_SPEC.
      	(LIB_LINUX_SPEC): Use GNU_USER_TARGET_LIB_SPEC.
      	(CRTOFFLOADBEGIN, CRTOFFLOADEND): Don't define.
      	(STARTFILE_LINUX_SPEC): Define as GNU_USER_TARGET_STARTFILE_SPEC.
      	(ENDFILE_LINUX_SPEC): Define as GNU_USER_TARGET_ENDFILE_SPEC.
      	(UCLIBC_DYNAMIC_LINKER, CHOOSE_DYNAMIC_LINKER): Don't define.
      	(LINK_EH_SPEC): Don't define.
      
      From-SVN: r266496
      Alan Modra committed
  2. 26 Nov, 2018 28 commits
  3. 25 Nov, 2018 4 commits