1. 15 Aug, 2014 6 commits
  2. 14 Aug, 2014 33 commits
    • re PR tree-optimization/62091 (ice in before_dom_children) · 80b6ba28
      
      	PR tree-optimization/62091
      	* g++.dg/ipa/devirt-38.C: New testcase.
      	* tree-ssa-alias.c (walk_aliased_vdefs_1): Do not clear
      	function_entry_reached.
      	(walk_aliased_vdefs): Clear it here.
      	* ipa-devirt.c (check_stmt_for_type_change): Handle static storage.
      
      From-SVN: r213991
      Jan Hubicka committed
    • ipa-utils.h (compare_virtual_tables): Declare. · 56b1f114
      	* ipa-utils.h (compare_virtual_tables): Declare.
      	* ipa-devirt.c (odr_subtypes_equivalent_p): New function
      
      	* lto-symtab.c (lto_varpool_replace_node): Call compare_virtual_tables.
      
      From-SVN: r213990
      Jan Hubicka committed
    • typeck.c (composite_pointer_type, [...]): When a pedwarn is suppressed under… · aa0a659c
      typeck.c (composite_pointer_type, [...]): When a pedwarn is suppressed under SFINAE, return error_mark_node.
      
      2014-08-14  Paolo Carlini  <paolo.carlini@oracle.com>
      
      	* typeck.c (composite_pointer_type, cxx_sizeof_or_alignof_type,
      	cp_build_array_ref, cp_build_function_call_vec): When a
      	pedwarn is suppressed under SFINAE, return error_mark_node.
      
      	* typeck.c (cxx_sizeof_or_alignof_type): Fix complain &
      	tf_warning_or_error, where complain is a bool, glitch.
      
      From-SVN: r213983
      Paolo Carlini committed
    • DR 458 · 0ee9c843
      	DR 458
      	* ginclude/stdatomic.h (__atomic_type_lock_free): Remove.
      	(ATOMIC_*_LOCK_FREE): Map to __GCC_ATOMIC_*_LOCK_FREE.
      
      	* gcc.dg/c11-stdatomic-2.c: New test.
      
      From-SVN: r213981
      Marek Polacek committed
    • re PR fortran/62106 (Adding a scalar variable to an array constructor gives wrong result) · ba8aa6fc
      2014-08-14  Thomas Koenig  <tkoenig@gcc.gnu.org>
      
      	PR fortran/62106
      	* gfortran.h (symbol_attribute):  Add fe_temp flag.
      	* frontend-passes.c (is_fe_temp):  New function.
      	(create_var):  Don't add a temporary for an already
      	created variable or for a constant.
      	(combine_ARRAY_constructor):  Remove special handling
      	for constants.
      
      2014-08-14  Thomas Koenig  <tkoenig@gcc.gnu.org>
      
      	PR fortran/62106
      	* gfortran.dg/array_constructor_49.f90:  New test.
      
      From-SVN: r213980
      Thomas Koenig committed
    • gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL. · bc0229f9
      gcc/fortran/
      2014-08-14  Tobias Burnus  <burnus@net-b.de>
      
              * gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
              (_gfortran_caf_register): Update for locking/critical.
              (_gfortran_caf_lock, _gfortran_caf_unlock): Add.
              * resolve.c (resolve_critical): New.
              (gfc_resolve_code): Call it.
              * trans-decl.c (gfor_fndecl_caf_critical,
              gfor_fndecl_caf_end_critical): Remove.
              (gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
              (gfc_build_builtin_function_decls): Remove critical,
              assign locking declarations.
              (generate_coarray_sym_init): Handle locking and
              critical variables.
              * trans-stmt.c (gfc_trans_critical): Add calls to
              lock/unlock libcaf functions.
              * trans.h (gfc_coarray_type): Update locking, add
              critical enum values.
              (gfor_fndecl_caf_critical, gfor_fndecl_caf_end_critical): Remove.
              (gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
      
      libgfortran/
      2014-08-14  Tobias Burnus  <burnus@net-b.de>
      
              * caf/libcaf.h (caf_register_t): Update for critical.
              (_gfortran_caf_critical, _gfortran_caf_end_critical): Remove.
              (_gfortran_caf_lock, _gfortran_caf_unlock): Add.
              * caf/single.c (_gfortran_caf_register): Handle locking
              variables.
              (_gfortran_caf_sendget): Re-name args for consistency.
              (_gfortran_caf_lock, _gfortran_caf_unlock): Add.
      
      From-SVN: r213979
      Tobias Burnus committed
    • gfortran.texi (Coarray Programming): Add first ABI documentation. · c194537c
      2014-08-14  Tobias Burnus  <burnus@net-b.de>
      
              * gfortran.texi (Coarray Programming): Add first ABI
              documentation.
      
      From-SVN: r213978
      Tobias Burnus committed
    • Fix ChangeLog entry · 9c8d7ac2
      From-SVN: r213976
      Tom de Vries committed
    • Remove duplicate declaration of mem_attrs_eq_p · 451d542e
      2014-08-14  Tom de Vries  <tom@codesourcery.com>
      
      	* emit-rtl.h (mem_attrs_eq_p): Remove duplicate declaration.
      
      From-SVN: r213975
      Tom de Vries committed
    • re PR c++/62101 (deleted definitions of friend functions are rejected) · 5d9607f0
      	PR c++/62101
      	* decl.c (grokdeclarator): Move the check for friend initializers..
      	* decl2.c (grokfield) ..here. Postpone early return for friends
      	until after the initializer check.
      
      From-SVN: r213974
      Ville Voutilainen committed
    • re PR c++/54377 (Consider default arguments in "wrong number of template arguments" diagnostic) · a62dbaa4
      /cp
      2014-08-14  Paolo Carlini  <paolo.carlini@oracle.com>
      
      	PR c++/54377
      	* pt.c (coerce_template_parms): Improve error message vs default
      	arguments.
      
      /testsuite
      2014-08-14  Paolo Carlini  <paolo.carlini@oracle.com>
      
      	PR c++/54377
      	* g++.dg/template/pr54377.C: New.
      	* g++.dg/cpp0x/pr54377.C: Likewise.
      	* g++.dg/cpp0x/alias-decl-2.C: Adjust.
      	* g++.dg/cpp0x/pr51226.C: Likewise.
      	* g++.dg/cpp0x/variadic2.C: Likewise.
      	* g++.dg/parse/too-many-tmpl-args1.C: Likewise.
      	* g++.dg/template/dtor3.C: Likewise.
      	* g++.dg/template/qualttp4.C: Likewise.
      	* g++.dg/template/spec28.C: Likewise.
      	* g++.old-deja/g++.brendan/crash8.C: Likewise.
      	* g++.old-deja/g++.pt/ttp7.C: Likewise.
      
      From-SVN: r213973
      Paolo Carlini committed
    • re PR fortran/62076 (testsuite failure in udr2.90) · 4875c29c
      	PR fortran/62076
      	* openmp.c (gfc_match_omp_clauses): When failed to match
      	operator name, defined op name or name, set buffer to
      	empty string.  Don't call gfc_find_omp_udr if buffer is empty
      	string.
      	(gfc_match_omp_declare_reduction): Call gfc_undo_symbols ()
      	before calling gfc_free_omp_udr.
      
      From-SVN: r213971
      Jakub Jelinek committed
    • Fix if-conversion pass for dead type-unsafe code · df5d402a
      2014-08-14  Tom de Vries  <tom@codesourcery.com>
      
      	PR rtl-optimization/62004
      	PR rtl-optimization/62030
      	* ifcvt.c (rtx_interchangeable_p): New function.
      	(noce_try_move, noce_process_if_block): Use rtx_interchangeable_p.
      	* emit-rtl.h (mem_attrs_eq_p): Declare.
      
      	* gcc.dg/pr62004.c: New test.
      	* gcc.dg/pr62030.c: Same.
      	* gcc.target/mips/pr62030-octeon.c: Same.
      
      From-SVN: r213970
      Tom de Vries committed
    • graphite-scop-detection.c: Add inclusion of cp-tree.h. · 821fce24
      
      [gcc/]
      
      	* graphite-scop-detection.c:
      	Add inclusion of cp-tree.h.
      	(graphite_can_represent_scev): Disables the handling of SSA_NAME nodes
      	in case they are pointers to object types
      
      From-SVN: r213969
      Roman Gareev committed
    • BASE-VER: Change to 5.0.0 · 2813008e
      2014-08-14  Richard Biener  <rguenther@suse.de>
      
      	* BASE-VER: Change to 5.0.0
      
      From-SVN: r213968
      Richard Biener committed
    • crontab: Change trunk snapshots from 4.10 to 5. · b50eee73
      2014-08-14  Richard Biener  <rguenther@suse.de>
      
      	* crontab: Change trunk snapshots from 4.10 to 5.
      
      From-SVN: r213967
      Richard Biener committed
    • sse.md (define_mode_attr avx512): New. · 8b994297
      gcc/
              * config/i386/sse.md (define_mode_attr avx512): New.
      	(define_mode_attr sse2_avx_avx512f): Allow V8HI, V16HI, V32HI, V2DI,
      	V4DI modes.
      	(define_mode_attr sse2_avx2): Allow V64QI, V32HI, V4TI modes.
      	(define_mode_attr ssse3_avx2): Ditto.
      	(define_mode_attr sse4_1_avx2): Allow V64QI, V32HI, V8DI modes.
      	(define_mode_attr avx2_avx512bw): New.
      	(define_mode_attr ssedoublemodelower): New.
      	(define_mode_attr ssedoublemode): Allow V8SF, V8SI, V4DI, V4DF, V4SI,
      	V32HI, V64QI modes.
      	(define_mode_attr ssebytemode): Allow V8DI modes.
      	(define_mode_attr sseinsnmode): Allow V4TI, V32HI, V64QI modes.
      	(define_mode_attr sseintvecmodelower): Allow V8DF, V4TI modes.
      	(define_mode_attr ssePSmode2): New.
      	(define_mode_attr ssescalarsize): Allow V64QI, V32QI, V16QI, V8HI,
      	V16HI, V32HI modes.
      	(define_mode_attr dbpsadbwmode): New.
      	(define_mode_attr bcstscalarsuff): Allow V64QI, V32QI, V16QI, V32HI,
      	V16HI, V8HI, V8SI, V4SI, V4DI, V2DI, V8SF, V4SF, V4DF, V2DF modes.
      	(vi8_sse4_1_avx2_avx512): New.
      	(define_insn <sse4_1_avx2>_movntdqa): Use <vi8_sse4_1_avx2_avx512>
      	mode attribute.
      	(define_mode_attr blendbits): Move before its immediate use.
      
      
      Co-Authored-By: Andrey Turetskiy <andrey.turetskiy@intel.com>
      Co-Authored-By: Anna Tikhonova <anna.tikhonova@intel.com>
      Co-Authored-By: Ilya Tocar <ilya.tocar@intel.com>
      Co-Authored-By: Ilya Verbin <ilya.verbin@intel.com>
      Co-Authored-By: Kirill Yukhin <kirill.yukhin@intel.com>
      Co-Authored-By: Maxim Kuznetsov <maxim.kuznetsov@intel.com>
      Co-Authored-By: Michael Zolotukhin <michael.v.zolotukhin@intel.com>
      
      From-SVN: r213966
      Alexander Ivchenko committed
    • sse.md: Allow V64QI, V32QI, V32HI, V4HI modes. · 2534573e
      gcc/
      	* config/i386/sse.md: Allow V64QI, V32QI, V32HI, V4HI modes.
      	* config/i386/subst.md
      	(define_mode_iterator SUBST_V): Update.
      	(define_mode_iterator SUBST_A): Ditto.
      	(define_subst_attr "mask_operand7"): New.
      	(define_subst_attr "mask_operand10"): New.
      	(define_subst_attr "mask_operand_arg34") : New.
      	(define_subst_attr "mask_expand_op3"): New.
      	(define_subst_attr "mask_mode512bit_condition"): Handle TARGET_AVX512VL.
      	(define_subst_attr "sd_mask_mode512bit_condition"): Ditto.
      	(define_subst_attr "mask_avx512vl_condition"): New.
      	(define_subst_attr "round_mask_operand4"): Ditto.
      	(define_subst_attr "round_mask_scalar_op3"): Delete.
      	(define_subst_attr "round_mask_op4"): New.
      	(define_subst_attr "round_mode512bit_condition"): Allow V8DImode,
      	V16SImode.
      	(define_subst_attr "round_modev8sf_condition"): New.
      	(define_subst_attr "round_modev4sf_condition"): GET_MODE instead of
      	<MODE>mode.
      	(define_subst_attr "round_saeonly_mask_operand4"): New.
      	(define_subst_attr "round_saeonly_mask_op4"): New.
      	(define_subst_attr "round_saeonly_mode512bit_condition"): Allow
      	V8DImode, V16SImode.
      	(define_subst_attr "round_saeonly_modev8sf_condition"): New.
      	(define_subst_attr "mask_expand4_name" "mask_expand4"): New.
      	(define_subst_attr "mask_expand4_args"): New.
      	(define_subst "mask_expand4"): New.
      
      
      Co-Authored-By: Andrey Turetskiy <andrey.turetskiy@intel.com>
      Co-Authored-By: Anna Tikhonova <anna.tikhonova@intel.com>
      Co-Authored-By: Ilya Tocar <ilya.tocar@intel.com>
      Co-Authored-By: Ilya Verbin <ilya.verbin@intel.com>
      Co-Authored-By: Kirill Yukhin <kirill.yukhin@intel.com>
      Co-Authored-By: Maxim Kuznetsov <maxim.kuznetsov@intel.com>
      Co-Authored-By: Michael Zolotukhin <michael.v.zolotukhin@intel.com>
      
      From-SVN: r213965
      Alexander Ivchenko committed
    • i386.md (define_attr "isa"): Add avx512bw,noavx512bw. · e2131cc7
      gcc/
              * config/i386/i386.md
      	(define_attr "isa"): Add avx512bw,noavx512bw.
      	(define_attr "enabled"): Ditto.
      	(define_split): Add 32/64-bit mask logic.
      	(define_insn "*k<logic>qi"): New.
      	(define_insn "*k<logic>hi"): New.
      	(define_insn "*anddi_1"): Add mask version.
      	(define_insn "*andsi_1"): Ditto.
      	(define_insn "*<code><mode>_1"): Ditto.
      	(define_insn "*<code>hi_1"): Ditto.
      	(define_insn "kxnor<mode>"): New.
      	(define_insn "kunpcksi"): New.
      	(define_insn "kunpckdi"): New.
      	(define_insn "*one_cmpl<mode>2_1"): Add mask version.
      	(define_insn "*one_cmplhi2_1"): Ditto.
      
      
      Co-Authored-By: Andrey Turetskiy <andrey.turetskiy@intel.com>
      Co-Authored-By: Anna Tikhonova <anna.tikhonova@intel.com>
      Co-Authored-By: Ilya Tocar <ilya.tocar@intel.com>
      Co-Authored-By: Ilya Verbin <ilya.verbin@intel.com>
      Co-Authored-By: Kirill Yukhin <kirill.yukhin@intel.com>
      Co-Authored-By: Maxim Kuznetsov <maxim.kuznetsov@intel.com>
      Co-Authored-By: Michael Zolotukhin <michael.v.zolotukhin@intel.com>
      
      From-SVN: r213964
      Alexander Ivchenko committed
    • i386.c (ix86_preferred_simd_mode): Allow V64QImode and V32HImode. · 1d944b8a
      gcc/
      	* config/i386/i386.c (ix86_preferred_simd_mode): Allow V64QImode and
      	V32HImode.
      
      
      Co-Authored-By: Andrey Turetskiy <andrey.turetskiy@intel.com>
      Co-Authored-By: Anna Tikhonova <anna.tikhonova@intel.com>
      Co-Authored-By: Ilya Tocar <ilya.tocar@intel.com>
      Co-Authored-By: Ilya Verbin <ilya.verbin@intel.com>
      Co-Authored-By: Kirill Yukhin <kirill.yukhin@intel.com>
      Co-Authored-By: Maxim Kuznetsov <maxim.kuznetsov@intel.com>
      Co-Authored-By: Michael Zolotukhin <michael.v.zolotukhin@intel.com>
      
      From-SVN: r213963
      Alexander Ivchenko committed
    • i386.c (print_reg): Сorrectly print 64-bit mask registers. · 9e4a4dd6
      gcc/
      	* config/i386/i386.c (print_reg): Сorrectly print 64-bit mask
      	registers.
      	(inline_secondary_memory_needed): Allow 64 bit wide mask registers.
      	(ix86_hard_regno_mode_ok): Allow 32/64-bit mask registers and
      	xmm/ymm16+ when availble.
      	* config/i386/i386.h
      	(HARD_REGNO_NREGS): Add mask regs.
      	(VALID_AVX512F_REG_MODE): Ditto.
      	(VALID_AVX512F_REG_MODE) : Define.
      	(VALID_MASK_AVX512BW_MODE): Ditto.
      	(reg_class) (MASK_REG_P(X)): Define.
      	* config/i386/i386.md: Do not split long moves with mask register,
      	use kmovb if avx512bw is availible.
      	(movdi_internal): Handle mask registers.
      
      
      Co-Authored-By: Andrey Turetskiy <andrey.turetskiy@intel.com>
      Co-Authored-By: Anna Tikhonova <anna.tikhonova@intel.com>
      Co-Authored-By: Ilya Tocar <ilya.tocar@intel.com>
      Co-Authored-By: Ilya Verbin <ilya.verbin@intel.com>
      Co-Authored-By: Kirill Yukhin <kirill.yukhin@intel.com>
      Co-Authored-By: Maxim Kuznetsov <maxim.kuznetsov@intel.com>
      Co-Authored-By: Michael Zolotukhin <michael.v.zolotukhin@intel.com>
      
      From-SVN: r213962
      Alexander Ivchenko committed
    • re PR tree-optimization/62081 (ICE: in fix_loop_structure, at loop-init.c:208… · 7d39012c
      re PR tree-optimization/62081 (ICE: in fix_loop_structure, at loop-init.c:208 with -fno-tree-ch -fno-tree-cselim -fno-tree-dominator-opts -fno-tree-reassoc -fno-tree-sink)
      
      2014-08-14  Richard Biener  <rguenther@suse.de>
      
      	PR tree-optimization/62081
      	* tree-ssa-loop.c (pass_fix_loops): New pass.
      	(pass_tree_loop::gate):  Do not fixup loops here.
      	* tree-pass.h (make_pass_fix_loops): Declare.
      	* passes.def: Schedule pass_fix_loops before GIMPLE loop passes.
      
      From-SVN: r213961
      Richard Biener committed
    • re PR lto/62067 (lto-lang.c:549: too many calls to va_end on some code paths ?) · 833f94c0
      2014-08-14  Richard Biener  <rguenther@suse.de>
      
      	PR lto/62067
      	* lto-lang.c (def_fn_type): Fix error handling wrt va_end.
      
      From-SVN: r213960
      Richard Biener committed
    • requirements: Remove empty directory. · e8af7616
      2014-08-14  Matthias Klose  <doko@ubuntu.com>
      
              * testsuite/ext/random/uniform_on_sphere_distribution/requirements:
              Remove empty directory.
      
      From-SVN: r213958
      Matthias Klose committed
    • tree.c (type_hash_lookup, [...]): Merge into ... · 0cff9154
      2014-08-14  Richard Biener  <rguenther@suse.de>
      
      	* tree.c (type_hash_lookup, type_hash_add): Merge into ...
      	(type_hash_canon): ... this and avoid 2nd lookup for the add.
      
      From-SVN: r213956
      Richard Biener committed
    • parser.c (cp_parser_init_declarator): Remove redundant check of decl_specifiers->type. · 215acd2b
      /gcc/cp
      2014-08-14  Paolo Carlini  <paolo.carlini@oracle.com>
      
      	* parser.c (cp_parser_init_declarator): Remove redundant check of
      	decl_specifiers->type.
      
      /gcc/testsuite
      2014-08-14  Paolo Carlini  <paolo.carlini@oracle.com>
      
      	* g++.dg/cpp0x/alias-decl-4.C: Adjust for parser change.
      	* g++.dg/cpp0x/decltype2.C: Likewise.
      	* g++.dg/cpp0x/decltype3.C: Likewise.
      	* g++.dg/cpp0x/pr60249.C: Likewise.
      	* g++.dg/cpp0x/variadic-ex10.C: Likewise.
      	* g++.dg/cpp0x/variadic-ex14.C: Likewise.
      	* g++.dg/cpp0x/variadic2.C: Likewise.
      	* g++.dg/cpp0x/variadic74.C: Likewise.
      	* g++.dg/parse/error10.C: Likewise.
      	* g++.dg/parse/error15.C: Likewise.
      	* g++.dg/parse/error2.C: Likewise.
      	* g++.dg/template/crash106.C: Likewise.
      	* g++.dg/template/crash89.C: Likewise.
      	* g++.dg/template/nontype7.C: Likewise.
      	* g++.dg/template/void3.C: Likewise.
      	* g++.dg/template/void7.C: Likewise.
      
      /libstdc++-v3
      2014-08-14  Paolo Carlini  <paolo.carlini@oracle.com>
      
      	* testsuite/26_numerics/random/linear_congruential_engine/
      	requirements/non_uint_neg.cc: Adjust for parser change.
      	* testsuite/tr1/5_numerical_facilities/random/linear_congruential/
      	requirements/non_uint_neg.cc: Likewise.
      
      From-SVN: r213952
      Paolo Carlini committed
    • re PR middle-end/62090 (ice in compute_may_aliases) · 35770bb2
      2014-08-14  Richard Biener  <rguenther@suse.de>
      
      	PR tree-optimization/62090
      	* builtins.c (fold_builtin_sprintf): Move to gimple-fold.c.
      	(fold_builtin_2): Do not fold sprintf.
      	(fold_builtin_3): Likewise.
      	* gimple-fold.c (gimple_fold_builtin_sprintf): New function
      	moved from builtins.c.
      	(gimple_fold_builtin): Fold sprintf.
      
      	* gcc.dg/pr62090.c: New testcase.
      
      From-SVN: r213951
      Richard Biener committed
    • re PR tree-optimization/62079 (ICE: in calc_dfs_tree, at dominance.c:401 with… · 121bc7dc
      re PR tree-optimization/62079 (ICE: in calc_dfs_tree, at dominance.c:401 with -fnon-call-exceptions)
      
      2014-08-14  Richard Biener  <rguenther@suse.de>
      
      	PR rtl-optimization/62079
      	* recog.c (peephole2_optimize): If peep2_do_cleanup_cfg
      	run cleanup_cfg.
      
      	* g++.dg/pr62079.C: New testcase.
      
      From-SVN: r213950
      Richard Biener committed
    • ipa-devirt.c (get_polymorphic_call_info): Use fndecl instead of current_function_decl. · 8e857bbf
      gcc/
      	* ipa-devirt.c (get_polymorphic_call_info): Use fndecl instead of
      	current_function_decl.
      
      From-SVN: r213947
      Ilya Enkovich committed
    • cgraph.c (cgraph_node::function_symbol): Fix wrong cgraph_function_node to… · 1113596f
      cgraph.c (cgraph_node::function_symbol): Fix wrong cgraph_function_node to cgraph_node::function_symbol refactoring.
      
      gcc/
      	* cgraph.c (cgraph_node::function_symbol): Fix wrong
      	cgraph_function_node to cgraph_node::function_symbol
      	refactoring.
      
      From-SVN: r213946
      Ilya Enkovich committed
    • arm.c (arm_option_override): Set max_insns_skipped to MAX_INSN_PER_IT_BLOCK when… · 4d2df0f4
      arm.c (arm_option_override): Set max_insns_skipped to MAX_INSN_PER_IT_BLOCK when optimize_size for THUMB2.
      
      ChangeLog:
      2014-08-14  Zhenqiang Chen  <zhenqiang.chen@arm.com>
      
      	* config/arm/arm.c (arm_option_override): Set max_insns_skipped
      	to MAX_INSN_PER_IT_BLOCK when optimize_size for THUMB2.
      
      testsuite/ChangeLog:
      2014-08-14  Zhenqiang Chen  <zhenqiang.chen@arm.com>
      
      	* gcc.target/arm/max-insns-skipped.c: New test.
      
      From-SVN: r213939
      Zhenqiang Chen committed
    • addrtmp.c: Add bind_pic_locally option. · 0b3a20e3
      
      	testcases
      	* c-c++-common/addrtmp.c: Add bind_pic_locally option.
      
      From-SVN: r213937
      Bin Cheng committed
    • Daily bump. · bc54cc9a
      From-SVN: r213936
      GCC Administrator committed
  3. 13 Aug, 2014 1 commit
    • compiler, runtime: Fix unexpected GC interfering with closure passing. · 798c183f
      The Go frontend passes closures through to functions using the
      functions __go_set_closure and __go_get_closure.  The
      expectation is that there are no function calls between
      set_closure and get_closure.  However, it turns out that there
      can be function calls if some of the function arguments
      require type conversion to an interface type.  Converting to
      an interface type can allocate memory, and that can in turn
      trigger a garbage collection, and that can in turn call pool
      cleanup functions that may call __go_set_closure.  So the
      called function can see the wrong closure value, which is bad.
      
      This patch fixes the problem in two different ways.  First, we
      move all type conversions in function arguments into temporary
      variables so that they can not appear before the call to
      __go_set_closure.  (This required shifting the flatten phase
      after the simplify_thunk phase, since the latter expects to
      work with unconverted argument types.)  Second, we fix the
      memory allocation function to preserve the closure value
      across any possible garbage collection.
      
      A test case is the libgo database/sql check run with the
      environment variable GOGC set to 1.
      
      From-SVN: r213932
      Ian Lance Taylor committed