[PATCH] Fix vector ABS_EXPR x = 0 folding (PR tree-optimization/55832)
Hi! While omit_one_operand_loc fold_converts the value to the right type, when type is vector, it is not possible to convert that way integer_one_node. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2013-01-03 Jakub Jelinek ja...@redhat.com Marc Glisse marc.gli...@inria.fr PR tree-optimization/55832 * fold-const.c (fold_binary_loc): For ABS_EXPRx = 0 and ABS_EXPRx 0 folding use constant_boolean_node instead of integer_{one,zero}_node. * gcc.c-torture/compile/pr55832.c: New test. --- gcc/fold-const.c.jj 2012-12-06 15:35:35.0 +0100 +++ gcc/fold-const.c2013-01-02 09:48:42.906797768 +0100 @@ -13519,7 +13519,9 @@ fold_binary_loc (location_t loc, when simplifying comparison of absolute value and zero), WARN_STRICT_OVERFLOW_CONDITIONAL); - return omit_one_operand_loc (loc, type, integer_one_node, arg0); + return omit_one_operand_loc (loc, type, + constant_boolean_node (true, type), + arg0); } /* Convert ABS_EXPRx 0 to false. */ @@ -13533,7 +13535,9 @@ fold_binary_loc (location_t loc, when simplifying comparison of absolute value and zero), WARN_STRICT_OVERFLOW_CONDITIONAL); - return omit_one_operand_loc (loc, type, integer_zero_node, arg0); + return omit_one_operand_loc (loc, type, + constant_boolean_node (false, type), + arg0); } /* If X is unsigned, convert X (1 Y) into X Y == 0 --- gcc/testsuite/gcc.c-torture/compile/pr55832.c.jj2013-01-02 10:00:53.271626853 +0100 +++ gcc/testsuite/gcc.c-torture/compile/pr55832.c 2013-01-02 10:00:44.0 +0100 @@ -0,0 +1,23 @@ +/* PR tree-optimization/55832 */ + +int g, b; + +void +foo (void) +{ + union U { int i; unsigned short s; } a = { 0 }; + unsigned char c; + unsigned short d = 0, *p = a.s; + + if (g) +a.i--; + + if (b a.i (d = 1)) +return; + + for (; a.i 15; a.i++) +b |= d = c; + + if (!*p) +g = 0; +} Jakub
[PATCH] Fix iv_number_of_iterations (PR rtl-optimization/55838)
Hi! When one (or both) IVs have extend_mode wider than mode, but step doesn't fit into mode (the IV is (subreg:MODE (plus:EXTEND_MODE base (mult:EXTEND_MODE i step)) lowpart) ), such as for EXTEND_MODE SImode, MODE QImode and step e.g. 129, 128, 256 or 517, iv_number_of_iterations can create invalid rtl. I think it is safe to just use the lowpart subreg of the step. The second hunk isn't enough, we use iv0.step resp. iv1.step directly in several other places in the routine, and the first hunk IMHO isn't enough either, if for the above extend_mode SI and mode QI iv1.step is 128, the first hunk will make -128 out of it, but then we negate it and get step 128 out of it again, not valid QImode CONST_INT, and use it e.g. as argument to UMOD. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? Or shall we just punt (either as done by H.J. in the PR, or in iv_number_of_iterations if the steps aren't valid mode CONST_INTs)? 2013-01-03 Jakub Jelinek ja...@redhat.com PR rtl-optimization/55838 * loop-iv.c (iv_number_of_iterations): Call lowpart_subreg on iv0.step, iv1.step and step. * gcc.dg/pr55838.c: New test. --- gcc/loop-iv.c.jj2012-10-22 08:42:25.0 +0200 +++ gcc/loop-iv.c 2013-01-02 09:17:42.215591646 +0100 @@ -2406,6 +2406,9 @@ iv_number_of_iterations (struct loop *lo iv1.step = const0_rtx; } + iv0.step = lowpart_subreg (mode, iv0.step, comp_mode); + iv1.step = lowpart_subreg (mode, iv1.step, comp_mode); + /* This is either infinite loop or the one that ends immediately, depending on initial values. Unswitching should remove this kind of conditions. */ if (iv0.step == const0_rtx iv1.step == const0_rtx) @@ -2516,6 +2519,7 @@ iv_number_of_iterations (struct loop *lo step = simplify_gen_unary (NEG, comp_mode, iv1.step, comp_mode); else step = iv0.step; + step = lowpart_subreg (mode, step, comp_mode); delta = simplify_gen_binary (MINUS, comp_mode, iv1.base, iv0.base); delta = lowpart_subreg (mode, delta, comp_mode); delta = simplify_gen_binary (UMOD, mode, delta, step); --- gcc/testsuite/gcc.dg/pr55838.c.jj 2012-11-17 15:43:17.572007394 +0100 +++ gcc/testsuite/gcc.dg/pr55838.c 2013-01-02 21:09:55.726580313 +0100 @@ -0,0 +1,13 @@ +/* PR rtl-optimization/55838 */ +/* { dg-do compile } */ +/* { dg-options -O2 -funroll-loops } */ + +int a; +unsigned char c; + +void +f (void) +{ + while (c++ 2) +c = a += 129; +} Jakub
Re: [PATCH] Fix vector ABS_EXPR x = 0 folding (PR tree-optimization/55832)
On Thu, 3 Jan 2013, Jakub Jelinek wrote: Hi! While omit_one_operand_loc fold_converts the value to the right type, when type is vector, it is not possible to convert that way integer_one_node. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? Ok. Thanks, Richard. 2013-01-03 Jakub Jelinek ja...@redhat.com Marc Glisse marc.gli...@inria.fr PR tree-optimization/55832 * fold-const.c (fold_binary_loc): For ABS_EXPRx = 0 and ABS_EXPRx 0 folding use constant_boolean_node instead of integer_{one,zero}_node. * gcc.c-torture/compile/pr55832.c: New test. --- gcc/fold-const.c.jj 2012-12-06 15:35:35.0 +0100 +++ gcc/fold-const.c 2013-01-02 09:48:42.906797768 +0100 @@ -13519,7 +13519,9 @@ fold_binary_loc (location_t loc, when simplifying comparison of absolute value and zero), WARN_STRICT_OVERFLOW_CONDITIONAL); - return omit_one_operand_loc (loc, type, integer_one_node, arg0); + return omit_one_operand_loc (loc, type, +constant_boolean_node (true, type), +arg0); } /* Convert ABS_EXPRx 0 to false. */ @@ -13533,7 +13535,9 @@ fold_binary_loc (location_t loc, when simplifying comparison of absolute value and zero), WARN_STRICT_OVERFLOW_CONDITIONAL); - return omit_one_operand_loc (loc, type, integer_zero_node, arg0); + return omit_one_operand_loc (loc, type, +constant_boolean_node (false, type), +arg0); } /* If X is unsigned, convert X (1 Y) into X Y == 0 --- gcc/testsuite/gcc.c-torture/compile/pr55832.c.jj 2013-01-02 10:00:53.271626853 +0100 +++ gcc/testsuite/gcc.c-torture/compile/pr55832.c 2013-01-02 10:00:44.0 +0100 @@ -0,0 +1,23 @@ +/* PR tree-optimization/55832 */ + +int g, b; + +void +foo (void) +{ + union U { int i; unsigned short s; } a = { 0 }; + unsigned char c; + unsigned short d = 0, *p = a.s; + + if (g) +a.i--; + + if (b a.i (d = 1)) +return; + + for (; a.i 15; a.i++) +b |= d = c; + + if (!*p) +g = 0; +} Jakub -- 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] Fix iv_number_of_iterations (PR rtl-optimization/55838)
On Thu, 3 Jan 2013, Jakub Jelinek wrote: Hi! When one (or both) IVs have extend_mode wider than mode, but step doesn't fit into mode (the IV is (subreg:MODE (plus:EXTEND_MODE base (mult:EXTEND_MODE i step)) lowpart) ), such as for EXTEND_MODE SImode, MODE QImode and step e.g. 129, 128, 256 or 517, iv_number_of_iterations can create invalid rtl. I think it is safe to just use the lowpart subreg of the step. The second hunk isn't enough, we use iv0.step resp. iv1.step directly in several other places in the routine, and the first hunk IMHO isn't enough either, if for the above extend_mode SI and mode QI iv1.step is 128, the first hunk will make -128 out of it, but then we negate it and get step 128 out of it again, not valid QImode CONST_INT, and use it e.g. as argument to UMOD. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? Truncating step is ok I think and so is the patch unless Zdenek has any comments in the next few days. Thanks, Richard. Or shall we just punt (either as done by H.J. in the PR, or in iv_number_of_iterations if the steps aren't valid mode CONST_INTs)? 2013-01-03 Jakub Jelinek ja...@redhat.com PR rtl-optimization/55838 * loop-iv.c (iv_number_of_iterations): Call lowpart_subreg on iv0.step, iv1.step and step. * gcc.dg/pr55838.c: New test. --- gcc/loop-iv.c.jj 2012-10-22 08:42:25.0 +0200 +++ gcc/loop-iv.c 2013-01-02 09:17:42.215591646 +0100 @@ -2406,6 +2406,9 @@ iv_number_of_iterations (struct loop *lo iv1.step = const0_rtx; } + iv0.step = lowpart_subreg (mode, iv0.step, comp_mode); + iv1.step = lowpart_subreg (mode, iv1.step, comp_mode); + /* This is either infinite loop or the one that ends immediately, depending on initial values. Unswitching should remove this kind of conditions. */ if (iv0.step == const0_rtx iv1.step == const0_rtx) @@ -2516,6 +2519,7 @@ iv_number_of_iterations (struct loop *lo step = simplify_gen_unary (NEG, comp_mode, iv1.step, comp_mode); else step = iv0.step; + step = lowpart_subreg (mode, step, comp_mode); delta = simplify_gen_binary (MINUS, comp_mode, iv1.base, iv0.base); delta = lowpart_subreg (mode, delta, comp_mode); delta = simplify_gen_binary (UMOD, mode, delta, step); --- gcc/testsuite/gcc.dg/pr55838.c.jj 2012-11-17 15:43:17.572007394 +0100 +++ gcc/testsuite/gcc.dg/pr55838.c2013-01-02 21:09:55.726580313 +0100 @@ -0,0 +1,13 @@ +/* PR rtl-optimization/55838 */ +/* { dg-do compile } */ +/* { dg-options -O2 -funroll-loops } */ + +int a; +unsigned char c; + +void +f (void) +{ + while (c++ 2) +c = a += 129; +} Jakub -- 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: C++ PATCH for c++/55804 (missing ctor call)
On Wed, Jan 2, 2013 at 7:31 PM, Jason Merrill ja...@redhat.com wrote: My earlier patch to force layout when re-building an array type caused problems because we weren't setting TYPE_NEEDS_CONSTRUCTING at the same time. So this attacks the problem in a different way: the underlying issue here is that we're attaching a variant (which has been laid out) to a previously built main variant (which hasn't). So now, when we do that we make sure to copy the layout information to the older variants. Tested x86_64-pc-linux-gnu, applying to trunk, 4.7 and 4.6. Much happier with this - especially for the release branch ... Thanks, Richard.
Re: [PATCH] Fix iv_number_of_iterations (PR rtl-optimization/55838)
Hi, When one (or both) IVs have extend_mode wider than mode, but step doesn't fit into mode (the IV is (subreg:MODE (plus:EXTEND_MODE base (mult:EXTEND_MODE i step)) lowpart) ), such as for EXTEND_MODE SImode, MODE QImode and step e.g. 129, 128, 256 or 517, iv_number_of_iterations can create invalid rtl. I think it is safe to just use the lowpart subreg of the step. The second hunk isn't enough, we use iv0.step resp. iv1.step directly in several other places in the routine, and the first hunk IMHO isn't enough either, if for the above extend_mode SI and mode QI iv1.step is 128, the first hunk will make -128 out of it, but then we negate it and get step 128 out of it again, not valid QImode CONST_INT, and use it e.g. as argument to UMOD. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? I think this is ok, Zdenek
Re: atomic update of profile counters (issue7000044)
On Thu, Jan 3, 2013 at 2:25 AM, Andrew Pinski pins...@gmail.com wrote: On Wed, Jan 2, 2013 at 5:15 PM, Rong Xu x...@google.com wrote: Hi, Here is a new patch. The only difference is to declare __atomic_fetch_add as weak. This is needed for targets without sync/atomic builtin support. The patch contains a call to the builtin regardless of the new options -fprofile-gen-atomic. This results in a unsat in these targets even for regular profile-gen built. With this new patch, if the user uses -fprofile-gen-atomic in these target, the generated code will seg fault. We think a better solution is to emit the builtin call only in these targets with the support, and give warning for non-supported target. But I did not find any target hook for this. Does anyone know how to do this? Why not use libatomic for those targets? Also note that not all targets support 'weak' linkage. Richard. Thanks, Andrew Pinski Thanks, -Rong On Fri, Dec 28, 2012 at 11:35 AM, Xinliang David Li davi...@google.com wrote: It would be great if this can make into gcc4.8. The patch has close to 0 impact on code stability. David On Fri, Dec 28, 2012 at 11:32 AM, Rong Xu x...@google.com wrote: Hi Honza, In the other thread of discussion (similar patch in google-4_7 branch), you said you were thinking if to let this patch into trunk in stage 3. Can you give some update? Thanks, -Rong On Fri, Dec 21, 2012 at 10:37 AM, Rong Xu x...@google.com wrote: On Fri, Dec 21, 2012 at 1:25 AM, Jan Hubicka hubi...@ucw.cz wrote: Hi, This patch adds support of atomic update of profiles counters. The goal is to improve the poor counter values for highly thread programs. The atomic update is under a new option -fprofile-gen-atomic=N N=0: default, no atomic update N=1: atomic update edge counters. N=2: atomic update some of value profile counters (currently indirect-call and one value profile). N=3: both edge counter and the above value profile counters. Other value: fall back to the default. This patch is a simple porting of the version in google-4_7 branch. It uses __atomic_fetch_add based on Andrew Pinski's suggestion. Note I did not apply to all the value profiles as the indirect-call profile is the most relevant one here. Test with bootstrap. Comments and suggestions are welcomed. Thanks, -Rong 2012-12-20 Rong Xu x...@google.com * libgcc/libgcov.c (__gcov_one_value_profiler_body_atomic): New function. Atomic update profile counters. (__gcov_one_value_profiler_atomic): Ditto. (__gcov_indirect_call_profiler_atomic): Ditto. * gcc/gcov-io.h: Macros for atomic update. * gcc/common.opt: New option. * gcc/tree-profile.c (gimple_init_edge_profiler): Atomic update profile counters. (gimple_gen_edge_profiler): Ditto. The patch looks resonable. Eventually we probably should provide rest of the value counters in thread safe manner. What happens on targets not having atomic operations? From http://gcc.gnu.org/onlinedocs/gcc/_005f_005fsync-Builtins.html#_005f_005fsync-Builtins, it says: If a particular operation cannot be implemented on the target processor, a warning is generated and a call an external function is generated. So I think there will be a warning and eventually a link error of unsat. Thanks, -Rong Honza
Re: RFA: Fix ICE on PARALLEL returns when expand builtins
On Wed, Jan 2, 2013 at 5:36 PM, Richard Sandiford rdsandif...@googlemail.com wrote: Richard Biener richard.guent...@gmail.com writes: On Sun, Dec 23, 2012 at 10:43 AM, Richard Sandiford rdsandif...@googlemail.com wrote: Some of the maths builtins can expand to a call followed by a bit of postprocessing. With 4.8's PARALLEL return optimisations, these embedded calls might return a PARALLEL of pseudos, but the postprocessing isn't prepared to deal with that. This leads to an ICE in builtins-53.c on n32 and n64 mips64-linux-gnu. One fix might have been to pass an explicit register target to the expand routines, but that target's only a hint. This patch instead adds an avoid_group_rtx function (named after gen_group_rtx) to convert PARALLELs to pseudos where necessary. I wondered whether it was really safe for expand_builtin_int_roundingfn_2 to pass target == const0_rtx as the ignore parameter to expand_call, given that we don't actually ignore the return value ourselves (even if the caller does). I suppose it is safe though, since expand_call will always return const0_rtx in that case, and this code is dealing with integer return values. Tested on mips64-linux-gnu. OK to install? Or is there a better way? You didn't add a testcase so I can't check myself It's gcc.dg/builtins-53.c. - but why isn't using force_reg enough here? I can imagine other cases than PARALLELs that are not well handled, no? Not sure either way TBH. Fortunately expanding your own calls seems to be pretty rare. But yeah, having force_reg (or I suppose force_operand) do it sounds good in principle. The problem is that the operation needs the type tree, which the force_* routines don't have. Hm? force_reg/operand only need a mode. I'm suggesting sth like Index: builtins.c === *** builtins.c (revision 194787) --- builtins.c (working copy) *** expand_builtin_int_roundingfn (tree exp, *** 2760,2765 --- 2760,2766 /* Truncate the result of floating point optab to integer via expand_fix (). */ + tmp = force_reg (TYPE_MODE (TREE_TYPE (TREE_TYPE (fallback_fndecl))), tmp); target = gen_reg_rtx (mode); expand_fix (target, tmp, 0); (I suppose we can even use force_reg (GET_MODE (tmp), tmp) here - it shouldn't be VOIDmode ever as its of FP type). Richard. Richard
Re: libgo patch committed: Update to current version of Go library
Hello! I've committed a patch to upgrade libgo to the current version of the master Go library. As usual, this mail message only includes the changes to files that are specific to gccgo. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. This caused massive testsuite problems on CentOS 5.8 due to missing utimensat. Practically all tests fail with: /home/uros/gcc-build/x86_64-unknown-linux-gnu/libgo/.libs/libgo.so: undefined reference to `utimensat' collect2: error: ld returned 1 exit status FAIL: bufio /home/uros/gcc-build/x86_64-unknown-linux-gnu/libgo/.libs/libgo.so: undefined reference to `utimensat' collect2: error: ld returned 1 exit status FAIL: bytes ... $ uname -a Linux omen7 2.6.18-308.11.1.el5xen #1 SMP Tue Jul 10 09:29:47 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux $ /lib/libc.so.6 GNU C Library stable release version 2.5, by Roland McGrath et al. Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Compiled by GNU CC version 4.1.2 20080704 (Red Hat 4.1.2-52). Compiled on a Linux 2.6.9 system on 2012-08-27. Available extensions: The C stubs add-on version 2.1.2. crypt add-on version 2.1 by Michael Glad and others GNU Libidn by Simon Josefsson GNU libio by Per Bothner NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk Native POSIX Threads Library by Ulrich Drepper et al BIND-8.2.3-T5B RT using linux kernel aio Thread-local storage support included. For bug reporting instructions, please see: http://www.gnu.org/software/libc/bugs.html. Uros.
Update printed Copyright notices
Hi! As every year, update printed Copyright notices in various locations. Committed to trunk. 2013-01-03 Jakub Jelinek ja...@redhat.com * gcc.c (process_command): Update copyright notice dates. * gcov.c (print_version): Likewise. * gcov-dump.c (print_version): Likewise. * gfortranspec.c (lang_specific_driver): Update copyright notice dates. * jcf-dump.c (version): Update copyright notice dates. * mf-runtime.c (__mf_usage): Update copyright notice dates. * gnu/java/rmi/registry/RegistryImpl.java (version): Update copyright notice dates. * tools/gnu/classpath/tools/orbd/Main.java (run): Likewise. * gnu/gcj/convert/Convert.java (version): Update copyright notice dates. * gnu/gcj/tools/gcj_dbtool/Main.java (main): Likewise. --- gcc/ChangeLog (revision 194837) +++ gcc/ChangeLog (working copy) @@ -1,5 +1,9 @@ 2013-01-03 Jakub Jelinek ja...@redhat.com + * gcc.c (process_command): Update copyright notice dates. + * gcov.c (print_version): Likewise. + * gcov-dump.c (print_version): Likewise. + PR rtl-optimization/55838 * loop-iv.c (iv_number_of_iterations): Call lowpart_subreg on iv0.step, iv1.step and step. --- gcc/fortran/ChangeLog (revision 194837) +++ gcc/fortran/ChangeLog (working copy) @@ -1,3 +1,8 @@ +2013-01-03 Jakub Jelinek ja...@redhat.com + + * gfortranspec.c (lang_specific_driver): Update copyright notice + dates. + 2012-12-28 Janus Weil ja...@gcc.gnu.org PR fortran/55692 --- gcc/fortran/gfortranspec.c (revision 194837) +++ gcc/fortran/gfortranspec.c (working copy) @@ -1,6 +1,6 @@ /* Specific flags and argument handling of the Fortran front-end. Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010, 2011, 2012 + 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc. This file is part of GCC. @@ -301,7 +301,7 @@ lang_specific_driver (struct cl_decoded_ case OPT__version: printf (GNU Fortran %s%s\n, pkgversion_string, version_string); - printf (Copyright %s 2012 Free Software Foundation, Inc.\n\n, + printf (Copyright %s 2013 Free Software Foundation, Inc.\n\n, _((C))); printf (_(GNU Fortran comes with NO WARRANTY, to the extent permitted by law.\n\ You may redistribute copies of GNU Fortran\n\ --- gcc/gcc.c (revision 194837) +++ gcc/gcc.c (working copy) @@ -1,7 +1,7 @@ /* Compiler driver program that can handle many languages. Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, - 2010, 2011, 2012 + 2010, 2011, 2012, 2013 Free Software Foundation, Inc. This file is part of GCC. @@ -6714,7 +6714,7 @@ main (int argc, char **argv) { printf (_(%s %s%s\n), progname, pkgversion_string, version_string); - printf (Copyright %s 2012 Free Software Foundation, Inc.\n, + printf (Copyright %s 2013 Free Software Foundation, Inc.\n, _((C))); fputs (_(This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n), --- gcc/gcov-dump.c (revision 194837) +++ gcc/gcov-dump.c (working copy) @@ -1,6 +1,6 @@ /* Dump a gcov file, for debugging use. Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, - 2012 Free Software Foundation, Inc. + 2012, 2013 Free Software Foundation, Inc. Contributed by Nathan Sidwell nat...@codesourcery.com Gcov is free software; you can redistribute it and/or modify @@ -135,7 +135,7 @@ static void print_version (void) { printf (gcov-dump %s%s\n, pkgversion_string, version_string); - printf (Copyright (C) 2012 Free Software Foundation, Inc.\n); + printf (Copyright (C) 2013 Free Software Foundation, Inc.\n); printf (This is free software; see the source for copying conditions.\n There is NO warranty; not even for MERCHANTABILITY or \n FITNESS FOR A PARTICULAR PURPOSE.\n\n); --- gcc/gcov.c (revision 194837) +++ gcc/gcov.c (working copy) @@ -1,7 +1,8 @@ /* Gcov.c: prepend line execution counts and branch probabilities to a source file. Copyright (C) 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, + 2012, 2013 Free Software Foundation, Inc. Contributed by James E. Wilson of Cygnus Support. Mangled by Bob Manson of Cygnus Support. @@ -489,7 +490,7 @@ static void print_version (void) { fnotice (stdout, gcov %s%s\n, pkgversion_string, version_string); - fprintf (stdout, Copyright %s 2012 Free Software Foundation, Inc.\n, + fprintf (stdout,
[PATCH] ChangeLog rotation
Hi! I've rotated ChangeLogs where we have ChangeLog-20NN files, patch too large for the mailing list even after bzip2, so just look at http://gcc.gnu.org/viewcvs?root=gccview=revrev=194840 for details. Jakub
Re: [C++ Patch] PR 54526 (again)
Hi, On 01/02/2013 11:07 AM, Jakub Jelinek wrote: Hi! On Sun, Oct 28, 2012 at 12:27:40PM +0100, Paolo Carlini wrote: --- gcc/cp/parser.c (revision 192887) +++ gcc/cp/parser.c (working copy) @@ -12655,9 +12655,8 @@ cp_parser_template_id (cp_parser *parser, /* Otherwise, emit an error about the invalid digraph, but continue parsing because we got our argument list. In C++11 do not emit any error, per 2.5/3. */ Shouldn't the In C++11 do not emit... sentence be removed from the comment as well? --- libcpp/lex.c(revision 192887) +++ libcpp/lex.c(working copy) @@ -2291,6 +2291,25 @@ _cpp_lex_direct (cpp_reader *pfile) if (*buffer-cur == ':') { buffer-cur++; + + /* C++11 - 2.5 p3, bullet 2. */ + if (CPP_OPTION (pfile, cplusplus) + (CPP_OPTION (pfile, lang) == CLK_CXX11 + || CPP_OPTION (pfile, lang) == CLK_GNUCXX11)) + { + if (*buffer-cur == ':') + { + buffer-cur++; + if (*buffer-cur != ':' *buffer-cur != '') + { + --buffer-cur; + --buffer-cur; + break; + } + --buffer-cur; I'd say way too many ++/-- above. I'd write it as: - buffer-cur++; + + /* C++11 - 2.5 p3, bullet 2. */ + if (CPP_OPTION (pfile, cplusplus) + (CPP_OPTION (pfile, lang) == CLK_CXX11 + || CPP_OPTION (pfile, lang) == CLK_GNUCXX11) + buffer-cur[1] == ':' + buffer-cur[2] != ':' buffer-cur[2] != '') + break; + + buffer-cur++; Agreed, thanks for your review Jakub. Thus I booted and tested succesfully the below version of the patch. Shall we apply it or it's late for 4.8.0? Thanks! Paolo. /// Index: gcc/cp/parser.c === --- gcc/cp/parser.c (revision 194839) +++ gcc/cp/parser.c (working copy) @@ -12655,11 +12655,9 @@ cp_parser_template_id (cp_parser *parser, return error_mark_node; } /* Otherwise, emit an error about the invalid digraph, but continue -parsing because we got our argument list. In C++11 do not emit -any error, per 2.5/3. */ - if (cxx_dialect cxx0x - permerror (next_token-location, - %::% cannot begin a template-argument list)) +parsing because we got our argument list. */ + if (permerror (next_token-location, +%::% cannot begin a template-argument list)) { static bool hint = false; inform (next_token-location, Index: gcc/testsuite/g++.dg/cpp0x/parse2.C === --- gcc/testsuite/g++.dg/cpp0x/parse2.C (revision 194839) +++ gcc/testsuite/g++.dg/cpp0x/parse2.C (working copy) @@ -10,3 +10,6 @@ int main() { X::A x; } + +int a; +bool b = 0::a; Index: gcc/testsuite/g++.old-deja/g++.other/crash28.C === --- gcc/testsuite/g++.old-deja/g++.other/crash28.C (revision 194839) +++ gcc/testsuite/g++.old-deja/g++.other/crash28.C (working copy) @@ -31,5 +31,5 @@ class foo }; void foo::x() throw(bar) { - if (!b) throw bar (static_cast::N::X*(this)); // { dg-error lambda expressions|expected } parse error + if (!b) throw bar (static_cast::N::X*(this)); // { dg-error lambda expressions|expected|invalid } parse error } Index: libcpp/lex.c === --- libcpp/lex.c(revision 194839) +++ libcpp/lex.c(working copy) @@ -2290,7 +2290,16 @@ _cpp_lex_direct (cpp_reader *pfile) { if (*buffer-cur == ':') { + /* C++11 - 2.5 p3, bullet 2. */ + if (CPP_OPTION (pfile, cplusplus) + (CPP_OPTION (pfile, lang) == CLK_CXX11 + || CPP_OPTION (pfile, lang) == CLK_GNUCXX11) + buffer-cur[1] == ':' + buffer-cur[2] != ':' buffer-cur[2] != '') + break; + buffer-cur++; + result-flags |= DIGRAPH; result-type = CPP_OPEN_SQUARE; }
[Ada] Class-wide objects and debugging information
If an object has a class-wide type and a renaming declaration is created for it, the original object and the one in the renaming declaration are exchanged so that source information is consistent. The exchange must preserve the entity chain, which already contains generated internal types. This ensures that freezing actions are properly generated for all objects declared subsequently in the same scope, and that debugging information is generated for them. No simple example available. Tested on x86_64-pc-linux-gnu, committed on trunk 2013-01-03 Ed Schonberg schonb...@adacore.com * exp_ch3.adb (Expand_N_Object_Declaration): If the object has a class-wide type and a renaming declaration is created for it, preserve entity chain, which already contains generated internal types. This ensures that freezing actions are properly generated for all objects declared subsequently in the same scope, and that debugging information is generated for them. * sem_util.adb, sem_util.ads (we): New debugging routine, to display entity chain of a given scope. Index: sem_ch8.adb === --- sem_ch8.adb (revision 194841) +++ sem_ch8.adb (working copy) @@ -8531,4 +8531,21 @@ end loop; end ws; + + -- we -- + + + procedure we (S : Entity_Id) is + E : Entity_Id; + begin + E := First_Entity (S); + while Present (E) loop + Write_Int (Int (E)); + Write_Str ( === ); + Write_Name (Chars (E)); + Write_Eol; + + Next_Entity (E); + end loop; + end we; end Sem_Ch8; Index: sem_ch8.ads === --- sem_ch8.ads (revision 194841) +++ sem_ch8.ads (working copy) @@ -169,4 +169,7 @@ procedure ws; -- Debugging routine for use in gdb: dump all entities on scope stack + procedure we (S : Entity_Id); + -- Debugging routine for use in gdb: dump all entities in given scope + end Sem_Ch8; Index: exp_ch3.adb === --- exp_ch3.adb (revision 194841) +++ exp_ch3.adb (working copy) @@ -5315,33 +5315,38 @@ Subtype_Mark= New_Occurrence_Of (Typ, Loc), Name = Convert_Tag_To_Interface (Typ, Tag_Comp))); - -- If the original entity comes from source, then mark the - -- new entity as needing debug information, even though it's - -- defined by a generated renaming that does not come from - -- source, so that Materialize_Entity will be set on the - -- entity when Debug_Renaming_Declaration is called during - -- analysis. - - if Comes_From_Source (Def_Id) then - Set_Debug_Info_Needed (Defining_Identifier (N)); - end if; - Analyze (N, Suppress = All_Checks); -- Replace internal identifier of rewritten node by the -- identifier found in the sources. We also have to exchange -- entities containing their defining identifiers to ensure -- the correct replacement of the object declaration by this - -- object renaming declaration ---because these identifiers + -- object renaming declaration because these identifiers -- were previously added by Enter_Name to the current scope. -- We must preserve the homonym chain of the source entity -- as well. We must also preserve the kind of the entity, - -- which may be a constant. + -- which may be a constant. Preserve entity chain because + -- itypes may have been generated already, and the full + -- chain must be preserved for final freezing. Finally, + -- Preserve Comes_From_Source setting, so that debugging + -- and cross-referencing information is properly kept. - Set_Chars (Defining_Identifier (N), Chars (Def_Id)); - Set_Homonym (Defining_Identifier (N), Homonym (Def_Id)); - Set_Ekind (Defining_Identifier (N), Ekind (Def_Id)); - Exchange_Entities (Defining_Identifier (N), Def_Id); + declare + New_Id: constant Entity_Id := Defining_Identifier (N); + Next_Temp : constant Entity_Id := Next_Entity (New_Id); + S_Flag: constant Boolean := + Comes_From_Source (Def_Id); + + begin + Set_Next_Entity (New_Id, Next_Entity (Def_Id)); + Set_Next_Entity (Def_Id, Next_Temp); + Set_Chars (Defining_Identifier
[Ada] Wrong visibility for root library unit
This change fixes a defect in the visibility rules whereby a root library unit that appears indirectly in the closure is erroneously treated as visible if referred to using an expanded name with prefix Standard. Root library units must be treated no different than child units for visibility purposes, as they are all children of predefined package Standard. The following compilation must be rejected with the indicated error message: $ gcc -c root_visibility.adb root_visibility.adb:3:18: U1 is not a visible entity of Standard with U2; procedure Root_Visibility is Self : Standard.U1.Address; begin Self := 123; end; with U1; package U2 is end; package U1 is type Address is mod 2**32; end; Tested on x86_64-pc-linux-gnu, committed on trunk 2013-01-03 Thomas Quinot qui...@adacore.com * sem_ch7.adb, sem_ch10.adb, einfo.adb, einfo.ads, sem_ch12.adb, rtsfind.adb, sem_elab.adb, sem_ch4.adb, sem_ch8.adb (Einfo.Is_Visible_Child_Unit, Einfo.Set_Is_Visible_Child_Unit): Rename to Is_Visible_Lib_Unit, Set_Is_Visible_Lib_Unit, and update spec accordingly (now also applies to root library units). (Sem_Ch10.Analyze_Subunit.Analyze_Subunit_Context): Toggle above flag on root library units, not only child units. (Sem_Ch10.Install[_Limited]_Withed_Unit): Same. (Sem_Ch10.Remove_Unit_From_Visibility): Reset Is_Visible_Lib_Unit even for root library units. (Sem_Ch8.Find_Expanded_Name): A selected component form whose prefix is Standard is an expanded name for a root library unit. Index: sem_ch7.adb === --- sem_ch7.adb (revision 194841) +++ sem_ch7.adb (working copy) @@ -2253,7 +2253,7 @@ if Is_Child_Unit (Id) then Set_Is_Potentially_Use_Visible -(Id, Is_Visible_Child_Unit (Id)); +(Id, Is_Visible_Lib_Unit (Id)); else Set_Is_Potentially_Use_Visible (Id); end if; Index: sem_ch10.adb === --- sem_ch10.adb(revision 194841) +++ sem_ch10.adb(working copy) @@ -2040,9 +2040,15 @@ end if; Unit_Name := Entity (Name (Item)); - while Is_Child_Unit (Unit_Name) loop -Set_Is_Visible_Child_Unit (Unit_Name); + loop +Set_Is_Visible_Lib_Unit (Unit_Name); +exit when Scope (Unit_Name) = Standard_Standard; Unit_Name := Scope (Unit_Name); + +if No (Unit_Name) then + Check_Error_Detected; + return; +end if; end loop; if not Is_Immediately_Visible (Unit_Name) then @@ -2083,8 +2089,9 @@ and then not Error_Posted (Item) then Unit_Name := Entity (Name (Item)); - while Is_Child_Unit (Unit_Name) loop - Set_Is_Visible_Child_Unit (Unit_Name, False); + loop + Set_Is_Visible_Lib_Unit (Unit_Name, False); + exit when Scope (Unit_Name) = Standard_Standard; Unit_Name := Scope (Unit_Name); end loop; @@ -2131,7 +2138,7 @@ E := First_Entity (Current_Scope); while Present (E) loop if not Is_Child_Unit (E) - or else Is_Visible_Child_Unit (E) + or else Is_Visible_Lib_Unit (E) then Set_Is_Immediately_Visible (E); end if; @@ -2296,11 +2303,9 @@ C : Entity_Id; begin C := Current_Scope; -while Present (C) - and then Is_Child_Unit (C) -loop +while Present (C) and then C /= Standard_Standard loop Set_Is_Immediately_Visible (C); - Set_Is_Visible_Child_Unit (C); + Set_Is_Visible_Lib_Unit (C); C := Scope (C); end loop; end; @@ -4210,7 +4215,7 @@ end In_Context; begin - Set_Is_Visible_Child_Unit (Id, In_Context); + Set_Is_Visible_Lib_Unit (Id, In_Context); end; end if; end if; @@ -4788,7 +4793,7 @@ if Analyzed (P_Unit) and then (Is_Immediately_Visible (P) -or else (Is_Child_Package and then Is_Visible_Child_Unit (P))) +or else (Is_Child_Package and then Is_Visible_Lib_Unit (P))) then -- The presence of both the limited and the analyzed nonlimited view @@ -4852,10 +4857,10 @@ Set_Ekind (P, E_Package); Set_Etype (P, Standard_Void_Type); Set_Scope (P,
[Ada] gnatfind missing references to array types
The format for the ALI file has evolved and now lists the information for both the index and the component type for array types. However, gnatfind and gnatxref do not correctly parse this information and consider the corresponding line as invalid, resulting in missing references. With the following example: with GNATCOLL.SQL.Exec; use GNATCOLL.SQL.Exec; procedure Debug_Books is Param : SQL_Parameters := (1 = +23); begin null; end Debug_Books; gnatfind must list a reference to SQL_Parameters. Tested on x86_64-pc-linux-gnu, committed on trunk 2013-01-03 Emmanuel Briot br...@adacore.com * xref_lib.adb (Parse_Identifier_Info): Fix handling of arrays, which have information in the ALI file for both the index and the component types. Index: xref_lib.adb === --- xref_lib.adb(revision 194841) +++ xref_lib.adb(working copy) @@ -925,10 +925,11 @@ end; end if; - if Ali (Ptr) = '' -or else Ali (Ptr) = '(' -or else Ali (Ptr) = '{' - then + while Ptr = Ali'Last + and then (Ali (Ptr) = '' + or else Ali (Ptr) = '(' + or else Ali (Ptr) = '{') + loop -- Here we have a type derivation information. The format is -- 3|12I45 which means that the current entity is derived from the -- type defined in unit number 3, line 12 column 45. The pipe and @@ -1065,7 +1066,7 @@ end loop; Ptr := Ptr + 1; end if; - end if; + end loop; -- To find the body, we will have to parse the file too
[Ada] 2012 rule on aliasing
Ongoing work to implement AI05-0144. No test needed. Tested on x86_64-pc-linux-gnu, committed on trunk 2013-01-03 Javier Miranda mira...@adacore.com * sem_warn.adb (Warn_On_Overlapping_Actuals): Adding documentation plus restricting the functionality of this routine to cover the cases described in the Ada 2012 reference manual. The previous extended support is now available under -gnatX. * s-tassta.adb (Finalize_Global_Tasks): Addition of a dummy variable to call Timed_Sleep. Required to avoid warning on overlapping out-mode actuals. * opt.ads (Extensions_Allowed): Update documentation. Index: s-tassta.adb === --- s-tassta.adb(revision 194841) +++ s-tassta.adb(working copy) @@ -806,8 +806,9 @@ procedure Finalize_Global_Tasks is Self_ID : constant Task_Id := STPO.Self; - Ignore : Boolean; - pragma Unreferenced (Ignore); + Ignore_1 : Boolean; + Ignore_2 : Boolean; + pragma Unreferenced (Ignore_1, Ignore_2); function State (Int : System.Interrupt_Management.Interrupt_ID) return Character; @@ -877,7 +878,7 @@ Timed_Sleep (Self_ID, 0.01, System.OS_Primitives.Relative, - Self_ID.Common.State, Ignore, Ignore); + Self_ID.Common.State, Ignore_1, Ignore_2); end loop; end if; @@ -886,7 +887,7 @@ Timed_Sleep (Self_ID, 0.01, System.OS_Primitives.Relative, - Self_ID.Common.State, Ignore, Ignore); + Self_ID.Common.State, Ignore_1, Ignore_2); Unlock (Self_ID); Index: sem_warn.adb === --- sem_warn.adb(revision 194841) +++ sem_warn.adb(working copy) @@ -3292,41 +3292,89 @@ Act1, Act2 : Node_Id; Form1, Form2 : Entity_Id; + function Is_Covered_Formal (Formal : Node_Id) return Boolean; + -- Return True if Formal is covered by the Ada 2012 rule. Under -gnatX + -- the rule is extended to cover record and array types. + + function Refer_Same_Object (Act1, Act2 : Node_Id) return Boolean; + -- Two names are known to refer to the same object if the two names + -- are known to denote the same object; or one of the names is a + -- selected_component, indexed_component, or slice and its prefix is + -- known to refer to the same object as the other name; or one of the + -- two names statically denotes a renaming declaration whose renamed + -- object_name is known to refer to the same object as the other name + -- (RM 6.4.1(6.11/3)) + + --- + -- Refer_Same_Object -- + --- + + function Refer_Same_Object (Act1, Act2 : Node_Id) return Boolean is + begin + return Denotes_Same_Object (Act1, Act2) + or else Denotes_Same_Prefix (Act1, Act2); + end Refer_Same_Object; + + --- + -- Is_Covered_Formal -- + --- + + function Is_Covered_Formal (Formal : Node_Id) return Boolean is + begin + -- Ada 2012 rule + + if not Extensions_Allowed then +return + Ekind_In (Formal, E_Out_Parameter, +E_In_Out_Parameter) +and then Is_Elementary_Type (Etype (Formal)); + + -- Under -gnatX the rule is extended to cover array and record types + + else +return + Ekind_In (Formal, E_Out_Parameter, +E_In_Out_Parameter) +and then (Is_Elementary_Type (Etype (Formal)) +or else Is_Record_Type (Etype (Formal)) +or else Is_Array_Type (Etype (Formal))); + end if; + end Is_Covered_Formal; + begin - if not Warn_On_Overlap then + if Ada_Version Ada_2012 and then not Warn_On_Overlap then return; end if; -- Exclude calls rewritten as enumeration literals - if Nkind (N) not in N_Subprogram_Call then + if Nkind (N) not in N_Subprogram_Call +and then Nkind (N) /= N_Entry_Call_Statement + then return; end if; - -- Exclude calls to library subprograms. Container operations specify - -- safe behavior when source and target coincide. + -- If a call C has two or more parameters of mode in out or out that are + -- of an elementary type, then the call is legal only if for each name + -- N that is passed as a parameter of mode in out or out to the call C, + -- there is no other name among the other parameters of mode in out or + -- out to C that is known to denote the same object (RM 6.4.1(6.15/3)) - if Is_Predefined_File_Name - (Unit_File_Name (Get_Source_Unit (Sloc (Subp
[Ada] Incorrect attachment point for address clause alignment check
The alignment check for an address clause must be inserted after the object has been elaborated in the GIGI sense, but before any initialization operation occur. This change fixes both the spec and implementation of Apply_Address_Clause_Check to this effect (previously they disagreed, and were both incorrect: following the spec would have cause the check to occur too early, before the alignment of the object can be accurately determined, while the implementation would insert it too late, after initialization is done). The following compilation must be accepted quietly and produce the indicated exception occurrence: $ gnatmake -q -gnatws addr_init_misaligned $ ./addr_init_misaligned raised PROGRAM_ERROR : addr_init_misaligned.adb:23 misaligned address value with System.Storage_Elements; with Ada.Text_IO; use Ada.Text_IO; procedure Addr_Init_Misaligned is Misaligned : constant System.Address := System.Storage_Elements.To_Address (1); function F return Integer is begin Put_Line (must not be called!); return 666; end F; type R is record Comp_I : Integer := F; comp_S : String (1 .. 10); end record; X : R; -- The init proc should never be evaluated because the address clause -- is misaligned. for X'Address use Misaligned; begin Put_Line (must not be executed (PE raised)); end; Tested on x86_64-pc-linux-gnu, committed on trunk 2013-01-03 Thomas Quinot qui...@adacore.com * checks.adb, checks.ads (Apply_Address_Clause_Check): The check must be generated at the start of the freeze actions for the entity, not before (or after) the freeze node. Index: checks.adb === --- checks.adb (revision 194841) +++ checks.adb (working copy) @@ -575,6 +575,8 @@ procedure Apply_Address_Clause_Check (E : Entity_Id; N : Node_Id) is + pragma Assert (Nkind (N) = N_Freeze_Entity); + AC : constant Node_Id:= Address_Clause (E); Loc : constant Source_Ptr := Sloc (AC); Typ : constant Entity_Id := Etype (E); @@ -734,7 +736,11 @@ Remove_Side_Effects (Expr); end if; - Insert_After_And_Analyze (N, + if No (Actions (N)) then +Set_Actions (N, New_List); + end if; + + Prepend_To (Actions (N), Make_Raise_Program_Error (Loc, Condition = Make_Op_Ne (Loc, @@ -745,11 +751,11 @@ (RTE (RE_Integer_Address), Expr), Right_Opnd = Make_Attribute_Reference (Loc, - Prefix = New_Occurrence_Of (E, Loc), + Prefix = New_Occurrence_Of (E, Loc), Attribute_Name = Name_Alignment)), Right_Opnd = Make_Integer_Literal (Loc, Uint_0)), - Reason = PE_Misaligned_Address_Value), - Suppress = All_Checks); + Reason = PE_Misaligned_Address_Value)); + Analyze (First (Actions (N)), Suppress = All_Checks); return; end if; Index: checks.ads === --- checks.ads (revision 194841) +++ checks.ads (working copy) @@ -131,8 +131,11 @@ -- are enabled, then this procedure generates a check that the specified -- address has an alignment consistent with the alignment of the object, -- raising PE if this is not the case. The resulting check (if one is - -- generated) is inserted before node N. check is also made for the case of - -- a clear overlay situation that the size of the overlaying object is not + -- generated) is prepended to the Actions list of N_Freeze_Entity node N. + -- Note that the check references E'Alignment, so it cannot be emitted + -- before N (its freeze node), otherwise this would cause an illegal + -- access before elaboration error in GIGI. For the case of a clear overlay + -- situation, we also check that the size of the overlaying object is not -- larger than the overlaid object. procedure Apply_Arithmetic_Overflow_Check (N : Node_Id);
[Ada] GNAT driver with a project file and a single main - switches
When the GNAT driver is called with a project file and a single main specified as an absolute path, the specific switches that are declared for the main source were not taken into account. This patch fixes this. The specific switches are now taken into account. Example: prj.gpr: project Prj is package Pretty_Printer is for Default_Switches (Ada) use (-nD); for Switches (pkg.ads) use (-kU); end Pretty_Printer; end Prj; Invoking gnat pretty -P prj.gpr /path/to/pkg.ads should result in gnatpp invoked with -aU, not -nD. Tested on x86_64-pc-linux-gnu, committed on trunk 2013-01-03 Vincent Celier cel...@adacore.com * gnatcmd.adb (GNATCmd): If a single main has been specified as an absolute path, use its simple file name to find specific switches, instead of the absolute path. Index: gnatcmd.adb === --- gnatcmd.adb (revision 194841) +++ gnatcmd.adb (working copy) @@ -1999,7 +1999,19 @@ In_Arrays = Element.Decl.Arrays, Shared= Project_Tree.Shared); Name_Len := 0; - Add_Str_To_Name_Buffer (Main.all); + + -- If the single main has been specified as an absolute + -- path, we use only the simple file name. If the + -- absolute path is incorrect, an error will be reported + -- by the underlying tool and it does not make a + -- difference what switches are used. + + if Is_Absolute_Path (Main.all) then +Add_Str_To_Name_Buffer (File_Name (Main.all)); + else +Add_Str_To_Name_Buffer (Main.all); + end if; + The_Switches := Prj.Util.Value_Of (Index = Name_Find, Src_Index = 0,
[Ada] 2012 rule on aliasing
Ongoing work to implement AI05-0144. Tested on x86_64-pc-linux-gnu, committed on trunk 2013-01-03 Javier Miranda mira...@adacore.com * sem_warn.adb (Warn_On_Overlapping_Actuals): For overlapping parameters that are record types or array types generate warnings only compiling under -gnatw.i * opt.ads (Extensions_Allowed): Restore previous documentation. Index: sem_warn.adb === --- sem_warn.adb(revision 194848) +++ sem_warn.adb(working copy) @@ -3293,8 +3293,7 @@ Form1, Form2 : Entity_Id; function Is_Covered_Formal (Formal : Node_Id) return Boolean; - -- Return True if Formal is covered by the Ada 2012 rule. Under -gnatX - -- the rule is extended to cover record and array types. + -- Return True if Formal is covered by the rule. function Refer_Same_Object (Act1, Act2 : Node_Id) return Boolean; -- Two names are known to refer to the same object if the two names @@ -3321,24 +3320,12 @@ function Is_Covered_Formal (Formal : Node_Id) return Boolean is begin - -- Ada 2012 rule - - if not Extensions_Allowed then -return - Ekind_In (Formal, E_Out_Parameter, -E_In_Out_Parameter) -and then Is_Elementary_Type (Etype (Formal)); - - -- Under -gnatX the rule is extended to cover array and record types - - else -return - Ekind_In (Formal, E_Out_Parameter, -E_In_Out_Parameter) -and then (Is_Elementary_Type (Etype (Formal)) -or else Is_Record_Type (Etype (Formal)) -or else Is_Array_Type (Etype (Formal))); - end if; + return + Ekind_In (Formal, E_Out_Parameter, + E_In_Out_Parameter) + and then (Is_Elementary_Type (Etype (Formal)) + or else Is_Record_Type (Etype (Formal)) + or else Is_Array_Type (Etype (Formal))); end Is_Covered_Formal; begin @@ -3360,7 +3347,8 @@ -- there is no other name among the other parameters of mode in out or -- out to C that is known to denote the same object (RM 6.4.1(6.15/3)) - -- Under -gnatX the rule is extended to cover array and record types. + -- Compiling under -gnatw.i we also report warnings on overlapping + -- parameters that are record types or array types. Form1 := First_Formal (Subp); Act1 := First_Actual (N); @@ -3401,10 +3389,21 @@ then null; + -- Under Ada 2012 we only report warnings on overlapping + -- arrays and record types if compiling under -gnatw.i + + elsif Ada_Version = Ada_2012 + and then not Is_Elementary_Type (Etype (Form1)) + and then not Warn_On_Overlap + then + null; + -- Here we may need to issue message else - Error_Msg_Warn := Ada_Version Ada_2012; + Error_Msg_Warn := + Ada_Version Ada_2012 + or else not Is_Elementary_Type (Etype (Form1)); declare Act : Node_Id; Index: opt.ads === --- opt.ads (revision 194848) +++ opt.ads (working copy) @@ -563,7 +563,7 @@ Extensions_Allowed : Boolean := False; -- GNAT -- Set to True by switch -gnatX if GNAT specific language extensions - -- are allowed. + -- are allowed. Currently there are no such defined extensions. type External_Casing_Type is ( As_Is, -- External names cased as they appear in the Ada source
[Ada] Illegal component clause for inherited component in extension
This change fixes the circuitry that handles record representation clauses so that a component clause for an inherited component in a record extension is properly rejected (such a clause is illegal per 13.5.1(9)). The following compilation must be rejected with the indicated error: $ gcc -c illegal_clause_for_inherited_comp.ads illegal_clause_for_inherited_comp.ads:7:08: component clause not allowed for inherited component B package Illegal_Clause_For_Inherited_Comp is type R1 is tagged record B : Boolean; end record; type R1_Ext is new R1 with null record; for R1_Ext use record B at 2 range 63 .. 63; end record; end; Tested on x86_64-pc-linux-gnu, committed on trunk 2013-01-03 Thomas Quinot qui...@adacore.com * sem_ch13.adb (Analyze_Record_Representation_Clause): Reject an illegal component clause for an inherited component in a record extension. Index: sem_ch13.adb === --- sem_ch13.adb(revision 194847) +++ sem_ch13.adb(working copy) @@ -4663,10 +4663,34 @@ Ocomp : Entity_Id; Posit : Uint; Rectype : Entity_Id; + Recdef : Node_Id; + function Is_Inherited (Comp : Entity_Id) return Boolean; + -- True if Comp is an inherited component in a record extension + + -- + -- Is_Inherited -- + -- + + function Is_Inherited (Comp : Entity_Id) return Boolean is + Comp_Base : Entity_Id; + begin + if Ekind (Rectype) = E_Record_Subtype then +Comp_Base := Original_Record_Component (Comp); + else +Comp_Base := Comp; + end if; + return Comp_Base /= Original_Record_Component (Comp_Base); + end Is_Inherited; + + Is_Record_Extension : Boolean; + -- True if Rectype is a record extension + CR_Pragma : Node_Id := Empty; -- Points to N_Pragma node if Complete_Representation pragma present + -- Start of processing for Analyze_Record_Representation_Clause + begin if Ignore_Rep_Clauses then return; @@ -4706,6 +4730,14 @@ return; end if; + -- We know we have a first subtype, now possibly go the the anonymous + -- base type to determine whether Rectype is a record extension. + + Recdef := Type_Definition (Declaration_Node (Base_Type (Rectype))); + Is_Record_Extension := +Nkind (Recdef) = N_Derived_Type_Definition + and then Present (Record_Extension_Part (Recdef)); + if Present (Mod_Clause (N)) then declare Loc : constant Source_Ptr := Sloc (N); @@ -4881,6 +4913,11 @@ (cannot reference discriminant of unchecked union, Component_Name (CC)); + elsif Is_Record_Extension and then Is_Inherited (Comp) then + Error_Msg_NE + (component clause not allowed for inherited + component, CC, Comp); + elsif Present (Component_Clause (Comp)) then -- Diagnose duplicate rep clause, or check consistency @@ -4908,10 +4945,11 @@ Error_Msg_N (component clause inconsistent with representation of ancestor, CC); + elsif Warn_On_Redundant_Constructs then Error_Msg_N -(?r?redundant component clause - for inherited component!, CC); +(?r?redundant confirming component clause + for component!, CC); end if; end; end if; @@ -7346,7 +7384,7 @@ begin if Present (CC1) and then Present (CC2) then --- Exclude odd case where we have two tag fields in the same +-- Exclude odd case where we have two tag components in the same -- record, both at location zero. This seems a bit strange, but -- it seems to happen in some circumstances, perhaps on an error. @@ -7387,7 +7425,7 @@ procedure Find_Component is procedure Search_Component (R : Entity_Id); - -- Search components of R for a match. If found, Comp is set. + -- Search components of R for a match. If found, Comp is set -- -- Search_Component -- @@ -7426,8 +7464,8 @@ Search_Component (Rectype); - -- If not found, maybe component of base type that is absent from - -- statically constrained first subtype. + -- If not found, maybe component of base type discriminant that is + -- absent from statically constrained first subtype. if No (Comp)
[Patch, AArch64] Fix vmovn_high_*, vqmovn_high_* and vqmovun_high_* intrinsics.
Hi, Attached is a patch that fixes bugs in intrinsic implementation of vmovn_high_*, vqmovn_high_* and vqmovun_high_* in arm_neon.h. This runtime bug was because of xtn2 having the incorrect operand number for the source operand. Tested on aarch64-none-elf. OK for trunk and 4.7? Thanks, Tejas Belagod ARM. 2013-01-03 Tejas Belagod tejas.bela...@arm.com gcc/ * config/aarch64/arm_neon.h (vmovn_high_*, vqmovn_high_*, vqmovun_high_*): Fix source operand number.diff --git a/gcc/config/aarch64/arm_neon.h b/gcc/config/aarch64/arm_neon.h index e8fafa6..c7f4323 100644 --- a/gcc/config/aarch64/arm_neon.h +++ b/gcc/config/aarch64/arm_neon.h @@ -11647,7 +11647,7 @@ __extension__ static __inline int8x16_t __attribute__ ((__always_inline__)) vmovn_high_s16 (int8x8_t a, int16x8_t b) { int8x16_t result = vcombine_s8 (a, vcreate_s8 (UINT64_C (0x0))); - __asm__ (xtn2 %0.16b,%2.8h + __asm__ (xtn2 %0.16b,%1.8h : +w(result) : w(b) : /* No clobbers */); @@ -11658,7 +11658,7 @@ __extension__ static __inline int16x8_t __attribute__ ((__always_inline__)) vmovn_high_s32 (int16x4_t a, int32x4_t b) { int16x8_t result = vcombine_s16 (a, vcreate_s16 (UINT64_C (0x0))); - __asm__ (xtn2 %0.8h,%2.4s + __asm__ (xtn2 %0.8h,%1.4s : +w(result) : w(b) : /* No clobbers */); @@ -11669,7 +11669,7 @@ __extension__ static __inline int32x4_t __attribute__ ((__always_inline__)) vmovn_high_s64 (int32x2_t a, int64x2_t b) { int32x4_t result = vcombine_s32 (a, vcreate_s32 (UINT64_C (0x0))); - __asm__ (xtn2 %0.4s,%2.2d + __asm__ (xtn2 %0.4s,%1.2d : +w(result) : w(b) : /* No clobbers */); @@ -11680,7 +11680,7 @@ __extension__ static __inline uint8x16_t __attribute__ ((__always_inline__)) vmovn_high_u16 (uint8x8_t a, uint16x8_t b) { uint8x16_t result = vcombine_u8 (a, vcreate_u8 (UINT64_C (0x0))); - __asm__ (xtn2 %0.16b,%2.8h + __asm__ (xtn2 %0.16b,%1.8h : +w(result) : w(b) : /* No clobbers */); @@ -11691,7 +11691,7 @@ __extension__ static __inline uint16x8_t __attribute__ ((__always_inline__)) vmovn_high_u32 (uint16x4_t a, uint32x4_t b) { uint16x8_t result = vcombine_u16 (a, vcreate_u16 (UINT64_C (0x0))); - __asm__ (xtn2 %0.8h,%2.4s + __asm__ (xtn2 %0.8h,%1.4s : +w(result) : w(b) : /* No clobbers */); @@ -11702,7 +11702,7 @@ __extension__ static __inline uint32x4_t __attribute__ ((__always_inline__)) vmovn_high_u64 (uint32x2_t a, uint64x2_t b) { uint32x4_t result = vcombine_u32 (a, vcreate_u32 (UINT64_C (0x0))); - __asm__ (xtn2 %0.4s,%2.2d + __asm__ (xtn2 %0.4s,%1.2d : +w(result) : w(b) : /* No clobbers */); @@ -14121,7 +14121,7 @@ __extension__ static __inline int8x16_t __attribute__ ((__always_inline__)) vqmovn_high_s16 (int8x8_t a, int16x8_t b) { int8x16_t result = vcombine_s8 (a, vcreate_s8 (UINT64_C (0x0))); - __asm__ (sqxtn2 %0.16b, %2.8h + __asm__ (sqxtn2 %0.16b, %1.8h : +w(result) : w(b) : /* No clobbers */); @@ -14132,7 +14132,7 @@ __extension__ static __inline int16x8_t __attribute__ ((__always_inline__)) vqmovn_high_s32 (int16x4_t a, int32x4_t b) { int16x8_t result = vcombine_s16 (a, vcreate_s16 (UINT64_C (0x0))); - __asm__ (sqxtn2 %0.8h, %2.4s + __asm__ (sqxtn2 %0.8h, %1.4s : +w(result) : w(b) : /* No clobbers */); @@ -14143,7 +14143,7 @@ __extension__ static __inline int32x4_t __attribute__ ((__always_inline__)) vqmovn_high_s64 (int32x2_t a, int64x2_t b) { int32x4_t result = vcombine_s32 (a, vcreate_s32 (UINT64_C (0x0))); - __asm__ (sqxtn2 %0.4s, %2.2d + __asm__ (sqxtn2 %0.4s, %1.2d : +w(result) : w(b) : /* No clobbers */); @@ -14154,7 +14154,7 @@ __extension__ static __inline uint8x16_t __attribute__ ((__always_inline__)) vqmovn_high_u16 (uint8x8_t a, uint16x8_t b) { uint8x16_t result = vcombine_u8 (a, vcreate_u8 (UINT64_C (0x0))); - __asm__ (uqxtn2 %0.16b, %2.8h + __asm__ (uqxtn2 %0.16b, %1.8h : +w(result) : w(b) : /* No clobbers */); @@ -14165,7 +14165,7 @@ __extension__ static __inline uint16x8_t __attribute__ ((__always_inline__)) vqmovn_high_u32 (uint16x4_t a, uint32x4_t b) { uint16x8_t result = vcombine_u16 (a, vcreate_u16 (UINT64_C (0x0))); - __asm__ (uqxtn2 %0.8h, %2.4s + __asm__ (uqxtn2 %0.8h, %1.4s : +w(result) : w(b) : /* No clobbers */); @@ -14176,7 +14176,7 @@ __extension__ static __inline uint32x4_t __attribute__ ((__always_inline__)) vqmovn_high_u64 (uint32x2_t a, uint64x2_t b) { uint32x4_t result = vcombine_u32 (a, vcreate_u32 (UINT64_C (0x0))); - __asm__ (uqxtn2 %0.4s, %2.2d + __asm__ (uqxtn2 %0.4s, %1.2d : +w(result) : w(b) : /* No clobbers */); @@ -14187,7 +14187,7 @@ __extension__
[PATCH] Fix PR55857
My earlier patch to avoid dead code generation for vectorized invariant loops breaks re-align load targets as the setup is still carried out for them. Fixed as follows, bootstrapped and tested on x86_64-unknown-linux-gnu and with a ppc cross. Committed. Richard. 2013-01-03 Richard Biener rguent...@suse.de PR tree-optimization/55857 * tree-vect-stmts.c (vectorizable_load): Do not setup re-alignment for invariant loads. * gcc.dg/vect/pr55857-1.c: New testcase. * gcc.dg/vect/pr55857-2.c: Likewise. Index: gcc/tree-vect-stmts.c === *** gcc/tree-vect-stmts.c (revision 194844) --- gcc/tree-vect-stmts.c (working copy) *** vectorizable_load (gimple stmt, gimple_s *** 4927,4933 if ((alignment_support_scheme == dr_explicit_realign_optimized || alignment_support_scheme == dr_explicit_realign) !!compute_in_loop) { msq = vect_setup_realignment (first_stmt, gsi, realignment_token, alignment_support_scheme, NULL_TREE, --- 4927,4934 if ((alignment_support_scheme == dr_explicit_realign_optimized || alignment_support_scheme == dr_explicit_realign) !!compute_in_loop !!integer_zerop (DR_STEP (dr))) { msq = vect_setup_realignment (first_stmt, gsi, realignment_token, alignment_support_scheme, NULL_TREE, Index: gcc/testsuite/gcc.dg/vect/pr55857-1.c === *** gcc/testsuite/gcc.dg/vect/pr55857-1.c (revision 0) --- gcc/testsuite/gcc.dg/vect/pr55857-1.c (working copy) *** *** 0 --- 1,17 + /* { dg-do compile } */ + + void + foo (int *data, unsigned len, const int qlp_coeff[], int lp, int residual[]) + { + int i; + int sum; + for(i = 0; i (int)len; i++) + { + sum = 0; + sum += qlp_coeff[1] * data[i-2]; + sum += qlp_coeff[0] * data[i-1]; + residual[i] = data[i] - (sum lp); + } + } + + /* { dg-final { cleanup-tree-dump vect } } */ Index: gcc/testsuite/gcc.dg/vect/pr55857-2.c === *** gcc/testsuite/gcc.dg/vect/pr55857-2.c (revision 0) --- gcc/testsuite/gcc.dg/vect/pr55857-2.c (working copy) *** *** 0 --- 1,21 + /* { dg-do compile } */ + + void foo (int *data, unsigned len, const int qlp_coeff[], + unsigned order, int lp, int residual[]) + { + int i; + int sum; + if(order == 2) + for(i = 0; i (int)len; i++) + { + sum = 0; + sum += qlp_coeff[1] * data[i-2]; + sum += qlp_coeff[0] * data[i-1]; + residual[i] = data[i] - (sum lp); + } + else + for(i = 0; i (int)len; i++) + residual[i] = data[i] - ((qlp_coeff[0] * data[i-1]) lp); + } + + /* { dg-final { cleanup-tree-dump vect } } */
[PATCH]: Fix for PR 55707 bootstrap fails in gcc/graphite-dependences.c error cast loses precision
Hello, this trivial patch fixes a bootstrap issue on LLP64 hosts. PR 55707 * graphite-dependences.c (hash_poly_ddr_p): Cast from pointer via intptr_t. Tested for x86_64-w64-mingw32 and x86_64-unknown-gnu-linux. If OK for apply, Kai please commit. Regards, Rainer Index: graphite-dependences.c === --- graphite-dependences.c (Revision 194638) +++ graphite-dependences.c (Arbeitskopie) @@ -56,7 +56,7 @@ hash_poly_ddr_p (const void *pddr) { const struct poly_ddr *p = (const struct poly_ddr *) pddr; - return (hashval_t) ((long) PDDR_SOURCE (p) + (long) PDDR_SINK (p)); + return (hashval_t) ((intptr_t) PDDR_SOURCE (p) + (intptr_t) PDDR_SINK (p)); } /* Returns true when PDDR has no dependence. */
Re: [PATCH]: Fix for PR 55707 bootstrap fails in gcc/graphite-dependences.c error cast loses precision
On Thu, Jan 3, 2013 at 1:08 PM, Rainer Emrich rai...@emrich-ebersheim.de wrote: Hello, this trivial patch fixes a bootstrap issue on LLP64 hosts. PR 55707 * graphite-dependences.c (hash_poly_ddr_p): Cast from pointer via intptr_t. Tested for x86_64-w64-mingw32 and x86_64-unknown-gnu-linux. If OK for apply, Kai please commit. Ok. Thanks, Richard. Regards, Rainer Index: graphite-dependences.c === --- graphite-dependences.c (Revision 194638) +++ graphite-dependences.c (Arbeitskopie) @@ -56,7 +56,7 @@ hash_poly_ddr_p (const void *pddr) { const struct poly_ddr *p = (const struct poly_ddr *) pddr; - return (hashval_t) ((long) PDDR_SOURCE (p) + (long) PDDR_SINK (p)); + return (hashval_t) ((intptr_t) PDDR_SOURCE (p) + (intptr_t) PDDR_SINK (p)); } /* Returns true when PDDR has no dependence. */
[RFA] statement before variable declaration in cp_parser_initializer_list.
Hello, I happened to notice a warning while compiling GCC, and it seemed like an easy fix... gcc/cp/ChangeLog: * parser.c (cp_parser_initializer_list): Move declaration of variable non_const to start of lexical block. Tested against x86_64-linux, no regression. OK to commit? (obvious?) Thanks, -- Joel --- gcc/cp/parser.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 3dc2ec6..61d93f8 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -17932,9 +17932,10 @@ cp_parser_initializer_list (cp_parser* parser, bool* non_constant_p) cp_lexer_next_token_is (parser-lexer, CPP_OPEN_SQUARE)) { /* In C++11, [ could start a lambda-introducer. */ + bool non_const = false; + cp_parser_parse_tentatively (parser); cp_lexer_consume_token (parser-lexer); - bool non_const = false; designator = cp_parser_constant_expression (parser, true, non_const); cp_parser_require (parser, CPP_CLOSE_SQUARE, RT_CLOSE_SQUARE); cp_parser_require (parser, CPP_EQ, RT_EQ); -- 1.7.0.4
Re: [RFA] statement before variable declaration in cp_parser_initializer_list.
On Thu, Jan 3, 2013 at 1:30 PM, Joel Brobecker brobec...@adacore.com wrote: Hello, I happened to notice a warning while compiling GCC, and it seemed like an easy fix... gcc/cp/ChangeLog: * parser.c (cp_parser_initializer_list): Move declaration of variable non_const to start of lexical block. Tested against x86_64-linux, no regression. OK to commit? (obvious?) Hmm? We compile with a C++ compiler where this is perfectly valid ... Richard. Thanks, -- Joel --- gcc/cp/parser.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 3dc2ec6..61d93f8 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -17932,9 +17932,10 @@ cp_parser_initializer_list (cp_parser* parser, bool* non_constant_p) cp_lexer_next_token_is (parser-lexer, CPP_OPEN_SQUARE)) { /* In C++11, [ could start a lambda-introducer. */ + bool non_const = false; + cp_parser_parse_tentatively (parser); cp_lexer_consume_token (parser-lexer); - bool non_const = false; designator = cp_parser_constant_expression (parser, true, non_const); cp_parser_require (parser, CPP_CLOSE_SQUARE, RT_CLOSE_SQUARE); cp_parser_require (parser, CPP_EQ, RT_EQ); -- 1.7.0.4
[PATCH] Another minor vectorizer TLC
This removes two calls to build_fold_indirect_ref which were only done to later call get_name on the result. Simply build a name in the first place instead of repeatedly doing so. It also adjusts dumping of what kind of object we vectorize (going from terribly wrong to most of the time wrong ...). The patch also commits one piece I had in my local tree for some time, state that the reason for not vectorizing is a non-empty latch block if we just checked that. Bootstrap regtest pending on x86_64-unknown-linux-gnu. Richard. 2013-01-03 Richard Biener rguent...@suse.de * tree-vect-loop.c (vect_analyze_loop_form): Clarify reason for not vectorizing. * tree-vect-data-refs.c (vect_create_addr_base_for_vector_ref): Do not build INDIRECT_REFs, call get_name once only. (vect_create_data_ref_ptr): Likewise. Dump base object kind based on DR_BASE_OBJECT, not DR_BASE_ADDRESS. Index: gcc/tree-vect-loop.c === *** gcc/tree-vect-loop.c(revision 194844) --- gcc/tree-vect-loop.c(working copy) *** vect_analyze_loop_form (struct loop *loo *** 1167,1177 before the loop if needed), where the loop header contains all the executable statements, and the latch is empty. */ if (!empty_block_p (loop-latch) ! || !gimple_seq_empty_p (phi_nodes (loop-latch))) { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, !not vectorized: unexpected loop form.); if (inner_loop_vinfo) destroy_loop_vec_info (inner_loop_vinfo, true); return NULL; --- 1167,1177 before the loop if needed), where the loop header contains all the executable statements, and the latch is empty. */ if (!empty_block_p (loop-latch) ! || !gimple_seq_empty_p (phi_nodes (loop-latch))) { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, !not vectorized: latch block not empty.); if (inner_loop_vinfo) destroy_loop_vec_info (inner_loop_vinfo, true); return NULL; Index: gcc/tree-vect-data-refs.c === *** gcc/tree-vect-data-refs.c (revision 194844) --- gcc/tree-vect-data-refs.c (working copy) *** vect_create_addr_base_for_vector_ref (gi *** 3576,3582 stmt_vec_info stmt_info = vinfo_for_stmt (stmt); struct data_reference *dr = STMT_VINFO_DATA_REF (stmt_info); tree data_ref_base = unshare_expr (DR_BASE_ADDRESS (dr)); ! tree base_name; tree data_ref_base_var; tree vec_stmt; tree addr_base, addr_expr; --- 3576,3582 stmt_vec_info stmt_info = vinfo_for_stmt (stmt); struct data_reference *dr = STMT_VINFO_DATA_REF (stmt_info); tree data_ref_base = unshare_expr (DR_BASE_ADDRESS (dr)); ! const char *base_name; tree data_ref_base_var; tree vec_stmt; tree addr_base, addr_expr; *** vect_create_addr_base_for_vector_ref (gi *** 3601,3612 } if (loop_vinfo) ! base_name = build_fold_indirect_ref (data_ref_base); else { base_offset = ssize_int (0); init = ssize_int (0); ! base_name = build_fold_indirect_ref (unshare_expr (DR_REF (dr))); } data_ref_base_var = create_tmp_var (TREE_TYPE (data_ref_base), batmp); --- 3601,3612 } if (loop_vinfo) ! base_name = get_name (data_ref_base); else { base_offset = ssize_int (0); init = ssize_int (0); ! base_name = get_name (DR_REF (dr)); } data_ref_base_var = create_tmp_var (TREE_TYPE (data_ref_base), batmp); *** vect_create_addr_base_for_vector_ref (gi *** 3654,3660 vec_stmt = fold_convert (vect_ptr_type, addr_base); addr_expr = vect_get_new_vect_var (vect_ptr_type, vect_pointer_var, ! get_name (base_name)); vec_stmt = force_gimple_operand (vec_stmt, seq, false, addr_expr); gimple_seq_add_seq (new_stmt_list, seq); --- 3654,3660 vec_stmt = fold_convert (vect_ptr_type, addr_base); addr_expr = vect_get_new_vect_var (vect_ptr_type, vect_pointer_var, ! base_name); vec_stmt = force_gimple_operand (vec_stmt, seq, false, addr_expr); gimple_seq_add_seq (new_stmt_list, seq); *** vect_create_data_ref_ptr (gimple stmt, t *** 3729,3735 gimple_stmt_iterator *gsi, gimple *ptr_incr, bool only_init, bool *inv_p) { ! tree base_name; stmt_vec_info stmt_info = vinfo_for_stmt (stmt); loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info); struct loop *loop = NULL; --- 3729,3735 gimple_stmt_iterator *gsi, gimple *ptr_incr,
Re: [RFA] statement before variable declaration in cp_parser_initializer_list.
Tested against x86_64-linux, no regression. OK to commit? (obvious?) Hmm? We compile with a C++ compiler where this is perfectly valid ... I was compiling with GCC 4.7 where it gave me a warning... I don't know much about C++ anymore, so I didn't know. Oh well! -- Joel
RFA: RL78: Always select register bank 0 at the start of an ISR
Hi DJ, Since interrupts can happen at any time, it is possible for a ISR to be called when register bank 0 is not the currently selected bank. Hence the prologue for an interrupt handler should always select bank 0 before saving any registers. The patch below makes sure that this happens. No regressions with a rl78-elf toolchain. OK to apply ? Cheers Nick gcc/ChangeLog 2013-01-03 Nick Clifton ni...@redhat.com * config/rl78/rl78.c (rl78_expand_prologue): Always select register bank 0 at the start of an interrupt handler. Index: gcc/config/rl78/rl78.c === --- gcc/config/rl78/rl78.c (revision 194833) +++ gcc/config/rl78/rl78.c (working copy) @@ -839,6 +839,9 @@ if (flag_stack_usage_info) current_function_static_stack_size = cfun-machine-framesize; + if (is_interrupt_func (cfun-decl)) +emit_insn (gen_sel_rb (GEN_INT (0))); + for (i = 0; i 16; i++) if (cfun-machine-need_to_push [i]) {
Re: [RFA] statement before variable declaration in cp_parser_initializer_list.
Hmm? We compile with a C++ compiler where this is perfectly valid ... Not on earlier branches though, e.g. the 4.7 branch. So I would install it everywhere to avoid gratuitous differences. -- Eric Botcazou
Re: [RFA] statement before variable declaration in cp_parser_initializer_list.
On Thu, Jan 3, 2013 at 1:37 PM, Joel Brobecker brobec...@adacore.com wrote: Tested against x86_64-linux, no regression. OK to commit? (obvious?) Hmm? We compile with a C++ compiler where this is perfectly valid ... I was compiling with GCC 4.7 where it gave me a warning... I don't know much about C++ anymore, so I didn't know. Oh well! Ah, for the 4.7 branch yes. Thanks, Richard. -- Joel
RFA: RL78: Correct values of the MDBL and MDBH registers
Hi DJ, There is a error in the RL78 G13 hardware manual. Section 14, Figure 14-3 lists the values of the MDBL registers as 4H, 5H and the MDBH registers as 6H, 7H. This is incorrect. The correct values are shown in Section 3, Table 3-5: MDBL = 6H, 7H, MDBH = 4H, 5H. GCC and the RL78 simulator currently use the values from section 14. The patch below corrects GCC. A similar patch will be submitted to update the sim. Tested with no regressions (on an updated sim) using an rl78-elf toolchain. OK to apply ? Cheers Nick gcc/ChangeLog 2013-01-03 Nick Clifton ni...@redhat.com * config/rl78/rl78.md (mulsi3_g13): Correct values for MDBL and MDBH registers. Index: gcc/config/rl78/rl78.md === --- gcc/config/rl78/rl78.md (revision 194833) +++ gcc/config/rl78/rl78.md (working copy) @@ -273,10 +273,10 @@ ) ;; 0x0 is MDAL. 0x2 is MDAH. -;; 0x4 is MDBL. 0x6 is MDBH. +;; 0x6 is MDBL. 0x4 is MDBH. ;; 0xF00E0 is MDCL. 0xF00E2 is MDCH. ;; 0xF00E8 is MDUC. -;; Warning: this matches the documentation, not the silicon. +;; Warning: this matches the silicon not the documentation. (define_insn mulsi3_g13 [(set (match_operand:SI 0 register_operand =v) (mult:SI (match_operand:SI 1 nonmemory_operand vi) @@ -291,12 +291,12 @@ movwax, %h2 movw0x2, ax ; MDAH nop ; mdb = mdal * mdah - movwax, 0x4 ; MDBL + movwax, 0x6 ; MDBL movw%h0, ax mov a, #0x40 mov !0xf00e8, a ; MDUC - movwax, 0x6 ; MDBH + movwax, 0x4 ; MDBH movw!0xf00e0, ax; MDCL movwax, #0 movw!0xf00e2, ax; MDCL
[PATCH] : Fix for PR 52123 gcc bootstrap with ada fails on mingw target
Hello, this trivial patch fixes the bootstrap with ada on mingw targets. The right casts fix the invalid conversion issues. Patch is against trunk. ada/ PR 52123 * adaint.c (__gnat_check_OWNER_ACL): Cast from pointer via SECURITY_DESCRIPTOR * (__gnat_set_OWNER_ACL): Cast from DWORD to ACCESS_MODE (__gnat_portable_spawn): Fix cast to char* const* (add_handle): Cast from pointer via void ** (add_handle): Cast from pointer via int * (__gnat_locate_exec_on_path): Cast from pointer via TCHAR * (__gnat_locate_exec_on_path): Cast from pointer via char * * initialize.c (append_arg): Cast from pointer via LPWSTR (__gnat_initialize): Cast from pointer via LPWSTR * seh_init.c (__gnat_map_SEH): Cast from pointer via FARPROC If OK for apply, Kai please commit. Regards, Rainer Index: ada/adaint.c === --- ada/adaint.c(Revision 194638) +++ ada/adaint.c(Arbeitskopie) @@ -1982,7 +1982,7 @@ __gnat_check_OWNER_ACL GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION, NULL, 0, nLength); - if ((pSD = (PSECURITY_DESCRIPTOR) HeapAlloc + if ((pSD = (SECURITY_DESCRIPTOR *) HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, nLength)) == NULL) return 0; @@ -2059,7 +2059,7 @@ __gnat_set_OWNER_ACL return; BuildExplicitAccessWithName -(ea, username, AccessPermissions, AccessMode, NO_INHERITANCE); +(ea, username, AccessPermissions, (ACCESS_MODE) AccessMode, NO_INHERITANCE); if (AccessMode == SET_ACCESS) { @@ -2384,7 +2384,7 @@ __gnat_portable_spawn (char *args[]) strcat (args[0], args_0); strcat (args[0], \); - status = spawnvp (P_WAIT, args_0, (const char* const*)args); + status = spawnvp (P_WAIT, args_0, (char* const*)args); /* restore previous value */ free (args[0]); @@ -2540,9 +2540,9 @@ add_handle (HANDLE h, int pid) { plist_max_length += 1000; HANDLES_LIST = -xrealloc (HANDLES_LIST, sizeof (HANDLE) * plist_max_length); +(void **) xrealloc (HANDLES_LIST, sizeof (HANDLE) * plist_max_length); PID_LIST = -xrealloc (PID_LIST, sizeof (int) * plist_max_length); +(int *) xrealloc (PID_LIST, sizeof (int) * plist_max_length); } HANDLES_LIST[plist_length] = h; @@ -2931,7 +2931,7 @@ __gnat_locate_exec_on_path (char *exec_n #define EXPAND_BUFFER_SIZE 32767 - wapath_val = alloca (EXPAND_BUFFER_SIZE); + wapath_val = (TCHAR *) alloca (EXPAND_BUFFER_SIZE); wapath_val [0] = '.'; wapath_val [1] = ';'; @@ -2941,7 +2941,7 @@ __gnat_locate_exec_on_path (char *exec_n if (!res) wapath_val [0] = _T('\0'); - apath_val = alloca (EXPAND_BUFFER_SIZE); + apath_val = (char *) alloca (EXPAND_BUFFER_SIZE); WS2SC (apath_val, wapath_val, EXPAND_BUFFER_SIZE); return __gnat_locate_exec (exec_name, apath_val); Index: ada/initialize.c === --- ada/initialize.c(Revision 194638) +++ ada/initialize.c(Arbeitskopie) @@ -88,14 +88,14 @@ append_arg (int *index, LPWSTR dir, LPWS { /* no dir prefix */ dirlen = 0; - fullvalue = xmalloc ((vallen + 1) * sizeof(TCHAR)); + fullvalue = (LPWSTR) xmalloc ((vallen + 1) * sizeof(TCHAR)); } else { /* Add dir first */ dirlen = _tcslen (dir); - fullvalue = xmalloc ((dirlen + vallen + 1) * sizeof(TCHAR)); + fullvalue = (LPWSTR) xmalloc ((dirlen + vallen + 1) * sizeof(TCHAR)); _tcscpy (fullvalue, dir); } @@ -203,7 +203,7 @@ __gnat_initialize (void *eh ATTRIBUTE_UN if (ldir != NULL) { int n = ldir - wargv[k] + 1; -dir = xmalloc ((n + 1) * sizeof (TCHAR)); +dir = (LPWSTR) xmalloc ((n + 1) * sizeof (TCHAR)); _tcsncpy (dir, wargv[k], n); dir[n] = _T('\0'); } Index: ada/seh_init.c === --- ada/seh_init.c (Revision 194638) +++ ada/seh_init.c (Arbeitskopie) @@ -91,7 +91,7 @@ __gnat_map_SEH (EXCEPTION_RECORD* Except */ if ((ExceptionRecord-ExceptionInformation[1] 3) != 0 || IsBadCodePtr - ((void *)(ExceptionRecord-ExceptionInformation[1] + 4096))) + ((FARPROC)(ExceptionRecord-ExceptionInformation[1] + 4096))) { *msg = EXCEPTION_ACCESS_VIOLATION; return program_error;
[Ada] Aspect Abstract_State
This patch provides the initial implementation of aspect Abstract_State. This construct is intended for formal verification proofs. The syntax of the aspect is as follows: abstract_state_list::= null | state_name_with_properties | (state_name_with_properties { , state_name_with_properties } ) state_name_with_properties ::= state_name | ( state_name with property_list ) property_list ::= property { , property } property ::= simple_property | name_value_property simple_property::= identifier name_value_property::= identifier = expression state_name ::= defining_identifier The semantics of the aspect are as follows: The identifier of a simple_property shall be Volatile, Input, or Output. There shall be at most one occurrence of the identifiers Volatile, Input and Output in a single property_list. If a property_list includes Volatile, then it shall also include exactly one of Input or Output. If a property_list includes either Input or Output, then it shall also include Volatile. The identifier of a name_value_property shall be Integrity. If a property_list includes Integrity then it shall be the final property in the list. Each state_name occurring in an Abstract_State aspect specification for a given package P introduces an implicit declaration of a state abstraction entity. This implicit declaration occurs at the beginning of the visible part of P. This implicit declaration requires completion. A state abstraction shall only be named in contexts where this is explicitly permitted (e.g., as part of a Globals aspect specification), but this is not a name resolution rule. Thus, the declaration of a state abstraction has the same visibility as any other declaration. A state abstraction is not an object; it does not have a type. The completion of a state abstraction declared in a package aspect_specification can only be provided as part of a Refined_State aspect specification within the body of the package. A null abstract_state_list specifies that a package contains no hidden state or variables declared in its visible_part. A variable declared in the visible_part of a package implicitly declares a state abstraction entity with the same identifier as the defining_identifier of the variable. The variable declaration acts as the completion of the state abstraction. The implicitly declared state abstraction is only visible in a limited view of the package. A volatile state abstraction is one declared with a property list which includes the Volatile property, and either Input or Output. A Volatile Input or Output state abstraction represents a sequence of state changes brought about by reading or writing successive values to or from a volatile variable. -- Source -- -- semantics.ads package Semantics is package OK_1 with Abstract_State = null is end OK_1; package OK_2 with Abstract_State = (S_1, (S_2 with Volatile, Input, Integrity = 1), (S_3 with Output, Volatile, Integrity = 2)) is end OK_2; package Error_1 with Abstract_State = (S_1, S_1,-- duplicate state name 123,-- junk state name (123 with Input, Volatile), -- junk state name (S_2 with Junk_Name),-- junk property (S_3 with Input, Input), -- duplicate property (S_4 with Input),-- no Volatile (S_5 with Output), -- no Volatile (S_6 with Volatile), -- neither Input nor Output (S_7 with Volatile, Input, Output), -- can't have Input and Output (S_8 with Integrity = Junk_Value), -- has to be integer literal null)-- can't have null or any of the above is end Error_1; end Semantics; - -- Compilation -- - $ gcc -c -gnatc -gnat12 -gnatd.V semantics.ads semantics.ads:14:11: malformed abstract state declaration semantics.ads:16:09: S_1 conflicts with declaration at line 15 semantics.ads:18:09: state name must be an identifier semantics.ads:19:18: invalid state property semantics.ads:20:25: duplicate state property semantics.ads:21:08: properties Input and Output require Volatile semantics.ads:22:08: properties Input and Output require Volatile semantics.ads:23:08: property Volatile requires exactly one Input or Output semantics.ads:24:08: property Volatile requires exactly one Input or Output semantics.ads:25:31: integrity level must be an integer literal semantics.ads:26:08: package Error_1 has non-null abstract state Tested on x86_64-pc-linux-gnu, committed on trunk 2013-01-03 Hristian Kirtchev kirtc...@adacore.com * aspects.adb, aspects.ads: Add Aspect_Abstract_State to all the relevant tables. * einfo.ads, einfo.adb: Add Integrity_Level and
[Ada] Avoid overflow in Table reallocation
This patch avoids an overflow that occurs when tables get bigger than about 12 million elements. No change in functionality (except for enormous tables), so no test available. Tested on x86_64-pc-linux-gnu, committed on trunk 2013-01-03 Bob Duff d...@adacore.com * table.adb (Reallocate): Calculate new Length in Long_Integer to avoid overflow. Index: table.adb === --- table.adb (revision 194841) +++ table.adb (working copy) @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2009, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -172,6 +172,7 @@ procedure Reallocate is New_Size : Memory.size_t; + New_Length : Long_Integer; begin if Max Last_Val then @@ -186,11 +187,15 @@ -- the increment value or 10, which ever is larger (the reason -- for the use of 10 here is to ensure that the table does really -- increase in size (which would not be the case for a table of --- length 10 increased by 3% for instance). +-- length 10 increased by 3% for instance). Do the intermediate +-- calculation in Long_Integer to avoid overflow. while Max Last_Val loop - Length := Int'Max (Length * (100 + Table_Increment) / 100, - Length + 10); + New_Length := + Long_Integer (Length) * + (100 + Long_Integer (Table_Increment)) + / 100; + Length := Int'Max (Int (New_Length), Length + 10); Max := Min + Length - 1; end loop;
Re: [Patch, AArch64] Fix vmovn_high_*, vqmovn_high_* and vqmovun_high_* intrinsics.
On 03/01/13 11:35, Tejas Belagod wrote: Hi, Attached is a patch that fixes bugs in intrinsic implementation of vmovn_high_*, vqmovn_high_* and vqmovun_high_* in arm_neon.h. This runtime bug was because of xtn2 having the incorrect operand number for the source operand. Tested on aarch64-none-elf. OK for trunk and 4.7? Thanks, Tejas Belagod ARM. 2013-01-03 Tejas Belagod tejas.bela...@arm.com gcc/ * config/aarch64/arm_neon.h (vmovn_high_*, vqmovn_high_*, vqmovun_high_*): Fix source operand number. OK. R.
Re: [PATCH] : Fix for PR 52123 gcc bootstrap with ada fails on mingw target
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Forgot to mention, tested on x86_64-w64-mingw32 and x86_64-unknown-gnu-linux. Am 03.01.2013 14:06, schrieb Rainer Emrich: Hello, this trivial patch fixes the bootstrap with ada on mingw targets. The right casts fix the invalid conversion issues. Patch is against trunk. ada/ PR 52123 * adaint.c (__gnat_check_OWNER_ACL): Cast from pointer via SECURITY_DESCRIPTOR * (__gnat_set_OWNER_ACL): Cast from DWORD to ACCESS_MODE (__gnat_portable_spawn): Fix cast to char* const* (add_handle): Cast from pointer via void ** (add_handle): Cast from pointer via int * (__gnat_locate_exec_on_path): Cast from pointer via TCHAR * (__gnat_locate_exec_on_path): Cast from pointer via char * * initialize.c (append_arg): Cast from pointer via LPWSTR (__gnat_initialize): Cast from pointer via LPWSTR * seh_init.c (__gnat_map_SEH): Cast from pointer via FARPROC If OK for apply, Kai please commit. Regards, Rainer Index: ada/adaint.c === --- ada/adaint.c (Revision 194638) +++ ada/adaint.c (Arbeitskopie) @@ -1982,7 +1982,7 @@ __gnat_check_OWNER_ACL GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION, NULL, 0, nLength); - if ((pSD = (PSECURITY_DESCRIPTOR) HeapAlloc + if ((pSD = (SECURITY_DESCRIPTOR *) HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, nLength)) == NULL) return 0; @@ -2059,7 +2059,7 @@ __gnat_set_OWNER_ACL return; BuildExplicitAccessWithName -(ea, username, AccessPermissions, AccessMode, NO_INHERITANCE); +(ea, username, AccessPermissions, (ACCESS_MODE) AccessMode, NO_INHERITANCE); if (AccessMode == SET_ACCESS) { @@ -2384,7 +2384,7 @@ __gnat_portable_spawn (char *args[]) strcat (args[0], args_0); strcat (args[0], \); - status = spawnvp (P_WAIT, args_0, (const char* const*)args); + status = spawnvp (P_WAIT, args_0, (char* const*)args); /* restore previous value */ free (args[0]); @@ -2540,9 +2540,9 @@ add_handle (HANDLE h, int pid) { plist_max_length += 1000; HANDLES_LIST = - xrealloc (HANDLES_LIST, sizeof (HANDLE) * plist_max_length); + (void **) xrealloc (HANDLES_LIST, sizeof (HANDLE) * plist_max_length); PID_LIST = -xrealloc (PID_LIST, sizeof (int) * plist_max_length); + (int *) xrealloc (PID_LIST, sizeof (int) * plist_max_length); } HANDLES_LIST[plist_length] = h; @@ -2931,7 +2931,7 @@ __gnat_locate_exec_on_path (char *exec_n #define EXPAND_BUFFER_SIZE 32767 - wapath_val = alloca (EXPAND_BUFFER_SIZE); + wapath_val = (TCHAR *) alloca (EXPAND_BUFFER_SIZE); wapath_val [0] = '.'; wapath_val [1] = ';'; @@ -2941,7 +2941,7 @@ __gnat_locate_exec_on_path (char *exec_n if (!res) wapath_val [0] = _T('\0'); - apath_val = alloca (EXPAND_BUFFER_SIZE); + apath_val = (char *) alloca (EXPAND_BUFFER_SIZE); WS2SC (apath_val, wapath_val, EXPAND_BUFFER_SIZE); return __gnat_locate_exec (exec_name, apath_val); Index: ada/initialize.c === --- ada/initialize.c (Revision 194638) +++ ada/initialize.c (Arbeitskopie) @@ -88,14 +88,14 @@ append_arg (int *index, LPWSTR dir, LPWS { /* no dir prefix */ dirlen = 0; - fullvalue = xmalloc ((vallen + 1) * sizeof(TCHAR)); + fullvalue = (LPWSTR) xmalloc ((vallen + 1) * sizeof(TCHAR)); } else { /* Add dir first */ dirlen = _tcslen (dir); - fullvalue = xmalloc ((dirlen + vallen + 1) * sizeof(TCHAR)); + fullvalue = (LPWSTR) xmalloc ((dirlen + vallen + 1) * sizeof(TCHAR)); _tcscpy (fullvalue, dir); } @@ -203,7 +203,7 @@ __gnat_initialize (void *eh ATTRIBUTE_UN if (ldir != NULL) { int n = ldir - wargv[k] + 1; - dir = xmalloc ((n + 1) * sizeof (TCHAR)); +dir = (LPWSTR) xmalloc ((n + 1) * sizeof (TCHAR)); _tcsncpy (dir, wargv[k], n); dir[n] = _T('\0'); } Index: ada/seh_init.c === --- ada/seh_init.c(Revision 194638) +++ ada/seh_init.c(Arbeitskopie) @@ -91,7 +91,7 @@ __gnat_map_SEH (EXCEPTION_RECORD* Except */ if ((ExceptionRecord-ExceptionInformation[1] 3) != 0 || IsBadCodePtr - ((void *)(ExceptionRecord-ExceptionInformation[1] + 4096))) + ((FARPROC)(ExceptionRecord-ExceptionInformation[1] + 4096))) { *msg = EXCEPTION_ACCESS_VIOLATION; return program_error; -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with undefined - http://www.enigmail.net/ iQEcBAEBAgAGBQJQ5YcuAAoJEB3HOsWs+KJbw/MH/jJZxT7cheP/yKJzNI6icRlD 14XNGJ+9qMD9tTwNS20JML/gqaFrVg1IW69fxwPouNqsVngludbqvgV3dboNQiTn 1CA6/n/mkjGmmx9YcmtBvYsKhk7WLmQVOb1m+NAd/PDw92raCCUyxTrGPLRo3V4J iLOUPsDHi27JOjIdgUyyqMFPUpKmvdyRC/yrHWGiZuRPgWXA/vaVtEtSefNlQvxB oW3JuRW59epcxE+tV/cpxfc9uCsYEE6ZRGymh68bJb/+FNemO3252F4qf4788B95 CmxZ/AYuLTIbfaEaClXVWm3of3hM1l2mvputPLodweghGm1c1bHtWS0x8YaK7Do= =dA5H -END PGP SIGNATURE-
Re: [committed] Fix ICE in gen_reg_rtx, at emit-rtl.c:864/865 compiling GNU MPFR
The testcase should have included dg-add-options tls. committed as obvious. Index: tls-reload-1.c === --- tls-reload-1.c (revision 194830) +++ tls-reload-1.c (working copy) @@ -1,5 +1,6 @@ /* { dg-do run } */ /* { dg-require-effective-target tls_runtime } */ +/* { dg-add-options tls } */ #define ARRAY(X) X##_array #define DECLARE(X) \
Re: extern C fixes for sunCC
Marc == Marc Glisse marc.gli...@inria.fr writes: Marc libcpp/ Marc * line-map.c (get_combined_adhoc_loc): Cast to extern C type. Yucky. Marc line_map_realloc reallocator Marc - = set-reallocator ? set-reallocator : xrealloc; Marc + = set-reallocator ? set-reallocator Marc + : (line_map_realloc) xrealloc; The indentation is wrong here, and it needs extra parens, per the GNU coding standards. I think it should have a comment as well. Tom
Re: [PATCH] Fix PR55857
On Thu, 3 Jan 2013, Richard Biener wrote: My earlier patch to avoid dead code generation for vectorized invariant loops breaks re-align load targets as the setup is still carried out for them. Fixed as follows, bootstrapped and tested on x86_64-unknown-linux-gnu and with a ppc cross. I have reverted this and the patch that caused the issue in the first place. Richard. Committed. Richard. 2013-01-03 Richard Biener rguent...@suse.de PR tree-optimization/55857 * tree-vect-stmts.c (vectorizable_load): Do not setup re-alignment for invariant loads. * gcc.dg/vect/pr55857-1.c: New testcase. * gcc.dg/vect/pr55857-2.c: Likewise. Index: gcc/tree-vect-stmts.c === *** gcc/tree-vect-stmts.c (revision 194844) --- gcc/tree-vect-stmts.c (working copy) *** vectorizable_load (gimple stmt, gimple_s *** 4927,4933 if ((alignment_support_scheme == dr_explicit_realign_optimized || alignment_support_scheme == dr_explicit_realign) !!compute_in_loop) { msq = vect_setup_realignment (first_stmt, gsi, realignment_token, alignment_support_scheme, NULL_TREE, --- 4927,4934 if ((alignment_support_scheme == dr_explicit_realign_optimized || alignment_support_scheme == dr_explicit_realign) !!compute_in_loop !!integer_zerop (DR_STEP (dr))) { msq = vect_setup_realignment (first_stmt, gsi, realignment_token, alignment_support_scheme, NULL_TREE, Index: gcc/testsuite/gcc.dg/vect/pr55857-1.c === *** gcc/testsuite/gcc.dg/vect/pr55857-1.c (revision 0) --- gcc/testsuite/gcc.dg/vect/pr55857-1.c (working copy) *** *** 0 --- 1,17 + /* { dg-do compile } */ + + void + foo (int *data, unsigned len, const int qlp_coeff[], int lp, int residual[]) + { + int i; + int sum; + for(i = 0; i (int)len; i++) + { + sum = 0; + sum += qlp_coeff[1] * data[i-2]; + sum += qlp_coeff[0] * data[i-1]; + residual[i] = data[i] - (sum lp); + } + } + + /* { dg-final { cleanup-tree-dump vect } } */ Index: gcc/testsuite/gcc.dg/vect/pr55857-2.c === *** gcc/testsuite/gcc.dg/vect/pr55857-2.c (revision 0) --- gcc/testsuite/gcc.dg/vect/pr55857-2.c (working copy) *** *** 0 --- 1,21 + /* { dg-do compile } */ + + void foo (int *data, unsigned len, const int qlp_coeff[], + unsigned order, int lp, int residual[]) + { + int i; + int sum; + if(order == 2) + for(i = 0; i (int)len; i++) + { + sum = 0; + sum += qlp_coeff[1] * data[i-2]; + sum += qlp_coeff[0] * data[i-1]; + residual[i] = data[i] - (sum lp); + } + else + for(i = 0; i (int)len; i++) + residual[i] = data[i] - ((qlp_coeff[0] * data[i-1]) lp); + } + + /* { dg-final { cleanup-tree-dump vect } } */ -- 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: extern C fixes for sunCC
On Thu, 3 Jan 2013, Tom Tromey wrote: Marc == Marc Glisse marc.gli...@inria.fr writes: Marc libcpp/ Marc* line-map.c (get_combined_adhoc_loc): Cast to extern C type. Yucky. Yes, there is a discussion of what is necessary for a real fix (and an alternate hack) in the PR: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50177 Do you prefer an other approach? Marc line_map_realloc reallocator Marc -= set-reallocator ? set-reallocator : xrealloc; Marc += set-reallocator ? set-reallocator Marc + : (line_map_realloc) xrealloc; The indentation is wrong here, and it needs extra parens, per the GNU coding standards. I think it should have a comment as well. Like this? (I'll test if approved, but I am not sure what was wrong with the indentation and parentheses so it may be wrong again) Reformatting the patch, I noticed that I only fixed one of the 3 occurences, so here are all 3. * line-map.c (get_combined_adhoc_loc): Cast from extern C type. (new_linemap): Likewise. (linemap_enter_macro): Likewise. -- Marc GlisseIndex: line-map.c === --- line-map.c (revision 194796) +++ line-map.c (working copy) @@ -115,22 +115,24 @@ get_combined_adhoc_loc (struct line_maps lb.data = data; slot = (struct location_adhoc_data **) htab_find_slot (set-location_adhoc_data_map.htab, lb, INSERT); if (*slot == NULL) { if (set-location_adhoc_data_map.curr_loc = set-location_adhoc_data_map.allocated) { char *orig_data = (char *) set-location_adhoc_data_map.data; long long offset; - line_map_realloc reallocator - = set-reallocator ? set-reallocator : xrealloc; + /* Cast away extern C from the type of xrealloc. */ + line_map_realloc reallocator = set-reallocator +? set-reallocator +: ((line_map_realloc) xrealloc); if (set-location_adhoc_data_map.allocated == 0) set-location_adhoc_data_map.allocated = 128; else set-location_adhoc_data_map.allocated *= 2; set-location_adhoc_data_map.data = (struct location_adhoc_data *) reallocator (set-location_adhoc_data_map.data, set-location_adhoc_data_map.allocated * sizeof (struct location_adhoc_data)); offset = (char *) (set-location_adhoc_data_map.data) - orig_data; @@ -210,22 +212,24 @@ new_linemap (struct line_maps *set, /* Depending on this variable, a macro map would be allocated in a different memory location than an ordinary map. */ bool macro_map_p = (reason == LC_ENTER_MACRO); struct line_map *result; if (LINEMAPS_USED (set, macro_map_p) == LINEMAPS_ALLOCATED (set, macro_map_p)) { /* We ran out of allocated line maps. Let's allocate more. */ unsigned alloc_size; - line_map_realloc reallocator - = set-reallocator ? set-reallocator : xrealloc; + /* Cast away extern C from the type of xrealloc. */ + line_map_realloc reallocator = set-reallocator +? set-reallocator +: ((line_map_realloc) xrealloc); line_map_round_alloc_size_func round_alloc_size = set-round_alloc_size; /* We are going to execute some dance to try to reduce the overhead of the memory allocator, in case we are using the ggc-page.c one. The actual size of memory we are going to get back from the allocator is the smallest power of 2 that is greater than the size we requested. So let's consider that size then. */ @@ -423,22 +427,24 @@ linemap_tracks_macro_expansion_locs_p (s locations, this function returns NULL. In that case, callers of this function cannot encode {line,column} pairs into locations of macro tokens anymore. */ const struct line_map * linemap_enter_macro (struct line_maps *set, struct cpp_hashnode *macro_node, source_location expansion, unsigned int num_tokens) { struct line_map *map; source_location start_location; - line_map_realloc reallocator -= set-reallocator ? set-reallocator : xrealloc; + /* Cast away extern C from the type of xrealloc. */ + line_map_realloc reallocator = set-reallocator +? set-reallocator +: ((line_map_realloc) xrealloc); start_location = LINEMAPS_MACRO_LOWEST_LOCATION (set) - num_tokens; if (start_location = set-highest_line || start_location LINEMAPS_MACRO_LOWEST_LOCATION (set)) /* We ran out of macro map space. */ return NULL; map = new_linemap (set, LC_ENTER_MACRO);
[PATCH] Use less vertical spacing in data-ref analysis dumps
This halves the size of vect dumps for mgrid with -details. The dataref analysis parts have too much spacing. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard. 2013-01-03 Richard Biener rguent...@suse.de * tree-data-ref.c (dump_conflict_function): Use less vertical spacing. (dump_subscript): Adjust. (finalize_ddr_dependent): Do not dump redundant info. (analyze_siv_subscript): Adjust. (subscript_dependence_tester): Likewise. (compute_affine_dependence): Likewise. Index: gcc/tree-data-ref.c === *** gcc/tree-data-ref.c (revision 194844) --- gcc/tree-data-ref.c (working copy) *** dump_conflict_function (FILE *outf, conf *** 216,231 unsigned i; if (cf-n == NO_DEPENDENCE) ! fprintf (outf, no dependence\n); else if (cf-n == NOT_KNOWN) ! fprintf (outf, not known\n); else { for (i = 0; i cf-n; i++) { fprintf (outf, [); dump_affine_function (outf, cf-fns[i]); ! fprintf (outf, ]\n); } } } --- 216,233 unsigned i; if (cf-n == NO_DEPENDENCE) ! fprintf (outf, no dependence); else if (cf-n == NOT_KNOWN) ! fprintf (outf, not known); else { for (i = 0; i cf-n; i++) { + if (i != 0) + fprintf (outf, ); fprintf (outf, [); dump_affine_function (outf, cf-fns[i]); ! fprintf (outf, ]); } } } *** dump_subscript (FILE *outf, struct subsc *** 243,266 if (CF_NONTRIVIAL_P (cf)) { tree last_iteration = SUB_LAST_CONFLICT (subscript); ! fprintf (outf, last_conflict: ); ! print_generic_stmt (outf, last_iteration, 0); } cf = SUB_CONFLICTS_IN_B (subscript); ! fprintf (outf, iterations_that_access_an_element_twice_in_B: ); dump_conflict_function (outf, cf); if (CF_NONTRIVIAL_P (cf)) { tree last_iteration = SUB_LAST_CONFLICT (subscript); ! fprintf (outf, last_conflict: ); ! print_generic_stmt (outf, last_iteration, 0); } ! fprintf (outf, (Subscript distance: ); ! print_generic_stmt (outf, SUB_DISTANCE (subscript), 0); ! fprintf (outf, )\n); ! fprintf (outf, )\n); } /* Print the classic direction vector DIRV to OUTF. */ --- 245,267 if (CF_NONTRIVIAL_P (cf)) { tree last_iteration = SUB_LAST_CONFLICT (subscript); ! fprintf (outf, \n last_conflict: ); ! print_generic_expr (outf, last_iteration, 0); } cf = SUB_CONFLICTS_IN_B (subscript); ! fprintf (outf, \n iterations_that_access_an_element_twice_in_B: ); dump_conflict_function (outf, cf); if (CF_NONTRIVIAL_P (cf)) { tree last_iteration = SUB_LAST_CONFLICT (subscript); ! fprintf (outf, \n last_conflict: ); ! print_generic_expr (outf, last_iteration, 0); } ! fprintf (outf, \n (Subscript distance: ); ! print_generic_expr (outf, SUB_DISTANCE (subscript), 0); ! fprintf (outf, ))\n); } /* Print the classic direction vector DIRV to OUTF. */ *** static inline void *** 1507,1519 finalize_ddr_dependent (struct data_dependence_relation *ddr, tree chrec) { - if (dump_file (dump_flags TDF_DETAILS)) - { - fprintf (dump_file, (dependence classified: ); - print_generic_expr (dump_file, chrec, 0); - fprintf (dump_file, )\n); - } - DDR_ARE_DEPENDENT (ddr) = chrec; free_subscripts (DDR_SUBSCRIPTS (ddr)); DDR_SUBSCRIPTS (ddr).create (0); --- 1508,1513 *** end_analyze_subs_aa: *** 2647,2654 dump_conflict_function (dump_file, *overlaps_a); fprintf (dump_file, )\n (overlaps_b = ); dump_conflict_function (dump_file, *overlaps_b); ! fprintf (dump_file, )\n); ! fprintf (dump_file, )\n); } } --- 2641,2647 dump_conflict_function (dump_file, *overlaps_a); fprintf (dump_file, )\n (overlaps_b = ); dump_conflict_function (dump_file, *overlaps_b); ! fprintf (dump_file, ))\n); } } *** analyze_siv_subscript (tree chrec_a, *** 2769,2775 { siv_subscript_dontknow:; if (dump_file (dump_flags TDF_DETAILS)) ! fprintf (dump_file, siv test failed: unimplemented.\n); *overlaps_a = conflict_fn_not_known (); *overlaps_b = conflict_fn_not_known (); *last_conflicts = chrec_dont_know; --- 2762,2768 { siv_subscript_dontknow:; if (dump_file (dump_flags TDF_DETAILS)) ! fprintf (dump_file, siv test failed: unimplemented); *overlaps_a = conflict_fn_not_known (); *overlaps_b = conflict_fn_not_known (); *last_conflicts = chrec_dont_know; *** analyze_overlapping_iterations (tree chr *** 2994,3001
[Patch, Fortran] PR55854/PR55763 - CLASS(*) fixes
The attached patch fixes two ICE. Regarding the unlimited_polymorphic_3.f03 change: null(x) is invalid as initialization expression (null-init). Using ptr2 = x would be valid, but it ICEs. (Cf. PR55763, comment 13) Build and regtested on x86-64-gnu-linux. OK for the trunk? Tobias 2013-01-03 Tobias Burnus bur...@net-b.de PR fortran/55854 PR fortran/55763 * class.c (gfc_class_null_initializer): Fix finding the vtab. (gfc_find_intrinsic_vtab): Use BT_VOID for some components. 2013-01-03 Tobias Burnus bur...@net-b.de PR fortran/55854 PR fortran/55763 * gfortran.dg/unlimited_polymorphic_3.f03: Remove invalid code. * gfortran.dg/unlimited_polymorphic_7.f90: New. * gfortran.dg/unlimited_polymorphic_8.f90: New. diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c index 61d65e7..5cbdd31 100644 --- a/gcc/fortran/class.c +++ b/gcc/fortran/class.c @@ -414,7 +414,7 @@ gfc_class_null_initializer (gfc_typespec *ts, gfc_expr *init_expr) ts-u.derived-components-ts.u.derived-attr.unlimited_polymorphic; if (is_unlimited_polymorphic init_expr) -vtab = gfc_find_intrinsic_vtab ((init_expr-ts)); +vtab = gfc_find_intrinsic_vtab (ts-u.derived-components-ts); else vtab = gfc_find_derived_vtab (ts-u.derived); @@ -2224,9 +2224,7 @@ gfc_find_intrinsic_vtab (gfc_typespec *ts) goto cleanup; c-attr.pointer = 1; c-attr.access = ACCESS_PRIVATE; - /* Avoid segfaults because due to character length. */ - c-ts.type = ts-type == BT_CHARACTER ? BT_VOID : ts-type; - c-ts.kind = ts-kind; + c-ts.type = BT_VOID; c-initializer = gfc_get_null_expr (NULL); /* Add component _def_init. */ @@ -2234,9 +2232,7 @@ gfc_find_intrinsic_vtab (gfc_typespec *ts) goto cleanup; c-attr.pointer = 1; c-attr.access = ACCESS_PRIVATE; - /* Avoid segfaults due to missing character length. */ - c-ts.type = ts-type == BT_CHARACTER ? BT_VOID : ts-type; - c-ts.kind = ts-kind; + c-ts.type = BT_VOID; c-initializer = gfc_get_null_expr (NULL); /* Add component _copy. */ diff --git a/gcc/testsuite/gfortran.dg/unlimited_polymorphic_3.f03 b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_3.f03 index 5ed9897..05a4b3f 100644 --- a/gcc/testsuite/gfortran.dg/unlimited_polymorphic_3.f03 +++ b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_3.f03 @@ -28,9 +28,7 @@ contains end type t type(t), pointer :: x class(*), pointer :: ptr1 = null() ! pointer initialization -class(*), pointer :: ptr2 = null(x) ! pointer initialization if (same_type_as (ptr1, x) .neqv. .FALSE.) call abort -if (same_type_as (ptr2, x) .neqv. .TRUE.) call abort end subroutine bar end program main diff --git a/gcc/testsuite/gfortran.dg/unlimited_polymorphic_7.f90 b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_7.f90 new file mode 100644 index 000..3bd4d4d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_7.f90 @@ -0,0 +1,19 @@ +! { dg-do compile } +! +! PR fortran/55763 +! +! Contributed by Harald Anlauf +! + +module gfcbug121 + implicit none + type myobj + class(*), allocatable :: x + contains + procedure :: print + end type myobj +contains + subroutine print(this) +class(myobj) :: this + end subroutine print +end module gfcbug121 diff --git a/gcc/testsuite/gfortran.dg/unlimited_polymorphic_8.f90 b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_8.f90 new file mode 100644 index 000..e0fa931 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_8.f90 @@ -0,0 +1,20 @@ +! { dg-do compile } +! { dg-options -fdump-tree-original } +! +! PR fortran/55854 +! +! Contributed by Damian Rouson +! + + type foo +class(*), allocatable :: x + end type +contains + subroutine bar(this) +type(foo), intent(out) :: this + end +end + +! { dg-final { scan-tree-dump-times foo.0.x._data = 0B; 1 original } } +! { dg-final { scan-tree-dump-times foo.0.x._vptr = .* __vtab__.tar; 1 original } } +! { dg-final { cleanup-tree-dump optimized } }
C++ PATCH for c++/53650 (memory-hog with large array)
My patch for c++/48370 changed initialization of an array from a brace-enclosed initializer list so that even when the initializer is omitted, we were filling out the CONSTRUCTOR with the appropriate value-initialization semantics. For a large array, this causes the internal representation to be a lot larger than iterating over the array, initializing all the elements with the same code. The 48370 fix only really needs to do that for array initializers which might contain temporaries that need to have their lifetimes extended, so this patch limits the earlier change to element types that could be affected. The build_vec_init hunk is to avoid regressing on c++/35602 now that we're using build_vec_init again on that testcase. Tested x86_64-pc-linux-gnu, applying to trunk for now. commit 8174b0f1a41d8c05f1a72868062faaa2229f15f4 Author: Jason Merrill ja...@redhat.com Date: Wed Jan 2 20:37:21 2013 -0500 PR c++/53650 * call.c (type_has_extended_temps): New. * cp-tree.h: Declare it. * decl.c (check_initializer): Use build_aggr_init for arrays if it is false. * init.c (build_vec_init): Avoid mixed signed/unsigned arithmetic. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index ad39637..1466c4b 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -9234,6 +9234,28 @@ extend_ref_init_temps (tree decl, tree init, vectree, va_gc **cleanups) return init; } +/* Returns true iff an initializer for TYPE could contain temporaries that + need to be extended because they are bound to references or + std::initializer_list. */ + +bool +type_has_extended_temps (tree type) +{ + type = strip_array_types (type); + if (TREE_CODE (type) == REFERENCE_TYPE) +return true; + if (CLASS_TYPE_P (type)) +{ + if (is_std_init_list (type)) + return true; + for (tree f = next_initializable_field (TYPE_FIELDS (type)); + f; f = next_initializable_field (DECL_CHAIN (f))) + if (type_has_extended_temps (TREE_TYPE (f))) + return true; +} + return false; +} + /* Returns true iff TYPE is some variant of std::initializer_list. */ bool diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 465fa0f..810df7d 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -4952,6 +4952,7 @@ extern tree initialize_reference (tree, tree, int, tsubst_flags_t); extern tree extend_ref_init_temps (tree, tree, vectree, va_gc**); extern tree make_temporary_var_for_ref_to_temp (tree, tree); +extern bool type_has_extended_temps (tree); extern tree strip_top_quals (tree); extern bool reference_related_p (tree, tree); extern tree perform_implicit_conversion (tree, tree, tsubst_flags_t); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 52ceefc..5c268b1 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -5657,7 +5657,9 @@ check_initializer (tree decl, tree init, int flags, vectree, va_gc **cleanups) if ((type_build_ctor_call (type) || CLASS_TYPE_P (type)) !(flags LOOKUP_ALREADY_DIGESTED) !(init BRACE_ENCLOSED_INITIALIZER_P (init) - CP_AGGREGATE_TYPE_P (type))) + CP_AGGREGATE_TYPE_P (type) + (CLASS_TYPE_P (type) + || type_has_extended_temps (type { init_code = build_aggr_init_full_exprs (decl, init, flags); diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 6edc0a5..2ee2473 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -3637,7 +3637,9 @@ build_vec_init (tree base, tree maxindex, tree init, if (TREE_CODE (type) == ARRAY_TYPE) m = cp_build_binary_op (input_location, MULT_EXPR, m, -array_type_nelts_total (type), +/* Avoid mixing signed and unsigned. */ +convert (TREE_TYPE (m), + array_type_nelts_total (type)), complain); finish_cleanup_try_block (try_block); diff --git a/gcc/testsuite/g++.dg/init/array34.C b/gcc/testsuite/g++.dg/init/array34.C new file mode 100644 index 000..c5f608b --- /dev/null +++ b/gcc/testsuite/g++.dg/init/array34.C @@ -0,0 +1,13 @@ +// PR c++/53650 +// We should loop over array inits if they don't involve temporaries +// that need extending. +// { dg-final { scan-assembler-times _ZN5ClassC1Ev 1 } } + +struct Class { + Class(); +}; + +int main() { + Class table [10] = {}; + return 0; +}
Re: [PATCH]: Fix for PR 55707 bootstrap fails in gcc/graphite-dependences.c error cast loses precision
Hi Rainer, applied at rev 194859. Thanks, Kai
Re: C++ PATCH for c++/53650 (memory-hog with large array)
On Thu, Jan 03, 2013 at 11:48:48AM -0500, Jason Merrill wrote: --- /dev/null +++ b/gcc/testsuite/g++.dg/init/array34.C @@ -0,0 +1,13 @@ +// PR c++/53650 +// We should loop over array inits if they don't involve temporaries +// that need extending. +// { dg-final { scan-assembler-times _ZN5ClassC1Ev 1 } } + +struct Class { + Class(); +}; + +int main() { + Class table [10] = {}; + return 0; +} Won't the test fail on weirdo targets that need some extern directives for the external symbols? I'd say safer would be to scan the gimple dump instead... Jakub
PATCH: Fix ChangeLog entry for PR lto/55466
Hi, I checked in this patch to fix ChangeLog entry for PR lto/55466. H.J. --- diff --git a/gcc/ChangeLog-2012 b/gcc/ChangeLog-2012 index ae21e02..ee4c574 100644 --- a/gcc/ChangeLog-2012 +++ b/gcc/ChangeLog-2012 @@ -790,9 +790,6 @@ PR lto/55466 * lto-symtab.c (lto_symtab_merge_decls_1): Don't record the prevailing variable. - * lto.c (lto_register_var_decl_in_symtab): Don't record static - variables. - (lto_main): Record the global variables if WPA isn't enabled. 2012-12-10 Richard Biener rguent...@suse.de diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 9e0de2a..061408f 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,10 @@ +2012-12-10 H.J. Lu hongjiu...@intel.com + + PR lto/55466 + * lto.c (lto_register_var_decl_in_symtab): Don't record static + variables. + (lto_main): Record the global variables if WPA isn't enabled. + 2012-11-20 Diego Novillo dnovi...@google.com Jakub Jelinek ja...@redhat.com
Re: Use libstdc++-raw-cxx.m4 in libjava
On Wed, Jan 2, 2013 at 3:27 AM, Andreas Schwab sch...@linux-m68k.org wrote: Jakub Jelinek ja...@redhat.com writes: On Tue, Dec 11, 2012 at 02:00:18PM -0800, H.J. Lu wrote: 2012-12-11 H.J. Lu hongjiu...@intel.com * libstdc++-raw-cxx.m4 (GCC_LIBSTDCXX_RAW_CXX_FLAGS): Also AC_SUBST LIBSTDCXX_RAW_CXX_LDFLAGS. --- a/config/libstdc++-raw-cxx.m4 +++ b/config/libstdc++-raw-cxx.m4 @@ -14,13 +14,17 @@ # along with GCC; see the file COPYING3. If not see # http://www.gnu.org/licenses/. -# Define compiler flags, LIBSTDCXX_RAW_CXX_CXXFLAGS, for libstdc++-v3 -# header files to compile libraries in C++ with raw_cxx=true. +# Define flags, LIBSTDCXX_RAW_CXX_CXXFLAGS and # LIBSTDCXX_RAW_CXX_LDFLAGS, +# for libstdc++-v3 header files to compile and link libraries in C++ with +# raw_cxx=true. AC_DEFUN([GCC_LIBSTDCXX_RAW_CXX_FLAGS], [ AC_REQUIRE([ACX_NONCANONICAL_TARGET]) LIBSTDCXX_RAW_CXX_CXXFLAGS=\ -I\$(top_builddir)/../libstdc++-v3/include \ -I\$(top_builddir)/../libstdc++-v3/include/\$(target_noncanonical) \ -I\$(top_srcdir)/../libstdc++-v3/libsupc++ + LIBSTDCXX_RAW_CXX_LDFLAGS=\ +-I\$(top_builddir)/../libstdc++-v3/src/libstdc++.la -I/libstdc++-v3/src/libstdc++.la ? That can't be right, libstdc++.la is not a directory containing header files. And a library shouldn't be put on LDFLAGS, but on LIBADD. And LIBSTDCXX_RAW_CXX_LDLAGS doesn't exist. Here is the patch. OK to install? Thanks. -- H.J. --- config/ 2013-01-03 H.J. Lu hongjiu...@intel.com * libstdc++-raw-cxx.m4 (GCC_LIBSTDCXX_RAW_CXX_FLAGS): Replace LIBSTDCXX_RAW_CXX_LDFLAGS with LIBSTDCXX_RAW_CXX_LIBADD. libjava/ 2013-01-03 H.J. Lu hongjiu...@intel.com * Makefile.am (lib_gnu_awt_xlib_la_LDFLAGS): Replace LIBSTDCXX_RAW_CXX_LDLAGS with LIBSTDCXX_RAW_CXX_LIBADD. * Makefile.in: Regenerated. libsanitizer/ 2013-01-03 H.J. Lu hongjiu...@intel.com * asan/Makefile.am (libasan_la_LIBADD): Replace LIBSTDCXX_RAW_CXX_LDLAGS with LIBSTDCXX_RAW_CXX_LIBADD. * tsan/Makefile.am (libtsan_la_LIBADD): Likewise. * Makefile.in: Regenerated. * configure: Likewise. * asan/Makefile.in: Likewise. * interception/Makefile.in: Likewise. * sanitizer_common/Makefile.in: Likewise. * tsan/Makefile.in: Likewise. diff --git a/config/libstdc++-raw-cxx.m4 b/config/libstdc++-raw-cxx.m4 index 8052c2f..d7aa1a9 100644 --- a/config/libstdc++-raw-cxx.m4 +++ b/config/libstdc++-raw-cxx.m4 @@ -23,8 +23,8 @@ AC_DEFUN([GCC_LIBSTDCXX_RAW_CXX_FLAGS], [ -I\$(top_builddir)/../libstdc++-v3/include \ -I\$(top_builddir)/../libstdc++-v3/include/\$(target_noncanonical) \ -I\$(top_srcdir)/../libstdc++-v3/libsupc++ - LIBSTDCXX_RAW_CXX_LDFLAGS=\ --I\$(top_builddir)/../libstdc++-v3/src/libstdc++.la + LIBSTDCXX_RAW_CXX_LIBADD=\ +\$(top_builddir)/../libstdc++-v3/src/libstdc++.la AC_SUBST(LIBSTDCXX_RAW_CXX_CXXFLAGS) - AC_SUBST(LIBSTDCXX_RAW_CXX_LDFLAGS) + AC_SUBST(LIBSTDCXX_RAW_CXX_LIBADD) ]) diff --git a/libjava/Makefile.am b/libjava/Makefile.am index c6c84e4..dd08a4f 100644 --- a/libjava/Makefile.am +++ b/libjava/Makefile.am @@ -594,7 +594,7 @@ lib_gnu_awt_xlib_la_CPPFLAGS = \ $(AM_CPPFLAGS) \ $(LIBSTDCXX_RAW_CXX_CXXFLAGS) ## The mysterious backslash in the grep pattern is consumed by make. -lib_gnu_awt_xlib_la_LDFLAGS = $(LIBSTDCXX_RAW_CXX_LDLAGS) \ +lib_gnu_awt_xlib_la_LDFLAGS = $(LIBSTDCXX_RAW_CXX_LIBADD) \ @X_PRE_LIBS@ @X_LIBS@ -lX11 @X_EXTRA_LIBS@ \ -rpath $(toolexeclibdir) $(LIBJAVA_LDFLAGS_NOUNDEF) \ -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LIBGCJ_LD_SYMBOLIC) diff --git a/libsanitizer/asan/Makefile.am b/libsanitizer/asan/Makefile.am index 76cdcfd..b5a61ec 100644 --- a/libsanitizer/asan/Makefile.am +++ b/libsanitizer/asan/Makefile.am @@ -40,7 +40,7 @@ libasan_la_LIBADD = $(top_builddir)/sanitizer_common/libsanitizer_common.la else libasan_la_LIBADD = $(top_builddir)/sanitizer_common/libsanitizer_common.la $(top_builddir)/interception/libinterception.la endif -libasan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDLAGS) +libasan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LIBADD) libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` -lpthread -ldl diff --git a/libsanitizer/tsan/Makefile.am b/libsanitizer/tsan/Makefile.am index 435fe71..62e339e 100644 --- a/libsanitizer/tsan/Makefile.am +++ b/libsanitizer/tsan/Makefile.am @@ -34,7 +34,7 @@ tsan_files = \ tsan_symbolize_addr2line_linux.cc libtsan_la_SOURCES = $(tsan_files) -libtsan_la_LIBADD = $(top_builddir)/sanitizer_common/libsanitizer_common.la $(top_builddir)/interception/libinterception.la $(LIBSTDCXX_RAW_CXX_LDLAGS) +libtsan_la_LIBADD = $(top_builddir)/sanitizer_common/libsanitizer_common.la $(top_builddir)/interception/libinterception.la $(LIBSTDCXX_RAW_CXX_LIBADD) libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` -lpthread
[PATCH, i386]: Fix PR 55712, cpuinfo.c doesn't compile for x86-64 with medium memory model
On Sun, Dec 30, 2012 at 8:08 PM, Uros Bizjak ubiz...@gmail.com wrote: On Fri, Dec 28, 2012 at 9:27 PM, Richard Henderson r...@redhat.com wrote: On 12/27/2012 12:08 AM, Uros Bizjak wrote: The alternative approach is changing cpuid definition in cpuid.h (as in attached patch) to preserve %rbx, but we can't detect various code model settings there. Since the change depends on the definition of __PIC__, we unnecessary preserve %rbx also for -mcmodel=small. Certainly we can. We also control the preprocessor defines. All that's needed is that we create one for the code model. Something like attached? I have also included all suggestions (earlyclobber and operand prefix on temporary register). 2012-12-30 Uros Bizjak ubiz...@gmail.com PR target/55712 * config/i386/i386-c.c (ix86_target_macros_internal): Depending on selected code model, define __code_mode_small__, __code_model_medium__, __code_model_large__, __code_model_32__ or __code_model_kernel__. * config/i386/cpuid.h (__cpuid, __cpuid_count) [__i386__]: Prefix xchg temporary register with %k. Declare temporary register as early clobbered. [__x86_64__]: For medium and large code models, preserve %rbx register. Tested on x86_64-pc-linux-gnu {,-m32}. I have committed the patch to mainline SVN. The patch will be backported to 4.7 branch after a couple of days. Uros.
Re: extern C fixes for sunCC
Marc == Marc Glisse marc.gli...@inria.fr writes: Marc Do you prefer an other approach? No, this is fine, just yucky. Marc Like this? (I'll test if approved, but I am not sure what was wrong Marc with the indentation and parentheses so it may be wrong again) From the node 'Formatting' in the GCS: Insert extra parentheses so that Emacs will indent the code properly. For example, the following indentation looks nice if you do it by hand, v = rup-ru_utime.tv_sec*1000 + rup-ru_utime.tv_usec/1000 + rup-ru_stime.tv_sec*1000 + rup-ru_stime.tv_usec/1000; but Emacs would alter it. Adding a set of parentheses produces something that looks equally nice, and which Emacs will preserve: v = (rup-ru_utime.tv_sec*1000 + rup-ru_utime.tv_usec/1000 + rup-ru_stime.tv_sec*1000 + rup-ru_stime.tv_usec/1000); The comments seem fine. It is ok with the formatting fixed. Tom
[PATCH, PR 55755] Make SRA create less VIEW_CONVERT_EXPRs
Hi, the patch below fixes PR 55755 which was in the compiler for years. The problem is that a replacement of a bit-field can have a larger TYPE_SIZE than the type of the field and so creating a V_C_E from it to the field type may result in invalid gimple. We do that when we scalarize only one side of an assignment and get incompatible types on both sides and the other (non-scalar) side has a child access in the access tree (regardless if it is to be scalarize or not). When looking at the issue I realized that the last condition is completely unnecessary (at least now, the first concepts of the new SRA were a bit different) because the subsequent handling of sub-replacements will do the right thing (load/store them to the original aggregate) and removing it is indeed the correct thing to deal with this bug - if both sides are scalarized, size of both will grow to mode size, if only one, we can avoid the V_C_E. I am a little worried about the contains_bitfld_comp_ref_p and contains_vce_or_bfcref_p gurads which are there because of Ada PR 46349 (which involves aggregate bit-fields) and which might in theory lead to the same problem but I'm weary of touching it, at least not in one commit (I'm testing what happens if I remove them right now), and this patch does not make the current situation any worse. In order to make sure we do not mess up when the non-scalar side has sub-replacements in it, I have added a new testcase. The patch has passed bootstrap and testing on x86_64-linux on trunk and the 4.7 and 4.6 branches. I'd like to commit it to all of them, perhaps after having it on trunk only for a while. Thanks, Martin 2013-01-02 Martin Jambor mjam...@suse.cz PR tree-optimization/55755 * tree-sra.c (sra_modify_assign): Do not check that an access has no children when trying to avoid producing a VIEW_CONVERT_EXPR. testsuite/ * gcc.dg/torture/pr55755.c: New test. * gcc.dg/tree-ssa/sra-13.c: Likewise. * gcc.dg/tree-ssa/pr45144.c: Update. Index: src/gcc/testsuite/gcc.dg/torture/pr55755.c === --- /dev/null +++ src/gcc/testsuite/gcc.dg/torture/pr55755.c @@ -0,0 +1,43 @@ +/* { dg-do run } */ +/* { dg-require-effective-target int32plus } */ + +struct S4 +{ + unsigned f0:24; +} __attribute__((__packed__)); + +struct S4 g_10 = { + 6210831 +}; + +struct S5 +{ + int i; + struct S4 l_8[2]; +} __attribute__((__packed__)); + +int a, b; + +struct S4 func_2 (int x) +{ + struct S5 l = { +0, +{{0}, {0}} + }; + l.i = a; + g_10 = l.l_8[1]; + for (; x2; x++) { +struct S4 tmp = { + 11936567 +}; +l.l_8[x] = tmp; + } + b = l.i; + return g_10; +} + +int main (void) +{ + func_2 (0); + return 0; +} Index: src/gcc/testsuite/gcc.dg/tree-ssa/sra-13.c === --- /dev/null +++ src/gcc/testsuite/gcc.dg/tree-ssa/sra-13.c @@ -0,0 +1,114 @@ +/* Test that SRA replacement can deal with assignments that have + sub-replacements on one side and a single scalar replacement on another. */ +/* { dg-do run } */ +/* { dg-options -O1 } */ + +struct A +{ + int i1, i2; +}; + +struct B +{ + long long int l; +}; + +union U +{ + struct A a; + struct B b; +}; + +int b, gi; +long gl; +union U gu1, gu2; + +int __attribute__ ((noinline, noclone)) +foo (void) +{ + union U x, y; + int r; + + y = gu1; + if (b) +y.b.l = gl; + + x = y; + + if (!b) +r = x.a.i1; + else +r = 0; + + gu2 = x; + return r; +} + +long long int __attribute__ ((noinline, noclone)) +bar (void) +{ + union U x, y; + int r; + + y = gu1; + if (b) +y.a.i1 = gi; + + x = y; + + if (!b) +r = x.b.l; + else +r = 0; + + gu2 = x; + return r; +} + + +int +main (void) +{ + int r; + long long int s; + + b = 0; + gu1.a.i1 = 123; + gu1.a.i2 = 234; + r = foo (); + if (r != 123) +__builtin_abort (); + if (gu2.a.i1 != 123) +__builtin_abort (); + if (gu2.a.i2 != 234) +__builtin_abort (); + + b = 1; + gl = 1001; + gu1.b.l = 1000; + r = foo (); + if (r != 0) +__builtin_abort (); + if (gu2.b.l != 1001) +__builtin_abort (); + + b = 0; + gu1.b.l = 2000; + s = bar (); + if (s != 2000) +__builtin_abort (); + if (gu2.b.l != 2000) +__builtin_abort (); + + b = 1; + gi = 456; + gu1.a.i1 = 123; + gu1.a.i2 = 234; + s = bar (); + if (s != 0) +__builtin_abort (); + if (gu2.a.i1 != 456) +__builtin_abort (); + + return 0; +} Index: src/gcc/tree-sra.c === --- src.orig/gcc/tree-sra.c +++ src/gcc/tree-sra.c @@ -3087,15 +3087,13 @@ sra_modify_assign (gimple *stmt, gimple_ ??? This should move to fold_stmt which we simply should call after building a VIEW_CONVERT_EXPR here. */ if (AGGREGATE_TYPE_P (TREE_TYPE (lhs)) - !contains_bitfld_comp_ref_p (lhs) -
Re: Use libstdc++-raw-cxx.m4 in libjava
H.J. Lu hjl.to...@gmail.com writes: diff --git a/libjava/Makefile.am b/libjava/Makefile.am index c6c84e4..dd08a4f 100644 --- a/libjava/Makefile.am +++ b/libjava/Makefile.am @@ -594,7 +594,7 @@ lib_gnu_awt_xlib_la_CPPFLAGS = \ $(AM_CPPFLAGS) \ $(LIBSTDCXX_RAW_CXX_CXXFLAGS) ## The mysterious backslash in the grep pattern is consumed by make. -lib_gnu_awt_xlib_la_LDFLAGS = $(LIBSTDCXX_RAW_CXX_LDLAGS) \ +lib_gnu_awt_xlib_la_LDFLAGS = $(LIBSTDCXX_RAW_CXX_LIBADD) \ @X_PRE_LIBS@ @X_LIBS@ -lX11 @X_EXTRA_LIBS@ \ -rpath $(toolexeclibdir) $(LIBJAVA_LDFLAGS_NOUNDEF) \ -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LIBGCJ_LD_SYMBOLIC) It is still wrong to use LDFLAGS for libraries to be linked in. All of $(LIBSTDCXX_RAW_CXX_LIBADD) @X_PRE_LIBS@ @X_LIBS@ -lX11 @X_EXTRA_LIBS@ should be on lib_gnu_awt_xlib_la_LDADD. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 And now for something completely different.
C++ PATCH for c++/55856 (ICE with tuple of reference)
In the original testcase, the constexpr code was getting confused by a DECL_EXPR for a lifetime-extended temporary bound to the reference member of the tuple. Tested x86_64-pc-linux-gnu, applying to trunk and 4.7. commit e9f73b2b5a67a425ae52755a6f9bebe16fc2398d Author: Jason Merrill ja...@redhat.com Date: Thu Jan 3 13:16:14 2013 -0500 PR c++/55856 * semantics.c (build_data_member_initialization): Handle DECL_EXPR. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index f649399..9f8119f 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -5848,15 +5848,19 @@ build_data_member_initialization (tree t, vecconstructor_elt, va_gc **vec) member = TREE_OPERAND (t, 0); init = unshare_expr (TREE_OPERAND (t, 1)); } - else + else if (TREE_CODE (t) == CALL_EXPR) { - gcc_assert (TREE_CODE (t) == CALL_EXPR); member = CALL_EXPR_ARG (t, 0); /* We don't use build_cplus_new here because it complains about abstract bases. Leaving the call unwrapped means that it has the wrong type, but cxx_eval_constant_expression doesn't care. */ init = unshare_expr (t); } + else if (TREE_CODE (t) == DECL_EXPR) +/* Declaring a temporary, don't add it to the CONSTRUCTOR. */ +return true; + else +gcc_unreachable (); if (TREE_CODE (member) == INDIRECT_REF) member = TREE_OPERAND (member, 0); if (TREE_CODE (member) == NOP_EXPR) diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor11.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor11.C new file mode 100644 index 000..4b526ea --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor11.C @@ -0,0 +1,16 @@ +// PR c++/55856 +// { dg-options -std=c++11 } + +struct A +{ + A(const char *); +}; + +template class T +struct B +{ + T t; + template class U constexpr B(U u): t(u) { }; +}; + +BA b();
Re: C++ PATCH for c++/53650 (memory-hog with large array)
On 01/03/2013 11:54 AM, Jakub Jelinek wrote: I'd say safer would be to scan the gimple dump instead... That makes sense. commit 8a13c5cee23447467ed58bb1f213cad9050e3f87 Author: jason jason@138bc75d-0d04-0410-961f-82ee72b054a4 Date: Thu Jan 3 18:34:48 2013 + PR c++/53650 * g++.dg/init/array34.C: Check gimple dump, not assembler. diff --git a/gcc/testsuite/g++.dg/init/array34.C b/gcc/testsuite/g++.dg/init/array34.C index c5f608b..1c2e022 100644 --- a/gcc/testsuite/g++.dg/init/array34.C +++ b/gcc/testsuite/g++.dg/init/array34.C @@ -1,7 +1,9 @@ // PR c++/53650 // We should loop over array inits if they don't involve temporaries // that need extending. -// { dg-final { scan-assembler-times _ZN5ClassC1Ev 1 } } +// { dg-options -fdump-tree-gimple } +// { dg-final { scan-tree-dump-times Class::Class 1 gimple } } +// { dg-final { cleanup-tree-dump gimple } } struct Class { Class();
Re: [committed] Fix ICE in gen_reg_rtx, at emit-rtl.c:864/865 compiling GNU MPFR
David Edelsohn dje@gmail.com writes: The testcase should have included dg-add-options tls. committed as obvious. Thanks. I also removed the main point of the test in a final tweak. Also committed as obvious after testing on mips64-linux-gnu. Richard gcc/testsuite/ * gcc.dg/torture/tls/tls-reload-1.c (main): Make testing more thorough. Index: gcc/testsuite/gcc.dg/torture/tls/tls-reload-1.c === --- gcc/testsuite/gcc.dg/torture/tls/tls-reload-1.c 2013-01-03 18:49:20.0 + +++ gcc/testsuite/gcc.dg/torture/tls/tls-reload-1.c 2013-01-03 18:49:49.574422889 + @@ -42,7 +42,7 @@ main (void) int i; setup (array); - B(CHECK, tls); + C(CHECK, tls); if (!y) abort (); return 0;
C++ PATCH for c++/55842 (ICE with noexcept and __has_nothrow_constructor)
We need to instantiate a deferred noexcept when evaluationg __has_nothrow_constructor. Tested x86_64-pc-linux-gnu, applying to trunk and 4.7. commit 2b440f24a3319736c477523f65af741f97068ab6 Author: Jason Merrill ja...@redhat.com Date: Thu Jan 3 14:38:54 2013 -0500 PR c++/55842 * semantics.c (trait_expr_value): Call maybe_instantiate_noexcept. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 9f8119f..2e02295 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -5454,7 +5454,8 @@ trait_expr_value (cp_trait_kind kind, tree type1, tree type2) return (trait_expr_value (CPTK_HAS_TRIVIAL_CONSTRUCTOR, type1, type2) || (CLASS_TYPE_P (type1) (t = locate_ctor (type1)) - TYPE_NOTHROW_P (TREE_TYPE (t; + (maybe_instantiate_noexcept (t), + TYPE_NOTHROW_P (TREE_TYPE (t); case CPTK_HAS_TRIVIAL_CONSTRUCTOR: type1 = strip_array_types (type1); diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_constructor-2.C b/gcc/testsuite/g++.dg/ext/has_nothrow_constructor-2.C new file mode 100644 index 000..9191c3e --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/has_nothrow_constructor-2.C @@ -0,0 +1,7 @@ +// PR c++/55842 +// { dg-options -std=c++11 } + +template class=void struct number { + number() noexcept(noexcept(0)) { } +}; +const int z=__has_nothrow_constructor(number);
C++ PATCH for c++/55753 (ICE with constexpr)
This is a bit I missed in my 55419 patch; if we aren't setting TREE_CONSTANT on TARGET_EXPRs in the constexpr code, we can't expect it in the template code. Tested x86_64-pc-linux-gnu, applying to trunk and 4.7. commit db160eb9b07b62f3696e7358c74e6d59c68385d8 Author: Jason Merrill ja...@redhat.com Date: Thu Jan 3 14:43:05 2013 -0500 PR c++/55419 PR c++/55753 * pt.c (tsubst_copy_and_build) [TARGET_EXPR]: Don't touch TREE_CONSTANT. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 1b3f039..09a0aa5 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -14333,11 +14333,9 @@ tsubst_copy_and_build (tree t, case TARGET_EXPR: /* We can get here for a constant initializer of non-dependent type. FIXME stop folding in cp_parser_initializer_clause. */ - gcc_assert (TREE_CONSTANT (t)); { tree r = get_target_expr_sfinae (RECUR (TARGET_EXPR_INITIAL (t)), complain); - TREE_CONSTANT (r) = true; RETURN (r); } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor12.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor12.C new file mode 100644 index 000..a5a4b4d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor12.C @@ -0,0 +1,14 @@ +// PR c++/55753 +// { dg-options -std=c++11 } + +template typename Tp +struct C { + constexpr C(const Tp r) { } +}; + +template typename Tp +struct B { + B() { +Cdouble cpl = Cdouble((true ? 1.0 : Cdouble())); + } +};
[Patch, fortran] PR55827 ICE with multiple fortran modules.
Hello, here is a fix for PR fortran/55827 where we had a function expression (loaded from a module) whose symtree pointer was NULL. My attempt to have symtree properly set got me way too far, so this is fixing the unconditional usages of symtree based on Steve's patch in the PR. As noted in the PR, it looks bogus to have a NULL expr-symtree, but in fact expr-value.function.esym is set, and it is what is solely looked at, apart for the cases fixed in this patch. The trans-expr.c part initializes `sym' earlier and uses it instead of accessing `expr-symtree' directly. The class.c part creates a similar construct to initialize `ts' without accessing `expr-symtree' directly. I don't use Steve's way (returning early for a NULL symtree), because I remembered that `expr-symtree' could be a generic symbol, thus have invalid type for use to initialize `ts', contrary to `expr-value.function.esym'. It's better to always use `esym' when it is available. And then returning early on NULL symtree is not necessary any more. Regression tested on x86_64-unknown-linux-gnu. OK for trunk? Do we want it on the branches as well? Mikael 2013-01-03 Steven G. Kargl ka...@gcc.gnu.org Mikael Morin mik...@gcc.gnu.org * class.c (gfc_fix_class_refs): Adapt ts initialization for the case e-symtree == NULL. * trans-expr.c (gfc_conv_function_expr): Init sym earlier. Use it. diff --git a/class.c b/class.c index 8a8a54a..8b00a2c 100644 --- a/class.c +++ b/class.c @@ -166,7 +166,23 @@ gfc_fix_class_refs (gfc_expr *e) e-value.function.isym != NULL)) return; - ts = e-symtree-n.sym-ts; + if (e-expr_type == EXPR_VARIABLE) +ts = e-symtree-n.sym-ts; + else +{ + gfc_symbol *func; + + gcc_assert (e-expr_type == EXPR_FUNCTION); + if (e-value.function.esym != NULL) + func = e-value.function.esym; + else + func = e-symtree-n.sym; + + if (func-result != NULL) + ts = func-result-ts; + else + ts = func-ts; +} for (ref = e-ref; *ref != NULL; ref = (*ref)-next) { diff --git a/trans-expr.c b/trans-expr.c index 42f6e0c..d36b466 100644 --- a/trans-expr.c +++ b/trans-expr.c @@ -5420,20 +5420,20 @@ gfc_conv_function_expr (gfc_se * se, gfc_expr * expr) return; } + /* expr.value.function.esym is the resolved (specific) function symbol for + most functions. However this isn't set for dummy procedures. */ + sym = expr-value.function.esym; + if (!sym) +sym = expr-symtree-n.sym; + /* We distinguish statement functions from general functions to improve runtime performance. */ - if (expr-symtree-n.sym-attr.proc == PROC_ST_FUNCTION) + if (sym-attr.proc == PROC_ST_FUNCTION) { gfc_conv_statement_function (se, expr); return; } - /* expr.value.function.esym is the resolved (specific) function symbol for - most functions. However this isn't set for dummy procedures. */ - sym = expr-value.function.esym; - if (!sym) -sym = expr-symtree-n.sym; - gfc_conv_procedure_call (se, sym, expr-value.function.actual, expr, NULL); } 2013-01-03 Steven G. Kargl ka...@gcc.gnu.org Mikael Morin mik...@gcc.gnu.org * gfortran.dg/use_10.f90: New test. ! { dg-do compile } ! ! PR fortran/55827 ! gfortran used to ICE with the call to `tostring' depending on how the ! `tostring' symbol was USE-associated. ! ! Contributed by Lorenz Hüdepohl b...@stellardeath.org module stringutils interface pure function strlen(handle) result(len) integer, intent(in) :: handle integer :: len end function end interface end module module intermediate ! does not die if this module is merged with stringutils contains function tostring(handle) result(string) use stringutils integer, intent(in) :: handle character(len=strlen(handle)) :: string end function end module module usage contains subroutine dies_here(handle) use stringutils ! does not die if this unnecessary line is omitted or placed after use intermediate use intermediate integer :: handle write(*,*) tostring(handle) ! ICE end subroutine end module
Re: [C++ Patch] PR 54526 (again)
On 01/03/2013 05:44 AM, Paolo Carlini wrote: + /* C++11 - 2.5 p3, bullet 2. */ Please flesh out this comment some more. Jason
[AARCH64] Optimize cmp in some cases
Hi, For aarch64, we don't CSE some cmp away. This patch fixes the case where we are CSE across some basic-blocks like: int f(int a, int b) { if(ab) return 1; if(ab) return -1; return 0; } --- CUT --- To fix this, I implemented the target hook TARGET_FIXED_CONDITION_CODE_REGS as there was already code in CSE which uses this target hook to find the extra setting of the CC registers. OK? Build and tested on aarch64-thunder-elf (using Cavium's internal simulator). Build a cross to aarch64-thunder-linux-gnu and a Canadian cross with that one for the native toolchain. Thanks, Andrew Pinski * config/aarch64/aarch64.c (aarch64_fixed_condition_code_regs): New function. (TARGET_FIXED_CONDITION_CODE_REGS): Define. * gcc.target/aarch64/cmp-1.c: New testcase. * config/aarch64/aarch64.c (aarch64_fixed_condition_code_regs): New function. (TARGET_FIXED_CONDITION_CODE_REGS): Define. * gcc.target/aarch64/cmp-1.c: New testcase. Index: testsuite/gcc.target/aarch64/cmp-1.c === --- testsuite/gcc.target/aarch64/cmp-1.c(revision 0) +++ testsuite/gcc.target/aarch64/cmp-1.c(revision 0) @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options -O2 } */ + +int f(int a, int b) +{ + if(ab) +return 1; + if(ab) +return -1; + return 0; +} + +/* We should optimize away the second cmp. */ +/* { dg-final { scan-assembler-times cmp\tw 1 } } */ + Index: config/aarch64/aarch64.c === --- config/aarch64/aarch64.c(revision 194872) +++ config/aarch64/aarch64.c(working copy) @@ -3041,6 +3041,16 @@ aarch64_const_double_zero_rtx_p (rtx x) return REAL_VALUES_EQUAL (r, dconst0); } +/* Return the fixed registers used for condition codes. */ + +static bool +aarch64_fixed_condition_code_regs (unsigned int *p1, unsigned int *p2) +{ + *p1 = CC_REGNUM; + *p2 = -1; + return true; +} + enum machine_mode aarch64_select_cc_mode (RTX_CODE code, rtx x, rtx y) { @@ -7551,6 +7561,9 @@ aarch64_vectorize_vec_perm_const_ok (enu #define TARGET_VECTORIZE_VEC_PERM_CONST_OK \ aarch64_vectorize_vec_perm_const_ok + +#define TARGET_FIXED_CONDITION_CODE_REGS aarch64_fixed_condition_code_regs + struct gcc_target targetm = TARGET_INITIALIZER; #include gt-aarch64.h
[Patch, Fortran] PR55763 - reject MOLD with NULL() in init-data expressions
NULL with MOLD should be rejected as (default) initialization expression. From F2008: R506 null-init is function-reference C512 (R506) The function-reference shall be a reference to the intrinsic function NULL with no arguments. null-init occurs twice, as R505 initialization in R505 initialization and in R442 component-initialization (default initialization). Before, integer, pointer :: p = null(x) gave an type error (LHS: integer, RHS: unknown). While class(*), pointer :: p = null(x) was accepted without error diagnostic. Build and regtested on x86-64-gnu-linux. OK for the trunk? Tobias 2012-01-04 Tobias Burnus bur...@net-b.de PR fortran/55763 * decl.c (gfc_match_null): Parse and reject MOLD. 2012-01-04 Tobias Burnus bur...@net-b.de PR fortran/55763 * gfortran.dg/null_7.f90: New. diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 5ed8388..7d49578 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -1671,11 +1671,31 @@ match gfc_match_null (gfc_expr **result) { gfc_symbol *sym; - match m; + match m, m2 = MATCH_NO; - m = gfc_match ( null ( )); - if (m != MATCH_YES) -return m; + if ((m = gfc_match ( null ( ))) == MATCH_ERROR) +return MATCH_ERROR; + + if (m == MATCH_NO) +{ + locus old_loc; + char name[GFC_MAX_SYMBOL_LEN + 1]; + + if ((m2 = gfc_match ( null (, name)) != MATCH_YES) + return m2; + + old_loc = gfc_current_locus; + if ((m2 = gfc_match ( %n ) , name)) == MATCH_ERROR) + return MATCH_ERROR; + if (m2 != MATCH_YES + ((m2 = gfc_match ( mold = %n ), name)) == MATCH_ERROR)) + return MATCH_ERROR; + if (m2 == MATCH_NO) + { + gfc_current_locus = old_loc; + return MATCH_NO; + } +} /* The NULL symbol now has to be/become an intrinsic function. */ if (gfc_get_symbol (null, NULL, sym)) @@ -1694,6 +1714,13 @@ gfc_match_null (gfc_expr **result) *result = gfc_get_null_expr (gfc_current_locus); + /* Invalid per F2008, C512. */ + if (m2 == MATCH_YES) +{ + gfc_error (NULL() initialization at %C may not have MOLD); + return MATCH_ERROR; +} + return MATCH_YES; } diff --git a/gcc/testsuite/gfortran.dg/null_7.f90 b/gcc/testsuite/gfortran.dg/null_7.f90 new file mode 100644 index 000..d6d77d2 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/null_7.f90 @@ -0,0 +1,20 @@ +! { dg-do compile } +! +! PR fortran/55763 +! + +implicit none +integer, pointer :: x +class(*), pointer :: y +integer, pointer :: p1 = null(x) ! { dg-error NULL.. initialization at .1. may not have MOLD } +integer, pointer :: p2 = null(mold=x) ! { dg-error NULL.. initialization at .1. may not have MOLD } +class(*), pointer :: p3 =null(x) ! { dg-error NULL.. initialization at .1. may not have MOLD } +type t + real, pointer :: a1 = null(x) ! { dg-error NULL.. initialization at .1. may not have MOLD } + real, pointer :: a2 = null ( mold = x) ! { dg-error NULL.. initialization at .1. may not have MOLD } + class(*), pointer :: a3 = null(mold = x ) ! { dg-error NULL.. initialization at .1. may not have MOLD } +end type t + +x = null(x) ! OK +y = null(y) ! OK +end
[PATCH] i386: Fix gcc.dg/torture/tls/tls-reload-1.c
The problem here is that if tmp had the correct mode, as it usually might, we'd incorrectly discard tmp instead of assigning it to op1. I see little point in the explicit check vs mode, since convert_to_mode is going to do exactly that first thing. This redundant check is something that should be eliminated elsewhere in the source base too. Tested on x86_64-linux. r~ * config/i386/i386.c (ix86_expand_move): Always assign to op1 after eliminating TLS symbols. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 60f68d4..6dffe14 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -1,6 +1,6 @@ /* Subroutines used for code generation on IA-32. - Copyright (C) 1988, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 + Copyright (C) 1988, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, + 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc. This file is part of GCC. @@ -15960,8 +15960,7 @@ ix86_expand_move (enum machine_mode mode, rtx operands[]) op0, 1, OPTAB_DIRECT); if (tmp == op0) return; - if (GET_MODE (tmp) != mode) - op1 = convert_to_mode (mode, tmp, 1); + op1 = convert_to_mode (mode, tmp, 1); } } -- 1.7.11.7
[google 4_7] backport std::unique_ptrT[], D improvements
Relax the restrictions on argument types to a unique_ptr instantiated on an array type. This patch is a backport of Jonathan Wakely's std::unique_ptrT[], D improvements http://gcc.gnu.org/ml/gcc-patches/2012-12/msg01271.html to the google 4.7 branch. The existing unique_ptr admits no conversions, not even cv-qualification conversions. The patch permits cv-qualification conversion. It prohibits derived-to-base pointer conversion, as is needed to prevent improper deletion. It permits user-defined pointer types. The latter permissiveness is under debate. Given struct base { }; struct derived : base { }; as we cannot presently distinguish between the safe struct ptr_base { operator base*() { return 0; } }; ... unique_ptr base ( ptr_base() ); and the unsafe struct ptr_derived { operator derived*() { return 0; } }; ... unique_ptr base ( ptr_derived() ); No existing code can encounter the unsafe part because no existing code can have user-defined pointer types. There are likely to be very few uses of user-defined pointers introduced into the code base between now and when the issue is resolved. So, backporting the patch as is seems safe enough, and not too much trouble to correct later. Tested on x86_64. Tests pass through Google's core and mantle, but fail for apparently unrelated reasons in crust. Okay for branch? Index: libstdc++-v3/include/std/type_traits === --- libstdc++-v3/include/std/type_traits(revision 194742) +++ libstdc++-v3/include/std/type_traits(working copy) @@ -1723,6 +1723,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct enable_iftrue, _Tp { typedef _Tp type; }; + templatetypename... _Cond +using _Require = typename enable_if__and__Cond...::value::type; // Primary template. /// Define a member typedef @c type to one of two argument types. Index: libstdc++-v3/include/bits/unique_ptr.h === --- libstdc++-v3/include/bits/unique_ptr.h (revision 194742) +++ libstdc++-v3/include/bits/unique_ptr.h (working copy) @@ -52,7 +52,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr default_delete() noexcept = default; templatetypename _Up, typename = typename - std::enable_ifstd::is_convertible_Up*, _Tp*::value::type + enable_ifis_convertible_Up*, _Tp*::value::type default_delete(const default_delete_Up) noexcept { } void @@ -70,8 +70,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION templatetypename _Tp struct default_delete_Tp[] { +private: + templatetypename _Up + using __remove_cv = typename remove_cv_Up::type; + + // Like is_base_of_Tp, _Up but false if unqualified types are the same + templatetypename _Up + using __is_derived_Tp + = __and_ is_base_of_Tp, _Up, + __not_is_same__remove_cv_Tp, __remove_cv_Up ; + +public: constexpr default_delete() noexcept = default; + templatetypename _Up, typename = typename + enable_if!__is_derived_Tp_Up::value::type +default_delete(const default_delete_Up[]) noexcept { } + void operator()(_Tp* __ptr) const { @@ -80,7 +95,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION delete [] __ptr; } - templatetypename _Up void operator()(_Up*) const = delete; + templatetypename _Up + typename enable_if__is_derived_Tp_Up::value::type + operator()(_Up*) const = delete; }; /// 20.7.12.2 unique_ptr for single objects. @@ -99,7 +116,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef typename remove_reference_Dp::type _Del; public: - typedef decltype( __test_Del(0)) type; + typedef decltype(__test_Del(0)) type; }; typedef std::tupletypename _Pointer::type, _Dp __tuple_type; @@ -113,54 +130,45 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Constructors. constexpr unique_ptr() noexcept : _M_t() - { static_assert(!std::is_pointerdeleter_type::value, + { static_assert(!is_pointerdeleter_type::value, constructed with null function pointer deleter); } explicit unique_ptr(pointer __p) noexcept : _M_t(__p, deleter_type()) - { static_assert(!std::is_pointerdeleter_type::value, + { static_assert(!is_pointerdeleter_type::value, constructed with null function pointer deleter); } unique_ptr(pointer __p, - typename std::conditionalstd::is_referencedeleter_type::value, + typename std::conditionalis_referencedeleter_type::value, deleter_type, const deleter_type::type __d) noexcept : _M_t(__p, __d) { } unique_ptr(pointer __p, - typename std::remove_referencedeleter_type::type __d) noexcept + typename remove_referencedeleter_type::type __d) noexcept : _M_t(std::move(__p),
Re: [google 4_7] backport std::unique_ptrT[], D improvements
On Thu, Jan 3, 2013 at 3:46 PM, Lawrence Crowl cr...@googlers.com wrote: Relax the restrictions on argument types to a unique_ptr instantiated on an array type. This patch is a backport of Jonathan Wakely's std::unique_ptrT[], D improvements http://gcc.gnu.org/ml/gcc-patches/2012-12/msg01271.html to the google 4.7 branch. Approved for google/gcc-4_7 branch. Thanks, -- Paul Pluzhnikov
[v3 testsuite] gdb-test.exp: catch error running gdb command
The libstdc++ prettyprinter tests require a certain level of support from GDB, and the check for that GDB support runs a command that includes a quoted string. This causes an error from the testsuite infrastructure for embedded processors whose board support passes commands through additional levels of procedures that lose the backslashes that escape the quotes. Adding more backslashes wouldn't work because it would prevent the command from working for the majority of boards. I can't figure out a real solution to the problem. Rather than gdb_version_check resulting in an error for boards that pass a command through additional levels of procedure calls, this patch lets it catch the error so that it can fail gracefully and the tests will be reported as UNSUPPORTED. This will skip the tests for a relatively small number of test setups. OK for trunk? Janis 2013-01-03 Janis Johnson jani...@codesourcery.com * testsuite/lib/gdb-test.exp (gdb_batch_check): Catch error running gdb command. Index: libstdc++-v3/testsuite/lib/gdb-test.exp === --- libstdc++-v3/testsuite/lib/gdb-test.exp (revision 194619) +++ libstdc++-v3/testsuite/lib/gdb-test.exp (working copy) @@ -219,7 +219,9 @@ set gdb_name $::env(GUALITY_GDB_NAME) set cmd $gdb_name -nw -nx -quiet -batch -ex \$command\ send_log Spawning: $cmd\n -set res [remote_spawn target $cmd] +if [catch { set res [remote_spawn target $cmd] } ] { + return 0 +} if { $res 0 || $res == } { return 0 }
Re: [Patch, Darwin, ppc] constrain processor usage for m32.
Found the problem: The assembler generates a relocation of type LO14, meaning 14 bits that represent bits 2 - 15 of the effective address (lowest two bits are forced to zero), which is used for some types of 64 bit loads and stores. Unfortunately the OS X dynamic linker doesn't support that relocation type any more beginning with 10.4. After looking at the dyld sources It seems LO16 should be used instead. I'll see if I can fix the assembler. Am 01.01.2013 um 22:06 schrieb Mike Stump: On Jan 1, 2013, at 10:03 AM, Tobias Netzel tobias.net...@googlemail.com wrote: Or do you have any other ideas? I don't. I'd grab the .s files (compile with -save-temps) and start stripping things out til it loads, then then last thing stripped was the thing that broke it.
Re: [patch] std::unique_ptrT[], D improvements
On 1/1/13, Geoffrey Romer gro...@google.com wrote: AFAICT there's no way to distinguish between safe and unsafe conversions of user-defined pointers, because that's a property of the pointer implementation, not the type itself. My PR errs on the side of trusting the implementation to provide only correct conversions. As Jonathan notes, Howard has objected to that part of the PR, so it's possible the eventual resolution will differ in that respect; I intend to pick up that discussion next week when I'm back from vacation. BTW, I've attached my latest set of tests. -- Lawrence Crowl tests.tar.gz Description: GNU Zip compressed data
Re: atomic update of profile counters (issue7000044)
Here is the new patch. It links libatomic when -fprofile-gen-atomic is specified for FDO instrumentation build. Here I assume libatomic is always installed. Andrew: do you think if this is reasonable? It also disables the functionality if target does not support weak (ie. TARGET_SUPPORTS_WEAK == 0). Thanks, -Rong On Thu, Jan 3, 2013 at 1:05 AM, Richard Biener richard.guent...@gmail.com wrote: On Thu, Jan 3, 2013 at 2:25 AM, Andrew Pinski pins...@gmail.com wrote: On Wed, Jan 2, 2013 at 5:15 PM, Rong Xu x...@google.com wrote: Hi, Here is a new patch. The only difference is to declare __atomic_fetch_add as weak. This is needed for targets without sync/atomic builtin support. The patch contains a call to the builtin regardless of the new options -fprofile-gen-atomic. This results in a unsat in these targets even for regular profile-gen built. With this new patch, if the user uses -fprofile-gen-atomic in these target, the generated code will seg fault. We think a better solution is to emit the builtin call only in these targets with the support, and give warning for non-supported target. But I did not find any target hook for this. Does anyone know how to do this? Why not use libatomic for those targets? Also note that not all targets support 'weak' linkage. How about check the flag TARGET_SUPPORTS_WEAK, and only enable the code when the flag is true. Richard. Thanks, Andrew Pinski Thanks, -Rong On Fri, Dec 28, 2012 at 11:35 AM, Xinliang David Li davi...@google.com wrote: It would be great if this can make into gcc4.8. The patch has close to 0 impact on code stability. David On Fri, Dec 28, 2012 at 11:32 AM, Rong Xu x...@google.com wrote: Hi Honza, In the other thread of discussion (similar patch in google-4_7 branch), you said you were thinking if to let this patch into trunk in stage 3. Can you give some update? Thanks, -Rong On Fri, Dec 21, 2012 at 10:37 AM, Rong Xu x...@google.com wrote: On Fri, Dec 21, 2012 at 1:25 AM, Jan Hubicka hubi...@ucw.cz wrote: Hi, This patch adds support of atomic update of profiles counters. The goal is to improve the poor counter values for highly thread programs. The atomic update is under a new option -fprofile-gen-atomic=N N=0: default, no atomic update N=1: atomic update edge counters. N=2: atomic update some of value profile counters (currently indirect-call and one value profile). N=3: both edge counter and the above value profile counters. Other value: fall back to the default. This patch is a simple porting of the version in google-4_7 branch. It uses __atomic_fetch_add based on Andrew Pinski's suggestion. Note I did not apply to all the value profiles as the indirect-call profile is the most relevant one here. Test with bootstrap. Comments and suggestions are welcomed. Thanks, -Rong 2012-12-20 Rong Xu x...@google.com * libgcc/libgcov.c (__gcov_one_value_profiler_body_atomic): New function. Atomic update profile counters. (__gcov_one_value_profiler_atomic): Ditto. (__gcov_indirect_call_profiler_atomic): Ditto. * gcc/gcov-io.h: Macros for atomic update. * gcc/common.opt: New option. * gcc/tree-profile.c (gimple_init_edge_profiler): Atomic update profile counters. (gimple_gen_edge_profiler): Ditto. The patch looks resonable. Eventually we probably should provide rest of the value counters in thread safe manner. What happens on targets not having atomic operations? From http://gcc.gnu.org/onlinedocs/gcc/_005f_005fsync-Builtins.html#_005f_005fsync-Builtins, it says: If a particular operation cannot be implemented on the target processor, a warning is generated and a call an external function is generated. So I think there will be a warning and eventually a link error of unsat. Thanks, -Rong Honza patch3.diff Description: Binary data
Re: [google][4.7] Allow function reordering linker plugin to separate hot and cold code into different ELF segments
Hi Rong, The following patch modifies the behaviour of the linker plugin to not create a separate segment for cold sections by default. Separate segments can be created with the plugin option segment=cold. Is this alright to commit? Thanks, -Sri. On Mon, Dec 17, 2012 at 11:14 AM, Sriraman Tallam tmsri...@google.com wrote: I have committed this patch. Thanks, -Sri. On Fri, Dec 14, 2012 at 4:16 PM, Rong Xu x...@google.com wrote: Looks good to me for google/gcc-4_7 branch. Thanks, -Rong On Fri, Dec 14, 2012 at 3:42 PM, Sriraman Tallam tmsri...@google.com wrote: Hi Rong, Please review this code. This code allows the function reordering plugin to separate hot and cold code into different ELF segments. This would allow optimizations like mapping the hot code alone to huge pages. With this patch, by default, the plugin maps .text.unlikely sections into a separate ELF segment. This can be turned off with plugin option --segment=none. The include/plugin-api.h changes are a backport from trunk. Thanks, -Sri. Index: function_reordering_plugin/function_reordering_plugin.c === --- function_reordering_plugin/function_reordering_plugin.c (revision 194878) +++ function_reordering_plugin/function_reordering_plugin.c (working copy) @@ -34,8 +34,12 @@ along with this program; see the file COPYING3. I This plugin dumps the final layout order of the functions in a file called final_layout.txt. To change the output file, pass the new file name with --plugin-opt. To dump to stderr instead, just pass - stderr to --plugin-opt. */ + stderr to --plugin-opt. + This plugin also allows placing all functions found cold in a separate + segment. This can be enabled with the linker option: + --plugin-opt,segment=cold. */ + #if HAVE_STDINT_H #include stdint.h #endif @@ -89,9 +93,10 @@ static int is_api_exist = 0; /* The plugin does nothing when no-op is 1. */ static int no_op = 0; -/* The plugin does not create a new segment for unlikely code if - no_segment is set. */ -static int no_segment = 0; +/* The plugin creates a new segment for unlikely code if unlikely_segment + is set. This can be set with the linker option: + --plugin-opt,segment=cold. */ +static int unlikely_segment = 0; /* Copies new output file name out_file */ void get_filename (const char *name) @@ -132,10 +137,11 @@ process_option (const char *name) /* Check if options is segment=none */ if (strncmp (name, option_segment, strlen (option_segment)) == 0) { - if (strcmp (name + strlen (option_segment), none) == 0) - no_segment = 1; - else - no_segment = 0; + const char *option_val = name + strlen (option_segment); + if (strcmp (option_val, none) == 0) + unlikely_segment = 0; + else if (strcmp (option_val, cold) == 0) + unlikely_segment = 1; return; } @@ -244,7 +250,10 @@ claim_file_hook (const struct ld_plugin_input_file { /* Inform the linker to prepare for section reordering. */ (*allow_section_ordering) (); - (*allow_unique_segment_for_sections) (); + /* Inform the linker to allow certain sections to be placed in +a separate segment. */ + if (unlikely_segment == 1) +(*allow_unique_segment_for_sections) (); is_ordering_specified = 1; } @@ -335,15 +344,29 @@ all_symbols_read_hook (void) if (out_file != NULL strcmp (out_file, stderr) != 0) fclose (fp); - /* Pass the new order of functions to the linker. */ - update_section_order (section_list, unlikely_segment_start); - assert (num_entries = unlikely_segment_end); - update_section_order (section_list, num_entries - unlikely_segment_end); - /* Map all unlikely code into a new segment. */ - if (no_segment == 0) -unique_segment_for_sections (.text.unlikely_executed, 0, 0x1000, -section_list + unlikely_segment_start, -unlikely_segment_end - unlikely_segment_start); + + if (unlikely_segment == 1) +{ + /* Pass the new order of functions to the linker. */ + /* Fix the order of all sections upto the beginning of the +unlikely section. */ + update_section_order (section_list, unlikely_segment_start); + assert (num_entries = unlikely_segment_end); + /* Fix the order of all sections after the end of the unlikely +section. */ + update_section_order (section_list, num_entries - unlikely_segment_end); + /* Map all unlikely code into a new segment. */ + unique_segment_for_sections ( + .text.unlikely_executed, 0, 0x1000, + section_list + unlikely_segment_start, + unlikely_segment_end - unlikely_segment_start); +} + else +{ + /* Pass the new order of functions to the linker. */ + update_section_order (section_list, num_entries); +
[PATCH] Clarify error message (PR middle-end/55859)
This patch clarifies the error message when using e.g. -Obar option, except non-negative numbers we accept some other levels too. Bootstrapped on x86_64-linux. Ok for trunk? 2013-01-04 Marek Polacek pola...@redhat.com PR middle-end/55859 * opts.c (default_options_optimization): Clarify error message. --- gcc/opts.c.mp 2013-01-04 02:48:33.116785922 +0100 +++ gcc/opts.c 2013-01-04 02:48:51.729870314 +0100 @@ -1,7 +1,6 @@ /* Command line option handling. Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, - 2012 - + 2012, 2013 Free Software Foundation, Inc. Contributed by Neil Booth. @@ -543,7 +542,8 @@ default_options_optimization (struct gcc const int optimize_val = integral_argument (opt-arg); if (optimize_val == -1) error_at (loc, - argument to %qs should be a non-negative integer, + argument to %qs should be a non-negative integer, + 'g', 's', or 'fast', -O); else { Marek
Re: [committed] Fix ICE in gen_reg_rtx, at emit-rtl.c:864/865 compiling GNU MPFR
Committed the attached change to trunk and 4.7 after testing on hppa- unknown-linux-gnu. Working on a revised change for 4.6. I don't think symbol + constant can occur but I'm not absolutely sure. On 2-Jan-13, at 8:12 AM, Richard Sandiford wrote: In any case, reload needs to know up-front that the constant can't be rematerialised, via LEGITIMATE_CONSTANT_P. emit_move_insn_1 would be too late. It looks like PA already handles this for some TLS models: /* TLS_MODEL_GLOBAL_DYNAMIC and TLS_MODEL_LOCAL_DYNAMIC are not legitimate constants. */ if (PA_SYMBOL_REF_TLS_P (x)) { enum tls_model model = SYMBOL_REF_TLS_MODEL (x); if (model == TLS_MODEL_GLOBAL_DYNAMIC || model == TLS_MODEL_LOCAL_DYNAMIC) return false; } so maybe that should just be: if (PA_SYMBOL_REF_TLS_P (x)) return false; Dave -- John David Anglin dave.ang...@bell.net 2013-01-03 John David Anglin dave.ang...@nrc-cnrc.gc.ca PR target/53789 * config/pa/pa.md (movsi): Revert previous change. * config/pa/pa.c (pa_legitimate_constant_p): Reject all TLS symbol references. Index: config/pa/pa.md === --- config/pa/pa.md (revision 194824) +++ config/pa/pa.md (working copy) @@ -2094,12 +2155,6 @@ { - /* A TLS symbol reference is not a valid move source operand. - pa_emit_move_sequence can only handle them prior to reload. - There is also no way to reload a TLS symbol reference, so - we must reject them after reload starts. */ - if (PA_SYMBOL_REF_TLS_P (operands[1]) !can_create_pseudo_p ()) -FAIL; if (pa_emit_move_sequence (operands, SImode, 0)) DONE; }) Index: config/pa/pa.c === --- config/pa/pa.c (revision 194824) +++ config/pa/pa.c (working copy) @@ -10358,15 +10358,11 @@ return false; /* TLS_MODEL_GLOBAL_DYNAMIC and TLS_MODEL_LOCAL_DYNAMIC are not - legitimate constants. */ + legitimate constants. The other variants can't be handled by + the move patterns after reload starts. */ if (PA_SYMBOL_REF_TLS_P (x)) - { - enum tls_model model = SYMBOL_REF_TLS_MODEL (x); +return false; - if (model == TLS_MODEL_GLOBAL_DYNAMIC || model == TLS_MODEL_LOCAL_DYNAMIC) - return false; - } - if (TARGET_64BIT GET_CODE (x) == CONST_DOUBLE) return false;
Re: [Patch, fortran] PR55827 ICE with multiple fortran modules.
Dear Mikael and Steve, From a quick read of your correspondence in the PR, you seem to have covered all the angles between you. OK for trunk. As for the branches; yes, but how far back to go? I guess that 4.6 and 4.7 should be patched, if possible, since they are in current use in distributions. However, I note that class.c(gfc_fix_class_refs) is dated 2012-02-02 and was applied to 4.7.0 trunk. Is the bug present 4.6? I have neither tree loaded since updating my system and so cannot check at the moment. Thanks for the patch. Paul On 3 January 2013 22:31, Mikael Morin mikael.mo...@sfr.fr wrote: Hello, here is a fix for PR fortran/55827 where we had a function expression (loaded from a module) whose symtree pointer was NULL. My attempt to have symtree properly set got me way too far, so this is fixing the unconditional usages of symtree based on Steve's patch in the PR. As noted in the PR, it looks bogus to have a NULL expr-symtree, but in fact expr-value.function.esym is set, and it is what is solely looked at, apart for the cases fixed in this patch. The trans-expr.c part initializes `sym' earlier and uses it instead of accessing `expr-symtree' directly. The class.c part creates a similar construct to initialize `ts' without accessing `expr-symtree' directly. I don't use Steve's way (returning early for a NULL symtree), because I remembered that `expr-symtree' could be a generic symbol, thus have invalid type for use to initialize `ts', contrary to `expr-value.function.esym'. It's better to always use `esym' when it is available. And then returning early on NULL symtree is not necessary any more. Regression tested on x86_64-unknown-linux-gnu. OK for trunk? Do we want it on the branches as well? Mikael -- The knack of flying is learning how to throw yourself at the ground and miss. --Hitchhikers Guide to the Galaxy
Re: [Patch, Fortran] PR55854/PR55763 - CLASS(*) fixes
Dear Tobias, Hah! You are right about null(x). It is an odd constraint, though, since all that is used is the type/kind information. OK for trunk Thanks for the patch. Paul On 3 January 2013 17:38, Tobias Burnus bur...@net-b.de wrote: The attached patch fixes two ICE. Regarding the unlimited_polymorphic_3.f03 change: null(x) is invalid as initialization expression (null-init). Using ptr2 = x would be valid, but it ICEs. (Cf. PR55763, comment 13) Build and regtested on x86-64-gnu-linux. OK for the trunk? Tobias -- The knack of flying is learning how to throw yourself at the ground and miss. --Hitchhikers Guide to the Galaxy
Re: [Patch, Fortran] PR55763 - reject MOLD with NULL() in init-data expressions
Dear Tobias, Yes, following your previous patch that I OK'd this is clearly OK for trunk. Thanks Paul On 4 January 2013 00:23, Tobias Burnus bur...@net-b.de wrote: NULL with MOLD should be rejected as (default) initialization expression. From F2008: R506 null-init is function-reference C512 (R506) The function-reference shall be a reference to the intrinsic function NULL with no arguments. null-init occurs twice, as R505 initialization in R505 initialization and in R442 component-initialization (default initialization). Before, integer, pointer :: p = null(x) gave an type error (LHS: integer, RHS: unknown). While class(*), pointer :: p = null(x) was accepted without error diagnostic. Build and regtested on x86-64-gnu-linux. OK for the trunk? Tobias -- The knack of flying is learning how to throw yourself at the ground and miss. --Hitchhikers Guide to the Galaxy
Re: [google][4.7] Allow function reordering linker plugin to separate hot and cold code into different ELF segments
Is it better to change the option to something like: split_segment|nosplit-segment or split_segment=yes|no David On Thu, Jan 3, 2013 at 5:41 PM, Sriraman Tallam tmsri...@google.com wrote: Hi Rong, The following patch modifies the behaviour of the linker plugin to not create a separate segment for cold sections by default. Separate segments can be created with the plugin option segment=cold. Is this alright to commit? Thanks, -Sri. On Mon, Dec 17, 2012 at 11:14 AM, Sriraman Tallam tmsri...@google.com wrote: I have committed this patch. Thanks, -Sri. On Fri, Dec 14, 2012 at 4:16 PM, Rong Xu x...@google.com wrote: Looks good to me for google/gcc-4_7 branch. Thanks, -Rong On Fri, Dec 14, 2012 at 3:42 PM, Sriraman Tallam tmsri...@google.com wrote: Hi Rong, Please review this code. This code allows the function reordering plugin to separate hot and cold code into different ELF segments. This would allow optimizations like mapping the hot code alone to huge pages. With this patch, by default, the plugin maps .text.unlikely sections into a separate ELF segment. This can be turned off with plugin option --segment=none. The include/plugin-api.h changes are a backport from trunk. Thanks, -Sri.