Re: [Fortran, (RFC) patch] PR49110/51055 Assignment to alloc. deferred-length character vars
Jakub Jelinek wrote: On Tue, Dec 18, 2012 at 10:38:06PM +0100, Tobias Burnus wrote: Updated patch attached. Build and regtested on x86-64-gnu-linux. OK for the trunk? Looks ok to me, thanks. I have now committed it as Rev. 194604. For what it is worth, I have also successfully tested the test case with crayftn (-e v -e w), pgf95 (-Msave -Mallocatable=f03) and ifort (-assume realloc_lhs -save). David: Thanks for the bug report and sorry for taking that long to fix it. Tobias
Re: [fortran, patch] Allow displaying backtraces from user code
On Sun, Dec 16, 2012 at 12:50 AM, Janus Weil ja...@gcc.gnu.org wrote: Hi, So, in principle I'm fine with all your BACKTRACE_* variants (except for _splurge, maybe ;) Or, why not just (plain and simple) BACKTRACE? The name is the same as backtrace() in glibc, but otherwise, sure why not. _show/_print might be preferable in the sense that they convey that stuff will be directly printed on the screen, rather than, say, the procedure returning an array of strings with the stack trace info. Agreed. Let's go with BACKTRACE_SHOW. Attached is a new patch which uses this name. Moreover, it follow your previous advice to move the message Backtrace for this error out of backtrace_show into backtrace_handler. I also added Program aborted. Backtrace: in sys_abort. - As previously show_backtrace() was always followed by program termination, we now need to ensure that it properly cleans up after itself in case the application continues execution. In particular, make sure it doesn't leak file descriptors, and that the addr2line child process terminates properly. Good point. Do you have any particular suggestions about what would be needed in this direction? (You're probably much more familiar with the libgfortran code than I am.) As a simple test, something like the following (untested) code might do: program b integer :: i do i = 1, 100 call backtrace_show end do read(*, *) end program b When the programs waits on user input, check with ps -eFH that your a.out process (or whatever you call the binary) doesn't have any child processes, then ls /proc/[PID]/fd and check that the process has only 3 fd's (std{in,out,err}). Ok, I tried this and indeed there seem to be no child processes left. However, I do see open fd's (one for each backtrace invocation). Looking at the code, it seems a close (f[0]) was missing (which I added now). Great, thanks for fixing this! Do you have any further comments or do you think the patch is ok for trunk now? Ok for trunk. A minor addition, if you care, would be to mention in the documentation for backtrace_show() that the error message is printed to the unit corresponding to ERROR_UNIT in ISO_FORTRAN_ENV. Thanks for the patch! -- Janne Blomqvist
[PING] Bugfix: Additional parameter for canonicalize comparison
Hi, are the ARM parts of the patch below ok for mainline? I did a compile test with a cross. Bye, -Andreas- Original Message Subject: [PATCH] Bugfix: Additional parameter for canonicalize comparison Date: Wed, 12 Dec 2012 12:23:14 +0100 From: Andreas Krebbel kreb...@linux.vnet.ibm.com To: rearn...@arm.com CC: gcc-patches@gcc.gnu.org Hi Richard, is the attached patch ok for ARM? Bye, -Andreas- 2012-12-12 Andreas Krebbel andreas.kreb...@de.ibm.com * target.def: Define canonicalize_comparison hook. * targhooks.h (default_canonicalize_comparison): New prototype. * targhooks.c (default_canonicalize_comparison): New function. * doc/tm.texi: Add documentation for the new target hook. * doc/tm.texi.in: Likewise. * combine.c (try_combine): Adjust to use the target hook. * config/alpha/alpha.h (CANONICALIZE_COMPARISON): Remove macro definition. * config/alpha/alpha.c (alpha_canonicalize_comparison): New function. (TARGET_CANONICALIZE_COMPARISON): New macro definition. * config/arm/arm-protos.h (arm_canonicalize_comparison): Remove prototype. * config/arm/arm.c (arm_canonicalize_comparison): Add new parameter. (TARGET_CANONICALIZE_COMPARISON): New macro definition. * config/arm/arm.h (CANONICALIZE_COMPARISON): Remove macro definition. * config/s390/s390-protos.h (s390_canonicalize_comparison): Remove prototype. * config/s390/s390.c (s390_canonicalize_comparison): Add new parameter. (TARGET_CANONICALIZE_COMPARISON): New macro definition. * config/s390/s390.h (CANONICALIZE_COMPARISON): Remove macro definition. * config/sh/sh-protos.h (sh_canonicalize_comparison): Remove prototype. * config/sh/sh.c (sh_canonicalize_comparison): Add new prototype. New function overloading the old one. (TARGET_CANONICALIZE_COMPARISON): New macro definition. * config/sh/sh.h (CANONICALIZE_COMPARISON): Remove macro definition. * config/spu/spu.c (spu_canonicalize_comparison): New function. (TARGET_CANONICALIZE_COMPARISON): New macro definition. * config/spu/spu.h (CANONICALIZE_COMPARISON): Remove macro definition. --- gcc/combine.c | 19 ++-!!! gcc/config/alpha/alpha.c | 27 gcc/config/alpha/alpha.h | 20 gcc/config/arm/arm-protos.h |1 gcc/config/arm/arm.c | 68 ++-!! gcc/config/arm/arm.h |3 - gcc/config/s390/s390-protos.h |1 gcc/config/s390/s390.c| 13 +++! gcc/config/s390/s390.h|4 -- gcc/config/sh/sh-protos.h |2 - gcc/config/sh/sh.c| 34 +++!! gcc/config/sh/sh.h|4 -- gcc/config/spu/spu.c | 17 ++ gcc/config/spu/spu.h | 12 --- gcc/doc/tm.texi | 20 gcc/doc/tm.texi.in| 20 gcc/target.def|8 gcc/targhooks.h |2 + 18 files changed, 94 insertions(+), 50 deletions(-), 131 modifications(!) Index: gcc/combine.c === *** gcc/combine.c.orig --- gcc/combine.c *** static rtx gen_lowpart_or_truncate (enum *** 494,499 --- 494,510 static const struct rtl_hooks combine_rtl_hooks = RTL_HOOKS_INITIALIZER; + /* Convenience wrapper for the canonicalize_comparison target hook. +Target hooks cannot use enum rtx_code. */ + static inline void + target_canonicalize_comparison (enum rtx_code *code, rtx *op0, rtx *op1, + bool op0_preserve_value) + { + int code_int = (int)*code; + targetm.canonicalize_comparison (code_int, op0, op1, op0_preserve_value); + *code = (enum rtx_code)code_int; + } + /* Try to split PATTERN found in INSN. This returns NULL_RTX if PATTERN can not be split. Otherwise, it returns an insn sequence. This is a wrapper around split_insns which ensures that the *** try_combine (rtx i3, rtx i2, rtx i1, rtx *** 2944,2952 compare_code = orig_compare_code = GET_CODE (*cc_use_loc); compare_code = simplify_compare_const (compare_code, op0, op1); ! #ifdef CANONICALIZE_COMPARISON ! CANONICALIZE_COMPARISON (compare_code, op0, op1); ! #endif } /* Do the rest only if op1 is const0_rtx, which may be the --- 2955,2961 compare_code = orig_compare_code = GET_CODE (*cc_use_loc); compare_code = simplify_compare_const (compare_code, op0, op1); ! target_canonicalize_comparison (compare_code, op0, op1, 1); } /* Do the rest only if op1 is const0_rtx,
Fix ipa-inline-transform ICE
Hi, the ipa-inline-transform ICE is caused by fact that devirt_benefit in ipa-inline-analysis is able to determine devirtualiation oppurtunity of call to b3, while the ipa-prop responsible for updating function body after inlining is not. This is because the later is missing code turning known constant into binfo. Bootstrapped/regtested x86_64-linux, will commit this shortly. Honza PR tree-optimization/55683 * g++.dg/ipa/devirt-9.C: New testcase. * ipa-prop.c (try_make_edge_direct_virtual_call): Look into constants for binfo. Index: testsuite/g++.dg/ipa/devirt-9.C === *** testsuite/g++.dg/ipa/devirt-9.C (revision 0) --- testsuite/g++.dg/ipa/devirt-9.C (revision 0) *** *** 0 --- 1,30 + /* { dg-do compile } */ + /* { dg-options -O2 -fdump-ia-inline } */ + double foo (); + struct B + { + bool b1 () { return b3 (); } + void b2 (); + virtual bool b3 (); + }; + struct C + { + C () {} + bool + c1 (float x, float y) + { + if (x != c3 || y != c4) + c2.b2 (); + return c2.b1 (); + } + B c2; + float c3, c4; + }; + + void + bar () + { + static C c; + c.c1 (60, (int) foo ()); + } + /* { dg-final { scan-ipa-dump Discovered a virtual call to a known target inline } } */ Index: ipa-prop.c === *** ipa-prop.c (revision 194584) --- ipa-prop.c (working copy) *** try_make_edge_direct_virtual_call (struc *** 2223,2231 binfo = ipa_value_from_jfunc (new_root_info, jfunc); ! if (!binfo || TREE_CODE (binfo) != TREE_BINFO) return NULL; binfo = get_binfo_at_offset (binfo, ie-indirect_info-offset, ie-indirect_info-otr_type); if (binfo) --- 2223,2238 binfo = ipa_value_from_jfunc (new_root_info, jfunc); ! if (!binfo) return NULL; + if (TREE_CODE (binfo) != TREE_BINFO) + { + binfo = gimple_extract_devirt_binfo_from_cst (binfo); + if (!binfo) + return NULL; + } + binfo = get_binfo_at_offset (binfo, ie-indirect_info-offset, ie-indirect_info-otr_type); if (binfo)
Re: [PING] Bugfix: Additional parameter for canonicalize comparison
On 19/12/12 09:53, Andreas Krebbel wrote: Hi, are the ARM parts of the patch below ok for mainline? Yes. Sorry for the delay. R. I did a compile test with a cross. Bye, -Andreas- Original Message Subject: [PATCH] Bugfix: Additional parameter for canonicalize comparison Date: Wed, 12 Dec 2012 12:23:14 +0100 From: Andreas Krebbel kreb...@linux.vnet.ibm.com To: rearn...@arm.com CC: gcc-patches@gcc.gnu.org Hi Richard, is the attached patch ok for ARM? Bye, -Andreas- 2012-12-12 Andreas Krebbel andreas.kreb...@de.ibm.com * target.def: Define canonicalize_comparison hook. * targhooks.h (default_canonicalize_comparison): New prototype. * targhooks.c (default_canonicalize_comparison): New function. * doc/tm.texi: Add documentation for the new target hook. * doc/tm.texi.in: Likewise. * combine.c (try_combine): Adjust to use the target hook. * config/alpha/alpha.h (CANONICALIZE_COMPARISON): Remove macro definition. * config/alpha/alpha.c (alpha_canonicalize_comparison): New function. (TARGET_CANONICALIZE_COMPARISON): New macro definition. * config/arm/arm-protos.h (arm_canonicalize_comparison): Remove prototype. * config/arm/arm.c (arm_canonicalize_comparison): Add new parameter. (TARGET_CANONICALIZE_COMPARISON): New macro definition. * config/arm/arm.h (CANONICALIZE_COMPARISON): Remove macro definition. * config/s390/s390-protos.h (s390_canonicalize_comparison): Remove prototype. * config/s390/s390.c (s390_canonicalize_comparison): Add new parameter. (TARGET_CANONICALIZE_COMPARISON): New macro definition. * config/s390/s390.h (CANONICALIZE_COMPARISON): Remove macro definition. * config/sh/sh-protos.h (sh_canonicalize_comparison): Remove prototype. * config/sh/sh.c (sh_canonicalize_comparison): Add new prototype. New function overloading the old one. (TARGET_CANONICALIZE_COMPARISON): New macro definition. * config/sh/sh.h (CANONICALIZE_COMPARISON): Remove macro definition. * config/spu/spu.c (spu_canonicalize_comparison): New function. (TARGET_CANONICALIZE_COMPARISON): New macro definition. * config/spu/spu.h (CANONICALIZE_COMPARISON): Remove macro definition. --- gcc/combine.c | 19 ++-!!! gcc/config/alpha/alpha.c | 27 gcc/config/alpha/alpha.h | 20 gcc/config/arm/arm-protos.h |1 gcc/config/arm/arm.c | 68 ++-!! gcc/config/arm/arm.h |3 - gcc/config/s390/s390-protos.h |1 gcc/config/s390/s390.c| 13 +++! gcc/config/s390/s390.h|4 -- gcc/config/sh/sh-protos.h |2 - gcc/config/sh/sh.c| 34 +++!! gcc/config/sh/sh.h|4 -- gcc/config/spu/spu.c | 17 ++ gcc/config/spu/spu.h | 12 --- gcc/doc/tm.texi | 20 gcc/doc/tm.texi.in| 20 gcc/target.def|8 gcc/targhooks.h |2 + 18 files changed, 94 insertions(+), 50 deletions(-), 131 modifications(!) Index: gcc/combine.c === *** gcc/combine.c.orig --- gcc/combine.c *** static rtx gen_lowpart_or_truncate (enum *** 494,499 --- 494,510 static const struct rtl_hooks combine_rtl_hooks = RTL_HOOKS_INITIALIZER; + /* Convenience wrapper for the canonicalize_comparison target hook. +Target hooks cannot use enum rtx_code. */ + static inline void + target_canonicalize_comparison (enum rtx_code *code, rtx *op0, rtx *op1, + bool op0_preserve_value) + { + int code_int = (int)*code; + targetm.canonicalize_comparison (code_int, op0, op1, op0_preserve_value); + *code = (enum rtx_code)code_int; + } + /* Try to split PATTERN found in INSN. This returns NULL_RTX if PATTERN can not be split. Otherwise, it returns an insn sequence. This is a wrapper around split_insns which ensures that the *** try_combine (rtx i3, rtx i2, rtx i1, rtx *** 2944,2952 compare_code = orig_compare_code = GET_CODE (*cc_use_loc); compare_code = simplify_compare_const (compare_code, op0, op1); ! #ifdef CANONICALIZE_COMPARISON ! CANONICALIZE_COMPARISON (compare_code, op0, op1); ! #endif } /* Do the rest only if op1 is const0_rtx, which may be the --- 2955,2961 compare_code = orig_compare_code = GET_CODE (*cc_use_loc); compare_code = simplify_compare_const (compare_code,
[PATCH] Fix PR55736
Switch conversion currently makes no effort to hide BLOCKs from locations of expressions it puts into the static constructors built. This causes issues at least for LTO where dead references to BLOCKs end up being produced for the varpool global initializers. But I can very well imagine that later CCP can re-expose these BLOCKs after they have been collected in a regular compilation as well. The patch moves the function that strips expressions of their location from ipa-prop.c next to unshare_expr and calls it unshare_expr_without_location. LTO bootstrap and regtest ongoing on x86_64-unknown-linux-gnu. Richard. 2012-12-19 Richard Biener rguent...@suse.de PR tree-optimization/55736 * gimplify.c (prune_expr_location): New function. (unshare_expr_without_location): Likewise. * tree.h (unshare_expr_without_location): Declare. * ipa-prop.c (prune_expression_for_jf): Remove. (prune_expression_for_jf_1): Likewise. (ipa_set_jf_constant): Use unshare_expr_without_location. (ipa_set_jf_arith_pass_through): Likewise. (determine_known_aggregate_parts): Likewise. * tree-switch-conversion.c (build_constructors): Use unshare_expr_without_location on all constructor elements. Index: gcc/gimplify.c === *** gcc/gimplify.c (revision 194578) --- gcc/gimplify.c (working copy) *** unshare_expr (tree expr) *** 1059,1064 --- 1059,1088 walk_tree (expr, mostly_copy_tree_r, NULL, NULL); return expr; } + + /* Worker for unshare_expr_without_location. */ + + static tree + prune_expr_location (tree *tp, int *walk_subtrees, void *) + { + if (EXPR_P (*tp)) + SET_EXPR_LOCATION (*tp, UNKNOWN_LOCATION); + else + *walk_subtrees = 0; + return NULL_TREE; + } + + /* Similar to unshare_expr but also prune all expression locations +from EXPR. */ + + tree + unshare_expr_without_location (tree expr) + { + walk_tree (expr, mostly_copy_tree_r, NULL, NULL); + if (EXPR_P (expr)) + walk_tree (expr, prune_expr_location, NULL, NULL); + return expr; + } /* WRAPPER is a code such as BIND_EXPR or CLEANUP_POINT_EXPR which can both contain statements and have a value. Assign its value to a temporary Index: gcc/tree.h === *** gcc/tree.h (revision 194578) --- gcc/tree.h (working copy) *** extern void change_decl_assembler_name ( *** 5606,5611 --- 5606,5612 /* In gimplify.c */ extern tree unshare_expr (tree); + extern tree unshare_expr_without_location (tree); /* In stmt.c */ Index: gcc/ipa-prop.c === *** gcc/ipa-prop.c (revision 194578) --- gcc/ipa-prop.c (working copy) *** ipa_print_all_jump_functions (FILE *f) *** 295,325 } } - /* Worker for prune_expression_for_jf. */ - - static tree - prune_expression_for_jf_1 (tree *tp, int *walk_subtrees, void *) - { - if (EXPR_P (*tp)) - SET_EXPR_LOCATION (*tp, UNKNOWN_LOCATION); - else - *walk_subtrees = 0; - return NULL_TREE; - } - - /* Return the expression tree EXPR unshared and with location stripped off. */ - - static tree - prune_expression_for_jf (tree exp) - { - if (EXPR_P (exp)) - { - exp = unshare_expr (exp); - walk_tree (exp, prune_expression_for_jf_1, NULL, NULL); - } - return exp; - } - /* Set JFUNC to be a known type jump function. */ static void --- 295,300 *** ipa_set_jf_constant (struct ipa_jump_fun *** 341,347 if (constant EXPR_P (constant)) SET_EXPR_LOCATION (constant, UNKNOWN_LOCATION); jfunc-type = IPA_JF_CONST; ! jfunc-value.constant = prune_expression_for_jf (constant); } /* Set JFUNC to be a simple pass-through jump function. */ --- 316,322 if (constant EXPR_P (constant)) SET_EXPR_LOCATION (constant, UNKNOWN_LOCATION); jfunc-type = IPA_JF_CONST; ! jfunc-value.constant = unshare_expr_without_location (constant); } /* Set JFUNC to be a simple pass-through jump function. */ *** ipa_set_jf_arith_pass_through (struct ip *** 363,369 tree operand, enum tree_code operation) { jfunc-type = IPA_JF_PASS_THROUGH; ! jfunc-value.pass_through.operand = prune_expression_for_jf (operand); jfunc-value.pass_through.formal_id = formal_id; jfunc-value.pass_through.operation = operation; jfunc-value.pass_through.agg_preserved = false; --- 338,344 tree operand, enum tree_code operation) { jfunc-type = IPA_JF_PASS_THROUGH; ! jfunc-value.pass_through.operand = unshare_expr_without_location (operand); jfunc-value.pass_through.formal_id = formal_id; jfunc-value.pass_through.operation = operation;
Re: [PATCH] Add gen_lowpart_for_debug (PR debug/55730)
On Tue, Dec 18, 2012 at 8:03 PM, Jakub Jelinek ja...@redhat.com wrote: Hi! On Tue, Dec 18, 2012 at 09:25:14AM +0100, Paolo Bonzini wrote: Il 17/12/2012 22:33, Jakub Jelinek ha scritto: If gen_lowpart_if_possible returns NULL, the default rtl_hooks.gen_lowpart_no_emit hook returns the original value, which is not of the desired mode. I bet in most passes for real insns such rtx is then meant to fail recog and thrown away, but for DEBUG_INSN modification that doesn't work, since there is no verification (but also e.g. any kind of SUBREG is fine). So we can e.g. end up with a (plus:SI (mem:DI ...) (mem:SI ...)) or similar and then various passes (in this testcase on s390x reload) can be very upset about that. Makes sense, and it could even be a wrong-code bug for this simplification: Richi reported another related failure today. During combine, rtl_hooks.gen_lowpart_no_emit is the combine version, which instead of giving up creates (clobber:MODE (const_int 0)). This is slightly less wrong than what the general hook did, but still dwarf2out would ICE when seeing that (with checking, without it just not provide location info). We can easily emit the SUBREG though (e.g. var-tracking itself also calls gen_rtx_raw_SUBREG as last resort) in the DEBUG_INSN operands. Bootstrapped/regtested on x86_64-linux and i686-linux (and on the testcase using - powerpc64-linux cross), ok for trunk? Ok. Thanks, Richard. 2012-12-18 Jakub Jelinek ja...@redhat.com PR debug/55730 * dwarf2out.c (mem_loc_descriptor): Ignore CLOBBER. * valtrack.c (gen_lowpart_for_debug): New function. (propagate_for_debug): Temporarily set rtl_hooks.gen_lowpart_no_emit to gen_lowpart_for_debug. * gcc.dg/debug/pr55730.c: New test. --- gcc/dwarf2out.c.jj 2012-12-18 11:41:30.0 +0100 +++ gcc/dwarf2out.c 2012-12-18 16:38:26.925380294 +0100 @@ -12714,6 +12714,7 @@ mem_loc_descriptor (rtx rtl, enum machin case CONST_VECTOR: case CONST_FIXED: case CLRSB: +case CLOBBER: /* If delegitimize_address couldn't do anything with the UNSPEC, we can't express it in the debug info. This can happen e.g. with some TLS UNSPECs. */ --- gcc/valtrack.c.jj 2012-11-05 15:02:17.0 +0100 +++ gcc/valtrack.c 2012-12-18 17:15:18.499375776 +0100 @@ -29,6 +29,24 @@ along with GCC; see the file COPYING3. #include regs.h #include emit-rtl.h +/* gen_lowpart_no_emit hook implementation for DEBUG_INSNs. In DEBUG_INSNs, + all lowpart SUBREGs are valid, despite what the machine requires for + instructions. */ + +static rtx +gen_lowpart_for_debug (enum machine_mode mode, rtx x) +{ + rtx result = gen_lowpart_if_possible (mode, x); + if (result) +return result; + + if (GET_MODE (x) != VOIDmode) +return gen_rtx_raw_SUBREG (mode, x, + subreg_lowpart_offset (mode, GET_MODE (x))); + + return NULL_RTX; +} + /* Replace auto-increment addressing modes with explicit operations to access the same addresses without modifying the corresponding registers. */ @@ -158,6 +176,7 @@ propagate_for_debug (rtx insn, rtx last, basic_block this_basic_block) { rtx next, loc, end = NEXT_INSN (BB_END (this_basic_block)); + rtx (*saved_rtl_hook_no_emit) (enum machine_mode, rtx); struct rtx_subst_pair p; p.to = src; @@ -165,6 +184,8 @@ propagate_for_debug (rtx insn, rtx last, next = NEXT_INSN (insn); last = NEXT_INSN (last); + saved_rtl_hook_no_emit = rtl_hooks.gen_lowpart_no_emit; + rtl_hooks.gen_lowpart_no_emit = gen_lowpart_for_debug; while (next != last next != end) { insn = next; @@ -179,6 +200,7 @@ propagate_for_debug (rtx insn, rtx last, df_insn_rescan (insn); } } + rtl_hooks.gen_lowpart_no_emit = saved_rtl_hook_no_emit; } /* Initialize DEBUG to an empty list, and clear USED, if given. */ --- gcc/testsuite/gcc.dg/debug/pr55730.c.jj 2012-12-18 17:08:29.649351676 +0100 +++ gcc/testsuite/gcc.dg/debug/pr55730.c2012-12-18 17:08:04.0 +0100 @@ -0,0 +1,24 @@ +/* PR debug/55730 */ +/* { dg-do compile } */ +/* { dg-options -w } */ + +union U +{ + float f; + int i; +}; + +void +foo (unsigned short *x, unsigned char y) +{ + unsigned char g; + union U u; + if (u.i 0) +g = 0; + else +{ + u.f = u.f * (255.0F / 256.0F) + 32768.0F; + g = (unsigned char) u.i; +} + *x = (g 8) | y; +} Jakub
[asan] Never use memset for clearing of shadow mem in epilogues (PR fortran/55341)
Hi! clear_storage sometimes emits a library call instead of clearing storage by pieces, rep stos* and similar, unfortunately if it is a call that libasan intercepts (memset), it fails because it doesn't allow writes into shadow mem. Fixed by scanning the clear_storage sequence if there are any calls, and if there are, replaces it with a simple loop storing 0. Tested on x86_64-linux, ok for trunk? 2012-12-19 Jakub Jelinek ja...@redhat.com PR fortran/55341 * asan.c (asan_clear_shadow): New function. (asan_emit_stack_protection): Use it. --- gcc/asan.c.jj 2012-12-13 00:05:04.0 +0100 +++ gcc/asan.c 2012-12-19 12:25:57.676365851 +0100 @@ -270,6 +270,45 @@ asan_shadow_cst (unsigned char shadow_by return GEN_INT (trunc_int_for_mode (val, SImode)); } +/* Clear shadow memory at SHADOW_MEM, LEN bytes. Can't call a library call here + though. */ + +static void +asan_clear_shadow (rtx shadow_mem, HOST_WIDE_INT len) +{ + rtx insn, insns, top_label, end, addr, tmp, jump; + + start_sequence (); + clear_storage (shadow_mem, GEN_INT (len), BLOCK_OP_NORMAL); + insns = get_insns (); + end_sequence (); + for (insn = insns; insn; insn = NEXT_INSN (insn)) +if (CALL_P (insn)) + break; + if (insn == NULL_RTX) +{ + emit_insn (insns); + return; +} + + gcc_assert ((len 3) == 0); + top_label = gen_label_rtx (); + addr = force_reg (Pmode, XEXP (shadow_mem, 0)); + shadow_mem = adjust_automodify_address (shadow_mem, SImode, addr, 0); + end = force_reg (Pmode, plus_constant (Pmode, addr, len)); + emit_label (top_label); + + emit_move_insn (shadow_mem, const0_rtx); + tmp = expand_simple_binop (Pmode, PLUS, addr, GEN_INT (4), addr, + true, OPTAB_LIB_WIDEN); + if (tmp != addr) +emit_move_insn (addr, tmp); + emit_cmp_and_jump_insns (addr, end, LT, NULL_RTX, Pmode, true, top_label); + jump = get_last_insn (); + gcc_assert (JUMP_P (jump)); + add_reg_note (jump, REG_BR_PROB, GEN_INT (REG_BR_PROB_BASE * 80 / 100)); +} + /* Insert code to protect stack vars. The prologue sequence should be emitted directly, epilogue sequence returned. BASE is the register holding the stack base, against which OFFSETS array offsets are relative to, OFFSETS @@ -404,8 +443,7 @@ asan_emit_stack_protection (rtx base, HO (last_offset - prev_offset) ASAN_SHADOW_SHIFT); prev_offset = last_offset; - clear_storage (shadow_mem, GEN_INT (last_size ASAN_SHADOW_SHIFT), -BLOCK_OP_NORMAL); + asan_clear_shadow (shadow_mem, last_size ASAN_SHADOW_SHIFT); last_offset = offset; last_size = 0; } @@ -418,8 +456,7 @@ asan_emit_stack_protection (rtx base, HO shadow_mem = adjust_address (shadow_mem, VOIDmode, (last_offset - prev_offset) ASAN_SHADOW_SHIFT); - clear_storage (shadow_mem, GEN_INT (last_size ASAN_SHADOW_SHIFT), -BLOCK_OP_NORMAL); + asan_clear_shadow (shadow_mem, last_size ASAN_SHADOW_SHIFT); } do_pending_stack_adjust (); Jakub
[asan] Use -fno-shrink-wrap for null-deref-1.c test
Hi! Weirdly this test fails just on some boxes and others succeeds (x86_64-linux, -Os only). The problem seems to be in the libasan fast unwinder, if the routine is shrink-wrapped, even when it is compiled with -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer, if the memory dereference which is supposed to segfault is outside of the region with valid frame pointer, the backtrace will still be wrong. Hopefully fixed by adding -fno-shrink-wrap. 2012-12-19 Jakub Jelinek ja...@redhat.com * c-c++-common/asan/null-deref-1.c: Add -fno-shrink-wrap to dg-options. --- gcc/testsuite/c-c++-common/asan/null-deref-1.c.jj 2012-12-13 00:02:50.0 +0100 +++ gcc/testsuite/c-c++-common/asan/null-deref-1.c 2012-12-19 12:30:05.354962160 +0100 @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options -fno-omit-frame-pointer } */ +/* { dg-options -fno-omit-frame-pointer -fno-shrink-wrap } */ /* { dg-additional-options -mno-omit-leaf-frame-pointer { target { i?86-*-* x86_64-*-* } } } */ /* { dg-shouldfail asan } */ Jakub
Re: [fortran, patch] Allow displaying backtraces from user code
Hi, first off: Some more words on the naming issue. I actually still prefer the most simple and straightforward variant (i.e. BACKTRACE, which can easily be found and does not sound 'clumsy') ... Or, why not just (plain and simple) BACKTRACE? The name is the same as backtrace() in glibc, but otherwise, sure why not. Is that actually an issue at all? The intrinsic procedure would be accessible as BACKTRACE from Fortran programs, but internally it receives the usual libgfortran name mangling, which makes it _gfortran_backtrace. So there should be no naming collision issues with glibc's backtrace(), right? _show/_print might be preferable in the sense that they convey that stuff will be directly printed on the screen, rather than, say, the procedure returning an array of strings with the stack trace info. I don't see that as a problem either, since we probably do not want to add another intrinsic which returns the backtrace as a string or something (if anything, we might add an optional integer argument, in order to print to a different unit, but I'm not proposing to do that right now). In any case, the procedure's behavior is described in the documentation. Do you have any further comments or do you think the patch is ok for trunk now? Ok for trunk. A minor addition, if you care, would be to mention in the documentation for backtrace_show() that the error message is printed to the unit corresponding to ERROR_UNIT in ISO_FORTRAN_ENV. Done. Thanks for the patch! Thanks for reviewing. Attached is a new patch, which expands the documentation according to your proposal, and uses the name BACKTRACE. I hope that both Janne and Tobias can agree with this naming decision ... Cheers, Janus pr36044_v3.diff Description: Binary data
Re: libgo patch committed: Update to current library
Hi Ian, Sorry about that. This patch should fix the build. I have not yet it does, thanks. tested whether it passes the tests. Bootstrapped on x86_64-unknown-linux-gnu, which proves nothing since the file is not used on GNU/Linux. Committed to mainline. I've tried it on i386-pc-solaris2.10, and it passes the log/syslog test even with -test.short=false. On the other hand, I wonder how the message formatting interoperates with Solaris syslog: the libc function adds an ID field since at least Solaris 8, something like Oct 8 16:53:11 luole xntpd[244]: [ID 204180 daemon.info] synchronisation lost Rainer -- - Rainer Orth, Center for Biotechnology, Bielefeld University
Re: [PING] Bugfix: Additional parameter for canonicalize comparison
On Wed, Dec 19, 2012 at 12:34 PM, Richard Earnshaw rearn...@arm.com wrote: On 19/12/12 09:53, Andreas Krebbel wrote: Hi, are the ARM parts of the patch below ok for mainline? Yes. Sorry for the delay. I think this broke bootstrap on x86_64: /space/rguenther/src/svn/trunk/gcc/config/i386/i386.c: At global scope: /space/rguenther/src/svn/trunk/gcc/config/i386/i386.c:42503: error: invalid conversion from 'bool (*)(int*, rtx_def**, rtx_def**, bool)' to 'void (*)(int*, rtx_def**, rtx_def**, bool)' make[3]: *** [i386.o] Error 1 or maybe even everywhere. Yeah, bool vs. void return value in the default implementation. Please fix. Richard. R. I did a compile test with a cross. Bye, -Andreas- Original Message Subject: [PATCH] Bugfix: Additional parameter for canonicalize comparison Date: Wed, 12 Dec 2012 12:23:14 +0100 From: Andreas Krebbel kreb...@linux.vnet.ibm.com To: rearn...@arm.com CC: gcc-patches@gcc.gnu.org Hi Richard, is the attached patch ok for ARM? Bye, -Andreas- 2012-12-12 Andreas Krebbel andreas.kreb...@de.ibm.com * target.def: Define canonicalize_comparison hook. * targhooks.h (default_canonicalize_comparison): New prototype. * targhooks.c (default_canonicalize_comparison): New function. * doc/tm.texi: Add documentation for the new target hook. * doc/tm.texi.in: Likewise. * combine.c (try_combine): Adjust to use the target hook. * config/alpha/alpha.h (CANONICALIZE_COMPARISON): Remove macro definition. * config/alpha/alpha.c (alpha_canonicalize_comparison): New function. (TARGET_CANONICALIZE_COMPARISON): New macro definition. * config/arm/arm-protos.h (arm_canonicalize_comparison): Remove prototype. * config/arm/arm.c (arm_canonicalize_comparison): Add new parameter. (TARGET_CANONICALIZE_COMPARISON): New macro definition. * config/arm/arm.h (CANONICALIZE_COMPARISON): Remove macro definition. * config/s390/s390-protos.h (s390_canonicalize_comparison): Remove prototype. * config/s390/s390.c (s390_canonicalize_comparison): Add new parameter. (TARGET_CANONICALIZE_COMPARISON): New macro definition. * config/s390/s390.h (CANONICALIZE_COMPARISON): Remove macro definition. * config/sh/sh-protos.h (sh_canonicalize_comparison): Remove prototype. * config/sh/sh.c (sh_canonicalize_comparison): Add new prototype. New function overloading the old one. (TARGET_CANONICALIZE_COMPARISON): New macro definition. * config/sh/sh.h (CANONICALIZE_COMPARISON): Remove macro definition. * config/spu/spu.c (spu_canonicalize_comparison): New function. (TARGET_CANONICALIZE_COMPARISON): New macro definition. * config/spu/spu.h (CANONICALIZE_COMPARISON): Remove macro definition. --- gcc/combine.c | 19 ++-!!! gcc/config/alpha/alpha.c | 27 gcc/config/alpha/alpha.h | 20 gcc/config/arm/arm-protos.h |1 gcc/config/arm/arm.c | 68 ++-!! gcc/config/arm/arm.h |3 - gcc/config/s390/s390-protos.h |1 gcc/config/s390/s390.c| 13 +++! gcc/config/s390/s390.h|4 -- gcc/config/sh/sh-protos.h |2 - gcc/config/sh/sh.c| 34 +++!! gcc/config/sh/sh.h|4 -- gcc/config/spu/spu.c | 17 ++ gcc/config/spu/spu.h | 12 --- gcc/doc/tm.texi | 20 gcc/doc/tm.texi.in| 20 gcc/target.def|8 gcc/targhooks.h |2 + 18 files changed, 94 insertions(+), 50 deletions(-), 131 modifications(!) Index: gcc/combine.c === *** gcc/combine.c.orig --- gcc/combine.c *** static rtx gen_lowpart_or_truncate (enum *** 494,499 --- 494,510 static const struct rtl_hooks combine_rtl_hooks = RTL_HOOKS_INITIALIZER; + /* Convenience wrapper for the canonicalize_comparison target hook. +Target hooks cannot use enum rtx_code. */ + static inline void + target_canonicalize_comparison (enum rtx_code *code, rtx *op0, rtx *op1, + bool op0_preserve_value) + { + int code_int = (int)*code; + targetm.canonicalize_comparison (code_int, op0, op1, op0_preserve_value); + *code = (enum rtx_code)code_int; + } + /* Try to split PATTERN found in INSN. This returns NULL_RTX if PATTERN can not be split. Otherwise, it returns an insn sequence. This is a wrapper around split_insns which ensures that the *** try_combine (rtx
RE: [PATCH][ARM] AArch32 vmaxnm, vminnm support
Ping. http://gcc.gnu.org/ml/gcc-patches/2012-11/msg02097.html Thanks, Kyrill -Original Message- From: gcc-patches-ow...@gcc.gnu.org [mailto:gcc-patches- ow...@gcc.gnu.org] On Behalf Of Kyrylo Tkachov Sent: 26 November 2012 14:40 To: gcc-patches@gcc.gnu.org Cc: Ramana Radhakrishnan; Richard Earnshaw Subject: [PATCH][ARM] AArch32 vmaxnm, vminnm support Hi all, This patch adds support for the AArch32 vmaxnm and vminnm VFP instructions in that can be used to implement the smax[sf,df]3 and smin[sf,df]3 RTL patterns. The patterns are only used by gcc when unsafe math optimisations are turned on. Two new values for the type attribute are introduced: f_minmaxs and f_minmaxd. New compilation tests are added. They pass and no regressions on arm-none-eabi. Ok for trunk? Thanks, Kyrill gcc/ChangeLog 2012-11-26 Kyrylo Tkachov kyrylo.tkac...@arm.com * config/arm/arm.md (f_minmaxs, f_minmaxd): New types. * config/arm/vfp.md (smaxmode3): New pattern. (sminmode3): Likewise. gcc/testsuite/ChangeLog 2012-11-26 Kyrylo Tkachov kyrylo.tkac...@arm.com * gcc.target/arm/vmaxnmdf.c: New test. * gcc.target/arm/vmaxnmsf.c: Likewise. * gcc.target/arm/vminnmsf.c: Likewise. * gcc.target/arm/vminnmdf.c: Likewise.
Re: [PING] Bugfix: Additional parameter for canonicalize comparison
On Wed, Dec 19, 2012 at 3:04 PM, Richard Biener richard.guent...@gmail.com wrote: On Wed, Dec 19, 2012 at 12:34 PM, Richard Earnshaw rearn...@arm.com wrote: On 19/12/12 09:53, Andreas Krebbel wrote: Hi, are the ARM parts of the patch below ok for mainline? Yes. Sorry for the delay. I think this broke bootstrap on x86_64: /space/rguenther/src/svn/trunk/gcc/config/i386/i386.c: At global scope: /space/rguenther/src/svn/trunk/gcc/config/i386/i386.c:42503: error: invalid conversion from 'bool (*)(int*, rtx_def**, rtx_def**, bool)' to 'void (*)(int*, rtx_def**, rtx_def**, bool)' make[3]: *** [i386.o] Error 1 or maybe even everywhere. Yeah, bool vs. void return value in the default implementation. Please fix. I also can't find a definition of default_canonicalize_comparison - did you forget to commit a part of the patch? Thanks, Richard. Richard. R. I did a compile test with a cross. Bye, -Andreas- Original Message Subject: [PATCH] Bugfix: Additional parameter for canonicalize comparison Date: Wed, 12 Dec 2012 12:23:14 +0100 From: Andreas Krebbel kreb...@linux.vnet.ibm.com To: rearn...@arm.com CC: gcc-patches@gcc.gnu.org Hi Richard, is the attached patch ok for ARM? Bye, -Andreas- 2012-12-12 Andreas Krebbel andreas.kreb...@de.ibm.com * target.def: Define canonicalize_comparison hook. * targhooks.h (default_canonicalize_comparison): New prototype. * targhooks.c (default_canonicalize_comparison): New function. * doc/tm.texi: Add documentation for the new target hook. * doc/tm.texi.in: Likewise. * combine.c (try_combine): Adjust to use the target hook. * config/alpha/alpha.h (CANONICALIZE_COMPARISON): Remove macro definition. * config/alpha/alpha.c (alpha_canonicalize_comparison): New function. (TARGET_CANONICALIZE_COMPARISON): New macro definition. * config/arm/arm-protos.h (arm_canonicalize_comparison): Remove prototype. * config/arm/arm.c (arm_canonicalize_comparison): Add new parameter. (TARGET_CANONICALIZE_COMPARISON): New macro definition. * config/arm/arm.h (CANONICALIZE_COMPARISON): Remove macro definition. * config/s390/s390-protos.h (s390_canonicalize_comparison): Remove prototype. * config/s390/s390.c (s390_canonicalize_comparison): Add new parameter. (TARGET_CANONICALIZE_COMPARISON): New macro definition. * config/s390/s390.h (CANONICALIZE_COMPARISON): Remove macro definition. * config/sh/sh-protos.h (sh_canonicalize_comparison): Remove prototype. * config/sh/sh.c (sh_canonicalize_comparison): Add new prototype. New function overloading the old one. (TARGET_CANONICALIZE_COMPARISON): New macro definition. * config/sh/sh.h (CANONICALIZE_COMPARISON): Remove macro definition. * config/spu/spu.c (spu_canonicalize_comparison): New function. (TARGET_CANONICALIZE_COMPARISON): New macro definition. * config/spu/spu.h (CANONICALIZE_COMPARISON): Remove macro definition. --- gcc/combine.c | 19 ++-!!! gcc/config/alpha/alpha.c | 27 gcc/config/alpha/alpha.h | 20 gcc/config/arm/arm-protos.h |1 gcc/config/arm/arm.c | 68 ++-!! gcc/config/arm/arm.h |3 - gcc/config/s390/s390-protos.h |1 gcc/config/s390/s390.c| 13 +++! gcc/config/s390/s390.h|4 -- gcc/config/sh/sh-protos.h |2 - gcc/config/sh/sh.c| 34 +++!! gcc/config/sh/sh.h|4 -- gcc/config/spu/spu.c | 17 ++ gcc/config/spu/spu.h | 12 --- gcc/doc/tm.texi | 20 gcc/doc/tm.texi.in| 20 gcc/target.def|8 gcc/targhooks.h |2 + 18 files changed, 94 insertions(+), 50 deletions(-), 131 modifications(!) Index: gcc/combine.c === *** gcc/combine.c.orig --- gcc/combine.c *** static rtx gen_lowpart_or_truncate (enum *** 494,499 --- 494,510 static const struct rtl_hooks combine_rtl_hooks = RTL_HOOKS_INITIALIZER; + /* Convenience wrapper for the canonicalize_comparison target hook. +Target hooks cannot use enum rtx_code. */ + static inline void + target_canonicalize_comparison (enum rtx_code *code, rtx *op0, rtx *op1, + bool op0_preserve_value) + { + int code_int = (int)*code; + targetm.canonicalize_comparison (code_int, op0, op1, op0_preserve_value); + *code = (enum rtx_code)code_int; + } + /* Try to
Re: [fortran, patch] Allow displaying backtraces from user code
Janus Weil wrote: Attached is a new patch, which expands the documentation according to your proposal, and uses the name BACKTRACE. I hope that both Janne and Tobias can agree with this naming decision ... Looks fine from my side. Can you also add a quip to http://gcc.gnu.org/wiki/GFortran#GCC4.8 ? Tobias
[PATCH] Unbreak bootstrap
I'll check in the following once it survived stage1. Richard. 2012-12-19 Richard Biener rguent...@suse.de * targhooks.h (default_canonicalize_comparison): Fix prototype. * targhooks.c (default_canonicalize_comparison): Define. Index: gcc/targhooks.h === --- gcc/targhooks.h (revision 194609) +++ gcc/targhooks.h (working copy) @@ -179,7 +179,7 @@ extern unsigned char default_class_max_n extern enum unwind_info_type default_debug_unwind_info (void); -extern bool default_canonicalize_comparison (int *, rtx *, rtx *, bool); +extern void default_canonicalize_comparison (int *, rtx *, rtx *, bool); extern int default_label_align_after_barrier_max_skip (rtx); extern int default_loop_align_max_skip (rtx); Index: gcc/targhooks.c === --- gcc/targhooks.c (revision 194609) +++ gcc/targhooks.c (working copy) @@ -1540,4 +1540,11 @@ default_member_type_forces_blk (const_tr return false; } +/* Default version of canonicalize_comparison. */ + +void +default_canonicalize_comparison (int *, rtx *, rtx *, bool) +{ +} + #include gt-targhooks.h
[Patch, AArch64]: Fix test harness to for unaligned vector mem access.
Hi, Currently on the trunk, we have many vect tests that fail for aarch64-*-* because check_effective_target_vect_no_align () in target-supports.exp returns true for aarch64 where in fact it should be returning false. This causes the tests that check for vect_no_align and expect messages for loop versioning to fail. The attached patch drops aarch64 from the list of targets in check_effective_target_vect_no_align () as unaligned access is supported. Tested on trunk for aarch64-none-elf with no regressions. OK for trunk? Thanks, Tejas Belagod ARM. Changelog: 2012-12-19 Tejas Belagod tejas.bela...@arm.com testsuite/ * lib/target-supports.exp (check_effective_target_vect_no_align): Remove aarch64 from list of targets.diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index e541c12..c20ec5e 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -3488,7 +3488,6 @@ proc check_effective_target_vect_no_align { } { if { [istarget mipsisa64*-*-*] || [istarget sparc*-*-*] || [istarget ia64-*-*] -|| [istarget aarch64-*-*] || [check_effective_target_arm_vect_no_misalign] || ([istarget mips*-*-*] [check_effective_target_mips_loongson]) } {
Re: [Patch, AArch64]: Fix test harness to for unaligned vector mem access.
On 19/12/12 14:47, Tejas Belagod wrote: Hi, Currently on the trunk, we have many vect tests that fail for aarch64-*-* because check_effective_target_vect_no_align () in target-supports.exp returns true for aarch64 where in fact it should be returning false. This causes the tests that check for vect_no_align and expect messages for loop versioning to fail. The attached patch drops aarch64 from the list of targets in check_effective_target_vect_no_align () as unaligned access is supported. Tested on trunk for aarch64-none-elf with no regressions. OK for trunk? Thanks, Tejas Belagod ARM. Changelog: 2012-12-19 Tejas Belagod tejas.bela...@arm.com testsuite/ * lib/target-supports.exp (check_effective_target_vect_no_align): Remove aarch64 from list of targets. OK. R.
[Patch, Fortran/GOMP, committed] Moved test case from testsuite/gfortran.dg/gomp to libgomp/
Commited as obvious (Rev. 194611). The test case accesses the .mod file which is generated in libgomp. For some reasons, it works when GCC is installed (i.e. it works for most developers?) but it fails otherwise (e.g. for HJ's builds). Tobias Index: libgomp/ChangeLog === --- libgomp/ChangeLog (Revision 194610) +++ libgomp/ChangeLog (Arbeitskopie) @@ -1,3 +1,8 @@ +2012-12-19 Tobias Burnus bur...@net-b.de + + * testsuite/libgomp.fortran/use_intrinsic_1.f90: New; moved + from gcc/testsuite/gfortran.dg/gomp/use_intrinsic_1.f90. + 2012-11-21 Jakub Jelinek ja...@redhat.com PR libgomp/55411 Index: gcc/testsuite/ChangeLog === --- gcc/testsuite/ChangeLog (Revision 194610) +++ gcc/testsuite/ChangeLog (Arbeitskopie) @@ -1,3 +1,8 @@ +2012-12-19 Tobias Burnus bur...@net-b.de + + * gfortran.dg/gomp/use_intrinsic_1.f90: Moved + to libgomp/testsuite/libgomp.fortran/use_intrinsic_1.f90. + 2012-12-19 Richard Biener rguent...@suse.de PR tree-optimization/55736 Index: gcc/testsuite/gfortran.dg/gomp/use_intrinsic_1.f90 === --- gcc/testsuite/gfortran.dg/gomp/use_intrinsic_1.f90 (Revision 194610) +++ gcc/testsuite/gfortran.dg/gomp/use_intrinsic_1.f90 (Arbeitskopie) @@ -1,11 +0,0 @@ -! { dg-do compile } -! -! PR fortran/55197 -! -! Contributed by Erik Toussaint -! - -use, intrinsic :: omp_lib, only: omp_get_num_threads -use, intrinsic :: omp_lib_kinds , foo = omp_lock_kind -print *, foo -end
Re: [fortran, patch] Allow displaying backtraces from user code
Attached is a new patch, which expands the documentation according to your proposal, and uses the name BACKTRACE. I hope that both Janne and Tobias can agree with this naming decision ... Looks fine from my side. Great, thanks. Janne? Can you also add a quip to http://gcc.gnu.org/wiki/GFortran#GCC4.8 ? Sure, as soon as the patch is committed ... Cheers, Janus
Re: PATCH RFA: PR go/55201: Create libatomic convenience library
Am 19.12.2012 01:28, schrieb Ian Lance Taylor: On Tue, Dec 18, 2012 at 3:15 PM, Richard Henderson r...@redhat.com wrote: On 12/18/2012 02:52 PM, Ian Lance Taylor wrote: Argh. But why? Wouldn't that only apply to cases where the lock was sometimes locked by one library and sometimes locked by a different one? Or did you really mean ... only apply to cases where the memory protected by the lock was visible to more than one library. Yes, if libgo is attempting atomic accesses to its own data structures, which themselves are not exported from libgo, then a copy of libatomic ought to work. It would probably be better for the shared libgo to depend on the shared libatomic though. That's simply more pedantically correct. But according to Matthias's comment upthread, it would require addressing some issue in libtool in order to get multilib working correctly. I'm not going to try to solve this today, but if somebody else wants to that would be great. you cannot reproduce this, if you already have libatomic.so.1 installed into your destination/installation path. You should be able to reproduce this by installing into an empty destination (maybe using DESTDIR). Then libgo can't find the libatomic. calling make install-target-libatomic and then re-running lets make install succeed. Makefile.def doesn't define any dependencies on the installation targets, however seldom people run make install with -j, and then the order the target_modules are listed matters. libatomic comes behind the libgo target, otoh libquadmath comes before libgfortran and installs without issues. The following patch fixes this for me, maybe other target library dependencies should be added too. that would be for libgfortran on libquadmath, libgcc libsanitizer on libstdc++ libstdc++ on libgomp, libgcc libjava on libstdc++, libgcc libasan on libgcc libobjc on libgcc libitm on libgcc Matthias Index: Makefile.def === --- Makefile.def(Revision 194604) +++ Makefile.def(Arbeitskopie) @@ -514,6 +514,8 @@ // recursive make, we can't be that specific. dependencies = { module=all-target-libstdc++-v3; on=configure-target-libgomp; }; +dependencies = { module=install-target-libgo; on=install-target-libatomic; }; + // Target modules in the 'src' repository. lang_env_dependencies = { module=libtermcap; }; lang_env_dependencies = { module=rda; };
[Patch, libgomp] libgomp.fortran/fortran.exp - add -fintrinsic-modules-path ${blddir}
The attached patch adds -fintrinsic-modules-path ${blddir} otherwise, the compiler might have trouble finding the libraries using use, INTRINSIC :: omp_lib. Without intrinsic it searches the -I directories. (The compiler supports multiple -fintrinsic-modules-path, cf. gfc_add_intrinsic_modules_path; however, the only physically existing intrinsic .mod files are those of libgomp. ISO_C_binding and ISO_Fortran_env do only virtually exist in the compiler.) Tested on x86-64-gnu-linux. OK? Tobias 2012-12-19 Tobias Burnus bur...@net-b.de * testsuite/libgomp.fortran/fortran.exp: Set -fintrinsic-modules-path. diff --git a/libgomp/testsuite/libgomp.fortran/fortran.exp b/libgomp/testsuite/libgomp.fortran/fortran.exp index 5fa42f4..68440d18 100644 --- a/libgomp/testsuite/libgomp.fortran/fortran.exp +++ b/libgomp/testsuite/libgomp.fortran/fortran.exp @@ -14,6 +14,7 @@ set quadmath_library_path ../libquadmath/.libs dg-init if { $blddir != } { +lappend ALWAYS_CFLAGS additional_flags=-fintrinsic-modules-path ${blddir} # Look for a static libgfortran first. if [file exists ${blddir}/${lang_library_path}/libgfortran.a] { set lang_test_file ${lang_library_path}/libgfortran.a
Re: [PATCH][ARM] AArch32 vmaxnm, vminnm support
On 26/11/12 14:40, Kyrylo Tkachov wrote: Hi all, This patch adds support for the AArch32 vmaxnm and vminnm VFP instructions in that can be used to implement the smax[sf,df]3 and smin[sf,df]3 RTL patterns. The patterns are only used by gcc when unsafe math optimisations are turned on. Two new values for the type attribute are introduced: f_minmaxs and f_minmaxd. New compilation tests are added. They pass and no regressions on arm-none-eabi. Ok for trunk? OK. R.
Re: [Patch, libgomp] libgomp.fortran/fortran.exp - add -fintrinsic-modules-path ${blddir}
On Wed, Dec 19, 2012 at 04:38:41PM +0100, Tobias Burnus wrote: 2012-12-19 Tobias Burnus bur...@net-b.de * testsuite/libgomp.fortran/fortran.exp: Set -fintrinsic-modules-path. Okay. Jakub
Re: PATCH RFA: PR go/55201: Create libatomic convenience library
On Wed, Dec 19, 2012 at 7:38 AM, Matthias Klose d...@ubuntu.com wrote: The following patch fixes this for me, maybe other target library dependencies should be added too. that would be for libgfortran on libquadmath, libgcc libsanitizer on libstdc++ libstdc++ on libgomp, libgcc libjava on libstdc++, libgcc libasan on libgcc libobjc on libgcc libitm on libgcc Matthias Index: Makefile.def === --- Makefile.def(Revision 194604) +++ Makefile.def(Arbeitskopie) @@ -514,6 +514,8 @@ // recursive make, we can't be that specific. dependencies = { module=all-target-libstdc++-v3; on=configure-target-libgomp; }; +dependencies = { module=install-target-libgo; on=install-target-libatomic; }; + // Target modules in the 'src' repository. lang_env_dependencies = { module=libtermcap; }; lang_env_dependencies = { module=rda; }; Thanks for looking into it. This patch is OK with a ChangeLog entry. Ian
Re: [ARM] Turning off 64bits ops in Neon and gfortran/modulo-scheduling problem
On 17 December 2012 16:12, Richard Earnshaw rearn...@arm.com wrote: On 29/11/12 17:16, Christophe Lyon wrote: On trunk I have noticed a regression in gfortran when using modulo scheduling: sms-1.f90 now fails, but I suspect it's not because of this patch since forcing compilation for armv5t makes the same test fail with and without my patch. Hmm, that's worrying. Could you please makesure this is recorded in bugzilla. If this is a regression, please mark it as such. I was about to do so, but after bisecting it turns out that the problem was introduced by http://gcc.gnu.org/viewcvs?root=gccview=revrev=192969 and is very likely to be another instance of PR55562, which has just been fixed by http://gcc.gnu.org/ml/gcc-patches/2012-12/msg01137.html. Now that this optimization is disabled by default, the onlya8 code is completely redundant and should be purged, along with the insn alternatives that used it. R. Here is a new version of my patch, with the cleanup you requested. 2012-12-18 Christophe Lyon christophe.l...@linaro.org gcc/ * config/arm/arm-protos.h (tune_params): Add prefer_neon_for_64bits field. * config/arm/arm.c (prefer_neon_for_64bits): New variable. (arm_slowmul_tune): Default prefer_neon_for_64bits to false. (arm_fastmul_tune, arm_strongarm_tune, arm_xscale_tune): Ditto. (arm_9e_tune, arm_v6t2_tune, arm_cortex_tune): Ditto. (arm_cortex_a5_tune, arm_cortex_a15_tune): Ditto. (arm_cortex_a9_tune, arm_fa726te_tune): Ditto. (arm_option_override): Handle -mneon-for-64bits new option. * config/arm/arm.h (TARGET_PREFER_NEON_64BITS): New macro. (prefer_neon_for_64bits): Declare new variable. * config/arm/arm.md (arch): Rename neon_onlya8 and neon_nota8 to avoid_neon_for_64bits and neon_for_64bits. Remove onlya8 and nota8. (arch_enabled): Handle new arch types. Remove support for onlya8 and nota8. (one_cmpldi2): Use new arch names. * config/arm/arm.opt (mneon-for-64bits): Add option. * config/arm/neon.md (adddi3_neon, subdi3_neon, iordi3_neon) (anddi3_neon, xordi3_neon, ashldi3_neon, shiftdi3_neon): Use neon_for_64bits instead of nota8 and avoid_neon_for_64bits instead of onlya8. * doc/invoke.texi (-mneon-for-64bits): Document. gcc/testsuite/ * gcc.target/arm/neon-for-64bits-1.c: New tests. * gcc.target/arm/neon-for-64bits-2.c: Likewise. diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h index d942c5b..c92f055 100644 --- a/gcc/config/arm/arm-protos.h +++ b/gcc/config/arm/arm-protos.h @@ -247,6 +247,8 @@ struct tune_params performance. The first element covers Thumb state and the second one is for ARM state. */ bool logical_op_non_short_circuit[2]; + /* Prefer Neon for 64-bit bitops. */ + bool prefer_neon_for_64bits; }; extern const struct tune_params *current_tune; diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 84ce56f..5e99436 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -816,6 +816,10 @@ int arm_arch_thumb2; int arm_arch_arm_hwdiv; int arm_arch_thumb_hwdiv; +/* Nonzero if we should use Neon to handle 64-bits operations rather + than core registers. */ +int prefer_neon_for_64bits = 0; + /* In case of a PRE_INC, POST_INC, PRE_DEC, POST_DEC memory reference, we must report the mode of the memory reference from TARGET_PRINT_OPERAND to TARGET_PRINT_OPERAND_ADDRESS. */ @@ -895,6 +899,7 @@ const struct tune_params arm_slowmul_tune = arm_default_branch_cost, false, /* Prefer LDRD/STRD. */ {true, true},/* Prefer non short circuit. */ + false /* Prefer Neon for 64-bits bitops. */ }; const struct tune_params arm_fastmul_tune = @@ -908,6 +913,7 @@ const struct tune_params arm_fastmul_tune = arm_default_branch_cost, false, /* Prefer LDRD/STRD. */ {true, true},/* Prefer non short circuit. */ + false /* Prefer Neon for 64-bits bitops. */ }; /* StrongARM has early execution of branches, so a sequence that is worth @@ -924,6 +930,7 @@ const struct tune_params arm_strongarm_tune = arm_default_branch_cost, false, /* Prefer LDRD/STRD. */ {true, true},/* Prefer non short circuit. */ + false /* Prefer Neon for 64-bits bitops. */ }; const struct tune_params arm_xscale_tune = @@ -937,6 +944,7 @@ const struct tune_params arm_xscale_tune = arm_default_branch_cost, false, /* Prefer LDRD/STRD. */ {true, true},
Re: [PATCH,x86] Fix combine for condditional instructions.
On Fri, Dec 14, 2012 at 11:47 AM, Yuri Rumyantsev ysrum...@gmail.com wrote: With your new fix that add if-then-else splitting for memory operand I got expected performance speed-up - +6.7% for Atom and +8.4% for SNB. We need to do all testing this weekend and I will get you our final feedback on Monday. After some off-line discussions, we decided to enable splitting for Atom only (where it was always a win), since splitting regressed SNB in some other tests. 2012-12-19 Uros Bizjak ubiz...@gmail.com Yuri Rumyantsev ysrum...@gmail.com * config/i386/i386.h (enum ix86_tune_indices): Add X86_TUNE_AVOID_MEM_OPND_FOR_CMOVE. (TARGET_AVOID_MEM_OPND_FOR_CMOVE): New define. * config/i386/i386.c (initial_ix86_tune_features) X86TUNE_AVOID_MEM_OPND_FOR_CMOVE: Initialize. * config/i386/i386.md (splitters to avoid cmove memory operands): New. (peephole2s to avoid cmove memory operands): New. Tested on x86_64-pc-linux-gnu, committed to mainline SVN. Uros. Index: i386.c === --- i386.c (revision 194610) +++ i386.c (working copy) @@ -2026,7 +2026,11 @@ static unsigned int initial_ix86_tune_features[X86 /* X86_TUNE_GENERAL_REGS_SSE_SPILL: Try to spill general regs to SSE regs instead of memory. */ - m_COREI7 | m_CORE2I7 + m_COREI7 | m_CORE2I7, + + /* X86_TUNE_AVOID_MEM_OPND_FOR_CMOVE: Try to avoid memory operands for + a conditional move. */ + m_ATOM }; /* Feature tests against the various architecture variations. */ Index: i386.h === --- i386.h (revision 194610) +++ i386.h (working copy) @@ -331,6 +331,7 @@ enum ix86_tune_indices { X86_TUNE_REASSOC_INT_TO_PARALLEL, X86_TUNE_REASSOC_FP_TO_PARALLEL, X86_TUNE_GENERAL_REGS_SSE_SPILL, + X86_TUNE_AVOID_MEM_OPND_FOR_CMOVE, X86_TUNE_LAST }; @@ -436,6 +437,8 @@ extern unsigned char ix86_tune_features[X86_TUNE_L ix86_tune_features[X86_TUNE_REASSOC_FP_TO_PARALLEL] #define TARGET_GENERAL_REGS_SSE_SPILL \ ix86_tune_features[X86_TUNE_GENERAL_REGS_SSE_SPILL] +#define TARGET_AVOID_MEM_OPND_FOR_CMOVE \ + ix86_tune_features[X86_TUNE_AVOID_MEM_OPND_FOR_CMOVE] /* Feature tests against the various architecture variations. */ enum ix86_arch_indices { Index: i386.md === --- i386.md (revision 194610) +++ i386.md (working copy) @@ -16093,6 +16093,28 @@ [(set_attr type icmov) (set_attr mode MODE)]) +;; Don't do conditional moves with memory inputs. This splitter helps +;; register starved x86_32 by forcing inputs into registers before reload. +(define_split + [(set (match_operand:SWI248 0 register_operand) + (if_then_else:SWI248 (match_operator 1 ix86_comparison_operator + [(reg FLAGS_REG) (const_int 0)]) + (match_operand:SWI248 2 nonimmediate_operand) + (match_operand:SWI248 3 nonimmediate_operand)))] + !TARGET_64BIT TARGET_CMOVE +TARGET_AVOID_MEM_OPND_FOR_CMOVE +(MEM_P (operands[2]) || MEM_P (operands[3])) +can_create_pseudo_p () +optimize_insn_for_speed_p () + [(set (match_dup 0) + (if_then_else:SWI248 (match_dup 1) (match_dup 2) (match_dup 3)))] +{ + if (MEM_P (operands[2])) +operands[2] = force_reg (MODEmode, operands[2]); + if (MEM_P (operands[3])) +operands[3] = force_reg (MODEmode, operands[3]); +}) + (define_insn *movqicc_noc [(set (match_operand:QI 0 register_operand =r,r) (if_then_else:QI (match_operator 1 ix86_comparison_operator @@ -16105,14 +16127,12 @@ (set_attr mode QI)]) (define_split - [(set (match_operand 0 register_operand) - (if_then_else (match_operator 1 ix86_comparison_operator - [(reg FLAGS_REG) (const_int 0)]) - (match_operand 2 register_operand) - (match_operand 3 register_operand)))] + [(set (match_operand:SWI12 0 register_operand) + (if_then_else:SWI12 (match_operator 1 ix86_comparison_operator + [(reg FLAGS_REG) (const_int 0)]) + (match_operand:SWI12 2 register_operand) + (match_operand:SWI12 3 register_operand)))] TARGET_CMOVE !TARGET_PARTIAL_REG_STALL -(GET_MODE (operands[0]) == QImode - || GET_MODE (operands[0]) == HImode) reload_completed [(set (match_dup 0) (if_then_else:SI (match_dup 1) (match_dup 2) (match_dup 3)))] @@ -16122,6 +16142,33 @@ operands[3] = gen_lowpart (SImode, operands[3]); }) +;; Don't do conditional moves with memory inputs +(define_peephole2 + [(match_scratch:SWI248 2 r) + (set (match_operand:SWI248 0 register_operand) + (if_then_else:SWI248 (match_operator 1 ix86_comparison_operator + [(reg FLAGS_REG) (const_int 0)]) + (match_dup 0) +
[patch] Fix typo in multiarch definition for kfreebsd
Fixes a typo in the multiarch definition for kfreebsd. Committed as obvious. Matthias 2012-12-19 Matthias Klose d...@ubuntu.com * config/i386/t-kfreebsd (MULTIARCH_DIRNAME): Add comma to separate arguments in make function. Index: config/i386/t-kfreebsd === --- config/i386/t-kfreebsd (Revision 194615) +++ config/i386/t-kfreebsd (Arbeitskopie) @@ -2,4 +2,4 @@ # MULTILIB_OSDIRNAMES are set in t-linux64. KFREEBSD_OS = $(filter kfreebsd%, $(word 3, $(subst -, ,$(target -MULTILIB_OSDIRNAMES := $(filter-out mx32=% $(subst linux,$(KFREEBSD_OS),$(MULTILIB_OSDIRNAMES))) +MULTILIB_OSDIRNAMES := $(filter-out mx32=%,$(subst linux,$(KFREEBSD_OS),$(MULTILIB_OSDIRNAMES)))
[patch] fix multiarch definition for powerpcspe-linux-gnu
The definition of the multiarch tuple for powerpcspe-linux-gnu was wrong. The t-spe fragment isn't included for the powerpc*-linux* case, so move it to t-linux, and use tm_file_list (tm_file is only used in config.gcc). Ok for the trunk? Matthias 2012-12-19 Roland Stigge sti...@debian.org Matthias Klose d...@ubuntu.com * config/rs6000/t-spe (MULTIARCH_DIRNAME): Remove. * config/rs6000/t-linux (MULTIARCH_DIRNAME): Define name for powerpc-linux-gnuspe. Index: config/rs6000/t-spe === --- config/rs6000/t-spe (Revision 194615) +++ config/rs6000/t-spe (Arbeitskopie) @@ -71,7 +71,3 @@ mabi=altivec/mlittle \ maltivec/mlittle \ maltivec/mabi=altivec/mlittle - -ifneq (,$(findstring linux, $(target))) -MULTIARCH_DIRNAME = powerpc-linux-gnuspe$(if $(findstring rs6000/e500-double.h, $(tm_file)),,v1) -endif Index: config/rs6000/t-linux === --- config/rs6000/t-linux (Revision 194615) +++ config/rs6000/t-linux (Arbeitskopie) @@ -1,5 +1,9 @@ # do not define the multiarch name if configured for a soft-float cpu # or soft-float. ifeq (,$(filter $(with_cpu),$(SOFT_FLOAT_CPUS))$(findstring soft,$(with_float))) +ifneq (,$(findstring spe,$(target))) +MULTIARCH_DIRNAME = powerpc-linux-gnuspe$(if $(findstring rs6000/e500-double.h, $(tm_file_list)),,v1) +else MULTIARCH_DIRNAME = powerpc-linux-gnu endif +endif
Re: [C PATCH] Don't perform function array conversions on inline asm m constrainted inputs (PR c++/55619)
On Wed, 12 Dec 2012, Jakub Jelinek wrote: 2012-12-12 Jakub Jelinek ja...@redhat.com PR c++/55619 * c-parser.c (c_parser_asm_operands): Remove CONVERT_P argument, don't call default_function_array_conversion nor c_fully_fold here. (c_parser_asm_statement): Adjust callers. * c-typeck.c (build_asm_expr): Call c_fully_fold on inputs and outputs here, and call default_function_array_conversion on inputs that don't need to be addressable. * c-c++-common/pr55619.c: New test. OK. -- Joseph S. Myers jos...@codesourcery.com
Re: [PATCH] Enable non-complex math builtins from C99 for Bionic
On Thu, 13 Dec 2012, Alexander Ivchenko wrote: Could you please take a look at the attached patch that implements the target libc_has_function hook? I didn't change so far the default presence of c99, but rather tried to preserve the current behaviour of TARGET_C99_FUNCTIONS. It looks like a plausible starting point, given the changed default, coding style fixes (you're missing spaces before '('), documentation text moved from tm.texi.in to target.def, removal of TARGET_C99_FUNCTIONS documentation, poisoning of TARGET_C99_FUNCTIONS in system.h and moving the Linux implementation of the hook from builtins.c to some Linux-specific file since you can't assume OPTION_GLIBC or OPTION_BIONIC are defined for other targets. -- Joseph S. Myers jos...@codesourcery.com
Re: [doc] extend.texi copy-editing, 3/N (hyphenated phrases)
On 12/18/2012 10:42 PM, Gerald Pfeifer wrote: Hi Sandra, On Sat, 10 Nov 2012, Sandra Loosemore wrote: 2012-11-10 Sandra Loosemoresan...@codesourcery.com gcc/ * doc/extend.texi: Copy-edit to fix incorrect hyphenation phrases involving bit, byte, word, precision, and floating modifiers. Index: gcc/doc/extend.texi === -for targets having @code{long long} integer with less then 128 bit width. +for targets having @code{long long} integer less than 128 bits wide. Should this one read long long integer_s_ (plural)? I'd probably rephrase this one as for targets with @code{long long int} less than 128 bits wide. -causes the compiler to pass up to 3 floating point arguments in +causes the compiler to pass up to 3 floating-point arguments in While we are at it, should this be three instead of 3? It would in my native Austrian/German, but perhaps English is different here? I'm not picky about use of digits vs spelled-out numbers as long as parallel constructions use the same thing (e.g., not 3 dogs and four cats). Journalism style guides recommend spelling out numbers less than 10, while technical ones recommend using digits most of the time, but there are all sorts of exceptions in both cases. -Generate code that uses (does not use) the popcount and double -precision FP reciprocal estimate instruction implemented on the POWER5 +Generate code that uses (does not use) the popcount and double-precision +FP reciprocal estimate instruction implemented on the POWER5 Should this one by floating-point instead of FP? And @code{popcount} ? I wouldn't know what the right terminology for these instructions is without looking it up in the architecture manual. Is popcount even the literal name of the instruction? Most of the other items in this list seem to be describing the purpose of the instructions rather than naming them. In general, the GCC manual is not consistent about markup on machine instruction names. I think @code markup is a good choice, but in the same section I see other instructions named as @samp{dlmzb} and ISEL. This is something that's hard to identify with mechanical searching, too. BTW, in my copy-editing I've tried to avoid messing too much with text that's full of technical details or jargon I'm not familiar with, since I might inadvertently change the meaning by attempting to rewrite it. I've spent the time to look up the details and correct terminology for some sections that seemed particularly unreadable, but in cases like this one I thought the text was probably comprehensible as-is to somebody familiar with the processor. I'll be happy to make all those changes, wanted to verify with you as a native speaker, and one who cares about grammar, first though. ;-) Heh, glad to offer what help I can. -Sandra
Re: [PATCH] PR c++/53609 - Wrong argument deduction for pack expansion in argument pack
How about the below? gcc/cp/ * pt.c (argument_pack_element_is_expansion_p) (make_argument_pack_select, use_pack_expansion_extra_args_p) (gen_elem_of_pack_expansion_instantiation): New static functions. (has_bare_parameter_packs): Factorized out of ... (check_for_bare_parameter_packs): ... here. (tsubst): When looking through an ARGUMENT_PACK_SELECT tree node, look through the possibly resulting pack expansion as well. (tsubst_pack_expansion): Use use_pack_expansion_extra_p to generalize when to use the PACK_EXPANSION_EXTRA_ARGS mechanism. Use gen_elem_of_pack_expansion_instantiation to build the instantiation piece-wise. Don't use arg_from_parm_pack_p anymore, as gen_elem_of_pack_expansion_instantiation and the change in tsubst above generalize this particular case. (arg_from_parm_pack_p): Remove this for it's not used by tsubst_pack_expansion anymore. gcc/testsuite/ * g++.dg/cpp0x/variadic139.C: New test. * g++.dg/cpp0x/variadic140.C: Likewise. * g++.dg/cpp0x/variadic141.C: Likewise. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index ecb013e..313f7a4 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -201,7 +201,6 @@ static void append_type_to_template_for_access_check_1 (tree, tree, tree, static tree listify (tree); static tree listify_autos (tree, tree); static tree template_parm_to_arg (tree t); -static bool arg_from_parm_pack_p (tree, tree); static tree current_template_args (void); static tree tsubst_template_parm (tree, tree, tsubst_flags_t); static tree instantiate_alias_template (tree, tree, tsubst_flags_t); @@ -3308,6 +3307,29 @@ make_pack_expansion (tree arg) return result; } +/* Return NULL_TREE iff T contains *NO* unexpanded parameter packs. + Return the TREE_LIST of unexpanded parameter packs otherwise. */ + +static tree +has_bare_parameter_packs (tree t) +{ + tree parameter_packs = NULL_TREE; + struct find_parameter_pack_data ppd; + + if (!processing_template_decl || !t || t == error_mark_node) +return NULL_TREE; + + if (TREE_CODE (t) == TYPE_DECL) +t = TREE_TYPE (t); + + ppd.parameter_packs = parameter_packs; + ppd.visited = pointer_set_create (); + cp_walk_tree (t, find_parameter_packs_r, ppd, ppd.visited); + pointer_set_destroy (ppd.visited); + + return parameter_packs; +} + /* Checks T for any bare parameter packs, which have not yet been expanded, and issues an error if any are found. This operation can only be done on full expressions or types (e.g., an expression @@ -3325,19 +3347,7 @@ make_pack_expansion (tree arg) bool check_for_bare_parameter_packs (tree t) { - tree parameter_packs = NULL_TREE; - struct find_parameter_pack_data ppd; - - if (!processing_template_decl || !t || t == error_mark_node) -return false; - - if (TREE_CODE (t) == TYPE_DECL) -t = TREE_TYPE (t); - - ppd.parameter_packs = parameter_packs; - ppd.visited = pointer_set_create (); - cp_walk_tree (t, find_parameter_packs_r, ppd, ppd.visited); - pointer_set_destroy (ppd.visited); + tree parameter_packs = has_bare_parameter_packs (t); if (parameter_packs) { @@ -3812,42 +3822,6 @@ template_parm_to_arg (tree t) return t; } -/* This function returns TRUE if PARM_PACK is a template parameter - pack and if ARG_PACK is what template_parm_to_arg returned when - passed PARM_PACK. */ - -static bool -arg_from_parm_pack_p (tree arg_pack, tree parm_pack) -{ - /* For clarity in the comments below let's use the representation - argument_packelements' to denote an argument pack and its - elements. - - In the 'if' block below, we want to detect cases where - ARG_PACK is argument_packPARM_PACK I.e, we want to - check if ARG_PACK is an argument pack which sole element is - the expansion of PARM_PACK. That argument pack is typically - created by template_parm_to_arg when passed a parameter - pack. */ - - if (arg_pack - TREE_VEC_LENGTH (ARGUMENT_PACK_ARGS (arg_pack)) == 1 - PACK_EXPANSION_P (TREE_VEC_ELT (ARGUMENT_PACK_ARGS (arg_pack), 0))) -{ - tree expansion = TREE_VEC_ELT (ARGUMENT_PACK_ARGS (arg_pack), 0); - tree pattern = PACK_EXPANSION_PATTERN (expansion); - if ((TYPE_P (pattern) same_type_p (pattern, parm_pack)) - || (!TYPE_P (pattern) cp_tree_equal (parm_pack, pattern))) - /* The argument pack that the parameter maps to is just an - expansion of the parameter itself, such as one would - find in the implicit typedef of a class inside the - class itself. Consider this parameter unsubstituted, - so that we will maintain the outer pack expansion. */ - return true; -} - return false; -} - /* Given a set of template parameters, return them as a set of template arguments. The template parameters are represented as a TREE_VEC, in the form documented in
[Patch, Fortran] PR54818 - Fix ICE with TRANSFER to char
TRANSFER(..., string) created on x86-64 an integer(8) string length; that lead to a tree-checking ICE but also might pass the wrong type in 'call sub(transfer(233, )'. Build and regtested on x86-64-gnu-linux. OK for the trunk? Tobias 2012-12-20 Tobias Burnus bur...@net-b.de PR fortran/54818 * trans-intrinsic.c (gfc_conv_intrinsic_transfer): Ensure that the string length if of type gfc_charlen_type_node. 2012-12-20 Tobias Burnus bur...@net-b.de PR fortran/54818 * gfortran.dg/transfer_intrinsic_4.f: New. diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 4f74c3f..b1e6a2e 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -5662,7 +5662,7 @@ scalar_transfer: gfc_add_expr_to_block (se-pre, tmp); se-expr = tmpdecl; - se-string_length = dest_word_len; + se-string_length = fold_convert (gfc_charlen_type_node, dest_word_len); } else { diff --git a/gcc/testsuite/gfortran.dg/transfer_intrinsic_4.f b/gcc/testsuite/gfortran.dg/transfer_intrinsic_4.f new file mode 100644 index 000..4173afd --- /dev/null +++ b/gcc/testsuite/gfortran.dg/transfer_intrinsic_4.f @@ -0,0 +1,27 @@ +! { dg-do compile } +! +! PR fortran/54818 +! +! Contributed by Scott Pakin +! + subroutine broken ( name1, name2, bmix ) + + implicit none + + integer, parameter :: i_knd = kind( 1 ) + integer, parameter :: r_knd = selected_real_kind( 13 ) + + character(len=8) :: dum + character(len=8) :: blk + real(r_knd), dimension(*) :: bmix, name1, name2 + integer(i_knd) :: j, idx1, n, i + integer(i_knd), external :: nafix + + write (*, 99002) name1(j), + ( adjustl( + transfer(name2(nafix(bmix(idx1+i),1)),dum)//blk + //blk), bmix(idx1+i+1), i = 1, n, 2 ) + +99002 format (' *', 10x, a8, 8x, 3(a24,1pe12.5,',',6x)) + + end subroutine broken
Re: [Patch, Fortran] PR54818 - Fix ICE with TRANSFER to char
Dear Tobias, OK for trunk, apart from: s/the string length if of type gfc_charlen_type_node/the string length is of type gfc_charlen_type_node/ Thanks for the patch Paul On 20 December 2012 00:29, Tobias Burnus bur...@net-b.de wrote: TRANSFER(..., string) created on x86-64 an integer(8) string length; that lead to a tree-checking ICE but also might pass the wrong type in 'call sub(transfer(233, )'. Build and regtested on x86-64-gnu-linux. OK for the trunk? Tobias -- The knack of flying is learning how to throw yourself at the ground and miss. --Hitchhikers Guide to the Galaxy
Re: [google 4.7] atomic update of profile counters (issue6965050)
This looks good to me for google branches. Useful for trunk too. David On Wed, Dec 19, 2012 at 12:08 PM, Rong Xu x...@google.com wrote: Hi, This patch adds the supprot of atomic update the profile counters. Tested with google internal benchmarks and fdo kernel build. Thanks, -Rong 2012-12-19 Rong Xu x...@google.com * gcc/common.opt: Add -fprofile-gen-atomic option. * gcc/gcov-io.h: Add profile atomic update support. * gcc/tree-profile.c (gimple_init_edge_profiler): Ditto. (gimple_gen_edge_profiler): Ditto. * libgcc/libgcov.c (__gcov_one_value_profiler_body): Ditto. (__gcov_one_value_profiler_body_atomic): Ditto. (__gcov_one_value_profiler_atomic): Ditto. (__gcov_indirect_call_profiler_atomic): Ditto. Index: gcc/common.opt === --- gcc/common.opt (revision 194562) +++ gcc/common.opt (working copy) @@ -1754,6 +1754,15 @@ fprofile-dump Common Report Var(flag_profile_dump) Init(0) Optimization Dump CFG profile for comparison. +; fprofile-gen-atomic=0: disable aotimically update. +; fprofile-gen-atomic=1: aotimically update edge profile counters. +; fprofile-gen-atomic=2: aotimically update value profile counters. +; fprofile-gen-atomic=3: aotimically update edge and value profile counters. +; other values will be ignored (fall back to the default of 0). +fprofile-gen-atomic= +Common Joined UInteger Report Var(flag_profile_gen_atomic) Init(0) Optimization +fprofile-gen-atomic=[0..3] Atomically increments for profile counters. + fprofile-generate Common Enable common options for generating profile info for profile feedback directed optimizations Index: gcc/gcov-io.h === --- gcc/gcov-io.h (revision 194562) +++ gcc/gcov-io.h (working copy) @@ -300,6 +300,14 @@ typedef unsigned gcov_type_unsigned __attribute__ #endif /* BITS_PER_UNIT == 8 */ +#if LONG_LONG_TYPE_SIZE 32 +#define GCOV_TYPE_SYNC_FETCH_AND_ADD_FN __sync_fetch_and_add_8 +#define GCOV_TYPE_SYNC_FETCH_AND_ADD BUILT_IN_SYNC_FETCH_AND_ADD_8 +#else +#define GCOV_TYPE_SYNC_FETCH_AND_ADD_FN __sync_fetch_and_add_4 +#define GCOV_TYPE_SYNC_FETCH_AND_ADD BUILT_IN_SYNC_FETCH_AND_ADD_4 +#endif + #undef EXTRACT_MODULE_ID_FROM_GLOBAL_ID #undef EXTRACT_FUNC_ID_FROM_GLOBAL_ID #undef GEN_FUNC_GLOBAL_ID @@ -322,6 +330,18 @@ typedef unsigned gcov_type_unsigned __attribute__ typedef unsigned gcov_unsigned_t; typedef unsigned gcov_position_t; +#if LONG_LONG_TYPE_SIZE 32 +#define GCOV_TYPE_SYNC_FETCH_AND_ADD_FN __sync_fetch_and_add_8 +#define GCOV_TYPE_SYNC_FETCH_AND_ADD BUILT_IN_SYNC_FETCH_AND_ADD_8 +#else +#define GCOV_TYPE_SYNC_FETCH_AND_ADD_FN __sync_fetch_and_add_4 +#define GCOV_TYPE_SYNC_FETCH_AND_ADD BUILT_IN_SYNC_FETCH_AND_ADD_4 +#endif +#define PROFILE_GEN_EDGE_ATOMIC (flag_profile_gen_atomic == 1 || \ + flag_profile_gen_atomic == 3) +#define PROFILE_GEN_VALUE_ATOMIC (flag_profile_gen_atomic == 2 || \ + flag_profile_gen_atomic == 3) + /* gcov_type is typedef'd elsewhere for the compiler */ #if IN_GCOV #define GCOV_LINKAGE static Index: gcc/tree-profile.c === --- gcc/tree-profile.c (revision 194562) +++ gcc/tree-profile.c (working copy) @@ -471,7 +471,12 @@ gimple_init_edge_profiler (void) = build_function_type_list (void_type_node, gcov_type_ptr, gcov_type_node, NULL_TREE); - tree_one_value_profiler_fn + if (PROFILE_GEN_VALUE_ATOMIC) +tree_one_value_profiler_fn + = build_fn_decl (__gcov_one_value_profiler_atomic, +one_value_profiler_fn_type); + else +tree_one_value_profiler_fn = build_fn_decl (__gcov_one_value_profiler, one_value_profiler_fn_type); TREE_NOTHROW (tree_one_value_profiler_fn) = 1; @@ -487,7 +492,12 @@ gimple_init_edge_profiler (void) gcov_type_ptr, gcov_type_node, ptr_void, ptr_void, NULL_TREE); - tree_indirect_call_profiler_fn + if (PROFILE_GEN_VALUE_ATOMIC) +tree_indirect_call_profiler_fn + = build_fn_decl (__gcov_indirect_call_profiler_atomic, +ic_profiler_fn_type); + else +tree_indirect_call_profiler_fn = build_fn_decl (__gcov_indirect_call_profiler, ic_profiler_fn_type); TREE_NOTHROW (tree_indirect_call_profiler_fn) = 1; @@ -563,21 +573,37 @@ gimple_gen_edge_profiler (int edgeno, edge e)
Re: Patch to enable unlimited polymorphism to gfortran
Dear All, Committed as revision 194622 and corrigendum 194626 (removes one test from unlimited_polymorphic_2.f03). Thanks to one and all for the help. Paul On 19 December 2012 07:17, Paul Richard Thomas paul.richard.tho...@gmail.com wrote: Thanks Tobias and Dominique, I'll make the corrections that you have requested. I believe that the 2*(GFC_MAX_SYMBOL_LEN+1) has a historic origin - I had not thought about it until last night, when you pointed it out. As for the segfault - that line should go. The automatic nulling of the _vptr of 'u1', on scope entry, has gone and so its value is indeterminate. same_type_as takes the _vptrs as arguments - hence the segfault. I'll commit tonight unless anybody has any objections. Cheers Paul On 19 December 2012 00:18, Dominique Dhumieres domi...@lps.ens.fr wrote: Dear Paul, With your patch applied on top of a clean revision 194590, the executable for unlimited_polymorphic_1.f03 gives a Segmentation fault - invalid memory reference at Program received signal SIGSEGV, Segmentation fault. 0x00011d1c in MAIN__ () at /opt/gcc/p_work/gcc/testsuite/gfortran.dg/unlimited_polymorphic_1.f03:69 69if (SAME_TYPE_AS (obj1, u1) .neqv. .FALSE.) call abort This segmentation fault disappears if I compile the test with -fsanitize=address, while valgrind gives an endless ==14264== Signal 11 being dropped from thread 0's queue Indeed this is on x86_64-apple-darwin10. TIA Dominique -- The knack of flying is learning how to throw yourself at the ground and miss. --Hitchhikers Guide to the Galaxy -- The knack of flying is learning how to throw yourself at the ground and miss. --Hitchhikers Guide to the Galaxy
Re: [google 4.7] atomic update of profile counters (issue6965050)
On Wed, Dec 19, 2012 at 12:08 PM, Rong Xu x...@google.com wrote: Hi, This patch adds the supprot of atomic update the profile counters. Tested with google internal benchmarks and fdo kernel build. I think you should use the __atomic_ functions instead of __sync_ functions as they allow better performance for simple counters as you can use __ATOMIC_RELAXED. And this would be useful for the trunk also. I was going to implement this exact thing this week but some other important stuff came up. Thanks, Andrew Pinski Thanks, -Rong 2012-12-19 Rong Xu x...@google.com * gcc/common.opt: Add -fprofile-gen-atomic option. * gcc/gcov-io.h: Add profile atomic update support. * gcc/tree-profile.c (gimple_init_edge_profiler): Ditto. (gimple_gen_edge_profiler): Ditto. * libgcc/libgcov.c (__gcov_one_value_profiler_body): Ditto. (__gcov_one_value_profiler_body_atomic): Ditto. (__gcov_one_value_profiler_atomic): Ditto. (__gcov_indirect_call_profiler_atomic): Ditto. Index: gcc/common.opt === --- gcc/common.opt (revision 194562) +++ gcc/common.opt (working copy) @@ -1754,6 +1754,15 @@ fprofile-dump Common Report Var(flag_profile_dump) Init(0) Optimization Dump CFG profile for comparison. +; fprofile-gen-atomic=0: disable aotimically update. +; fprofile-gen-atomic=1: aotimically update edge profile counters. +; fprofile-gen-atomic=2: aotimically update value profile counters. +; fprofile-gen-atomic=3: aotimically update edge and value profile counters. +; other values will be ignored (fall back to the default of 0). +fprofile-gen-atomic= +Common Joined UInteger Report Var(flag_profile_gen_atomic) Init(0) Optimization +fprofile-gen-atomic=[0..3] Atomically increments for profile counters. + fprofile-generate Common Enable common options for generating profile info for profile feedback directed optimizations Index: gcc/gcov-io.h === --- gcc/gcov-io.h (revision 194562) +++ gcc/gcov-io.h (working copy) @@ -300,6 +300,14 @@ typedef unsigned gcov_type_unsigned __attribute__ #endif /* BITS_PER_UNIT == 8 */ +#if LONG_LONG_TYPE_SIZE 32 +#define GCOV_TYPE_SYNC_FETCH_AND_ADD_FN __sync_fetch_and_add_8 +#define GCOV_TYPE_SYNC_FETCH_AND_ADD BUILT_IN_SYNC_FETCH_AND_ADD_8 +#else +#define GCOV_TYPE_SYNC_FETCH_AND_ADD_FN __sync_fetch_and_add_4 +#define GCOV_TYPE_SYNC_FETCH_AND_ADD BUILT_IN_SYNC_FETCH_AND_ADD_4 +#endif + #undef EXTRACT_MODULE_ID_FROM_GLOBAL_ID #undef EXTRACT_FUNC_ID_FROM_GLOBAL_ID #undef GEN_FUNC_GLOBAL_ID @@ -322,6 +330,18 @@ typedef unsigned gcov_type_unsigned __attribute__ typedef unsigned gcov_unsigned_t; typedef unsigned gcov_position_t; +#if LONG_LONG_TYPE_SIZE 32 +#define GCOV_TYPE_SYNC_FETCH_AND_ADD_FN __sync_fetch_and_add_8 +#define GCOV_TYPE_SYNC_FETCH_AND_ADD BUILT_IN_SYNC_FETCH_AND_ADD_8 +#else +#define GCOV_TYPE_SYNC_FETCH_AND_ADD_FN __sync_fetch_and_add_4 +#define GCOV_TYPE_SYNC_FETCH_AND_ADD BUILT_IN_SYNC_FETCH_AND_ADD_4 +#endif +#define PROFILE_GEN_EDGE_ATOMIC (flag_profile_gen_atomic == 1 || \ + flag_profile_gen_atomic == 3) +#define PROFILE_GEN_VALUE_ATOMIC (flag_profile_gen_atomic == 2 || \ + flag_profile_gen_atomic == 3) + /* gcov_type is typedef'd elsewhere for the compiler */ #if IN_GCOV #define GCOV_LINKAGE static Index: gcc/tree-profile.c === --- gcc/tree-profile.c (revision 194562) +++ gcc/tree-profile.c (working copy) @@ -471,7 +471,12 @@ gimple_init_edge_profiler (void) = build_function_type_list (void_type_node, gcov_type_ptr, gcov_type_node, NULL_TREE); - tree_one_value_profiler_fn + if (PROFILE_GEN_VALUE_ATOMIC) +tree_one_value_profiler_fn + = build_fn_decl (__gcov_one_value_profiler_atomic, +one_value_profiler_fn_type); + else +tree_one_value_profiler_fn = build_fn_decl (__gcov_one_value_profiler, one_value_profiler_fn_type); TREE_NOTHROW (tree_one_value_profiler_fn) = 1; @@ -487,7 +492,12 @@ gimple_init_edge_profiler (void) gcov_type_ptr, gcov_type_node, ptr_void, ptr_void, NULL_TREE); - tree_indirect_call_profiler_fn + if (PROFILE_GEN_VALUE_ATOMIC) +tree_indirect_call_profiler_fn + = build_fn_decl (__gcov_indirect_call_profiler_atomic, +ic_profiler_fn_type); + else +tree_indirect_call_profiler_fn
Re: [google 4.7] atomic update of profile counters (issue6965050)
On Wed, Dec 19, 2012 at 4:29 PM, Andrew Pinski pins...@gmail.com wrote: On Wed, Dec 19, 2012 at 12:08 PM, Rong Xu x...@google.com wrote: Hi, This patch adds the supprot of atomic update the profile counters. Tested with google internal benchmarks and fdo kernel build. I think you should use the __atomic_ functions instead of __sync_ functions as they allow better performance for simple counters as you can use __ATOMIC_RELAXED. You are right. I think __ATOMIC_RELAXED should be OK here. Thanks for the suggestion. And this would be useful for the trunk also. I was going to implement this exact thing this week but some other important stuff came up. I'll post trunk patch later. Thanks, Andrew Pinski Thanks, -Rong 2012-12-19 Rong Xu x...@google.com * gcc/common.opt: Add -fprofile-gen-atomic option. * gcc/gcov-io.h: Add profile atomic update support. * gcc/tree-profile.c (gimple_init_edge_profiler): Ditto. (gimple_gen_edge_profiler): Ditto. * libgcc/libgcov.c (__gcov_one_value_profiler_body): Ditto. (__gcov_one_value_profiler_body_atomic): Ditto. (__gcov_one_value_profiler_atomic): Ditto. (__gcov_indirect_call_profiler_atomic): Ditto. Index: gcc/common.opt === --- gcc/common.opt (revision 194562) +++ gcc/common.opt (working copy) @@ -1754,6 +1754,15 @@ fprofile-dump Common Report Var(flag_profile_dump) Init(0) Optimization Dump CFG profile for comparison. +; fprofile-gen-atomic=0: disable aotimically update. +; fprofile-gen-atomic=1: aotimically update edge profile counters. +; fprofile-gen-atomic=2: aotimically update value profile counters. +; fprofile-gen-atomic=3: aotimically update edge and value profile counters. +; other values will be ignored (fall back to the default of 0). +fprofile-gen-atomic= +Common Joined UInteger Report Var(flag_profile_gen_atomic) Init(0) Optimization +fprofile-gen-atomic=[0..3] Atomically increments for profile counters. + fprofile-generate Common Enable common options for generating profile info for profile feedback directed optimizations Index: gcc/gcov-io.h === --- gcc/gcov-io.h (revision 194562) +++ gcc/gcov-io.h (working copy) @@ -300,6 +300,14 @@ typedef unsigned gcov_type_unsigned __attribute__ #endif /* BITS_PER_UNIT == 8 */ +#if LONG_LONG_TYPE_SIZE 32 +#define GCOV_TYPE_SYNC_FETCH_AND_ADD_FN __sync_fetch_and_add_8 +#define GCOV_TYPE_SYNC_FETCH_AND_ADD BUILT_IN_SYNC_FETCH_AND_ADD_8 +#else +#define GCOV_TYPE_SYNC_FETCH_AND_ADD_FN __sync_fetch_and_add_4 +#define GCOV_TYPE_SYNC_FETCH_AND_ADD BUILT_IN_SYNC_FETCH_AND_ADD_4 +#endif + #undef EXTRACT_MODULE_ID_FROM_GLOBAL_ID #undef EXTRACT_FUNC_ID_FROM_GLOBAL_ID #undef GEN_FUNC_GLOBAL_ID @@ -322,6 +330,18 @@ typedef unsigned gcov_type_unsigned __attribute__ typedef unsigned gcov_unsigned_t; typedef unsigned gcov_position_t; +#if LONG_LONG_TYPE_SIZE 32 +#define GCOV_TYPE_SYNC_FETCH_AND_ADD_FN __sync_fetch_and_add_8 +#define GCOV_TYPE_SYNC_FETCH_AND_ADD BUILT_IN_SYNC_FETCH_AND_ADD_8 +#else +#define GCOV_TYPE_SYNC_FETCH_AND_ADD_FN __sync_fetch_and_add_4 +#define GCOV_TYPE_SYNC_FETCH_AND_ADD BUILT_IN_SYNC_FETCH_AND_ADD_4 +#endif +#define PROFILE_GEN_EDGE_ATOMIC (flag_profile_gen_atomic == 1 || \ + flag_profile_gen_atomic == 3) +#define PROFILE_GEN_VALUE_ATOMIC (flag_profile_gen_atomic == 2 || \ + flag_profile_gen_atomic == 3) + /* gcov_type is typedef'd elsewhere for the compiler */ #if IN_GCOV #define GCOV_LINKAGE static Index: gcc/tree-profile.c === --- gcc/tree-profile.c (revision 194562) +++ gcc/tree-profile.c (working copy) @@ -471,7 +471,12 @@ gimple_init_edge_profiler (void) = build_function_type_list (void_type_node, gcov_type_ptr, gcov_type_node, NULL_TREE); - tree_one_value_profiler_fn + if (PROFILE_GEN_VALUE_ATOMIC) +tree_one_value_profiler_fn + = build_fn_decl (__gcov_one_value_profiler_atomic, +one_value_profiler_fn_type); + else +tree_one_value_profiler_fn = build_fn_decl (__gcov_one_value_profiler, one_value_profiler_fn_type); TREE_NOTHROW (tree_one_value_profiler_fn) = 1; @@ -487,7 +492,12 @@ gimple_init_edge_profiler (void) gcov_type_ptr, gcov_type_node, ptr_void, ptr_void, NULL_TREE);
Re: [google 4.7] fdo build for linux kernel (issue 6968046)
The change in gcov-io.h is from a different patch. David https://codereview.appspot.com/6968046/diff/1/gcc/gcov-io.c File gcc/gcov-io.c (right): https://codereview.appspot.com/6968046/diff/1/gcc/gcov-io.c#newcode688 gcc/gcov-io.c:688: Have you compared this with this impl: while (x) { c++; x=(x-1) } return c; https://codereview.appspot.com/6968046/
Re: [PATCH] Fix PR gcov-profile/55734 for bootstrapping with older compilers (issue6980044)
On Wed, Dec 19, 2012 at 01:34:34PM -0800, Teresa Johnson wrote: +#if IN_LIBGCOV + /* When building libgcov we don't include system.h, which includes + hwint.h (where floor_log2 is declared). However, libgcov.a + is built by the bootstrapped compiler and therefore the builtins + are always available. */ + r = 63 - __builtin_clzll (v); Perhaps it would be more portable to use r = sizeof (long long) * __CHAR_BIT__ - 1 - __builtin_clzll (v); here. +#else + /* We use floor_log2 from hwint.c, which takes a HOST_WIDE_INT + that is either 32 or 64 bits, and gcov_type_unsigned may be 64 bits. + Need to check for the case where gcov_type_unsigned is 64 bits + and HOST_WIDE_INT is 32 bits and handle it specially. */ +#if LONG_LONG_TYPE_SIZE = HOST_BITS_PER_WIDE_INT If not in libgcov.a, we have typedef unsigned HOST_WIDEST_INT gcov_type_unsigned; in gcov-io.h. LONG_LONG_TYPE_SIZE is target long long size, you are interested about the size of host gcov_type_unsigned. So perhaps test HOST_BITS_PER_WIDEST_INT instead of LONG_LONG_TYPE_SIZE? + r = floor_log2 (v); +#else +#if LONG_LONG_TYPE_SIZE == 2 * HOST_BITS_PER_WIDE_INT Likewise. Can't you use #elif above and get rid of one of the #endif lines? + HOST_WIDE_INT hwi_v = v HOST_BITS_PER_WIDE_INT; + if (hwi_v) +r = floor_log2 (hwi_v) + HOST_BITS_PER_WIDE_INT; + else +r = floor_log2 ((HOST_WIDE_INT)v); +#else + gcc_unreachable (); +#endif +#endif +#endif +} Jakub
Re: [google 4.7] fdo build for linux kernel (issue 6968046)
On Wed, Dec 19, 2012 at 5:04 PM, davi...@google.com wrote: The change in gcov-io.h is from a different patch. sorry. here is the patch for gcov-io.h: Index: gcov-io.h === --- gcov-io.h (revision 194562) +++ gcov-io.h (working copy) @@ -781,8 +781,8 @@ unused) */ unsigned n_functions;/* number of functions */ - const struct gcov_fn_info *const *functions; /* pointer to pointers - to function information */ + const struct gcov_fn_info **functions; /* pointer to pointers + to function information */ }; /* Information about a single imported module. */ @@ -988,8 +988,7 @@ GCOV_LINKAGE void gcov_seek (gcov_position_t /*position*/) ATTRIBUTE_HIDDEN; GCOV_LINKAGE void gcov_truncate (void) ATTRIBUTE_HIDDEN; GCOV_LINKAGE gcov_unsigned_t gcov_string_length (const char *) ATTRIBUTE_HIDDEN; -GCOV_LINKAGE unsigned gcov_gcda_file_size (struct gcov_info *, - struct gcov_summary *); +GCOV_LINKAGE unsigned gcov_gcda_file_size (struct gcov_info *); #else /* Available outside libgcov */ GCOV_LINKAGE void gcov_sync (gcov_position_t /*base*/, David https://codereview.appspot.com/6968046/diff/1/gcc/gcov-io.c File gcc/gcov-io.c (right): https://codereview.appspot.com/6968046/diff/1/gcc/gcov-io.c#newcode688 gcc/gcov-io.c:688: Have you compared this with this impl: while (x) { c++; x=(x-1) } return c; I did not try this pimplier version. I can do a test on the dump speed and report back. https://codereview.appspot.com/6968046/
Re: Follow-up to PR bootstrap/54820
Two test cases, debug_msg_so.err and debug_msg_ndebug.err, are still broken by the original patch, because (a) debug_msg.so has a DT_NEEDED entry for libstdc++.so, (b) the use of -static-libstdc++ means that that DT_NEEDED entry is unknown when we link the executable, and (c) the undefined symbols in debug_msg.so will not be printed. The obvious solution would be to add an option to cancel -static-libstdc++, but there doesn't seem to be one. (There is a -shared-libgcc option, but no -shared-libstdc++.) I've tested two alternatives that work: (1) Force the issue by explicitly adding -Bdynamic -lstdc++ to the link flags for debug_msg_so and debug_msg_ndebug. (2) Remove the DT_NEEDED entry from debug_msg.so by linking it with -static-libstdc++ also. Which one seems preferable? Any better ideas? -cary On Tue, Oct 23, 2012 at 2:54 PM, Ian Lance Taylor i...@google.com wrote: On Tue, Oct 23, 2012 at 2:11 PM, Eric Botcazou ebotca...@adacore.com wrote: 2012-10-23 Eric Botcazou ebotca...@adacore.com PR bootstrap/54820 * configure.ac (have_static_libs): Force 'no' for GCC version 4.5. * configure: Regenerate. This is OK. Thanks. Ian
Re: [patch] fix multiarch definition for powerpcspe-linux-gnu
On Wed, Dec 19, 2012 at 11:47 AM, Matthias Klose d...@ubuntu.com wrote: The definition of the multiarch tuple for powerpcspe-linux-gnu was wrong. The t-spe fragment isn't included for the powerpc*-linux* case, so move it to t-linux, and use tm_file_list (tm_file is only used in config.gcc). Ok for the trunk? Okay. Thanks, David
Re: Follow-up to PR bootstrap/54820
On Wed, Dec 19, 2012 at 6:13 PM, Cary Coutant ccout...@google.com wrote: Two test cases, debug_msg_so.err and debug_msg_ndebug.err, are still broken by the original patch, because (a) debug_msg.so has a DT_NEEDED entry for libstdc++.so, (b) the use of -static-libstdc++ means that that DT_NEEDED entry is unknown when we link the executable, and (c) the undefined symbols in debug_msg.so will not be printed. The obvious solution would be to add an option to cancel -static-libstdc++, but there doesn't seem to be one. (There is a -shared-libgcc option, but no -shared-libstdc++.) I've tested two alternatives that work: (1) Force the issue by explicitly adding -Bdynamic -lstdc++ to the link flags for debug_msg_so and debug_msg_ndebug. (2) Remove the DT_NEEDED entry from debug_msg.so by linking it with -static-libstdc++ also. Which one seems preferable? Any better ideas? Adding -Bdynamic seems fine to me. And I guess GCC should have a -shared-libstdc++ option. Ian
[PATCH][ARM][thumb1] Reduce lr save for leaf function with non-far jump
Current GCC thumb1 has an annoying problem that always assuming far branch. So it forces to save lr, even when unnecessarily. The most extreme case complained by partner is: // compiled with -mthumb -mcpu=cortex-m0 -Os. void foo() { for (;;); } = foo: push{lr} // Crazy!!! .L2: b .L2 The reason is that thumb1 far jump is only resolved in the very late pass shorten_branch. Prologue/epilogue pass doesn't actually know a branch is far or not from its attribute. It has to conservatively save/restore lr whenever there is a branch. This patch tries to fix it with a simple heuristic, i.e., using function size to decide if a far jump will likely be used. Function size information is meaningful in prologue/epilogue pass. The heuristic uses following check to decide if lr should be saved for far jump: function_size * 3 = 2048 // yes: save lr for possible far jump. No: don't save lr for far jump The scheme has an issue: if some corner case does break above condition, there is no chance to fix-up but to ICE. But the heuristic condition is very conservative. It is base on the worse normal condition that each instruction is associated with a 4 byte literal ( (2+4)/2=3, blooming size by 3 times ). I can't think of a real case to trigger the ICE. So I think it should work. Other approaches than the heuristic scheme are too expensive to implement for this small size/performance issue. I did explored some but none of them persuaded myself. Tests passed: * build libgcc, libstdc++, newlib, libm * make check-gcc with cpu=cortex-m0 * Small and extreme test cases diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 327ef22..ad79451 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -21790,6 +21857,11 @@ thumb1_final_prescan_insn (rtx insn) else if (conds != CONDS_NOCOND) cfun-machine-thumb1_cc_insn = NULL_RTX; } + +/* Check if unexpected far jump is used. */ +if (cfun-machine-lr_save_eliminated + get_attr_far_jump (insn) == FAR_JUMP_YES) + internal_error(Unexpected thumb1 far jump); } int @@ -21815,6 +21887,8 @@ static int thumb_far_jump_used_p (void) { rtx insn; + bool far_jump = false; + unsigned int func_size = 0; /* This test is only important for leaf functions. */ /* assert (!leaf_function_p ()); */ @@ -21870,6 +21944,26 @@ thumb_far_jump_used_p (void) get_attr_far_jump (insn) == FAR_JUMP_YES ) { + far_jump = true; + } + func_size += get_attr_length (insn); +} + + /* Attribute far_jump will always be true for thumb1 before shorten_branch + pass. So checking far_jump attribute before shorten_branch isn't much + useful. + + Following heuristic tries to estimate more accruately if a far jump may + finally be used. The heuristic is very conservative as there is no chance + to roll-back the decision of not to use far jump. + + Thumb1 long branch offset is -2048 to 2046. The worst case is each 2-byte + insn is assiociated with a 4 byte constant pool. Using function size + 2048/3 as the threshold is conservative enough. */ + if (far_jump) +{ + if ((func_size * 3) = 2048) +{ /* Record the fact that we have decided that the function does use far jumps. */ cfun-machine-far_jump_used = 1;