diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-12-17 08:02:18 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-12-17 08:02:18 +0000 |
commit | 89011aed2df43a3ea68ba208d8cacdb9d52a61c1 (patch) | |
tree | 0e4e7c592b1f4f2f355bf94198a094c3011efe44 /gcc | |
parent | dc17fc09fde393a52f5a0bcd4302548676589857 (diff) | |
download | gcc-89011aed2df43a3ea68ba208d8cacdb9d52a61c1.tar.gz |
2012-12-17 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 194546 using svnmerge.py
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@194551 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
40 files changed, 473 insertions, 64 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0dbf2032f6f..a64aaec9211 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,64 @@ +2012-12-16 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + PR middle-end/55709 + Forward port from 4.7 branch: + 2012-04-10 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + PR middle-end/52894 + * varasm.c (process_pending_assemble_externals): Set + pending_assemble_externals_processed true. + (assemble_external): Call assemble_external_real if the pending + assemble externals have been processed. + +2012-12-16 Eric Botcazou <ebotcazou@adacore.com> + Tomash Brechko <tomash.brechko@gmail.com> + + PR target/55673 + * config/sparc/sparc.c (sparc_emit_membar_for_model): Fix reversed + handling of before and after cases. + * config/sparc/sync.md (atomic_store): Fix pasto. + +2012-12-16 Eric Botcazou <ebotcazou@adacore.com> + + PR rtl-optimization/55630 + * expr.c (expand_assignment): Do not call copy_blkmode_to_reg to move + BLKmode return values to the return register. + +2012-12-15 Alexandre Oliva <aoliva@redhat.com> + + PR libmudflap/53952 + * expr.c (mem_ref_refers_to_non_mem_p): Factor out + implementation into... + (addr_expr_of_non_mem_decl_p_1): ... this new function. + (addr_expr_of_non_mem_decl_p): New. + * tree.h (addr_expr_of_non_mem_decl_p): Declare. + * tree-mudflap.c (mf_xform_derefs_1): Don't change MEM_REFs + and TARGET_MEM_REFs that have an ADDR_EXPR of a non-mem DECL + as base operand. + +2012-12-14 Yvan Roux <yvan.roux@linaro.org> + + * optabs.c (expand_atomic_store): Elide redundant model test. + +2012-12-14 Teresa Johnson <tejohnson@google.com> + + PR gcov-profile/55674 + * lto-cgraph.c (merge_profile_summaries): Set min correctly the + first time we merge into a histogram entry. + +2012-12-14 Richard Biener <rguenther@suse.de> + + PR tree-optimization/55684 + * tree-ssa-loop-ivcanon.c (remove_redundant_iv_tests): Handle + gracefully the case where we cannot compute the number of + iterations at an exit. + +2012-12-14 Richard Biener <rguenther@suse.de> + + PR tree-optimization/55687 + * tree-chrec.h (no_evolution_in_loop_p): Properly use + tree_contains_chrecs. + 2012-12-13 Richard Henderson <rth@redhat.com> PR middle-end/55492 diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 3f3e24c6351..94d40c2e448 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20121214 +20121217 diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index bf9ce421756..0c902a825ff 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2012-12-15 Eric Botcazou <ebotcazou@adacore.com> + Martin Ettl <ettl.martin@gmx.de> + + PR ada/53996 + * gcc-interface/utils.c (gnat_type_for_size): Use %u in lieu of %d. + 2012-12-11 Eric Botcazou <ebotcazou@adacore.com> * gcc-interface/Make-lang.in (RTS_DIR): Define only if Ada is enabled. @@ -2512,8 +2518,9 @@ 2012-10-01 Vincent Pucci <pucci@adacore.com> - * s-gearop.adb (Vector_Matrix_Product): Dimensions check fixed. Index - of Left in S evaluation fixed. + PR ada/54614 + * s-gearop.adb (Vector_Matrix_Product): Fix dimension check and index + of Left in S evaluation. 2012-10-01 Javier Miranda <miranda@adacore.com> diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index 2d448d1ddb9..309cff6ad32 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -2797,7 +2797,7 @@ gnat_type_for_size (unsigned precision, int unsignedp) if (!TYPE_NAME (t)) { - sprintf (type_name, "%sSIGNED_%d", unsignedp ? "UN" : "", precision); + sprintf (type_name, "%sSIGNED_%u", unsignedp ? "UN" : "", precision); TYPE_NAME (t) = get_identifier (type_name); } diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 4e9de987457..054672bd777 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -11190,26 +11190,26 @@ sparc_emit_membar_for_model (enum memmodel model, if (before_after & 1) { - if (model == MEMMODEL_ACQUIRE - || model == MEMMODEL_ACQ_REL - || model == MEMMODEL_SEQ_CST) + if (model == MEMMODEL_RELEASE + || model == MEMMODEL_ACQ_REL + || model == MEMMODEL_SEQ_CST) { if (load_store & 1) - mm |= LoadLoad | LoadStore; + mm |= LoadLoad | StoreLoad; if (load_store & 2) - mm |= StoreLoad | StoreStore; + mm |= LoadStore | StoreStore; } } if (before_after & 2) { - if (model == MEMMODEL_RELEASE + if (model == MEMMODEL_ACQUIRE || model == MEMMODEL_ACQ_REL || model == MEMMODEL_SEQ_CST) { if (load_store & 1) - mm |= LoadLoad | StoreLoad; + mm |= LoadLoad | LoadStore; if (load_store & 2) - mm |= LoadStore | StoreStore; + mm |= StoreLoad | StoreStore; } } diff --git a/gcc/config/sparc/sync.md b/gcc/config/sparc/sync.md index d11f6636490..0295e6ee24a 100644 --- a/gcc/config/sparc/sync.md +++ b/gcc/config/sparc/sync.md @@ -35,8 +35,7 @@ (define_expand "membar" [(set (match_dup 1) - (unspec:BLK [(match_dup 1) - (match_operand:SI 0 "const_int_operand")] + (unspec:BLK [(match_dup 1) (match_operand:SI 0 "const_int_operand")] UNSPEC_MEMBAR))] "TARGET_V8 || TARGET_V9" { @@ -66,7 +65,7 @@ "stbar" [(set_attr "type" "multi")]) -;; For V8, LDSTUB has the effect of membar #StoreLoad +;; For V8, LDSTUB has the effect of membar #StoreLoad. (define_insn "*membar_storeload" [(set (match_operand:BLK 0 "" "") (unspec:BLK [(match_dup 0) (const_int 2)] UNSPEC_MEMBAR))] @@ -123,8 +122,8 @@ [(set_attr "type" "load,fpload")]) (define_expand "atomic_store<mode>" - [(match_operand:I 0 "register_operand" "") - (match_operand:I 1 "memory_operand" "") + [(match_operand:I 0 "memory_operand" "") + (match_operand:I 1 "register_operand" "") (match_operand:SI 2 "const_int_operand" "")] "" { diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ea4cfb20342..83d3c63860c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,13 @@ +2012-12-14 Jason Merrill <jason@redhat.com> + + PR c++/55685 + * pt.c (tsubst_copy_and_build): Don't use SIZEOF_EXPR_TYPE_P in + templates. + + PR c++/42315 + * decl.c (maybe_deduce_size_from_array_init): Don't change the + variable type. + 2012-12-13 Jakub Jelinek <jakub@redhat.com> PR c++/55652 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index cdda2f42765..64bd4b5d2c0 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -4834,14 +4834,12 @@ maybe_deduce_size_from_array_init (tree decl, tree init) if (failure == 1) { error ("initializer fails to determine size of %qD", decl); - TREE_TYPE (decl) = error_mark_node; } else if (failure == 2) { if (do_default) { error ("array size missing in %qD", decl); - TREE_TYPE (decl) = error_mark_node; } /* If a `static' var's size isn't known, make it extern as well as static, so it does not get allocated. If it's not @@ -4853,7 +4851,6 @@ maybe_deduce_size_from_array_init (tree decl, tree init) else if (failure == 3) { error ("zero-size array %qD", decl); - TREE_TYPE (decl) = error_mark_node; } } diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 91450d85407..a21522b3510 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -13563,7 +13563,7 @@ tsubst_copy_and_build (tree t, { if (TREE_CODE (r) != SIZEOF_EXPR || TYPE_P (op1)) { - if (TYPE_P (op1)) + if (!processing_template_decl && TYPE_P (op1)) { r = build_min (SIZEOF_EXPR, size_type_node, build1 (NOP_EXPR, op1, error_mark_node)); diff --git a/gcc/expr.c b/gcc/expr.c index 48e2581bdaf..9d9e5b9abf5 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -4557,21 +4557,48 @@ get_bit_range (unsigned HOST_WIDE_INT *bitstart, *bitend = *bitstart + tree_low_cst (DECL_SIZE (repr), 1) - 1; } +/* Returns true if ADDR is an ADDR_EXPR of a DECL that does not reside + in memory and has non-BLKmode. DECL_RTL must not be a MEM; if + DECL_RTL was not set yet, return NORTL. */ + +static inline bool +addr_expr_of_non_mem_decl_p_1 (tree addr, bool nortl) +{ + if (TREE_CODE (addr) != ADDR_EXPR) + return false; + + tree base = TREE_OPERAND (addr, 0); + + if (!DECL_P (base) + || TREE_ADDRESSABLE (base) + || DECL_MODE (base) == BLKmode) + return false; + + if (!DECL_RTL_SET_P (base)) + return nortl; + + return (!MEM_P (DECL_RTL (base))); +} + /* Returns true if the MEM_REF REF refers to an object that does not reside in memory and has non-BLKmode. */ -static bool +static inline bool mem_ref_refers_to_non_mem_p (tree ref) { tree base = TREE_OPERAND (ref, 0); - if (TREE_CODE (base) != ADDR_EXPR) - return false; - base = TREE_OPERAND (base, 0); - return (DECL_P (base) - && !TREE_ADDRESSABLE (base) - && DECL_MODE (base) != BLKmode - && DECL_RTL_SET_P (base) - && !MEM_P (DECL_RTL (base))); + return addr_expr_of_non_mem_decl_p_1 (base, false); +} + +/* Return TRUE iff OP is an ADDR_EXPR of a DECL that's not + addressable. This is very much like mem_ref_refers_to_non_mem_p, + but instead of the MEM_REF, it takes its base, and it doesn't + assume a DECL is in memory just because its RTL is not set yet. */ + +bool +addr_expr_of_non_mem_decl_p (tree op) +{ + return addr_expr_of_non_mem_decl_p_1 (op, true); } /* Expand an assignment that stores the value of FROM into TO. If NONTEMPORAL @@ -4920,7 +4947,12 @@ expand_assignment (tree to, tree from, bool nontemporal) rtx temp; push_temp_slots (); - if (REG_P (to_rtx) && TYPE_MODE (TREE_TYPE (from)) == BLKmode) + + /* If the source is itself a return value, it still is in a pseudo at + this point so we can move it back to the return register directly. */ + if (REG_P (to_rtx) + && TYPE_MODE (TREE_TYPE (from)) == BLKmode + && TREE_CODE (from) != CALL_EXPR) temp = copy_blkmode_to_reg (GET_MODE (to_rtx), from); else temp = expand_expr (from, NULL_RTX, GET_MODE (to_rtx), EXPAND_NORMAL); diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index a0677870baa..7202632cb70 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,20 @@ +2012-12-16 Tobias Burnus <burnus@net-b.de> + + PR fortran/55197 + * module.c (gfc_use_module): Free rename list only for + internally generated intrinsic modules. + +2012-12-16 Tobias Burnus <burnus@net-b.de> + + * trans-intrinsic.c (conv_intrinsic_move_alloc): Set dynamic + type of the FROM variable to the declared type. + +2012-12-16 Tobias Burnus <burnus@net-b.de> + + PR fortran/55638 + * resolve.c (resolve_formal_arglist): Allow VALUE without + INTENT for ELEMENTAL procedures. + 2012-12-10 Janus Weil <janus@gcc.gnu.org> PR fortran/52909 @@ -5,8 +22,8 @@ 2012-12-09 Tobias Burnus <burnus@net-b.de> - * trans-array.c (gfc_deallocate_scalar_with_status): Use - NULL_TREE in the call to gfc_deallocate_scalar_with_status. + * trans-array.c (structure_alloc_comps): Use NULL_TREE in the + call to gfc_deallocate_scalar_with_status. * trans-decl.c (gfc_trans_deferred_vars): Pass symbol. * trans-stmt.c (gfc_trans_deallocate): Pass polymorphic variable. diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index 16ea97b72cd..cde57390c37 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -6157,6 +6157,8 @@ gfc_use_module (gfc_use_list *module) "intrinsic module at %C") != FAILURE) { use_iso_fortran_env_module (); + free_rename (module->rename); + module->rename = NULL; gfc_current_locus = old_locus; module->intrinsic = true; return; @@ -6167,6 +6169,8 @@ gfc_use_module (gfc_use_list *module) "ISO_C_BINDING module at %C") != FAILURE) { import_iso_c_binding_module(); + free_rename (module->rename); + module->rename = NULL; gfc_current_locus = old_locus; module->intrinsic = true; return; @@ -6359,8 +6363,6 @@ gfc_use_modules (void) next = module_list->next; rename_list_remove_duplicate (module_list->rename); gfc_use_module (module_list); - if (module_list->intrinsic) - free_rename (module_list->rename); free (module_list); } gfc_rename_list = NULL; diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 1c7b5fb64e1..d4d5eb9b52d 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -488,10 +488,12 @@ resolve_formal_arglist (gfc_symbol *proc) continue; } - if (sym->attr.intent == INTENT_UNKNOWN) + /* Fortran 2008 Corrigendum 1, C1290a. */ + if (sym->attr.intent == INTENT_UNKNOWN && !sym->attr.value) { gfc_error ("Argument '%s' of elemental procedure '%s' at %L must " - "have its INTENT specified", sym->name, proc->name, + "have its INTENT specified or have the VALUE " + "attribute", sym->name, proc->name, &sym->declared_at); continue; } diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 504a9f3b8fc..4f74c3ff29a 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -7338,6 +7338,8 @@ conv_intrinsic_move_alloc (gfc_code *code) /* Set _vptr. */ if (to_expr->ts.type == BT_CLASS) { + gfc_symbol *vtab; + gfc_free_expr (to_expr2); gfc_init_se (&to_se, NULL); to_se.want_pointer = 1; @@ -7346,23 +7348,31 @@ conv_intrinsic_move_alloc (gfc_code *code) if (from_expr->ts.type == BT_CLASS) { + vtab = gfc_find_derived_vtab (from_expr->ts.u.derived); + gcc_assert (vtab); + gfc_free_expr (from_expr2); gfc_init_se (&from_se, NULL); from_se.want_pointer = 1; gfc_add_vptr_component (from_expr); gfc_conv_expr (&from_se, from_expr); - tmp = from_se.expr; + gfc_add_modify_loc (input_location, &block, to_se.expr, + fold_convert (TREE_TYPE (to_se.expr), + from_se.expr)); + + /* Reset _vptr component to declared type. */ + tmp = gfc_build_addr_expr (NULL_TREE, gfc_get_symbol_decl (vtab)); + gfc_add_modify_loc (input_location, &block, from_se.expr, + fold_convert (TREE_TYPE (from_se.expr), tmp)); } else { - gfc_symbol *vtab; vtab = gfc_find_derived_vtab (from_expr->ts.u.derived); gcc_assert (vtab); tmp = gfc_build_addr_expr (NULL_TREE, gfc_get_symbol_decl (vtab)); + gfc_add_modify_loc (input_location, &block, to_se.expr, + fold_convert (TREE_TYPE (to_se.expr), tmp)); } - - gfc_add_modify_loc (input_location, &block, to_se.expr, - fold_convert (TREE_TYPE (to_se.expr), tmp)); } return gfc_finish_block (&block); @@ -7371,6 +7381,8 @@ conv_intrinsic_move_alloc (gfc_code *code) /* Update _vptr component. */ if (to_expr->ts.type == BT_CLASS) { + gfc_symbol *vtab; + to_se.want_pointer = 1; to_expr2 = gfc_copy_expr (to_expr); gfc_add_vptr_component (to_expr2); @@ -7378,22 +7390,31 @@ conv_intrinsic_move_alloc (gfc_code *code) if (from_expr->ts.type == BT_CLASS) { + vtab = gfc_find_derived_vtab (from_expr->ts.u.derived); + gcc_assert (vtab); + from_se.want_pointer = 1; from_expr2 = gfc_copy_expr (from_expr); gfc_add_vptr_component (from_expr2); gfc_conv_expr (&from_se, from_expr2); - tmp = from_se.expr; + gfc_add_modify_loc (input_location, &block, to_se.expr, + fold_convert (TREE_TYPE (to_se.expr), + from_se.expr)); + + /* Reset _vptr component to declared type. */ + tmp = gfc_build_addr_expr (NULL_TREE, gfc_get_symbol_decl (vtab)); + gfc_add_modify_loc (input_location, &block, from_se.expr, + fold_convert (TREE_TYPE (from_se.expr), tmp)); } else { - gfc_symbol *vtab; vtab = gfc_find_derived_vtab (from_expr->ts.u.derived); gcc_assert (vtab); tmp = gfc_build_addr_expr (NULL_TREE, gfc_get_symbol_decl (vtab)); + gfc_add_modify_loc (input_location, &block, to_se.expr, + fold_convert (TREE_TYPE (to_se.expr), tmp)); } - gfc_add_modify_loc (input_location, &block, to_se.expr, - fold_convert (TREE_TYPE (to_se.expr), tmp)); gfc_free_expr (to_expr2); gfc_init_se (&to_se, NULL); @@ -7449,7 +7470,7 @@ conv_intrinsic_move_alloc (gfc_code *code) /* Move the pointer and update the array descriptor data. */ gfc_add_modify_loc (input_location, &block, to_se.expr, from_se.expr); - /* Set "to" to NULL. */ + /* Set "from" to NULL. */ tmp = gfc_conv_descriptor_data_get (from_se.expr); gfc_add_modify_loc (input_location, &block, tmp, fold_convert (TREE_TYPE (tmp), null_pointer_node)); diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 9da9414c3a6..f10627295b8 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -5463,13 +5463,10 @@ Binary_expression::do_determine_type(const Type_context* context) // Give a useful error if that happened. if (tleft->is_abstract() && subcontext.type != NULL - && (this->left_->type()->integer_type() == NULL - || (subcontext.type->integer_type() == NULL - && subcontext.type->float_type() == NULL - && subcontext.type->complex_type() == NULL - && subcontext.type->interface_type() == NULL))) + && !subcontext.may_be_abstract + && subcontext.type->integer_type() == NULL) this->report_error(("invalid context-determined non-integer type " - "for shift operand")); + "for left operand of shift")); // The context for the right hand operand is the same as for the // left hand operand, except for a shift operator. diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c index 85b1ea4a5f3..73a58f03206 100644 --- a/gcc/lto-cgraph.c +++ b/gcc/lto-cgraph.c @@ -1368,7 +1368,9 @@ merge_profile_summaries (struct lto_file_decl_data **file_data_vec) so we need to account for a non-zero histogram entry at new_ix. */ unsigned new_ix = gcov_histo_index (scaled_min); lto_gcov_summary.histogram[new_ix].min_value - = MIN (lto_gcov_summary.histogram[new_ix].min_value, scaled_min); + = (lto_gcov_summary.histogram[new_ix].num_counters + ? MIN (lto_gcov_summary.histogram[new_ix].min_value, scaled_min) + : scaled_min); /* Some of the scaled counter values would ostensibly need to be placed into different (larger) histogram buckets, but we keep things simple here and place the scaled cumulative counter value in the bucket diff --git a/gcc/optabs.c b/gcc/optabs.c index 99fd02554fa..4f3cbb48916 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -7537,8 +7537,7 @@ expand_atomic_store (rtx mem, rtx val, enum memmodel model, bool use_release) } /* Otherwise assume stores are atomic, and emit the proper barriers. */ - if (model == MEMMODEL_SEQ_CST || model == MEMMODEL_RELEASE) - expand_mem_thread_fence (model); + expand_mem_thread_fence (model); emit_move_insn (mem, val); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e16352a3812..5276ca7d25e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,48 @@ +2012-12-16 Tobias Burnus <burnus@net-b.de> + + PR fortran/55197 + * gfortran.dg/gomp/use_intrinsic_1.f90: New. + +2012-12-16 Tobias Burnus <burnus@net-b.de> + + * gfortran.dg/move_alloc_14.f90: New. + +2012-12-16 Tobias Burnus <burnus@net-b.de> + + PR fortran/55638 + * gfortran.dg/elemental_args_check_3.f90: Update dg-error. + * gfortran.dg/elemental_args_check_7.f90: New. + +2012-12-15 Eric Botcazou <ebotcazou@adacore.com> + + * lib/scanasm.exp (get_ada_spec_filename): Use procedural form. + +2012-12-15 Eric Botcazou <ebotcazou@adacore.com> + + PR ada/52735 + * gnat.dg/nested_generic1.adb: New test. + * gnat.dg/nested_generic1_pkg.ad[sb]: New helper. + +2012-12-15 Eric Botcazou <ebotcazou@adacore.com> + + PR ada/53766 + * gnat.dg/controlled7.ad[sb]: New test. + +2012-12-14 Steve Ellcey <sellcey@mips.com> + + PR regression/55688 + * g++.dg/other/pr55650.C: Add dg-require-profiling. + +2012-12-14 Richard Biener <rguenther@suse.de> + + PR tree-optimization/55684 + * gcc.dg/torture/pr55684.c: New testcase. + +2012-12-14 Richard Biener <rguenther@suse.de> + + PR tree-optimization/55687 + * gcc.dg/torture/pr55687.c: New testcase. + 2012-12-13 Jakub Jelinek <jakub@redhat.com> PR c++/55652 diff --git a/gcc/testsuite/g++.dg/gomp/pr34964.C b/gcc/testsuite/g++.dg/gomp/pr34964.C index f5995a6da91..a02faa2a8d4 100644 --- a/gcc/testsuite/g++.dg/gomp/pr34964.C +++ b/gcc/testsuite/g++.dg/gomp/pr34964.C @@ -2,5 +2,5 @@ // { dg-do compile } // { dg-options "-fopenmp" } -char x[] = 0; // { dg-error "initializer fails to determine size" } +char x[] = 0; // { dg-error "initializer" } #pragma omp threadprivate (x) diff --git a/gcc/testsuite/g++.dg/init/array21.C b/gcc/testsuite/g++.dg/init/array21.C index f41ce86b1d9..5438af1d477 100644 --- a/gcc/testsuite/g++.dg/init/array21.C +++ b/gcc/testsuite/g++.dg/init/array21.C @@ -2,6 +2,6 @@ void foo() { - const int x[] = 0; // { dg-error "size" } + const int x[] = 0; // { dg-error "initializer" } ++x; } diff --git a/gcc/testsuite/g++.dg/init/array32.C b/gcc/testsuite/g++.dg/init/array32.C new file mode 100644 index 00000000000..06b27a94a8a --- /dev/null +++ b/gcc/testsuite/g++.dg/init/array32.C @@ -0,0 +1,7 @@ +// PR c++/42315 + +extern int x[]; + +int i = x[0]; + +int x[] = 0; // { dg-error "" } diff --git a/gcc/testsuite/g++.dg/other/pr55650.C b/gcc/testsuite/g++.dg/other/pr55650.C index fc52b19f5d3..c565b06ef49 100644 --- a/gcc/testsuite/g++.dg/other/pr55650.C +++ b/gcc/testsuite/g++.dg/other/pr55650.C @@ -1,5 +1,6 @@ // PR gcov-profile/55650 // { dg-do link } +// { dg-require-profiling "-fprofile-generate" } // { dg-options "-O2 -fprofile-generate" } // { dg-additional-sources "pr55650.cc" } diff --git a/gcc/testsuite/g++.dg/template/sizeof15.C b/gcc/testsuite/g++.dg/template/sizeof15.C new file mode 100644 index 00000000000..3298dad3f94 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/sizeof15.C @@ -0,0 +1,13 @@ +// PR c++/55685 + +typedef __SIZE_TYPE__ size_t; +template <size_t T, size_t U> +struct A; + +template <typename T> struct B +{ + static A <sizeof (T), 0> x; +}; + +template <typename T> +A <sizeof (T), 0> B <T>::x; diff --git a/gcc/testsuite/gcc.dg/torture/pr55684.c b/gcc/testsuite/gcc.dg/torture/pr55684.c new file mode 100644 index 00000000000..7002a3737f8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr55684.c @@ -0,0 +1,33 @@ +/* { dg-do compile } */ + +typedef struct _IO_FILE FILE; +unsigned long int strtoul(const char *, char **, int); +char *fgets(char *, int, FILE *); +struct ihexrec { + unsigned char reclen; + unsigned char data[256]; +}; +static void srec_readrec(struct ihexrec * srec, char * rec) +{ + int i, j; + char buf[8]; + int offset = 0, len; + char * e; + for (i=0; j<srec->reclen; j++) + { + if (offset+2 > len) + return; + for (i=0; i<2; i++) + buf[i] = rec[offset++]; + srec->data[j] = strtoul(buf, &e, 16); + } + for (i=0; i<2; i++) + buf[i] = rec[offset++]; +} +void srec2b(FILE *inf) +{ + char buffer[256]; + struct ihexrec srec; + while (fgets(buffer,256,inf)!=(void *)0) + srec_readrec(&srec, buffer); +} diff --git a/gcc/testsuite/gcc.dg/torture/pr55687.c b/gcc/testsuite/gcc.dg/torture/pr55687.c new file mode 100644 index 00000000000..1eab1a4f653 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr55687.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ + +typedef struct _IO_FILE FILE; +typedef short gshort; +typedef struct _GString GString; + +extern char *fgets(char *, int, FILE *); + +void verbose_text_loop (void *data) +{ + FILE *dev_vcs; + char buf[81]; + GString *buf_str; + gshort i, j; + while (1) + { + for (i = 1; i <= 7; i++) + { + while (fgets (buf, 81, dev_vcs)) + { + for (j = 0; j < __builtin_strlen (buf); j++) + if (buf[j] != ' ') + break; + for (; j < __builtin_strlen (buf); j++) + g_string_append_c_inline (buf_str, buf[j]); + } + } + } +} diff --git a/gcc/testsuite/gfortran.dg/elemental_args_check_3.f90 b/gcc/testsuite/gfortran.dg/elemental_args_check_3.f90 index 77111f1c519..8d638745794 100644 --- a/gcc/testsuite/gfortran.dg/elemental_args_check_3.f90 +++ b/gcc/testsuite/gfortran.dg/elemental_args_check_3.f90 @@ -13,7 +13,7 @@ CONTAINS (a, & ! { dg-error "must be scalar" } b, & ! { dg-error "POINTER attribute" } c, & ! { dg-error "ALLOCATABLE attribute" } - d) ! { dg-error "INTENT specified" } + d) ! { dg-error "must have its INTENT specified or have the VALUE attribute" } INTEGER, INTENT(IN) :: a(:) INTEGER, POINTER, INTENT(IN) :: b INTEGER, ALLOCATABLE, INTENT(IN) :: c diff --git a/gcc/testsuite/gfortran.dg/elemental_args_check_7.f90 b/gcc/testsuite/gfortran.dg/elemental_args_check_7.f90 new file mode 100644 index 00000000000..7b5843b950b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/elemental_args_check_7.f90 @@ -0,0 +1,26 @@ +! { dg-do compile } +! +! PR fortran/55638 +! +! Additionally, VALUE no INTENT is required (and only "intent(in)" allowed) +! + + elemental subroutine foo(x, y, z) + integer, intent(inout) :: x + integer, VALUE :: y + integer, VALUE, intent(in) :: z + x = y + end subroutine foo + + impure elemental subroutine foo2(x, y, z) ! { dg-error "Argument 'x' of elemental procedure 'foo2' at .1. must have its INTENT specified or have the VALUE attribute" } + integer :: x + integer, VALUE :: y + integer, VALUE :: z + x = y + end subroutine foo2 + + subroutine foo3(x, y, z) + integer, VALUE, intent(in) :: x + integer, VALUE, intent(inout) :: y ! { dg-error "VALUE attribute conflicts with INTENT.INOUT. attribute" } + integer, VALUE, intent(out) :: z ! { dg-error "VALUE attribute conflicts with INTENT.OUT. attribute" } + end subroutine foo3 diff --git a/gcc/testsuite/gfortran.dg/gomp/use_intrinsic_1.f90 b/gcc/testsuite/gfortran.dg/gomp/use_intrinsic_1.f90 new file mode 100644 index 00000000000..5996350301b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/use_intrinsic_1.f90 @@ -0,0 +1,11 @@ +! { dg-do compile } +! +! PR fortran/55197 +! +! Contributed by Erik Toussaint +! + +use, intrinsic :: omp_lib, only: omp_get_num_threads +use, intrinsic :: omp_lib_kinds , foo => omp_lock_kind +print *, foo +end diff --git a/gcc/testsuite/gfortran.dg/move_alloc_14.f90 b/gcc/testsuite/gfortran.dg/move_alloc_14.f90 new file mode 100644 index 00000000000..bc5e4916512 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/move_alloc_14.f90 @@ -0,0 +1,22 @@ +! { dg-do run } +! +! Ensure that move_alloc for CLASS resets the FROM variable's dynamic type +! to the declared one +! +implicit none +type t +end type t +type, extends(t) :: t2 +end type t2 + +class(t), allocatable :: a, b, c +class(t), allocatable :: a2(:), b2(:), c2(:) +allocate (t2 :: a) +allocate (t2 :: a2(5)) +call move_alloc (from=a, to=b) +call move_alloc (from=a2, to=b2) +!print *, same_type_as (a,c), same_type_as (a,b) +!print *, same_type_as (a2,c2), same_type_as (a2,b2) +if (.not. same_type_as (a,c) .or. same_type_as (a,b)) call abort () +if (.not. same_type_as (a2,c2) .or. same_type_as (a2,b2)) call abort () +end diff --git a/gcc/testsuite/gnat.dg/controlled7.adb b/gcc/testsuite/gnat.dg/controlled7.adb new file mode 100644 index 00000000000..bdcf67ac466 --- /dev/null +++ b/gcc/testsuite/gnat.dg/controlled7.adb @@ -0,0 +1,18 @@ +-- PR ada/53766 +-- Reported by Duncan Sands <baldrick@gcc.gnu.org> + +-- { dg-do compile } +-- { dg-options "-gnatp" } + +with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; + +package body Controlled7 is + + procedure Proc (Offset : Storage_Offset) is + begin + if Offset + Unbounded_String'Max_Size_In_Storage_Elements >= 16 then + raise Program_Error; + end if; + end; + +end Controlled7; diff --git a/gcc/testsuite/gnat.dg/controlled7.ads b/gcc/testsuite/gnat.dg/controlled7.ads new file mode 100644 index 00000000000..672a8e7a721 --- /dev/null +++ b/gcc/testsuite/gnat.dg/controlled7.ads @@ -0,0 +1,7 @@ +with System.Storage_Elements; use System.Storage_Elements; + +package Controlled7 is + + procedure Proc (Offset : Storage_Offset); + +end Controlled7; diff --git a/gcc/testsuite/gnat.dg/nested_generic1.adb b/gcc/testsuite/gnat.dg/nested_generic1.adb new file mode 100644 index 00000000000..1a20cdf5d4b --- /dev/null +++ b/gcc/testsuite/gnat.dg/nested_generic1.adb @@ -0,0 +1,12 @@ +-- PR ada/52735 +-- Reported by Per Sandberg <per.sandberg@bredband.net> + +-- { dg-do compile } + +with Nested_Generic1_Pkg; + +procedure Nested_Generic1 is + package P is new Nested_Generic1_Pkg; +begin + null; +end; diff --git a/gcc/testsuite/gnat.dg/nested_generic1_pkg.adb b/gcc/testsuite/gnat.dg/nested_generic1_pkg.adb new file mode 100644 index 00000000000..12276261395 --- /dev/null +++ b/gcc/testsuite/gnat.dg/nested_generic1_pkg.adb @@ -0,0 +1,11 @@ +package body Nested_Generic1_Pkg is + + procedure Image_Generic + (Renderer : in not null Element_Renderer) is + begin + null; + end; + + procedure Image_Standard_Instance is new Image_Generic; + +end Nested_Generic1_Pkg; diff --git a/gcc/testsuite/gnat.dg/nested_generic1_pkg.ads b/gcc/testsuite/gnat.dg/nested_generic1_pkg.ads new file mode 100644 index 00000000000..a783388a69e --- /dev/null +++ b/gcc/testsuite/gnat.dg/nested_generic1_pkg.ads @@ -0,0 +1,8 @@ +generic +package Nested_Generic1_Pkg is + + type Element_Renderer is access procedure; + + generic procedure Image_Generic (Renderer : in not null Element_Renderer); + +end Nested_Generic1_Pkg; diff --git a/gcc/testsuite/lib/scanasm.exp b/gcc/testsuite/lib/scanasm.exp index 598948e8147..a7d4f43b1a6 100644 --- a/gcc/testsuite/lib/scanasm.exp +++ b/gcc/testsuite/lib/scanasm.exp @@ -191,7 +191,7 @@ proc get_ada_spec_filename { testcase } { set filename [lindex $testcase 0] set tailname [file tail $filename] set extension [string trimleft [file extension $tailname] {.}] - set rootname [regsub -all {\-} [file rootname $tailname] {_}] + regsub -all {\-} [file rootname $tailname] {_} rootname return [string tolower "${rootname}_${extension}.ads"] } diff --git a/gcc/tree-chrec.h b/gcc/tree-chrec.h index 6d61d5fa8ea..db3f3bfe8cc 100644 --- a/gcc/tree-chrec.h +++ b/gcc/tree-chrec.h @@ -117,7 +117,7 @@ no_evolution_in_loop_p (tree chrec, unsigned loop_num, bool *res) STRIP_NOPS (chrec); scev = hide_evolution_in_other_loops_than_loop (chrec, loop_num); - *res = !tree_is_chrec (scev); + *res = !tree_contains_chrecs (scev, NULL); return true; } diff --git a/gcc/tree-mudflap.c b/gcc/tree-mudflap.c index 9b9c549a19b..90d04489188 100644 --- a/gcc/tree-mudflap.c +++ b/gcc/tree-mudflap.c @@ -877,6 +877,9 @@ mf_xform_derefs_1 (gimple_stmt_iterator *iter, tree *tp, break; case MEM_REF: + if (addr_expr_of_non_mem_decl_p (TREE_OPERAND (t, 0))) + return; + addr = fold_build_pointer_plus_loc (location, TREE_OPERAND (t, 0), TREE_OPERAND (t, 1)); base = addr; @@ -886,6 +889,9 @@ mf_xform_derefs_1 (gimple_stmt_iterator *iter, tree *tp, break; case TARGET_MEM_REF: + if (addr_expr_of_non_mem_decl_p (TMR_BASE (t))) + return; + addr = tree_mem_ref_addr (ptr_type_node, t); base = addr; limit = fold_build_pointer_plus_hwi_loc (location, diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c index d54f704725a..eef613c4a77 100644 --- a/gcc/tree-ssa-loop-ivcanon.c +++ b/gcc/tree-ssa-loop-ivcanon.c @@ -555,9 +555,8 @@ remove_redundant_iv_tests (struct loop *loop) /* Only when we know the actual number of iterations, not just a bound, we can remove the exit. */ if (!number_of_iterations_exit (loop, exit_edge, - &niter, false, false)) - gcc_unreachable (); - if (!integer_onep (niter.assumptions) + &niter, false, false) + || !integer_onep (niter.assumptions) || !integer_zerop (niter.may_be_zero) || !niter.niter || TREE_CODE (niter.niter) != INTEGER_CST diff --git a/gcc/tree.h b/gcc/tree.h index 9f17253fbf8..01e81b2ee19 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -6304,6 +6304,9 @@ extern unsigned HOST_WIDE_INT compute_builtin_object_size (tree, int); succeed. */ extern int can_move_by_pieces (unsigned HOST_WIDE_INT, unsigned int); +/* Is it an ADDR_EXPR of a DECL that's not in memory? */ +extern bool addr_expr_of_non_mem_decl_p (tree); + extern unsigned HOST_WIDE_INT highest_pow2_factor (const_tree); extern tree build_personality_function (const char *); diff --git a/gcc/varasm.c b/gcc/varasm.c index bca852dc4e8..daeb6e2a829 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -2088,6 +2088,11 @@ contains_pointers_p (tree type) it all the way to final. See PR 17982 for further discussion. */ static GTY(()) tree pending_assemble_externals; +/* Some targets delay some output to final using TARGET_ASM_FILE_END. + As a result, assemble_external can be called after the list of externals + is processed and the pointer set destroyed. */ +static bool pending_assemble_externals_processed; + #ifdef ASM_OUTPUT_EXTERNAL /* Avoid O(external_decls**2) lookups in the pending_assemble_externals TREE_LIST in assemble_external. */ @@ -2144,6 +2149,7 @@ process_pending_assemble_externals (void) assemble_external_real (TREE_VALUE (list)); pending_assemble_externals = 0; + pending_assemble_externals_processed = true; pointer_set_destroy (pending_assemble_externals_set); #endif } @@ -2196,6 +2202,12 @@ assemble_external (tree decl ATTRIBUTE_UNUSED) weak_decls = tree_cons (NULL, decl, weak_decls); #ifdef ASM_OUTPUT_EXTERNAL + if (pending_assemble_externals_processed) + { + assemble_external_real (decl); + return; + } + if (! pointer_set_insert (pending_assemble_externals_set, decl)) pending_assemble_externals = tree_cons (NULL, decl, pending_assemble_externals); |