Re: [patch] [fixincludes] Ignore .DS_Store junk files when running make check
Eric Gallager writes: > I've attached trivial, 1-line patch to fixincludes_check.tpl; it > allows 'make check' to succeed on OS X, by ignoring the files that > Finder creates to keep track of the status of directories. > > -Eric Gallager > fixincludes/check.tpl | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/fixincludes/check.tpl b/fixincludes/check.tpl > index 0d1f444..300aeac 100644 > --- a/fixincludes/check.tpl > +++ b/fixincludes/check.tpl > @@ -143,6 +143,7 @@ cd $TESTBASE > > find * -type f -print | \ > fgrep -v 'CVS/' | \ > +fgrep -v '.DS_Store' | \ > fgrep -v '.svn/' > ${TESTDIR}/LIST > > exitok=` find ... ! -name .DS_Store ... Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."
[committed] Use target-insns.def for forms of non-local goto
Bootstrapped & regression-tested on x86_64-linux-gnu and aarch64-linux-gnu. Also tested via config-list.mk. Committed as preapproved. Thanks, Richard gcc/ * target-insns.def (builtin_longjmp, builtin_setjmp_receiver) (builtin_setjmp_setup, exception_receiver, nonlocal_goto) (nonlocal_goto_receiver): New targetm instruction patterns. * builtins.c (expand_builtin_setjmp_setup): Use them instead of HAVE_*/gen_* interface. (expand_builtin_setjmp_receiver): Likewise. (expand_builtin_longjmp, expand_builtin_nonlocal_goto): Likewise. * except.c (expand_dw2_landing_pad_for_region): Likewise. Index: gcc/target-insns.def === --- gcc/target-insns.def2015-07-05 08:46:04.67929 +0100 +++ gcc/target-insns.def2015-07-05 08:46:04.67557 +0100 @@ -30,14 +30,20 @@ Patterns that take no operands should have a prototype "(void)". Instructions should be documented in md.texi rather than here. */ +DEF_TARGET_INSN (builtin_longjmp, (rtx x0)) +DEF_TARGET_INSN (builtin_setjmp_receiver, (rtx x0)) +DEF_TARGET_INSN (builtin_setjmp_setup, (rtx x0)) DEF_TARGET_INSN (canonicalize_funcptr_for_compare, (rtx x0, rtx x1)) DEF_TARGET_INSN (casesi, (rtx x0, rtx x1, rtx x2, rtx x3, rtx x4)) DEF_TARGET_INSN (epilogue, (void)) +DEF_TARGET_INSN (exception_receiver, (void)) DEF_TARGET_INSN (jump, (rtx x0)) DEF_TARGET_INSN (load_multiple, (rtx x0, rtx x1, rtx x2)) DEF_TARGET_INSN (mem_signal_fence, (rtx x0)) DEF_TARGET_INSN (mem_thread_fence, (rtx x0)) DEF_TARGET_INSN (memory_barrier, (void)) +DEF_TARGET_INSN (nonlocal_goto, (rtx x0, rtx x1, rtx x2, rtx x3)) +DEF_TARGET_INSN (nonlocal_goto_receiver, (void)) DEF_TARGET_INSN (prologue, (void)) DEF_TARGET_INSN (return, (void)) DEF_TARGET_INSN (sibcall_epilogue, (void)) Index: gcc/builtins.c === --- gcc/builtins.c 2015-07-05 08:46:04.67929 +0100 +++ gcc/builtins.c 2015-07-05 08:46:04.67199 +0100 @@ -889,10 +889,8 @@ expand_builtin_setjmp_setup (rtx buf_add emit_stack_save (SAVE_NONLOCAL, &stack_save); /* If there is further processing to do, do it. */ -#ifdef HAVE_builtin_setjmp_setup - if (HAVE_builtin_setjmp_setup) -emit_insn (gen_builtin_setjmp_setup (buf_addr)); -#endif + if (targetm.have_builtin_setjmp_setup ()) +emit_insn (targetm.gen_builtin_setjmp_setup (buf_addr)); /* We have a nonlocal label. */ cfun->has_nonlocal_label = 1; @@ -903,7 +901,7 @@ expand_builtin_setjmp_setup (rtx buf_add If RECEIVER_LABEL is NULL, instead contruct a nonlocal goto handler. */ void -expand_builtin_setjmp_receiver (rtx receiver_label ATTRIBUTE_UNUSED) +expand_builtin_setjmp_receiver (rtx receiver_label) { rtx chain; @@ -919,9 +917,7 @@ expand_builtin_setjmp_receiver (rtx rece /* Now put in the code to restore the frame pointer, and argument pointer, if needed. */ -#ifdef HAVE_nonlocal_goto - if (! HAVE_nonlocal_goto) -#endif + if (! targetm.have_nonlocal_goto ()) { /* First adjust our frame pointer to its actual value. It was previously set to the start of the virtual area corresponding to @@ -972,17 +968,12 @@ expand_builtin_setjmp_receiver (rtx rece } #endif -#ifdef HAVE_builtin_setjmp_receiver - if (receiver_label != NULL && HAVE_builtin_setjmp_receiver) -emit_insn (gen_builtin_setjmp_receiver (receiver_label)); + if (receiver_label != NULL && targetm.have_builtin_setjmp_receiver ()) +emit_insn (targetm.gen_builtin_setjmp_receiver (receiver_label)); + else if (targetm.have_nonlocal_goto_receiver ()) +emit_insn (targetm.gen_nonlocal_goto_receiver ()); else -#endif -#ifdef HAVE_nonlocal_goto_receiver -if (HAVE_nonlocal_goto_receiver) - emit_insn (gen_nonlocal_goto_receiver ()); -else -#endif - { /* Nothing */ } +{ /* Nothing */ } /* We must not allow the code we just generated to be reordered by scheduling. Specifically, the update of the frame pointer must @@ -1019,11 +1010,9 @@ expand_builtin_longjmp (rtx buf_addr, rt gcc_assert (value == const1_rtx); last = get_last_insn (); -#ifdef HAVE_builtin_longjmp - if (HAVE_builtin_longjmp) -emit_insn (gen_builtin_longjmp (buf_addr)); + if (targetm.have_builtin_longjmp ()) +emit_insn (targetm.gen_builtin_longjmp (buf_addr)); else -#endif { fp = gen_rtx_MEM (Pmode, buf_addr); lab = gen_rtx_MEM (Pmode, plus_constant (Pmode, buf_addr, @@ -1037,14 +1026,12 @@ expand_builtin_longjmp (rtx buf_addr, rt /* Pick up FP, label, and SP from the block and jump. This code is from expand_goto in stmt.c; see there for detailed comments. */ -#ifdef HAVE_nonlocal_goto - if (HAVE_nonlocal_goto) + if (targetm.have_nonlocal_goto ()) /* We have to pass a value to the nonlocal_goto pattern that will get copied into
[committed] Use target-insns.def for untyped call/return
Bootstrapped & regression-tested on x86_64-linux-gnu and aarch64-linux-gnu. Also tested via config-list.mk. Committed as preapproved. Thanks, Richard gcc/ * target-insns.def (untyped_call, untyped_return): New targetm instruction patterns. * builtins.c (expand_builtin_apply): Use them instead of HAVE_*/gen_* interface. (result_vector): Define unconditionally. Index: gcc/target-insns.def === --- gcc/target-insns.def2015-07-05 08:48:34.157410329 +0100 +++ gcc/target-insns.def2015-07-05 08:48:34.157410329 +0100 @@ -50,3 +50,5 @@ DEF_TARGET_INSN (sibcall_epilogue, (void DEF_TARGET_INSN (simple_return, (void)) DEF_TARGET_INSN (store_multiple, (rtx x0, rtx x1, rtx x2)) DEF_TARGET_INSN (tablejump, (rtx x0, rtx x1)) +DEF_TARGET_INSN (untyped_call, (rtx x0, rtx x1, rtx x2)) +DEF_TARGET_INSN (untyped_return, (rtx x0, rtx x1)) Index: gcc/builtins.c === --- gcc/builtins.c 2015-07-05 08:48:34.157410329 +0100 +++ gcc/builtins.c 2015-07-05 08:48:34.153410375 +0100 @@ -104,9 +104,7 @@ static int target_char_cast (tree, char static rtx get_memory_rtx (tree, tree); static int apply_args_size (void); static int apply_result_size (void); -#if defined (HAVE_untyped_call) || defined (HAVE_untyped_return) static rtx result_vector (int, rtx); -#endif static void expand_builtin_prefetch (tree); static rtx expand_builtin_apply_args (void); static rtx expand_builtin_apply_args_1 (void); @@ -1448,7 +1446,6 @@ apply_result_size (void) return size; } -#if defined (HAVE_untyped_call) || defined (HAVE_untyped_return) /* Create a vector describing the result block RESULT. If SAVEP is true, the result block is used to save the values; otherwise it is used to restore the values. */ @@ -1477,7 +1474,6 @@ result_vector (int savep, rtx result) } return gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (nelts, savevec)); } -#endif /* HAVE_untyped_call or HAVE_untyped_return */ /* Save the state required to perform an untyped call with the same arguments as were passed to the current function. */ @@ -1698,12 +1694,13 @@ expand_builtin_apply (rtx function, rtx function = memory_address (FUNCTION_MODE, function); /* Generate the actual call instruction and save the return value. */ -#ifdef HAVE_untyped_call - if (HAVE_untyped_call) -emit_call_insn (gen_untyped_call (gen_rtx_MEM (FUNCTION_MODE, function), - result, result_vector (1, result))); + if (targetm.have_untyped_call ()) +{ + rtx mem = gen_rtx_MEM (FUNCTION_MODE, function); + emit_call_insn (targetm.gen_untyped_call (mem, result, + result_vector (1, result))); +} else -#endif #ifdef HAVE_call_value if (HAVE_call_value) { @@ -1767,14 +1764,13 @@ expand_builtin_return (rtx result) apply_result_size (); result = gen_rtx_MEM (BLKmode, result); -#ifdef HAVE_untyped_return - if (HAVE_untyped_return) + if (targetm.have_untyped_return ()) { - emit_jump_insn (gen_untyped_return (result, result_vector (0, result))); + rtx vector = result_vector (0, result); + emit_jump_insn (targetm.gen_untyped_return (result, vector)); emit_barrier (); return; } -#endif /* Restore the return value and note that each value is used. */ size = 0;
[committed] Use target-insns.def for prefetch
Bootstrapped & regression-tested on x86_64-linux-gnu and aarch64-linux-gnu. Also tested via config-list.mk. Committed as preapproved. Thanks, Richard gcc/ * target-insns.def (prefetch): New targetm instruction pattern. * tree-ssa-loop-prefetch.c: Include targeth. (tree_ssa_prefetch_arrays): Use prefetch targetm pattern instead of HAVE_*/gen_* interface. * builtins.c (expand_builtin_prefetch): Likewise. * toplev.c (process_options): Likewise. Index: gcc/target-insns.def === --- gcc/target-insns.def2015-07-05 08:49:32.128750538 +0100 +++ gcc/target-insns.def2015-07-05 08:49:32.120750686 +0100 @@ -44,6 +44,7 @@ DEF_TARGET_INSN (mem_thread_fence, (rtx DEF_TARGET_INSN (memory_barrier, (void)) DEF_TARGET_INSN (nonlocal_goto, (rtx x0, rtx x1, rtx x2, rtx x3)) DEF_TARGET_INSN (nonlocal_goto_receiver, (void)) +DEF_TARGET_INSN (prefetch, (rtx x0, rtx x1, rtx x2)) DEF_TARGET_INSN (prologue, (void)) DEF_TARGET_INSN (return, (void)) DEF_TARGET_INSN (sibcall_epilogue, (void)) Index: gcc/tree-ssa-loop-prefetch.c === --- gcc/tree-ssa-loop-prefetch.c2015-07-05 08:49:32.128750538 +0100 +++ gcc/tree-ssa-loop-prefetch.c2015-07-05 08:49:32.124750587 +0100 @@ -57,6 +57,7 @@ Free Software Foundation; either version #include "langhooks.h" #include "tree-inline.h" #include "tree-data-ref.h" +#include "target.h" /* FIXME: Needed for optabs, but this should all be moved to a TBD interface @@ -216,10 +217,6 @@ #define HAVE_BACKWARD_PREFETCH 0 #define ACCEPTABLE_MISS_RATE 50 #endif -#ifndef HAVE_prefetch -#define HAVE_prefetch 0 -#endif - #define L1_CACHE_SIZE_BYTES ((unsigned) (L1_CACHE_SIZE * 1024)) #define L2_CACHE_SIZE_BYTES ((unsigned) (L2_CACHE_SIZE * 1024)) @@ -1954,11 +1951,11 @@ tree_ssa_prefetch_arrays (void) bool unrolled = false; int todo_flags = 0; - if (!HAVE_prefetch + if (!targetm.have_prefetch () /* It is possible to ask compiler for say -mtune=i486 -march=pentium4. -mtune=i486 causes us having PREFETCH_BLOCK 0, since this is part of processor costs and i486 does not have prefetch, but --march=pentium4 causes HAVE_prefetch to be true. Ugh. */ +-march=pentium4 causes targetm.have_prefetch to be true. Ugh. */ || PREFETCH_BLOCK == 0) return 0; Index: gcc/builtins.c === --- gcc/builtins.c 2015-07-05 08:49:32.128750538 +0100 +++ gcc/builtins.c 2015-07-05 08:49:32.120750686 +0100 @@ -1282,18 +1282,16 @@ expand_builtin_prefetch (tree exp) op2 = const0_rtx; } -#ifdef HAVE_prefetch - if (HAVE_prefetch) + if (targetm.have_prefetch ()) { struct expand_operand ops[3]; create_address_operand (&ops[0], op0); create_integer_operand (&ops[1], INTVAL (op1)); create_integer_operand (&ops[2], INTVAL (op2)); - if (maybe_expand_insn (CODE_FOR_prefetch, 3, ops)) + if (maybe_expand_insn (targetm.code_for_prefetch, 3, ops)) return; } -#endif /* Don't do anything with direct references to volatile memory, but generate code to handle other side effects. */ Index: gcc/toplev.c === --- gcc/toplev.c2015-07-05 08:49:32.128750538 +0100 +++ gcc/toplev.c2015-07-05 08:49:32.124750587 +0100 @@ -1571,19 +1571,16 @@ process_options (void) } } -#ifndef HAVE_prefetch - if (flag_prefetch_loop_arrays > 0) + if (flag_prefetch_loop_arrays > 0 && !targetm.code_for_prefetch) { warning (0, "-fprefetch-loop-arrays not supported for this target"); flag_prefetch_loop_arrays = 0; } -#else - if (flag_prefetch_loop_arrays > 0 && !HAVE_prefetch) + else if (flag_prefetch_loop_arrays > 0 && !targetm.have_prefetch ()) { warning (0, "-fprefetch-loop-arrays not supported for this target (try -march switches)"); flag_prefetch_loop_arrays = 0; } -#endif /* This combination of options isn't handled for i386 targets and doesn't make much sense anyway, so don't allow it. */
[committed] Use target-insns.def for trap
Bootstrapped & regression-tested on x86_64-linux-gnu and aarch64-linux-gnu. Also tested via config-list.mk. Committed as preapproved. Thanks, Richard gcc/ * target-insns.def (trap): New targetm instruction pattern. * builtins.c (expand_builtin_trap): Use it instead of HAVE_*/gen_* interface. * explow.c (allocate_dynamic_stack_space): Likewise. * ifcvt.c (find_if_header): Likewise. Index: gcc/target-insns.def === --- gcc/target-insns.def2015-07-05 08:50:33.976046688 +0100 +++ gcc/target-insns.def2015-07-05 08:50:33.972046718 +0100 @@ -51,5 +51,6 @@ DEF_TARGET_INSN (sibcall_epilogue, (void DEF_TARGET_INSN (simple_return, (void)) DEF_TARGET_INSN (store_multiple, (rtx x0, rtx x1, rtx x2)) DEF_TARGET_INSN (tablejump, (rtx x0, rtx x1)) +DEF_TARGET_INSN (trap, (void)) DEF_TARGET_INSN (untyped_call, (rtx x0, rtx x1, rtx x2)) DEF_TARGET_INSN (untyped_return, (rtx x0, rtx x1)) Index: gcc/builtins.c === --- gcc/builtins.c 2015-07-05 08:50:33.976046688 +0100 +++ gcc/builtins.c 2015-07-05 08:50:33.972046718 +0100 @@ -4737,10 +4737,9 @@ expand_builtin_assume_aligned (tree exp, void expand_builtin_trap (void) { -#ifdef HAVE_trap - if (HAVE_trap) + if (targetm.have_trap ()) { - rtx_insn *insn = emit_insn (gen_trap ()); + rtx_insn *insn = emit_insn (targetm.gen_trap ()); /* For trap insns when not accumulating outgoing args force REG_ARGS_SIZE note to prevent crossjumping of calls with different args sizes. */ @@ -4748,7 +4747,6 @@ expand_builtin_trap (void) add_reg_note (insn, REG_ARGS_SIZE, GEN_INT (stack_pointer_delta)); } else -#endif emit_library_call (abort_libfunc, LCT_NORETURN, VOIDmode, 0); emit_barrier (); } Index: gcc/explow.c === --- gcc/explow.c2015-07-05 08:50:33.976046688 +0100 +++ gcc/explow.c2015-07-05 08:50:33.972046718 +0100 @@ -1422,11 +1422,9 @@ allocate_dynamic_stack_space (rtx size, emit_cmp_and_jump_insns (available, size, GEU, NULL_RTX, Pmode, 1, space_available); -#ifdef HAVE_trap - if (HAVE_trap) - emit_insn (gen_trap ()); + if (targetm.have_trap ()) + emit_insn (targetm.gen_trap ()); else -#endif error ("stack limits not supported on this target"); emit_barrier (); emit_label (space_available); Index: gcc/ifcvt.c === --- gcc/ifcvt.c 2015-07-05 08:50:33.976046688 +0100 +++ gcc/ifcvt.c 2015-07-05 08:50:33.976046688 +0100 @@ -67,9 +67,6 @@ #define HAVE_incscc 0 #ifndef HAVE_decscc #define HAVE_decscc 0 #endif -#ifndef HAVE_trap -#define HAVE_trap 0 -#endif #ifndef MAX_CONDITIONAL_EXECUTE #define MAX_CONDITIONAL_EXECUTE \ @@ -3414,7 +3411,7 @@ find_if_header (basic_block test_bb, int && cond_exec_find_if_block (&ce_info)) goto success; - if (HAVE_trap + if (targetm.have_trap () && optab_handler (ctrap_optab, word_mode) != CODE_FOR_nothing && find_cond_trap (test_bb, then_edge, else_edge)) goto success;
[committed] Use target-insns.def for save/restore stack
Bootstrapped & regression-tested on x86_64-linux-gnu and aarch64-linux-gnu. Also tested via config-list.mk. Committed as preapproved. Thanks, Richard gcc/ * target-insns.def (restore_stack_block, restore_stack_function) (restore_stack_nonlocal, save_stack_block, save_stack_function) (save_stack_nonlocal): New targetm instruction patterns. * builtins.c (expand_builtin_apply): Use them instead of HAVE_*/gen_* interface. * explow.c (emit_stack_save, emit_stack_restore): Likewise. Index: gcc/target-insns.def === --- gcc/target-insns.def2015-07-05 08:51:23.963477604 +0100 +++ gcc/target-insns.def2015-07-05 08:51:23.955477687 +0100 @@ -46,7 +46,13 @@ DEF_TARGET_INSN (nonlocal_goto, (rtx x0, DEF_TARGET_INSN (nonlocal_goto_receiver, (void)) DEF_TARGET_INSN (prefetch, (rtx x0, rtx x1, rtx x2)) DEF_TARGET_INSN (prologue, (void)) +DEF_TARGET_INSN (restore_stack_block, (rtx x0, rtx x1)) +DEF_TARGET_INSN (restore_stack_function, (rtx x0, rtx x1)) +DEF_TARGET_INSN (restore_stack_nonlocal, (rtx x0, rtx x1)) DEF_TARGET_INSN (return, (void)) +DEF_TARGET_INSN (save_stack_block, (rtx x0, rtx x1)) +DEF_TARGET_INSN (save_stack_function, (rtx x0, rtx x1)) +DEF_TARGET_INSN (save_stack_nonlocal, (rtx x0, rtx x1)) DEF_TARGET_INSN (sibcall_epilogue, (void)) DEF_TARGET_INSN (simple_return, (void)) DEF_TARGET_INSN (store_multiple, (rtx x0, rtx x1, rtx x2)) Index: gcc/builtins.c === --- gcc/builtins.c 2015-07-05 08:51:23.963477604 +0100 +++ gcc/builtins.c 2015-07-05 08:51:23.955477687 +0100 @@ -1611,11 +1611,9 @@ expand_builtin_apply (rtx function, rtx NO_DEFER_POP; /* Save the stack with nonlocal if available. */ -#ifdef HAVE_save_stack_nonlocal - if (HAVE_save_stack_nonlocal) + if (targetm.have_save_stack_nonlocal ()) emit_stack_save (SAVE_NONLOCAL, &old_stack_level); else -#endif emit_stack_save (SAVE_BLOCK, &old_stack_level); /* Allocate a block of memory onto the stack and copy the memory @@ -1732,11 +1730,9 @@ expand_builtin_apply (rtx function, rtx add_function_usage_to (call_insn, call_fusage); /* Restore the stack. */ -#ifdef HAVE_save_stack_nonlocal - if (HAVE_save_stack_nonlocal) + if (targetm.have_save_stack_nonlocal ()) emit_stack_restore (SAVE_NONLOCAL, old_stack_level); else -#endif emit_stack_restore (SAVE_BLOCK, old_stack_level); fixup_args_size_notes (call_insn, get_last_insn (), 0); Index: gcc/explow.c === --- gcc/explow.c2015-07-05 08:51:23.963477604 +0100 +++ gcc/explow.c2015-07-05 08:51:23.955477687 +0100 @@ -973,30 +973,24 @@ emit_stack_save (enum save_level save_le { rtx sa = *psave; /* The default is that we use a move insn and save in a Pmode object. */ - rtx (*fcn) (rtx, rtx) = gen_move_insn_uncast; + rtx_insn *(*fcn) (rtx, rtx) = gen_move_insn; machine_mode mode = STACK_SAVEAREA_MODE (save_level); /* See if this machine has anything special to do for this kind of save. */ switch (save_level) { -#ifdef HAVE_save_stack_block case SAVE_BLOCK: - if (HAVE_save_stack_block) - fcn = gen_save_stack_block; + if (targetm.have_save_stack_block ()) + fcn = targetm.gen_save_stack_block; break; -#endif -#ifdef HAVE_save_stack_function case SAVE_FUNCTION: - if (HAVE_save_stack_function) - fcn = gen_save_stack_function; + if (targetm.have_save_stack_function ()) + fcn = targetm.gen_save_stack_function; break; -#endif -#ifdef HAVE_save_stack_nonlocal case SAVE_NONLOCAL: - if (HAVE_save_stack_nonlocal) - fcn = gen_save_stack_nonlocal; + if (targetm.have_save_stack_nonlocal ()) + fcn = targetm.gen_save_stack_nonlocal; break; -#endif default: break; } @@ -1028,7 +1022,7 @@ emit_stack_save (enum save_level save_le emit_stack_restore (enum save_level save_level, rtx sa) { /* The default is that we use a move insn. */ - rtx (*fcn) (rtx, rtx) = gen_move_insn_uncast; + rtx_insn *(*fcn) (rtx, rtx) = gen_move_insn; /* If stack_realign_drap, the x86 backend emits a prologue that aligns both STACK_POINTER and HARD_FRAME_POINTER. @@ -1047,24 +1041,18 @@ emit_stack_restore (enum save_level save /* See if this machine has anything special to do for this kind of save. */ switch (save_level) { -#ifdef HAVE_restore_stack_block case SAVE_BLOCK: - if (HAVE_restore_stack_block) - fcn = gen_restore_stack_block; + if (targetm.have_restore_stack_block ()) + fcn = targetm.gen_restore_stack_block; break; -#endif -#ifdef HAVE_restore_stack_function case SAVE_FUNCTION: - if (HAVE_restore_stack_function) - fcn = gen_restore_stack_function; + if (targetm.have_restore_stack_functio
[committed] Remove gen_move_insn_uncast
The previous patch removed the only users of gen_move_insn_uncast (which was added to make those functions work with rtx_insn *). Bootstrapped & regression-tested on x86_64-linux-gnu and aarch64-linux-gnu. Also tested via config-list.mk. Committed as obvious. Thanks, Richard gcc/ * expr.h (gen_move_insn_uncast): Delete. * expr.c (gen_move_insn_uncast): Delete. Index: gcc/expr.h === --- gcc/expr.h 2015-07-05 08:54:31.709339940 +0100 +++ gcc/expr.h 2015-07-05 08:54:31.701340021 +0100 @@ -204,7 +204,6 @@ extern rtx store_by_pieces (rtx, unsigne /* Emit insns to set X from Y. */ extern rtx_insn *emit_move_insn (rtx, rtx); extern rtx_insn *gen_move_insn (rtx, rtx); -extern rtx gen_move_insn_uncast (rtx, rtx); /* Emit insns to set X from Y, with no frills. */ extern rtx_insn *emit_move_insn_1 (rtx, rtx); Index: gcc/expr.c === --- gcc/expr.c 2015-07-05 08:54:31.709339940 +0100 +++ gcc/expr.c 2015-07-05 08:54:31.701340021 +0100 @@ -3625,15 +3625,6 @@ gen_move_insn (rtx x, rtx y) return seq; } -/* Same as above, but return rtx (used as a callback, which must have - prototype compatible with other functions returning rtx). */ - -rtx -gen_move_insn_uncast (rtx x, rtx y) -{ - return gen_move_insn (x, y); -} - /* If Y is representable exactly in a narrower mode, and the target can perform the extension directly from constant or memory, then emit the move as an extension. */
[committed] Use target-insns.def for stack_protect_{set,test}
Bootstrapped & regression-tested on x86_64-linux-gnu and aarch64-linux-gnu. Also tested via config-list.mk. Committed as preapproved. Thanks, Richard gcc/ * target-insns.def (stack_protect_set, stack_protect_test): New targetm instruction patterns. * cfgexpand.c (stack_protect_prologue): Use them instead of HAVE_*/gen_* interface. * function.c (stack_protect_epilogue): Likewise. Index: gcc/target-insns.def === --- gcc/target-insns.def2015-07-05 08:55:39.336569730 +0100 +++ gcc/target-insns.def2015-07-05 08:55:39.332569792 +0100 @@ -55,6 +55,8 @@ DEF_TARGET_INSN (save_stack_function, (r DEF_TARGET_INSN (save_stack_nonlocal, (rtx x0, rtx x1)) DEF_TARGET_INSN (sibcall_epilogue, (void)) DEF_TARGET_INSN (simple_return, (void)) +DEF_TARGET_INSN (stack_protect_set, (rtx x0, rtx x1)) +DEF_TARGET_INSN (stack_protect_test, (rtx x0, rtx x1, rtx x2)) DEF_TARGET_INSN (store_multiple, (rtx x0, rtx x1, rtx x2)) DEF_TARGET_INSN (tablejump, (rtx x0, rtx x1)) DEF_TARGET_INSN (trap, (void)) Index: gcc/cfgexpand.c === --- gcc/cfgexpand.c 2015-07-05 08:55:39.336569730 +0100 +++ gcc/cfgexpand.c 2015-07-05 08:55:39.328569856 +0100 @@ -5767,11 +5767,6 @@ expand_main_function (void) /* Expand code to initialize the stack_protect_guard. This is invoked at the beginning of a function to be protected. */ -#ifndef HAVE_stack_protect_set -# define HAVE_stack_protect_set0 -# define gen_stack_protect_set(x,y)(gcc_unreachable (), NULL_RTX) -#endif - static void stack_protect_prologue (void) { @@ -5783,15 +5778,12 @@ stack_protect_prologue (void) /* Allow the target to copy from Y to X without leaking Y into a register. */ - if (HAVE_stack_protect_set) -{ - rtx insn = gen_stack_protect_set (x, y); - if (insn) - { - emit_insn (insn); - return; - } -} + if (targetm.have_stack_protect_set ()) +if (rtx_insn *insn = targetm.gen_stack_protect_set (x, y)) + { + emit_insn (insn); + return; + } /* Otherwise do a straight move. */ emit_move_insn (x, y); Index: gcc/function.c === --- gcc/function.c 2015-07-05 08:55:39.336569730 +0100 +++ gcc/function.c 2015-07-05 08:55:39.332569792 +0100 @@ -4874,11 +4874,6 @@ init_function_start (tree subr) /* Expand code to verify the stack_protect_guard. This is invoked at the end of a function to be protected. */ -#ifndef HAVE_stack_protect_test -# define HAVE_stack_protect_test 0 -# define gen_stack_protect_test(x, y, z) (gcc_unreachable (), NULL_RTX) -#endif - void stack_protect_epilogue (void) { @@ -4891,13 +4886,12 @@ stack_protect_epilogue (void) /* Allow the target to compare Y with X without leaking either into a register. */ - switch (HAVE_stack_protect_test != 0) + switch (targetm.have_stack_protect_test ()) { case 1: - tmp = gen_stack_protect_test (x, y, label); - if (tmp) + if (rtx_insn *seq = targetm.gen_stack_protect_test (x, y, label)) { - emit_insn (tmp); + emit_insn (seq); break; } /* FALLTHRU */
[committed] Use target-insns.def for various stack patterns
Bootstrapped & regression-tested on x86_64-linux-gnu and aarch64-linux-gnu. Also tested via config-list.mk. Committed as preapproved. Thanks, Richard gcc/ * target-insns.def (allocate_stack, check_stack, probe_stack) (probe_stack_address, split_stack_prologue, split_stack_space_check): New targetm instruction patterns. * explow.c (allocate_dynamic_stack_space): Use them instead of HAVE_*/gen_* interface. (emit_stack_probe): Likewise. (probe_stack_range): Likewise. * function.c (thread_prologue_and_epilogue_insns): Likewise. Index: gcc/target-insns.def === --- gcc/target-insns.def2015-07-05 08:56:54.099718182 +0100 +++ gcc/target-insns.def2015-07-05 08:57:13.0 +0100 @@ -30,11 +30,13 @@ Patterns that take no operands should have a prototype "(void)". Instructions should be documented in md.texi rather than here. */ +DEF_TARGET_INSN (allocate_stack, (rtx x0, rtx x1)) DEF_TARGET_INSN (builtin_longjmp, (rtx x0)) DEF_TARGET_INSN (builtin_setjmp_receiver, (rtx x0)) DEF_TARGET_INSN (builtin_setjmp_setup, (rtx x0)) DEF_TARGET_INSN (canonicalize_funcptr_for_compare, (rtx x0, rtx x1)) DEF_TARGET_INSN (casesi, (rtx x0, rtx x1, rtx x2, rtx x3, rtx x4)) +DEF_TARGET_INSN (check_stack, (rtx x0)) DEF_TARGET_INSN (epilogue, (void)) DEF_TARGET_INSN (exception_receiver, (void)) DEF_TARGET_INSN (jump, (rtx x0)) @@ -45,6 +47,8 @@ DEF_TARGET_INSN (memory_barrier, (void)) DEF_TARGET_INSN (nonlocal_goto, (rtx x0, rtx x1, rtx x2, rtx x3)) DEF_TARGET_INSN (nonlocal_goto_receiver, (void)) DEF_TARGET_INSN (prefetch, (rtx x0, rtx x1, rtx x2)) +DEF_TARGET_INSN (probe_stack, (rtx x0)) +DEF_TARGET_INSN (probe_stack_address, (rtx x0)) DEF_TARGET_INSN (prologue, (void)) DEF_TARGET_INSN (restore_stack_block, (rtx x0, rtx x1)) DEF_TARGET_INSN (restore_stack_function, (rtx x0, rtx x1)) @@ -55,6 +59,8 @@ DEF_TARGET_INSN (save_stack_function, (r DEF_TARGET_INSN (save_stack_nonlocal, (rtx x0, rtx x1)) DEF_TARGET_INSN (sibcall_epilogue, (void)) DEF_TARGET_INSN (simple_return, (void)) +DEF_TARGET_INSN (split_stack_prologue, (void)) +DEF_TARGET_INSN (split_stack_space_check, (rtx x0, rtx x1)) DEF_TARGET_INSN (stack_protect_set, (rtx x0, rtx x1)) DEF_TARGET_INSN (stack_protect_test, (rtx x0, rtx x1, rtx x2)) DEF_TARGET_INSN (store_multiple, (rtx x0, rtx x1, rtx x2)) Index: gcc/explow.c === --- gcc/explow.c2015-07-05 08:56:54.099718182 +0100 +++ gcc/explow.c2015-07-05 08:56:54.091718280 +0100 @@ -1308,16 +1308,15 @@ allocate_dynamic_stack_space (rtx size, available_label = NULL; -#ifdef HAVE_split_stack_space_check - if (HAVE_split_stack_space_check) + if (targetm.have_split_stack_space_check ()) { available_label = gen_label_rtx (); /* This instruction will branch to AVAILABLE_LABEL if there are SIZE bytes available on the stack. */ - emit_insn (gen_split_stack_space_check (size, available_label)); + emit_insn (targetm.gen_split_stack_space_check +(size, available_label)); } -#endif /* The __morestack_allocate_stack_space function will allocate memory using malloc. If the alignment of the memory returned @@ -1375,8 +1374,7 @@ allocate_dynamic_stack_space (rtx size, /* Perform the required allocation from the stack. Some systems do this differently than simply incrementing/decrementing from the stack pointer, such as acquiring the space by calling malloc(). */ -#ifdef HAVE_allocate_stack - if (HAVE_allocate_stack) + if (targetm.have_allocate_stack ()) { struct expand_operand ops[2]; /* We don't have to check against the predicate for operand 0 since @@ -1384,10 +1382,9 @@ allocate_dynamic_stack_space (rtx size, be valid for the operand. */ create_fixed_operand (&ops[0], target); create_convert_operand_to (&ops[1], size, STACK_SIZE_MODE, true); - expand_insn (CODE_FOR_allocate_stack, 2, ops); + expand_insn (targetm.code_for_allocate_stack, 2, ops); } else -#endif { int saved_stack_pointer_delta; @@ -1491,22 +1488,18 @@ set_stack_check_libfunc (const char *lib void emit_stack_probe (rtx address) { -#ifdef HAVE_probe_stack_address - if (HAVE_probe_stack_address) -emit_insn (gen_probe_stack_address (address)); + if (targetm.have_probe_stack_address ()) +emit_insn (targetm.gen_probe_stack_address (address)); else -#endif { rtx memref = gen_rtx_MEM (word_mode, address); MEM_VOLATILE_P (memref) = 1; /* See if we have an insn to probe the stack. */ -#ifdef HAVE_probe_stack - if (HAVE_probe_stack) -emit_insn (gen_probe_stack (memref)); + if (targetm.have_probe_stack ()) +emit_insn (targetm.gen_probe_stack (m
[committed] Use target-insns.def for clear_cache
Bootstrapped & regression-tested on x86_64-linux-gnu and aarch64-linux-gnu. Also tested via config-list.mk. Committed as preapproved. Thanks, Richard gcc/ * target-insns.def (clear_cache): New targetm instruction pattern. * builtins.c (expand_builtin___clear_cache): Use it instead of HAVE_*/gen_* interface. Index: gcc/target-insns.def === --- gcc/target-insns.def2015-07-05 08:58:38.390530076 +0100 +++ gcc/target-insns.def2015-07-05 08:58:38.386530121 +0100 @@ -37,6 +37,7 @@ DEF_TARGET_INSN (builtin_setjmp_setup, ( DEF_TARGET_INSN (canonicalize_funcptr_for_compare, (rtx x0, rtx x1)) DEF_TARGET_INSN (casesi, (rtx x0, rtx x1, rtx x2, rtx x3, rtx x4)) DEF_TARGET_INSN (check_stack, (rtx x0)) +DEF_TARGET_INSN (clear_cache, (rtx x0, rtx x1)) DEF_TARGET_INSN (epilogue, (void)) DEF_TARGET_INSN (exception_receiver, (void)) DEF_TARGET_INSN (jump, (rtx x0)) Index: gcc/builtins.c === --- gcc/builtins.c 2015-07-05 08:58:38.390530076 +0100 +++ gcc/builtins.c 2015-07-05 08:58:38.382530166 +0100 @@ -4807,20 +4807,22 @@ expand_builtin_copysign (tree exp, rtx t /* Expand a call to __builtin___clear_cache. */ static rtx -expand_builtin___clear_cache (tree exp ATTRIBUTE_UNUSED) +expand_builtin___clear_cache (tree exp) { -#ifndef HAVE_clear_cache + if (!targetm.code_for_clear_cache) +{ #ifdef CLEAR_INSN_CACHE - /* There is no "clear_cache" insn, and __clear_cache() in libgcc - does something. Just do the default expansion to a call to - __clear_cache(). */ - return NULL_RTX; + /* There is no "clear_cache" insn, and __clear_cache() in libgcc +does something. Just do the default expansion to a call to +__clear_cache(). */ + return NULL_RTX; #else - /* There is no "clear_cache" insn, and __clear_cache() in libgcc - does nothing. There is no need to call it. Do nothing. */ - return const0_rtx; + /* There is no "clear_cache" insn, and __clear_cache() in libgcc +does nothing. There is no need to call it. Do nothing. */ + return const0_rtx; #endif /* CLEAR_INSN_CACHE */ -#else +} + /* We have a "clear_cache" insn, and it will handle everything. */ tree begin, end; rtx begin_rtx, end_rtx; @@ -4834,7 +4836,7 @@ expand_builtin___clear_cache (tree exp A return const0_rtx; } - if (HAVE_clear_cache) + if (targetm.have_clear_cache ()) { struct expand_operand ops[2]; @@ -4846,11 +4848,10 @@ expand_builtin___clear_cache (tree exp A create_address_operand (&ops[0], begin_rtx); create_address_operand (&ops[1], end_rtx); - if (maybe_expand_insn (CODE_FOR_clear_cache, 2, ops)) + if (maybe_expand_insn (targetm.code_for_clear_cache, 2, ops)) return const0_rtx; } return const0_rtx; -#endif /* HAVE_clear_cache */ } /* Given a trampoline address, make sure it satisfies TRAMPOLINE_ALIGNMENT. */
[committed] Use target-insns.def for doloop_{begin,end}
Bootstrapped & regression-tested on x86_64-linux-gnu and aarch64-linux-gnu. Also tested via config-list.mk. Committed as preapproved. Thanks, Richard gcc/ * target-insns.def (doloop_begin, doloop_end): New targetm instruction patterns. * loop-init.c: Include target.h. (pass_loop2::gate): Use the new targetm patterns instead of HAVE_*/gen_* interface. (pass_rtl_doloop::gate): Likewise. (pass_rtl_doloop::execute): Remove preprocessor condition. * hw-doloop.c: Build unconditionally. * loop-doloop.c: Likewise. (doloop_optimize): Use the new targetm patterns instead of HAVE_*/gen_* interface. (doloop_modify): Likewise. Change type of doloop_seq to rtx_insn *. * modulo-sched.c (doloop_register_get): Likewise. Index: gcc/target-insns.def === --- gcc/target-insns.def2015-06-30 12:08:59.067622994 +0100 +++ gcc/target-insns.def2015-06-30 12:08:59.063623075 +0100 @@ -37,6 +37,8 @@ DEF_TARGET_INSN (builtin_setjmp_setup, ( DEF_TARGET_INSN (casesi, (rtx x0, rtx x1, rtx x2, rtx x3, rtx x4)) DEF_TARGET_INSN (check_stack, (rtx x0)) DEF_TARGET_INSN (clear_cache, (rtx x0, rtx x1)) +DEF_TARGET_INSN (doloop_begin, (rtx x0, rtx x1)) +DEF_TARGET_INSN (doloop_end, (rtx x0, rtx x1)) DEF_TARGET_INSN (epilogue, (void)) DEF_TARGET_INSN (exception_receiver, (void)) DEF_TARGET_INSN (jump, (rtx x0)) Index: gcc/loop-init.c === --- gcc/loop-init.c 2015-06-30 12:08:59.067622994 +0100 +++ gcc/loop-init.c 2015-06-30 12:08:59.059623141 +0100 @@ -41,6 +41,7 @@ Software Foundation; either version 3, o #include "tree-ssa-loop-niter.h" #include "loop-unroll.h" #include "tree-scalar-evolution.h" +#include "target.h" /* Apply FLAGS to the loop state. */ @@ -377,10 +378,8 @@ pass_loop2::gate (function *fun) && (flag_move_loop_invariants || flag_unswitch_loops || flag_unroll_loops -#ifdef HAVE_doloop_end - || (flag_branch_on_count_reg && HAVE_doloop_end) -#endif - )) + || (flag_branch_on_count_reg + && targetm.have_doloop_end ( return true; else { @@ -644,20 +643,14 @@ const pass_data pass_data_rtl_doloop = bool pass_rtl_doloop::gate (function *) { -#ifdef HAVE_doloop_end - return (flag_branch_on_count_reg && HAVE_doloop_end); -#else - return false; -#endif + return (flag_branch_on_count_reg && targetm.have_doloop_end ()); } unsigned int -pass_rtl_doloop::execute (function *fun ATTRIBUTE_UNUSED) +pass_rtl_doloop::execute (function *fun) { -#ifdef HAVE_doloop_end if (number_of_loops (fun) > 1) doloop_optimize_loops (); -#endif return 0; } Index: gcc/hw-doloop.c === --- gcc/hw-doloop.c 2015-06-30 12:08:59.067622994 +0100 +++ gcc/hw-doloop.c 2015-06-30 12:08:59.059623141 +0100 @@ -52,8 +52,6 @@ Software Foundation; either version 3, o #include "hw-doloop.h" #include "dumpfile.h" -#ifdef HAVE_doloop_end - /* Dump information collected in LOOPS. */ static void dump_hwloops (hwloop_info loops) @@ -685,4 +683,3 @@ reorg_loops (bool do_reorder, struct hw_ if (dump_file) print_rtl (dump_file, get_insns ()); } -#endif Index: gcc/loop-doloop.c === --- gcc/loop-doloop.c 2015-06-30 12:08:59.067622994 +0100 +++ gcc/loop-doloop.c 2015-06-30 12:08:59.059623141 +0100 @@ -80,8 +80,6 @@ Software Foundation; either version 3, o register cannot be used for anything else but doloop -- ??? detect these cases). */ -#ifdef HAVE_doloop_end - /* Return the loop termination condition for PATTERN or zero if it is not a decrement and branch jump insn. */ @@ -414,7 +412,7 @@ add_test (rtx cond, edge *e, basic_block static void doloop_modify (struct loop *loop, struct niter_desc *desc, - rtx doloop_seq, rtx condition, rtx count) + rtx_insn *doloop_seq, rtx condition, rtx count) { rtx counter_reg; rtx tmp, noloop = NULL_RTX; @@ -562,21 +560,9 @@ doloop_modify (struct loop *loop, struct /* Some targets (eg, C4x) need to initialize special looping registers. */ -#ifdef HAVE_doloop_begin - { -rtx init; - -init = gen_doloop_begin (counter_reg, doloop_seq); -if (init) - { - start_sequence (); - emit_insn (init); - sequence = get_insns (); - end_sequence (); - emit_insn_after (sequence, BB_END (loop_preheader_edge (loop)->src)); - } - } -#endif + if (targetm.have_doloop_begin ()) +if (rtx_insn *seq = targetm.gen_doloop_begin (counter_reg, doloop_seq)) + emit_insn_after (seq, BB_END (loop_preheader_edge (loop)->src)); /* Insert the new low-overhead looping insn. */ emit_jump_insn_after (doloop_seq, BB_END (loop_end)); @@ -612
[committed] Use target-insns.def for insv, extv and extzv
Bootstrapped & regression-tested on x86_64-linux-gnu and aarch64-linux-gnu. Also tested via config-list.mk. Committed as preapproved. Thanks, Richard gcc/ * target-insns.def (extv, extzv, insv): New targetm instruction patterns. * optabs.c (get_extraction_insn): Use them instead of HAVE_*/gen_* interface. * recog.c (simplify_while_replacing): Likewise. Index: gcc/target-insns.def === --- gcc/target-insns.def2015-07-05 09:01:57.816257588 +0100 +++ gcc/target-insns.def2015-07-05 09:01:57.812257637 +0100 @@ -42,6 +42,9 @@ DEF_TARGET_INSN (doloop_begin, (rtx x0, DEF_TARGET_INSN (doloop_end, (rtx x0, rtx x1)) DEF_TARGET_INSN (epilogue, (void)) DEF_TARGET_INSN (exception_receiver, (void)) +DEF_TARGET_INSN (extv, (rtx x0, rtx x1, rtx x2, rtx x3)) +DEF_TARGET_INSN (extzv, (rtx x0, rtx x1, rtx x2, rtx x3)) +DEF_TARGET_INSN (insv, (rtx x0, rtx x1, rtx x2, rtx x3)) DEF_TARGET_INSN (jump, (rtx x0)) DEF_TARGET_INSN (load_multiple, (rtx x0, rtx x1, rtx x2)) DEF_TARGET_INSN (mem_signal_fence, (rtx x0)) Index: gcc/optabs.c === --- gcc/optabs.c2015-07-05 09:01:57.816257588 +0100 +++ gcc/optabs.c2015-07-05 09:01:57.808257686 +0100 @@ -8416,18 +8416,6 @@ expand_jump_insn (enum insn_code icode, } /* Reduce conditional compilation elsewhere. */ -#ifndef HAVE_insv -#define HAVE_insv 0 -#define CODE_FOR_insv CODE_FOR_nothing -#endif -#ifndef HAVE_extv -#define HAVE_extv 0 -#define CODE_FOR_extv CODE_FOR_nothing -#endif -#ifndef HAVE_extzv -#define HAVE_extzv 0 -#define CODE_FOR_extzv CODE_FOR_nothing -#endif /* Enumerates the possible types of structure operand to an extraction_insn. */ @@ -8512,25 +8500,25 @@ get_extraction_insn (extraction_insn *in switch (pattern) { case EP_insv: - if (HAVE_insv + if (targetm.have_insv () && get_traditional_extraction_insn (insn, type, mode, - CODE_FOR_insv, 0, 3)) + targetm.code_for_insv, 0, 3)) return true; return get_optab_extraction_insn (insn, type, mode, insv_optab, insvmisalign_optab, 2); case EP_extv: - if (HAVE_extv + if (targetm.have_extv () && get_traditional_extraction_insn (insn, type, mode, - CODE_FOR_extv, 1, 0)) + targetm.code_for_extv, 1, 0)) return true; return get_optab_extraction_insn (insn, type, mode, extv_optab, extvmisalign_optab, 3); case EP_extzv: - if (HAVE_extzv + if (targetm.have_extzv () && get_traditional_extraction_insn (insn, type, mode, - CODE_FOR_extzv, 1, 0)) + targetm.code_for_extzv, 1, 0)) return true; return get_optab_extraction_insn (insn, type, mode, extzv_optab, extzvmisalign_optab, 3); Index: gcc/recog.c === --- gcc/recog.c 2015-07-05 09:01:57.816257588 +0100 +++ gcc/recog.c 2015-07-05 09:01:57.812257637 +0100 @@ -566,15 +566,6 @@ cancel_changes (int num) } /* Reduce conditional compilation elsewhere. */ -#ifndef HAVE_extv -#define HAVE_extv 0 -#define CODE_FOR_extv CODE_FOR_nothing -#endif -#ifndef HAVE_extzv -#define HAVE_extzv 0 -#define CODE_FOR_extzv CODE_FOR_nothing -#endif - /* A subroutine of validate_replace_rtx_1 that tries to simplify the resulting rtx. */ @@ -690,15 +681,15 @@ simplify_while_replacing (rtx *loc, rtx machine_mode is_mode = GET_MODE (XEXP (x, 0)); int pos = INTVAL (XEXP (x, 2)); - if (GET_CODE (x) == ZERO_EXTRACT && HAVE_extzv) + if (GET_CODE (x) == ZERO_EXTRACT && targetm.have_extzv ()) { - wanted_mode = insn_data[CODE_FOR_extzv].operand[1].mode; + wanted_mode = insn_data[targetm.code_for_extzv].operand[1].mode; if (wanted_mode == VOIDmode) wanted_mode = word_mode; } - else if (GET_CODE (x) == SIGN_EXTRACT && HAVE_extv) + else if (GET_CODE (x) == SIGN_EXTRACT && targetm.have_extv ()) { - wanted_mode = insn_data[CODE_FOR_extv].operand[1].mode; + wanted_mode = insn_data[targetm.code_for_extv].operand[1].mode; if (wanted_mode == VOIDmode) wanted_mode = word_mode; }
Re: [committed] Remove condition from PA indirect_jump
John David Anglin writes: > The attached change removes the C condition from the PA indirect jump > since it depended on operands[] and this isn't generally allowed in > named patterns. > > Tested on hppa-unknown-linux-gnu and hppa2.0w-hp-hpux11.11. Committed > to trunk and active branches. Thanks!
fix segfault in verify_flow_info() with -dx option
Hi, Passing -dx causes segmentation fault: Test case: void f(void) {} ./test.c: In function 'f': ../test.c:3:1: internal compiler error: Segmentation fault } ^ 0xab6baf crash_signal /home/prathamesh.kulkarni/gnu-toolchain/src/gcc.git/gcc/toplev.c:366 0x694b14 verify_flow_info() /home/prathamesh.kulkarni/gnu-toolchain/src/gcc.git/gcc/cfghooks.c:109 0x9f7e64 execute_function_todo /home/prathamesh.kulkarni/gnu-toolchain/src/gcc.git/gcc/passes.c:1997 0x9f86eb execute_todo /home/prathamesh.kulkarni/gnu-toolchain/src/gcc.git/gcc/passes.c:2042 Started with r210068. It looks like -dx causes cfun->cfg to be NULL, and hence the segfault in verify_flow_info(). The attached patch tries to fix it by adding a check to cfun->cfg before calling verify_flow_info() from execute_function_todo(). Bootstrapped and tested on x86_64-unknown-linux-gnu. OK for trunk ? Thank you, Prathamesh diff --git a/gcc/passes.c b/gcc/passes.c index 4966334..8362554 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -1965,7 +1965,8 @@ execute_function_todo (function *fn, void *data) /* IPA passes leave basic-blocks unsplit, so make sure to not trip on that. */ if ((cfun->curr_properties & PROP_cfg) - && !from_ipa_pass) + && !from_ipa_pass + && cfun->cfg) verify_flow_info (); if (current_loops && loops_state_satisfies_p (LOOP_CLOSED_SSA)) 2015-07-05 Prathamesh Kulkarni * passes.c (execute_function_todo): Check for cfun->cfg before calling verify_flow_info().
Re: [PATCH 1/2][ARM] PR/65956 AAPCS update for alignment attribute
> Technically this is incorrect since AGGREGATE_TYPE_P includes ARRAY_TYPE > and ARRAY_TYPE doesn't have TYPE_FIELDS. I doubt we could reach that > case though (unless there's a language that allows passing arrays by value). Ada passes small array types by the method specified by the pass_by_reference hook (and large array types by reference). -- Eric Botcazou
flatten cfgloop.h
Hi, The attached patches flatten cfgloop.h. patch-1.diff moves around prototypes and structures to respective header-files. patch-2.diff (mostly auto-generated) replicates cfgloop.h includes in c files. Bootstrapped and tested on x86_64-unknown-linux-gnu with all front-ends. Built on all targets using config-list.mk. I left includes in cfgloop.h commented with #if 0 ... #endif. OK for trunk ? Thank you, Prathamesh 2015-07-05 Prathamesh Kulkarni * loop-invariant.h: New header file. * loop-init.h: Likewise. * loop-doloop.h: Likewise. * cfgloopanal.h: Likewise. * loop-iv.h: Likewise. * cfgloop.h: Include loop-invariant.h, loop-init.h, loop-doloop.h, cfgloopanal.h, loop-iv.h. Move loop-invariant.c prototypes to loop-invariant.h. Move loop-init.c prototypes to loop-init.h. Move loop-doloop.c prototypes to loop-doloop.h. Move cfgloopanal.c prototypes to cfgloopanal.h. Move loop-iv.c prototypes to loop-iv.h. (iv_extend_code): Move to loop-iv.h. (rtx_iv): Likewise. 2015-07-05 Prathamesh Kulkarni * asan.c: Adjust includes for flattening cfgloop.h. * auto-profile.c: Likewise. * bt-load.c: Likewise. * cfg.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfgloop.c: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraphunit.c: Likewise. * config/aarch64/aarch64.c: Likewise. * config/i386/i386.c: Likewise. * config/mn10300/mn10300.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/s390/s390.c: Likewise. * config/sh/sh.c: Likewise. * config/spu/spu.c: Likewise. * config/tilegx/tilegx.c: Likewise. * config/tilepro/tilepro.c: Likewise. * cprop.c: Likewise. * ddg.c: Likewise. * df-core.c: Likewise. * except.c: Likewise. * final.c: Likewise. * fwprop.c: Likewise. * gengtype.c: Likewise. * ggc-page.c: Likewise. * gimple-ssa-isolate-paths.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * graph.c: Likewise. * graphite-blocking.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-isl-ast-to-gimple.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-scop-detection.c: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * ifcvt.c: Likewise. * ipa-icf-gimple.c: Likewise. * ipa-icf.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-split.c: Likewise. * loop-doloop.c: Likewise. * loop-init.c: Likewise. * loop-invariant.c: Likewise. * loop-iv.c: Likewise. * loop-unroll.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * passes.c: Likewise. * predict.c: Likewise. * profile.c: Likewise. * sese.c: Likewise. * target-globals.c: Likewise. * toplev.c: Likewise. * tracer.c: Likewise. * trans-mem.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chkp-opt.c: Likewise. * tree-chkp.c: Likewise. * tree-chrec.c: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-eh.c: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-parloops.c: Likewise. * tree-predcom.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Like
[fortran, patch] Remove libgfortranbegin.a
Hi, 6 years ago, we removed the static helper library libgfortranbegin.a. Since gfortran 4.5, we don’t use it, but still provide it for backward compatibility. I’m thinking 6 years notice is enough, and we should remove it. A search for it on github and other code repositories does not indicate any real use in existing build systems, but quite a few cases of people confused by its existence and purpose. I’m saying we get rid of it. Attached patch bootstrapped and tested on x86_64-apple-darwin. OK to commit? FX libgfortranbegin.diff Description: Binary data libgfortranbegin.ChangeLog Description: Binary data
[MOXIE] Hookize GO_IF_LEGITIMATE_ADDRESS
Hi. This patch removes obsolete GO_IF_LEGITIMATE_ADDRESS macros from the MOXIE back end in the GCC and introduces equivalent TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P target hook. Regression tested on moxie-unknown-elf. OK for trunk? 2015-07-05 Anatoly Sokolov * config/moxie/moxie.h (GO_IF_LEGITIMATE_ADDRESS): Remove macros. * config/moxie/moxie.c (moxie_reg_ok_for_base_p, moxie_legitimate_address_p): New functions. (TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P): Define. Index: gcc/config/moxie/moxie.c === --- gcc/config/moxie/moxie.c(revision 225410) +++ gcc/config/moxie/moxie.c(working copy) @@ -595,6 +595,45 @@ return 0; } +/* Helper function for `moxie_legitimate_address_p'. */ + +static bool +moxie_reg_ok_for_base_p (const_rtx reg, bool strict_p) +{ + int regno = REGNO (reg); + + if (strict_p) +return HARD_REGNO_OK_FOR_BASE_P (regno) + || HARD_REGNO_OK_FOR_BASE_P (reg_renumber[regno]); + else +return !HARD_REGISTER_NUM_P (regno) + || HARD_REGNO_OK_FOR_BASE_P (regno); +} + +/* Worker function for TARGET_LEGITIMATE_ADDRESS_P. */ + +static bool +moxie_legitimate_address_p (machine_mode mode ATTRIBUTE_UNUSED, + rtx x, bool strict_p, + addr_space_t as) +{ + gcc_assert (ADDR_SPACE_GENERIC_P (as)); + + if (GET_CODE(x) == PLUS + && REG_P (XEXP (x, 0)) + && moxie_reg_ok_for_base_p (XEXP (x, 0), strict_p) + && CONST_INT_P (XEXP (x, 1)) + && IN_RANGE (INTVAL (XEXP (x, 1)), -32768, 32767)) +return true; + if (REG_P (x) && moxie_reg_ok_for_base_p (x, strict_p)) +return true; + if (GET_CODE (x) == SYMBOL_REF + || GET_CODE (x) == LABEL_REF + || GET_CODE (x) == CONST) +return true; + return false; +} + /* The Global `targetm' Variable. */ /* Initialize the GCC target structure. */ @@ -615,6 +654,8 @@ #undef TARGET_FUNCTION_ARG_ADVANCE #define TARGET_FUNCTION_ARG_ADVANCEmoxie_function_arg_advance +#undef TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P +#define TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P moxie_legitimate_address_p #undef TARGET_SETUP_INCOMING_VARARGS #define TARGET_SETUP_INCOMING_VARARGS moxie_setup_incoming_varargs Index: gcc/config/moxie/moxie.h === --- gcc/config/moxie/moxie.h(revision 225410) +++ gcc/config/moxie/moxie.h(working copy) @@ -451,30 +451,6 @@ elements of a jump-table should have. */ #define CASE_VECTOR_MODE SImode -/* A C compound statement with a conditional `goto LABEL;' executed - if X (an RTX) is a legitimate memory address on the target machine - for a memory operand of mode MODE. */ -#define GO_IF_LEGITIMATE_ADDRESS(MODE,X,LABEL) \ - do { \ -if (GET_CODE(X) == PLUS) \ - {\ - rtx op1,op2;\ - op1 = XEXP(X,0);\ - op2 = XEXP(X,1);\ - if (GET_CODE(op1) == REG\ - && GET_CODE(op2) == CONST_INT \ - && IN_RANGE (INTVAL (op2), -32768, 32767) \ - && REGNO_OK_FOR_BASE_P(REGNO(op1))) \ - goto LABEL; \ - }\ -if (REG_P (X) && REGNO_OK_FOR_BASE_P (REGNO (X))) \ - goto LABEL; \ -if (GET_CODE (X) == SYMBOL_REF \ - || GET_CODE (X) == LABEL_REF\ - || GET_CODE (X) == CONST) \ - goto LABEL; \ - } while (0) - /* Run-time Target Specification */ #define TARGET_CPU_CPP_BUILTINS() \ Anatoly.
Re: [fortran, patch] Remove libgfortranbegin.a
On Sun, Jul 05, 2015 at 03:37:25PM +0200, FX wrote: > Hi, > > 6 years ago, we removed the static helper library libgfortranbegin.a. Since > gfortran 4.5, we don???t use it, but still provide it for backward > compatibility. > > I???m thinking 6 years notice is enough, and we should remove it. A search > for it on github and other code repositories does not indicate any real use > in existing build systems, but quite a few cases of people confused by its > existence and purpose. > > I???m saying we get rid of it. Attached patch bootstrapped and tested on > x86_64-apple-darwin. > OK to commit? > I agree it is time for a cleanup. OK to commit. In fact, it may be time to refactor/rewrite parts of the codebase. I've been looking at io.c since Gerhard has sent in a bug report for invalid code, for example, 'open(1, status=42)'. I fixed that bug, then started purposely trying to break IO statements. 'open(1, iomsg=42)' currently dies with an ICE, and untangling this failure has been a fun chase as the code dates back to r81764. I have a patch for iomsg cooking. -- Steve
Re: [PATCH][8/n] Remove GENERIC stmt combining from SCCVN
> The following moves some bitwise patterns from the match-and-simplify > branch, extending them with proper conditional converts and removing > the corresponding patterns from fold-const.c There is a pasto/thinko in the last pattern: /* Convert ~X ^ C to X ^ ~C. */ (simplify (bit_xor (convert? (bit_not @0)) INTEGER_CST@1) (bit_xor (convert @0) (bit_not @1))) That's incorrect if the types don't have the same precision, as in the other cases, and is responsible for PR tree-optimization/66757. Tested on x86_64-suse-linux, OK for the mainline? 2015-07-05 Eric Botcazou PR tree-optimization/66757 * match.pd: Add missing condition to ~X ^ C -> X ^ ~C. 2015-07-05 Eric Botcazou * gcc.c-torture/execute/pr66757.c: New test. -- Eric BotcazouIndex: match.pd === --- match.pd (revision 225410) +++ match.pd (working copy) @@ -444,7 +444,8 @@ (define_operator_list CBRT BUILT_IN_CBRT /* Convert ~X ^ C to X ^ ~C. */ (simplify (bit_xor (convert? (bit_not @0)) INTEGER_CST@1) - (bit_xor (convert @0) (bit_not @1))) + (if (tree_nop_conversion_p (type, TREE_TYPE (@0))) + (bit_xor (convert @0) (bit_not @1 /* Fold (X & Y) ^ Y as ~X & Y. */ (simplify /* PR tree-optimization/66757 */ /* Testcase by Zhendong Su */ int a, b; int main (void) { unsigned int t = (unsigned char) (~b); if ((t ^ 1) / 255) __builtin_abort (); return 0; }
Re: [Ping, Patch, Fortran, PR58586, v5] ICE with derived type with allocatable component passed by value
On Sat, Jul 04, 2015 at 09:20:39PM +0200, Andre Vehreschild wrote: > > Thanks for looking at the code. The error you experience is known > to me. The bug is present in gfortran and only exposed by this patch. > Unfortunately is the pr58586 not addressing this specific error. It > may be in the bugtracker under a different number already. Furthermore > did I not want to extend the patch for 58586 any further, because I > have learned that the more complicated a patch gets the longer review > takes. For making the testcase run fine we also simply can comment the line. > I can appreciate the problem of fixing one bug may expose another, and I agree that holding up a patch for 58586 due to a latent bug seems unreasonable. I reviewed the email history and it appears that you've addressed Mikael's concerns. My only comment would be to comment out the problematic statement in alloc_comp_class_4.f03, and open a new bug report to record the issue. Ok to commit with my suggested change. -- Steve
Re: [Ping, Patch, Fortran, PR58586, v5] ICE with derived type with allocatable component passed by value
Dear Andre, I agree with Steve's recommendation that you comment out the line and open a PR for the problem. The patch looks fine to me and applied cleanly, apart from trailing CRs in the testcases. OK by me too. Cheers Paul PS I felt safe in setting a deadline for the submodule patch because: (i) It was obvious that nobody would review it because of its size; and (ii) It is safely ring-fenced by the need for very specific procedure attributes and declarations. I would not dream of doing the same for other patches more integrated in parts of the compiler that are frequented by commonly used code. For example, the patch to encompass the use of private entities with submodules will be just such a patch when I figure out how to do it! I can sympathize with you though; you have often had to wait an excessively long time for reviews. On 5 July 2015 at 18:14, Steve Kargl wrote: > On Sat, Jul 04, 2015 at 09:20:39PM +0200, Andre Vehreschild wrote: >> >> Thanks for looking at the code. The error you experience is known >> to me. The bug is present in gfortran and only exposed by this patch. >> Unfortunately is the pr58586 not addressing this specific error. It >> may be in the bugtracker under a different number already. Furthermore >> did I not want to extend the patch for 58586 any further, because I >> have learned that the more complicated a patch gets the longer review >> takes. For making the testcase run fine we also simply can comment the line. >> > > I can appreciate the problem of fixing one bug may expose another, > and I agree that holding up a patch for 58586 due to a latent bug > seems unreasonable. I reviewed the email history and it appears > that you've addressed Mikael's concerns. My only comment would > be to comment out the problematic statement in alloc_comp_class_4.f03, > and open a new bug report to record the issue. Ok to commit with > my suggested change. > > -- > Steve -- Outside of a dog, a book is a man's best friend. Inside of a dog it's too dark to read. Groucho Marx
[PATCH] PR target/35514: Gcc shoud generate symbol type for undefined symbol
Update default_elf_asm_output_external to also output symbol type to help ELF linker to properly issue diagnostic message. We don't output symbol type for reference to external TLS symbol since assembler will generate TLS symbol type based on TLS relocation and Solaris assembler only supports the @tls_obj type directive, not the @tls_object type directive used by GNU assmbler, which doesn't understand the @tls_obj type directive. Tested on Linux/x86-64. OK for trunk? Thanks. H.J. --- gcc/ PR target/35514 * varasm.c (default_elf_asm_output_external): Also output symbol type. gcc/testsuite/ PR target/35514 * lib/target-supports.exp (check_effective_target_elf): New. * gcc.dg/pr35514-1.c: New file. * gcc.dg/pr35514-2.c: Likewise. --- gcc/testsuite/gcc.dg/pr35514-1.c | 16 gcc/testsuite/gcc.dg/pr35514-2.c | 14 ++ gcc/testsuite/lib/target-supports.exp | 20 gcc/varasm.c | 22 +- 4 files changed, 67 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr35514-1.c create mode 100644 gcc/testsuite/gcc.dg/pr35514-2.c diff --git a/gcc/testsuite/gcc.dg/pr35514-1.c b/gcc/testsuite/gcc.dg/pr35514-1.c new file mode 100644 index 000..8a1d99d --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr35514-1.c @@ -0,0 +1,16 @@ +/* { dg-do compile { target { elf } } } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler ".type\[^\\n\]*object, (%|@)object" } } */ +/* { dg-final { scan-assembler ".type\[^\\n\]*function, (%|@)function" } } */ + +/* Verify that we generate proper symbol types for external reference. */ + +extern int object; +void function (void); + +int +foo (void) +{ + function (); + return object; +} diff --git a/gcc/testsuite/gcc.dg/pr35514-2.c b/gcc/testsuite/gcc.dg/pr35514-2.c new file mode 100644 index 000..f67af5a --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr35514-2.c @@ -0,0 +1,14 @@ +/* { dg-do compile { target { elf } } } */ +/* { dg-require-effective-target tls } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler-not ".type\[^\\n\]*object, (%|@)object" } } */ + +/* Verify that we generate proper symbol types for external reference. */ + +extern __thread int object; + +int +foo (void) +{ + return object; +} diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index bf512e9..c3ec209 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -6349,3 +6349,23 @@ proc check_effective_target_comdat_group {} { int (*fn) () = foo; }] } + +# Returns 1 if the target is ELF. + +proc check_effective_target_elf { } { +global check_effective_target_elf_saved +global tool + +if [info exists check_effective_target_elf_saved] { +verbose "check_effective_target_elf returning saved $check_effective_target_elf_saved" 2 +} else { + set objformat [gcc_target_object_format] + if { $objformat == "elf" } { + set check_effective_target_elf_saved 1 + } else { + set check_effective_target_elf_saved 0 + } +verbose "check_effective_target_elf returning $check_effective_target_elf_saved" 2 +} +return $check_effective_target_elf_saved +} diff --git a/gcc/varasm.c b/gcc/varasm.c index 3e76032..12f36f3 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -7509,7 +7509,7 @@ elf_record_gcc_switches (print_switch_type type, const char * name) } /* Emit text to declare externally defined symbols. It is needed to - properly support non-default visibility. */ + properly support non-default visibility and specify symbol type. */ void default_elf_asm_output_external (FILE *file ATTRIBUTE_UNUSED, tree decl, @@ -7518,10 +7518,22 @@ default_elf_asm_output_external (FILE *file ATTRIBUTE_UNUSED, /* We output the name if and only if TREE_SYMBOL_REFERENCED is set in order to avoid putting out names that are never really used. Always output visibility specified in the source. */ - if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)) - && (DECL_VISIBILITY_SPECIFIED (decl) - || targetm.binds_local_p (decl))) -maybe_assemble_visibility (decl); + if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))) +{ + if (DECL_VISIBILITY_SPECIFIED (decl) + || targetm.binds_local_p (decl)) + maybe_assemble_visibility (decl); + +#ifdef ASM_OUTPUT_TYPE_DIRECTIVE + if (TREE_CODE (decl) == FUNCTION_DECL) + ASM_OUTPUT_TYPE_DIRECTIVE (file, name, "function"); + else if (TREE_CODE (decl) == VAR_DECL) + { + if (!DECL_THREAD_LOCAL_P (decl)) + ASM_OUTPUT_TYPE_DIRECTIVE (file, name, "object"); + } +#endif +} } /* The default hook for TARGET_ASM_OUTPUT_SOURCE_FILENAME. */ -- 2.4.3
Re: [Ping, Patch, Fortran, PR58586, v5] ICE with derived type with allocatable component passed by value
On Sun, Jul 05, 2015 at 07:48:13PM +0200, Paul Richard Thomas wrote: > Dear Andre, > > I agree with Steve's recommendation that you comment out the line and > open a PR for the problem. > > The patch looks fine to me and applied cleanly, apart from trailing > CRs in the testcases. > > OK by me too. > > Cheers > > Paul > > PS I felt safe in setting a deadline for the submodule patch because: > (i) It was obvious that nobody would review it because of its size; > and (ii) It is safely ring-fenced by the need for very specific > procedure attributes and declarations. I would not dream of doing the > same for other patches more integrated in parts of the compiler that > are frequented by commonly used code. For example, the patch to > encompass the use of private entities with submodules will be just > such a patch when I figure out how to do it! I can sympathize with > you though; you have often had to wait an excessively long time for > reviews. > Fortunately (or unfortunately depends how one looks at the situation) Andre is working in an area that I feel very uncomfortable reviewing. I haven't ventured into OOP Fortran, and I'm still recovering from my last encounter with allocate/deallocate code. I also agree that waiting 6+ weeks for approval is a bit long time. Unfortunately, it seems evident that we're all too busy with Real Life(tm) at the moment. PS: Are you going to announce your submodule milestone on c.l.f? -- Steve
[PATCH, fortran] Fix numerous ICEs in IO statements with IOMSG
The attached patch fixes numerous ICE's where a program writed invalid code (see testcase). Regression tested on i386-*-freebsd. OK to commit? 2015-07-05 Steven G. Kargl * io.c (check_char_variable): New function. (match_open_element, match_close_element, match_file_element, match_dt_element, match_inquire_element, match_wait_element): Use it. 2015-07-05 Steven G. Kargl * gfortran.dg/iomsg_2.f90: New test. -- Steve Index: gcc/fortran/io.c === --- gcc/fortran/io.c (revision 225415) +++ gcc/fortran/io.c (working copy) @@ -1181,7 +1181,7 @@ check_format_string (gfc_expr *e, bool i } -/ Fortran 95 I/O statement matchers */ +/ Fortran I/O statement matchers */ /* Match a FORMAT statement. This amounts to actually parsing the format descriptors in order to correctly locate the end of the @@ -1242,6 +1242,21 @@ gfc_match_format (void) } +/* Check for a CHARACTER variable. The check for scalar is done in + resolve_tag. */ + +static bool +check_char_variable (gfc_expr *e) +{ + if (e->expr_type != EXPR_VARIABLE || e->ts.type != BT_CHARACTER) +{ + gfc_error("IOMSG must be a scalar-default-char-variable at %L", &e->where); + return false; +} + return true; +} + + static bool is_char_type (const char *name, gfc_expr *e) { @@ -1570,7 +1585,9 @@ match_open_element (gfc_open *open) m = match_etag (&tag_unit, &open->unit); if (m != MATCH_NO) return m; - m = match_out_tag (&tag_iomsg, &open->iomsg); + m = match_etag (&tag_iomsg, &open->iomsg); + if (m == MATCH_YES && !check_char_variable (open->iomsg)) +return MATCH_ERROR; if (m != MATCH_NO) return m; m = match_out_tag (&tag_iostat, &open->iostat); @@ -2234,7 +2251,9 @@ match_close_element (gfc_close *close) m = match_etag (&tag_status, &close->status); if (m != MATCH_NO) return m; - m = match_out_tag (&tag_iomsg, &close->iomsg); + m = match_etag (&tag_iomsg, &close->iomsg); + if (m == MATCH_YES && !check_char_variable (close->iomsg)) +return MATCH_ERROR; if (m != MATCH_NO) return m; m = match_out_tag (&tag_iostat, &close->iostat); @@ -2395,7 +2414,9 @@ match_file_element (gfc_filepos *fp) m = match_etag (&tag_unit, &fp->unit); if (m != MATCH_NO) return m; - m = match_out_tag (&tag_iomsg, &fp->iomsg); + m = match_etag (&tag_iomsg, &fp->iomsg); + if (m == MATCH_YES && !check_char_variable (fp->iomsg)) +return MATCH_ERROR; if (m != MATCH_NO) return m; m = match_out_tag (&tag_iostat, &fp->iostat); @@ -2760,7 +2781,9 @@ match_dt_element (io_kind k, gfc_dt *dt) m = match_etag (&tag_spos, &dt->pos); if (m != MATCH_NO) return m; - m = match_out_tag (&tag_iomsg, &dt->iomsg); + m = match_etag (&tag_iomsg, &dt->iomsg); + if (m == MATCH_YES && !check_char_variable (dt->iomsg)) +return MATCH_ERROR; if (m != MATCH_NO) return m; @@ -3939,7 +3962,9 @@ match_inquire_element (gfc_inquire *inqu m = match_etag (&tag_unit, &inquire->unit); RETM m = match_etag (&tag_file, &inquire->file); RETM m = match_ltag (&tag_err, &inquire->err); - RETM m = match_out_tag (&tag_iomsg, &inquire->iomsg); + RETM m = match_etag (&tag_iomsg, &inquire->iomsg); + if (m == MATCH_YES && !check_char_variable (inquire->iomsg)) +return MATCH_ERROR; RETM m = match_out_tag (&tag_iostat, &inquire->iostat); RETM m = match_vtag (&tag_exist, &inquire->exist); RETM m = match_vtag (&tag_opened, &inquire->opened); @@ -4222,7 +4247,9 @@ match_wait_element (gfc_wait *wait) RETM m = match_ltag (&tag_err, &wait->err); RETM m = match_ltag (&tag_end, &wait->eor); RETM m = match_ltag (&tag_eor, &wait->end); - RETM m = match_out_tag (&tag_iomsg, &wait->iomsg); + RETM m = match_etag (&tag_iomsg, &wait->iomsg); + if (m == MATCH_YES && !check_char_variable (wait->iomsg)) +return MATCH_ERROR; RETM m = match_out_tag (&tag_iostat, &wait->iostat); RETM m = match_etag (&tag_id, &wait->id); RETM return MATCH_NO; Index: gcc/testsuite/gfortran.dg/iomsg_2.f90 === --- gcc/testsuite/gfortran.dg/iomsg_2.f90 (revision 0) +++ gcc/testsuite/gfortran.dg/iomsg_2.f90 (working copy) @@ -0,0 +1,44 @@ +! { dg-do compile } +subroutine foo1 + implicit none + integer i + open(1, iomsg=666) ! { dg-error "IOMSG must be" } + open(1, iomsg='sgk')! { dg-error "IOMSG must be" } + open(1, iomsg=i)! { dg-error "IOMSG must be" } + close(1, iomsg=666) ! { dg-error "IOMSG must be" } + close(1, iomsg='sgk') ! { dg-error "IOMSG must be" } + close(1, iomsg=i) ! { dg-error "IOMSG must be" } +end subroutine foo1 + +subroutine foo + implicit none + integer i + real :: x = 1 + write(1, *, iomsg='sgk') x ! { dg-error "IOMSG must be" } + write(1, *, iomsg=i) x ! { dg-error "IOMSG must be" } +
Re: [PATCH][11/n] Remove GENERIC stmt combining from SCCVN
On Thu, Jul 2, 2015 at 7:05 AM, Richard Biener wrote: > > This moves floating-point related comparison foldings from > fold_comparison to match.pd. I noticed we call fold_comparison > only for a subset of tcc_comparison - the newly introduced > simple_comparison operator list and changes to present patterns > reflect that. > > Bootstrapped on x86_64-unknown-linux-gnu, testing in progress. > > Richard. > > 2015-07-02 Richard Biener > > * fold-const.c (fold_mathfn_compare): Remove. > (fold_inf_compare): Likewise. > (fold_comparison): Move floating point comparison simplifications... > * match.pd: ... to patterns here. Introduce simple_comparisons > operator list and use it for patterns formerly in fold_comparison. > This caused: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66770 -- H.J.
[wwwdocs] debian.org now uses https
...so convert to links in our manuals. Applied. Gerald 2015-07-05 Gerald Pfeifer * doc/fragments.texi (Target Fragment): Convert debian.org link to use https. * doc/install.texi (Configuration): Ditto. Index: doc/fragments.texi === --- doc/fragments.texi (revision 225434) +++ doc/fragments.texi (working copy) @@ -237,7 +237,7 @@ in @code{MULTILIB_OSDIRNAMES} instead. More documentation about multiarch can be found at -@uref{http://wiki.debian.org/Multiarch}. +@uref{https://wiki.debian.org/Multiarch}. @findex SPECS @item SPECS Index: doc/install.texi === --- doc/install.texi(revision 225434) +++ doc/install.texi(working copy) @@ -1058,7 +1058,7 @@ and for cross builds configured with @option{--with-sysroot}, and without @option{--with-native-system-header-dir}. More documentation about multiarch can be found at -@uref{http://wiki.debian.org/Multiarch}. +@uref{https://wiki.debian.org/Multiarch}. @item --enable-vtable-verify Specify whether to enable or disable the vtable verification feature.
Get rid of move_iterator in debug checks
Hi I would like to restore foreign iterator check even when move_iterator are being use. To do so I leverage on __miter_base to get rid of move_iterator layer before running the check. I had to expose __miter_base fallback implementation in cpp_type_traits.h to safely use it in debug mode. 2015-07-05 François Dumont * include/bits/stl_algobase.h (__miter_base): Move... * include/bits/cpp_type_traits.h: ...here. * include/debug/functions.h (__foreign_iterator_aux): Use latter. * testsuite/23_containers/vector/debug/insert7_neg.cc: New. Tested undex linux x86_64. Ok ? François diff --git libstdc++-v3/include/bits/cpp_type_traits.h libstdc++-v3/include/bits/cpp_type_traits.h index f7b76bf..b66b61f 100644 --- libstdc++-v3/include/bits/cpp_type_traits.h +++ libstdc++-v3/include/bits/cpp_type_traits.h @@ -399,6 +399,13 @@ __INT_N(__GLIBCXX_TYPE_INT_N_3) typedef __false_type __type; }; + // Fallback implementation of the function in bits/stl_iterator.h used to + // remove the move_iterator wrapper. + template +inline _Iterator +__miter_base(_Iterator __it) +{ return __it; } + _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git libstdc++-v3/include/bits/stl_algobase.h libstdc++-v3/include/bits/stl_algobase.h index b737fd0..f05e5cd 100644 --- libstdc++-v3/include/bits/stl_algobase.h +++ libstdc++-v3/include/bits/stl_algobase.h @@ -277,12 +277,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __niter_base(_Iterator __it) { return __it; } - // Likewise for move_iterator. - template -inline _Iterator -__miter_base(_Iterator __it) -{ return __it; } - // All of these auxiliary structs serve two purposes. (1) Replace // calls to copy with memmove whenever possible. (Memmove, not memcpy, // because the input and output ranges are permitted to overlap.) diff --git libstdc++-v3/include/debug/functions.h libstdc++-v3/include/debug/functions.h index e15f285..023758f 100644 --- libstdc++-v3/include/debug/functions.h +++ libstdc++-v3/include/debug/functions.h @@ -198,7 +198,8 @@ namespace __gnu_debug std::__false_type) { return _Insert_range_from_self_is_safe<_Sequence>::__value - || __foreign_iterator_aux2(__it, __other, __other_end); + || __foreign_iterator_aux2(__it, std::__miter_base(__other), + std::__miter_base(__other_end)); } templatehttp://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++11" } +// { dg-do run { xfail *-*-* } } + +#include +#include +#include + +void +test01() +{ + __gnu_debug::vector> v; + + v.emplace_back(new int(0)); + v.emplace_back(new int(1)); + + v.insert(begin(v) + 1, + make_move_iterator(begin(v)), + make_move_iterator(end(v))); +} + +int +main() +{ + test01(); +}
[PATCH] PR target/53383: Allow -mincoming-stack-boundary=3 with -mno-sse
Similar to -mpreferred-stack-boundary=3, -mincoming-stack-boundary=3 is allowed with -mno-sse in 64-bit mode. OK for trunk? H.J. gcc/ PR target/53383 * config/i386/i386.c (ix86_option_override_internal): Allow -mincoming-stack-boundary=X if -mpreferred-stack-boundary=N is allowed and X < N. gcc/testsuite/ PR target/53383 * gcc.target/i386/pr53383-1.c: New file. * gcc.target/i386/pr53383-2.c: Likewise. * gcc.target/i386/pr53383-3.c: Likewise. --- gcc/config/i386/i386.c| 13 - gcc/testsuite/gcc.target/i386/pr53383-1.c | 8 gcc/testsuite/gcc.target/i386/pr53383-2.c | 8 gcc/testsuite/gcc.target/i386/pr53383-3.c | 8 4 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr53383-1.c create mode 100644 gcc/testsuite/gcc.target/i386/pr53383-2.c create mode 100644 gcc/testsuite/gcc.target/i386/pr53383-3.c diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 7d26e8c..cea1295 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -4085,12 +4085,15 @@ ix86_option_override_internal (bool main_args_p, ix86_incoming_stack_boundary = ix86_default_incoming_stack_boundary; if (opts_set->x_ix86_incoming_stack_boundary_arg) { - if (opts->x_ix86_incoming_stack_boundary_arg - < (TARGET_64BIT_P (opts->x_ix86_isa_flags) ? 4 : 2) - || opts->x_ix86_incoming_stack_boundary_arg > 12) - error ("-mincoming-stack-boundary=%d is not between %d and 12", + int min = (TARGET_64BIT_P (opts->x_ix86_isa_flags) +? (TARGET_SSE_P (opts->x_ix86_isa_flags) ? 4 : 3) : 2); + int max = 12; + + if (opts->x_ix86_incoming_stack_boundary_arg < min + || opts->x_ix86_incoming_stack_boundary_arg > max) + error ("-mincoming-stack-boundary=%d is not between %d and %d", opts->x_ix86_incoming_stack_boundary_arg, - TARGET_64BIT_P (opts->x_ix86_isa_flags) ? 4 : 2); + min, max); else { ix86_user_incoming_stack_boundary diff --git a/gcc/testsuite/gcc.target/i386/pr53383-1.c b/gcc/testsuite/gcc.target/i386/pr53383-1.c new file mode 100644 index 000..d140bda --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr53383-1.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mno-sse -mpreferred-stack-boundary=3" } */ + +int +bar (int x) +{ + return x + 9; +} diff --git a/gcc/testsuite/gcc.target/i386/pr53383-2.c b/gcc/testsuite/gcc.target/i386/pr53383-2.c new file mode 100644 index 000..a1b8e41 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr53383-2.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mno-sse -mpreferred-stack-boundary=3 -mincoming-stack-boundary=3" } */ + +int +bar (int x) +{ + return x + 9; +} diff --git a/gcc/testsuite/gcc.target/i386/pr53383-3.c b/gcc/testsuite/gcc.target/i386/pr53383-3.c new file mode 100644 index 000..e5d3a5b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr53383-3.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mno-sse -mincoming-stack-boundary=3 -mpreferred-stack-boundary=3" } */ + +int +bar (int x) +{ + return x + 9; +} -- 2.4.3
Re: [PATCH] PR target/35514: Gcc shoud generate symbol type for undefined symbol
On Sun, Jul 5, 2015 at 11:14 AM, H.J. Lu wrote: > Update default_elf_asm_output_external to also output symbol type to > help ELF linker to properly issue diagnostic message. We don't output > symbol type for reference to external TLS symbol since assembler will > generate TLS symbol type based on TLS relocation and Solaris assembler > only supports the @tls_obj type directive, not the @tls_object type > directive used by GNU assmbler, which doesn't understand the @tls_obj > type directive. > > Tested on Linux/x86-64. OK for trunk? > > Thanks. > > > H.J. > --- > gcc/ > > PR target/35514 > * varasm.c (default_elf_asm_output_external): Also output symbol > type. > > gcc/testsuite/ > > PR target/35514 > * lib/target-supports.exp (check_effective_target_elf): New. > * gcc.dg/pr35514-1.c: New file. > * gcc.dg/pr35514-2.c: Likewise. > --- > gcc/testsuite/gcc.dg/pr35514-1.c | 16 > gcc/testsuite/gcc.dg/pr35514-2.c | 14 ++ > gcc/testsuite/lib/target-supports.exp | 20 > gcc/varasm.c | 22 +- > 4 files changed, 67 insertions(+), 5 deletions(-) > create mode 100644 gcc/testsuite/gcc.dg/pr35514-1.c > create mode 100644 gcc/testsuite/gcc.dg/pr35514-2.c > > diff --git a/gcc/testsuite/gcc.dg/pr35514-1.c > b/gcc/testsuite/gcc.dg/pr35514-1.c > new file mode 100644 > index 000..8a1d99d > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/pr35514-1.c > @@ -0,0 +1,16 @@ > +/* { dg-do compile { target { elf } } } */ > +/* { dg-options "-O2" } */ > +/* { dg-final { scan-assembler ".type\[^\\n\]*object, (%|@)object" } } */ > +/* { dg-final { scan-assembler ".type\[^\\n\]*function, (%|@)function" } } */ > + > +/* Verify that we generate proper symbol types for external reference. */ > + > +extern int object; > +void function (void); > + > +int > +foo (void) > +{ > + function (); > + return object; > +} > diff --git a/gcc/testsuite/gcc.dg/pr35514-2.c > b/gcc/testsuite/gcc.dg/pr35514-2.c > new file mode 100644 > index 000..f67af5a > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/pr35514-2.c > @@ -0,0 +1,14 @@ > +/* { dg-do compile { target { elf } } } */ > +/* { dg-require-effective-target tls } */ > +/* { dg-options "-O2" } */ > +/* { dg-final { scan-assembler-not ".type\[^\\n\]*object, (%|@)object" } } */ > + > +/* Verify that we generate proper symbol types for external reference. */ > + > +extern __thread int object; > + > +int > +foo (void) > +{ > + return object; > +} > diff --git a/gcc/testsuite/lib/target-supports.exp > b/gcc/testsuite/lib/target-supports.exp > index bf512e9..c3ec209 100644 > --- a/gcc/testsuite/lib/target-supports.exp > +++ b/gcc/testsuite/lib/target-supports.exp > @@ -6349,3 +6349,23 @@ proc check_effective_target_comdat_group {} { > int (*fn) () = foo; > }] > } > + > +# Returns 1 if the target is ELF. > + > +proc check_effective_target_elf { } { > +global check_effective_target_elf_saved > +global tool > + > +if [info exists check_effective_target_elf_saved] { > +verbose "check_effective_target_elf returning saved > $check_effective_target_elf_saved" 2 > +} else { > + set objformat [gcc_target_object_format] > + if { $objformat == "elf" } { > + set check_effective_target_elf_saved 1 > + } else { > + set check_effective_target_elf_saved 0 > + } > +verbose "check_effective_target_elf returning > $check_effective_target_elf_saved" 2 > +} > +return $check_effective_target_elf_saved > +} > diff --git a/gcc/varasm.c b/gcc/varasm.c > index 3e76032..12f36f3 100644 > --- a/gcc/varasm.c > +++ b/gcc/varasm.c > @@ -7509,7 +7509,7 @@ elf_record_gcc_switches (print_switch_type type, const > char * name) > } > > /* Emit text to declare externally defined symbols. It is needed to > - properly support non-default visibility. */ > + properly support non-default visibility and specify symbol type. */ > void > default_elf_asm_output_external (FILE *file ATTRIBUTE_UNUSED, > tree decl, > @@ -7518,10 +7518,22 @@ default_elf_asm_output_external (FILE *file > ATTRIBUTE_UNUSED, >/* We output the name if and only if TREE_SYMBOL_REFERENCED is > set in order to avoid putting out names that are never really > used. Always output visibility specified in the source. */ > - if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)) > - && (DECL_VISIBILITY_SPECIFIED (decl) > - || targetm.binds_local_p (decl))) > -maybe_assemble_visibility (decl); > + if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))) > +{ > + if (DECL_VISIBILITY_SPECIFIED (decl) > + || targetm.binds_local_p (decl)) > + maybe_assemble_visibility (decl); > + > +#ifdef ASM_OUTPUT_TYPE_DIRECTIVE > + if (TREE_CODE (decl) == FUNCTION_DECL) > + ASM_OUTPUT_TYPE_DIRECTIVE (file, name, "function"
[nios2, committed] allow constant offset with %gprel
I've checked in the attached patch to fix an oversight in the handling of GP-relative addressing modes in the nios2 back end. It allows GCC to generate addresses of the form "%gprel(sym+offset)(gp)" instead of just "%gprel(sym)(gp)". Formerly GCC required a scratch register and extra instruction to compute the address in this case, but in fact both the assembler and underlying relocation support a constant offset with %gprel. -Sandra 2015-07-05 Chung-Lin Tang Sandra Loosemore gcc/ * config/nios2/nios2-protos.h (nios2_symbol_ref_in_small_data_p): Delete extern declaration. (gprel_constant_p): Add extern declaration. * config/nios2/constraints.md ("S"): Use gprel_constant_p instead of nios2_symbol_ref_in_small_data_p. * config/nios2/nios2.c (nios2_legitimate_address_p): Likewise. (nios2_symbol_ref_in_small_data_p): Make static. (gprel_constant_p): Make non-static. gcc/testsuite/ * gcc.target/nios2/gprel-offset.c: New test. Index: gcc/testsuite/gcc.target/nios2/gprel-offset.c === --- gcc/testsuite/gcc.target/nios2/gprel-offset.c (revision 0) +++ gcc/testsuite/gcc.target/nios2/gprel-offset.c (revision 0) @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +static struct s { + int x; + char y; +} s; + +void set (char c) +{ + s.y = c; +} + + +char get (void) +{ + return s.y; +} + +/* { dg-final { scan-assembler-times "%gprel\\(s\\+4\\)\\(gp\\)" 2 } } */ Index: gcc/config/nios2/nios2-protos.h === --- gcc/config/nios2/nios2-protos.h (revision 225420) +++ gcc/config/nios2/nios2-protos.h (working copy) @@ -44,7 +44,7 @@ extern bool nios2_fpu_insn_enabled (enum extern const char * nios2_fpu_insn_asm (enum n2fpu_code); extern bool nios2_legitimate_pic_operand_p (rtx); -extern bool nios2_symbol_ref_in_small_data_p (rtx); +extern bool gprel_constant_p (rtx); extern bool nios2_regno_ok_for_base_p (int, bool); extern bool nios2_unspec_reloc_p (rtx); Index: gcc/config/nios2/constraints.md === --- gcc/config/nios2/constraints.md (revision 225419) +++ gcc/config/nios2/constraints.md (working copy) @@ -84,8 +84,7 @@ (define_constraint "S" "An immediate stored in small data, accessible by GP." - (and (match_code "symbol_ref") - (match_test "nios2_symbol_ref_in_small_data_p (op)"))) + (match_test "gprel_constant_p (op)")) (define_constraint "T" "A constant unspec offset representing a relocation." Index: gcc/config/nios2/nios2.c === --- gcc/config/nios2/nios2.c (revision 225420) +++ gcc/config/nios2/nios2.c (working copy) @@ -1614,14 +1614,15 @@ nios2_legitimate_address_p (machine_mode case SYMBOL_REF: if (SYMBOL_REF_TLS_MODEL (operand)) return false; - - if (nios2_symbol_ref_in_small_data_p (operand)) + + /* Else, fall through. */ +case CONST: + if (gprel_constant_p (operand)) return true; /* Else, fall through. */ case LABEL_REF: case CONST_INT: -case CONST: case CONST_DOUBLE: return false; @@ -1688,7 +1689,7 @@ nios2_in_small_data_p (const_tree exp) /* Return true if symbol is in small data section. */ -bool +static bool nios2_symbol_ref_in_small_data_p (rtx sym) { tree decl; @@ -2110,7 +2111,7 @@ nios2_print_operand (FILE *file, rtx op, } /* Return true if this is a GP-relative accessible reference. */ -static bool +bool gprel_constant_p (rtx op) { if (GET_CODE (op) == SYMBOL_REF
Re: [PATCH] New configure option to default enable Smart Stack Protection
fredag 03 juli 2015 01.01.51 skrev Magnus Granberg: > Hi > Working on a patch that enable Smart Stack Protection as default. > I still miss docs and testcase for the patch. I need you ides and help. > > /Magnus G. > --- New patch with doc and testcase added. /Magnus G. Changlogs /gcc 2015-07-05 Magnus Granberg * common.opt (fstack-protector): Initialize to -1. (fstack-protector-all): Likewise. (fstack-protector-strong): Likewise. (fstack-protector-explicit): Likewise. * configure.ac: Add --enable-default-ssp. * defaults.h (DEFAULT_FLAG_SSP): New. Default SSP to strong. * opts.c (finish_options): Update opts->x_flag_stack_protect if it is -1. * doc/install.texi: Document --enable-default-ssp. * config.in: Regenerated. * configure: Likewise. /testsuite 2015-07-05 Magnus Granberg * lib/target-supports.exp (check_effective_target_fstack_protector_enabled): New test. * gcc.target/i386/ssp-default.c: New test. --- a/gcc/configure.ac 2014-12-05 00:53:24.0 +0100 +++ b/gcc/configure.ac 2015-06-08 23:27:11.744348211 +0200 @@ -5221,6 +5119,25 @@ if test x$gcc_cv_libc_provides_ssp = xye [Define if your target C library provides stack protector support]) fi +# Check whether --enable-default-ssp was given. +AC_ARG_ENABLE(default-ssp, +[AS_HELP_STRING([--enable-default-ssp], + [enable Smart Stack Protection as default])],[ +if test x$gcc_cv_libc_provides_ssp = xyes; then + case "$target" in +ia64*-*-*) enable_default_ssp=no ;; +*) enable_default_ssp=$enableval ;; + esac +else + enable_default_ssp=no +fi], +enable_default_ssp=no) +if test x$enable_default_ssp == xyes ; then + AC_DEFINE(ENABLE_DEFAULT_SSP, 1, + [Define if your target supports default stack protector and it is enabled.]) +fi +AC_SUBST([enable_default_ssp]) + # Test for on the target. GCC_TARGET_TEMPLATE([HAVE_SYS_SDT_H]) AC_MSG_CHECKING(sys/sdt.h in the target C library) --- a/gcc/defaults.h 2014-11-01 09:13:09.0 +0100 +++ b/gcc/defaults.h 2015-06-08 22:43:18.764269749 +0200 @@ -1263,6 +1263,18 @@ see the files COPYING3 and COPYING.RUNTI #define STACK_SIZE_MODE word_mode #endif +/* Default value for flag_stack_protect when flag_stack_protect is initialized to -1: + --enable-default-ssp: Default flag_stack_protect to -fstack-protector-strong. + --disable-default-ssp: Default flag_stack_protect to 0. + */ +#ifdef ENABLE_DEFAULT_SSP +# ifndef DEFAULT_FLAG_SSP +# define DEFAULT_FLAG_SSP 3 +# endif +#else +# define DEFAULT_FLAG_SSP 0 +#endif + /* Provide default values for the macros controlling stack checking. */ /* The default is neither full builtin stack checking... */ --- a/gcc/common.opt 2014-10-28 11:33:04.0 +0100 +++ b/gcc/common.opt 2015-06-08 22:41:30.114266512 +0200 @@ -2054,15 +2054,15 @@ Common RejectNegative Joined Var(common_ -fstack-limit-symbol= Trap if the stack goes past symbol fstack-protector -Common Report Var(flag_stack_protect, 1) +Common Report Var(flag_stack_protect, 1) Init(-1) Use propolice as a stack protection method fstack-protector-all -Common Report RejectNegative Var(flag_stack_protect, 2) +Common Report RejectNegative Var(flag_stack_protect, 2) Init(-1) Use a stack protection method for every function fstack-protector-strong -Common Report RejectNegative Var(flag_stack_protect, 3) +Common Report RejectNegative Var(flag_stack_protect, 3) Init(-1) Use a smart stack protection method for certain functions fstack-protector-explicit -Common Report RejectNegative Var(flag_stack_protect, 4) +Common Report RejectNegative Var(flag_stack_protect, 4) Init(-1) Use stack protection method only for functions with the stack_protect attribute fstack-usage --- a/gcc/opts.c 2015-06-10 02:37:39.0 +0200 +++ b/gcc/opts.c 2015-07-03 23:47:50.868752099 +0200 @@ -757,6 +757,11 @@ finish_options (struct gcc_options *opts opts->x_flag_opts_finished = true; } + /* We initialize opts->x_flag_stack_protect to -1 so that targets + can set a default value. */ + if (opts->x_flag_stack_protect == -1) +opts->x_flag_stack_protect = DEFAULT_FLAG_SSP; + if (opts->x_optimize == 0) { /* Inlining does not work if not optimizing, --- a/gcc/doc/install.texi 2015-06-03 18:38:10.0 +0200 +++ bgcc/doc/install.texi 2015-07-03 22:18:41.498592691 +0200 @@ -1642,6 +1642,9 @@ Using the GNU Compiler Collection (GCC)} See ``RS/6000 and PowerPC Options'' in the main manual @end ifhtml +@item --enable-default-ssp +Turn on @option{-fstack-protector-strong} by default. + @item --enable-cld This option enables @option{-mcld} by default for 32-bit x86 targets. @ifnothtml --- a/gcc/testsuite/lib/target-supports.exp 2015-05-21 15:30:24.0 +0200 +++ b/gcc/testsuite/lib/target-supports.exp 2015-07-03 21:55:53.748551933 +0200 @@ -1124,6 +1124,16 @@ proc check_effective_target_pie_enabled }] } +# Return 1
Re: [patch] [fixincludes] Ignore .DS_Store junk files when running make check
I was just matching the code that was already used there... should the lines to ignore the CVS and .svn folders be re-written into the style you propose, too? On 7/5/15, Andreas Schwab wrote: > Eric Gallager writes: > >> I've attached trivial, 1-line patch to fixincludes_check.tpl; it >> allows 'make check' to succeed on OS X, by ignoring the files that >> Finder creates to keep track of the status of directories. >> >> -Eric Gallager >> fixincludes/check.tpl | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/fixincludes/check.tpl b/fixincludes/check.tpl >> index 0d1f444..300aeac 100644 >> --- a/fixincludes/check.tpl >> +++ b/fixincludes/check.tpl >> @@ -143,6 +143,7 @@ cd $TESTBASE >> >> find * -type f -print | \ >> fgrep -v 'CVS/' | \ >> +fgrep -v '.DS_Store' | \ >> fgrep -v '.svn/' > ${TESTDIR}/LIST >> >> exitok=` > > find ... ! -name .DS_Store ... > > Andreas. > > -- > Andreas Schwab, sch...@linux-m68k.org > GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 > "And now for something completely different." >
Re: [PATCH 1/2] Allow REG_EQUAL for ZERO_EXTRACT
On 30/06/15 17:16, Maxim Kuvyrkov wrote: >> On Jun 30, 2015, at 6:54 AM, Kugan wrote: >> >> >> On 29/06/15 21:56, Maxim Kuvyrkov wrote: On Jun 28, 2015, at 2:28 PM, Kugan wrote: This patch allows setting REG_EQUAL for ZERO_EXTRACT and handle that in cse (where the src for the ZERO_EXTRACT needs to be calculated) Thanks, Kugan >>> From 75e746e559ffd21b25542b3db627e3b318118569 Mon Sep 17 00:00:00 2001 From: Kugan Vivekanandarajah Date: Fri, 26 Jun 2015 17:12:07 +1000 Subject: [PATCH 1/2] Allow adding REG_EQUAL for ZERO_EXTRACT --- gcc/ChangeLog | 6 ++ gcc/cse.c | 41 - gcc/emit-rtl.c | 3 ++- 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 080aa39..d4a73d6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-06-26 Kugan Vivekanandarajah + + * cse.c (cse_insn): Calculate src_eqv for ZERO_EXTRACT. + * emit-rtl.c (set_for_reg_notes): Allow ZERO_EXTRACT to set + REG_EQUAL note. + 2015-06-25 H.J. Lu * gentarget-def.c (def_target_insn): Cast return of strtol to diff --git a/gcc/cse.c b/gcc/cse.c index 100c9c8..8add651 100644 --- a/gcc/cse.c +++ b/gcc/cse.c @@ -4531,8 +4531,47 @@ cse_insn (rtx_insn *insn) if (n_sets == 1 && REG_NOTES (insn) != 0 && (tem = find_reg_note (insn, REG_EQUAL, NULL_RTX)) != 0 && (! rtx_equal_p (XEXP (tem, 0), SET_SRC (sets[0].rtl)) +|| GET_CODE (SET_DEST (sets[0].rtl)) == ZERO_EXTRACT || GET_CODE (SET_DEST (sets[0].rtl)) == STRICT_LOW_PART)) -src_eqv = copy_rtx (XEXP (tem, 0)); +{ + src_eqv = copy_rtx (XEXP (tem, 0)); + + /* If DEST is of the form ZERO_EXTACT, as in: + (set (zero_extract:SI (reg:SI 119) +(const_int 16 [0x10]) +(const_int 16 [0x10])) +(const_int 51154 [0xc7d2])) + REG_EQUAL note will specify the value of register (reg:SI 119) at this + point. Note that this is different from SRC_EQV. We can however + calculate SRC_EQV with the position and width of ZERO_EXTRACT. */ + if (GET_CODE (SET_DEST (sets[0].rtl)) == ZERO_EXTRACT) >>> >>> Consider changing >>> >>> if (something >>>&& (!rtx_equal_p) >>>|| ZERO_EXTRACT >>>|| STRICT_LOW_PART) >>> >>> to >>> >>> if (something >>>&& !rtx_equal_p) >>> { >>> if (ZERO_EXTRACT) >>> { >>> } >>> else if (STRICT_LOW_PART) >>> { >>> } >>> } >>> >>> Otherwise looks good to me, but you still need another approval. >> >> Thanks Maxim for the review. How about the attached patch? > > Looks good, with a couple of indentation nit-picks below. No need to repost > the patch on their account. Wait for another a maintainer's review. Thanks. Here is the update patch. Kugan >From 0b86c1ed630ef70e17412808d6baca93259de2ee Mon Sep 17 00:00:00 2001 From: Kugan Vivekanandarajah Date: Fri, 26 Jun 2015 17:12:07 +1000 Subject: [PATCH 1/3] Allow adding REG_EQUAL for ZERO_EXTRACT --- gcc/ChangeLog | 7 +++ gcc/cse.c | 49 ++--- gcc/emit-rtl.c | 3 ++- 3 files changed, 51 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fc23abd..5796f16 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ + +2015-06-26 Kugan Vivekanandarajah + + * cse.c (cse_insn): Calculate src_eqv for ZERO_EXTRACT. + * emit-rtl.c (set_for_reg_notes): Allow ZERO_EXTRACT to set + REG_EQUAL note. + 2015-06-30 Eric Botcazou * lto-streamer-out.c (class DFS): Adjust hash_scc method. diff --git a/gcc/cse.c b/gcc/cse.c index e01240c..09dc7c2 100644 --- a/gcc/cse.c +++ b/gcc/cse.c @@ -4525,14 +4525,49 @@ cse_insn (rtx_insn *insn) canonicalize_insn (insn, &sets, n_sets); /* If this insn has a REG_EQUAL note, store the equivalent value in SRC_EQV, - if different, or if the DEST is a STRICT_LOW_PART. The latter condition - is necessary because SRC_EQV is handled specially for this case, and if - it isn't set, then there will be no equivalence for the destination. */ + if different, or if the DEST is a STRICT_LOW_PART/ZERO_EXTRACT. The + latter condition is necessary because SRC_EQV is handled specially for + this case, and if it isn't set, then there will be no equivalence + for the destination. */ if (n_sets == 1 && REG_NOTES (insn) != 0 - && (tem = find_reg_note (insn, REG_EQUAL, NULL_RTX)) != 0 - && (! rtx_equal_p (XEXP (tem, 0), SET_SRC (sets[0].rtl)) - || GET_CODE (SET_DEST (sets[0].rtl)) == STRICT_LOW_PART)) -src_eqv = copy_rtx (XEXP (tem, 0)); + && (tem = find_reg_note (insn, REG_EQUAL, NULL_RTX)) != 0) +{ + if ((! rtx_equal_p (XEXP (tem, 0), SET_SRC (sets[0].rtl)))
Re: fix segfault in verify_flow_info() with -dx option
On Sun, Jul 5, 2015 at 2:07 PM, Prathamesh Kulkarni wrote: > Hi, > Passing -dx causes segmentation fault: > Test case: void f(void) {} > > ./test.c: In function 'f': > ../test.c:3:1: internal compiler error: Segmentation fault > } > ^ > 0xab6baf crash_signal > /home/prathamesh.kulkarni/gnu-toolchain/src/gcc.git/gcc/toplev.c:366 > 0x694b14 verify_flow_info() > /home/prathamesh.kulkarni/gnu-toolchain/src/gcc.git/gcc/cfghooks.c:109 > 0x9f7e64 execute_function_todo > /home/prathamesh.kulkarni/gnu-toolchain/src/gcc.git/gcc/passes.c:1997 > 0x9f86eb execute_todo > /home/prathamesh.kulkarni/gnu-toolchain/src/gcc.git/gcc/passes.c:2042 > > Started with r210068. > It looks like -dx causes cfun->cfg to be NULL, and hence the segfault > in verify_flow_info(). > The attached patch tries to fix it by adding a check to cfun->cfg before > calling > verify_flow_info() from execute_function_todo(). > Bootstrapped and tested on x86_64-unknown-linux-gnu. > OK for trunk ? No. We've checked cfun->curr_properties & PROP_cfg already. So whatever is keeping that set but frees the CFG is the offender (and should clear the flag). Richard. > Thank you, > Prathamesh
Re: [PATCH][8/n] Remove GENERIC stmt combining from SCCVN
On Sun, 5 Jul 2015, Eric Botcazou wrote: > > The following moves some bitwise patterns from the match-and-simplify > > branch, extending them with proper conditional converts and removing > > the corresponding patterns from fold-const.c > > There is a pasto/thinko in the last pattern: > > /* Convert ~X ^ C to X ^ ~C. */ > (simplify > (bit_xor (convert? (bit_not @0)) INTEGER_CST@1) > (bit_xor (convert @0) (bit_not @1))) > > That's incorrect if the types don't have the same precision, as in the other > cases, and is responsible for PR tree-optimization/66757. Hum, somehow I convinced myself that it was ok if the precision wasn't the same (but I can't remember my line of thought). Your testcase clearly shows I was wrong ;) > Tested on x86_64-suse-linux, OK for the mainline? Ok. Thanks, Richard. > > 2015-07-05 Eric Botcazou > > PR tree-optimization/66757 > * match.pd: Add missing condition to ~X ^ C -> X ^ ~C. > > 2015-07-05 Eric Botcazou > > * gcc.c-torture/execute/pr66757.c: New test. > > -- Richard Biener SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Dilip Upmanyu, Graham Norton, HRB 21284 (AG Nuernberg)