[Ada] Further tweak for PR ada/52123
Tested by Cesar on i686-pc-mingw32, applied on mainline and 4.7 branch. 2013-03-08 Cesar Strauss PR ada/52123 * seh_init.c (Raise_From_Signal_Handler): Declare as no-return. (__gnat_SEH_error_handler): Likewise. Remove final return. -- Eric BotcazouIndex: seh_init.c === --- seh_init.c (revision 196487) +++ seh_init.c (working copy) @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 2005-2012, Free Software Foundation, Inc.* + * Copyright (C) 2005-2013, 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- * @@ -60,7 +60,8 @@ extern struct Exception_Data _abort_sign #define Raise_From_Signal_Handler \ ada__exceptions__raise_from_signal_handler -extern void Raise_From_Signal_Handler (struct Exception_Data *, const char *); +extern void Raise_From_Signal_Handler (struct Exception_Data *, const char *) + ATTRIBUTE_NORETURN; #if defined (_WIN32) @@ -72,7 +73,7 @@ extern void Raise_From_Signal_Handler (s extern void _global_unwind2 (void *); EXCEPTION_DISPOSITION __gnat_SEH_error_handler -(struct _EXCEPTION_RECORD*, void*, struct _CONTEXT*, void*); +(struct _EXCEPTION_RECORD*, void*, struct _CONTEXT*, void*) ATTRIBUTE_NORETURN; struct Exception_Data * __gnat_map_SEH (EXCEPTION_RECORD* ExceptionRecord, const char **msg); @@ -198,7 +199,6 @@ __gnat_SEH_error_handler (struct _EXCEPT #endif Raise_From_Signal_Handler (exception, msg); - return 0; /* This is never reached, avoid compiler warning */ } #endif /* !(defined (_WIN64) && defined (__SEH__)) */
Re: [PATCH, updated] Vtable pointer verification, runtime library changes (patch 3 of 3)
On 08/03/2013 00:11, Jonathan Wakely wrote: > On 7 March 2013 23:53, Caroline Tice wrote: >> I believe this patch addresses all of your comments; I modified the >> configure.ac files to generate the configures, and I fixed the >> spelling mistakes in the comments. I still get the warnings when >> generating the Makefile.in files from the Makefile.am files, but the >> resulting files seem to be correct, and I don't know how to make the >> warnings go away. >> >> Please review this patch and let me know if it will be ok to commit >> when GCC opens up again. > > I'd like to know if someone with better automake skills than I have > can do anything about that warning, but otherwise that looks OK to me, > thanks. Looks like libvtv___la_LIBADD is still being defined in the else clause. I'm also getting warnings for src/c++11/Makefile.am about EXTRA_VTV_LDFLAGS, which may need renaming to avoid confusing automake: src/c++11/Makefile.am:70: variable `EXTRA_VTV_LDFLAGS' is defined but no program or src/c++11/Makefile.am:70: library has `EXTRA_VTV' as canonical name (possible typo) src/c++98/Makefile.am:152: variable `EXTRA_VTV_LDFLAGS' is defined but no program or src/c++98/Makefile.am:152: library has `EXTRA_VTV' as canonical name (possible typo) Also, it should generally contain only .lo and .la object and libraries to link against. From the automake manual: > 8.3.7 _LIBADD, _LDFLAGS, and _LIBTOOLFLAGS > As shown in previous sections, the ‘library_LIBADD’ variable should be used > to list extra libtool objects (‘.lo’ files) or libtool libraries (‘.la’) > to add to library. The ‘library_LDFLAGS’ variable is the place to list > additional libtool linking flags, such as ‘-version-info’, ‘-static’, and a > lot more. So putting a dir path into LIBADD and then concatenating -L and including it wholesale in some other flag variable seems incorrect. Also, both that and the top-level change looks dubious to me. The libtool subdir isn't necessarily called '.libs' on all platforms, and you should never need to reach into it(*). Likewise LIBVTV_FLAGS. Instead of adding -lvtv_init or -lvtv_stubs to the linker flags, I think you're supposed to add the corresponding .la files to the relevant LIBADD variable. And w.r.t. the top-level change, I think it may turn out to be unneeded altogether once the libtool stuff is correct. It also looks odd to me that linker flags are being added into a CXXFLAGS variable (EXTRA_VTV_LDFLAGS via VTV_CXXFLAGS) rather than the corresponding LDFLAGS. I'm not a libtool expert, I've just been told to avoid similar dubious practices in patches I've submitted in the past. And one minor nit, it is conventional not to include the generated files (Makefile.in, configure) in patches. They should autogenerate exactly the same everywhere and it saves clutter. cheers, DaveK -- (*) - I see a couple of cases have slipped through already, I think we should avoid adding any more.
[arm/embedded-4_7-branch] Merge with gcc-4_7-branch r196534
Committed as r196535.
Re: [PATCH] Fix -print-multi-os-directory for aarch64
On 07/03/13 16:45, Jakub Jelinek wrote: On Thu, Mar 07, 2013 at 08:29:06AM -0800, Andrew Pinski wrote: On Thu, Mar 7, 2013 at 3:15 AM, Jakub Jelinek wrote: AFAIK aarch64 libraries are supposed to go into /usr/lib64 etc. directories similarly to x86-64 etc., but as aarch64 isn't a true multilib target (having two different backends for 32-bit vs. 64-bit code), currently gcc -print-multi-os-directory prints . instead of ../lib64. I think glibc is broken also. So after this change, the build using the released 2.17 and this new gcc breaks. Then glibc will need patching too. Distros using multiarch aren't affected by this, others IMHO will want it in */lib64 and for aarch64 IMHO it isn't still too late for that change. Jakub Hi, Moving from /lib to /lib64 will affect binutils 2.23 (ld) and glibc 2.17. This seems to me to be a rather disruptive change this late in the day. Cheers /Marcus
Re: [PATCH] Fix -print-multi-os-directory for aarch64
On Fri, Mar 08, 2013 at 09:04:19AM +, Marcus Shawcroft wrote: > On 07/03/13 16:45, Jakub Jelinek wrote: > >On Thu, Mar 07, 2013 at 08:29:06AM -0800, Andrew Pinski wrote: > >>On Thu, Mar 7, 2013 at 3:15 AM, Jakub Jelinek wrote: > >>>AFAIK aarch64 libraries are supposed to go into /usr/lib64 etc. > >>>directories similarly to x86-64 etc., but as aarch64 isn't a true > >>>multilib target (having two different backends for 32-bit vs. 64-bit code), > >>>currently gcc -print-multi-os-directory prints . instead of ../lib64. > >> > >>I think glibc is broken also. So after this change, the build using > >>the released 2.17 and this new gcc breaks. > > > >Then glibc will need patching too. Distros using multiarch aren't affected > >by this, others IMHO will want it in */lib64 and for aarch64 IMHO it isn't > >still too late for that change. > > Hi, Moving from /lib to /lib64 will affect binutils 2.23 (ld) and > glibc 2.17. This seems to me to be a rather disruptive change this > late in the day. Yes, it does affect them, on the binutils side it would be about setting LIBPATH_SUFFIX=64 in ld/emulparams/aarch64linux.sh when appropriate (grep LIBPATH_SUFFIX=64 ld/emulparams/*.sh to see what other targets do), on the glibc side for other targets sysdeps/gnu/configure.in is where libc_cv_slibdir and libc_cv_libdir are tweaked. Note, this change doesn't affect multiarch, so Debian/Ubuntu is unaffected, for others there can be an easy workaround for transitional period (just add */lib64 -> */lib symlinks (or vice versa)). The point of using */lib64 is that it is consistent with how most other important 64-bit architectures are handled (x86_64, ppc64, s390x, sparc64, mips64) and that even if you don't expect coexistence of 32-bit arm and 64-bit aarch64 libraries on the same filesystem right now, using */lib64 allows that in the future. Even if some distros use lib64 -> lib or vice versa symlinks for some time if they choose so, if there is agreement to go with lib64 path suffixes, it means packages that need to know this can be changed, rather than adding horrible hacks to see what library suffixes should be used. Because of disagreements (even when the psABI talked about lib64), we ended up with hacks like: MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu) MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu) MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32) on x86_64-linux, so if the decision on */lib vs. */lib64 on aarch64 is left to everybody and there is no agreement, we'll need similar hacks for config/aarch64/t-linux, something like MULTIARCH_DIRNAME = $(if $(shell test -d $(SYSTEM_HEADER_DIR)/../../usr/lib64 -a ! -L $(SYSTEM_HEADER_DIR)/../../usr/lib64 && echo lib64),,$(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)) MULTILIB_OSDIRNAMES = $(if $(shell test -d $(SYSTEM_HEADER_DIR)/../../usr/lib64 -a ! -L $(SYSTEM_HEADER_DIR)/../../usr/lib64 && echo lib64),.=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)) (i.e. if /usr/lib64 is a directory and not a symlink, use ../lib64 multi-os-directory, otherwise . . The issue is that all the effected packages would need to contain similar hacks (gcc, binutils, glibc, libtool, ...). Jakub
Re: [patch testsuite]: Fix gcc.target/i386 cases for mingw-targets
Hi Kai, some comments; I'll leave approval to a target maintainer. > Index: gcc.target/i386/movti.c > === > --- gcc.target/i386/movti.c (Revision 196507) > +++ gcc.target/i386/movti.c (Arbeitskopie) > @@ -7,4 +7,4 @@ _Decimal128 test (void) >return 1234123412341234.123412341234dl; > } > > -/* { dg-final { scan-assembler-not "movabs" } } */ > +/* { dg-final { scan-assembler-not "movabs" { target { ! > x86_64-*-mingw* } } } } */ Please add a comment why mingw64 is special here. > Index: gcc.target/i386/pr20020-1.c > === > --- gcc.target/i386/pr20020-1.c (Revision 196507) > +++ gcc.target/i386/pr20020-1.c (Arbeitskopie) > @@ -1,5 +1,6 @@ > /* Check that 128-bit struct's are represented as TImode values. */ > /* { dg-do compile { target int128 } } */ > +/* { dg-skip-if "" { x86_64-*-mingw* } { "*" } { "" } } */ Please omit the default { "*" } { "" } here and in other tests below. And again: explain why the test is skipped. Thanks. Rainer -- - Rainer Orth, Center for Biotechnology, Bielefeld University
Re: [patch testsuite]: Fixes in gcc.dg for mingw-targets
Hi Kai, > Index: gcc.dg/torture/pr53922.c > === > --- gcc.dg/torture/pr53922.c (Revision 196507) > +++ gcc.dg/torture/pr53922.c (Arbeitskopie) > @@ -1,5 +1,6 @@ > /* { dg-do run } */ > /* { dg-require-weak "" } */ > +/* { dg-skip-if "No undefined" { *-*-mingw* } { "*" } { "" } } */ again: no unnecessary { "*" } { "" } default. > Index: gcc.dg/weak/weak-1.c > === > --- gcc.dg/weak/weak-1.c (Revision 196507) > +++ gcc.dg/weak/weak-1.c (Arbeitskopie) > @@ -1,6 +1,7 @@ > /* { dg-do compile } */ > /* { dg-require-weak "" } */ > /* { dg-options "-fno-common" } */ > +/* { dg-skip-if "" { *-*-mingw* } { "*" } { "" } } */ Same here, and explain why the test is skipped. Several more instances in other test. Thanks. Rainer -- - Rainer Orth, Center for Biotechnology, Bielefeld University
[PATCH] Fix another BLOCK issue
This fixes the fact that the inliner now associates a BLOCK with BLOCK_SOURCE_LOCATION but we don't dare to keep that BLOCK live when removing unused block scopes. Adding location verification for BLOCK_SOURCE_LOCATION shows this immediately during bootstrap. The obvious fix for this is the tree-inline.c hunk (obvious in that it is a return to previous behavior where location and block were not unified). As for the verification either we verify it the way in the patch below or we verify that LOCATION_BLOCK of BLOCK_SOURCE_LOCATION is always NULL. Any preference? (or just leave out the checking?) Bootstrap and regtest running on x86_64-unknown-linux-gnu (now way past the ICE with just the checking bits applied). Thanks, Richard. 2013-03-08 Richard Biener * tree-inline.c (expand_call_inline): Do not associate a BLOCK with the location in BLOCK_SOURCE_LOCATION. * tree-cfg.c (verify_location): Verify BLOCK_SOURCE_LOCATION. Index: gcc/tree-inline.c === *** gcc/tree-inline.c (revision 196538) --- gcc/tree-inline.c (working copy) *** expand_call_inline (basic_block bb, gimp *** 3929,3935 { id->block = make_node (BLOCK); BLOCK_ABSTRACT_ORIGIN (id->block) = fn; ! BLOCK_SOURCE_LOCATION (id->block) = input_location; prepend_lexical_block (gimple_block (stmt), id->block); } --- 3929,3935 { id->block = make_node (BLOCK); BLOCK_ABSTRACT_ORIGIN (id->block) = fn; ! BLOCK_SOURCE_LOCATION (id->block) = LOCATION_LOCUS (input_location); prepend_lexical_block (gimple_block (stmt), id->block); } Index: gcc/tree-cfg.c === *** gcc/tree-cfg.c (revision 196538) --- gcc/tree-cfg.c (working copy) *** verify_location (pointer_set_t *blocks, *** 4511,4516 --- 4511,4518 error ("location references block not in block tree"); return true; } + if (block != NULL_TREE) + return verify_location (blocks, BLOCK_SOURCE_LOCATION (block)); return false; }
Re: [PATCH] Fix another BLOCK issue
On Fri, Mar 08, 2013 at 11:24:40AM +0100, Richard Biener wrote: > > This fixes the fact that the inliner now associates a BLOCK > with BLOCK_SOURCE_LOCATION but we don't dare to keep that BLOCK > live when removing unused block scopes. Adding location verification > for BLOCK_SOURCE_LOCATION shows this immediately during bootstrap. > > The obvious fix for this is the tree-inline.c hunk (obvious > in that it is a return to previous behavior where location and > block were not unified). > > As for the verification either we verify it the way in the patch > below or we verify that LOCATION_BLOCK of BLOCK_SOURCE_LOCATION > is always NULL. Any preference? (or just leave out the checking?) I guess I'd prefer verifying that LOCATION_BLOCK of BLOCK_SOURCE_LOCATION is NULL, but don't feel too strongly about that, so if that means another bootstrap/regtest for you, just go ahead with what you have now. > 2013-03-08 Richard Biener > > * tree-inline.c (expand_call_inline): Do not associate > a BLOCK with the location in BLOCK_SOURCE_LOCATION. > * tree-cfg.c (verify_location): Verify BLOCK_SOURCE_LOCATION. Jakub
[C++ Patch] PR 51412
Hi, today I noticed that I still have assigned this rather simple diagnostic issue, where LAMBDA_EXPR is unhandled by our pretty printing code. I suppose we can make at least some progress for 4.8.0. Is the below goo enough for now? Tested x86_64-linux. Thanks, Paolo. // /cp 2013-03-08 Paolo Carlini PR c++/51412 * cxx-pretty-print.c (pp_cxx_expression): Handle LAMBDA_EXPR. * error.c (dump_expr): Likewise. /testsuite 2013-03-08 Paolo Carlini PR c++/51412 * g++.dg/cpp0x/lambda/lambda-err3.C: New. Index: cp/cxx-pretty-print.c === --- cp/cxx-pretty-print.c (revision 196540) +++ cp/cxx-pretty-print.c (working copy) @@ -1162,6 +1162,10 @@ pp_cxx_expression (cxx_pretty_printer *pp, tree t) } } break; + +case LAMBDA_EXPR: + pp_cxx_ws_string (pp, ""); + break; default: pp_c_expression (pp_c_base (pp), t); Index: cp/error.c === --- cp/error.c (revision 196540) +++ cp/error.c (working copy) @@ -2494,6 +2494,10 @@ dump_expr (tree t, int flags) dump_expr (resolve_virtual_fun_from_obj_type_ref (t), flags); break; +case LAMBDA_EXPR: + pp_string (cxx_pp, M_("")); + break; + /* This list is incomplete, but should suffice for now. It is very important that `sorry' does not call `report_error_function'. That could cause an infinite loop. */ Index: testsuite/g++.dg/cpp0x/lambda/lambda-err3.C === --- testsuite/g++.dg/cpp0x/lambda/lambda-err3.C (revision 0) +++ testsuite/g++.dg/cpp0x/lambda/lambda-err3.C (working copy) @@ -0,0 +1,10 @@ +// PR c++/51412 +// { dg-do compile { target c++11 } } + +void foo(int); + +template void bar() +{ + foo([]{}...); // { dg-error "" } + foo([]{}=0 ...); // { dg-error "" } +}
Re: [PATCH] Fix PR56478
On Thu, Mar 07, 2013 at 03:25:35PM +0100, Jakub Jelinek wrote: > On Tue, Mar 05, 2013 at 10:07:50AM +0100, Marek Polacek wrote: > > + if (compare_count.scmp (double_int_zero) == -1) > > +compare_count = double_int_zero; > > + if (loop_count.scmp (double_int_zero) == -1) > > +loop_count = double_int_zero; > > Use if (compare_count.is_negative ()) etc. instead? Done. > > - probability = (double) REG_BR_PROB_BASE * compare_count / loop_count; > > - predict_edge (then_edge, PRED_LOOP_IV_COMPARE, probability); > > +{ > > + tem = compare_count.divmod_with_overflow (loop_count, > > +0, TRUNC_DIV_EXPR, > > +&mod, &of); > > This is wrong. As compare_count is < loop_count, this will always yield > zero. > > I guess you want something like: > /* If loop_count is too big, such that REG_BR_PROB_BASE * loop_count > could overflow, shift both loop_count and compare_count right a bit > so that it doesn't overflow. Note both counts are known not to be > negative at this point. */ > int clz_bits = clz_hwi (loop_count.high); > gcc_assert (REG_BR_PROB_BASE < 32768); > if (clz_bits < 16) > { > loop_count.arshift (16 - clz_bits, HOST_BITS_PER_DOUBLE_INT); > compare_count.arshift (16 - clz_bits, HOST_BITS_PER_DOUBLE_INT); > } > tem = loop_count.mul_with_sign (double_int::from_shwi (REG_BR_PROB_BASE), > true, &of); > gcc_assert (!of); > tem = tem.divmod (loop_count, true, TRUNC_DIV_EXPR, &mod); > probability = tem.to_uhwi (); > predict_edge (then_edge, PRED_LOOP_IV_COMPARE, probability); Thanks. How does it look now? I've discovered that previous patch caused a regression, so I had to find the bug and retest etc. (There was loop_count instead of compare_count.) Regtested/bootstrapped on x86_64-linux, ok for trunk? Or do you want me to change anything? 2013-03-08 Marek Polacek Jakub Jelinek PR tree-optimization/56478 * predict.c (is_comparison_with_loop_invariant_p): Change the type of loop_step to tree. (predict_loops): Adjust. (predict_iv_comparison): Perform the computations on double_ints. * gcc.dg/torture/pr56478.c: New test. --- gcc/predict.c.mp2013-03-07 20:01:01.078417558 +0100 +++ gcc/predict.c 2013-03-08 11:35:05.227603993 +0100 @@ -1028,13 +1028,13 @@ static bool is_comparison_with_loop_invariant_p (gimple stmt, struct loop *loop, tree *loop_invariant, enum tree_code *compare_code, -int *loop_step, +tree *loop_step, tree *loop_iv_base) { tree op0, op1, bound, base; affine_iv iv0, iv1; enum tree_code code; - int step; + tree step; code = gimple_cond_code (stmt); *loop_invariant = NULL; @@ -1077,7 +1077,7 @@ is_comparison_with_loop_invariant_p (gim bound = iv0.base; base = iv1.base; if (host_integerp (iv1.step, 0)) - step = tree_low_cst (iv1.step, 0); + step = iv1.step; else return false; } @@ -1086,7 +1086,7 @@ is_comparison_with_loop_invariant_p (gim bound = iv1.base; base = iv0.base; if (host_integerp (iv0.step, 0)) - step = tree_low_cst (iv0.step, 0); + step = iv0.step; else return false; } @@ -1178,7 +1178,7 @@ predict_iv_comparison (struct loop *loop gimple stmt; tree compare_var, compare_base; enum tree_code compare_code; - int compare_step; + tree compare_step_var; edge then_edge; edge_iterator ei; @@ -1192,7 +1192,7 @@ predict_iv_comparison (struct loop *loop return; if (!is_comparison_with_loop_invariant_p (stmt, loop, &compare_var, &compare_code, - &compare_step, + &compare_step_var, &compare_base)) return; @@ -1224,34 +1224,78 @@ predict_iv_comparison (struct loop *loop && host_integerp (compare_base, 0)) { int probability; - HOST_WIDE_INT compare_count; - HOST_WIDE_INT loop_bound = tree_low_cst (loop_bound_var, 0); - HOST_WIDE_INT compare_bound = tree_low_cst (compare_var, 0); - HOST_WIDE_INT base = tree_low_cst (compare_base, 0); - HOST_WIDE_INT loop_count = (loop_bound - base) / compare_step; + bool of, overflow = false; + double_int mod, compare_count, tem, loop_count; - if ((compare_step > 0) + double_int loop_bound = tree_to_double_int (loop_bound_var); + double_int compare_bound = tree_to_double_int (compare_var); + double_int base = tree_to_double_int (compare_base); + double_int compare_step = tree_to_d
[patch testsuite]: Fix regressions in gcc-c-torture's builtin-tests using LTO on mingw-targets
Hello, this patch fixes 23 regressions about LTO and double-defined symbols for memcpy/memset. Issue is that for mingw-targets the C-runtime functions aren't weak and not necessarily overridable. ChangeLog 2013-03-08 Kai Tietz * gcc.c-torture/execute/builtins/builtins.exp: Add for mingw targets linker option --allow-multiple-definition. Ok for apply ? Regards, Kai Index: builtins.exp === --- builtins.exp(Revision 196543) +++ builtins.exp(Arbeitskopie) @@ -42,6 +42,7 @@ if [istarget "powerpc-*-darwin*"] { lappend additional_flags "-Wl,-multiply_defined,suppress" } if { [istarget *-*-eabi*] + || [istarget *-*-mingw*] || [istarget *-*-elf] } { lappend additional_flags "-Wl,--allow-multiple-definition" }
Re: [patch testsuite]: Fix regressions in gcc-c-torture's builtin-tests using LTO on mingw-targets
Hi Kai, > Index: builtins.exp > === > --- builtins.exp(Revision 196543) > +++ builtins.exp(Arbeitskopie) > @@ -42,6 +42,7 @@ if [istarget "powerpc-*-darwin*"] { > lappend additional_flags "-Wl,-multiply_defined,suppress" > } > if { [istarget *-*-eabi*] > + || [istarget *-*-mingw*] > || [istarget *-*-elf] } { please keep the list sorted. Thanks. Rainer -- - Rainer Orth, Center for Biotechnology, Bielefeld University
Re: [PATCH] Fix PR56478
On Fri, Mar 08, 2013 at 01:16:37PM +0100, Marek Polacek wrote: > --- gcc/predict.c.mp 2013-03-07 20:01:01.078417558 +0100 > +++ gcc/predict.c 2013-03-08 11:35:05.227603993 +0100 > @@ -1028,13 +1028,13 @@ static bool > is_comparison_with_loop_invariant_p (gimple stmt, struct loop *loop, >tree *loop_invariant, >enum tree_code *compare_code, > - int *loop_step, > + tree *loop_step, >tree *loop_iv_base) > { >tree op0, op1, bound, base; >affine_iv iv0, iv1; >enum tree_code code; > - int step; > + tree step; > >code = gimple_cond_code (stmt); >*loop_invariant = NULL; > @@ -1077,7 +1077,7 @@ is_comparison_with_loop_invariant_p (gim >bound = iv0.base; >base = iv1.base; >if (host_integerp (iv1.step, 0)) > - step = tree_low_cst (iv1.step, 0); > + step = iv1.step; >else > return false; > } > @@ -1086,7 +1086,7 @@ is_comparison_with_loop_invariant_p (gim >bound = iv1.base; >base = iv0.base; >if (host_integerp (iv0.step, 0)) > - step = tree_low_cst (iv0.step, 0); > + step = iv0.step; >else > return false; > } If the callers use double_int computation, perhaps there is no reason for the host_integerp checks and all we could verify is that the trees have TREE_CODE (iv0.step) etc. == INTEGER_CST (and perhaps that if the type of them is unsigned, then they don't have the msb set (i.e. !TYPE_UNSIGNED (TREE_TYPE (iv0.step)) || !tree_to_double_int (iv0.step).is_negative () ). But perhaps that can be left for 4.9 as an improvement? > @@ -1224,34 +1224,78 @@ predict_iv_comparison (struct loop *loop >&& host_integerp (compare_base, 0)) Ditto the host_integerp checks above. > + if ((compare_step.scmp (double_int_zero) == 1) I believe compare_step should be known not to be zero here (there are integer_zerop checks earlier, aren't they), so this could be also !compare_step.is_negative () ? Other than that it looks good to me, Richard, is this fine for you too? Jakub
[PATCH] Another BLOCK issue - PR56570
This PR shows that when SRA creates DECL_DEBUG_EXPRs with locations (and blocks) this does not work with inlining. The reason is that the inliner does not bother to copy vars used only in lhs of debug-stmts (eek) and thus ends up sharing DECL_DEBUG_EXPRs (and not re-mapping them and their location blocks). Maybe a recipie for further desaster ... (who knows). I didn't manage to get it to "properly" copy things, but basically else if (TREE_CODE (t) == VAR_DECL && !is_global_var (t) && !pointer_map_contains (id->decl_map, t)) /* T is a non-localized variable. */; doesn't work - vars can be not in local-decls (which we all remap) due to remove-unused-locals. Thus we end up not remapping the debug var (and refer to the other functions DECL_DEBUG_EXPR). The following avoids the DECL_DEBUG_EXPR issue by clearing all location information from it (it's unused anyway). The above code should nevertheless be inspected ... I took the liberty to sync the MEM_REF code from the two nearly identical tree copying routines (eh ...), it was my first guess as to what goes wrong. Bootstrapped on x86_64-unknown-linux-gnu, testing in progress. For 4.9 we'd want a verify_no_location eventually which we can use to recurse here. Any comments about the above code? Thanks, Richard. 2013-03-08 Richard Biener PR tree-optimization/56570 * tree-cfg.c (verify_expr_location_1): Verify locations for DECL_DEBUG_EXPR. * tree-sra.c (create_access_replacement): Strip locations from DECL_DEBUG_EXPRs. * tree-inline.c (copy_tree_body_r): Sync MEM_REF code from ... remap_gimple_op_r. Index: gcc/tree-cfg.c === *** gcc/tree-cfg.c (revision 196542) --- gcc/tree-cfg.c (working copy) *** verify_expr_location_1 (tree *tp, int *w *** 4523,4528 --- 4523,4537 { struct pointer_set_t *blocks = (struct pointer_set_t *) data; + if (TREE_CODE (*tp) == VAR_DECL + && DECL_DEBUG_EXPR_IS_FROM (*tp)) + { + tree t = DECL_DEBUG_EXPR (*tp); + tree addr = walk_tree (&t, verify_expr_location_1, blocks, NULL); + if (addr) + return addr; + } + if (!EXPR_P (*tp)) { *walk_subtrees = false; Index: gcc/tree-sra.c === *** gcc/tree-sra.c (revision 196541) --- gcc/tree-sra.c (working copy) *** create_access_replacement (struct access *** 1917,1923 && !DECL_ARTIFICIAL (access->base)) { char *pretty_name = make_fancy_name (access->expr); ! tree debug_expr = unshare_expr (access->expr), d; bool fail = false; DECL_NAME (repl) = get_identifier (pretty_name); --- 1917,1923 && !DECL_ARTIFICIAL (access->base)) { char *pretty_name = make_fancy_name (access->expr); ! tree debug_expr = unshare_expr_without_location (access->expr), d; bool fail = false; DECL_NAME (repl) = get_identifier (pretty_name); Index: gcc/tree-inline.c === *** gcc/tree-inline.c (revision 196542) --- gcc/tree-inline.c (working copy) *** copy_tree_body_r (tree *tp, int *walk_su *** 1092,1113 } else if (TREE_CODE (*tp) == MEM_REF) { ! /* We need to re-canonicalize MEM_REFs from inline substitutions !that can happen when a pointer argument is an ADDR_EXPR. */ ! tree decl = TREE_OPERAND (*tp, 0); ! tree *n; ! n = (tree *) pointer_map_contains (id->decl_map, decl); ! if (n) ! { ! tree old = *tp; ! *tp = fold_build2 (MEM_REF, TREE_TYPE (*tp), !unshare_expr (*n), TREE_OPERAND (*tp, 1)); ! TREE_THIS_VOLATILE (*tp) = TREE_THIS_VOLATILE (old); ! TREE_NO_WARNING (*tp) = TREE_NO_WARNING (old); ! *walk_subtrees = 0; ! return NULL; ! } } /* Here is the "usual case". Copy this tree node, and then --- 1092,1113 } else if (TREE_CODE (*tp) == MEM_REF) { ! tree ptr = TREE_OPERAND (*tp, 0); ! tree type = remap_type (TREE_TYPE (*tp), id); ! tree old = *tp; ! /* We need to re-canonicalize MEM_REFs from inline substitutions !that can happen when a pointer argument is an ADDR_EXPR. !Recurse here manually to allow that. */ ! walk_tree (&ptr, copy_tree_body_r, data, NULL); ! *tp = fold_build2 (MEM_REF, type, !ptr, TREE_OPERAND (*tp, 1)); ! TREE_THIS_NOTRAP (*tp) = TREE_THIS_NOTRAP (old); ! TREE_THIS_VOLATILE (*tp) = TREE_THIS_VOLATILE (old); ! TREE_SIDE_EFFECTS (*tp) = TREE_SIDE_EFFECTS (old); ! TREE_NO_WARNING (*tp) = TREE_NO_WARN
Re: [PATCH] Another BLOCK issue - PR56570
On Fri, Mar 08, 2013 at 01:59:23PM +0100, Richard Biener wrote: > This PR shows that when SRA creates DECL_DEBUG_EXPRs with locations > (and blocks) this does not work with inlining. The reason is that > the inliner does not bother to copy vars used only in lhs of > debug-stmts (eek) and thus ends up sharing DECL_DEBUG_EXPRs It is not about not bothering, we really shouldn't have different sets of copied vars with -g vs. -g0, otherwise we end up with -fcompare-debug failures. > Any comments about the above code? I don't understand how the tree-inline.c change is related to this. For 4.9, once the verification that DECL_DEBUG_EXPR doesn't have locations is in, we can remove the DECL_DEBUG_EXPR handling code from tree-ssa-live.c. Also for 4.9 we should rename DECL_DEBUG_EXPR_IS_FROM to DECL_HAS_DEBUG_EXPR_P. Jakub
Re: [PATCH] Fix PR56478
On Fri, Mar 8, 2013 at 1:30 PM, Jakub Jelinek wrote: > On Fri, Mar 08, 2013 at 01:16:37PM +0100, Marek Polacek wrote: >> --- gcc/predict.c.mp 2013-03-07 20:01:01.078417558 +0100 >> +++ gcc/predict.c 2013-03-08 11:35:05.227603993 +0100 >> @@ -1028,13 +1028,13 @@ static bool >> is_comparison_with_loop_invariant_p (gimple stmt, struct loop *loop, >>tree *loop_invariant, >>enum tree_code *compare_code, >> - int *loop_step, >> + tree *loop_step, >>tree *loop_iv_base) >> { >>tree op0, op1, bound, base; >>affine_iv iv0, iv1; >>enum tree_code code; >> - int step; >> + tree step; >> >>code = gimple_cond_code (stmt); >>*loop_invariant = NULL; >> @@ -1077,7 +1077,7 @@ is_comparison_with_loop_invariant_p (gim >>bound = iv0.base; >>base = iv1.base; >>if (host_integerp (iv1.step, 0)) >> - step = tree_low_cst (iv1.step, 0); >> + step = iv1.step; >>else >> return false; >> } >> @@ -1086,7 +1086,7 @@ is_comparison_with_loop_invariant_p (gim >>bound = iv1.base; >>base = iv0.base; >>if (host_integerp (iv0.step, 0)) >> - step = tree_low_cst (iv0.step, 0); >> + step = iv0.step; >>else >> return false; >> } > > If the callers use double_int computation, perhaps there is > no reason for the host_integerp checks and all we could verify is > that the trees have TREE_CODE (iv0.step) etc. == INTEGER_CST > (and perhaps that if the type of them is unsigned, then they don't > have the msb set (i.e. > !TYPE_UNSIGNED (TREE_TYPE (iv0.step)) > || !tree_to_double_int (iv0.step).is_negative () ). > But perhaps that can be left for 4.9 as an improvement? > >> @@ -1224,34 +1224,78 @@ predict_iv_comparison (struct loop *loop >>&& host_integerp (compare_base, 0)) > > Ditto the host_integerp checks above. > >> + if ((compare_step.scmp (double_int_zero) == 1) > > I believe compare_step should be known not to be zero here (there are > integer_zerop checks earlier, aren't they), so this could be also > !compare_step.is_negative () > ? > > Other than that it looks good to me, Richard, is this fine for you too? Yes. Thanks, Richard. > Jakub
Re: [patch testsuite]: Fix regressions in gcc-c-torture's builtin-tests using LTO on mingw-targets
2013/3/8 Rainer Orth : > Hi Kai, > >> Index: builtins.exp >> === >> --- builtins.exp(Revision 196543) >> +++ builtins.exp(Arbeitskopie) >> @@ -42,6 +42,7 @@ if [istarget "powerpc-*-darwin*"] { >> lappend additional_flags "-Wl,-multiply_defined,suppress" >> } >> if { [istarget *-*-eabi*] >> + || [istarget *-*-mingw*] >> || [istarget *-*-elf] } { > > please keep the list sorted. > > Thanks. > Rainer Applied after adjusting. Thanks, Kai
Re: [PATCH] Another BLOCK issue - PR56570
On Fri, 8 Mar 2013, Jakub Jelinek wrote: > On Fri, Mar 08, 2013 at 01:59:23PM +0100, Richard Biener wrote: > > This PR shows that when SRA creates DECL_DEBUG_EXPRs with locations > > (and blocks) this does not work with inlining. The reason is that > > the inliner does not bother to copy vars used only in lhs of > > debug-stmts (eek) and thus ends up sharing DECL_DEBUG_EXPRs > > It is not about not bothering, we really shouldn't have different sets > of copied vars with -g vs. -g0, otherwise we end up with -fcompare-debug > failures. > > > Any comments about the above code? > > I don't understand how the tree-inline.c change is related to this. It just fell out of my attempts to fix the bug in the inliner. I can postpone that change to 4.9 if you like (possibly trying to unify those two functions with using a template ...). > For 4.9, once the verification that DECL_DEBUG_EXPR doesn't have locations is > in, > we can remove the DECL_DEBUG_EXPR handling code from tree-ssa-live.c. > Also for 4.9 we should rename DECL_DEBUG_EXPR_IS_FROM to > DECL_HAS_DEBUG_EXPR_P. Yeah. I'll put it on my TODO. Thanks, Richard.
Re: [patch testsuite]: Fix gcc.target/i386 cases for mingw-targets
2013/3/8 Rainer Orth : > Hi Kai, > > some comments; I'll leave approval to a target maintainer. > >> Index: gcc.target/i386/movti.c >> === >> --- gcc.target/i386/movti.c (Revision 196507) >> +++ gcc.target/i386/movti.c (Arbeitskopie) >> @@ -7,4 +7,4 @@ _Decimal128 test (void) >>return 1234123412341234.123412341234dl; >> } >> >> -/* { dg-final { scan-assembler-not "movabs" } } */ >> +/* { dg-final { scan-assembler-not "movabs" { target { ! >> x86_64-*-mingw* } } } } */ > > Please add a comment why mingw64 is special here. > >> Index: gcc.target/i386/pr20020-1.c >> === >> --- gcc.target/i386/pr20020-1.c (Revision 196507) >> +++ gcc.target/i386/pr20020-1.c (Arbeitskopie) >> @@ -1,5 +1,6 @@ >> /* Check that 128-bit struct's are represented as TImode values. */ >> /* { dg-do compile { target int128 } } */ >> +/* { dg-skip-if "" { x86_64-*-mingw* } { "*" } { "" } } */ > > Please omit the default { "*" } { "" } here and in other tests below. > And again: explain why the test is skipped. Hmm, why shall I omit here the default. I checked in tree and most statements for dg-skip-if are expressing default too. Well, to skip here x64 mingw is caused by the fact that it has a different ABI as x86_64. I will add it to skip message. > Thanks. > Rainer Ok to apply with those changes? Kai
Re: [patch testsuite]: Fix gcc.target/i386 cases for mingw-targets
Hi Kai, >>> Index: gcc.target/i386/pr20020-1.c >>> === >>> --- gcc.target/i386/pr20020-1.c (Revision 196507) >>> +++ gcc.target/i386/pr20020-1.c (Arbeitskopie) >>> @@ -1,5 +1,6 @@ >>> /* Check that 128-bit struct's are represented as TImode values. */ >>> /* { dg-do compile { target int128 } } */ >>> +/* { dg-skip-if "" { x86_64-*-mingw* } { "*" } { "" } } */ >> >> Please omit the default { "*" } { "" } here and in other tests below. >> And again: explain why the test is skipped. > > Hmm, why shall I omit here the default. I checked in tree and most > statements for dg-skip-if are expressing default too. just because support for omitting the default isn't that old. There's certainly opportunity for cleanup, but we shouldn't spread this any further. > Well, to skip here x64 mingw is caused by the fact that it has a > different ABI as x86_64. I will add it to skip message. Thanks. It's always far easier to have this in the testsuite to spare the next guy from doing software archaeology. > Ok to apply with those changes? Again, I prefer to defer to the target maintainers. Rainer -- - Rainer Orth, Center for Biotechnology, Bielefeld University
Re: [PATCH] Fix PR56478
Here's a final version. I've used !compare_step.is_negative (). Moreover, sanity checked by printing out old and new probability and comparing them after check-gcc. So this should be prety safe now. I will apply the patch shortly. 2013-03-08 Marek Polacek Jakub Jelinek PR tree-optimization/56478 * predict.c (is_comparison_with_loop_invariant_p): Change the type of loop_step to tree. (predict_loops): Adjust. (predict_iv_comparison): Perform the computations on double_ints. * gcc.dg/torture/pr56478.c: New test. --- gcc/predict.c.mp2013-03-07 20:01:01.078417558 +0100 +++ gcc/predict.c 2013-03-08 14:42:26.445834030 +0100 @@ -1028,13 +1028,13 @@ static bool is_comparison_with_loop_invariant_p (gimple stmt, struct loop *loop, tree *loop_invariant, enum tree_code *compare_code, -int *loop_step, +tree *loop_step, tree *loop_iv_base) { tree op0, op1, bound, base; affine_iv iv0, iv1; enum tree_code code; - int step; + tree step; code = gimple_cond_code (stmt); *loop_invariant = NULL; @@ -1077,7 +1077,7 @@ is_comparison_with_loop_invariant_p (gim bound = iv0.base; base = iv1.base; if (host_integerp (iv1.step, 0)) - step = tree_low_cst (iv1.step, 0); + step = iv1.step; else return false; } @@ -1086,7 +1086,7 @@ is_comparison_with_loop_invariant_p (gim bound = iv1.base; base = iv0.base; if (host_integerp (iv0.step, 0)) - step = tree_low_cst (iv0.step, 0); + step = iv0.step; else return false; } @@ -1178,7 +1178,7 @@ predict_iv_comparison (struct loop *loop gimple stmt; tree compare_var, compare_base; enum tree_code compare_code; - int compare_step; + tree compare_step_var; edge then_edge; edge_iterator ei; @@ -1192,7 +1192,7 @@ predict_iv_comparison (struct loop *loop return; if (!is_comparison_with_loop_invariant_p (stmt, loop, &compare_var, &compare_code, - &compare_step, + &compare_step_var, &compare_base)) return; @@ -1224,34 +1224,78 @@ predict_iv_comparison (struct loop *loop && host_integerp (compare_base, 0)) { int probability; - HOST_WIDE_INT compare_count; - HOST_WIDE_INT loop_bound = tree_low_cst (loop_bound_var, 0); - HOST_WIDE_INT compare_bound = tree_low_cst (compare_var, 0); - HOST_WIDE_INT base = tree_low_cst (compare_base, 0); - HOST_WIDE_INT loop_count = (loop_bound - base) / compare_step; + bool of, overflow = false; + double_int mod, compare_count, tem, loop_count; - if ((compare_step > 0) + double_int loop_bound = tree_to_double_int (loop_bound_var); + double_int compare_bound = tree_to_double_int (compare_var); + double_int base = tree_to_double_int (compare_base); + double_int compare_step = tree_to_double_int (compare_step_var); + + /* (loop_bound - base) / compare_step */ + tem = loop_bound.sub_with_overflow (base, &of); + overflow |= of; + loop_count = tem.divmod_with_overflow (compare_step, + 0, TRUNC_DIV_EXPR, + &mod, &of); + overflow |= of; + + if ((!compare_step.is_negative ()) ^ (compare_code == LT_EXPR || compare_code == LE_EXPR)) - compare_count = (loop_bound - compare_bound) / compare_step; + { + /* (loop_bound - compare_bound) / compare_step */ + tem = loop_bound.sub_with_overflow (compare_bound, &of); + overflow |= of; + compare_count = tem.divmod_with_overflow (compare_step, +0, TRUNC_DIV_EXPR, +&mod, &of); + overflow |= of; + } else - compare_count = (compare_bound - base) / compare_step; - +{ + /* (compare_bound - base) / compare_step */ + tem = compare_bound.sub_with_overflow (base, &of); + overflow |= of; + compare_count = tem.divmod_with_overflow (compare_step, +0, TRUNC_DIV_EXPR, +&mod, &of); + overflow |= of; + } if (compare_code == LE_EXPR || compare_code == GE_EXPR) - compare_count ++; + ++compare_count; if (loop_bound_code == LE_EXPR || loop_bound_code == GE_EXPR) - loop_count ++; - if (compare_count < 0) - compare_count = 0; - if (loop_count < 0) - loop_count = 0; - - if (loop_count == 0) +
Re: [PATCH] track heap usage with -fmem-report
Richard Biener writes: > This hacky patch tracks per-pass heap usage with -fmem-report > using glibc malloc hooks (which are deprecated!? eh ... I can > see no replacement?) > > Still somewhat broken accounting for the overall numbers > (and peak memory use, that is). > > But it's a start. And it uses internal glibc allocator > implementation details ... (eh). At least it's low-overhead. I found it much simpler to just LD_PRELOAD tcmalloc and use its excellent debugging support. I think it makes (with debugging disabled) run LTO run a few percent faster too (but ran those numbers some time ago) -Andi -- a...@linux.intel.com -- Speaking for myself only
Re: [C++ Patch] PR 51412
OK. Jason
Re: [PATCH] track heap usage with -fmem-report
On Fri, 8 Mar 2013, Andi Kleen wrote: > Richard Biener writes: > > > This hacky patch tracks per-pass heap usage with -fmem-report > > using glibc malloc hooks (which are deprecated!? eh ... I can > > see no replacement?) > > > > Still somewhat broken accounting for the overall numbers > > (and peak memory use, that is). > > > > But it's a start. And it uses internal glibc allocator > > implementation details ... (eh). At least it's low-overhead. > > I found it much simpler to just LD_PRELOAD tcmalloc and use > its excellent debugging support. > > I think it makes (with debugging disabled) run LTO run > a few percent faster too (but ran those numbers some time > ago) The point was to eventually amend -ftime-report output with per-pass heap usage as well (in addition to the GC stats it prints). Yes, I know of various tools that can track memory usage - but those are not per-pass nor are they built in. Richard.
C++ PATCH for c++/56567 (ICE with lambda returning init-list)
My initial proposal for allowing general return type deduction allowed deduction of std::initializer_list, which is not permitted by C++11. But this doesn't make sense, because the underlying array will immediately leak, so we should just give an error even in C++1y. Tested x86_64-pc-linux-gnu, applying to trunk. commit 10c6627ac3371930fe44868ad94cb2ebc9d4e908 Author: Jason Merrill Date: Fri Mar 8 10:25:55 2013 -0500 PR c++/56567 * semantics.c (apply_deduced_return_type): Don't allow returning std::initializer_list. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index f1eb9ba..5c93a25 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -9061,6 +9061,12 @@ apply_deduced_return_type (tree fco, tree return_type) if (return_type == error_mark_node) return; + if (is_std_init_list (return_type)) +{ + error ("returning %qT", return_type); + return_type = void_type_node; +} + if (LAMBDA_FUNCTION_P (fco)) { tree lambda = CLASSTYPE_LAMBDA_EXPR (current_class_type); diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-initlist3.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-initlist3.C new file mode 100644 index 000..029287b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-initlist3.C @@ -0,0 +1,11 @@ +// PR c++/56567 +// { dg-require-effective-target c++11 } + +#include + +int main() +{ + []{ return { 1, 2 }; }(); // { dg-error "initializer_list" } +} + +// { dg-prune-output "return-statement with a value" }
C++ PATCH for various lambda bugs (51494, 51884, 56222, 51884)
The first two patches deal with issues with 'this' capture; we were inappropriately capturing 'this' for uses of static members and forming pointers to members, and for uses in unevaluated context. The last patch avoids a crash from recursive use of dfs_walk when instantiating a class with virtual functions using a local class whose scope involves a qualified-id. Tested x86_64-pc-linux-gnu, applying to trunk. commit 58322f8d0b0892ac66d184cc933655e135d324af Author: Jason Merrill Date: Tue Mar 5 12:09:52 2013 -0500 PR c++/51494 PR c++/51884 PR c++/56222 * tree.c (maybe_dummy_object): Don't capture 'this'. * semantics.c (maybe_resolve_dummy): New. (finish_non_static_data_member): Use it. (finish_qualified_id_expr): Don't test is_dummy_object. * cp-tree.h: Declare maybe_resolve_dummy. * call.c (build_new_method_call_1): Use it. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 4eb38ec..530835b 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -7627,6 +7627,7 @@ build_new_method_call_1 (tree instance, tree fns, vec **args, else { fn = cand->fn; + call = NULL_TREE; if (!(flags & LOOKUP_NONVIRTUAL) && DECL_PURE_VIRTUAL_P (fn) @@ -7644,12 +7645,26 @@ build_new_method_call_1 (tree instance, tree fns, vec **args, if (TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE && is_dummy_object (instance_ptr)) { - if (complain & tf_error) - error ("cannot call member function %qD without object", - fn); - call = error_mark_node; + instance = maybe_resolve_dummy (instance); + if (instance == error_mark_node) + call = error_mark_node; + else if (!is_dummy_object (instance)) + { + /* We captured 'this' in the current lambda now that + we know we really need it. */ + instance_ptr = build_this (instance); + cand->first_arg = instance_ptr; + } + else + { + if (complain & tf_error) + error ("cannot call member function %qD without object", + fn); + call = error_mark_node; + } } - else + + if (call != error_mark_node) { /* Optimize away vtable lookup if we know that this function can't be overridden. We need to check if diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 4a597d8..c3b2aec 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -5722,6 +5722,7 @@ extern bool is_capture_proxy (tree); extern bool is_normal_capture_proxy (tree); extern void register_capture_members (tree); extern tree lambda_expr_this_capture(tree); +extern tree maybe_resolve_dummy (tree); extern tree nonlambda_method_basetype (void); extern void maybe_add_lambda_conv_op(tree); extern bool is_lambda_ignored_entity(tree); diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index d605de9..d11a4e4 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -1544,6 +1544,7 @@ finish_non_static_data_member (tree decl, tree object, tree qualifying_scope) object = maybe_dummy_object (scope, NULL); } + object = maybe_resolve_dummy (object); if (object == error_mark_node) return error_mark_node; @@ -1778,15 +1779,14 @@ finish_qualified_id_expr (tree qualifying_class, } else if (BASELINK_P (expr) && !processing_template_decl) { - tree ob; - /* See if any of the functions are non-static members. */ /* If so, the expression may be relative to 'this'. */ if (!shared_member_p (expr) - && (ob = maybe_dummy_object (qualifying_class, NULL), - !is_dummy_object (ob))) + && current_class_ptr + && DERIVED_FROM_P (qualifying_class, + current_nonlambda_class_type ())) expr = (build_class_member_access_expr - (ob, + (maybe_dummy_object (qualifying_class, NULL), expr, BASELINK_ACCESS_BINFO (expr), /*preserve_reference=*/false, @@ -9534,6 +9534,34 @@ lambda_expr_this_capture (tree lambda) return result; } +/* We don't want to capture 'this' until we know we need it, i.e. after + overload resolution has chosen a non-static member function. At that + point we call this function to turn a dummy object into a use of the + 'this' capture. */ + +tree +maybe_resolve_dummy (tree object) +{ + if (!is_dummy_object (object)) +return object; + + tree type = TYPE_MAIN_VARIANT (TREE_TYPE (object)); + gcc_assert (TREE_CODE (type) != POINTER_TYPE); + + if (type != current_class_type + && current_class_type + && LAMBDA_TYPE_P (current_class_type)) +{ + /* In a lambda, need to go through 'this' capture. */ + tree lam = CLASSTYPE_LAMBDA_EXPR (current_class_type); + tree cap = lambda_expr_this_capture (lam); + object = build_x_indirect_ref (EXPR_LOCATION (object), cap, + RO_NULL, tf_warning_or_error); +} + + return object; +} + /* Returns the method basetype of the innermost non-lambda function, or NULL_TREE if none. */ diff --git a/gcc/cp/tree.c b/gcc/cp/tre
Re: r196201 - in /trunk: gcc/ChangeLog gcc/config/i...
On Fri, Feb 22, 2013 at 01:58:09PM +0100, Jakub Jelinek wrote: > 2013-02-22 Jakub Jelinek > > PR sanitizer/56393 > * config/gnu-user.h (LIBASAN_EARLY_SPEC): Link in libasan_preinit.o > if not linking a shared library. > > --- gcc/config/gnu-user.h.jj 2013-02-05 16:55:01.0 +0100 > +++ gcc/config/gnu-user.h 2013-02-22 13:02:11.0 +0100 > @@ -104,11 +104,13 @@ see the files COPYING3 and COPYING.RUNTI > it to force everything into the executable. And similarly for -ltsan. */ > #if defined(HAVE_LD_STATIC_DYNAMIC) > #undef LIBASAN_EARLY_SPEC > -#define LIBASAN_EARLY_SPEC "%{static-libasan:%{!shared:" \ > +#define LIBASAN_EARLY_SPEC "%{!shared:libasan_preinit%O%s} " \ > + "%{static-libasan:%{!shared:" \ >LD_STATIC_OPTION " --whole-archive -lasan --no-whole-archive " \ >LD_DYNAMIC_OPTION "}}%{!static-libasan:-lasan}" > #undef LIBTSAN_EARLY_SPEC > -#define LIBTSAN_EARLY_SPEC "%{static-libtsan:%{!shared:" \ > +#define LIBTSAN_EARLY_SPEC "%{!shared:libasan_preinit%O%s} " \ > + "%{static-libtsan:%{!shared:" \ >LD_STATIC_OPTION " --whole-archive -ltsan --no-whole-archive " \ >LD_DYNAMIC_OPTION "}}%{!static-libtsan:-ltsan}" > #endif No idea what I've been thinking that I also changed LIBTSAN_EARLY_SPEC. Obviously for -fsanitize=thread we shouldn't link in libasan_preinit.o, that is never going to work. Fixed thusly, committed as obvious to trunk: 2013-03-08 Jakub Jelinek * config/gnu-user.h (LIBTSAN_EARLY_SPEC): Don't link against libasan_preinit.o. --- gcc/config/gnu-user.h.jj2013-02-22 17:05:05.0 +0100 +++ gcc/config/gnu-user.h 2013-03-08 18:11:53.147370936 +0100 @@ -109,8 +109,7 @@ see the files COPYING3 and COPYING.RUNTI LD_STATIC_OPTION " --whole-archive -lasan --no-whole-archive " \ LD_DYNAMIC_OPTION "}}%{!static-libasan:-lasan}" #undef LIBTSAN_EARLY_SPEC -#define LIBTSAN_EARLY_SPEC "%{!shared:libasan_preinit%O%s} " \ - "%{static-libtsan:%{!shared:" \ +#define LIBTSAN_EARLY_SPEC "%{static-libtsan:%{!shared:" \ LD_STATIC_OPTION " --whole-archive -ltsan --no-whole-archive " \ LD_DYNAMIC_OPTION "}}%{!static-libtsan:-ltsan}" #endif Jakub
Re: [PATCH] Fix install-plugin with vxworks-dummy.h (PR plugins/45078)
On Wed, Mar 06, 2013 at 01:44:28PM +0100, Jakub Jelinek wrote: > On Wed, Mar 06, 2013 at 06:57:03PM +0800, Matthias Klose wrote: > > There is still vxworks-dummy.h, which is not installed, see PR45078. Would > > the > > same approach work? > > Like this? Untested though, and no access to most of the targets. Now bootstrapped/regtested on armv7hl-linux-gnueabi. Ok for trunk? > 2013-03-06 Jakub Jelinek > > PR plugins/45078 > * config.gcc: On arm, mips, sh and sparc add vxworks-dummy.h to > tm_file. > > --- gcc/config.gcc.jj 2013-02-22 17:04:41.0 +0100 > +++ gcc/config.gcc2013-03-06 13:38:19.711201446 +0100 > @@ -536,6 +536,9 @@ x86_64-*-*) > fi > tm_file="vxworks-dummy.h ${tm_file}" > ;; > +arm*-*-* | mips*-*-* | sh*-*-* | sparc*-*-*) > + tm_file="vxworks-dummy.h ${tm_file}" > + ;; > esac > > # On a.out targets, we need to use collect2. > @@ -861,7 +864,7 @@ arm-wrs-vxworks) > tmake_file="${tmake_file} arm/t-arm arm/t-vxworks" > ;; > arm*-*-netbsdelf*) > - tm_file="dbxelf.h elfos.h netbsd.h netbsd-elf.h arm/elf.h arm/aout.h > arm/arm.h arm/netbsd-elf.h" > + tm_file="dbxelf.h elfos.h netbsd.h netbsd-elf.h arm/elf.h arm/aout.h > ${tm_file} arm/netbsd-elf.h" > extra_options="${extra_options} netbsd.opt netbsd-elf.opt" > tmake_file="${tmake_file} arm/t-arm" > ;; > @@ -873,7 +876,7 @@ arm*-*-linux-*) # ARM GNU/Linux with E > ;; > esac > tmake_file="${tmake_file} arm/t-arm arm/t-arm-elf arm/t-bpabi > arm/t-linux-eabi" > - tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h arm/aout.h arm/arm.h" > + tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h arm/aout.h > vxworks-dummy.h arm/arm.h" > # Define multilib configuration for arm-linux-androideabi. > case ${target} in > *-androideabi) > @@ -891,7 +894,7 @@ arm*-*-linux-*) # ARM GNU/Linux with E > arm*-*-uclinux*eabi*)# ARM ucLinux > tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/linux-gas.h > arm/uclinux-elf.h glibc-stdint.h" > tmake_file="arm/t-arm arm/t-arm-elf arm/t-bpabi" > - tm_file="$tm_file arm/bpabi.h arm/uclinux-eabi.h arm/aout.h arm/arm.h" > + tm_file="$tm_file arm/bpabi.h arm/uclinux-eabi.h arm/aout.h > vxworks-dummy.h arm/arm.h" > # The BPABI long long divmod functions return a 128-bit value in > # registers r0-r3. Correctly modeling that requires the use of > # TImode. > @@ -928,7 +931,7 @@ arm*-*-eabi* | arm*-*-symbianelf* | arm* > tmake_file="${tmake_file} arm/t-symbian" > ;; > esac > - tm_file="${tm_file} arm/aout.h arm/arm.h" > + tm_file="${tm_file} arm/aout.h vxworks-dummy.h arm/arm.h" > ;; > avr-*-rtems*) > tm_file="elfos.h avr/elf.h avr/avr-arch.h avr/avr.h dbxelf.h > avr/rtems.h rtems.h newlib-stdint.h" > Jakub
[lra] patch to fix s390 building
It was about 9 months since I checked LRA for s390 last time. No wonder, that it is completely broken. The following patch at least permits to build s390 GCC with LRA. The patch was successfully bootstrapped on x864/x86-64, ppc64, and ia64. Committed as rev. 196553. 2013-03-08 Vladimir Makarov * lra-constraints.c (process_alt_operands): Don't penalize alternative of move insn which is an elimination result. (process_address): Use EXTRA_CONSTRAINT_STR for validation of extra address constraints. * lra-eliminations.c (eliminate_regs_in_insn): Make return earlier if there are no operand changes. * lra-spills.c (lra_final_code_change): Skip subreg change for operators. Index: lra-constraints.c === --- lra-constraints.c (revision 196509) +++ lra-constraints.c (working copy) @@ -2068,7 +2068,11 @@ process_alt_operands (int only_alternati no_subreg_reg_operand[1]) || (targetm.preferred_reload_class (no_subreg_reg_operand[1], - (enum reg_class) curr_alt[1]) != NO_REGS) + (enum reg_class) curr_alt[1]) != NO_REGS)) + /* If it is a result of recent elimination in move +insn we can transform it into an add still by +using this alternative. */ + && GET_CODE (no_subreg_reg_operand[1]) != PLUS))) /* We have a move insn and a new reload insn will be similar to the current insn. We should avoid such situation as it results in LRA cycling. */ @@ -2444,6 +2448,15 @@ process_address (int nop, rtx *before, r && process_addr_reg (ad.index_term, before, NULL, INDEX_REG_CLASS)) change_p = true; +#ifdef EXTRA_CONSTRAINT_STR + /* Target hooks sometimes reject extra constraint addresses -- use + EXTRA_CONSTRAINT_STR for the validation. */ + if (constraint[0] != 'p' + && EXTRA_ADDRESS_CONSTRAINT (constraint[0], constraint) + && EXTRA_CONSTRAINT_STR (op, constraint[0], constraint)) +return change_p; +#endif + /* There are three cases where the shape of *AD.INNER may now be invalid: 1) the original address was valid, but either elimination or Index: lra-eliminations.c === --- lra-eliminations.c (revision 196509) +++ lra-eliminations.c (working copy) @@ -977,6 +977,9 @@ eliminate_regs_in_insn (rtx insn, bool r } } + if (! validate_p) +return; + /* Substitute the operands; the new values are in the substed_operand array. */ for (i = 0; i < static_id->n_operands; i++) @@ -984,16 +987,13 @@ eliminate_regs_in_insn (rtx insn, bool r for (i = 0; i < static_id->n_dups; i++) *id->dup_loc[i] = substed_operand[(int) static_id->dup_num[i]]; - if (validate_p) -{ - /* If we had a move insn but now we don't, re-recognize it. -This will cause spurious re-recognition if the old move had a -PARALLEL since the new one still will, but we can't call -single_set without having put new body into the insn and the -re-recognition won't hurt in this rare case. */ - id = lra_update_insn_recog_data (insn); - static_id = id->insn_static_data; -} + /* If we had a move insn but now we don't, re-recognize it. + This will cause spurious re-recognition if the old move had a + PARALLEL since the new one still will, but we can't call + single_set without having put new body into the insn and the + re-recognition won't hurt in this rare case. */ + id = lra_update_insn_recog_data (insn); + static_id = id->insn_static_data; } /* Spill pseudos which are assigned to hard registers in SET. Add Index: lra-spills.c === --- lra-spills.c(revision 196509) +++ lra-spills.c(working copy) @@ -644,10 +644,12 @@ lra_final_code_change (void) } lra_insn_recog_data_t id = lra_get_insn_recog_data (insn); + struct lra_static_insn_data *static_id = id->insn_static_data; bool insn_change_p = false; for (i = id->insn_static_data->n_operands - 1; i >= 0; i--) - if (alter_subregs (id->operand_loc[i], ! DEBUG_INSN_P (insn))) + if ((DEBUG_INSN_P (insn) || ! static_id->operand[i].is_operator) + && alter_subregs (id->operand_loc[i], ! DEBUG_INSN_P (insn))) { lra_update_dup (id, i); insn_change_p = true;
Re: [GOOGLE] Fix incorrect dependency in Makefile.in
ok. David On Thu, Mar 7, 2013 at 5:36 PM, Dehao Chen wrote: > This patch fixes the incorrect dependency in Makefile.in. > > Bootstrapped and passed regression test. > > Okay for google-4_7 branch? > > Thanks, > DehaoIndex: > > gcc/Makefile.in > === > --- gcc/Makefile.in (revision 196532) > +++ gcc/Makefile.in (working copy) > @@ -3442,7 +3442,7 @@ > $(TREE_PASS_H) $(TREE_FLOW_H) $(TREE_INLINE_H) > cfglayout.o : cfglayout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ > $(RTL_H) $(TREE_H) insn-config.h $(BASIC_BLOCK_H) hard-reg-set.h output.h > \ > - $(FUNCTION_H) $(CFGLAYOUT_H) $(CFGLOOP_H) $(TARGET_H) gt-cfglayout.h \ > + $(FUNCTION_H) $(CFGLAYOUT_H) $(CFGLOOP_H) $(TARGET_H) \ > $(GGC_H) alloc-pool.h $(FLAGS_H) $(OBSTACK_H) $(TREE_PASS_H) vecprim.h \ > $(DF_H) $(EMIT_RTL_H) $(COMMON_TARGET_H) > timevar.o : timevar.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
[google/gcc-4_7-mobile] Cherry-pick 196555 - fix broken dependency
Hi Ahmad and Dehao, gcc-4_7-mobile branch needs 196555 patch to fix broken dependency when bootstrapping host compiler for chromeos. Could you take a look, thanks! -Han Patch here >> diff --git a/gcc/Makefile.in b/gcc/Makefile.in index c180f31..82b 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -3442,7 +3442,7 @@ tracer.o : tracer.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(TREE_PASS_H) $(TREE_FLOW_H) $(TREE_INLINE_H) cfglayout.o : cfglayout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(RTL_H) $(TREE_H) insn-config.h $(BASIC_BLOCK_H) hard-reg-set.h output.h \ - $(FUNCTION_H) $(CFGLAYOUT_H) $(CFGLOOP_H) $(TARGET_H) gt-cfglayout.h \ + $(FUNCTION_H) $(CFGLAYOUT_H) $(CFGLOOP_H) $(TARGET_H) \ $(GGC_H) alloc-pool.h $(FLAGS_H) $(OBSTACK_H) $(TREE_PASS_H) vecprim.h \ $(DF_H) $(EMIT_RTL_H) $(COMMON_TARGET_H) timevar.o : timevar.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
Re: [google/gcc-4_7-mobile] Cherry-pick 196555 - fix broken dependency
Looks good. Dehao On Fri, Mar 8, 2013 at 11:07 AM, Han Shen(沈涵) wrote: > Hi Ahmad and Dehao, gcc-4_7-mobile branch needs 196555 patch to fix > broken dependency when bootstrapping host compiler for chromeos. > > Could you take a look, thanks! > > -Han > > Patch here >> > diff --git a/gcc/Makefile.in b/gcc/Makefile.in > index c180f31..82b 100644 > --- a/gcc/Makefile.in > +++ b/gcc/Makefile.in > @@ -3442,7 +3442,7 @@ tracer.o : tracer.c $(CONFIG_H) $(SYSTEM_H) > coretypes.h $(TM_H) $(RTL_H) \ > $(TREE_PASS_H) $(TREE_FLOW_H) $(TREE_INLINE_H) > cfglayout.o : cfglayout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ > $(RTL_H) $(TREE_H) insn-config.h $(BASIC_BLOCK_H) hard-reg-set.h output.h > \ > - $(FUNCTION_H) $(CFGLAYOUT_H) $(CFGLOOP_H) $(TARGET_H) gt-cfglayout.h \ > + $(FUNCTION_H) $(CFGLAYOUT_H) $(CFGLOOP_H) $(TARGET_H) \ > $(GGC_H) alloc-pool.h $(FLAGS_H) $(OBSTACK_H) $(TREE_PASS_H) vecprim.h \ > $(DF_H) $(EMIT_RTL_H) $(COMMON_TARGET_H) > timevar.o : timevar.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
Re: do not pass PR_INSTRUMENTEDCODE if there is no instrumentation
On 02/27/2013 08:43 AM, Aldy Hernandez wrote: > + * trans-mem.c (expand_transaction): Do not set PR_INSTRUMENTEDCODE > + if GTMA_HAS_NO_INSTRUMENTATION. > + (generate_tm_state): Keep GTMA_HAS_NO_INSTRUMENTATION bit. > + (ipa_tm_transform_transaction): Set GTMA_HAS_NO_INSTRUMENTATION. > + * gimple.h (GTMA_HAS_NO_INSTRUMENTATION): Define. > + * gimple-pretty-print.c (dump_gimple_transaction): Handle > + GTMA_HAS_NO_INSTRUMENTATION. This version is ok. r~
Re: Fix vector C++11 allocator bug
On 03/07/2013 11:46 PM, Jonathan Wakely wrote: As expected it works for vector/swap.cc too. So we definitely need the bug fix to std::vector::operator= and the testsuite changes to add elements, but I think I'd prefer to just re-swap the containers in the non-propagating case. This is indeed better so I applied the patch as you proposed. 2013-03-08 François Dumont * include/bits/vector.tcc (vector<>operator=(const vector<>&): Reset pointers after deallocation when memory can be reused. * testsuite/23_containers/vector/allocator/minimal.cc: Insert elements to really challenge C++11 allocator integration. * testsuite/23_containers/vector/allocator/copy.cc: Likewise. * testsuite/23_containers/vector/allocator/copy_assign.cc: Likewise. * testsuite/23_containers/vector/allocator/move_assign.cc: Likewise. * testsuite/23_containers/vector/allocator/swap.cc: Likewise and swap vector back before checks on memory/personality mapping are performed. * testsuite/23_containers/forward_list/allocator/minimal.cc: Insert element to really challenge C++11 allocator integration. * testsuite/23_containers/forward_list/allocator/copy.cc: Likewise. * testsuite/23_containers/forward_list/allocator/copy_assign.cc: Likewise. * testsuite/23_containers/forward_list/allocator/move_assign.cc: Likewise. * testsuite/23_containers/forward_list/allocator/swap.cc: Likewise and swap forward_list back before checks on memory/personality mapping are performed. Index: include/bits/vector.tcc === --- include/bits/vector.tcc (revision 196556) +++ include/bits/vector.tcc (working copy) @@ -173,6 +173,9 @@ _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage - this->_M_impl._M_start); + this->_M_impl._M_start = nullptr; + this->_M_impl._M_finish = nullptr; + this->_M_impl._M_end_of_storage = nullptr; } std::__alloc_on_copy(_M_get_Tp_allocator(), __x._M_get_Tp_allocator()); Index: testsuite/23_containers/forward_list/allocator/copy_assign.cc === --- testsuite/23_containers/forward_list/allocator/copy_assign.cc (revision 196556) +++ testsuite/23_containers/forward_list/allocator/copy_assign.cc (working copy) @@ -31,7 +31,9 @@ typedef propagating_allocator alloc_type; typedef std::forward_list test_type; test_type v1(alloc_type(1)); + v1.push_front(T()); test_type v2(alloc_type(2)); + v2.push_front(T()); v2 = v1; VERIFY(1 == v1.get_allocator().get_personality()); VERIFY(2 == v2.get_allocator().get_personality()); @@ -43,7 +45,9 @@ typedef propagating_allocator alloc_type; typedef std::forward_list test_type; test_type v1(alloc_type(1)); + v1.push_front(T()); test_type v2(alloc_type(2)); + v2.push_front(T()); v2 = v1; VERIFY(1 == v1.get_allocator().get_personality()); VERIFY(1 == v2.get_allocator().get_personality()); Index: testsuite/23_containers/forward_list/allocator/minimal.cc === --- testsuite/23_containers/forward_list/allocator/minimal.cc (revision 196556) +++ testsuite/23_containers/forward_list/allocator/minimal.cc (working copy) @@ -37,6 +37,7 @@ typedef std::allocator_traits traits_type; typedef std::forward_list test_type; test_type v(alloc_type{}); + v.push_front(T()); VERIFY( v.max_size() == traits_type::max_size(v.get_allocator()) ); } Index: testsuite/23_containers/forward_list/allocator/copy.cc === --- testsuite/23_containers/forward_list/allocator/copy.cc (revision 196556) +++ testsuite/23_containers/forward_list/allocator/copy.cc (working copy) @@ -31,6 +31,7 @@ typedef propagating_allocator alloc_type; typedef std::forward_list test_type; test_type v1(alloc_type(1)); + v1.push_front(T()); test_type v2(v1); VERIFY(1 == v1.get_allocator().get_personality()); VERIFY(0 == v2.get_allocator().get_personality()); @@ -42,6 +43,7 @@ typedef propagating_allocator alloc_type; typedef std::forward_list test_type; test_type v1(alloc_type(1)); + v1.push_front(T()); test_type v2(v1); VERIFY(1 == v1.get_allocator().get_personality()); VERIFY(1 == v2.get_allocator().get_personality()); Index: testsuite/23_containers/forward_list/allocator/move_assign.cc === --- testsuite/23_containers/forward_list/allocator/move_assign.cc (revision 196556) +++ testsuite/23_containers/forward_list/allocator/move_assign.cc (working copy) @@ -31,7 +31,9 @@ typedef propagating_allocator alloc_type; typedef std::forward_list test_type; test_type v1(alloc_type(1)); + v1.push_front(T()); test_type v2(alloc_type(2)); + v2.push_front(T()); v2 = std::move(v1); VERIFY(1 == v1.get_a
[lra] Merged with trunk
LRA branch has been merged with trunk @ 196555. The branch was successfully bootstrapped on x86/x86-64. Committed as rev. 196556.
Re: Fix vector C++11 allocator bug
On 8 March 2013 20:16, François Dumont wrote: > On 03/07/2013 11:46 PM, Jonathan Wakely wrote: >> >> As expected it works for vector/swap.cc too. So we definitely need the bug >> fix to std::vector::operator= and the testsuite changes to add elements, but >> I think I'd prefer to just re-swap the containers in the non-propagating >> case. > > > This is indeed better so I applied the patch as you proposed. Thanks, can you also make the same changes to the 4.7 branch? If not I can do so.
[v3] bits/memoryfwd.h
Hey y'all. I noticed the repeated, repeated, repeated use of std::allocator forward decls as I was trying to debug some doxygen output. Clearly, it's past time for a memory forward header, like bits/stringfwd.h. The following patch implements this. Perhaps some of the other headers can now be optimized because of this, but that was not my primary focus. Instead, I was just trying to come up with the smallest patch that was semantically equivalent to existing trunk. tested x86/linux -benjamin 2013-03-08 Benjamin Kosnik * include/bits/memoryfwd.h: New. Centralize forward declarations. * include/bits/algorithmfwd.h: Consistent comments. * include/bits/localefwd.h: Same. * include/ext/vstring_fwd.h: Same. * include/parallel/algorithmfwd.h: Same. * include/parallel/numericfwd.h: Same. * include/std/iosfwd: Same. * include/bits/alloc_traits.h: Include memoryfwd.h, remove allocator forward decl. * include/ext/alloc_traits.h: Remove allocator forward decl. * include/bits/stl_construct.h: Same. * include/bits/stringfwd.h: Include memoryfwd.h, remove allocator forward decl. Consistent comments. * doc/doxygen/user.cfg.in (TEMPLATE_RELATIONS): To NO. * include/Makefile.am (bits_headers): Add memoryfwd.h. * include/Makefile.in: Regenerate. * configure: Same. * include/bits/vector.tcc (vector<>operator=(const vector<>&): diff --git a/libstdc++-v3/doc/doxygen/user.cfg.in b/libstdc++-v3/doc/doxygen/user.cfg.in index 4a3afc4..45efb63 100644 --- a/libstdc++-v3/doc/doxygen/user.cfg.in +++ b/libstdc++-v3/doc/doxygen/user.cfg.in @@ -1957,7 +1957,7 @@ UML_LIMIT_NUM_FIELDS = 10 # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. -TEMPLATE_RELATIONS = YES +TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am index 5342217..6bd3b43 100644 --- a/libstdc++-v3/include/Makefile.am +++ b/libstdc++-v3/include/Makefile.am @@ -113,6 +113,7 @@ bits_headers = \ ${bits_srcdir}/locale_facets_nonio.tcc \ ${bits_srcdir}/localefwd.h \ ${bits_srcdir}/mask_array.h \ + ${bits_srcdir}/memoryfwd.h \ ${bits_srcdir}/move.h \ ${bits_srcdir}/ostream.tcc \ ${bits_srcdir}/ostream_insert.h \ diff --git a/libstdc++-v3/include/bits/algorithmfwd.h b/libstdc++-v3/include/bits/algorithmfwd.h index 7b8448c..e6321b2 100644 --- a/libstdc++-v3/include/bits/algorithmfwd.h +++ b/libstdc++-v3/include/bits/algorithmfwd.h @@ -1,4 +1,4 @@ -// declarations -*- C++ -*- +// Forward declarations -*- C++ -*- // Copyright (C) 2007-2013 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/include/bits/alloc_traits.h b/libstdc++-v3/include/bits/alloc_traits.h index 26c64f2..33ea145 100644 --- a/libstdc++-v3/include/bits/alloc_traits.h +++ b/libstdc++-v3/include/bits/alloc_traits.h @@ -32,6 +32,7 @@ #if __cplusplus >= 201103L +#include #include #include @@ -39,9 +40,6 @@ namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION - template -class allocator; - template class __alloctr_rebind_helper { diff --git a/libstdc++-v3/include/bits/allocator.h b/libstdc++-v3/include/bits/allocator.h index 97477fb..28df242 100644 --- a/libstdc++-v3/include/bits/allocator.h +++ b/libstdc++-v3/include/bits/allocator.h @@ -43,8 +43,8 @@ #ifndef _ALLOCATOR_H #define _ALLOCATOR_H 1 -// Define the base class to std::allocator. -#include +#include // Define the base class to std::allocator. +#include #if __cplusplus >= 201103L #include #endif @@ -54,17 +54,10 @@ namespace std _GLIBCXX_VISIBILITY(default) _GLIBCXX_BEGIN_NAMESPACE_VERSION /** - * @defgroup allocators Allocators - * @ingroup memory - * - * Classes encapsulating memory operations. - * - * @{ + * @addtogroup allocators + * @{ */ - template -class allocator; - /// allocator specialization. template<> class allocator @@ -150,13 +143,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION operator!=(const allocator<_Tp>&, const allocator<_Tp>&) { return false; } - /// Declare uses_allocator so it can be specialized in \ etc. - template -struct uses_allocator; - - /** - * @} - */ + /// @} group allocator // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. diff --git a/libstdc++-v3/include/bits/localefwd.h b/libstdc++-v3/include/bits/localefwd.h index e0a233b..ca06dc1 100644 --- a/libstdc++-v3/include/bits/localefwd.h +++ b/libstdc++-v3/include/bits/localefwd.h @@ -1,4 +1,4 @@ -// Locale support -*- C++ -*- +// Forward declarations -*- C++ -*- // Copyright (C) 1997-2013 Free Software Foundation, Inc. // @@ -185,6 +185,6 @@ _GLIBCXX_END_NAMESPACE_LDBL class messages_byname; _GLIBCXX_END_NA
[C++ testcase, committed] PR 56565
Hi, I'm adding the testcase and closing the PR as fixed. Thanks, Paolo. // 2013-03-08 Paolo Carlini PR c++/56565 * g++.dg/cpp0x/lambda/lambda-nsdmi2.C: New. Index: g++.dg/cpp0x/lambda/lambda-nsdmi2.C === --- g++.dg/cpp0x/lambda/lambda-nsdmi2.C (revision 0) +++ g++.dg/cpp0x/lambda/lambda-nsdmi2.C (working copy) @@ -0,0 +1,4 @@ +// PR c++/56565 +// { dg-do compile { target c++11 } } + +struct bug { int a; int *b = [&]{ return &a; }(); };
Re: [PATCH] MIPS: MIPS32r2 FP MADD instruction set support
On Thu, 21 Feb 2013, Mike Stump wrote: > > BTW, do you happen to know a way to reliable force all our testsuites NOT > > to delete executables after run? Personally I think it's missing the > > point to have them deleted -- how can one debug any regressions then? > > So, I go into the source and comment out the cleanup lines… Would be > nice to have them conditional on a variable so that one can set that > variable in their .dejagnurc file. Hmm, good idea, I'll see if the hack I use could be adapted easily. > The limitations of this are, multiple test cases can use the same > intermediate files and they would not give you a nice 1 to 1 mapping > back. However, this I usually side step by only running a subset of the > test suite that contains the part I'm interested in. Yeah, I think final executables that don't have unique names are even worse. It would be good to avoid at least making such new cases. > > What do other people do? > > We usually can cut and paste the one line and run the one case by hand. > Test cases that don't fall into this category, well, suck, I mean, are > more annoying. For this to work you need to have at least all the auxiliary stuff needed for linking, etc. that's built once per test suite run still available. Somehow I found it troublesome to rebuild it manually. Thanks for all the hints -- it looks to me like there's no easy answer. In which case I'll see if I can do anything about the hack I have in case someone else finds it useful. Maciej
Re: PR 56524: TREE_OPTIMIZATION_OPTABS vs. mips16
Jakub Jelinek writes: > So I think the > > if (TREE_OPTIMIZATION_OPTABS (optnode)) > ggc_free (TREE_OPTIMIZATION_OPTABS (optnode)); > > has to be removed (of course the second ggc_free, if memcmp returned 0, is > desirable). *blush*. Thanks for catching that. > Otherwise looks good. OK, here's what I installed after retesting on x86_64-linux-gnu and mips64-linux-gnu. Thanks, Richard gcc/ PR middle-end/56524 * tree.h (tree_optimization_option): Rename target_optabs to optabs. Add base_optabs. (TREE_OPTIMIZATION_OPTABS): Update after previous field change. (TREE_OPTIMIZATION_BASE_OPTABS): New macro. (save_optabs_if_changed): Replace with... (init_tree_optimization_optabs): ...this. * optabs.c (save_optabs_if_changed): Rename to... (init_tree_optimization_optabs): ...this. Take the optimization node as argument. Do nothing if the base optabs are already correct. Reuse the existing TREE_OPTIMIZATION_OPTABS memory if we need to recompute optabs. * function.h (function): Remove optabs field. * function.c (invoke_set_current_function_hook): Call init_tree_optimization_optabs. Use the result to initialize this_fn_optabs. gcc/c-family/ PR middle-end/56524 * c-common.c (handle_optimize_attribute): Don't call save_optabs_if_changed. gcc/testsuite/ PR middle-end/56524 * gcc.target/mips/pr56524.c: New test. Index: gcc/tree.h === --- gcc/tree.h 2013-03-08 07:52:41.865887012 + +++ gcc/tree.h 2013-03-08 07:54:18.122879783 + @@ -3589,21 +3589,26 @@ struct GTY(()) tree_optimization_option /* Target optabs for this set of optimization options. This is of type `struct target_optabs *'. */ - unsigned char *GTY ((atomic)) target_optabs; + unsigned char *GTY ((atomic)) optabs; + + /* The value of this_target_optabs against which the optabs above were + generated. */ + struct target_optabs *GTY ((skip)) base_optabs; }; #define TREE_OPTIMIZATION(NODE) \ (&OPTIMIZATION_NODE_CHECK (NODE)->optimization.opts) #define TREE_OPTIMIZATION_OPTABS(NODE) \ - (OPTIMIZATION_NODE_CHECK (NODE)->optimization.target_optabs) + (OPTIMIZATION_NODE_CHECK (NODE)->optimization.optabs) + +#define TREE_OPTIMIZATION_BASE_OPTABS(NODE) \ + (OPTIMIZATION_NODE_CHECK (NODE)->optimization.base_optabs) /* Return a tree node that encapsulates the current optimization options. */ extern tree build_optimization_node (void); -/* Save a new set of target_optabs in a TREE_OPTIMIZATION node if the - current set of optabs has changed. */ -extern void save_optabs_if_changed (tree); +extern void init_tree_optimization_optabs (tree); /* Target options used by a function. */ Index: gcc/optabs.c === --- gcc/optabs.c2013-03-08 07:54:02.938171541 + +++ gcc/optabs.c2013-03-08 07:54:29.833402743 + @@ -6208,31 +6208,32 @@ init_optabs (void) targetm.init_libfuncs (); } -/* Recompute the optabs and save them if they have changed. */ +/* Use the current target and options to initialize + TREE_OPTIMIZATION_OPTABS (OPTNODE). */ void -save_optabs_if_changed (tree fndecl) +init_tree_optimization_optabs (tree optnode) { - /* ?? If this fails, we should temporarily restore the default - target first (set_cfun (NULL) ??), do the rest of this function, - and then restore it. */ - gcc_assert (this_target_optabs == &default_target_optabs); + /* Quick exit if we have already computed optabs for this target. */ + if (TREE_OPTIMIZATION_BASE_OPTABS (optnode) == this_target_optabs) +return; + /* Forget any previous information and set up for the current target. */ + TREE_OPTIMIZATION_BASE_OPTABS (optnode) = this_target_optabs; struct target_optabs *tmp_optabs = (struct target_optabs *) -ggc_alloc_atomic (sizeof (struct target_optabs)); - tree optnode = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl); +TREE_OPTIMIZATION_OPTABS (optnode); + if (tmp_optabs) +memset (tmp_optabs, 0, sizeof (struct target_optabs)); + else +tmp_optabs = (struct target_optabs *) + ggc_alloc_atomic (sizeof (struct target_optabs)); /* Generate a new set of optabs into tmp_optabs. */ init_all_optabs (tmp_optabs); /* If the optabs changed, record it. */ if (memcmp (tmp_optabs, this_target_optabs, sizeof (struct target_optabs))) -{ - if (TREE_OPTIMIZATION_OPTABS (optnode)) - ggc_free (TREE_OPTIMIZATION_OPTABS (optnode)); - - TREE_OPTIMIZATION_OPTABS (optnode) = (unsigned char *) tmp_optabs; -} +TREE_OPTIMIZATION_OPTABS (optnode) = (unsigned char *) tmp_optabs; else { TREE_OPTIMIZATION_OPTABS (optnode) = NULL; Index: gcc/function.h === --- gcc/f