[wwwdocs] gcc-4.8/porting_to.html
Hey! Here is the first pass at the 4.8 porting documentation. This seems to reflect the current trunk reality. I'm not quite sure to about the best way to talk about the more aggressive loop optimizations WRT undefined sematincs, but this seems reasonable. Of course, if anybody has better ideas, I'm all ears. best, Benjamin2013-03-13 Benjamin Kosnik * htdocs/gcc-4.8/porting_to.html: Add. Index: htdocs/gcc-4.8/porting_to.html === RCS file: htdocs/gcc-4.8/porting_to.html diff -N htdocs/gcc-4.8/porting_to.html *** /dev/null 1 Jan 1970 00:00:00 - --- htdocs/gcc-4.8/porting_to.html 13 Mar 2013 09:23:12 - *** *** 0 --- 1,233 + + + + Porting to GCC 4.8 + + + + Porting to GCC 4.8 + + + The GCC 4.8 release series differs from previous GCC releases in more + than the usual list of + http://gcc.gnu.org/gcc-4.8/changes.html";>changes. Some of + these are a result of bug fixing, and some old behaviors have been + intentionally changed in order to support new standards, or relaxed + in standards-conforming ways to facilitate compilation or runtime + performance. Some of these changes are not visible to the naked eye + and will not cause problems when updating from older versions. + + + + However, some of these changes are visible, and can cause grief to + users porting to GCC 4.8. This document is an effort to identify major + issues and provide clear solutions in a quick and easily searched + manner. Additions and suggestions for improvement are welcome. + + + General issues + + New warnings + + Improvements to the GCC infrastructure allow improvements in + the ability of several existing warnings to spot problematic code. As + such, new warnings may exist for previously warning-free code that + uses + -Wmaybe-uninitialized. Note + that -Wall subsumes this warning flag. + + + Although these warnings will + not result in compilation failure, often -Wall is used in + conjunction with -Werror and as a result, new warnings + are turned into new errors. + + + As a workaround, remove -Werror until the new warnings + are fixed, or add -Wno-maybe-uninitialized. + + + More aggressive loop optimizations + + Improvements to the GCC infrastructure allow improvements in + the ability of the optimizers to transform loops. Some loops that previously + invoked undefined behavior may now be turned into endless loops. + + + For example, + + + unsigned int foo() + { + unsigned int data_data[128]; + + for (int fd = 0; fd < 128; ++fd) + data_data[fd] = fd * (0x0201); // error + + return data_data[0]; + } + + + + When fd is 64 or above, fd * 0x0201 overflows, which is invalid in C/C++ for signed ints. + + + + To fix, use the appropriate casts when converting between signed and + unsigned types to avoid overflows. Like so: + + + + data_data[fd] = (uint32_t) fd * (0x0201U); // ok + + + C language issues + + New warnings for pointer access + + + The behavior of -Wall has changed and now includes the + new warning flags -Wsizeof-pointer-memaccess. This may + result in new warnings in code that compiled cleanly with previous + versions of GCC. + + + For example, + + + #include+ + struct A { }; + + int main(void) + { + A obj; + A* p1 = &obj; + A p2[10]; + + memset(p1, 0, sizeof(p1)); // error, use memcopy + memset(p1, 0, sizeof(*p1)); // ok, dereferenced + memset(p2, 0, sizeof(p2)); // ok, array + + return 0; + } + + + Gives the following diagnostic: + + warning: argument to âsizeofâ in âvoid* memset(void*, int, size_t)â call is the same expression as the destination; did you mean to dereference it? [-Wsizeof-pointer-memaccess] + memset(p1, 0, sizeof(p1)); // error, use memcopy +^ + + + Although these warnings will not result in compilation failure, + often -Wall is used in conjunction with + -Werror and as a result, new warnings are turned into + new errors. + + To fix, either use memcopy or dereference the last argument in the + offending memset call. + + As a workaround, use + -Wno-sizeof-pointer-memaccess. + + Pre-processor pre-includes + + + The GCC pre-processor may now pre-includes a file that defines certain + macros for the entirety of the translation unit. This allows + fully conformant implementations of C99/C11 and other standards that + require compiler or compiler + runtime macros that describe + implementation availability. + + + + On linux, is pre-included. + + + + This subtle change means that some more creative uses of the + pre-processor may now fail, with the following diagnostic: + + + + /usr/include/stdc-predef.h:0: error: Syntax error near '3' + + + As a workaround, the stdc-predef.h preinclude can be disabled with + the use of -ffreestanding. For non C/C++ code, use the pre-processor flag -P. + + + C++ language issues + + New warn
Re: [wwwdocs] gcc-4.8/porting_to.html
Benjamin De Kosnik wrote: Hey! Here is the first pass at the 4.8 porting documentation. This seems to reflect the current trunk reality. I'm not quite sure to about the best way to talk about the more aggressive loop optimizations WRT undefined sematincs, but this seems reasonable. Of course, if anybody has better ideas, I'm all ears. Could you then add a link to the porting guide from changes.html, similar to last year's version? See http://gcc.gnu.org/gcc-4.7/changes.html and search for "porting guide". Tobias
[Patch, Fortran, 4.9] Minor FINAL preparation patch
Dear all, this small patch fixes some small issues with the current FINAL implementation, which is still disabled. Namely: (a) class.c: TRANSFER has an optional size= argument; if one doesn't has an actual-argument (which can be expr == NULL), it segfaults. (b) class.c: SIZE needs to return an index-size-kind integer not a default-kind integer (tree checking error, but potentially also wrong code) (c) trans.c: Scalar coarrays (with -fcoarray=lib) were mishandled - they also use an array descriptor Build and regtested on x86-64-gnu-linux. OK? (I target 4.9 with this patch; in principle, it could also be applied to 4.8: The code is not used, yet, and thus it shouldn't harm on 4.8 but there is also no benefit.) The full patch, which enables finalization and regtests is available at: https://userpage.physik.fu-berlin.de/~tburnus/final/ – The patch still requires some clean up. In addition, finalization (with a user FINAL subroutine) is mishandled for allocatable INTENT(OUT) as gfortran handles it (at least partially) in the caller (trans-expr.c's gfc_conv_procedure_call) and not in the callee (trans-decl.c). That will lead to not finalizing and segfaults at run time. There are more issues, but for an experimental implementation, fixing this issue should be enough. (Note: the .mod version should be bumped to force recompilation, which is required due to the ABI change of the vtable.) Tobias 2013-03-13 Tobias Burnus * class.c (finalization_scalarizer, finalizer_insert_packed_call, generate_finalization_wrapper): Avoid segfault with absent SIZE= argment to TRANSFER and use correct result kind for SIZE. * trans.c (gfc_build_final_call): Handle coarrays. diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c index d8e7b6d..db9a094 100644 --- a/gcc/fortran/class.c +++ b/gcc/fortran/class.c @@ -965,6 +965,7 @@ finalization_scalarizer (gfc_symbol *array, gfc_symbol *ptr, block->ext.actual->next = gfc_get_actual_arglist (); block->ext.actual->next->expr = gfc_get_int_expr (gfc_index_integer_kind, NULL, 0); + block->ext.actual->next->next = gfc_get_actual_arglist (); /* SIZE. */ /* The part: TRANSFER (C_LOC (array), c_intptr_t). */ @@ -987,9 +988,9 @@ finalization_scalarizer (gfc_symbol *array, gfc_symbol *ptr, /* TRANSFER. */ expr2 = gfc_build_intrinsic_call (sub_ns, GFC_ISYM_TRANSFER, "transfer", -gfc_current_locus, 2, expr, +gfc_current_locus, 3, expr, gfc_get_int_expr (gfc_index_integer_kind, - NULL, 0)); + NULL, 0), NULL); expr2->ts.type = BT_INTEGER; expr2->ts.kind = gfc_index_integer_kind; @@ -1315,7 +1316,7 @@ finalizer_insert_packed_call (gfc_code *block, gfc_finalizer *fini, gfc_expr *shape_expr; tmp_array->as->lower[i] = gfc_get_int_expr (gfc_default_integer_kind, NULL, 1); - /* SIZE (array, dim=i+1, kind=default_kind). */ + /* SIZE (array, dim=i+1, kind=gfc_index_integer_kind). */ shape_expr = gfc_build_intrinsic_call (sub_ns, GFC_ISYM_SIZE, "size", gfc_current_locus, 3, @@ -1323,7 +1324,9 @@ finalizer_insert_packed_call (gfc_code *block, gfc_finalizer *fini, gfc_get_int_expr (gfc_default_integer_kind, NULL, i+1), gfc_get_int_expr (gfc_default_integer_kind, - NULL, 0)); + NULL, + gfc_index_integer_kind)); + shape_expr->ts.kind = gfc_index_integer_kind; tmp_array->as->upper[i] = shape_expr; } gfc_set_sym_referenced (tmp_array); @@ -1799,7 +1802,9 @@ generate_finalization_wrapper (gfc_symbol *derived, gfc_namespace *ns, gfc_lval_expr_from_sym (array), gfc_lval_expr_from_sym (idx), gfc_get_int_expr (gfc_index_integer_kind, - NULL, 0)); + NULL, + gfc_index_integer_kind)); + block->expr2->value.op.op2->ts.kind = gfc_index_integer_kind; block->expr2->ts = idx->ts; /* if (strides(idx) /= sizes(idx-1)) is_contiguous = .false. */ diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index d7bdf26..4bccb32 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -1052,8 +1052,12 @@ gfc_build_final_call (gfc_typespec ts, gfc_expr *final_wrapper, gfc_expr *var, gfc_init_se (&se, NULL); se.want_pointer = 1; - if (var->rank || gfc_expr_attr (var).dimension) + if (var->rank || gfc_expr_attr (var).dimension + || (gfc_expr_attr (var).codimension + && gfc_option.coarray == GFC_FCOARRAY_LIB)) { + if (var->rank == 0) + se.want_coarray = 1; se.descriptor_only = 1; gfc_conv_expr_descriptor (&se, var); array = se.expr; @@ -1087,13 +1091,17 @@ gfc_build_final_call (gfc_typespec ts, gfc_expr *final_wrapper, gfc_expr *var, size = se.expr; array_expr = gfc_copy_expr (var); - gfc_add_data_component (array_expr); gfc_init_se (&se, NULL); se.want_pointer = 1; - if (array_expr->rank || gfc_expr_attr (array_expr).
Re: [wwwdocs] gcc-4.8/porting_to.html
Benjamin De Kosnik writes: > > Hey! Here is the first pass at the 4.8 porting documentation. .. > + memset(p1, 0, sizeof(p1)); // error, use memcopy s/memcopy/memcpy/ > + memset(p1, 0, sizeof(p1)); // error, use memcopy likewise > + To fix, either use memcopy or dereference the last argument in the likewise /Mikael
Re: [wwwdocs] gcc-4.8/porting_to.html
On Wed, 13 Mar 2013, Mikael Pettersson wrote: > Benjamin De Kosnik writes: > > > > Hey! Here is the first pass at the 4.8 porting documentation. > .. > > + memset(p1, 0, sizeof(p1)); // error, use memcopy > > s/memcopy/memcpy/ It doesn't make sense. memcpy from NULL src pointer? Alexander
Re: [wwwdocs] gcc-4.8/porting_to.html
Alexander Monakov writes: > > > On Wed, 13 Mar 2013, Mikael Pettersson wrote: > > > Benjamin De Kosnik writes: > > > > > > Hey! Here is the first pass at the 4.8 porting documentation. > > .. > > > + memset(p1, 0, sizeof(p1)); // error, use memcopy > > > > s/memcopy/memcpy/ > > It doesn't make sense. memcpy from NULL src pointer? I was only referring to the spelling of memcpy(), whether the examples make sense or not is another issue (I didn't read the text very carefully). /Mikael
[PATCH] Fix PR56608
Basic-block vectorization "removes" scalar stmt calls (well, replaces them with assignment from zero) even if the scalar result is used from non-vectorized code (yes, that's a cost issue as well, I filed PR56612 for this). The following is an easy workaround - while DCE is not run for quite a while after SLP it should be able to figure out if the scalar calls are dead or not. Bootstrap and regtest running on x86_64-unknown-linux-gnu. A more elaborate fix has to wait for 4.9 and my SLP re-org patches. Richard. 2013-03-13 Richard Biener PR tree-optimization/56608 * tree-vect-slp.c (vect_schedule_slp): Do not remove scalar calls when vectorizing basic-blocks. * gcc.dg/vect/fast-math-bb-slp-call-3.c: New testcase. Index: gcc/tree-vect-slp.c === *** gcc/tree-vect-slp.c (revision 196629) --- gcc/tree-vect-slp.c (working copy) *** vect_schedule_slp (loop_vec_info loop_vi *** 3181,3187 unsigned int j; gimple_stmt_iterator gsi; ! vect_remove_slp_scalar_calls (root); for (j = 0; SLP_TREE_SCALAR_STMTS (root).iterate (j, &store) && j < SLP_INSTANCE_GROUP_SIZE (instance); j++) --- 3191,3205 unsigned int j; gimple_stmt_iterator gsi; ! /* Remove scalar call stmts. Do not do this for basic-block !vectorization as not all uses may be vectorized. !??? Why should this be necessary? DCE should be able to !remove the stmts itself. !??? For BB vectorization we can as well remove scalar !stmts starting from the SLP tree root if they have no !uses. */ ! if (loop_vinfo) ! vect_remove_slp_scalar_calls (root); for (j = 0; SLP_TREE_SCALAR_STMTS (root).iterate (j, &store) && j < SLP_INSTANCE_GROUP_SIZE (instance); j++) Index: gcc/testsuite/gcc.dg/vect/fast-math-bb-slp-call-3.c === *** gcc/testsuite/gcc.dg/vect/fast-math-bb-slp-call-3.c (revision 0) --- gcc/testsuite/gcc.dg/vect/fast-math-bb-slp-call-3.c (working copy) *** *** 0 --- 1,68 + #include + #include + + #define MIN(a, b) (((a) < (b)) ? (a) : (b)) + #define MAX(a, b) (((a) > (b)) ? (a) : (b)) + + typedef struct { + int initialHeight, initialWidth; + int rotatedHeight, rotatedWidth; + int autoCropHeight, autoCropWidth; + } ufraw_data; + + void __attribute__((noinline,noclone)) + ufraw_test(ufraw_data *uf) + { + int iWidth = uf->initialWidth; + int iHeight = uf->initialHeight; + double aspectRatio = ((double)iWidth) / iHeight; + double midX = iWidth / 2.0 - 0.5; + double midY = iHeight / 2.0 - 0.5; + double maxX = 0, maxY = 0; + double minX = 99, minY = 99; + double lastX = 0, lastY = 0, area = 0; + double scale; + int i; + for (i = 0; i < iWidth + iHeight - 1; i++) + { + int x, y; + if (i < iWidth) { // Trace the left border of the image + x = i; + y = 0; + } else { // Trace the bottom border of the image + x = iWidth - 1; + y = i - iWidth + 1; + } + double srcX = x - midX; + double srcY = y - midY; + // A digital planimeter: + area += srcY * lastX - srcX * lastY; + lastX = srcX; + lastY = srcY; + maxX = MAX(maxX, fabs(srcX)); + maxY = MAX(maxY, fabs(srcY)); + if (fabs(srcX / srcY) > aspectRatio) + minX = MIN(minX, fabs(srcX)); + else + minY = MIN(minY, fabs(srcY)); + } + scale = sqrt((iWidth - 1) * (iHeight - 1) / area); + uf->rotatedWidth = MIN(ceil(2 * maxX + 1.0) * scale, 2 * iWidth); + uf->rotatedHeight = MIN(ceil(2 * maxY + 1.0) * scale, 2 * iHeight); + uf->autoCropWidth = MIN(floor(2 * minX) * scale, 2 * iWidth); + uf->autoCropHeight = MIN(floor(2 * minY) * scale, 2 * iHeight); + if (uf->autoCropWidth != 3) + abort (); + } + + int main() + { + ufraw_data uf_data; + ufraw_data *uf = &uf_data; + uf->initialWidth = 4; + uf->initialHeight = 5; + ufraw_test(uf); + return 0; + } + + /* { dg-final { cleanup-tree-dump "slp" } } */
[v3] libstdc++/56609
Hi, a very simple issue, tested x86_64-linux and committed. Thanks, Paolo. // 2013-03-13 Paolo Carlini PR libstdc++/56609 * include/std/type_traits (is_fundamental): Add std::nullptr_t. * testsuite/20_util/is_fundamental/value.cc: Extend. * testsuite/20_util/is_compound/value.cc: Likewise. Index: include/std/type_traits === --- include/std/type_traits (revision 196609) +++ include/std/type_traits (working copy) @@ -444,7 +444,7 @@ /// is_fundamental template struct is_fundamental -: public __or_, is_void<_Tp>>::type +: public __or_, is_void<_Tp>, __is_nullptr_t<_Tp>>::type { }; /// is_object Index: testsuite/20_util/is_compound/value.cc === --- testsuite/20_util/is_compound/value.cc (revision 196609) +++ testsuite/20_util/is_compound/value.cc (working copy) @@ -46,6 +46,9 @@ VERIFY( (test_category(false)) ); VERIFY( (test_category(false)) ); + // libstdc++/56609 + VERIFY( (test_category(false)) ); + // Sanity check. VERIFY( (test_category(true)) ); } Index: testsuite/20_util/is_fundamental/value.cc === --- testsuite/20_util/is_fundamental/value.cc (revision 196609) +++ testsuite/20_util/is_fundamental/value.cc (working copy) @@ -46,6 +46,9 @@ VERIFY( (test_category(true)) ); VERIFY( (test_category(true)) ); + // libstdc++/56609 + VERIFY( (test_category(true)) ); + // Sanity check. VERIFY( (test_category(false)) ); }
[C++ testcase, committed] PR 56611
Hi, I'm committing the testcase and closing the issue as already fixed in mainline. Thanks, Paolo. 2013-03-13 Paolo Carlini PR c++/56611 * g++.dg/cpp0x/alias-decl-32.C: New. Index: g++.dg/cpp0x/alias-decl-32.C === --- g++.dg/cpp0x/alias-decl-32.C(revision 0) +++ g++.dg/cpp0x/alias-decl-32.C(working copy) @@ -0,0 +1,25 @@ +// PR c++/56611 +// { dg-do compile { target c++11 } } + +template struct remove_reference { typedef T type; }; +template struct remove_reference { typedef T type; }; +template T declval() { return T(); } + +int f(int, int){return 0;} +struct Func{}; + +template struct result1 +{ + typedef decltype(f(declval::type>()...)) type; +}; + +template using result2 += decltype(f(declval::type>()...)); + +template struct R; +template struct R< This(Args...) > +{ + typedef result2 type; +}; + +typedef R< Func(int, int) >::type R_type;
Re: [PATCH][5/n] tree LIM TLC
On Tue, 12 Mar 2013, Steven Bosscher wrote: > On Tue, Mar 12, 2013 at 4:16 PM, Richard Biener wrote: > > --- 127,145 > > /* The locations of the accesses. Vector > >indexed by the loop number. */ > > > > ! /* The following sets are computed on demand. We use two bits per > > ! information to represent the not-computed state. */ > > ! > > ! /* The set of loops in that the memory reference is independent > > ! (2 * loop->num) or dependent (2 * loop->num + 1) in. > > ! If it is stored in the loop, this store is independent on all other > > ! loads and stores. > > ! If it is only loaded, then it is independent on all stores in the > > loop. */ > > ! bitmap loop_dependence; > > ! > > ! /* The set of memory references on that this reference is independent > > ! (2 * mem->id) or dependent (2 * mem->id + 1). */ > > ! bitmap ref_dependence; > > } *mem_ref_p; > > Perhaps add simple inline functions to test those bits, to avoid: > > > --- 2174,2182 > > ref2 = tem; > > } > > > > ! if (bitmap_bit_p (ref1->ref_dependence, 2 * ref2->id)) > > return true; > > ! if (bitmap_bit_p (ref1->ref_dependence, 2 * ref2->id + 1)) > > return false; > > > > if (dump_file && (dump_flags & TDF_DETAILS)) > > ? > > That kind of explicit 2*x+[01] is bound to go wrong at some point. Yeah, like with the following - also replaced bitmap by bitmap_head as you suggested in the other mail (others to follow in a separate patch). Bootstrap / test scheduled before the commit for 4.9. Thanks, Richard. 2013-03-13 Richard Biener * tree-ssa-loop-im.c (struct mem_ref): Merge indep_loop and dep_loop into loop_dependence, merge indep_ref and dep_ref into ref_dependence. Use a bitmap_head for those. (DEP_BIT, INDEP_BIT): New macros to compute the bit used for dependence and independence information. (mem_ref_alloc): Adjust. (refs_independent_p): Likewise. (record_indep_loop): Likewise. (ref_indep_loop_p): Likewise. Index: trunk/gcc/tree-ssa-loop-im.c === *** trunk.orig/gcc/tree-ssa-loop-im.c 2013-03-13 12:47:04.0 +0100 --- trunk/gcc/tree-ssa-loop-im.c2013-03-13 12:53:47.884467097 +0100 *** typedef struct mem_ref *** 127,149 /* The locations of the accesses. Vector indexed by the loop number. */ ! /* The following sets are computed on demand. We keep both set and ! its complement, so that we know whether the information was ! already computed or not. */ ! bitmap indep_loop; /* The set of loops in that the memory ! reference is independent, meaning: ! If it is stored in the loop, this store !is independent on all other loads and !stores. ! If it is only loaded, then it is independent !on all stores in the loop. */ ! bitmap dep_loop;/* The complement of INDEP_LOOP. */ ! ! bitmap indep_ref; /* The set of memory references on that ! this reference is independent. */ ! bitmap dep_ref; /* The complement of INDEP_REF. */ } *mem_ref_p; --- 127,149 /* The locations of the accesses. Vector indexed by the loop number. */ ! /* The following sets are computed on demand. We use two bits per ! information to represent the not-computed state. */ ! ! /* The set of loops in that the memory reference is independent ! (2 * loop->num) or dependent (2 * loop->num + 1) in. ! If it is stored in the loop, this store is independent on all other ! loads and stores. ! If it is only loaded, then it is independent on all stores in the loop. */ ! bitmap_head loop_dependence; ! ! /* The set of memory references on that this reference is independent ! (2 * mem->id) or dependent (2 * mem->id + 1). */ ! bitmap_head ref_dependence; } *mem_ref_p; + #define INDEP_BIT(n) ((n) * 2) + #define DEP_BIT(n) ((n) * 2 + 1) *** mem_ref_alloc (tree mem, unsigned hash, *** 1481,1490 ref->id = id; ref->hash = hash; ref->stored = BITMAP_ALLOC (&lim_bitmap_obstack); ! ref->indep_loop = BITMAP_ALLOC (&lim_bitmap_obstack); ! ref->dep_loop = BITMAP_ALLOC (&lim_bitmap_obstack); ! ref->indep_ref = BITMAP_ALLOC (&lim_bitmap_obstack); ! ref->dep_ref = BITMAP_ALLOC (&lim_bitmap_obstack); ref->accesses_in_loop.create (0); return ref; --- 1481,1488 ref->id = id; ref->hash = hash; ref->stored
Re: [PATCH] Fix PR56344
Ping. On Tue, Mar 05, 2013 at 05:06:21PM +0100, Marek Polacek wrote: > On Fri, Mar 01, 2013 at 09:41:27AM +0100, Richard Biener wrote: > > On Wed, Feb 27, 2013 at 6:38 PM, Joseph S. Myers > > wrote: > > > On Wed, 27 Feb 2013, Richard Biener wrote: > > > > > >> Wouldn't it be better to simply pass this using the variable size > > >> handling > > >> code? Thus, initialize args_size.var for too large constant size > > >> instead? > > > > > > Would that be compatible with the ABI definition of how a large (constant > > > size) argument should be passed? > > > > I'm not sure. Another alternative is to expand to __builtin_trap (), but > > that's > > probably not easy at this very point. > > > > Or simply fix the size calculation to not overflow (either don't count bits > > or use a double-int). > > I don't think double_int will help us here. We won't detect overflow, > because we overflowed here (when lower_bound is an int): > lower_bound = INTVAL (XEXP (XEXP (arg->stack_slot, 0), 1)); > The value from INTVAL () fits when lower_bound is a double_int, but > then: > i = lower_bound; > ... > stack_usage_map[i] > the size of stack_usage_map is stored in highest_outgoing_arg_in_use, > which is an int, so we're limited by an int size here. > Changing the type of highest_outgoing_arg_in_use from an int to a > double_int isn't worth the trouble, IMHO. > > Maybe the original approach, only with sorry () instead of error () > and e.g. HOST_BITS_PER_INT - 1 instead of 30 would be appropriate > after all. Dunno. > > Marek
[PATCH][7/n] tree LIM TLC
This uses bitmap_heads for more bitmaps (one indirection less and slightly smaller memory footprint) and it avoids the extra indirection to avoid having a vec of a vec which is now possible. Bootstrap and regtest running on x86_64-unknown-linux-gnu. Richard. 2013-03-13 Richard Biener * tree-ssa-loop-im.c (struct mem_ref_locs): Remove. (struct mem_ref): Make accesses_in_loop a vec of a vec of pointers to aggregate mem_ref_loc. Use a bitmap_head for the vector of loops the ref is stored in. (memory_accesses): Use vectors of bitmap_heads instead of vectors of bitmaps (outermost_indep_loop): Adjust. (free_mem_ref_locs): Inline into ... (memref_free): ... this and adjust. (mem_ref_alloc): Adjust. (mem_ref_locs_alloc): Remove. (record_mem_ref_loc): Adjust. Inline ref bitmap manipulation into its caller. (gather_mem_refs_stmt): Use a shared mem_ref for unanalyzable mems and do not record locations for it. (analyze_memory_references): Adjust. (get_all_locs_in_loop): Likewise. (ref_indep_loop_p_1): Likewise. (find_refs_for_sm): Likewise. (tree_ssa_lim_initialize): Likewise. Index: trunk/gcc/tree-ssa-loop-im.c === *** trunk.orig/gcc/tree-ssa-loop-im.c 2013-03-13 12:53:47.0 +0100 --- trunk/gcc/tree-ssa-loop-im.c2013-03-13 13:40:17.437154471 +0100 *** typedef struct mem_ref_loc *** 105,118 } *mem_ref_loc_p; - /* The list of memory reference locations in a loop. */ - - typedef struct mem_ref_locs - { - vec locs; - } *mem_ref_locs_p; - - /* Description of a memory reference. */ typedef struct mem_ref --- 105,110 *** typedef struct mem_ref *** 121,129 unsigned id;/* ID assigned to the memory reference (its index in memory_accesses.refs_list) */ hashval_t hash; /* Its hash value. */ ! bitmap stored; /* The set of loops in that this memory location is stored to. */ ! vec accesses_in_loop; /* The locations of the accesses. Vector indexed by the loop number. */ --- 113,121 unsigned id;/* ID assigned to the memory reference (its index in memory_accesses.refs_list) */ hashval_t hash; /* Its hash value. */ ! bitmap_head stored; /* The set of loops in that this memory location is stored to. */ ! vec > accesses_in_loop; /* The locations of the accesses. Vector indexed by the loop number. */ *** static struct *** 158,172 vec refs_list; /* The set of memory references accessed in each loop. */ ! vec refs_in_loop; /* The set of memory references accessed in each loop, including subloops. */ ! vec all_refs_in_loop; /* The set of memory references stored in each loop, including subloops. */ ! vec all_refs_stored_in_loop; /* Cache for expanding memory addresses. */ struct pointer_map_t *ttae_cache; --- 150,164 vec refs_list; /* The set of memory references accessed in each loop. */ ! vec refs_in_loop; /* The set of memory references accessed in each loop, including subloops. */ ! vec all_refs_in_loop; /* The set of memory references stored in each loop, including subloops. */ ! vec all_refs_stored_in_loop; /* Cache for expanding memory addresses. */ struct pointer_map_t *ttae_cache; *** outermost_indep_loop (struct loop *outer *** 605,617 { struct loop *aloop; ! if (bitmap_bit_p (ref->stored, loop->num)) return NULL; for (aloop = outer; aloop != loop; aloop = superloop_at_depth (loop, loop_depth (aloop) + 1)) ! if (!bitmap_bit_p (ref->stored, aloop->num) && ref_indep_loop_p (aloop, ref)) return aloop; --- 597,609 { struct loop *aloop; ! if (bitmap_bit_p (&ref->stored, loop->num)) return NULL; for (aloop = outer; aloop != loop; aloop = superloop_at_depth (loop, loop_depth (aloop) + 1)) ! if (!bitmap_bit_p (&ref->stored, aloop->num) && ref_indep_loop_p (aloop, ref)) return aloop; *** memref_eq (const void *obj1, const void *** 1438,1470 return operand_equal_p (mem1->mem, (const_tree) obj2, 0); } - /* Releases list of memory reference locations ACCS. */ - - static void - free_mem_ref_locs (mem_ref_locs_p accs) - { - unsigned i; - mem_ref_loc_p loc; - - if (!accs) - return; - - FOR_EACH_VEC_ELT (ac
[PATCH][8/n] tree LIM TLC
This changes the vector of locations we track for each memory reference from storing a pointer to a location aggregate to storing the aggregate directly, avoiding an indirection and tons of small memory allocations. This also touches the way we iterate over locations of refs - instead of building up a vector of all refs and then iterating over it and then freeing it the following implements a proper iterator using a functor template (and allows an early exit from ref_always_accessed_p). Bootstrap and regtest pending on x86_64-unknown-linux-gnu. Richard. 2013-03-13 Richard Biener * tree-ssa-loop-im.c (struct mem_ref): Make accesses_in_loop a vec of a vec of the aggregate mem_ref_loc. (memref_free): Adjust. (record_mem_ref_loc): Likewise. (get_all_locs_in_loop): Rewrite into ... (for_all_locs_in_loop): ... this iterator. (rewrite_mem_ref_loc): New functor. (rewrite_mem_refs): Use for_all_locs_in_loop. (sm_set_flag_if_changed): New functor. (execute_sm_if_changed_flag_set): Use for_all_locs_in_loop. (ref_always_accessed): New functor. (ref_always_accessed_p): Use for_all_locs_in_loop. Index: trunk/gcc/tree-ssa-loop-im.c === *** trunk.orig/gcc/tree-ssa-loop-im.c 2013-03-13 14:15:32.0 +0100 --- trunk/gcc/tree-ssa-loop-im.c2013-03-13 14:19:17.016903594 +0100 *** typedef struct mem_ref *** 115,121 hashval_t hash; /* Its hash value. */ bitmap_head stored; /* The set of loops in that this memory location is stored to. */ ! vec > accesses_in_loop; /* The locations of the accesses. Vector indexed by the loop number. */ --- 115,121 hashval_t hash; /* Its hash value. */ bitmap_head stored; /* The set of loops in that this memory location is stored to. */ ! vec > accesses_in_loop; /* The locations of the accesses. Vector indexed by the loop number. */ *** memref_eq (const void *obj1, const void *** 1435,1450 static void memref_free (struct mem_ref *mem) { ! unsigned i, j; ! vec *accs; ! mem_ref_loc_p loc; FOR_EACH_VEC_ELT (mem->accesses_in_loop, i, accs) ! { ! FOR_EACH_VEC_ELT (*accs, j, loc) ! free (loc); ! accs->release (); ! } mem->accesses_in_loop.release (); free (mem); --- 1435,1445 static void memref_free (struct mem_ref *mem) { ! unsigned i; ! vec *accs; FOR_EACH_VEC_ELT (mem->accesses_in_loop, i, accs) ! accs->release (); mem->accesses_in_loop.release (); free (mem); *** mem_ref_alloc (tree mem, unsigned hash, *** 1474,1487 static void record_mem_ref_loc (mem_ref_p ref, struct loop *loop, gimple stmt, tree *loc) { ! mem_ref_loc_p aref = XNEW (struct mem_ref_loc); if (ref->accesses_in_loop.length () <= (unsigned) loop->num) ref->accesses_in_loop.safe_grow_cleared (loop->num + 1); ! aref->stmt = stmt; ! aref->ref = loc; ref->accesses_in_loop[loop->num].safe_push (aref); } --- 1469,1482 static void record_mem_ref_loc (mem_ref_p ref, struct loop *loop, gimple stmt, tree *loc) { ! mem_ref_loc aref; if (ref->accesses_in_loop.length () <= (unsigned) loop->num) ref->accesses_in_loop.safe_grow_cleared (loop->num + 1); ! aref.stmt = stmt; ! aref.ref = loc; ref->accesses_in_loop[loop->num].safe_push (aref); } *** mem_refs_may_alias_p (tree mem1, tree me *** 1628,1647 return true; } ! /* Rewrites location LOC by TMP_VAR. */ ! ! static void ! rewrite_mem_ref_loc (mem_ref_loc_p loc, tree tmp_var) ! { ! *loc->ref = tmp_var; ! update_stmt (loc->stmt); ! } ! ! /* Adds all locations of REF in LOOP and its subloops to LOCS. */ ! static void ! get_all_locs_in_loop (struct loop *loop, mem_ref_p ref, ! vec *locs) { unsigned i; mem_ref_loc_p loc; --- 1623,1636 return true; } ! /* Iterates over all locations of REF in LOOP and its subloops calling !fn.operator() with the location as argument. When that operator !returns true the iteration is stopped and true is returned. !Otherwise false is returned. */ ! template ! static bool ! for_all_locs_in_loop (struct loop *loop, mem_ref_p ref, FN fn) { unsigned i; mem_ref_loc_p loc; *** get_all_locs_in_loop (struct loop *loop, *** 1649,1665 struct loop *subloop; if (!bitmap_bit_p (refs, ref->id)) ! return; ! if (ref->accesses_in_loop.length () ! > (unsigned) loop->num) ! { ! FOR_EACH_VEC_ELT (ref->accesses_in_loop[loop->num], i, loc) !
[PATCH][9/n] tree LIM TLC
This makes the linked list of dependent stmts a vector instead. Saves separate allocation / free of list entries and overall some memory (overhead for vecs is less than 50%). Bootstrap and regtest on x86_64-unknown-linux-gnu running. Richard. 2013-03-13 Richard Biener * tree-ssa-loop-im.c (struct depend): Remove. (struct lim_aux_data): Make depends a vec of gimples. (free_lim_aux_data): Adjust. (add_dependency): Likewise. (set_level): Likewise. Index: trunk/gcc/tree-ssa-loop-im.c === *** trunk.orig/gcc/tree-ssa-loop-im.c 2013-03-13 14:19:17.0 +0100 --- trunk/gcc/tree-ssa-loop-im.c2013-03-13 15:38:55.835709837 +0100 *** along with GCC; see the file COPYING3. *** 58,72 something; } */ - /* A type for the list of statements that have to be moved in order to be able -to hoist an invariant computation. */ - - struct depend - { - gimple stmt; - struct depend *next; - }; - /* The auxiliary data kept for each statement. */ struct lim_aux_data --- 58,63 *** struct lim_aux_data *** 85,95 unsigned cost; /* Cost of the computation performed by the statement. */ ! struct depend *depends; /* List of statements that must be also hoisted ! out of the loop when this statement is ! hoisted; i.e. those that define the operands ! of the statement and are inside of the ! MAX_LOOP loop. */ }; /* Maps statements to their lim_aux_data. */ --- 76,86 unsigned cost; /* Cost of the computation performed by the statement. */ ! vec depends;/* Vector of statements that must be also ! hoisted out of the loop when this statement ! is hoisted; i.e. those that define the ! operands of the statement and are inside of ! the MAX_LOOP loop. */ }; /* Maps statements to their lim_aux_data. */ *** get_lim_data (gimple stmt) *** 204,216 static void free_lim_aux_data (struct lim_aux_data *data) { ! struct depend *dep, *next; ! ! for (dep = data->depends; dep; dep = next) ! { ! next = dep->next; ! free (dep); ! } free (data); } --- 195,201 static void free_lim_aux_data (struct lim_aux_data *data) { ! data->depends.release(); free (data); } *** add_dependency (tree def, struct lim_aux *** 475,481 gimple def_stmt = SSA_NAME_DEF_STMT (def); basic_block def_bb = gimple_bb (def_stmt); struct loop *max_loop; - struct depend *dep; struct lim_aux_data *def_data; if (!def_bb) --- 460,465 *** add_dependency (tree def, struct lim_aux *** 500,509 && def_bb->loop_father == loop) data->cost += def_data->cost; ! dep = XNEW (struct depend); ! dep->stmt = def_stmt; ! dep->next = data->depends; ! data->depends = dep; return true; } --- 484,490 && def_bb->loop_father == loop) data->cost += def_data->cost; ! data->depends.safe_push (def_stmt); return true; } *** static void *** 866,873 set_level (gimple stmt, struct loop *orig_loop, struct loop *level) { struct loop *stmt_loop = gimple_bb (stmt)->loop_father; - struct depend *dep; struct lim_aux_data *lim_data; stmt_loop = find_common_loop (orig_loop, stmt_loop); lim_data = get_lim_data (stmt); --- 847,855 set_level (gimple stmt, struct loop *orig_loop, struct loop *level) { struct loop *stmt_loop = gimple_bb (stmt)->loop_father; struct lim_aux_data *lim_data; + gimple dep_stmt; + unsigned i; stmt_loop = find_common_loop (orig_loop, stmt_loop); lim_data = get_lim_data (stmt); *** set_level (gimple stmt, struct loop *ori *** 881,888 || flow_loop_nested_p (lim_data->max_loop, level)); lim_data->tgt_loop = level; ! for (dep = lim_data->depends; dep; dep = dep->next) ! set_level (dep->stmt, orig_loop, level); } /* Determines an outermost loop from that we want to hoist the statement STMT. --- 863,870 || flow_loop_nested_p (lim_data->max_loop, level)); lim_data->tgt_loop = level; ! FOR_EACH_VEC_ELT (lim_data->depends, i, dep_stmt) ! set_level (dep_stmt, orig_loop, level); } /* Determines an outermost loop from that we want to hoist the statement STMT.
Re: [C++ Patch] PR 56582
OK for 4.8.1. Jason
Re: [PATCH][4.8][4.7][4.6] Make -shared-libgcc the default on Cygwin.
On 12/03/2013 08:59, Richard Biener wrote: > On Tue, Mar 12, 2013 at 2:44 AM, Dave Korn wrote: >> Hello list, >> >> The attached patch makes -shared-libgcc the default for Cygwin. This is >> something that I should have done some time ago, as shared libgcc on Cygwin >> is >> more than mature. What's more, it is vital for reliable compilation of >> applications that throw exceptions or share TLS variables from DLLs into the >> main executable; at present these compile incorrectly without an explicit >> -shared-libgcc. For instance, the just-released MPFR-3.1.2 doesn't work >> without it. >> >> Given that it's a very simple tweak to the compiler specs on a single >> platform only, I would like to use my target maintainer's discretion to apply >> it even at this late stage, but I figure it's so close to RC1 that I should >> ask the RM's permission anyway. >> >> I'd also like to backport it to all the currently-open branches. >> >> gcc/ChangeLog >> >> 2013-03-12 Dave Korn >> >> * config/i386/cygwin.h (SHARED_LIBGCC_SPEC): Make shared libgcc the >> default setting. >> >> Is this OK by everyone? > > Ok for trunk (4.8). Please add a documentation entry to gcc-4.8/changes.html. Committed revision 196634, with the attached documentation update and cvs log entry: * htdocs/gcc-4.8/changes.html: Add OS-specific section and entry for Windows (Cygwin). > I'm not sure whether this kind of stuff should change on a release branch, > I'll defer to others for this. Still, if you backport it, add a > gcc-4.x/changes.html item to the sub-release sections. Would still like to do this, as it's important for correctness in anything that links against shared libraries, and it'll only have to be maintained as a local patch to any Cygwin distro version of GCC if we don't. cheers, DaveK Index: htdocs/gcc-4.8/changes.html === RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.8/changes.html,v retrieving revision 1.105 diff -p -u -r1.105 changes.html --- htdocs/gcc-4.8/changes.html 27 Feb 2013 19:24:43 - 1.105 +++ htdocs/gcc-4.8/changes.html 13 Mar 2013 15:19:44 - @@ -805,6 +805,20 @@ B b(42); // OK command-line option. +Operating Systems + +Windows (Cygwin) + +Executables are now linked against shared libgcc by default. +The previous default was to link statically, which can still be +done by explicitly specifying -static or -static-libgcc on the +command line. However it is strongly advised against, as it +will cause problems for any application that makes use of DLLs +compiled by GCC. It should be alright for a monolithic stand-alone +application that only links against the Windows OS DLLs, but +offers little or no benefit. + +
Re: [Patch, microblaze]: Add support for TLS in MicroBlaze
On 03/12/2013 01:47 PM, David Holsgrove wrote: Add support for thread local storage (general dynamic and local dynamic models) in MicroBlaze. gcc/Changelog 2013-03-13 Edgar E. Iglesias David Holsgrove * config/microblaze/microblaze-protos.h: (microblaze_cannot_force_const_mem, microblaze_tls_referenced_p, symbol_mentioned_p, label_mentioned_p): Add prototypes. * config/microblaze/microblaze.c (microblaze_address_type): Add ADDRESS_TLS and tls_reloc address types. (microblaze_address_info): Add tls_reloc. (TARGET_HAVE_TLS): Define. (get_tls_get_addr, microblaze_tls_symbol_p, microblaze_tls_operand_p_1, microblaze_tls_referenced_p, microblaze_cannot_force_const_mem, symbol_mentioned_p, label_mentioned_p, tls_mentioned_p, load_tls_operand, microblaze_call_tls_get_addr, microblaze_legitimize_tls_address): New functions. (microblaze_classify_unspec): Handle UNSPEC_TLS. (get_base_reg): Use microblaze_tls_symbol_p. (microblaze_classify_address): Handle TLS. (microblaze_legitimate_pic_operand): Use symbol_mentioned_p, label_mentioned_p and microblaze_tls_referenced_p. (microblaze_legitimize_address): Handle TLS. (microblaze_address_insns): Handle ADDRESS_TLS. (pic_address_needs_scratch): Handle TLS. (print_operand_address): Handle TLS. (microblaze_expand_prologue): Check TLS_NEEDS_GOT. (microblaze_expand_move): Handle TLS. (microblaze_legitimate_constant_p): Check microblaze_cannot_force_const_mem and microblaze_tls_symbol_p. (TARGET_CANNOT_FORCE_CONST_MEM): Define. * config/microblaze/microblaze.h (TLS_NEEDS_GOT): Define (PIC_OFFSET_TABLE_REGNUM): Set. * config/microblaze/linux.h (TLS_NEEDS_GOT): Define. * config/microblaze/microblaze.md (UNSPEC_TLS): Define. (addsi3, movsi_internal2, movdf_internal): Update constraints * config/microblaze/predicates.md (arith_plus_operand): Define (move_operand): Redefine as move_src_operand, check microblaze_tls_referenced_p. Signed-off-by: Edgar E. Iglesias Signed-off-by: David Holsgrove Hi David -- The patch is OK except for a number of minor formatting problems to meet GNU standards. - Comments are supposed to end with ". */". - Extra spacing around parens or between "!" and "TARGET...". - && or || at start of line continuing a condition rather that at end of previous line - Some places where the indenting is incorrect Should this patch be combined with the other patch adding TLS checking to configure? -- Michael Eagerea...@eagercon.com 1960 Park Blvd., Palo Alto, CA 94306 650-325-8077
Re: [PATCH] Fix -print-multi-os-directory for aarch64
On Thu, Mar 7, 2013 at 8:45 AM, 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. My objection to moving to /lib64 was more to have both binutils and glibc fixed. I am happy now they are getting fixed. Thanks, Andrew
[PATCH] Fix PR56605
This patch (suggested by Steven B) removes some redundant loop assertions that are currently being missed, resulting in redundant branches appearing prior to many loops on powerpc64. Bootstrapped and tested with no new regressions on powerpc64-unknown-linux-gnu. Ok for trunk? Thanks, Bill gcc: 2013-03-13 Bill Schmidt Steven Bosscher PR rtl-optimization/56605 * loop-iv.c (implies_p): Handle equal RTXs and subregs. gcc/testsuite: 2013-03-13 Bill Schmidt wschm...@linux.vnet.ibm.com> PR rtl-optimization/56605 * gcc.target/powerpc/pr56605.c: New. Index: gcc/testsuite/gcc.target/powerpc/pr56605.c === --- gcc/testsuite/gcc.target/powerpc/pr56605.c (revision 0) +++ gcc/testsuite/gcc.target/powerpc/pr56605.c (revision 0) @@ -0,0 +1,13 @@ +/* PR rtl-optimization/56605 */ +/* { dg-do compile { target { powerpc64-*-* && lp64 } } } */ +/* { dg-options "-O3 -mvsx -mcpu=power7 -fno-unroll-loops -fdump-rtl-loop2_doloop" } */ + +void foo (short* __restrict sb, int* __restrict ia) +{ + int i; + for (i = 0; i < 4000; i++) +ia[i] = (int) sb[i]; +} + +/* { dg-final { scan-rtl-dump-times "\\\(compare:CC \\\(subreg:SI \\\(reg:DI" 1 "loop2_doloop" } } */ +/* { dg-final { cleanup-rtl-dump "loop2_doloop" } } */ Index: gcc/loop-iv.c === --- gcc/loop-iv.c (revision 196633) +++ gcc/loop-iv.c (working copy) @@ -1496,19 +1496,26 @@ implies_p (rtx a, rtx b) rtx op0, op1, opb0, opb1, r; enum machine_mode mode; + if (rtx_equal_p (a, b)) +return true; + if (GET_CODE (a) == EQ) { op0 = XEXP (a, 0); op1 = XEXP (a, 1); - if (REG_P (op0)) + if (REG_P (op0) + || (GET_CODE (op0) == SUBREG + && REG_P (SUBREG_REG (op0 { r = simplify_replace_rtx (b, op0, op1); if (r == const_true_rtx) return true; } - if (REG_P (op1)) + if (REG_P (op1) + || (GET_CODE (op1) == SUBREG + && REG_P (SUBREG_REG (op1 { r = simplify_replace_rtx (b, op1, op0); if (r == const_true_rtx)
Re: [PATCH, updated] Vtable pointer verification, main gcc changes (patch 2 of 3)
On 2013-02-25 14:27 , Caroline Tice wrote: Index: libgcc/Makefile.in === --- libgcc/Makefile.in(revision 196266) +++ libgcc/Makefile.in(working copy) @@ -22,6 +22,7 @@ libgcc_topdir = @libgcc_topdir@ host_subdir = @host_subdir@ +gcc_srcdir = $(libgcc_topdir)/gcc gcc_objdir = $(MULTIBUILDTOP)../../$(host_subdir)/gcc srcdir = @srcdir@ @@ -969,6 +970,16 @@ crtendS$(objext): $(srcdir)/crtstuff.c # This is a version of crtbegin for -static links. crtbeginT$(objext): $(srcdir)/crtstuff.c $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_BEGIN -DCRTSTUFFT_O + +# These are used in vtable verification; see comments in source files for +# more details. +vtv_start$(objext): $(gcc_srcdir)/vtv_start.c +$(crt_compile) $(CRTSTUFF_T_CFLAGS_S) \ + -c $(gcc_srcdir)/vtv_start.c + +vtv_end$(objext): $(gcc_srcdir)/vtv_end.c +$(crt_compile) $(CRTSTUFF_T_CFLAGS_S) \ + -c $(gcc_srcdir)/vtv_end.c endif Why not have these two files in libgcc? I don't think we want to depend on source files in gcc/ from libgcc/ /* IPA Passes */ extern struct simple_ipa_opt_pass pass_ipa_lower_emutls; Index: gcc/tree-vtable-verify.c === --- gcc/tree-vtable-verify.c(revision 0) +++ gcc/tree-vtable-verify.c(revision 0) I would like to get rid of this naming convention where we prefix file names with 'tree-'. Just vtable-verify.c is fine. @@ -0,0 +1,724 @@ +/* Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Copyright (C) 2013 +/* Virtual Table Pointer Security Pass - Detect corruption of vtable pointers + before using them for virtual method dispatches. */ Do you have a URL to a paper/presentation for it? + + To find and reference the set of valid vtable pointers for any given + virtual class, we create a special global varible for each virtual s/varible/variable/ + + Some implementation details for this pass: + + To find the all of the virtual calls, we iterate through all the s/the all/all/ + struct vtable_registration key; + struct vtable_registration **slot; + + gcc_assert (node && node->registered); + + key.vtable_decl = vtable_decl; + slot = (struct vtable_registration **) htab_find_slot (node->registered, + &key, NO_INSERT); Unless you need to use this in an old branch, I strongly suggest using the new hash table facilities (hash-table.h). + + +/* Here are the three two structures into which we insert vtable map nodes. 'three two'? + /* Verify that there aren't any qualifiers on the type. */ + type_quals = TYPE_QUALS (TREE_TYPE (class_type_decl)); + gcc_assert (type_quals == TYPE_UNQUALIFIED); + + /* Get the mangled name for the unqualified type. */ + class_name = DECL_ASSEMBLER_NAME (class_type_decl); DECL_ASSEMBLER_NAME has side-effects (it generates one if there isn't one already). Just to avoid this unwanted side effect, protect it with if (HAS_DECL_ASSEMBLER_NAME_P). In fact, I think you should abort if the class_type_decl does *not* have one. So, just adding gcc_assert (HAS_DECL_ASSEMBLER_NAME_P(class_type_decl)) should be sufficient. + +/* This function attempts to recover the declared class of an object + that is used in making a virtual call. We try to get the type from + the type cast in the gimple assignment statement that extracts the + vtable pointer from the object (DEF_STMT). The gimple statment s/statment/statement/ + usually looks something like this: + + D.2201_4 = MEM[(struct Event *)this_1(D)]._vptr.Event*/ + +static tree +/* extract_object_class_type (gimple def_stmt) */ Remove this? +extract_object_class_type (tree rhs) +{ + /* tree rhs = NULL_TREE; */ + + /* Try to find and extract the type cast from that stmt. */ + + /* rhs = gimple_assign_rhs1 (def_stmt); */ + /* + if (TREE_CODE (rhs) == COMPONENT_REF) +{ + while (TREE_CODE (rhs) == COMPONENT_REF + && (TREE_CODE (TREE_OPERAND (rhs, 0)) == COMPONENT_REF)) +rhs = TREE_OPERAND (rhs, 0); + + if (TREE_CODE (rhs) == COMPONENT_REF + && TREE_CODE (TREE_OPERAND (rhs, 0)) == MEM_REF + && TREE_CODE (TREE_TYPE (TREE_OPERAND (rhs, 0)))== RECORD_TYPE) +rhs = TREE_TYPE (TREE_OPERAND (rhs, 0)); + else +rhs = NULL_TREE; +} + else +rhs = NULL_TREE; + */ What's this? Is it needed? There's some other commented code here that seems out of place. + + tree result = NULL_TREE; + + + if (TREE_CODE (rhs) == COMPONENT_REF) +{ + tree op0 = TREE_OPERAND (rhs, 0); + tree op1 = TREE_OPERAND (rhs, 1); + + if (TREE_CODE (op1) == FIELD_DECL + && DECL_VIRTUAL_P (op1)) +{ + if (TREE_CODE (op0) == COMPONENT_REF + && TREE_CODE (TREE_OPERAND (op0, 0)) == MEM_REF + && TREE_CODE (TREE_TYPE (TREE_OPERAND (op0, 0)))== RECORD_TYPE) +result = TREE_TYPE (TREE_OPERAND (op0, 0)); + e
[PATCH] Introduce -Waggressive-loop-optimizations (PR tree-optimization/53265)
Hi! This patch is an attempt to warn about undefined behavior in simple loops with known constant number of latch executions, which probably is the most common case where gcc 4.8 started to turn finite loops involving undefined behavior before reaching last iteration into endless loops. Of course the patch doesn't guarantee warning for all such mistakes, and for loops without known constant number of latch executions it is question on what exactly we should warn about. Honza has some prototype patch, perhaps that could be done if loop->warned_aggressive_loop_optimizations is still false. To avoid false positives in some cases (e.g. exp_ch7.adb during bootstrap), I had to start warning only later on (with the advantage that at that point loops are preserved and thus we can set flag in the loop structure whether we've warned already). I had to tweak a couple of testcases (pr49518.c clearly can result in undefined behavior conditionally, longbranch2.C also had obvious undefined behavior (I've verified that r8 cc1plus generated exactly same size and insn type code with original and fixed testcase, the only thing that differed were immediates in some instructions due to different field sizes). In cunroll-10.c we no longer do anything as it had known constant number of latch executions, thus no undefined behavior discovery is performed. In libgcc, the DW_CFA_GNU_window_save handling code was hardcoding SPARC register window setup, but that is also undefined behavior on targets that have fewer than 32 DWARF_FRAME_REGISTERS. I've just shut it up there, after all DW_CFA_GNU_window_save is only ever used on SPARC anyway. I've bootstrapped/regtested the patch together with a debugging patch to show where the last hunk in estimate_numbers_of_iterations_loop actually changed anything. It happened in ../../gcc/ada/exp_ch7.adb:3540 (see the PR, in dead code), we'd need a copyprop pass with cfgcleanup before cunrolli to avoid that, then in {sse4_2,avx}-vpcmp{i,e}strm-{1,2}.c /usr/src/gcc/gcc/testsuite/gcc.target/i386/sse4_2-pcmpstr.h:339 (reduced testcase -O2: short t[8]; static inline void bar (int x, int y) { short s[8]; int i, d = (x & 1) == 0 ? 16 : 8; if (x & 0x40) for (i = 0; i < d; i++) if (d == 8) s[i] = (y & (1 << i)) ? -1 : 0; __builtin_memcpy (t, s, sizeof s); } void foo (int y) { bar (0x26, y); } ) - here number_of_latch_iterations returns 0, apparently because it finds out that the loop will be never executed. Then gcc.dg/torture/pr49518.c:11 (see above, ok) and gcc.dg/pr53265.c (expected, many). So, I think we're fine. Ok for 4.8? 2013-03-13 Jakub Jelinek PR tree-optimization/53265 * common.opt (Waggressive-loop-optimizations): New option. * tree-ssa-loop-niter.c: Include tree-pass.h. (do_warn_aggressive_loop_optimizations): New function. (record_estimate): Call it. Don't add !is_exit bounds to loop->bounds if number_of_latch_executions returned constant. (estimate_numbers_of_iterations_loop): Call number_of_latch_executions early. If number_of_latch_executions returned constant, set nb_iterations_upper_bound back to it. * cfgloop.h (struct loop): Add warned_aggressive_loop_optimizations field. * Makefile.in (tree-ssa-loop-niter.o): Depend on $(TREE_PASS_H). * doc/invoke.texi (-Wno-aggressive-loop-optimizations): Document. * gcc.dg/pr53265.c: New test. * gcc.dg/torture/pr49518.c: Add -Wno-aggressive-loop-optimizations to dg-options. * g++.dg/opt/longbranch2.C (EBCOTLut): Double sizes of a2 and a3 arrays. * gcc.dg/tree-ssa/cunroll-10.c (main): Rename to foo. Add argument n, use it as high bound instead of 4. * unwind-dw2.c (execute_cfa_program): Avoid -Waggressive-array-optimizations warnings for DW_CFA_GNU_window_save on targets with DWARF_FRAME_REGISTERS < 32. * testsuite/libmudflap.c/fail37-frag.c: Add optimization barrier. --- gcc/common.opt.jj 2013-03-12 09:59:34.692099982 +0100 +++ gcc/common.opt 2013-03-12 13:47:08.922161154 +0100 @@ -505,6 +505,10 @@ Waggregate-return Common Var(warn_aggregate_return) Warning Warn about returning structures, unions or arrays +Waggressive-loop-optimizations +Common Var(warn_aggressive_loop_optimizations) Init(1) Warning +Warn if a loop with constant number of iterations triggers undefined behavior + Warray-bounds Common Var(warn_array_bounds) Warning Warn if an array is accessed out of bounds --- gcc/tree-ssa-loop-niter.c.jj2013-03-12 09:59:34.740099692 +0100 +++ gcc/tree-ssa-loop-niter.c 2013-03-13 11:19:02.100060913 +0100 @@ -37,6 +37,7 @@ along with GCC; see the file COPYING3. #include "flags.h" #include "diagnostic-core.h" #include "tree-inline.h" +#include "tree-pass.h" #define SWAP(X, Y) do { affine_iv *tmp = (X); (X) = (Y); (Y) = tmp; } while (0) @@ -2525,6 +2526,40 @@ record_niter_bound (struct loop *loop,
[C++ PATCH] Fix -Wdiv-by-zero regression (PR c++/56607)
Hi! My sizeof deferred folding changes led to the following regression. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, acked by Jason in the PR, queued for 4.8.1 and 4.9. 2013-03-13 Jakub Jelinek PR c++/56607 * typeck.c (cp_build_binary_op): When calling warn_for_div_by_zero, pass op1 through maybe_constant_value first. * g++.dg/warn/Wdiv-by-zero-2.C: New test. * c-c++-common/pr56607.c: New test. --- gcc/cp/typeck.c.jj 2013-03-12 09:59:36.0 +0100 +++ gcc/cp/typeck.c 2013-03-13 09:04:26.011917793 +0100 @@ -4015,7 +4015,7 @@ cp_build_binary_op (location_t location, { enum tree_code tcode0 = code0, tcode1 = code1; - warn_for_div_by_zero (location, op1); + warn_for_div_by_zero (location, maybe_constant_value (op1)); if (tcode0 == COMPLEX_TYPE || tcode0 == VECTOR_TYPE) tcode0 = TREE_CODE (TREE_TYPE (TREE_TYPE (op0))); @@ -4051,7 +4051,7 @@ cp_build_binary_op (location_t location, case TRUNC_MOD_EXPR: case FLOOR_MOD_EXPR: - warn_for_div_by_zero (location, op1); + warn_for_div_by_zero (location, maybe_constant_value (op1)); if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE && TREE_CODE (TREE_TYPE (type0)) == INTEGER_TYPE --- gcc/testsuite/g++.dg/warn/Wdiv-by-zero-2.C.jj 2013-03-13 09:16:50.550483072 +0100 +++ gcc/testsuite/g++.dg/warn/Wdiv-by-zero-2.C 2013-03-13 09:22:28.213474528 +0100 @@ -0,0 +1,34 @@ +// PR c++/56607 +// { dg-do compile { target { { lp64 || ilp32 } || llp64 } } } +// { dg-options "-O2 -Wdiv-by-zero -std=c++11" } + +constexpr int sc () { return sizeof (char); } +constexpr int si () { return sizeof (int); } +constexpr int zc () { return sc () - 1; } +constexpr int zi (int d) { return si () / d - 1; } + +int +f1 (void) +{ + return 1 / zc ();// { dg-warning "division by zero" } +} + +int +f2 (void) +{ + constexpr int x = zc (); + return 1 / x;// { dg-warning "division by zero" } +} + +int +f3 (void) +{ + return 1 / zi (3); // { dg-warning "division by zero" } +} + +int +f4 (void) +{ + constexpr int x = zi (3); + return 1 / x;// { dg-warning "division by zero" } +} --- gcc/testsuite/c-c++-common/pr56607.c.jj 2013-03-13 09:17:03.671405262 +0100 +++ gcc/testsuite/c-c++-common/pr56607.c2013-03-13 09:21:54.892673827 +0100 @@ -0,0 +1,29 @@ +/* PR c++/56607 */ +/* { dg-do compile { target { { lp64 || ilp32 } || llp64 } } } */ +/* { dg-options "-O2 -Wdiv-by-zero" } */ + +int +f1 (void) +{ + return 1 / (sizeof (char) - 1); /* { dg-warning "division by zero" } */ +} + +int +f2 (void) +{ + const int x = sizeof (char) - 1; + return 1 / x;/* { dg-warning "division by zero" "" { target c++ } } */ +} + +int +f3 (void) +{ + return 1 / (sizeof (int) / 3 - 1); /* { dg-warning "division by zero" } */ +} + +int +f4 (void) +{ + const int x = sizeof (int) / 3 - 1; + return 1 / x;/* { dg-warning "division by zero" "" { target c++ } } */ +} Jakub
Fox a MinGW warning in libiberty/setenv.c
I get this compiling the latest pretest of GDB 7.6 with MinGW: gcc -c -DHAVE_CONFIG_H -O2 -gdwarf-2 -g3 -D__USE_MINGW_ACCESS -I. -I./../include -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic ./setenv.c -o setenv.o ./setenv.c:66:1: warning: function declaration isn't a prototype [-Wstrict-prototypes] This happens because MinGW's stdlib.h has this: #ifdef __MSVCRT__ extern _CRTIMP char *** __cdecl __MINGW_NOTHROW __p__environ(void); extern _CRTIMP wchar_t *** __cdecl __MINGW_NOTHROW __p__wenviron(void); # define _environ (*__p__environ()) # define _wenviron (*__p__wenviron()) #else /* ! __MSVCRT__ */ #endif /* ! __MSVCRT__ */ #define environ _environ and setenv.c does this: #ifndef HAVE_ENVIRON_DECL extern char **environ; #endif Solution: Add a guard: --- libiberty/setenv.c~ 2011-02-03 09:23:59.0 +0200 +++ libiberty/setenv.c 2013-03-13 13:22:49.085187200 +0200 @@ -63,8 +63,10 @@ #define __environ environ #ifndef HAVE_ENVIRON_DECL +#ifndef environ extern char **environ; #endif +#endif OK to commit (with a suitable ChangeLog entry)?
Re: Fox a MinGW warning in libiberty/setenv.c
On 3/13/13, Eli Zaretskii wrote: > > #ifdef __MSVCRT__ >extern _CRTIMP char *** __cdecl __MINGW_NOTHROW __p__environ(void); >extern _CRTIMP wchar_t *** __cdecl __MINGW_NOTHROW > __p__wenviron(void); > # define _environ (*__p__environ()) > # define _wenviron (*__p__wenviron()) > #else /* ! __MSVCRT__ */ > #endif /* ! __MSVCRT__ */ > > #define environ _environ Cool. >and setenv.c does this: > > #ifndef HAVE_ENVIRON_DECL > extern char **environ; > #endif > >Solution: Add a guard: This is OK with a ChangeLog entry. Thanks. Ian
C++ PATCH for c++/56346 (thread_local3.C link error on targets without __dso_handle)
We can't pass the address of __dso_handle to __cxa_thread_atexit if the target doesn't provide that symbol in the crt files. Fixed by passing NULL if the target doesn't use __cxa_atexit. Tested x86_64-pc-linux-gnu and hppa2.0w-hp-hpux11.11. This fixes broken new functionality on a secondary target; is it OK for 4.8.0 or should it wait for 4.8.1? commit 145dab2e1e46ac025414e1a225e29caa2c3b41c1 Author: Jason Merrill Date: Mon Mar 11 12:31:16 2013 -0400 PR c++/56346 * decl.c (register_dtor_fn): Pass null to __cxa_thread_atexit dso_handle parm on targets without __cxa_atexit. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 150e866..92114ff 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -6758,10 +6758,9 @@ register_dtor_fn (tree decl) "__aeabi_atexit"), and DECL is a class object, we can just pass the destructor to "__cxa_atexit"; we don't have to build a temporary function to do the cleanup. */ - ob_parm = (DECL_THREAD_LOCAL_P (decl) - || (flag_use_cxa_atexit - && !targetm.cxx.use_atexit_for_cxa_atexit ())); - dso_parm = ob_parm; + dso_parm = (flag_use_cxa_atexit + && !targetm.cxx.use_atexit_for_cxa_atexit ()); + ob_parm = (DECL_THREAD_LOCAL_P (decl) || dso_parm); use_dtor = ob_parm && CLASS_TYPE_P (type); if (use_dtor) { @@ -6825,7 +6824,7 @@ register_dtor_fn (tree decl) before passing it in, to avoid spurious errors. */ addr = build_nop (ptr_type_node, addr); } - else if (ob_parm) + else /* Since the cleanup functions we build ignore the address they're given, there's no reason to pass the actual address in, and, in general, it's cheaper to pass NULL than any @@ -6835,6 +6834,10 @@ register_dtor_fn (tree decl) if (dso_parm) arg2 = cp_build_addr_expr (get_dso_handle_node (), tf_warning_or_error); + else if (ob_parm) +/* Just pass NULL to the dso handle parm if we don't actually + have a DSO handle on this target. */ +arg2 = null_pointer_node; else arg2 = NULL_TREE;
Re: C++ PATCH for c++/56346 (thread_local3.C link error on targets without __dso_handle)
On Wed, Mar 13, 2013 at 03:32:24PM -0400, Jason Merrill wrote: > We can't pass the address of __dso_handle to __cxa_thread_atexit if > the target doesn't provide that symbol in the crt files. Fixed by > passing NULL if the target doesn't use __cxa_atexit. > > Tested x86_64-pc-linux-gnu and hppa2.0w-hp-hpux11.11. This fixes > broken new functionality on a secondary target; is it OK for 4.8.0 > or should it wait for 4.8.1? This is ok for 4.8.0. > commit 145dab2e1e46ac025414e1a225e29caa2c3b41c1 > Author: Jason Merrill > Date: Mon Mar 11 12:31:16 2013 -0400 > > PR c++/56346 > * decl.c (register_dtor_fn): Pass null to __cxa_thread_atexit > dso_handle parm on targets without __cxa_atexit. > > diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c > index 150e866..92114ff 100644 > --- a/gcc/cp/decl.c > +++ b/gcc/cp/decl.c > @@ -6758,10 +6758,9 @@ register_dtor_fn (tree decl) > "__aeabi_atexit"), and DECL is a class object, we can just pass the > destructor to "__cxa_atexit"; we don't have to build a temporary > function to do the cleanup. */ > - ob_parm = (DECL_THREAD_LOCAL_P (decl) > - || (flag_use_cxa_atexit > - && !targetm.cxx.use_atexit_for_cxa_atexit ())); > - dso_parm = ob_parm; > + dso_parm = (flag_use_cxa_atexit > + && !targetm.cxx.use_atexit_for_cxa_atexit ()); > + ob_parm = (DECL_THREAD_LOCAL_P (decl) || dso_parm); >use_dtor = ob_parm && CLASS_TYPE_P (type); >if (use_dtor) > { > @@ -6825,7 +6824,7 @@ register_dtor_fn (tree decl) >before passing it in, to avoid spurious errors. */ >addr = build_nop (ptr_type_node, addr); > } > - else if (ob_parm) > + else > /* Since the cleanup functions we build ignore the address > they're given, there's no reason to pass the actual address > in, and, in general, it's cheaper to pass NULL than any > @@ -6835,6 +6834,10 @@ register_dtor_fn (tree decl) >if (dso_parm) > arg2 = cp_build_addr_expr (get_dso_handle_node (), > tf_warning_or_error); > + else if (ob_parm) > +/* Just pass NULL to the dso handle parm if we don't actually > + have a DSO handle on this target. */ > +arg2 = null_pointer_node; >else > arg2 = NULL_TREE; > Jakub
RE: FW: [PATCH] [MIPS] microMIPS gcc support
> -Original Message- > From: Richard Sandiford [mailto:rdsandif...@googlemail.com] > Sent: Tuesday, March 05, 2013 4:06 PM > To: Moore, Catherine > Cc: gcc-patches@gcc.gnu.org; Rozycki, Maciej > Subject: Re: FW: [PATCH] [MIPS] microMIPS gcc support: > > We have a few internal-only undocumented constraints that aren't used > much, so we should be able to move them to the "Y" space instead. The > patch below does this for "T" and "U". Then we could use "U" for new, > longer constraints. > > > U > > where is: > > s for signed > u for unsigned > d for decremented unsigned (-1 ... N) > i for incremented unsigned (1 ... N) > > where is: > > b for "byte" (*1) > h for "halfwords" (*2) > w for "words" (*4) > d for "doublewords" (*8) -- useful for 64-bit MIPS16 but probably not > needed for 32-bit microMIPS > > and where is the number of bits. and could be > replaced with an ad-hoc two-letter combination for special cases. > E.g. "Uas9" ("add stack") for ADDISUP. > > Just a suggestion though. I'm not saying these names are totally intuitive or > anything, but they should at least be better than arbitrary letters. > > Also, could be two digits if necessary, or we could just use hex > digits. I extended this proposal a bit by: 1. Adding a e for encoded. The constraint will start with Ue, when the operand is an encoded value. 2. I decided to use two digits for . 3. The ad-hoc combination is used for anything else. Patch is attached. WDYT? I'm still testing, but results so far look really good. Catherine short-delay.cl Description: short-delay.cl short-delay.patch Description: short-delay.patch
[cxx-conversion] RFC - Helper types for building GIMPLE
This patch adds an initial implementation for a new helper type for generating GIMPLE statements. The type is called gimple_builder. There are two main variants: gimple_builder_normal and gimple_builder_ssa. The difference between the two is the temporaries they create. The 'normal' builder creates temporaries in normal form (i.e., VAR_DECLs). The 'ssa' builder creates SSA names. The basic functionality is described in http://gcc.gnu.org/wiki/cxx-conversion/gimple-generation. I expect it to evolve as I address feedback on this initial implementation. The patch implements the initial builder. It has enough functionality to simplify the generation of 3 address assignments (the bulk of all generated code). To use the builder: 1- Declare an instance 'gb' of gimple_builder_normal or gimple_builder_ssa. E.g., gimple_builder_ssa gb; 2- Use gb.add_* to add a new statement to it. This returns an SSA name or VAR_DECL with the value of the added statement. 3- Call gb.insert_*() to insert the sequence of statements in the builder into a statement iterator. For instance, in asan.c we generate the expression: (shadow != 0) & (base_addr & 7) + (size_in_bytes - 1)) >= shadow). with the following code: - gimple_builder_ssa gb(location); t = gb.add (NE_EXPR, shadow, 0); tree t1 = gb.add (BIT_AND_EXPR, base_addr, 7); t1 = gb.add_type_cast (shadow_type, t1); if (size_in_bytes > 1) t1 = gb.add (PLUS_EXPR, t1, size_in_bytes - 1); t1 = gb.add (GE_EXPR, t1, shadow); t = gb.add (BIT_AND_EXPR, t, t1); gb.insert_after (&gsi, GSI_NEW_STMT); - In contrast, the original code needed to generate the same expression is significantly longer: - g = gimple_build_assign_with_ops (NE_EXPR, make_ssa_name (boolean_type_node, NULL), shadow, build_int_cst (shadow_type, 0)); gimple_set_location (g, location); gsi_insert_after (&gsi, g, GSI_NEW_STMT); t = gimple_assign_lhs (g); g = gimple_build_assign_with_ops (BIT_AND_EXPR, make_ssa_name (uintptr_type, NULL), base_addr, build_int_cst (uintptr_type, 7)); gimple_set_location (g, location); gsi_insert_after (&gsi, g, GSI_NEW_STMT); g = gimple_build_assign_with_ops (NOP_EXPR, make_ssa_name (shadow_type, NULL), gimple_assign_lhs (g), NULL_TREE); gimple_set_location (g, location); gsi_insert_after (&gsi, g, GSI_NEW_STMT); if (size_in_bytes > 1) { g = gimple_build_assign_with_ops (PLUS_EXPR, make_ssa_name (shadow_type, NULL), gimple_assign_lhs (g), build_int_cst (shadow_type, size_in_bytes - 1)); gimple_set_location (g, location); gsi_insert_after (&gsi, g, GSI_NEW_STMT); } g = gimple_build_assign_with_ops (GE_EXPR, make_ssa_name (boolean_type_node, NULL), gimple_assign_lhs (g), shadow); gimple_set_location (g, location); gsi_insert_after (&gsi, g, GSI_NEW_STMT); g = gimple_build_assign_with_ops (BIT_AND_EXPR, make_ssa_name (boolean_type_node, NULL), t, gimple_assign_lhs (g)); gimple_set_location (g, location); gsi_insert_after (&gsi, g, GSI_NEW_STMT); t = gimple_assign_lhs (g); - I expect to add more facilities to the builder. Mainly, generation of control flow altering statements which will automatically reflect on the CFG. I do not think the helper should replace all code generation, but it should serve as a shorter/simpler way of generating GIMPLE IL in the common cases. Feedback welcome. I would like to consider adding this facility when stage 1 opens. In the meantime, I've committed the patch to the cxx-conversion branch. Th
Re: [cxx-conversion] RFC - Helper types for building GIMPLE
On Wed, Mar 13, 2013 at 10:55 PM, Diego Novillo wrote: > This patch adds an initial implementation for a new helper type for > generating GIMPLE statements. Great. I was just asking you about this on IRC - you not there - but here's a patch. Great! > For instance, in asan.c we generate the expression: > > (shadow != 0) & (base_addr & 7) + (size_in_bytes - 1)) >= shadow). > > with the following code: > > - > gimple_builder_ssa gb(location); > t = gb.add (NE_EXPR, shadow, 0); > tree t1 = gb.add (BIT_AND_EXPR, base_addr, 7); > t1 = gb.add_type_cast (shadow_type, t1); > if (size_in_bytes > 1) > t1 = gb.add (PLUS_EXPR, t1, size_in_bytes - 1); > t1 = gb.add (GE_EXPR, t1, shadow); > t = gb.add (BIT_AND_EXPR, t, t1); > gb.insert_after (&gsi, GSI_NEW_STMT); > - Much better than what GCC has now, although I had hoped it'd be possible to build on the result of a previous expression without tree variables. > I expect to add more facilities to the builder. Mainly, generation of > control flow altering statements which will automatically reflect on > the CFG. What does your plan for this look like? Personally I'd prefer to keep CFG modifications explicit, not hidden behind this builder. CFG changes must be done with great care, to avoid invalidating associated data (profile, dominator tree, etc.). I'm worried that if you hide this behind a builder, it'll be more difficult to figure out where/how the CFG is modified (a simple grep for CFG-modifying functions won't do anymore). > I do not think the helper should replace all code generation, but it > should serve as a shorter/simpler way of generating GIMPLE IL in the > common cases. I'd like to convert the profiling code, if you'd accept patches for that on the cxx-branch. > Feedback welcome. I would like to consider adding this facility when > stage 1 opens. Let's play with it a bit first on the CXX branch, and update documentation like doc/gimple.texi :-) Ciao! Steven
Re: [cxx-conversion] RFC - Helper types for building GIMPLE
Nice -- GCC LOC will be significantly reduced with these interfaces. Using 'add' as interface name can be confusing -- new, or new_stmt, or new_assignment/new_call etc might be better -- but we can delay the bike shedding later. David On Wed, Mar 13, 2013 at 2:55 PM, Diego Novillo wrote: > This patch adds an initial implementation for a new helper type for > generating GIMPLE statements. > > The type is called gimple_builder. There are two main variants: > gimple_builder_normal and gimple_builder_ssa. The difference between > the two is the temporaries they create. The 'normal' builder creates > temporaries in normal form (i.e., VAR_DECLs). The 'ssa' builder > creates SSA names. > > The basic functionality is described in > http://gcc.gnu.org/wiki/cxx-conversion/gimple-generation. I expect it > to evolve as I address feedback on this initial implementation. > > The patch implements the initial builder. It has enough functionality > to simplify the generation of 3 address assignments (the bulk of all > generated code). > > To use the builder: > > 1- Declare an instance 'gb' of gimple_builder_normal or >gimple_builder_ssa. E.g., gimple_builder_ssa gb; > > 2- Use gb.add_* to add a new statement to it. This >returns an SSA name or VAR_DECL with the value of the added >statement. > > 3- Call gb.insert_*() to insert the sequence of statements in the >builder into a statement iterator. > > For instance, in asan.c we generate the expression: > > (shadow != 0) & (base_addr & 7) + (size_in_bytes - 1)) >= shadow). > > with the following code: > > - > gimple_builder_ssa gb(location); > t = gb.add (NE_EXPR, shadow, 0); > tree t1 = gb.add (BIT_AND_EXPR, base_addr, 7); > t1 = gb.add_type_cast (shadow_type, t1); > if (size_in_bytes > 1) > t1 = gb.add (PLUS_EXPR, t1, size_in_bytes - 1); > t1 = gb.add (GE_EXPR, t1, shadow); > t = gb.add (BIT_AND_EXPR, t, t1); > gb.insert_after (&gsi, GSI_NEW_STMT); > - > > > In contrast, the original code needed to generate the same expression > is significantly longer: > > > - > g = gimple_build_assign_with_ops (NE_EXPR, > make_ssa_name (boolean_type_node, >NULL), > shadow, > build_int_cst (shadow_type, 0)); > gimple_set_location (g, location); > gsi_insert_after (&gsi, g, GSI_NEW_STMT); > t = gimple_assign_lhs (g); > > g = gimple_build_assign_with_ops (BIT_AND_EXPR, > make_ssa_name (uintptr_type, >NULL), > base_addr, > build_int_cst (uintptr_type, 7)); > gimple_set_location (g, location); > gsi_insert_after (&gsi, g, GSI_NEW_STMT); > > g = gimple_build_assign_with_ops (NOP_EXPR, > make_ssa_name (shadow_type, >NULL), > gimple_assign_lhs (g), NULL_TREE); > gimple_set_location (g, location); > gsi_insert_after (&gsi, g, GSI_NEW_STMT); > if (size_in_bytes > 1) > { > g = gimple_build_assign_with_ops (PLUS_EXPR, > make_ssa_name (shadow_type, >NULL), > gimple_assign_lhs (g), > build_int_cst (shadow_type, >size_in_bytes - > 1)); > gimple_set_location (g, location); > gsi_insert_after (&gsi, g, GSI_NEW_STMT); > } > > g = gimple_build_assign_with_ops (GE_EXPR, > make_ssa_name (boolean_type_node, >NULL), > gimple_assign_lhs (g), > shadow); > gimple_set_location (g, location); > gsi_insert_after (&gsi, g, GSI_NEW_STMT); > > g = gimple_build_assign_with_ops (BIT_AND_EXPR, > make_ssa_name (boolean_type_node, >NULL), > t, gimple_assign_lhs (g)); > gimple_set_location (g, location); > gsi_insert_after (&gsi, g, GSI_NEW_STMT); > t = gimple_assign_lhs (g); > ---
Re: [cxx-conversion] RFC - Helper types for building GIMPLE
LGTM On 3/13/13, Diego Novillo wrote: > This patch adds an initial implementation for a new helper type for > generating GIMPLE statements. > > The type is called gimple_builder. There are two main variants: > gimple_builder_normal and gimple_builder_ssa. The difference between > the two is the temporaries they create. The 'normal' builder creates > temporaries in normal form (i.e., VAR_DECLs). The 'ssa' builder > creates SSA names. > > The basic functionality is described in > http://gcc.gnu.org/wiki/cxx-conversion/gimple-generation. I expect it > to evolve as I address feedback on this initial implementation. > > The patch implements the initial builder. It has enough functionality > to simplify the generation of 3 address assignments (the bulk of all > generated code). > > To use the builder: > > 1- Declare an instance 'gb' of gimple_builder_normal or >gimple_builder_ssa. E.g., gimple_builder_ssa gb; > > 2- Use gb.add_* to add a new statement to it. This >returns an SSA name or VAR_DECL with the value of the added >statement. > > 3- Call gb.insert_*() to insert the sequence of statements in the >builder into a statement iterator. > > For instance, in asan.c we generate the expression: > > (shadow != 0) & (base_addr & 7) + (size_in_bytes - 1)) >= shadow). > > with the following code: > > - > gimple_builder_ssa gb(location); > t = gb.add (NE_EXPR, shadow, 0); > tree t1 = gb.add (BIT_AND_EXPR, base_addr, 7); > t1 = gb.add_type_cast (shadow_type, t1); > if (size_in_bytes > 1) > t1 = gb.add (PLUS_EXPR, t1, size_in_bytes - 1); > t1 = gb.add (GE_EXPR, t1, shadow); > t = gb.add (BIT_AND_EXPR, t, t1); > gb.insert_after (&gsi, GSI_NEW_STMT); > - > > > In contrast, the original code needed to generate the same expression > is significantly longer: > > > - > g = gimple_build_assign_with_ops (NE_EXPR, > make_ssa_name (boolean_type_node, > NULL), > shadow, > build_int_cst (shadow_type, 0)); > gimple_set_location (g, location); > gsi_insert_after (&gsi, g, GSI_NEW_STMT); > t = gimple_assign_lhs (g); > > g = gimple_build_assign_with_ops (BIT_AND_EXPR, > make_ssa_name (uintptr_type, > NULL), > base_addr, > build_int_cst (uintptr_type, 7)); > gimple_set_location (g, location); > gsi_insert_after (&gsi, g, GSI_NEW_STMT); > > g = gimple_build_assign_with_ops (NOP_EXPR, > make_ssa_name (shadow_type, > NULL), > gimple_assign_lhs (g), NULL_TREE); > gimple_set_location (g, location); > gsi_insert_after (&gsi, g, GSI_NEW_STMT); > if (size_in_bytes > 1) > { > g = gimple_build_assign_with_ops (PLUS_EXPR, > make_ssa_name (shadow_type, > NULL), > gimple_assign_lhs (g), > build_int_cst (shadow_type, > size_in_bytes - 1)); > gimple_set_location (g, location); > gsi_insert_after (&gsi, g, GSI_NEW_STMT); > } > > g = gimple_build_assign_with_ops (GE_EXPR, > make_ssa_name (boolean_type_node, > NULL), > gimple_assign_lhs (g), > shadow); > gimple_set_location (g, location); > gsi_insert_after (&gsi, g, GSI_NEW_STMT); > > g = gimple_build_assign_with_ops (BIT_AND_EXPR, > make_ssa_name (boolean_type_node, > NULL), > t, gimple_assign_lhs (g)); > gimple_set_location (g, location); > gsi_insert_after (&gsi, g, GSI_NEW_STMT); > t = gimple_assign_lhs (g); > - > > I expect to add more facilities to the builder. Mainly, generation of > control flow altering statements which will automatically reflect on > the CFG. > > I do not think the helper should replace all code generation, but it > should serve as a shorter/simpler way of generating GIMPLE IL i
Re: [cxx-conversion] RFC - Helper types for building GIMPLE
On 2013-03-13 18:16 , Steven Bosscher wrote: Much better than what GCC has now, although I had hoped it'd be possible to build on the result of a previous expression without tree variables. It may be possible, but we need something to tie the expressions together and the temporaries are the perfect glue. I tried coming up with some other referencing scheme, but this seemed the most natural. If you can think of anything simpler, let's do it. What does your plan for this look like? Personally I'd prefer to keep CFG modifications explicit, not hidden behind this builder. CFG changes must be done with great care, to avoid invalidating associated data (profile, dominator tree, etc.). I'm worried that if you hide this behind a builder, it'll be more difficult to figure out where/how the CFG is modified (a simple grep for CFG-modifying functions won't do anymore). Mostly what you see on the wiki. If I add a GIMPLE_COND, I want the builder to add the basic diamond for it (http://gcc.gnu.org/wiki/cxx-conversion/gimple-generation#Generating_statements_that_affect_control_flow) I'd like to convert the profiling code, if you'd accept patches for that on the cxx-branch. Absolutely! Let's play with it a bit first on the CXX branch, and update documentation like doc/gimple.texi :-) Sounds good. Though once stage 1 opens, I would prefer to move further implementation to trunk. Diego.
Re: [cxx-conversion] RFC - Helper types for building GIMPLE
On 2013-03-13 18:19 , Xinliang David Li wrote: Using 'add' as interface name can be confusing -- new, or new_stmt, or new_assignment/new_call etc might be better -- but we can delay the bike shedding later. Yeah, I remember discussing this offline and I completely forgot to make the change. I'll fix that. Thanks. Diego.
[PATCH][Cilkplus] Build Cilk Runtime for non x86.
Hello Everyone, This attached patch is for the Cilk Plus branch affecting the Cilk Runtime. This patch should potentially allow the Cilk runtime library build for non-x86 targets. We have tested this on ARM (trimslice machine) and it seem to work on our test case. We encourage all the GCC target developers to help us expand Cilk on other targets. Thanks, Balaji V. Iyer. Index: libcilkrts/runtime/sysdep-unix.c === --- libcilkrts/runtime/sysdep-unix.c(revision 196638) +++ libcilkrts/runtime/sysdep-unix.c(working copy) @@ -309,11 +309,15 @@ void __cilkrts_stop_workers(global_state_t *g) * spawn. This should be called each time a frame is resumed. */ static inline void restore_fp_state (__cilkrts_stack_frame *sf) { +#if defined __i386__ || defined __x86_64 __asm__ ( "ldmxcsr %0\n\t" "fnclex\n\t" "fldcw %1" : : "m" (sf->mxcsr), "m" (sf->fpcsr)); +#else +# warning "unimplemented: code to restore the floating point state" +#endif } /* Resume user code after a spawn or sync, possibly on a different stack. Index: libcilkrts/runtime/os-unix.c === --- libcilkrts/runtime/os-unix.c(revision 196638) +++ libcilkrts/runtime/os-unix.c(working copy) @@ -344,7 +344,8 @@ COMMON_SYSDEP unsigned long long __cilkrts_gettick __asm__ volatile("rdtsc" : "=a" (a), "=d" (d)); return ((unsigned long long)a) | (((unsigned long long)d) << 32); #else -# error "unimplemented cycle counter" +# warning "unimplemented cycle counter" +return 0; #endif } @@ -359,7 +360,7 @@ COMMON_SYSDEP void __cilkrts_short_pause(void) #elif defined __i386__ || defined __x86_64 __asm__("pause"); #else -# error __cilkrts_short_pause undefined +# warning __cilkrts_short_pause undefined #endif } @@ -369,7 +370,7 @@ COMMON_SYSDEP int __cilkrts_xchg(volatile int *ptr /* asm statement here works around icc bugs */ __asm__("xchgl %0,%a1" :"=r" (x) : "r" (ptr), "0" (x) :"memory"); #else -# error __cilkrts_xchg undefined +x = __sync_lock_test_and_set(ptr, x); #endif return x; } Index: libcilkrts/ChangeLog.cilkplus === --- libcilkrts/ChangeLog.cilkplus (revision 196638) +++ libcilkrts/ChangeLog.cilkplus (working copy) @@ -1,3 +1,13 @@ +2013-03-13 Balaji V. Iyer + + * runtime/sysdep-unix.c (__cilkrts_stop_workers): Inserted inline + assembly inside a #if which is only invoked when compiled for i386. + Otherwise, output a warning. + * runtime/os-unix.c (__cilkrts_gettick): Replaced #error with #warning. + (__cilkrts_short_pause): Likewise. + (__cilkrts_xchg): Likewise. + + 2013-02-05 Balaji V. Iyer * Makefile.in (am_libcilkrts_la_OBJECTS): Removed symbol_test. Index: configure === --- configure (revision 196638) +++ configure (working copy) @@ -3159,17 +3159,6 @@ if test x$enable_libgomp = x ; then esac fi -# Disable libcilkrts on non x86 machines... for now. -if test x$enable_libcilkrts = x ; then -# Enable libcilkrts by default on x86 machines. -case "${target}" in -i[3456789]86-*-* | x86_64-*-*) - ;; -*) - noconfigdirs="$noconfigdirs target-libcilkrts" -esac -fi - # Disable libatomic on unsupported systems. if test -d ${srcdir}/libatomic; then if test x$enable_libatomic = x; then Index: ChangeLog.cilkplus === --- ChangeLog.cilkplus (revision 0) +++ ChangeLog.cilkplus (revision 0) @@ -0,0 +1,4 @@ +2013-03-13 Balaji V. Iyer + + * configure.ac (enable_libcilkrts): Made libcilkrts unconditional. + * configure (enable_libcilkrts): Likewise. Index: configure.ac === --- configure.ac(revision 196638) +++ configure.ac(working copy) @@ -507,17 +507,6 @@ if test x$enable_libgomp = x ; then esac fi -# Disable libcilkrts on non x86 machines... for now. -if test x$enable_libcilkrts = x ; then -# Enable libcilkrts by default on x86 machines. -case "${target}" in -i[3456789]86-*-* | x86_64-*-*) - ;; -*) - noconfigdirs="$noconfigdirs target-libcilkrts" -esac -fi - # Disable libatomic on unsupported systems. if test -d ${srcdir}/libatomic; then if test x$enable_libatomic = x; then
Re: [PATCH][Cilkplus] Build Cilk Runtime for non x86.
On Wed, Mar 13, 2013 at 4:30 PM, Iyer, Balaji V wrote: > Hello Everyone, > This attached patch is for the Cilk Plus branch affecting the Cilk > Runtime. This patch should potentially allow the Cilk runtime library build > for non-x86 targets. We have tested this on ARM (trimslice machine) and it > seem to work on our test case. We encourage all the GCC target developers to > help us expand Cilk on other targets. Only comment I have is: +x = __sync_lock_test_and_set(ptr, x); Use the __atomic builtins instead. This allows for better control of what memory barriers are wanted here. Thanks, Andrew
Re: [wwwdocs] gcc-4.8/porting_to.html
> It doesn't make sense. memcpy from NULL src pointer? Indeed, that doesn't make sense. Thanks. -benjamin
Re: [wwwdocs] gcc-4.8/porting_to.html
Here is round two, as checked-in. -benjamin 2013-03-13 Benjamin Kosnik * htdocs/gcc-4.8/porting_to.html: Add. * htdocs/gcc-4.8/changes.html: Add link. Index: changes.html === RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.8/changes.html,v retrieving revision 1.106 diff -c -p -r1.106 changes.html *** changes.html 13 Mar 2013 15:20:56 - 1.106 --- changes.html 14 Mar 2013 00:20:47 - *** by this change. *** 54,59 --- 54,66 --with-avrlibc=no. If the compiler is configured for RTEMS, the option is always turned off. + + More information on porting to GCC 4.8 from previous versions + of GCC can be found in + the http://gcc.gnu.org/gcc-4.8/porting_to.html";>porting + guide for this release. + + General Optimizer Improvements (and Changes) Index: porting_to.html === RCS file: porting_to.html diff -N porting_to.html *** /dev/null 1 Jan 1970 00:00:00 - --- porting_to.html 14 Mar 2013 00:20:47 - *** *** 0 --- 1,232 + + + + Porting to GCC 4.8 + + + + Porting to GCC 4.8 + + + The GCC 4.8 release series differs from previous GCC releases in more + than the usual list of + http://gcc.gnu.org/gcc-4.8/changes.html";>changes. Some of + these are a result of bug fixing, and some old behaviors have been + intentionally changed in order to support new standards, or relaxed + in standards-conforming ways to facilitate compilation or runtime + performance. Some of these changes are not visible to the naked eye + and will not cause problems when updating from older versions. + + + + However, some of these changes are visible, and can cause grief to + users porting to GCC 4.8. This document is an effort to identify major + issues and provide clear solutions in a quick and easily searched + manner. Additions and suggestions for improvement are welcome. + + + General issues + + New warnings + + Improvements to the GCC infrastructure allow improvements in + the ability of several existing warnings to spot problematic code. As + such, new warnings may exist for previously warning-free code that + uses + -Wmaybe-uninitialized. + + + Although these warnings will + not result in compilation failure, often -Wall is used in + conjunction with -Werror and as a result, new warnings + are turned into new errors. + + + As a workaround, remove -Werror until the new warnings + are fixed, or add -Wno-maybe-uninitialized. + + + More aggressive loop optimizations + + Improvements to the GCC infrastructure allow improvements in + the ability of the optimizers to transform loops. Some loops that previously + invoked undefined behavior may now be turned into endless loops. + + + For example, + + + unsigned int foo() + { + unsigned int data_data[128]; + + for (int fd = 0; fd < 128; ++fd) + data_data[fd] = fd * (0x0201); // error + + return data_data[0]; + } + + + + When fd is 64 or above, fd * 0x0201 overflows, which is invalid in C/C++ for signed ints. + + + + To fix, use the appropriate casts when converting between signed and + unsigned types to avoid overflows. Like so: + + + + data_data[fd] = (uint32_t) fd * (0x0201U); // ok + + + C language issues + + New warnings for pointer access + + + The behavior of -Wall has changed and now includes the + new warning flag -Wsizeof-pointer-memaccess. This may + result in new warnings in code that compiled cleanly with previous + versions of GCC. + + + For example, + + + #include+ + struct A { }; + + int main(void) + { + A obj; + A* p1 = &obj; + A p2[10]; + + memset(p1, 0, sizeof(p1)); // error + memset(p1, 0, sizeof(*p1)); // ok, dereferenced + memset(p2, 0, sizeof(p2)); // ok, array + + return 0; + } + + + Gives the following diagnostic: + + warning: argument to âsizeofâ in âvoid* memset(void*, int, size_t)â call is the same expression as the destination; did you mean to dereference it? [-Wsizeof-pointer-memaccess] + memset(p1, 0, sizeof(p1)); // error +^ + + + Although these warnings will not result in compilation failure, + often -Wall is used in conjunction with + -Werror and as a result, new warnings are turned into + new errors. + + To fix, either re-write to use memcpy or dereference the last argument in the + offending memset call. + + As a workaround, use + -Wno-sizeof-pointer-memaccess. + + Pre-processor pre-includes + + + The GCC pre-processor may now pre-includes a file that defines certain + macros for the entirety of the translation unit. This allows + fully conformant implementations of C99/C11 and other standards that + require compiler or compiler + runtime macros that describe + implementation availability. + + + + On linux, is pre-included. + + + + This subtle change means that some
Re: [wwwdocs] gcc-4.8/porting_to.html
> Here is round two, as checked-in. ... and here are the validation patches. -benjamin2013-03-13 Benjamin Kosnik * htdocs/gcc-4.8/porting_to.html: Fix markup. * htdocs/gcc-4.8/changes.html: Same. Index: changes.html === RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.8/changes.html,v retrieving revision 1.107 diff -c -p -r1.107 changes.html *** changes.html 14 Mar 2013 00:25:06 - 1.107 --- changes.html 14 Mar 2013 01:09:43 - *** by this change. *** 59,65 of GCC can be found in the http://gcc.gnu.org/gcc-4.8/porting_to.html";>porting guide for this release. ! General Optimizer Improvements (and Changes) --- 59,65 of GCC can be found in the http://gcc.gnu.org/gcc-4.8/porting_to.html";>porting guide for this release. ! General Optimizer Improvements (and Changes) Index: porting_to.html === RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.8/porting_to.html,v retrieving revision 1.1 diff -c -p -r1.1 porting_to.html *** porting_to.html 14 Mar 2013 00:25:06 - 1.1 --- porting_to.html 14 Mar 2013 01:09:43 - *** unsigned int foo() *** 60,66 { unsigned int data_data[128]; ! for (int fd = 0; fd < 128; ++fd) data_data[fd] = fd * (0x0201); // error return data_data[0]; --- 60,66 { unsigned int data_data[128]; ! for (int fd = 0; fd < 128; ++fd) data_data[fd] = fd * (0x0201); // error return data_data[0]; *** struct A { }; *** 101,107 int main(void) { A obj; ! A* p1 = &obj; A p2[10]; memset(p1, 0, sizeof(p1)); // error --- 101,107 int main(void) { A obj; ! A* p1 = &obj; A p2[10]; memset(p1, 0, sizeof(p1)); // error *** offending memset call. *** 129,134 --- 129,135 As a workaround, use -Wno-sizeof-pointer-memaccess. + Pre-processor pre-includes *** pre-processor may now fail, with the fol *** 155,161 As a workaround, the stdc-predef.h preinclude can be disabled with the use of -ffreestanding. For non C/C++ code, use the pre-processor flag -P. ! C++ language issues --- 156,162 As a workaround, the stdc-predef.h preinclude can be disabled with the use of -ffreestanding. For non C/C++ code, use the pre-processor flag -P. ! C++ language issues *** versions of GCC. *** 170,176 For example, ! template int foo(_Tp __a) { --- 171,177 For example, ! templateint foo(_Tp __a) { *** new errors. *** 197,202 --- 198,204 As a workaround, use -Wno-unused-local-typedefs. + Stray comma at the end of declaration now rejected 2013-03-13 Benjamin Kosnik * htdocs/gcc-4.8/porting_to.html: Fix markup. Index: porting_to.html === RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.8/porting_to.html,v retrieving revision 1.2 diff -c -p -r1.2 porting_to.html *** porting_to.html 14 Mar 2013 01:13:56 - 1.2 --- porting_to.html 14 Mar 2013 01:17:37 - *** error: stray â,â at end of member de *** 227,233 Jakub Jelinek, ! https://lists.fedoraproject.org/pipermail/devel/2013-January/175876.html";>Results of a test mass rebuild of rawhide/x86_64 with gcc-4.8.0-0.1.fc19 --- 227,233 Jakub Jelinek, ! https://lists.fedoraproject.org/pipermail/devel/2013-January/175876.html";>Results of a test mass rebuild of rawhide/x86_64 with gcc-4.8.0-0.1.fc19
[patch committed] [SH] Fix build failure on sh-linux
Hi, The attached patch is to fix build failure on sh-linux caused with the recent Oleg's changes. Committed on trunk. Regards, kaz -- 2013-03-14 Kaz Kojima * config/sh/linux.h (TARGET_DEFAULT): Remove MASK_USERMODE. (SUBTARGET_OVERRIDE_OPTIONS): Set TARGET_USERMODE as default. * config/sh/netbsd-elf.h (TARGET_DEFAULT): Remove MASK_USERMODE. (SUBTARGET_OVERRIDE_OPTIONS): New. diff -up ORIG/trunk/gcc/config/sh/linux.h trunk/gcc/config/sh/linux.h --- ORIG/trunk/gcc/config/sh/linux.h2013-02-04 09:32:36.0 +0900 +++ trunk/gcc/config/sh/linux.h 2013-03-14 11:25:41.0 +0900 @@ -39,8 +39,7 @@ along with GCC; see the file COPYING3. #undef TARGET_DEFAULT #define TARGET_DEFAULT \ - (TARGET_CPU_DEFAULT | MASK_USERMODE | TARGET_ENDIAN_DEFAULT \ - | TARGET_OPT_DEFAULT) + (TARGET_CPU_DEFAULT | TARGET_ENDIAN_DEFAULT | TARGET_OPT_DEFAULT) #define TARGET_ASM_FILE_END file_end_indicate_exec_stack @@ -146,5 +145,8 @@ along with GCC; see the file COPYING3. else if (TARGET_SH1) \ sh_atomic_model_str = "soft-imask"; \ } \ + /* Set -musermode if it hasn't been specified. */ \ + if (global_options_set.x_TARGET_USERMODE == 0) \ + TARGET_USERMODE = true; \ } \ while (0) diff -up ORIG/trunk/gcc/config/sh/netbsd-elf.h trunk/gcc/config/sh/netbsd-elf.h --- ORIG/trunk/gcc/config/sh/netbsd-elf.h 2013-02-04 09:32:37.0 +0900 +++ trunk/gcc/config/sh/netbsd-elf.h2013-03-14 11:25:11.0 +0900 @@ -58,7 +58,7 @@ along with GCC; see the file COPYING3. #undef TARGET_DEFAULT #define TARGET_DEFAULT \ - (TARGET_CPU_DEFAULT | MASK_USERMODE | TARGET_ENDIAN_DEFAULT) + (TARGET_CPU_DEFAULT | TARGET_ENDIAN_DEFAULT) /* Define because we use the label and we do not need them. */ #define NO_PROFILE_COUNTERS 1 @@ -94,3 +94,13 @@ while (0) #define SH_DIV_STRATEGY_DEFAULT SH_DIV_CALL2 #undef SH_DIV_STR_FOR_SIZE #define SH_DIV_STR_FOR_SIZE "call2" + +#undef SUBTARGET_OVERRIDE_OPTIONS +#define SUBTARGET_OVERRIDE_OPTIONS \ + do \ +{ \ + /* Set -musermode if it hasn't been specified. */ \ + if (global_options_set.x_TARGET_USERMODE == 0) \ + TARGET_USERMODE = true; \ +} \ + while (0)
[v3] doc/html regen
Sync html in sources with generated output. -benjamin 20130313-7-docs.patch.bz2 Description: application/bzip