Re: [Patch, ARM] Enable libsanitizer
+euge...@google.com Hi Christophe, On Thu, Mar 28, 2013 at 2:09 AM, Christophe Lyon christophe.l...@linaro.org wrote: Hi, This small patch enables libsanitizer on ARM. It has been tested successfully on cortex-a9 hardware (via the GCC testsuite). I have chosen to bundle -funwind-table with -fsanitize=* so that a useful backtrace can be printed to the user in case of error, otherwise the reporting is limited to one line belonging to libsanitizer.so. Note that the testsuite currently fails when executing under qemu: - support of /proc/self/maps does not conform to the kernel format. One extra space is missing from some lines, which confuses libsanitizer. Patch proposed to upstream qemu: http://lists.gnu.org/archive/html/qemu-devel/2013-02/msg03051.html As we discussed in https://code.google.com/p/address-sanitizer/issues/detail?id=160 this may be fixed in libsanitizer, although i'd still prefer the qemu fix. - qemu reserves some memory space by default, conflicting with libsanitizer needs. Workaround: invoke qemu with -R 0 Good to know! - libsanitizer detects if its output is a tty, and when GCC testsuite is executed under qemu, libsanitizer concludes that it is actually running under a tty, and adds beautyfying characters which confuse dejanu. Is this again a quemu problem? Or should we do some more checks before emitting color codes? A comment about this patch and a question to Evgeniy: on Android/ARM we use zero shadow offset. (code.google.com/p/address-sanitizer/wiki/ZeroBasedShadow) Can we do it on other ARM targets too? --kcc OK? Christophe. 2013-03-27 Christophe Lyon christophe.l...@linaro.org gcc/ * config/arm/arm.c (arm_asan_shadow_offset): New function. (TARGET_ASAN_SHADOW_OFFSET): Define. * config/arm/linux-eabi.h (ASAN_CC1_SPEC): Define. (LINUX_OR_ANDROID_CC): Add ASAN_CC1_SPEC. libsanitizer/ * configure.tgt: Add ARM pattern.
Re: [Patch, ARM] Enable libsanitizer
On Thu, Mar 28, 2013 at 11:36 AM, Konstantin Serebryany konstantin.s.serebry...@gmail.com wrote: +euge...@google.com Hi Christophe, On Thu, Mar 28, 2013 at 2:09 AM, Christophe Lyon christophe.l...@linaro.org wrote: Hi, This small patch enables libsanitizer on ARM. It has been tested successfully on cortex-a9 hardware (via the GCC testsuite). I have chosen to bundle -funwind-table with -fsanitize=* so that a useful backtrace can be printed to the user in case of error, otherwise the reporting is limited to one line belonging to libsanitizer.so. Note that the testsuite currently fails when executing under qemu: - support of /proc/self/maps does not conform to the kernel format. One extra space is missing from some lines, which confuses libsanitizer. Patch proposed to upstream qemu: http://lists.gnu.org/archive/html/qemu-devel/2013-02/msg03051.html As we discussed in https://code.google.com/p/address-sanitizer/issues/detail?id=160 this may be fixed in libsanitizer, although i'd still prefer the qemu fix. - qemu reserves some memory space by default, conflicting with libsanitizer needs. Workaround: invoke qemu with -R 0 Good to know! - libsanitizer detects if its output is a tty, and when GCC testsuite is executed under qemu, libsanitizer concludes that it is actually running under a tty, and adds beautyfying characters which confuse dejanu. Is this again a quemu problem? Or should we do some more checks before emitting color codes? A comment about this patch and a question to Evgeniy: on Android/ARM we use zero shadow offset. (code.google.com/p/address-sanitizer/wiki/ZeroBasedShadow) Can we do it on other ARM targets too? We do it because newer versions of Android use PIE binaries, and, combined with other specifics of address space on Linux/ARM, there is no space for ASan shadow anywhere else. And it's faster. Zero-based shadow requires PIE. Non-zero-based requires non-PIE on Android. Is it the same with QEMU? If so, we should switch to zero-based for uniformity and performance. --kcc OK? Christophe. 2013-03-27 Christophe Lyon christophe.l...@linaro.org gcc/ * config/arm/arm.c (arm_asan_shadow_offset): New function. (TARGET_ASAN_SHADOW_OFFSET): Define. * config/arm/linux-eabi.h (ASAN_CC1_SPEC): Define. (LINUX_OR_ANDROID_CC): Add ASAN_CC1_SPEC. libsanitizer/ * configure.tgt: Add ARM pattern.
Re: [Patch, ARM] Enable libsanitizer
On Thu, Mar 28, 2013 at 12:00:23PM +0400, Evgeniy Stepanov wrote: We do it because newer versions of Android use PIE binaries, and, combined with other specifics of address space on Linux/ARM, there is no space for ASan shadow anywhere else. And it's faster. Zero-based shadow requires PIE. Non-zero-based requires non-PIE on Android. Is it the same with QEMU? If so, we should switch to zero-based for uniformity and performance. I don't think most of the arm-linux-gnueabi binaries are PIEs, so using zero shadow offset would be wrong on Linux. If 1 29 works (e.g. prelink library area on linux-arm is 0x4100 .. 0x5000, so shadow of 0x2000 .. 0x3fff is fine for that), IMHO we should use it. Jakub
Re: [PATCH] Fix PR56695 + adjust verify_gimple_comparison
On Wed, 27 Mar 2013, Marek Polacek wrote: This fixes PR56695 where we ICEd because expand_vec_cond_expr doesn't expect that the result of a vector comparison is of TYPE_UNSIGNED type. So we unconditionally build a signed type now. We know that the result of vec comparison is e.g. { -1, 0, -1} and that all elements have to be SI types. This patch does one more thing - in verify_gimple_comparison we now explicitly check whether the result of a vec comparison is signed. Regtested/bootstrapped on x86_64-unknown-linux-gnu, ok for trunk? Ok. Thanks, Richard. 2013-03-27 Marek Polacek pola...@redhat.com Richard Biener rguent...@suse.de PR tree-optimization/56695 * tree-vect-stmts.c (vectorizable_condition): Unconditionally build signed result of a vector comparison. * tree-cfg.c (verify_gimple_comparison): Check that a result of a vector comparison has signed type. * gcc.dg/vect/pr56695.c: New test. --- gcc/tree-vect-stmts.c.mp 2013-03-27 15:19:43.928738801 +0100 +++ gcc/tree-vect-stmts.c 2013-03-27 15:20:12.485832946 +0100 @@ -5265,7 +5265,7 @@ vectorizable_condition (gimple stmt, gim vectree vec_oprnds1 = vNULL; vectree vec_oprnds2 = vNULL; vectree vec_oprnds3 = vNULL; - tree vec_cmp_type = vectype; + tree vec_cmp_type; if (slp_node || PURE_SLP_STMT (stmt_info)) ncopies = 1; @@ -5338,14 +5338,12 @@ vectorizable_condition (gimple stmt, gim TREE_CODE (else_clause) != FIXED_CST) return false; - if (!INTEGRAL_TYPE_P (TREE_TYPE (vectype))) -{ - unsigned int prec = GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (vectype))); - tree cmp_type = build_nonstandard_integer_type (prec, 1); - vec_cmp_type = get_same_sized_vectype (cmp_type, vectype); - if (vec_cmp_type == NULL_TREE) - return false; -} + unsigned int prec = GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (vectype))); + /* The result of a vector comparison should be signed type. */ + tree cmp_type = build_nonstandard_integer_type (prec, 0); + vec_cmp_type = get_same_sized_vectype (cmp_type, vectype); + if (vec_cmp_type == NULL_TREE) +return false; if (!vec_stmt) { --- gcc/tree-cfg.c.mp 2013-03-27 15:19:59.144788303 +0100 +++ gcc/tree-cfg.c2013-03-27 15:20:12.475832906 +0100 @@ -3191,7 +3191,10 @@ verify_gimple_comparison (tree type, tre if (TYPE_VECTOR_SUBPARTS (type) != TYPE_VECTOR_SUBPARTS (op0_type) || (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (type))) - != GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (op0_type) + != GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (op0_type + /* The result of a vector comparison is of signed + integral type. */ + || TYPE_UNSIGNED (TREE_TYPE (type))) { error (invalid vector comparison resulting type); debug_generic_expr (type); --- gcc/testsuite/gcc.dg/vect/pr56695.c.mp2013-03-27 15:19:06.901618407 +0100 +++ gcc/testsuite/gcc.dg/vect/pr56695.c 2013-03-27 15:19:00.13259 +0100 @@ -0,0 +1,14 @@ +/* PR tree-optimization/56695 */ +/* { dg-do compile } */ +/* { dg-options -O2 -ftree-vectorize } */ + +int a, b, i; + +void +f (void) +{ + for (i = 0; i 8; ++i) +a |= !(i |= b %= 1); +} + +/* { dg-final { cleanup-tree-dump vect } } */ Marek -- Richard Biener rguent...@suse.de SUSE / SUSE Labs SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 GF: Jeff Hawn, Jennifer Guild, Felix Imend
Re: [patch] Unified debug dump function names.
On Wed, Mar 27, 2013 at 5:15 PM, Lawrence Crowl cr...@googlers.com wrote: On 3/27/13, Richard Biener richard.guent...@gmail.com wrote: On Mar 27, 2013, Lawrence Crowl cr...@googlers.com wrote: Patch with rename to debug attached. Tested on x86_64. Add uniform debug dump function names. Add some overloaded functions that provide uniform debug dump function names. These names are: debug: the general debug dumper debug_verbose: for more details debug_raw: for the gory details debug_head: for the heads of declarations, e.g. function heads debug_body: for the bodies of declarations, e.g. function bodies Not all types have the last four versions. The debug functions come in two flavors, those that take pointers to the type, and those that take references to the type. The first handles printing of 'nil' for null pointers. The second assumes a valid reference, and prints the content. Example uses are as follows: cp_token t, *p; debug (t); debug (p); From the debugger, use call debug (t) The functions sets implemented are: debug (only) basic_block_def, const bitmap_head_def, cp_binding_level, cp_parser, cp_token, data_reference, die_struct, edge_def, gimple_statement_d, ira_allocno, ira_allocno_copy, live_range, lra_live_range, omega_pb_d, pt_solution, const rtx_def, sreal, tree_live_info_d, _var_map, veccp_token, va_gc, vecdata_reference_p, vecddr_p, vecrtx, vectree, va_gc, debug and debug_raw simple_bitmap_def debug and debug_verbose expr_def, struct loop, vinsn_def debug, debug_raw, debug_verbose, debug_head, debug_body const tree_node This patch is somewhat different from the original plan at gcc.gnu.org/wiki/cxx-conversion/debugging-dumps. The reason is that gdb has an incomplete implementation of C++ call syntax; requiring explicit specification of template arguments and explicit specification of function arguments even when they have default values. So, the original plan would have required typing call dump cp_token (t, 0, 0, stderr) which is undesireable. Instead instead of templates, we overload plain functions. This adds a small burden of manually adding the pointer version of dump for each type. Instead of default function arguments, we simply assume the default values. Most of the underlying dump functions did not use the options and indent parameters anyway. Several provide FILE* parameters, but we expect debugging to use stderr anyway. So, the explicit specification of arguments was not as valuable as we thought initially. Note that generally modules should provide a print_FOO (FILE *, FOO *...) interface which should be the worker for the dump_* interface which prints to dumpfiles (and stdout/stderr with -fopt-info) and the debug_* interface (which just prints to stderr). I'm not sure what you're saying here. I haven't been adding new underlying functionality. If there are missing print_FOO functions, shouldn't they be a separate work item? Sure. I just wanted to mention naming / semantics convention where you mentioned FILE parameters. Finally, a change of name from dump to debug reflect the implicit output to stderr. A few more questions. As we are now using C++ and these functions are not called by GCC itself - do we really need all the extern declarations in the header files? We don't have -Wstrict-prototypes issues with C++ and I do not consider the debug () interface part of the public API of a module. This avoids people ending up calling debug () from inside GCC. We don't need the extern declarations for gdb, but I've written temporary calls to debug into the source code while I was developing. It would be handy to not have to add declarations simultaneously. Your call. Ah, I see. I have no strong preference here. + if (ptr) +debug (*ptr); + else +fprintf (stderr, nil\n); can we avoid repeating this using a common helper? I'd use a simple #define like #define DO_DEBUG_PTR(p) do { if (p) debug (*(p)) else fprintf (stderr, nil\n); } while (0) but I suppose you can come up with something more clever using C++? I had a template that did this for us in my earlier code. I removed the template when I discovered the gdb issue. One advantage to removing the template was that I no longer needed a common header and its inclusion in various files. Adding the macro would reintroduce the header. My personal preference is to avoid the macros and just live with the repeated pattern. Ok, fine with me - I just wanted to double-check. The patch is ok as-is. Richard. -- Lawrence Crowl
Re: [patch] Fix node weight updates during ipa-cp (issue7812053)
On Wed, Mar 27, 2013 at 6:22 PM, Teresa Johnson tejohn...@google.com wrote: I found that the node weight updates on cloned nodes during ipa-cp were leading to incorrect/insane weights. Both the original and new node weight computations used truncating divides, leading to a loss of total node weight. I have fixed this by making both rounding integer divides. Bootstrapped and tested on x86-64-unknown-linux-gnu. Ok for trunk? I'm sure we can outline a rounding integer divide inline function on gcov_type. To gcov-io.h, I suppose. Otherwise this looks ok to me. Thanks, Richard. 2013-03-27 Teresa Johnson tejohn...@google.com * ipa-cp.c (update_profiling_info): Perform rounding integer division when updating weights instead of truncating. (update_specialized_profile): Ditto. Index: ipa-cp.c === --- ipa-cp.c(revision 197118) +++ ipa-cp.c(working copy) @@ -2588,14 +2588,18 @@ update_profiling_info (struct cgraph_node *orig_no for (cs = new_node-callees; cs ; cs = cs-next_callee) if (cs-frequency) - cs-count = cs-count * (new_sum * REG_BR_PROB_BASE - / orig_node_count) / REG_BR_PROB_BASE; + cs-count = (cs-count + * ((new_sum * REG_BR_PROB_BASE + orig_node_count/2) + / orig_node_count) + + REG_BR_PROB_BASE/2) / REG_BR_PROB_BASE; else cs-count = 0; for (cs = orig_node-callees; cs ; cs = cs-next_callee) -cs-count = cs-count * (remainder * REG_BR_PROB_BASE -/ orig_node_count) / REG_BR_PROB_BASE; +cs-count = (cs-count + * ((remainder * REG_BR_PROB_BASE + orig_node_count/2) +/ orig_node_count) + + REG_BR_PROB_BASE/2) / REG_BR_PROB_BASE; if (dump_file) dump_profile_updates (orig_node, new_node); @@ -2627,14 +2631,19 @@ update_specialized_profile (struct cgraph_node *ne for (cs = new_node-callees; cs ; cs = cs-next_callee) if (cs-frequency) - cs-count += cs-count * redirected_sum / new_node_count; + cs-count += (cs-count +* ((redirected_sum * REG_BR_PROB_BASE ++ new_node_count/2) / new_node_count) ++ REG_BR_PROB_BASE/2) / REG_BR_PROB_BASE; else cs-count = 0; for (cs = orig_node-callees; cs ; cs = cs-next_callee) { - gcov_type dec = cs-count * (redirected_sum * REG_BR_PROB_BASE - / orig_node_count) / REG_BR_PROB_BASE; + gcov_type dec = (cs-count + * ((redirected_sum * REG_BR_PROB_BASE + + orig_node_count/2) / orig_node_count) + + REG_BR_PROB_BASE/2) / REG_BR_PROB_BASE; if (dec cs-count) cs-count -= dec; else -- This patch is available for review at http://codereview.appspot.com/7812053
Re: [patch] Use JUMP_TABLE_DATA_P instead of JUMP_P and GET_CODE tests
On Thu, Mar 28, 2013 at 12:16 AM, Steven Bosscher stevenb@gmail.com wrote: *Ping* Ok. Thanks, Richard. On Sat, Mar 23, 2013 at 5:15 PM, Steven Bosscher wrote: Hello, This patch replaces all tests I could find, where the code is looking for jump table data with GET_CODE(..)=ADDR_VEC and similar with JUMP_TABLE_DATA_P tests. Most replacements are mechanical, but a few are not: * The code in s390.c looked odd, I think the replacement code is easier to follow. * The changed in bfin.c and a few other places assume that ADDR_VEC and ADDR_DIFF_VEC can only appear as tablejump data. This appears to be assumed in many other places in the compiler (although AFAICT it's not documented as such) and it looks like the authors of the changed code simply omitted the JUMP_P test before looking at the pattern for an ADDR_VEC/ADDR_DIFF_VEC. BTW if ADDR_VEC/ADDR_DIFF_VEC really only appear in JUMP_TABLE_DATA_P insns then tests for these codes can be removed in all places where the insn being looked at must be in a basic block. That's almost all places in the middle-end proper (especially as case labels) and I intend to clean that up in a follow-up patch. But first... Bootstrappedtested on powerpc64-unknown-linux-gnu and on ia64-unknown-linux-gnu. OK for trunk? Ciao! Steven
Re: [patch] Hash table changes from cxx-conversion branch
On Wed, Mar 27, 2013 at 5:44 PM, Lawrence Crowl cr...@googlers.com wrote: On 3/27/13, Richard Biener richard.guent...@gmail.com wrote: On Mar 23, 2013 Lawrence Crowl cr...@googlers.com wrote: This patch is a consolodation of the hash_table patches to the cxx-conversion branch. Update various hash tables from htab_t to hash_table. Modify types and calls to match. Ugh. Can you split it up somewhat ... like split target bits away at least? Targets may prefer to keep the old hashes for ease of branch maintainance. I will do that. * tree-ssa-live.c'var_map_base_init::tree_to_index New struct tree_int_map_hasher. I think this wants to be generalized - we have the common tree_map/tree_decl_map and tree_int_map maps in tree.h - those (and its users) should be tackled in a separate patch by providing common hashtable trails implementations. I will investigate for a separate patch. Remove unused: htab_t scop::original_pddrs SCOP_ORIGINAL_PDDRS Remove unused: insert_loop_close_phis insert_guard_phis debug_ivtype_map ivtype_map_elt_info new_ivtype_map_elt Unused function/type removal are obvious changes. Remove unused: dse.c bitmap clear_alias_sets dse.c bitmap disqualified_clear_alias_sets dse.c alloc_pool clear_alias_mode_pool dse.c dse_step2_spill dse.c dse_step5_spill graphds.h htab_t graph::indices See above. It wasn't obvious that the functions could be removed. :-) Are you saying you don't want these notations in the description? No, I was saying that removal of unused functions / types should be committed separately and do not need approval as they are obvious. If they are not obvious (I didn't look at that patch part), then posting separately still helps ;) Thanks, Richard. -- Lawrence Crowl
[Patch, Fortran] PR56737 - Fixing a bug in the I/O format cache handling
libgfortran parses the format string for formatted I/O and saves it in an internal representation. To speed up the I/O - for instance in a loop -, caching is used. However, a pointer to format string is used for the processing of strings (normal string constants and Hollerith). That works well if the format string is a constant as then the pointer won't change between invocations. It often also works when the string is stack-allocated if either the character variable on the stack is never freed (for the same format string) - or multiple calls to the same format lead to the same stack location. (In general, the same stack location is unlikely but in typical I/O calls that's often the case. And static string constants are the rule.) The bug dates back to the first caching implementation in GCC 4.5. There are two possibilities: a) To disable caching when a string (FMT_A or FMT_H) is in the format string. b) To copy the format string The attached patch does the latter. The current hashing algorithm avoids hash collisions by checking whether the value is exactly the same - and the value is given by the format string. Thus, instead of copying the string when storing the format in the cache, the patch copies it now before calling parse_format_list. Bootstrapped and regtested on x86-64-gnu-linux. OK for the trunk and the 4.6/4.7/4.8 branches? Tobias 2013-03-28 Tobias Burnus bur...@net-b.de PR fortran/56737 * io/format.c (parse_format): With caching, copy dtp-format string. (save_parsed_format): Use dtp-format directy without copying. 2013-03-28 Tobias Burnus bur...@net-b.de PR fortran/56737 * testsuite/gfortran.dg/fmt_cache_3.f90: New. diff --git a/gcc/testsuite/gfortran.dg/fmt_cache_3.f90 b/gcc/testsuite/gfortran.dg/fmt_cache_3.f90 new file mode 100644 index 000..ec8e1b3 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/fmt_cache_3.f90 @@ -0,0 +1,80 @@ +! { dg-do run } +! +! PR fortran/56737 +! +! Contributed by Jonathan Hogg +! +module hsl_mc73_single + implicit none + integer, parameter, private :: wp = kind(0.0) +contains + subroutine mc73_fiedler(n,lirn,irn,ip,list) + integer, intent (in) :: n + integer, intent (in) :: lirn + integer, intent (in) :: irn(*) + integer, intent (in) :: ip(*) + integer, intent (out) :: list(*) + + integer :: icntl(10) + + call fiedler_graph(icntl) + end subroutine mc73_fiedler + + subroutine mc73_order + integer :: icntl(10) + + call fiedler_graph(icntl) + end subroutine mc73_order + + subroutine fiedler_graph(icntl) + integer, intent (in) :: icntl(10) + + real (kind = wp) :: tol + real (kind = wp) :: tol1 + real (kind = wp) :: rtol + + call multilevel_eig(tol,tol1,rtol,icntl) + end subroutine fiedler_graph + + subroutine multilevel_eig(tol,tol1,rtol,icntl) + real (kind = wp), intent (in) :: tol,tol1,rtol + integer, intent(in) :: icntl(10) + + call level_print(6,'end of level ',1) + end subroutine multilevel_eig + + subroutine level_print(mp,title1,level) + character (len = *), intent(in) :: title1 + integer, intent(in) :: mp,level + character(len=80) fmt + integer :: char_len1,char_len2 + + char_len1=len_trim(title1) + + write (fmt,('(',i4,'(1H ),6h= ,a',i4,',i4,6h =)')) + level*3, char_len1 +! print *, fmt = , fmt +! print *, title1= , title1 +! print *, level = , level + write (66,fmt) title1,level + end subroutine level_print +end module hsl_mc73_single + +program test + use hsl_mc73_single + implicit none + character(len=200) :: str(2) + integer, parameter :: wp = kind(0.0) + + integer :: n, lirn + integer :: irn(1), ip(1), list(1) + + str = + open (66, status='scratch') + call mc73_order + call mc73_fiedler(n,lirn,irn,ip,list) + rewind (66) + read (66, '(a)') str + close (66) + if (any (str /== end of level 1 =)) call abort() +end program test diff --git a/libgfortran/io/format.c b/libgfortran/io/format.c index c64596b..db95e49 100644 --- a/libgfortran/io/format.c +++ b/libgfortran/io/format.c @@ -148,8 +148,7 @@ save_parsed_format (st_parameter_dt *dtp) u-format_hash_table[hash].hashed_fmt = NULL; free (u-format_hash_table[hash].key); - u-format_hash_table[hash].key = xmalloc (dtp-format_len); - memcpy (u-format_hash_table[hash].key, dtp-format, dtp-format_len); + u-format_hash_table[hash].key = dtp-format; u-format_hash_table[hash].key_len = dtp-format_len; u-format_hash_table[hash].hashed_fmt = dtp-u.p.fmt; @@ -1223,6 +1222,13 @@ parse_format (st_parameter_dt *dtp) /* Not found so proceed as follows. */ + if (format_cache_ok) +{ + char *fmt_string = xmalloc (dtp-format_len); + memcpy (fmt_string, dtp-format, dtp-format_len); + dtp-format = fmt_string; +} + dtp-u.p.fmt = fmt = xmalloc (sizeof (format_data)); fmt-format_string = dtp-format;
Re: [Patch, Fortran] PR56737 - Fixing a bug in the I/O format cache handling
Tobias Burnus wrote: b) To copy the format string The attached patch does the latter. The current hashing algorithm avoids hash collisions by checking whether the value is exactly the same - and the value is given by the format string. Thus, instead of copying the string when storing the format in the cache, the patch copies it now before calling parse_format_list. Re-reading what Jerry wrote, I realized that the current code disables format caching for strings (but not for Holleriths). With my patch, that's no longer required. Attached is a missed-optimization patch. Bootstrapped and regtested on x86-64-gnu-linux. OK for the trunk and the 4.6/4.7/4.8 branches? (Or should the follow-up patch only applied to the trunk?) BTW: Without the follow up patch, the following is a memory leak as parse_format_list might set format_cache_ok to false: if (fmt-error) { format_error (dtp, NULL, fmt-error); + if (format_cache_ok) + free (dtp-format); Thus, if the follow-up patch is not backported, it should be changed to !is_internal_unit (dtp), which is the initial condition for format_cache_ok. Tobias 2012-03-28 Tobias Burnus bur...@net-b.de PR fortran/56737 * io/format.c (parse_format_list): Also cache FMT_STRING. (parse_format): Update call. diff --git a/libgfortran/io/format.c b/libgfortran/io/format.c index db95e49..d5a3548 100644 --- a/libgfortran/io/format.c +++ b/libgfortran/io/format.c @@ -586,16 +586,15 @@ format_lex (format_data *fmt) * parenthesis node which contains the rest of the list. */ static fnode * -parse_format_list (st_parameter_dt *dtp, bool *save_ok, bool *seen_dd) +parse_format_list (st_parameter_dt *dtp, bool *seen_dd) { fnode *head, *tail; format_token t, u, t2; int repeat; format_data *fmt = dtp-u.p.fmt; - bool saveit, seen_data_desc = false; + bool seen_data_desc = false; head = tail = NULL; - saveit = *save_ok; /* Get the next format item */ format_item: @@ -612,7 +611,7 @@ parse_format_list (st_parameter_dt *dtp, bool *save_ok, bool *seen_dd) } get_fnode (fmt, head, tail, FMT_LPAREN); tail-repeat = -2; /* Signifies unlimited format. */ - tail-u.child = parse_format_list (dtp, saveit, seen_data_desc); + tail-u.child = parse_format_list (dtp, seen_data_desc); if (fmt-error != NULL) goto finished; if (!seen_data_desc) @@ -631,7 +630,7 @@ parse_format_list (st_parameter_dt *dtp, bool *save_ok, bool *seen_dd) case FMT_LPAREN: get_fnode (fmt, head, tail, FMT_LPAREN); tail-repeat = repeat; - tail-u.child = parse_format_list (dtp, saveit, seen_data_desc); + tail-u.child = parse_format_list (dtp, seen_data_desc); *seen_dd = seen_data_desc; if (fmt-error != NULL) goto finished; @@ -659,7 +658,7 @@ parse_format_list (st_parameter_dt *dtp, bool *save_ok, bool *seen_dd) case FMT_LPAREN: get_fnode (fmt, head, tail, FMT_LPAREN); tail-repeat = 1; - tail-u.child = parse_format_list (dtp, saveit, seen_data_desc); + tail-u.child = parse_format_list (dtp, seen_data_desc); *seen_dd = seen_data_desc; if (fmt-error != NULL) goto finished; @@ -723,8 +722,6 @@ parse_format_list (st_parameter_dt *dtp, bool *save_ok, bool *seen_dd) goto between_desc; case FMT_STRING: - /* TODO: Find out why it is necessary to turn off format caching. */ - saveit = false; get_fnode (fmt, head, tail, FMT_STRING); tail-u.string.p = fmt-string; tail-u.string.length = fmt-value; @@ -1104,8 +1101,6 @@ parse_format_list (st_parameter_dt *dtp, bool *save_ok, bool *seen_dd) finished: - *save_ok = saveit; - return head; } @@ -1255,8 +1250,7 @@ parse_format (st_parameter_dt *dtp) fmt-avail++; if (format_lex (fmt) == FMT_LPAREN) -fmt-array.array[0].u.child = parse_format_list (dtp, format_cache_ok, - seen_data_desc); +fmt-array.array[0].u.child = parse_format_list (dtp, seen_data_desc); else fmt-error = Missing initial left parenthesis in format;
Re: [PATCH] Fix PR56694
Richard Biener wrote: This fixes PR56694 - the code keeping BLOCKs live is not looking at the EH tree for references. In the must-not-throw failure_loc such references can now appear. Fixed by reverting that to 4.7 behavior. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk and 4.8 branch. Richard. 2013-03-25 Richard Biener rguent...@suse.de PR middle-end/56694 * tree-eh.c (lower_eh_must_not_throw): Strip BLOCKs from the must-not-throw stmt location. * g++.dg/torture/pr56694.C: New testcase. Index: gcc/tree-eh.c === *** gcc/tree-eh.c (revision 197029) --- gcc/tree-eh.c (working copy) *** lower_eh_must_not_throw (struct leh_stat *** 1855,1861 this_region = gen_eh_region_must_not_throw (state-cur_region); this_region-u.must_not_throw.failure_decl = gimple_eh_must_not_throw_fndecl (inner); ! this_region-u.must_not_throw.failure_loc = gimple_location (tp); /* In order to get mangling applied to this decl, we must mark it used now. Otherwise, pass_ipa_free_lang_data won't think it --- 1855,1862 this_region = gen_eh_region_must_not_throw (state-cur_region); this_region-u.must_not_throw.failure_decl = gimple_eh_must_not_throw_fndecl (inner); ! this_region-u.must_not_throw.failure_loc ! = LOCATION_LOCUS (gimple_location (tp)); /* In order to get mangling applied to this decl, we must mark it used now. Otherwise, pass_ipa_free_lang_data won't think it Index: gcc/testsuite/g++.dg/torture/pr56694.C === *** gcc/testsuite/g++.dg/torture/pr56694.C (revision 0) --- gcc/testsuite/g++.dg/torture/pr56694.C (working copy) *** *** 0 --- 1,30 + // { dg-do compile } + // { dg-options -fopenmp } + Hi, This fails to build on 'bare-metal'(non-OS) targets. The attached patch fixes this from FAIL - UNSUPPORTED for bare-metal targets. Tested on bare-metal aarch64 (aarch64-none-elf). OK? Thanks, Tejas Belagod. ARM. Changelog: 2013-03-28 Tejas Belagod tejas.bela...@arm.com testsuite/ * g++.dg/torture/pr56694.C: Fix test case to build on bare-metal targets.diff --git a/gcc/testsuite/g++.dg/torture/pr56694.C b/gcc/testsuite/g++.dg/torture/pr56694.C index 22bfe3c..d3de051 100644 --- a/gcc/testsuite/g++.dg/torture/pr56694.C +++ b/gcc/testsuite/g++.dg/torture/pr56694.C @@ -1,5 +1,6 @@ // { dg-do compile } // { dg-options -fopenmp } +// { dg-require-effective-target fopenmp } class GException { public:
Re: [PATCH] Fix PR56694
On Thu, 28 Mar 2013, Tejas Belagod wrote: Richard Biener wrote: This fixes PR56694 - the code keeping BLOCKs live is not looking at the EH tree for references. In the must-not-throw failure_loc such references can now appear. Fixed by reverting that to 4.7 behavior. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk and 4.8 branch. Richard. 2013-03-25 Richard Biener rguent...@suse.de PR middle-end/56694 * tree-eh.c (lower_eh_must_not_throw): Strip BLOCKs from the must-not-throw stmt location. * g++.dg/torture/pr56694.C: New testcase. Index: gcc/tree-eh.c === *** gcc/tree-eh.c (revision 197029) --- gcc/tree-eh.c (working copy) *** lower_eh_must_not_throw (struct leh_stat *** 1855,1861 this_region = gen_eh_region_must_not_throw (state-cur_region); this_region-u.must_not_throw.failure_decl = gimple_eh_must_not_throw_fndecl (inner); ! this_region-u.must_not_throw.failure_loc = gimple_location (tp); /* In order to get mangling applied to this decl, we must mark it used now. Otherwise, pass_ipa_free_lang_data won't think it --- 1855,1862 this_region = gen_eh_region_must_not_throw (state-cur_region); this_region-u.must_not_throw.failure_decl = gimple_eh_must_not_throw_fndecl (inner); ! this_region-u.must_not_throw.failure_loc ! = LOCATION_LOCUS (gimple_location (tp)); /* In order to get mangling applied to this decl, we must mark it used now. Otherwise, pass_ipa_free_lang_data won't think it Index: gcc/testsuite/g++.dg/torture/pr56694.C === *** gcc/testsuite/g++.dg/torture/pr56694.C (revision 0) --- gcc/testsuite/g++.dg/torture/pr56694.C (working copy) *** *** 0 --- 1,30 + // { dg-do compile } + // { dg-options -fopenmp } + Hi, This fails to build on 'bare-metal'(non-OS) targets. The attached patch fixes this from FAIL - UNSUPPORTED for bare-metal targets. Tested on bare-metal aarch64 (aarch64-none-elf). OK? Ok for trunk and branch. Thanks, Richard. Thanks, Tejas Belagod. ARM. Changelog: 2013-03-28 Tejas Belagod tejas.bela...@arm.com testsuite/ * g++.dg/torture/pr56694.C: Fix test case to build on bare-metal targets.
Re: [patch i386 windows]: Fix PR/52790 also required for workig upcoming cygwin x64 target
Ping
C++ PATCH: use C++ semantics for inline functions (defined in headers)
C++ has a much more predictable semantics for inline functions, so we no longer need to define them (especially in header files) with the 'static' specifier. The upshot is that when the compiler fails to inline a call in a given translation unit, it keeps only one copy in the entire program, instead of multiple copies (as the 'static' specifier would have implied.) With this patch, there is 2K reduction in size for cc1plus. Applying to trunk. Tested on an x86_64-suse-linux. -- Gaby 2013-03-28 Gabriel Dos Reis g...@integrable-solutions.net * cp-tree.h (next_aggr_init_expr_arg): Remove static specifier. (first_aggr_init_expr): Likewise. (more_aggr_init_expr_args_p): Likewise. (type_of_this_parm): Likewise. (class_of_this_parm): Likewise. * name-lookup.h (get_global_value_if_present): Likewise. (is_typename_at_global_scope): Likewise. Index: cp-tree.h === --- cp-tree.h (revision 197194) +++ cp-tree.h (working copy) @@ -3026,7 +3026,7 @@ /* Initialize the abstract argument list iterator object ITER with the arguments from AGGR_INIT_EXPR node EXP. */ -static inline void +inline void init_aggr_init_expr_arg_iterator (tree exp, aggr_init_expr_arg_iterator *iter) { @@ -3037,7 +3037,7 @@ /* Return the next argument from abstract argument list iterator object ITER, and advance its state. Return NULL_TREE if there are no more arguments. */ -static inline tree +inline tree next_aggr_init_expr_arg (aggr_init_expr_arg_iterator *iter) { tree result; @@ -3052,7 +3052,7 @@ past and return the first argument. Useful in for expressions, e.g. for (arg = first_aggr_init_expr_arg (exp, iter); arg; arg = next_aggr_init_expr_arg (iter)) */ -static inline tree +inline tree first_aggr_init_expr_arg (tree exp, aggr_init_expr_arg_iterator *iter) { init_aggr_init_expr_arg_iterator (exp, iter); @@ -3061,7 +3061,7 @@ /* Test whether there are more arguments in abstract argument list iterator ITER, without changing its state. */ -static inline bool +inline bool more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) { return (iter-i iter-n); @@ -4905,7 +4905,7 @@ /* Return the type of the `this' parameter of FNTYPE. */ -static inline tree +inline tree type_of_this_parm (const_tree fntype) { function_args_iterator iter; @@ -4916,7 +4916,7 @@ /* Return the class of the `this' parameter of FNTYPE. */ -static inline tree +inline tree class_of_this_parm (const_tree fntype) { return TREE_TYPE (type_of_this_parm (fntype)); Index: name-lookup.h === --- name-lookup.h (revision 197194) +++ name-lookup.h (working copy) @@ -347,7 +347,7 @@ /* Set *DECL to the (non-hidden) declaration for ID at global scope, if present and return true; otherwise return false. */ -static inline bool +inline bool get_global_value_if_present (tree id, tree *decl) { tree global_value = namespace_binding (id, global_namespace); @@ -358,7 +358,7 @@ /* True is the binding of IDENTIFIER at global scope names a type. */ -static inline bool +inline bool is_typename_at_global_scope (tree id) { tree global_value = namespace_binding (id, global_namespace);
[Patch, Fortran] PR56735 - Fix namelist read regression with ?
gfortran supports ? and =? as input with namelists (a somewhat common vendor extension). Either of those can be used with stdin to print the available fields of the namelist. With non-stdin input, the ? and =? lines are simply ignored. However, two patches, one in 2008 and one in 2011 broke that feature. The first one broke the output of the namelist with stdin, the second caused that the namelist read is aborted (with iostat == 0) - and the namelist ist not read. The attached patch fixes this. GCC 4.6 to 4.9 are affected by the latter issue (for which the PR has been filled). The other issue affects 4.5 to 4.9 and only applies to stdin input, for which no output is shown when using ?. Build and regtested on x86-64-gnu-linux. OK for the trunk - and for GCC 4.6 to 4.8? Tobias 2013-03-28 Tobias Burnus bur...@net-b.de PR fortran/56735 * io/list_read.c (nml_query): Only abort when an error occured. (namelist_read): Add goto instead of falling through. 2013-03-28 Tobias Burnus bur...@net-b.de PR fortran/56735 * gfortran.dg/namelist_80.f90: New. diff --git a/gcc/testsuite/gfortran.dg/namelist_80.f90 b/gcc/testsuite/gfortran.dg/namelist_80.f90 new file mode 100644 index 000..1961b11 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/namelist_80.f90 @@ -0,0 +1,27 @@ +! { dg-do run } +! +! PR fortran/56735 +! +! Contributed by Adam Williams +! +PROGRAM TEST +INTEGER int1,int2,int3 +NAMELIST /temp/ int1,int2,int3 + +int1 = -1; int2 = -2; int3 = -3 + +OPEN (53, STATUS='scratch') +WRITE (53, '(a)') ' ?' +WRITE (53, '(a)') +WRITE (53, '(a)') '$temp' +WRITE (53, '(a)') ' int1=1' +WRITE (53, '(a)') ' int2=2' +WRITE (53, '(a)') ' int3=3' +WRITE (53, '(a)') '$END' +REWIND(53) + +READ (53, temp) +CLOSE (53) + +if (int1 /= 1 .or. int2 /= 2 .or. int3 /= 3) call abort() +END PROGRAM diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index ec45570..7ce727d 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -2380,11 +2380,11 @@ nml_query (st_parameter_dt *dtp, char c) index_type len; char * p; #ifdef HAVE_CRLF - static const index_type endlen = 3; + static const index_type endlen = 2; static const char endl[] = \r\n; static const char nmlend[] = end\r\n; #else - static const index_type endlen = 2; + static const index_type endlen = 1; static const char endl[] = \n; static const char nmlend[] = end\n; #endif @@ -2414,12 +2414,12 @@ nml_query (st_parameter_dt *dtp, char c) /* namelist_name\n */ len = dtp-namelist_name_len; - p = write_block (dtp, len + endlen); + p = write_block (dtp, len - 1 + endlen); if (!p) goto query_return; memcpy (p, , 1); memcpy ((char*)(p + 1), dtp-namelist_name, len); - memcpy ((char*)(p + len + 1), endl, endlen - 1); + memcpy ((char*)(p + len + 1), endl, endlen); for (nl = dtp-u.p.ionml; nl; nl = nl-next) { /* var_name\n */ @@ -2430,14 +2430,15 @@ nml_query (st_parameter_dt *dtp, char c) goto query_return; memcpy (p, , 1); memcpy ((char*)(p + 1), nl-var_name, len); - memcpy ((char*)(p + len + 1), endl, endlen - 1); + memcpy ((char*)(p + len + 1), endl, endlen); } /* end\n */ - p = write_block (dtp, endlen + 3); + p = write_block (dtp, endlen + 4); + if (!p) goto query_return; - memcpy (p, nmlend, endlen + 3); + memcpy (p, nmlend, endlen + 4); } /* Flush the stream to force immediate output. */ @@ -3072,6 +3073,7 @@ find_nml_name: case '?': nml_query (dtp, '?'); + goto find_nml_name; case EOF: return;
[C++ Patch] PR 56725
Hi, in this PR Tom noticed that we are producing weird extra initial spaces in some error messages and Manuel replied that in fact those messages should rather be inform. Per Manuel suggestion, I therefore adjusted call.c in that sense but then noticed that eg, across rv1n.C, we were producing inconsistent diagnostics, only the errors toward the end of the file transformed to inform. I changed therefore convert_for_initialization too, and that led to the consistent behavior I was looking for (clang behaves very similarly, by the way). One last point. In convert_like_real we have now: /* Call build_user_type_conversion again for the error. */ build_user_type_conversion (totype, convs-u.expr, LOOKUP_NORMAL, complain); if (fn) inform (input_location, initializing argument %P of %q+D, argnum, fn); (we used to have an unconditional additional error). I suppose that's fine. But if there is the risk that build_user_type_conversion only produces permerrors, I suppose I have to add the slightly ugly mechanism used in convert_for_initialization, saving and reading the counters around the call. Tested x86_654-linux. Thanks, Paolo. // /cp 2013-03-28 Paolo Carlini paolo.carl...@oracle.com Manuel Lopez-Ibanez m...@gcc.gnu.org PR c++/56725 * call.c (convert_like_real): Change series of two permerrors to permerror + inform (and likewise for two errors). (build_new_method_call_1): Likewise. * typeck.c (convert_for_initialization): Change additional warning or error to inform. /testsuite 2013-03-28 Paolo Carlini paolo.carl...@oracle.com PR c++/56725 * g++.dg/conversion/op4.C: Adjust. * g++.dg/cpp0x/rv1n.C: Likewise. * g++.dg/cpp0x/rv2n.C: Likewise. * g++.dg/cpp0x/template_deduction.C: Likewise. * g++.dg/expr/cond8.C: Likewise. * g++.dg/other/error4.C: Likewise. * g++.old-deja/g++.bugs/900514_03.C: Likewise. * g++.old-deja/g++.bugs/900519_02.C: Likewise. * g++.old-deja/g++.bugs/900519_03.C: Likewise. * g++.old-deja/g++.bugs/900520_02.C: Likewise. * g++.old-deja/g++.jason/conversion2.C: Likewise. * g++.old-deja/g++.law/cvt20.C: Likewise. * g++.old-deja/g++.law/cvt8.C: Likewise. * g++.old-deja/g++.law/init8.C: Likewise. * g++.old-deja/g++.mike/net12.C: Likewise. * g++.old-deja/g++.mike/net8.C: Likewise. * g++.old-deja/g++.mike/p2793.C: Likewise. * g++.old-deja/g++.mike/p3836.C: Likewise. * g++.old-deja/g++.mike/p418.C: Likewise. * g++.old-deja/g++.mike/p701.C: Likewise. * g++.old-deja/g++.mike/p807.C: Likewise. Index: cp/call.c === --- cp/call.c (revision 197190) +++ cp/call.c (working copy) @@ -5836,11 +5836,11 @@ convert_like_real (conversion *convs, tree expr, t break; } - permerror (loc, invalid conversion from %qT to %qT, -TREE_TYPE (expr), totype); - if (fn) - permerror (DECL_SOURCE_LOCATION (fn), -initializing argument %P of %qD, argnum, fn); + if (permerror (loc, invalid conversion from %qT to %qT, +TREE_TYPE (expr), totype) + fn) + inform (DECL_SOURCE_LOCATION (fn), + initializing argument %P of %qD, argnum, fn); return cp_convert (totype, expr, complain); } @@ -5943,7 +5943,8 @@ convert_like_real (conversion *convs, tree expr, t build_user_type_conversion (totype, convs-u.expr, LOOKUP_NORMAL, complain); if (fn) - error ( initializing argument %P of %q+D, argnum, fn); + inform (input_location, initializing argument %P of %q+D, + argnum, fn); } return error_mark_node; @@ -6074,7 +6075,7 @@ convert_like_real (conversion *convs, tree expr, t error_at (loc, cannot bind %qT lvalue to %qT, TREE_TYPE (expr), totype); if (fn) - error ( initializing argument %P of %q+D, argnum, fn); + inform (loc, initializing argument %P of %q+D, argnum, fn); return error_mark_node; } @@ -7467,11 +7468,11 @@ build_new_method_call_1 (tree instance, tree fns, if (! (complain tf_error)) return error_mark_node; - permerror (input_location, -cannot call constructor %%T::%D% directly, -basetype, name); - permerror (input_location, for a function-style cast, remove the -redundant %::%D%, name); + if (permerror (input_location, +cannot call constructor %%T::%D% directly, +basetype, name)) + inform (input_location, for a function-style cast, remove the +
Re: patch to fix constant math - third patch - what is left for next stage 1
committed as revision 197198 kenny On 03/27/2013 10:19 AM, Richard Biener wrote: On Wed, Feb 27, 2013 at 1:37 AM, Kenneth Zadeck zad...@naturalbridge.com wrote: the original patch 3 was accepted and committed. These were subsequent comments. This could likely be just checked in the next stage 1 without approval. Ok. Thanks, Richard.
[wwwdocs] Adjust power.org reference in readings.html
Applied. Gerald Index: readings.html === RCS file: /cvs/gcc/wwwdocs/htdocs/readings.html,v retrieving revision 1.222 diff -u -3 -p -r1.222 readings.html --- readings.html 27 Mar 2013 22:10:04 - 1.222 +++ readings.html 28 Mar 2013 14:20:34 - @@ -244,7 +244,7 @@ Intelreg;64 and IA-32 Architectures Sof br /Manufacturer: IBM, Motorola br /a href=http://publib16.boulder.ibm.com/pseries/en_US/infocenter/base/43_docs/aixassem/alangref/toc.htm;AIX V4.3 Assembler Language Ref./a br /a href=http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixassem/alangref/alangreftfrm.htm;AIX 5L Assembler Language Ref./a - br /a href=http://www.power.org/resources/downloads/;Documentation and tools at power.org/a + br /a href=https://www.power.org/documentation/;Documentation and tools at power.org/a /li lirx
Re: [Patch, ARM] Enable libsanitizer
Note that the testsuite currently fails when executing under qemu: - support of /proc/self/maps does not conform to the kernel format. One extra space is missing from some lines, which confuses libsanitizer. Patch proposed to upstream qemu: http://lists.gnu.org/archive/html/qemu-devel/2013-02/msg03051.html As we discussed in https://code.google.com/p/address-sanitizer/issues/detail?id=160 this may be fixed in libsanitizer, although i'd still prefer the qemu fix. I'll ping the qemu list. - libsanitizer detects if its output is a tty, and when GCC testsuite is executed under qemu, libsanitizer concludes that it is actually running under a tty, and adds beautyfying characters which confuse dejanu. Is this again a quemu problem? I still don't know. I tried to investigate some time ago; I thought it could be a problem when qemu interprets a ~isatty syscall, but IIRC this syscall isn't used. So I don't know who finally asnwers to the isatty() query. Christophe.
Re: patch to fix constant math - second small patch -patch ping for next stage 1
committed as revision 197200. kenny On 03/27/2013 11:07 AM, Richard Biener wrote: On Wed, Mar 27, 2013 at 3:23 PM, Kenneth Zadeck zad...@naturalbridge.com wrote: On 03/27/2013 10:18 AM, Richard Biener wrote: On Wed, Feb 27, 2013 at 1:27 AM, Kenneth Zadeck zad...@naturalbridge.com wrote: Here is the second of my wide int patches with the patch rot removed. I would like to get these pre approved for the next stage 1. On 10/05/2012 06:48 PM, Kenneth Zadeck wrote: This patch adds machinery to genmodes.c so that largest possible sizes of various data structures can be determined at gcc build time. These functions create 3 symbols that are available in insn-modes.h: MAX_BITSIZE_MODE_INT - the bitsize of the largest int. MAX_BITSIZE_MODE_PARTIAL_INT - the bitsize of the largest partial int. MAX_BITSIZE_MODE_ANY_INT - the largest bitsize of any kind of int. I remember we have discussed about the need to special-case/handle partial integer modes. Do further patches use the _INT and _PARTIAL_INT sizes at all? I'm fine with providing MAX_BITSIZE_MODE_ANY_INT. i do not believe that in the end, those two ended up getting used.i can remove them if you want. Yes please. Ok with that change. Richard. kenny Richard.
Re: [C++ Patch] PR 56725
.. oops, the patch I attached has a typo. This is the right one. Paolo. // Index: cp/call.c === --- cp/call.c (revision 197198) +++ cp/call.c (working copy) @@ -5836,11 +5836,11 @@ convert_like_real (conversion *convs, tree expr, t break; } - permerror (loc, invalid conversion from %qT to %qT, -TREE_TYPE (expr), totype); - if (fn) - permerror (DECL_SOURCE_LOCATION (fn), -initializing argument %P of %qD, argnum, fn); + if (permerror (loc, invalid conversion from %qT to %qT, +TREE_TYPE (expr), totype) + fn) + inform (DECL_SOURCE_LOCATION (fn), + initializing argument %P of %qD, argnum, fn); return cp_convert (totype, expr, complain); } @@ -5943,7 +5943,8 @@ convert_like_real (conversion *convs, tree expr, t build_user_type_conversion (totype, convs-u.expr, LOOKUP_NORMAL, complain); if (fn) - error ( initializing argument %P of %q+D, argnum, fn); + inform (input_location, initializing argument %P of %q+D, + argnum, fn); } return error_mark_node; @@ -6074,7 +6075,8 @@ convert_like_real (conversion *convs, tree expr, t error_at (loc, cannot bind %qT lvalue to %qT, TREE_TYPE (expr), totype); if (fn) - error ( initializing argument %P of %q+D, argnum, fn); + inform (input_location, + initializing argument %P of %q+D, argnum, fn); return error_mark_node; } @@ -7467,11 +7469,11 @@ build_new_method_call_1 (tree instance, tree fns, if (! (complain tf_error)) return error_mark_node; - permerror (input_location, -cannot call constructor %%T::%D% directly, -basetype, name); - permerror (input_location, for a function-style cast, remove the -redundant %::%D%, name); + if (permerror (input_location, +cannot call constructor %%T::%D% directly, +basetype, name)) + inform (input_location, for a function-style cast, remove the + redundant %::%D%, name); call = build_functional_cast (basetype, build_tree_list_vec (user_args), complain); return call; Index: cp/typeck.c === --- cp/typeck.c (revision 197198) +++ cp/typeck.c (working copy) @@ -7984,13 +7984,12 @@ convert_for_initialization (tree exp, tree type, t if (fndecl) savew = warningcount + werrorcount, savee = errorcount; rhs = initialize_reference (type, rhs, flags, complain); - if (fndecl) - { - if (warningcount + werrorcount savew) - warning (0, in passing argument %P of %q+D, parmnum, fndecl); - else if (errorcount savee) - error (in passing argument %P of %q+D, parmnum, fndecl); - } + + if (fndecl + (warningcount + werrorcount savew || errorcount savee)) + inform (input_location, + in passing argument %P of %q+D, parmnum, fndecl); + return rhs; } Index: testsuite/g++.dg/conversion/op4.C === --- testsuite/g++.dg/conversion/op4.C (revision 197198) +++ testsuite/g++.dg/conversion/op4.C (working copy) @@ -9,7 +9,7 @@ struct X { } }; -void add_one (X ref) { /* { dg-error in passing argument } */ +void add_one (X ref) { /* { dg-message in passing argument } */ ++ ref.x; } Index: testsuite/g++.dg/cpp0x/rv1n.C === --- testsuite/g++.dg/cpp0x/rv1n.C (revision 197198) +++ testsuite/g++.dg/cpp0x/rv1n.C (working copy) @@ -30,7 +30,7 @@ const volatile A cv_source(); // 1 at a time -one sink_1_1( A); // { dg-error } +one sink_1_1( A); // { dg-message } int test1_1() { @@ -48,7 +48,7 @@ int test1_1() return 0; } -two sink_1_2(const A); // { dg-error } +two sink_1_2(const A); // { dg-message } int test1_2() { @@ -63,7 +63,7 @@ int test1_2() return 0; } -three sink_1_3(volatile A); // { dg-error } +three sink_1_3(volatile A); // { dg-message } int test1_3() { @@ -80,7 +80,7 @@ int test1_3() return 0; } -four sink_1_4(const volatile A); // { dg-error } +four sink_1_4(const volatile A); // { dg-message } int test1_4() { @@ -95,7 +95,7 @@ int test1_4() return 0; } -five sink_1_5( A); // { dg-error } +five sink_1_5( A); // { dg-message } int test1_5() { @@ -113,7 +113,7 @@ int test1_5() return 0; } -six sink_1_6(const
Re: [PATCH, AArch64] Make MOVK output operand 2 in hex
On 20/03/13 17:21, Ian Bolton wrote: MOVK should not be generated with a negative immediate, which the assembler rightfully rejects. This patch makes MOVK output its 2nd operand in hex instead. Tested on bare-metal and linux. OK for trunk? Cheers, Ian 2013-03-20 Ian Bolton ian.bol...@arm.com gcc/ * config/aarch64/aarch64.c (aarch64_print_operand): New format specifier for printing a constant in hex. * config/aarch64/aarch64.md (insv_immmode): Use the X format specifier for printing second operand. testsuite/ * gcc.target/aarch64/movk.c: New test. OK /Marcus
Re: patch to fix constant math - first small patch - patch ping for the next stage 1
richard, adding the gcc_checking_assert is going to require that i include system.h in hwint.h which seems to cause a loop. while in principle, i agree with the assert, this is going to be a mess. kenny On 03/27/2013 10:13 AM, Richard Biener wrote: On Wed, Feb 27, 2013 at 1:22 AM, Kenneth Zadeck zad...@naturalbridge.com wrote: Here is the first of my wide int patches with joseph's comments and the patch rot removed. I would like to get these pre approved for the next stage 1. + int shift = HOST_BITS_PER_WIDE_INT - (prec (HOST_BITS_PER_WIDE_INT - 1)); I think this should gcc_checking_assert that prec is not out of range (any reason why prec is signed int and not unsigned int?) rather than ignore bits in prec. +static inline HOST_WIDE_INT +zext_hwi (HOST_WIDE_INT src, int prec) +{ + if (prec == HOST_BITS_PER_WIDE_INT) +return src; + else +return src (((HOST_WIDE_INT)1 + (prec (HOST_BITS_PER_WIDE_INT - 1))) - 1); +} likewise. Also I'm not sure I agree about the signedness of the result / src. zext_hwi (-1, HOST_BITS_PER_WIDE_INT) 0 is true which is odd. The patch misses context of uses, so I'm not sure what the above functions are intended to do. Richard. On 10/05/2012 08:14 PM, Joseph S. Myers wrote: On Fri, 5 Oct 2012, Kenneth Zadeck wrote: +# define HOST_HALF_WIDE_INT_PRINT h This may cause problems on hosts not supporting %hd (MinGW?), and there's no real need for using h here given the promotion of short to int; you can just use (rather than e.g. needing special handling in xm-mingw32.h like is done for HOST_LONG_LONG_FORMAT).
Re: [C++ Patch] PR 56725
Ok. Jason
[PATCH] Fix PR56756
The domwalker fix to order dom children after inverted postorder exposed the latent issue that LIM relies on domwalk to walk all blocks defining SSA names before all blocks using them ... which is what the following patch tries to fix using the dependency information it already tracks (but incompletely so, thus the fixes). Bootstrapped and tested on x86_64-unknown-linux-gnu. I'm not entirely happy with this - it should use a worklist of stmts instead of recursing and handling basic-blocks. But well ... Leaving for comments. (inverted_post_order_compute visits loop nodes in weird order because it visits loop exit nodes last) Richard. 2013-03-28 Richard Biener rguent...@suse.de PR tree-optimization/56756 * tree-ssa-loop-im.c (outermost_invariant_loop): More properly handle not yet processed def stmts. (add_dependency): Simplify. (move_computations_stmt): Rename to ... (move_computations_bb): ... this. Process blocks with dependencies recursively. (move_computations): Instead of a dominator walk process basic-blocks in order determined by dependences of stmts we want to hoist. (force_move_till_op): Add dependencies. (struct fmt_data): Add dependence storage. (execute_sm): Adjust. * gcc.dg/torture/pr56756.c: New testcase. Index: gcc/tree-ssa-loop-im.c === --- gcc/tree-ssa-loop-im.c (revision 197188) +++ gcc/tree-ssa-loop-im.c (working copy) @@ -417,7 +418,7 @@ outermost_invariant_loop (tree def, stru { gimple def_stmt; basic_block def_bb; - struct loop *max_loop; + struct loop *def_loop; struct lim_aux_data *lim_data; if (!def) @@ -434,17 +435,22 @@ outermost_invariant_loop (tree def, stru if (!def_bb) return superloop_at_depth (loop, 1); - max_loop = find_common_loop (loop, def_bb-loop_father); - + def_loop = def_bb-loop_father; lim_data = get_lim_data (def_stmt); - if (lim_data != NULL lim_data-max_loop != NULL) -max_loop = find_common_loop (max_loop, -loop_outer (lim_data-max_loop)); - if (max_loop == loop) -return NULL; - max_loop = superloop_at_depth (loop, loop_depth (max_loop) + 1); + if (lim_data == NULL + || lim_data-max_loop == NULL) +{ + if (def_loop == loop) + return NULL; + if (!flow_loop_nested_p (def_loop, loop)) + return NULL; + return superloop_at_depth (loop, loop_depth (def_loop) + 1); +} - return max_loop; + if (lim_data-max_loop != loop + !flow_loop_nested_p (lim_data-max_loop, loop)) +return NULL; + return lim_data-max_loop; } /* DATA is a structure containing information associated with a statement @@ -466,7 +472,6 @@ add_dependency (tree def, struct lim_aux gimple def_stmt = SSA_NAME_DEF_STMT (def); basic_block def_bb = gimple_bb (def_stmt); struct loop *max_loop; - struct lim_aux_data *def_data; if (!def_bb) return true; @@ -478,17 +483,13 @@ add_dependency (tree def, struct lim_aux if (flow_loop_nested_p (data-max_loop, max_loop)) data-max_loop = max_loop; - def_data = get_lim_data (def_stmt); - if (!def_data) -return true; - if (add_cost /* Only add the cost if the statement defining DEF is inside LOOP, i.e. if it is likely that by moving the invariants dependent on it, we will be able to avoid creating a new register for it (since it will be only used in these dependent invariants). */ def_bb-loop_father == loop) -data-cost += def_data-cost; +data-cost += get_lim_data (def_stmt)-cost; data-depends.safe_push (def_stmt); @@ -1174,18 +1175,20 @@ determine_invariantness (void) data stored in LIM_DATA structures associated with each statement. Callback for walk_dominator_tree. */ -static void -move_computations_stmt (struct dom_walk_data *dw_data, - basic_block bb) +static unsigned +move_computations_bb (basic_block bb, sbitmap visited) { struct loop *level; gimple_stmt_iterator bsi; gimple stmt; unsigned cost = 0; struct lim_aux_data *lim_data; + unsigned todo = 0; + unsigned i; + gimple dep_stmt; if (!loop_outer (bb-loop_father)) -return; +return 0; for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); ) { @@ -1201,14 +1204,25 @@ move_computations_stmt (struct dom_walk_ cost = lim_data-cost; level = lim_data-tgt_loop; - clear_lim_data (stmt); if (!level) { + clear_lim_data (stmt); gsi_next (bsi); continue; } + /* Make sure to process blocks with stmts we depend on first. */ + FOR_EACH_VEC_ELT (lim_data-depends, i, dep_stmt) + if (gimple_bb (dep_stmt) +!bitmap_bit_p (visited, gimple_bb (dep_stmt)-index)) + { + bitmap_set_bit (visited, gimple_bb (dep_stmt)-index); +
Stream stmt histograms for LTO
Hi, this patch adds streaming of histograms that did not make it into LTO previously. This restores some optimizations, such as specialization of memcpy/memset inline code for expected sizealignment of the block. I also added specialzed streaming functions for gcov counters. They may be wider than HWI in some configurations so we want to be sure there are no uncontrolled overflows and we can do bit of sanity check that the values are not negative. (and probably skip streaming when profile is absent) lto-profilebootstrapped/regtested x86_64-linux. Will commit it shortly. * data-streamer-in.c (streamer_read_gcov_count): New function. * gimple-streamer-out.c: Include value-prof.h. (output_gimple_stmt): Output histogram. (output_bb): Use streamer_write_gcov_count. * value-prof.c: Include data-streamer.h (dump_histogram_value): Add HIST_TYPE_MAX. (stream_out_histogram_value): New function. (stream_in_histogram_value): New function. * value-prof.h (enum hist_type): Add HIST_TYPE_MAX. (stream_out_histogram_value, stream_in_histogram_value): Declare. * data-streamer-out.c (streamer_write_gcov_count): New function. (streamer_write_gcov_count_stream): New function. * lto-cgraph.c (lto_output_edge): Update counter streaming. (lto_output_node): Likewise. (input_node, input_edge): Likewise. * lto-streamer-out.c (output_cfg): Update streaming. * lto-streamer-in.c (input_cfg): Likewise. * data-streamer.h (streamer_write_gcov_count, streamer_write_gcov_count_stream, streamer_read_gcov_count): Declare. * gimple-streamer-in.c: Include value-prof.h (input_gimple_stmt): Input histograms. (input_bb): Update profile streaming. Index: data-streamer-in.c === *** data-streamer-in.c (revision 197125) --- data-streamer-in.c (working copy) *** streamer_read_hwi (struct lto_input_bloc *** 158,160 --- 158,170 } } } + + /* Read gcov_type value from IB. */ + + gcov_type + streamer_read_gcov_count (struct lto_input_block *ib) + { + gcov_type ret = streamer_read_hwi (ib); + gcc_assert (ret = 0); + return ret; + } Index: gimple-streamer-out.c === *** gimple-streamer-out.c (revision 197125) --- gimple-streamer-out.c (working copy) *** along with GCC; see the file COPYING3. *** 28,33 --- 28,34 #include gimple-streamer.h #include lto-streamer.h #include tree-streamer.h + #include value-prof.h /* Output PHI function PHI to the main stream in OB. */ *** output_gimple_stmt (struct output_block *** 59,64 --- 60,66 enum gimple_code code; enum LTO_tags tag; struct bitpack_d bp; + histogram_value hist; /* Emit identifying tag. */ code = gimple_code (stmt); *** output_gimple_stmt (struct output_block *** 72,77 --- 74,81 if (is_gimple_assign (stmt)) bp_pack_value (bp, gimple_assign_nontemporal_move_p (stmt), 1); bp_pack_value (bp, gimple_has_volatile_ops (stmt), 1); + hist = gimple_histogram_value (cfun, stmt); + bp_pack_value (bp, hist != NULL, 1); bp_pack_var_len_unsigned (bp, stmt-gsbase.subcode); /* Emit location information for the statement. */ *** output_gimple_stmt (struct output_block *** 167,172 --- 171,178 default: gcc_unreachable (); } + if (hist) + stream_out_histogram_value (ob, hist); } *** output_bb (struct output_block *ob, basi *** 183,189 : LTO_bb0); streamer_write_uhwi (ob, bb-index); ! streamer_write_hwi (ob, bb-count); streamer_write_hwi (ob, bb-frequency); streamer_write_hwi (ob, bb-flags); --- 189,195 : LTO_bb0); streamer_write_uhwi (ob, bb-index); ! streamer_write_gcov_count (ob, bb-count); streamer_write_hwi (ob, bb-frequency); streamer_write_hwi (ob, bb-flags); Index: value-prof.c === *** value-prof.c(revision 197125) --- value-prof.c(working copy) *** along with GCC; see the file COPYING3. *** 44,49 --- 44,50 #include dumpfile.h #include pointer-set.h #include profile.h + #include data-streamer.h /* In this file value profile based optimizations are placed. Currently the following optimizations are implemented (for more detailed descriptions *** dump_histogram_value (FILE *dump_file, h *** 333,341 --- 334,428 } fprintf (dump_file, .\n); break; + case HIST_TYPE_MAX: + gcc_unreachable (); } } + /* Dump information about HIST to DUMP_FILE. */ + + void +
Re: extend fwprop optimization
On Thu, Mar 28, 2013 at 5:34 AM, Wei Mi w...@google.com wrote: I am not familiar how to use define_subst, so I write a patch that changes define_insn_and_split to define_insn. bootstrapped and regression tested on x86_64-unknown-linux-gnu. A question is: after that change, Is there anyway I can make targetm.rtx_costs() aware about the truncation, .i.e the cost is only a shift instead of shift + and. Please also change all operand 2 predicates to register_operand. 2013-03-27 Wei Mi w...@google.com * config/i386/i386.md: Do shift truncation in define_insn instead of define_insn_and_split. Please write ChangeLog as: * config/i386/i386.md (*ashlmode3_mask): Rewrite as define_insn. Truncate operand 2 using %b asm operand modifier. (*shift_insnmode3_mask): Ditto. (*rotate_insnmode3_mask): Ditto. OK for mainline and all release branches with these changes. Thanks, Uros.
Re: *ping* [patch, fortran, 4.9] Dependency and string length calculation improvements
I wrote: Ping**2? I'd like to get these patches committed, if possible, to clear up my trees a little bit :-) Thomas *ping* Slightly updated patch below, with a better test case as suggested by Dominique. OK for trunk? 2013-03-16 Thomas Koenig tkoe...@gcc.gnu.org PR fortran/45159 * gfortran.h (gfc_dep_difference): Add prototype. * dependency.c (discard_nops): New function. (gfc_dep_difference): New function. (check_section_vs_section): Use gfc_dep_difference to calculate the difference of starting indices. * trans-expr.c (gfc_conv_substring): Use gfc_dep_difference to calculate the length of substrings where possible. 2013-03-16 Thomas Koenig tkoe...@gcc.gnu.org PR fortran/45159 * gfortran.dg/string_length_2.f90: New test. * gfortran.dg/dependency_41.f90: New test.
Re: [patch, fortran, 4.9] Improve efficiency of array constructor operators
Am 26.03.2013 18:17, schrieb Thomas Koenig: Hi Tobias, I have not yet looked at the patch, but I wonder whether that causes invalid code for if (any([a,b,c] f())) by evaluating f() multiple times. This is avoided by this part of the patch: + if (op2-expr_type == EXPR_CONSTANT) +scalar = gfc_copy_expr (op2); + else +scalar = create_var (gfc_copy_expr (op2)); which results in code like this: __var_1 = f (); if ((a __var_1 || b __var_1) || c __var_1) { { Are there any other concerns, or can I commit this? Regards Thomas
[patch] cilkplus: Array notation for C patch
Hello Joseph, Aldy et al., Attached, please find a fixed patch (bzipped) that implements array notation for C. To my best knowledge, I have fixed all the changes Joseph and Aldy have mentioned in the previous email threads (http://gcc.gnu.org/ml/gcc-patches/2013-03/msg01182.html, http://gcc.gnu.org/ml/gcc-patches/2013-03/msg01173.html, http://gcc.gnu.org/ml/gcc-patches/2013-03/msg00748.html, etc). Is it OK for trunk? Thanks, Balaji V. Iyer. Here are the Changelog entries: gcc/ChangeLog +2013-03-28 Balaji V. Iyer balaji.v.i...@intel.com + + * doc/extend.texi (C Extensions): Added documentation about Cilk Plus + array notation built-in reduction functions. + * doc/passes.texi (Passes): Added documentation about changes done + for Cilk Plus. + * doc/invoke.texi (C Dialect Options): Added documentation about + the -fcilkplus flag. + * doc/generic.texi (Storage References): Added documentation for + ARRAY_NOTATION_REF storage. + * Makefile.in (C_COMMON_OBJS): Added c-family/array-notation-common.o. + * tree-pretty-print.c (dump_generic_node): Add case for + ARRAY_NOTATION_REF. + (BUILTINS_DEF): Depend on cilkplus.def. + * builtins.def: Include cilkplus.def. + Define DEF_CILKPLUS_BUILTIN. + * builtin-types.def: Define BT_FN_INT_PTR_PTR_PTR. + * cilkplus.def: New file. gcc/c-family/ChangeLog +2013-03-28 Balaji V. Iyer balaji.v.i...@intel.com + + * c-common.c (c_define_builtins): When cilkplus is enabled, the + function array_notation_init_builtins is called. + (c_common_init_ts): Added ARRAY_NOTATION_REF as typed. + * c-common.def (ARRAY_NOTATION_REF): New tree. + * c-common.h (build_array_notation_expr): New function declaration. + (build_array_notation_ref): Likewise. + (extract_sec_implicit_index_arg): New extern declaration. + (is_sec_implicit_index_fn): Likewise. + (ARRAY_NOTATION_CHECK): New define. + (ARRAY_NOTATION_ARRAY): Likewise. + (ARRAY_NOTATION_START): Likewise. + (ARRAY_NOTATION_LENGTH): Likewise. + (ARRAY_NOTATION_STRIDE): Likewise. + (ARRAY_NOTATION_TYPE): Likewise. + * c-pretty-print.c (pp_c_postifix_expression): Added a new case for + ARRAY_NOTATION_REF. + (pp_c_expression): Likewise. + * c.opt (flag_enable_cilkplus): New flag. + * array-notation-common.c: New file. gcc/c/ChangeLog +2013-03-28 Balaji V. Iyer balaji.v.i...@intel.com + + * c-typeck.c (build_array_ref): Added a check to see if array's + index is greater than one. If true, then emit an error. + (build_function_call_vec): Exclude error reporting and checking + for builtin array-notation functions. + (convert_arguments): Likewise. + (c_finish_return): Added a check for array notations as a return + expression. If true, then emit an error. + (c_finish_loop): Added a check for array notations in a loop + condition. If true then emit an error. + (lvalue_p): Added a ARRAY_NOTATION_REF case. + (build_binary_op): Added a check for array notation expr inside + op1 and op0. If present, we call another function to find correct + type. + * Make-lang.in (C_AND_OBJC_OBJS): Added c-array-notation.o. + * c-parser.c (c_parser_compound_statement): Check if array + notation code is used in tree, if so, then transform them into + appropriate C code. + (c_parser_expr_no_commas): Check if array notation is used in LHS + or RHS, if so, then build array notation expression instead of + regular modify. + (c_parser_postfix_expression_after_primary): Added a check for + colon(s) after square braces, if so then handle it like an array + notation. Also, break up array notations in unary op if found. + (c_parser_direct_declarator_inner): Added a check for array + notation. + (c_parser_compound_statement): Added a check for array notation in + a stmt. If one is present, then expand array notation expr. + (c_parser_if_statement): Likewise. + (c_parser_switch_statement): Added a check for array notations in + a switch statement's condition. If true, then output an error. + (c_parser_while_statement): Similarly, but for a while. + (c_parser_do_statement): Similarly, but for a do-while. + (c_parser_for_statement): Similarly, but for a for-loop. + (c_parser_unary_expression): Check if array notation is used in a + pre-increment or pre-decrement expression. If true, then expand + them. + (c_parser_array_notation): New function. + * c-array-notation.c: New file. + * c-tree.h (is_cilkplus_reduce_builtin): Protoize. -Original Message- From: Joseph Myers [mailto:jos...@codesourcery.com] Sent: Wednesday, March 27, 2013 6:11 PM To: Aldy Hernandez Cc: gcc-patches; Iyer, Balaji V Subject:
[AARCH64] Add SHORT scalar move
Hi, This patch adds support in AArch64 for scalar moves to and from vector registers in SHORT modes. This has been tested with a full regression run on aarch64-elf. OK for trunk and 4.8? Thanks Sofiane - 2013-03-28 Sofiane Naci sofiane.n...@arm.com * config/aarch64/aarch64.md (*movmode_aarch64): Add alternatives for scalar move. * config/aarch64/aarch64.c (aarch64_simd_scalar_immediate_valid_for_move): New. * config/aarch64/aarch64-protos.h (aarch64_simd_scalar_immediate_valid_for_move): New. * config/aarch64/constraints.md (Dh, Dq): New. * config/aarch64/iterators.md (hq): New. aarch64-scalar-move.patch Description: Binary data
[AARCH64] Add SHORT scalar load/store using B/H registers
Hi, This patch adds support in AArch64 for scalar loads and stores to and from B/H registers. This has been tested with a full regression run on aarch64-elf. OK for trunk and 4.8? Thanks Sofiane - 2013-03-28 Sofiane Naci sofiane.n...@arm.com * config/aarch64/aarch64.md (*movmode_aarch64): Add variants for scalar load/store operations using B/H registers. (*zero_extendSHORT:modeGPI:mode2_aarch64): Likewise. aarch64-scalar-load-store.patch Description: Binary data
Re: [PING^1] [AArch64] Implement Bitwise AND and Set Flags
On 26/03/13 11:35, Hurugalawadi, Naveen wrote: Hi, Can we split them into two different patches. Just and in one Thanks for reviewing the patch. I have split the patches for and separately as per your suggestion. Thanks, I've adjusted the patch to use the SHIFT iterator instead of ASHIFT and committed as attached. Ian, has a BICS implementation to follow which will include his testcase as previously posted for both ANDS and BICS. /Marcusdiff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index ca94d70..4f04081 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -2467,6 +2467,69 @@ [(set_attr v8type logic,logic_imm) (set_attr mode SI)]) +(define_insn *andmode3_compare0 + [(set (reg:CC_NZ CC_REGNUM) + (compare:CC_NZ + (and:GPI (match_operand:GPI 1 register_operand %r,r) + (match_operand:GPI 2 aarch64_logical_operand r,lconst)) + (const_int 0))) + (set (match_operand:GPI 0 register_operand =r,r) + (and:GPI (match_dup 1) (match_dup 2)))] + + ands\\t%w0, %w1, %w2 + [(set_attr v8type logics,logics_imm) + (set_attr mode MODE)] +) + +;; zero_extend version of above +(define_insn *andsi3_compare0_uxtw + [(set (reg:CC_NZ CC_REGNUM) + (compare:CC_NZ + (and:SI (match_operand:SI 1 register_operand %r,r) + (match_operand:SI 2 aarch64_logical_operand r,K)) + (const_int 0))) + (set (match_operand:DI 0 register_operand =r,r) + (zero_extend:DI (and:SI (match_dup 1) (match_dup 2] + + ands\\t%w0, %w1, %w2 + [(set_attr v8type logics,logics_imm) + (set_attr mode SI)] +) + +(define_insn *and_SHIFT:optabmode3_compare0 + [(set (reg:CC_NZ CC_REGNUM) + (compare:CC_NZ + (and:GPI (SHIFT:GPI + (match_operand:GPI 1 register_operand r) + (match_operand:QI 2 aarch64_shift_imm_mode n)) + (match_operand:GPI 3 register_operand r)) + (const_int 0))) + (set (match_operand:GPI 0 register_operand =r) + (and:GPI (SHIFT:GPI (match_dup 1) (match_dup 2)) (match_dup 3)))] + + ands\\t%w0, %w3, %w1, SHIFT:shift %2 + [(set_attr v8type logics_shift) + (set_attr mode MODE)] +) + +;; zero_extend version of above +(define_insn *and_SHIFT:optabsi3_compare0_uxtw + [(set (reg:CC_NZ CC_REGNUM) + (compare:CC_NZ + (and:SI (SHIFT:SI + (match_operand:SI 1 register_operand r) + (match_operand:QI 2 aarch64_shift_imm_si n)) + (match_operand:SI 3 register_operand r)) + (const_int 0))) + (set (match_operand:DI 0 register_operand =r) + (zero_extend:DI (and:SI (SHIFT:SI (match_dup 1) (match_dup 2)) +(match_dup 3] + + ands\\t%w0, %w3, %w1, SHIFT:shift %2 + [(set_attr v8type logics_shift) + (set_attr mode SI)] +) + (define_insn *LOGICAL:optab_SHIFT:optabmode3 [(set (match_operand:GPI 0 register_operand =r) (LOGICAL:GPI (SHIFT:GPI
Re: [AARCH64] Add SHORT scalar move
On 28/03/13 17:15, Sofiane Naci wrote: Hi, This patch adds support in AArch64 for scalar moves to and from vector registers in SHORT modes. This has been tested with a full regression run on aarch64-elf. OK for trunk and 4.8? OK for trunk. /Marcus
Re: [AARCH64] Add SHORT scalar load/store using B/H registers
On 28/03/13 17:15, Sofiane Naci wrote: Hi, This patch adds support in AArch64 for scalar loads and stores to and from B/H registers. This has been tested with a full regression run on aarch64-elf. OK for trunk and 4.8? OK for trunk. /Marcus
Re: *ping* [patch, fortran, 4.9] Dependency and string length calculation improvements
Thomas Koenig wrote: below is a patch which improves dependency checking for array assignments and calculation of string lengths. Talking about dependencies, I wonder whether you would be interested implementing the function bool gfc_simply_noncontiguous (gfc_expr *); or something similarly named. It should return true, if the expression is known to be noncontiguous. Such a function has many uses: - Diagnostic to reject invalid code such as contiguous_ptr = noncontiguous_target,* passing a noncontiguous expression to c_loc, and possibly more - Compile-time simplification for the IS_CONTIGUOUS intrinsic (not yet implemented) - If we pass a noncontiguous array to a contiguous dummy argument (i.e. assumed-size, explicit-size or contiguous attribute), there is the check if(new_array != old_array) { unpack(old_array,new_array);free(new_array) }. If one knows that the array is noncontiguous, the if(new_array!=old_array) check could be removed (missed optimization) - Potentially some more uses Additionally, gfc_simply_noncontiguous has some bugs (both false positive and false negative) - especially for BT_CLASS and for ref-array/ref-substring handling (esp. when combined). Actually, for type t integer i end type t type(t) :: foo(5) is_contiguous(foo(:)%i), it depends on the aligning. (I think one needs to call gfc_target_expr_size for foo(:) and compare it with the storage size of foo(1)%i.) Of course, if there multiple components, foo(:)%i is obviously noncontiguous. (For gfc_simply_contiguous, see the Fortran standard for the exact definition of simply contiguous, which should be used with strict==true). If you will work on it, please tell me - otherwise, I might start to work on it. (It is not on top of my agenda, but for Fortran 2008's IS_CONTIGUOUS() and for diagnostic reasons, I like to have it.) * * * But now, a bit belated, to your patch. On 25.03.2013 16:43, Thomas Koenig wrote: OK for trunk? OK - except for the following three minor coding convention nits. +} +/* Return the difference between two expressions. Integer expressions of Two empty lines before the comment. +} + /* Returns 1 if the two ranges are the same and 0 if they are not (or if the This time only one empty line is missing. - mpz_clear (tmp); + mpz_clear (tmp); /* gfc_dep_difference returned true, so tmp was initialized. */ I am not sure whether the comment is needed - but if you want to keep it: The line is too long ;-) Tobias * Example for that pointer, contiguous :: ptr target :: tgt(5) ptr = tgt(::2)
[PATCH AArch64] Make omit-frame-pointer work correctly
Currently, if you compile with -fomit-frame-pointer, the frame record and frame pointer are still maintained (i.e. There is no way to get the behaviour you are asking for!). This patch fixes that. It also makes sure that if you ask for no frame pointers in leaf functions then they are not generated there unless LR gets clobbered in the leaf for some reason. (I have testcases here to check for that.) OK to commit to trunk? Cheers, Ian 2013-03-28 Ian Bolton ian.bol...@arm.com gcc/ * config/aarch64/aarch64.md (aarch64_can_eliminate): Only keep frame record when required. testsuite/ * gcc.target/aarch64/inc/asm-adder-clobber-lr.c: New test. * gcc.target/aarch64/inc/asm-adder-no-clobber-lr.c: Likewise. * gcc.target/aarch64/test-framepointer-1.c: Likewise. * gcc.target/aarch64/test-framepointer-2.c: Likewise. * gcc.target/aarch64/test-framepointer-3.c: Likewise. * gcc.target/aarch64/test-framepointer-4.c: Likewise. * gcc.target/aarch64/test-framepointer-5.c: Likewise. * gcc.target/aarch64/test-framepointer-6.c: Likewise. * gcc.target/aarch64/test-framepointer-7.c: Likewise. * gcc.target/aarch64/test-framepointer-8.c: Likewise.Index: gcc/testsuite/gcc.target/aarch64/test-framepointer-2.c === --- gcc/testsuite/gcc.target/aarch64/test-framepointer-2.c (revision 0) +++ gcc/testsuite/gcc.target/aarch64/test-framepointer-2.c (revision 0) @@ -0,0 +1,15 @@ +/* { dg-do run } */ +/* { dg-options -O2 -fomit-frame-pointer -mno-omit-leaf-frame-pointer -fno-inline --save-temps } */ + +#include asm-adder-no-clobber-lr.c + +/* omit-frame-pointer is TRUE. + omit-leaf-frame-pointer is false, but irrelevant due to omit-frame-pointer. + LR is not being clobbered in the leaf. + + Since we asked to have no frame pointers anywhere, we expect no frame + record in main or the leaf. */ + +/* { dg-final { scan-assembler-not stp\tx29, x30, \\\[sp, -\[0-9\]+\\\]! } } */ + +/* { dg-final { cleanup-saved-temps } } */ Index: gcc/testsuite/gcc.target/aarch64/test-framepointer-6.c === --- gcc/testsuite/gcc.target/aarch64/test-framepointer-6.c (revision 0) +++ gcc/testsuite/gcc.target/aarch64/test-framepointer-6.c (revision 0) @@ -0,0 +1,15 @@ +/* { dg-do run } */ +/* { dg-options -O2 -fomit-frame-pointer -mno-omit-leaf-frame-pointer -fno-inline --save-temps } */ + +#include asm-adder-clobber-lr.c + +/* omit-frame-pointer is TRUE. + omit-leaf-frame-pointer is false, but irrelevant due to omit-frame-pointer. + LR is being clobbered in the leaf. + + Since we asked to have no frame pointers anywhere, we expect no frame + record in main or the leaf. */ + +/* { dg-final { scan-assembler-not stp\tx29, x30, \\\[sp, -\[0-9\]+\\\]! } } */ + +/* { dg-final { cleanup-saved-temps } } */ Index: gcc/testsuite/gcc.target/aarch64/test-framepointer-3.c === --- gcc/testsuite/gcc.target/aarch64/test-framepointer-3.c (revision 0) +++ gcc/testsuite/gcc.target/aarch64/test-framepointer-3.c (revision 0) @@ -0,0 +1,15 @@ +/* { dg-do run } */ +/* { dg-options -O2 -fomit-frame-pointer -momit-leaf-frame-pointer -fno-inline --save-temps } */ + +#include asm-adder-no-clobber-lr.c + +/* omit-frame-pointer is TRUE. + omit-leaf-frame-pointer is true, but irrelevant due to omit-frame-pointer. + LR is not being clobbered in the leaf. + + Since we asked to have no frame pointers anywhere, we expect no frame + record in main or the leaf. */ + +/* { dg-final { scan-assembler-not stp\tx29, x30, \\\[sp, -\[0-9\]+\\\]! } } */ + +/* { dg-final { cleanup-saved-temps } } */ Index: gcc/testsuite/gcc.target/aarch64/test-framepointer-7.c === --- gcc/testsuite/gcc.target/aarch64/test-framepointer-7.c (revision 0) +++ gcc/testsuite/gcc.target/aarch64/test-framepointer-7.c (revision 0) @@ -0,0 +1,15 @@ +/* { dg-do run } */ +/* { dg-options -O2 -fomit-frame-pointer -momit-leaf-frame-pointer -fno-inline --save-temps } */ + +#include asm-adder-clobber-lr.c + +/* omit-frame-pointer is TRUE. + omit-leaf-frame-pointer is true, but irrelevant due to omit-frame-pointer. + LR is being clobbered in the leaf. + + Since we asked to have no frame pointers anywhere, we expect no frame + record in main or the leaf. */ + +/* { dg-final { scan-assembler-not stp\tx29, x30, \\\[sp, -\[0-9\]+\\\]! } } */ + +/* { dg-final { cleanup-saved-temps } } */ Index: gcc/testsuite/gcc.target/aarch64/asm-adder-clobber-lr.c === --- gcc/testsuite/gcc.target/aarch64/asm-adder-clobber-lr.c (revision 0) +++ gcc/testsuite/gcc.target/aarch64/asm-adder-clobber-lr.c (revision 0) @@ -0,0 +1,24 @@ +extern void abort (void); +
C++ PATCH for c++/56728 (ICE with bogus constexpr function)
In this testcase we were crashing because after function argument substitution in the initialization for crashnkill we couldn't figure out how to simplify *(Inner*)4, so we went back to bridge2. It certainly doesn't make sense for the initializer to refer to a parameter for a function called in the initializer, so the back end correctly blew up. The cxx_eval_indirect_ref hunk addresses this by returning the expanded version of the operand rather than the original one. The other two hunks address the issue that the getInner function is not a valid constexpr function, because it involves a reinterpret_cast from integer to pointer. Tested x86_64-pc-linux-gnu, applying to trunk. commit 44cdacef5b56c91e2787f737f0ea90aa66790436 Author: Jason Merrill ja...@redhat.com Date: Wed Mar 27 14:16:14 2013 -0400 PR c++/56728 * semantics.c (potential_constant_expression_1) [NOP_EXPR]: Reject conversion from integer to pointer. (cxx_eval_constant_expression): Likewise. (cxx_eval_indirect_ref): Use the folded operand if we still think this might be constant. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 72b884e..0b8e2f7 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -7661,6 +7661,8 @@ cxx_eval_indirect_ref (const constexpr_call *call, tree t, if (r == NULL_TREE) { + if (addr op0 != orig_op0) + return build1 (INDIRECT_REF, TREE_TYPE (t), op0); if (!addr) VERIFY_CONSTANT (t); return t; @@ -8056,6 +8058,16 @@ cxx_eval_constant_expression (const constexpr_call *call, tree t, non_constant_p, overflow_p); if (*non_constant_p) return t; + if (POINTER_TYPE_P (TREE_TYPE (t)) + TREE_CODE (op) == INTEGER_CST + !integer_zerop (op)) + { + if (!allow_non_constant) + error_at (EXPR_LOC_OR_HERE (t), + reinterpret_cast from integer to pointer); + *non_constant_p = true; + return t; + } if (op == oldop) /* We didn't fold at the top so we could check for ptr-int conversion. */ @@ -8452,6 +8464,15 @@ potential_constant_expression_1 (tree t, bool want_rval, tsubst_flags_t flags) may change to something more specific to type-punning (DR 1312). */ { tree from = TREE_OPERAND (t, 0); + if (POINTER_TYPE_P (TREE_TYPE (t)) + TREE_CODE (from) == INTEGER_CST + !integer_zerop (from)) + { + if (flags tf_error) + error_at (EXPR_LOC_OR_HERE (t), + reinterpret_cast from integer to pointer); + return false; + } return (potential_constant_expression_1 (from, TREE_CODE (t) != VIEW_CONVERT_EXPR, flags)); } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-reinterpret1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-reinterpret1.C new file mode 100644 index 000..69db98b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-reinterpret1.C @@ -0,0 +1,37 @@ +// PR c++/56728 +// { dg-require-effective-target c++11 } + +class B { +public: + static B instance; + class Inner + { + public: +class Wuzi +{ + unsigned int m; +} m_Class[3]; +unsigned m_Int[4]; + }; + + constexpr static Inner getInner() + { +/* I am surprised this is considered a constexpr */ +return *((Inner *)4); + } // { dg-error reinterpret_cast } +}; + +B B::instance; + +class A +{ +public: + constexpr A(B bridge, B::Inner bridge2, unsigned char index) +: m_Bridge(bridge), m_Wuz(bridge2.m_Class[index]) + {} + + B m_Bridge; + B::Inner::Wuzi m_Wuz; +}; +A works{B::instance, B::getInner(), 3}; +A crashnkill[1]{{B::instance, B::getInner(), 3}};
C++ PATCH for c++/56710 (ICE with local variable __t in lambda)
The compiler was getting confused when an implicit capture added a __t class binding and then tried to pop the __t local variable. But we don't need to push the closure members as bindings at all, since we now use capture proxies for name resolution. The second patch fixes a -Wshadow issue I noticed while looking at this. Tested x86_64-pc-linux-gnu, applying to trunk. commit 03426fb7d994c8eb6bf7f1097c45f6079e8227d5 Author: Jason Merrill ja...@redhat.com Date: Wed Mar 27 15:47:58 2013 -0400 PR c++/56710 * semantics.c (finish_member_declaration): Don't push closure members. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 0b8e2f7..ad1c209 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2719,8 +2719,10 @@ finish_member_declaration (tree decl) /*friend_p=*/0); } } - /* Enter the DECL into the scope of the class. */ - else if (pushdecl_class_level (decl)) + /* Enter the DECL into the scope of the class, if the class + isn't a closure (whose fields are supposed to be unnamed). */ + else if (CLASSTYPE_LAMBDA_EXPR (current_class_type) + || pushdecl_class_level (decl)) { if (TREE_CODE (decl) == USING_DECL) { diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-names1.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-names1.C new file mode 100644 index 000..df2b037 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-names1.C @@ -0,0 +1,9 @@ +// PR c++/56710 +// { dg-options -std=c++11 -Wall } + +int main() +{ +int t = 0; +return []() - int {int __t; __t = t; return __t; }(); +return [t]() - int {int __t; __t = t; return __t; }(); +} commit db4f00892384f76f442401984007eb2a0b476eb2 Author: Jason Merrill ja...@redhat.com Date: Wed Mar 27 15:31:09 2013 -0400 * name-lookup.c (pushdecl_maybe_friend_1): Use nonlambda_method_basetype and current_nonlambda_class_type. diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 0a0915a..e2ef75b 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -1163,8 +1163,8 @@ pushdecl_maybe_friend_1 (tree x, bool is_friend) { tree member; - if (current_class_ptr) - member = lookup_member (current_class_type, + if (nonlambda_method_basetype ()) + member = lookup_member (current_nonlambda_class_type (), name, /*protect=*/0, /*want_type=*/false, diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-shadow2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-shadow2.C new file mode 100644 index 000..8237a81 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-shadow2.C @@ -0,0 +1,10 @@ +// { dg-options -std=c++11 -Wshadow } + +struct A +{ + int i; + void f() + { +[=]{ int i; }; // { dg-warning shadows } + } +};
C++ PATCH for c++/56701 (treating 'this' as an rvalue)
When 'this' appears in an expression, it should be an rvalue rather than a const lvalue; in C++11, the distinction matters. The cp_build_indirect_ref change is to avoid building extra copies of *this due to this change. Tested x86_64-pc-linux-gnu, applying to trunk. commit a668cad5042d5e499b4d3c78e40505d22f061e3a Author: Jason Merrill ja...@redhat.com Date: Wed Mar 27 16:04:00 2013 -0400 PR c++/56701 * semantics.c (finish_this_expr): 'this' is an rvalue. * typeck.c (cp_build_indirect_ref): Handle NOP_EXPR of 'this'. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index ad1c209..2fe2908 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2297,7 +2297,6 @@ finish_this_expr (void) result = lambda_expr_this_capture (CLASSTYPE_LAMBDA_EXPR (type)); else result = current_class_ptr; - } else if (current_function_decl DECL_STATIC_FUNCTION_P (current_function_decl)) @@ -2314,6 +2313,9 @@ finish_this_expr (void) result = error_mark_node; } + /* The keyword 'this' is a prvalue expression. */ + result = rvalue (result); + return result; } diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index a0caa30..fedcc6d 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -2843,7 +2843,11 @@ cp_build_indirect_ref (tree ptr, ref_operator errorstring, { tree pointer, type; - if (ptr == current_class_ptr) + if (ptr == current_class_ptr + || (TREE_CODE (ptr) == NOP_EXPR + TREE_OPERAND (ptr, 0) == current_class_ptr + (same_type_ignoring_top_level_qualifiers_p + (TREE_TYPE (ptr), TREE_TYPE (current_class_ptr) return current_class_ref; pointer = (TREE_CODE (TREE_TYPE (ptr)) == REFERENCE_TYPE diff --git a/gcc/testsuite/g++.dg/cpp0x/rv-this.C b/gcc/testsuite/g++.dg/cpp0x/rv-this.C new file mode 100644 index 000..8064a51 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/rv-this.C @@ -0,0 +1,7 @@ +// PR c++/56701 +// { dg-require-effective-target c++11 } + +struct A +{ + void f(){ A* a = this; } +};
C++ PATCH for c++/56679 (sizeof... of template template parameter pack)
The only valid operand for sizeof... is a single identifier, so it doesn't really make sense to share code with other forms of sizeof. Tested x86_64-pc-linux-gnu, applying to trunk. commit 8a4393fa57437072d140065b5949e3aa9c4674d6 Author: Jason Merrill ja...@redhat.com Date: Wed Mar 27 17:20:41 2013 -0400 PR c++/56679 * parser.c (cp_parser_sizeof_pack): Split out from... (cp_parser_sizeof_operand): ...here. Require (id). diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 5e2a4e0..ec6eb08 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -22618,6 +22618,44 @@ cp_parser_late_parsing_default_args (cp_parser *parser, tree fn) pop_unparsed_function_queues (parser); } +/* Subroutine of cp_parser_sizeof_operand, for handling C++11 + + sizeof ... ( identifier ) + + where the 'sizeof' token has already been consumed. */ + +static tree +cp_parser_sizeof_pack (cp_parser *parser) +{ + /* Consume the `...'. */ + cp_lexer_consume_token (parser-lexer); + maybe_warn_variadic_templates (); + + bool paren = cp_lexer_next_token_is (parser-lexer, CPP_OPEN_PAREN); + if (paren) +cp_lexer_consume_token (parser-lexer); + else +permerror (cp_lexer_peek_token (parser-lexer)-location, + %sizeof...% argument must be surrounded by parentheses); + + cp_token *token = cp_lexer_peek_token (parser-lexer); + tree name = cp_parser_identifier (parser); + tree expr = cp_parser_lookup_name_simple (parser, name, token-location); + if (expr == error_mark_node) +cp_parser_name_lookup_error (parser, name, expr, NLE_NULL, + token-location); + if (TREE_CODE (expr) == TYPE_DECL) +expr = TREE_TYPE (expr); + else if (TREE_CODE (expr) == CONST_DECL) +expr = DECL_INITIAL (expr); + expr = make_pack_expansion (expr); + + if (paren) +cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN); + + return expr; +} + /* Parse the operand of `sizeof' (or a similar operator). Returns either a TYPE or an expression, depending on the form of the input. The KEYWORD indicates which kind of expression we have @@ -22631,7 +22669,12 @@ cp_parser_sizeof_operand (cp_parser* parser, enum rid keyword) char *tmp; bool saved_integral_constant_expression_p; bool saved_non_integral_constant_expression_p; - bool pack_expansion_p = false; + + /* If it's a `...', then we are computing the length of a parameter + pack. */ + if (keyword == RID_SIZEOF + cp_lexer_next_token_is (parser-lexer, CPP_ELLIPSIS)) +return cp_parser_sizeof_pack (parser); /* Types cannot be defined in a `sizeof' expression. Save away the old message. */ @@ -22650,19 +22693,6 @@ cp_parser_sizeof_operand (cp_parser* parser, enum rid keyword) = parser-non_integral_constant_expression_p; parser-integral_constant_expression_p = false; - /* If it's a `...', then we are computing the length of a parameter - pack. */ - if (keyword == RID_SIZEOF - cp_lexer_next_token_is (parser-lexer, CPP_ELLIPSIS)) -{ - /* Consume the `...'. */ - cp_lexer_consume_token (parser-lexer); - maybe_warn_variadic_templates (); - - /* Note that this is an expansion. */ - pack_expansion_p = true; -} - /* Do not actually evaluate the expression. */ ++cp_unevaluated_operand; ++c_inhibit_evaluation_warnings; @@ -22702,9 +22732,6 @@ cp_parser_sizeof_operand (cp_parser* parser, enum rid keyword) /*attrlist=*/NULL); } } - else if (pack_expansion_p) -permerror (cp_lexer_peek_token (parser-lexer)-location, - %sizeof...% argument must be surrounded by parentheses); /* If the type-id production did not work out, then we must be looking at the unary-expression production. */ @@ -22712,10 +22739,6 @@ cp_parser_sizeof_operand (cp_parser* parser, enum rid keyword) expr = cp_parser_unary_expression (parser, /*address_p=*/false, /*cast_p=*/false, NULL); - if (pack_expansion_p) -/* Build a pack expansion. */ -expr = make_pack_expansion (expr); - /* Go back to evaluating expressions. */ --cp_unevaluated_operand; --c_inhibit_evaluation_warnings; diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-sizeof1.C b/gcc/testsuite/g++.dg/cpp0x/variadic-sizeof1.C new file mode 100644 index 000..2837c85 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic-sizeof1.C @@ -0,0 +1,11 @@ +// PR c++/56679 +// { dg-require-effective-target c++11 } + +template template typename class... Args +struct Foo { + static const int value = sizeof...(Args); +}; + +template typename struct Bar { }; + +const int test = FooBar::value; diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic76.C b/gcc/testsuite/g++.dg/cpp0x/variadic76.C index fb80244..ff0211d 100644 --- a/gcc/testsuite/g++.dg/cpp0x/variadic76.C +++ b/gcc/testsuite/g++.dg/cpp0x/variadic76.C @@ -4,8 +4,8 @@ templateint... N int foo () { - return sizeof... (N ()); // { dg-error cannot be used as a function } - return sizeof... (N) (); // {
Re: C++ PATCH for c++/52748 (N3276 change to decltype of function call)
The change to force instantiation to check for abstract return types broke this change; until the core SG has a chance to discuss the language inconsistency, I'm going to disable that instantiation in decltype context. Tested x86_64-pc-linux-gnu, applying to trunk. commit d84445fd99912ad25589975f3d5f2fadb08ff9f6 Author: Jason Merrill ja...@redhat.com Date: Thu Mar 28 11:21:47 2013 -0400 PR c++/17232 PR c++/52748 * typeck2.c (abstract_virtuals_error_sfinae): Don't complete the type if tf_decltype is set. * pt.c (fn_type_unification): Add decltype_p parm. (get_bindings): Adjust. * cp-tree.h: Adjust. * class.c (resolve_address_of_overloaded_function): Adjust. * call.c (add_template_candidate_real, print_z_candidate): Adjust. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index cff653f..ba3de10 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -2905,7 +2905,8 @@ add_template_candidate_real (struct z_candidate **candidates, tree tmpl, fn = fn_type_unification (tmpl, explicit_targs, targs, args_without_in_chrg, nargs_without_in_chrg, - return_type, strict, flags, false); + return_type, strict, flags, false, + complain tf_decltype); if (fn == error_mark_node) { @@ -3221,7 +3222,7 @@ print_z_candidate (location_t loc, const char *msgstr, r-u.template_unification.return_type, r-u.template_unification.strict, r-u.template_unification.flags, - true); + true, false); break; case rr_invalid_copy: inform (cloc, diff --git a/gcc/cp/class.c b/gcc/cp/class.c index b48b353..956d5aa 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -7253,7 +7253,7 @@ resolve_address_of_overloaded_function (tree target_type, instantiation = fn_type_unification (fn, explicit_targs, targs, args, nargs, target_ret_type, DEDUCE_EXACT, LOOKUP_NORMAL, - false); + false, false); if (instantiation == error_mark_node) /* Instantiation failed. */ continue; diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 36671d5..4e60946 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -5419,7 +5419,7 @@ extern tree instantiate_template (tree, tree, tsubst_flags_t); extern tree fn_type_unification (tree, tree, tree, const tree *, unsigned int, tree, unification_kind_t, int, - bool); + bool, bool); extern void mark_decl_instantiated (tree, int); extern int more_specialized_fn (tree, tree, int); extern void do_decl_instantiation (tree, tree); diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 59ecdcb..27e3ff8 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -14935,7 +14935,8 @@ fn_type_unification (tree fn, tree return_type, unification_kind_t strict, int flags, - bool explain_p) + bool explain_p, + bool decltype_p) { tree parms; tree fntype; @@ -14949,6 +14950,9 @@ fn_type_unification (tree fn, tree tinst; tree r = error_mark_node; + if (decltype_p) +complain |= tf_decltype; + /* In C++0x, it's possible to have a function template whose type depends on itself recursively. This is most obvious with decltype, but can also occur with enumeration scope (c++/48969). So we need to catch infinite @@ -17626,7 +17630,8 @@ get_bindings (tree fn, tree decl, tree explicit_args, bool check_rettype) args, ix, (check_rettype || DECL_CONV_FN_P (fn) ? TREE_TYPE (decl_type) : NULL_TREE), - DEDUCE_EXACT, LOOKUP_NORMAL, /*explain_p=*/false) + DEDUCE_EXACT, LOOKUP_NORMAL, /*explain_p=*/false, + /*decltype*/false) == error_mark_node) return NULL_TREE; diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 52bc4ec..cf42958 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -265,15 +265,15 @@ abstract_virtuals_error_sfinae (tree decl, tree type, abstract_class_use use, return 0; type = TYPE_MAIN_VARIANT (type); - /* In SFINAE context, force instantiation. */ - if (!(complain tf_error)) + /* In SFINAE, non-N3276 context, force instantiation. */ + if (!(complain (tf_error|tf_decltype))) complete_type (type); /* If the type is incomplete, we register it within a hash table, so that we can check again once it is completed. This makes sense only for objects for which we have a declaration or at least a name. */ - if (!COMPLETE_TYPE_P (type)) + if (!COMPLETE_TYPE_P (type) (complain tf_error)) { void **slot; struct pending_abstract_type *pat; diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype-call2.C b/gcc/testsuite/g++.dg/cpp0x/decltype-call2.C new file mode 100644 index 000..ad23220 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype-call2.C @@ -0,0 +1,7 @@ +// PR c++/52748 +// We don't want to instantiate AT here. +// { dg-require-effective-target c++11 } + +template class T struct A: T { }; +template class T AT f(T);
[PATCH 9/n, i386]: Merge *vec_extractv2di_1_rex64 with base pattern using x64 isa attribute
Hello! 2013-03-28 Uros Bizjak ubiz...@gmail.com * config/i386/i386.md (*vec_extract2vdi_1): Merge with *vec_extractv2di_1_rex64. Use x64 isa attribute. Tested on x86_64-pc-linux-gnu {,-m32} and committed to mainline SVN. Uros. Index: sse.md === --- sse.md (revision 197207) +++ sse.md (working copy) @@ -7426,31 +7426,12 @@ [(set (match_dup 0) (match_dup 1))] operands[1] = gen_rtx_REG (DImode, REGNO (operands[1]));) -(define_insn *vec_extractv2di_1_rex64 - [(set (match_operand:DI 0 nonimmediate_operand =m,x,x,x,r) - (vec_select:DI - (match_operand:V2DI 1 nonimmediate_operand x,0,x,o,o) - (parallel [(const_int 1)])))] - TARGET_64BIT !(MEM_P (operands[0]) MEM_P (operands[1])) - @ - %vmovhps\t{%1, %0|%0, %1} - psrldq\t{$8, %0|%0, 8} - vpsrldq\t{$8, %1, %0|%0, %1, 8} - %vmovq\t{%H1, %0|%0, %H1} - mov{q}\t{%H1, %0|%0, %H1} - [(set_attr isa *,noavx,avx,*,*) - (set_attr type ssemov,sseishft1,sseishft1,ssemov,imov) - (set_attr length_immediate *,1,1,*,*) - (set_attr memory *,none,none,*,*) - (set_attr prefix maybe_vex,orig,vex,maybe_vex,orig) - (set_attr mode V2SF,TI,TI,TI,DI)]) - (define_insn *vec_extractv2di_1 - [(set (match_operand:DI 0 nonimmediate_operand =m,x,x,x,x,x) + [(set (match_operand:DI 0 nonimmediate_operand =m,x,x,x,x,x,r) (vec_select:DI - (match_operand:V2DI 1 nonimmediate_operand x,0,x,o,x,o) + (match_operand:V2DI 1 nonimmediate_operand x,0,x,o,x,o,o) (parallel [(const_int 1)])))] - !TARGET_64BIT TARGET_SSE + (TARGET_64BIT || TARGET_SSE) !(MEM_P (operands[0]) MEM_P (operands[1])) @ %vmovhps\t{%1, %0|%0, %1} @@ -7458,13 +7439,14 @@ vpsrldq\t{$8, %1, %0|%0, %1, 8} %vmovq\t{%H1, %0|%0, %H1} movhlps\t{%1, %0|%0, %1} - movlps\t{%H1, %0|%0, %H1} - [(set_attr isa *,sse2_noavx,avx,sse2,noavx,noavx) - (set_attr type ssemov,sseishft1,sseishft1,ssemov,ssemov,ssemov) - (set_attr length_immediate *,1,1,*,*,*) - (set_attr memory *,none,none,*,*,*) - (set_attr prefix maybe_vex,orig,vex,maybe_vex,orig,orig) - (set_attr mode V2SF,TI,TI,TI,V4SF,V2SF)]) + movlps\t{%H1, %0|%0, %H1} + mov{q}\t{%H1, %0|%0, %H1} + [(set_attr isa *,sse2_noavx,avx,sse2,noavx,noavx,x64) + (set_attr type ssemov,sseishft1,sseishft1,ssemov,ssemov,ssemov,imov) + (set_attr length_immediate *,1,1,*,*,*,*) + (set_attr memory *,none,none,*,*,*,*) + (set_attr prefix maybe_vex,orig,vex,maybe_vex,orig,orig,orig) + (set_attr mode V2SF,TI,TI,TI,V4SF,V2SF,DI)]) (define_insn *vec_dupv4si [(set (match_operand:V4SI 0 register_operand =x,x,x)
Re: [patch, fortran, 4.9] Improve efficiency of array constructor operators
On 28.03.2013 17:11, Thomas Koenig wrote: Am 26.03.2013 18:17, schrieb Thomas Koenig: Hi Tobias, I have not yet looked at the patch, but I wonder whether that causes invalid code for if (any([a,b,c] f())) by evaluating f() multiple times. This is avoided by this part of the patch: [...] which results in code like this: __var_1 = f (); if ((a __var_1 || b __var_1) || c __var_1) Are there any other concerns, or can I commit this? Indeed, the code looks fine. OK for the trunk - see nits below. Thanks for the patch! On 24.03.2013 22:46, Thomas Koenig wrote: +} + /* Recursive optimization of operators. */ Another empty line missing. Tobias PS: Regarding the string comparison patch: As Janne, think it should be fine with also supporting kind=4 (don't forget to multiply the length by the kind, e.g. ts.kind or more properly (but equivalently) gfc_character_kinds[index].bit_size/BITS_PER_BYTE). As follow up, I think you could do what Ondřej suggested.
Re: [AArch64] Bitwise adds and subs instructions with shift
Hi, I'm not sure how good the coverage is from these test cases On 26/03/13 11:42, Hurugalawadi, Naveen wrote: (define_insn *addmode3_compare0 [(set (reg:CC_NZ CC_REGNUM) (compare:CC_NZ -(plus:GPI (match_operand:GPI 1 register_operand %r,r) +(plus:GPI (match_operand:GPI 1 register_operand %rk,rk) (match_operand:GPI 2 aarch64_plus_operand rI,J)) SP is not valid for ADDS shifted register form. (define_insn *addsi3_compare0_uxtw [(set (reg:CC_NZ CC_REGNUM) (compare:CC_NZ -(plus:SI (match_operand:SI 1 register_operand %r,r) +(plus:SI (match_operand:SI 1 register_operand %rk,rk) (match_operand:SI 2 aarch64_plus_operand rI,J)) Likewise. +(define_insn *adds_shift_mode + [(set (reg:CC_NZ CC_REGNUM) + (compare:CC_NZ +(plus:GPI (ASHIFT:GPI + (match_operand:GPI 1 register_operand r) + (match_operand:QI 2 aarch64_shift_imm_mode n)) + (match_operand:GPI 3 register_operand r)) +(const_int 0))) + (set (match_operand:GPI 0 register_operand =r) + (plus:GPI (ASHIFT:GPI (match_dup 1) (match_dup 2)) + (match_dup 3)))] + + adds\\t%w0, %w3, %w1, shift %2 + [(set_attr v8type alu_shift) alus_shift Looking at the output from the tests supplied below, I don;t think this pattern is tested. + (set_attr mode MODE)] +) + +;; zero_extend version of above +(define_insn *adds_shift_si_uxtw + [(set (reg:CC_NZ CC_REGNUM) + (compare:CC_NZ +(plus:SI (ASHIFT:SI + (match_operand:SI 1 register_operand r) + (match_operand:QI 2 aarch64_shift_imm_si n)) + (match_operand:SI 3 register_operand r)) +(const_int 0))) + (set (match_operand:DI 0 register_operand =r) + (zero_extend:DI (plus:SI (ASHIFT:SI (match_dup 1) (match_dup 2)) +(match_dup 3] + + adds\\t%w0, %w3, %w1, shift %2 + [(set_attr v8type alu_shift) alus_shift Likewise, does the test case below hit this pattern? +(define_insn *adds_mul_imm_mode + [(set (reg:CC_NZ CC_REGNUM) + (compare:CC_NZ +(plus:GPI (mult:GPI + (match_operand:GPI 1 register_operand r) + (match_operand:QI 2 aarch64_pwr_2_mode n)) + (match_operand:GPI 3 register_operand rk)) +(const_int 0))) + (set (match_operand:GPI 0 register_operand =r) + (plus:GPI (mult:GPI (match_dup 1) (match_dup 2)) + (match_dup 3)))] + + adds\\t%w0, %w3, %w1, lsl %p2 + [(set_attr v8type alu_shift) alus_shift +;; zero_extend version of above +(define_insn *adds_mul_imm_si_uxtw + [(set (reg:CC_NZ CC_REGNUM) + (compare:CC_NZ +(plus:SI (mult:SI + (match_operand:SI 1 register_operand r) + (match_operand:QI 2 aarch64_pwr_2_si n)) + (match_operand:SI 3 register_operand rk)) +(const_int 0))) + (set (match_operand:DI 0 register_operand =r) + (zero_extend:DI (plus:SI (mult:SI (match_dup 1) (match_dup 2)) +(match_dup 3] + + adds\\t%w0, %w3, %w1, lsl %p2 + [(set_attr v8type alu_shift) + (set_attr mode SI)] alus_shift Does this one have test coverage? + +(define_insn *subs_shift_mode + [(set (reg:CC_NZ CC_REGNUM) + (compare:CC_NZ +(minus:GPI (match_operand:GPI 1 register_operand r) + (ASHIFT:GPI +(match_operand:GPI 2 register_operand r) +(match_operand:QI 3 aarch64_shift_imm_mode n))) +(const_int 0))) + (set (match_operand:GPI 0 register_operand =r) + (minus:GPI (match_dup 1) + (ASHIFT:GPI (match_dup 2) (match_dup 3] + + subs\\t%w0, %w1, %w2, shift %3 + [(set_attr v8type alu_shift) alus_shift Does this one have test coverage? + (set_attr mode MODE)] +) + +;; zero_extend version of above +(define_insn *subs_shift_si_uxtw + [(set (reg:CC_NZ CC_REGNUM) + (compare:CC_NZ +(minus:SI (match_operand:SI 1 register_operand r) + (ASHIFT:SI + (match_operand:SI 2 register_operand r) + (match_operand:QI 3 aarch64_shift_imm_si n))) + (const_int 0))) + (set (match_operand:DI 0 register_operand =r) + (zero_extend:DI (minus:SI (match_dup 1) + (ASHIFT:SI (match_dup 2) (match_dup 3)] + + subs\\t%w0, %w1, %w2, shift %3 + [(set_attr v8type alu_shift) alus_shift Does this one have test coverage? + (set_attr mode SI)] +) + +(define_insn *subs_mul_imm_mode + [(set (reg:CC_NZ CC_REGNUM) + (compare:CC_NZ +(minus:GPI (match_operand:GPI 1 register_operand rk) + (mult:GPI +(match_operand:GPI 2 register_operand r) +(match_operand:QI 3 aarch64_pwr_2_mode n))) +(const_int 0))) + (set
Re: [PATCH AArch64] Make omit-frame-pointer work correctly
On 28/03/13 17:55, Ian Bolton wrote: Currently, if you compile with -fomit-frame-pointer, the frame record and frame pointer are still maintained (i.e. There is no way to get the behaviour you are asking for!). This patch fixes that. It also makes sure that if you ask for no frame pointers in leaf functions then they are not generated there unless LR gets clobbered in the leaf for some reason. (I have testcases here to check for that.) OK to commit to trunk? Cheers, Ian 2013-03-28 Ian Bolton ian.bol...@arm.com gcc/ * config/aarch64/aarch64.md (aarch64_can_eliminate): Only keep frame record when required. testsuite/ * gcc.target/aarch64/inc/asm-adder-clobber-lr.c: New test. * gcc.target/aarch64/inc/asm-adder-no-clobber-lr.c: Likewise. * gcc.target/aarch64/test-framepointer-1.c: Likewise. * gcc.target/aarch64/test-framepointer-2.c: Likewise. * gcc.target/aarch64/test-framepointer-3.c: Likewise. * gcc.target/aarch64/test-framepointer-4.c: Likewise. * gcc.target/aarch64/test-framepointer-5.c: Likewise. * gcc.target/aarch64/test-framepointer-6.c: Likewise. * gcc.target/aarch64/test-framepointer-7.c: Likewise. * gcc.target/aarch64/test-framepointer-8.c: Likewise. OK /Marcus
Re: *ping* [patch, fortran, 4.9] Dependency and string length calculation improvements
Le 28/03/2013 18:48, Tobias Burnus a écrit : Talking about dependencies, I wonder whether you would be interested implementing the function bool gfc_simply_noncontiguous (gfc_expr *); or something similarly named. It should return true, if the expression is known to be noncontiguous. I suggest having instead a single function returning a two bit integer, one bit for contiguous, one for noncontiguous. Mikael
Re: [patch, fortran, 4.9] Improve efficiency of array constructor operators
Hi Tobias, I have committed the two approved patches, with the issues that you have noted fixed. Thanks a lot for the reviews! PS: Regarding the string comparison patch: As Janne, think it should be fine with also supporting kind=4 (don't forget to multiply the length by the kind, e.g. ts.kind or more properly (but equivalently) gfc_character_kinds[index].bit_size/BITS_PER_BYTE). I'll do that. As follow up, I think you could do what Ondřej suggested. I will also take a look at that. Regards Thomas
Re: *ping* [patch, fortran, 4.9] Dependency and string length calculation improvements
Hi Tobias, Talking about dependencies, I wonder whether you would be interested implementing the function bool gfc_simply_noncontiguous (gfc_expr *); or something similarly named. If you will work on it, please tell me - Sounds interesting. I'll give it a shot. Thomas
Re: [PATCH, generic] Support printing of escaped curly braces and vertical bar in assembler output
I'd suggest rewriting this expression in some easier way: p += (*p == '%' *(p + 1)) ? 2 : 1; I'd prefer if (*p == '%') p++; p++; That's not the same thing though. Maksim's code is correct, although it could certainly be written more clearly. Maybe something like if (*p == '%') p++; if (*p) p++; Segher
Re: [Patch, Fortran] PR56737 - Fixing a bug in the I/O format cache handling
On 03/28/2013 03:21 AM, Tobias Burnus wrote: Tobias Burnus wrote: b) To copy the format string The attached patch does the latter. The current hashing algorithm avoids hash collisions by checking whether the value is exactly the same - and the value is given by the format string. Thus, instead of copying the string when storing the format in the cache, the patch copies it now before calling parse_format_list. Re-reading what Jerry wrote, I realized that the current code disables format caching for strings (but not for Holleriths). With my patch, that's no longer required. Attached is a missed-optimization patch. Bootstrapped and regtested on x86-64-gnu-linux. OK for the trunk and the 4.6/4.7/4.8 branches? (Or should the follow-up patch only applied to the trunk?) I would treat all as part of one patch fixing the original issue which was a known TODO: Please goto trunk first and give it some settling time. If all is OK, I would go ahead and backport. It does fix a regression. Jerry
Re: [Patch, Fortran] PR56735 - Fix namelist read regression with ?
On 03/28/2013 06:48 AM, Tobias Burnus wrote: gfortran supports ? and =? as input with namelists (a somewhat common vendor extension). Either of those can be used with stdin to print the available fields of the namelist. With non-stdin input, the ? and =? lines are simply ignored. However, two patches, one in 2008 and one in 2011 broke that feature. The first one broke the output of the namelist with stdin, the second caused that the namelist read is aborted (with iostat == 0) - and the namelist ist not read. The attached patch fixes this. GCC 4.6 to 4.9 are affected by the latter issue (for which the PR has been filled). The other issue affects 4.5 to 4.9 and only applies to stdin input, for which no output is shown when using ?. Build and regtested on x86-64-gnu-linux. OK for the trunk - and for GCC 4.6 to 4.8? Tobias Yes OK. Please test on the backports and allow it to settle on trunk for a bit before the backport. Jerry
[c++-concepts] Merge from trunk
The trunk was merged into the c++-concepts branch as of revision 197225. -- Gaby
Re: [patch] Unified debug dump function names.
On 3/28/13, Richard Biener richard.guent...@gmail.com wrote: The patch is ok as-is. Committed. -- Lawrence Crowl