Index: libstdc++-v3/include/debug/functions.h =================================================================== --- libstdc++-v3/include/debug/functions.h (.../tags/gcc_4_8_2_release) (revision 204344) +++ libstdc++-v3/include/debug/functions.h (.../branches/gcc-4_8-branch) (revision 204344) @@ -345,11 +345,13 @@ return __check_sorted_set_aux(__first, __last, __pred, _SameType()); } + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 270. Binary search requirements overly strict + // Determine if a sequence is partitioned w.r.t. this element. template inline bool - __check_partitioned_lower_aux(_ForwardIterator __first, - _ForwardIterator __last, const _Tp& __value, - std::forward_iterator_tag) + __check_partitioned_lower(_ForwardIterator __first, + _ForwardIterator __last, const _Tp& __value) { while (__first != __last && *__first < __value) ++__first; @@ -362,38 +364,11 @@ return __first == __last; } - // For performance reason, as the iterator range has been validated, check on - // random access safe iterators is done using the base iterator. - template - inline bool - __check_partitioned_lower_aux( - const _Safe_iterator<_Iterator, _Sequence>& __first, - const _Safe_iterator<_Iterator, _Sequence>& __last, - const _Tp& __value, - std::random_access_iterator_tag __tag) - { - return __check_partitioned_lower_aux(__first.base(), __last.base(), - __value, __tag); - } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 270. Binary search requirements overly strict - // Determine if a sequence is partitioned w.r.t. this element. template inline bool - __check_partitioned_lower(_ForwardIterator __first, + __check_partitioned_upper(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) { - return __check_partitioned_lower_aux(__first, __last, __value, - std::__iterator_category(__first)); - } - - template - inline bool - __check_partitioned_upper_aux(_ForwardIterator __first, - _ForwardIterator __last, const _Tp& __value, - std::forward_iterator_tag) - { while (__first != __last && !(__value < *__first)) ++__first; if (__first != __last) @@ -405,35 +380,12 @@ return __first == __last; } - // For performance reason, as the iterator range has been validated, check on - // random access safe iterators is done using the base iterator. - template - inline bool - __check_partitioned_upper_aux( - const _Safe_iterator<_Iterator, _Sequence>& __first, - const _Safe_iterator<_Iterator, _Sequence>& __last, - const _Tp& __value, - std::random_access_iterator_tag __tag) - { - return __check_partitioned_upper_aux(__first.base(), __last.base(), - __value, __tag); - } - - template - inline bool - __check_partitioned_upper(_ForwardIterator __first, - _ForwardIterator __last, const _Tp& __value) - { - return __check_partitioned_upper_aux(__first, __last, __value, - std::__iterator_category(__first)); - } - + // Determine if a sequence is partitioned w.r.t. this element. template inline bool - __check_partitioned_lower_aux(_ForwardIterator __first, - _ForwardIterator __last, const _Tp& __value, - _Pred __pred, - std::forward_iterator_tag) + __check_partitioned_lower(_ForwardIterator __first, + _ForwardIterator __last, const _Tp& __value, + _Pred __pred) { while (__first != __last && bool(__pred(*__first, __value))) ++__first; @@ -446,39 +398,12 @@ return __first == __last; } - // For performance reason, as the iterator range has been validated, check on - // random access safe iterators is done using the base iterator. - template - inline bool - __check_partitioned_lower_aux( - const _Safe_iterator<_Iterator, _Sequence>& __first, - const _Safe_iterator<_Iterator, _Sequence>& __last, - const _Tp& __value, _Pred __pred, - std::random_access_iterator_tag __tag) - { - return __check_partitioned_lower_aux(__first.base(), __last.base(), - __value, __pred, __tag); - } - - // Determine if a sequence is partitioned w.r.t. this element. template inline bool - __check_partitioned_lower(_ForwardIterator __first, + __check_partitioned_upper(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Pred __pred) { - return __check_partitioned_lower_aux(__first, __last, __value, __pred, - std::__iterator_category(__first)); - } - - template - inline bool - __check_partitioned_upper_aux(_ForwardIterator __first, - _ForwardIterator __last, const _Tp& __value, - _Pred __pred, - std::forward_iterator_tag) - { while (__first != __last && !bool(__pred(__value, *__first))) ++__first; if (__first != __last) @@ -490,31 +415,6 @@ return __first == __last; } - // For performance reason, as the iterator range has been validated, check on - // random access safe iterators is done using the base iterator. - template - inline bool - __check_partitioned_upper_aux( - const _Safe_iterator<_Iterator, _Sequence>& __first, - const _Safe_iterator<_Iterator, _Sequence>& __last, - const _Tp& __value, _Pred __pred, - std::random_access_iterator_tag __tag) - { - return __check_partitioned_upper_aux(__first.base(), __last.base(), - __value, __pred, __tag); - } - - template - inline bool - __check_partitioned_upper(_ForwardIterator __first, - _ForwardIterator __last, const _Tp& __value, - _Pred __pred) - { - return __check_partitioned_upper_aux(__first, __last, __value, __pred, - std::__iterator_category(__first)); - } - // Helper struct to detect random access safe iterators. template struct __is_safe_random_iterator Index: libstdc++-v3/include/debug/macros.h =================================================================== --- libstdc++-v3/include/debug/macros.h (.../tags/gcc_4_8_2_release) (revision 204344) +++ libstdc++-v3/include/debug/macros.h (.../branches/gcc-4_8-branch) (revision 204344) @@ -261,8 +261,9 @@ w.r.t. the value _Value. */ #define __glibcxx_check_partitioned_lower(_First,_Last,_Value) \ __glibcxx_check_valid_range(_First,_Last); \ -_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower(_First, _Last, \ - _Value), \ +_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower( \ + __gnu_debug::__base(_First), \ + __gnu_debug::__base(_Last), _Value), \ _M_message(__gnu_debug::__msg_unpartitioned) \ ._M_iterator(_First, #_First) \ ._M_iterator(_Last, #_Last) \ @@ -270,8 +271,9 @@ #define __glibcxx_check_partitioned_upper(_First,_Last,_Value) \ __glibcxx_check_valid_range(_First,_Last); \ -_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper(_First, _Last, \ - _Value), \ +_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper( \ + __gnu_debug::__base(_First), \ + __gnu_debug::__base(_Last), _Value), \ _M_message(__gnu_debug::__msg_unpartitioned) \ ._M_iterator(_First, #_First) \ ._M_iterator(_Last, #_Last) \ @@ -281,8 +283,9 @@ w.r.t. the value _Value and predicate _Pred. */ #define __glibcxx_check_partitioned_lower_pred(_First,_Last,_Value,_Pred) \ __glibcxx_check_valid_range(_First,_Last); \ -_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower(_First, _Last, \ - _Value, _Pred), \ +_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower( \ + __gnu_debug::__base(_First), \ + __gnu_debug::__base(_Last), _Value, _Pred), \ _M_message(__gnu_debug::__msg_unpartitioned_pred) \ ._M_iterator(_First, #_First) \ ._M_iterator(_Last, #_Last) \ @@ -293,8 +296,9 @@ w.r.t. the value _Value and predicate _Pred. */ #define __glibcxx_check_partitioned_upper_pred(_First,_Last,_Value,_Pred) \ __glibcxx_check_valid_range(_First,_Last); \ -_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper(_First, _Last, \ - _Value, _Pred), \ +_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper( \ + __gnu_debug::__base(_First), \ + __gnu_debug::__base(_Last), _Value, _Pred), \ _M_message(__gnu_debug::__msg_unpartitioned_pred) \ ._M_iterator(_First, #_First) \ ._M_iterator(_Last, #_Last) \ Index: libstdc++-v3/include/bits/stl_algo.h =================================================================== --- libstdc++-v3/include/bits/stl_algo.h (.../tags/gcc_4_8_2_release) (revision 204344) +++ libstdc++-v3/include/bits/stl_algo.h (.../branches/gcc-4_8-branch) (revision 204344) @@ -2279,7 +2279,7 @@ _RandomAccessIterator __last) { _RandomAccessIterator __mid = __first + (__last - __first) / 2; - std::__move_median_to_first(__first, __first + 1, __mid, (__last - 2)); + std::__move_median_to_first(__first, __first + 1, __mid, __last - 1); return std::__unguarded_partition(__first + 1, __last, *__first); } @@ -2291,7 +2291,7 @@ _RandomAccessIterator __last, _Compare __comp) { _RandomAccessIterator __mid = __first + (__last - __first) / 2; - std::__move_median_to_first(__first, __first + 1, __mid, (__last - 2), + std::__move_median_to_first(__first, __first + 1, __mid, __last - 1, __comp); return std::__unguarded_partition(__first + 1, __last, *__first, __comp); } Index: libstdc++-v3/include/bits/shared_ptr_base.h =================================================================== --- libstdc++-v3/include/bits/shared_ptr_base.h (.../tags/gcc_4_8_2_release) (revision 204344) +++ libstdc++-v3/include/bits/shared_ptr_base.h (.../branches/gcc-4_8-branch) (revision 204344) @@ -391,7 +391,7 @@ public: template _Sp_counted_ptr_inplace(_Alloc __a, _Args&&... __args) - : _M_impl(__a), _M_storage() + : _M_impl(__a) { _M_impl._M_ptr = static_cast<_Tp*>(static_cast(&_M_storage)); // _GLIBCXX_RESOLVE_LIB_DEFECTS @@ -819,7 +819,7 @@ : _M_ptr(__r.get()), _M_refcount() { __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) - auto __tmp = std::__addressof(*__r.get()); + auto __tmp = __r.get(); _M_refcount = __shared_count<_Lp>(std::move(__r)); __enable_shared_from_this_helper(_M_refcount, __tmp, __tmp); } Index: libstdc++-v3/include/c_global/cstdio =================================================================== --- libstdc++-v3/include/c_global/cstdio (.../tags/gcc_4_8_2_release) (revision 204344) +++ libstdc++-v3/include/c_global/cstdio (.../branches/gcc-4_8-branch) (revision 204344) @@ -69,6 +69,7 @@ #undef ftell #undef fwrite #undef getc +#undef getchar #undef gets #undef perror #undef printf Index: libstdc++-v3/ChangeLog =================================================================== --- libstdc++-v3/ChangeLog (.../tags/gcc_4_8_2_release) (revision 204344) +++ libstdc++-v3/ChangeLog (.../branches/gcc-4_8-branch) (revision 204344) @@ -1,3 +1,48 @@ +2013-11-01 Paolo Carlini + + PR libstdc++/58952 + * include/c_global/cstdio: Undef getchar. + +2013-10-31 Jonathan Wakely + + * testsuite/20_util/shared_ptr/cons/58839.cc: Do not use + default_delete. + +2013-10-30 Chris Studholme + + PR libstdc++/58912 + * include/bits/shared_ptr_base.h (_Sp_counted_ptr_inplace): Remove + unnecessary initialization of storage buffer. + +2013-10-29 Jonathan Wakely + + PR libstdc++/58839 + * include/bits/shared_ptr_base.h + (__shared_ptr::__shared_ptr(unique_ptr&&)): Do not dereference + pointer. + * testsuite/20_util/shared_ptr/cons/58839.cc: New. + +2013-10-20 Chris Jefferson + Paolo Carlini + + PR libstdc++/58800 + * include/bits/stl_algo.h (__unguarded_partition_pivot): Change + __last - 2 to __last - 1. + * testsuite/25_algorithms/nth_element/58800.cc: New + +2013-10-16 François Dumont + + PR libstdc++/58191 + * include/debug/macros.h (__glibcxx_check_partitioned_lower): Add + __gnu_debug::__base calls on iterators passed to internal debug + check. + (__glibcxx_check_partitioned_lower_pred): Likewise. + (__glibcxx_check_partitioned_upper): Likewise. + (__glibcxx_check_partitioned_upper_pred): Likewise. + * include/debug/functions.h (__check_partitioned_lower): + Remove code to detect safe iterators. + (__check_partitioned_upper): Likewise. + 2013-10-16 Release Manager * GCC 4.8.2 released. Index: libstdc++-v3/testsuite/25_algorithms/nth_element/58800.cc =================================================================== --- libstdc++-v3/testsuite/25_algorithms/nth_element/58800.cc (.../tags/gcc_4_8_2_release) (revision 0) +++ libstdc++-v3/testsuite/25_algorithms/nth_element/58800.cc (.../branches/gcc-4_8-branch) (revision 204344) @@ -0,0 +1,52 @@ +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 25.3.2 [lib.alg.nth.element] + +// { dg-options "-std=gnu++11" } + +#include +#include +#include + +using __gnu_test::test_container; +using __gnu_test::random_access_iterator_wrapper; + +typedef test_container Container; + +void test01() +{ + std::vector v = { + 207089, + 202585, + 180067, + 157549, + 211592, + 216096, + 207089 + }; + + Container con(v.data(), v.data() + 7); + + std::nth_element(con.begin(), con.begin() + 3, con.end()); +} + +int main() +{ + test01(); + return 0; +} Index: libstdc++-v3/testsuite/20_util/shared_ptr/cons/58839.cc =================================================================== --- libstdc++-v3/testsuite/20_util/shared_ptr/cons/58839.cc (.../tags/gcc_4_8_2_release) (revision 0) +++ libstdc++-v3/testsuite/20_util/shared_ptr/cons/58839.cc (.../branches/gcc-4_8-branch) (revision 204344) @@ -0,0 +1,33 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } + +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +// libstdc++/58839 + +struct D { + void operator()(void*) const noexcept { } +}; + +void test01() +{ + std::unique_ptr y; + std::shared_ptr x = std::move(y); +} Index: contrib/ChangeLog =================================================================== --- contrib/ChangeLog (.../tags/gcc_4_8_2_release) (revision 204344) +++ contrib/ChangeLog (.../branches/gcc-4_8-branch) (revision 204344) @@ -1,3 +1,7 @@ +2013-10-21 Mike Stump + + * gcc_update (configure): Update to handle svn 1.8.1. + 2013-10-16 Release Manager * GCC 4.8.2 released. Index: contrib/gcc_update =================================================================== --- contrib/gcc_update (.../tags/gcc_4_8_2_release) (revision 204344) +++ contrib/gcc_update (.../branches/gcc-4_8-branch) (revision 204344) @@ -382,7 +382,7 @@ fi revision=`$GCC_SVN info | awk '/Revision:/ { print $2 }'` - branch=`$GCC_SVN info | sed -ne "/URL:/ { + branch=`$GCC_SVN info | sed -ne "/^URL:/ { s,.*/trunk,trunk, s,.*/branches/,, s,.*/tags/,, Index: gcc/tree-ssa-tail-merge.c =================================================================== --- gcc/tree-ssa-tail-merge.c (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/tree-ssa-tail-merge.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -297,7 +297,8 @@ tree val; def_operand_p def_p; - if (gimple_has_side_effects (stmt)) + if (gimple_has_side_effects (stmt) + || gimple_vdef (stmt) != NULL_TREE) return false; def_p = SINGLE_SSA_DEF_OPERAND (stmt, SSA_OP_DEF); Index: gcc/cgraphbuild.c =================================================================== --- gcc/cgraphbuild.c (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/cgraphbuild.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -73,7 +73,7 @@ decl = get_base_var (*tp); if (TREE_CODE (decl) == FUNCTION_DECL) { - struct cgraph_node *node = cgraph_get_create_node (decl); + struct cgraph_node *node = cgraph_get_create_real_symbol_node (decl); if (!ctx->only_vars) cgraph_mark_address_taken_node (node); ipa_record_reference ((symtab_node)ctx->varpool_node, @@ -143,7 +143,7 @@ { struct cgraph_node *per_node; - per_node = cgraph_get_create_node (DECL_FUNCTION_PERSONALITY (node->symbol.decl)); + per_node = cgraph_get_create_real_symbol_node (DECL_FUNCTION_PERSONALITY (node->symbol.decl)); ipa_record_reference ((symtab_node)node, (symtab_node)per_node, IPA_REF_ADDR, NULL); cgraph_mark_address_taken_node (per_node); } @@ -223,7 +223,7 @@ addr = get_base_address (addr); if (TREE_CODE (addr) == FUNCTION_DECL) { - struct cgraph_node *node = cgraph_get_create_node (addr); + struct cgraph_node *node = cgraph_get_create_real_symbol_node (addr); cgraph_mark_address_taken_node (node); ipa_record_reference ((symtab_node)data, (symtab_node)node, @@ -252,7 +252,7 @@ { /* ??? This can happen on platforms with descriptors when these are directly manipulated in the code. Pretend that it's an address. */ - struct cgraph_node *node = cgraph_get_create_node (t); + struct cgraph_node *node = cgraph_get_create_real_symbol_node (t); cgraph_mark_address_taken_node (node); ipa_record_reference ((symtab_node)data, (symtab_node)node, @@ -330,7 +330,7 @@ { tree fn = gimple_omp_parallel_child_fn (stmt); ipa_record_reference ((symtab_node)node, - (symtab_node)cgraph_get_create_node (fn), + (symtab_node)cgraph_get_create_real_symbol_node (fn), IPA_REF_ADDR, stmt); } if (gimple_code (stmt) == GIMPLE_OMP_TASK) @@ -338,12 +338,12 @@ tree fn = gimple_omp_task_child_fn (stmt); if (fn) ipa_record_reference ((symtab_node)node, - (symtab_node) cgraph_get_create_node (fn), + (symtab_node) cgraph_get_create_real_symbol_node (fn), IPA_REF_ADDR, stmt); fn = gimple_omp_task_copy_fn (stmt); if (fn) ipa_record_reference ((symtab_node)node, - (symtab_node)cgraph_get_create_node (fn), + (symtab_node)cgraph_get_create_real_symbol_node (fn), IPA_REF_ADDR, stmt); } } Index: gcc/cgraph.c =================================================================== --- gcc/cgraph.c (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/cgraph.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -2596,4 +2596,47 @@ FOR_EACH_FUNCTION (node) verify_cgraph_node (node); } + +/* Create external decl node for DECL. + The difference i nbetween cgraph_get_create_node and + cgraph_get_create_real_symbol_node is that cgraph_get_create_node + may return inline clone, while cgraph_get_create_real_symbol_node + will create a new node in this case. + FIXME: This function should be removed once clones are put out of decl + hash. */ + +struct cgraph_node * +cgraph_get_create_real_symbol_node (tree decl) +{ + struct cgraph_node *first_clone = cgraph_get_node (decl); + struct cgraph_node *node; + /* create symbol table node. even if inline clone exists, we can not take + it as a target of non-inlined call. */ + node = cgraph_get_node (decl); + if (node && !node->global.inlined_to) + return node; + + node = cgraph_create_node (decl); + + /* ok, we previously inlined the function, then removed the offline copy and + now we want it back for external call. this can happen when devirtualizing + while inlining function called once that happens after extern inlined and + virtuals are already removed. in this case introduce the external node + and make it available for call. */ + if (first_clone) + { + first_clone->clone_of = node; + node->clones = first_clone; + symtab_prevail_in_asm_name_hash ((symtab_node) node); + symtab_insert_node_to_hashtable ((symtab_node) node); + if (dump_file) + fprintf (dump_file, "Introduced new external node " + "(%s/%i) and turned into root of the clone tree.\n", + xstrdup (cgraph_node_name (node)), node->uid); + } + else if (dump_file) + fprintf (dump_file, "Introduced new external node " + "(%s/%i).\n", xstrdup (cgraph_node_name (node)), node->uid); + return node; +} #include "gt-cgraph.h" Index: gcc/cgraph.h =================================================================== --- gcc/cgraph.h (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/cgraph.h (.../branches/gcc-4_8-branch) (revision 204344) @@ -575,6 +575,7 @@ struct cgraph_node * cgraph_create_node (tree); struct cgraph_node * cgraph_create_empty_node (void); struct cgraph_node * cgraph_get_create_node (tree); +struct cgraph_node * cgraph_get_create_real_symbol_node (tree); struct cgraph_node * cgraph_same_body_alias (struct cgraph_node *, tree, tree); struct cgraph_node * cgraph_add_thunk (struct cgraph_node *, tree, tree, bool, HOST_WIDE_INT, HOST_WIDE_INT, tree, tree); Index: gcc/optabs.c =================================================================== --- gcc/optabs.c (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/optabs.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -7035,8 +7035,7 @@ create_output_operand (&ops[0], target, mode); create_fixed_operand (&ops[1], mem); - /* VAL may have been promoted to a wider mode. Shrink it if so. */ - create_convert_operand_to (&ops[2], val, mode, true); + create_input_operand (&ops[2], val, mode); create_integer_operand (&ops[3], model); if (maybe_expand_insn (icode, 4, ops)) return ops[0].value; @@ -7075,8 +7074,7 @@ struct expand_operand ops[3]; create_output_operand (&ops[0], target, mode); create_fixed_operand (&ops[1], mem); - /* VAL may have been promoted to a wider mode. Shrink it if so. */ - create_convert_operand_to (&ops[2], val, mode, true); + create_input_operand (&ops[2], val, mode); if (maybe_expand_insn (icode, 3, ops)) return ops[0].value; } @@ -7118,8 +7116,6 @@ { if (!target || !register_operand (target, mode)) target = gen_reg_rtx (mode); - if (GET_MODE (val) != VOIDmode && GET_MODE (val) != mode) - val = convert_modes (mode, GET_MODE (val), val, 1); if (expand_compare_and_swap_loop (mem, target, val, NULL_RTX)) return target; } @@ -7331,8 +7327,8 @@ create_output_operand (&ops[0], target_bool, bool_mode); create_output_operand (&ops[1], target_oval, mode); create_fixed_operand (&ops[2], mem); - create_convert_operand_to (&ops[3], expected, mode, true); - create_convert_operand_to (&ops[4], desired, mode, true); + create_input_operand (&ops[3], expected, mode); + create_input_operand (&ops[4], desired, mode); create_integer_operand (&ops[5], is_weak); create_integer_operand (&ops[6], succ_model); create_integer_operand (&ops[7], fail_model); @@ -7353,8 +7349,8 @@ create_output_operand (&ops[0], target_oval, mode); create_fixed_operand (&ops[1], mem); - create_convert_operand_to (&ops[2], expected, mode, true); - create_convert_operand_to (&ops[3], desired, mode, true); + create_input_operand (&ops[2], expected, mode); + create_input_operand (&ops[3], desired, mode); if (!maybe_expand_insn (icode, 4, ops)) return false; Index: gcc/DATESTAMP =================================================================== --- gcc/DATESTAMP (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/DATESTAMP (.../branches/gcc-4_8-branch) (revision 204344) @@ -1 +1 @@ -20131016 +20131104 Index: gcc/DEV-PHASE =================================================================== --- gcc/DEV-PHASE (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/DEV-PHASE (.../branches/gcc-4_8-branch) (revision 204344) @@ -0,0 +1 @@ +prerelease Index: gcc/ChangeLog =================================================================== --- gcc/ChangeLog (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/ChangeLog (.../branches/gcc-4_8-branch) (revision 204344) @@ -1,3 +1,130 @@ +2013-11-03 H.J. Lu + + Backport from mainline + 2013-10-12 H.J. Lu + + PR target/58690 + * config/i386/i386.c (ix86_copy_addr_to_reg): New function. + (ix86_expand_movmem): Replace copy_addr_to_reg with + ix86_copy_addr_to_reg. + (ix86_expand_setmem): Likewise. + +2013-10-29 Uros Bizjak + + Backport from mainline + 2013-08-08 Richard Sandiford + + PR rtl-optimization/58079 + * combine.c (combine_simplify_rtx): Avoid using SUBST if + simplify_comparison has widened a comparison with an integer. + +2013-10-29 Martin Jambor + + PR middle-end/58789 + Backport from mainline + 2013-05-09 Martin Jambor + + PR lto/57084 + * gimple-fold.c (canonicalize_constructor_val): Call + cgraph_get_create_real_symbol_node instead of cgraph_get_create_node. + + Backport from mainline + 2013-03-16 Jan Hubicka + + * cgraph.h (cgraph_get_create_real_symbol_node): Declare. + * cgraph.c (cgraph_get_create_real_symbol_node): New function. + * cgrpahbuild.c: Use cgraph_get_create_real_symbol_node instead + of cgraph_get_create_node. + * ipa-prop.c (ipa_make_edge_direct_to_target): Likewise. + +2013-10-28 Tom de Vries + + * cfgexpand.c (gimple_expand_cfg): Remove test for parm_birth_insn. + Don't commit insertions after NOTE_INSN_FUNCTION_BEG. + +2013-10-26 Uros Bizjak + + Backport from mainline + 2013-10-22 Uros Bizjak + + PR target/58779 + * config/i386/i386.c (put_condition_code) : + Remove CCCmode handling. + : Return 'c' suffix for CCCmode. + : Return 'nc' suffix for CCCmode. + (ix86_cc_mode) : Do not generate overflow checks. + * config/i386/i386.md (*sub3_cconly_overflow): Remove. + (*sub3_cc_overflow): Ditto. + (*subsi3_zext_cc_overflow): Ditto. + +2013-10-26 Uros Bizjak + + Backport from mainline + 2013-10-19 Uros Bizjak + + PR target/58792 + * config/i386/i386.c (ix86_function_value_regno): Add DX_REG, + ST1_REG and XMM1_REG for 32bit and 64bit targets. Also add DI_REG + and SI_REG for 64bit SYSV ABI targets. + +2013-08-25 Richard Henderson + + PR rtl/58542 + * optabs.c (maybe_emit_atomic_exchange): Use create_input_operand + instead of create_convert_operand_to. + (maybe_emit_sync_lock_test_and_set): Likewise. + (expand_atomic_compare_and_swap): Likewise. + (maybe_emit_compare_and_swap_exchange_loop): Don't convert_modes. + +2013-10-25 Eric Botcazou + + PR rtl-optimization/58831 + * alias.c (init_alias_analysis): At the beginning of each iteration, set + the reg_seen[N] bit if static_reg_base_value[N] is non-null. + +2013-10-25 Eric Botcazou + + * recog.c (search_ofs): New static variable moved from... + (peep2_find_free_register): ...here. + (peephole2_optimize): Initialize it. + +2013-10-24 David Edelsohn + + Backport from mainline + 2013-10-23 David Edelsohn + + PR target/58838 + * config/rs6000/rs6000.md (mulsi3_internal1 and splitter): Add + TARGET_32BIT final condition. + (mulsi3_internal2 and splitter): Same. + +2013-10-23 Tom de Vries + + PR tree-optimization/58805 + * tree-ssa-tail-merge.c (stmt_local_def): Add gimple_vdef check. + +2013-10-23 Richard Biener + + Backport from mainline + 2013-06-24 Richard Biener + + PR tree-optimization/57488 + * tree-ssa-pre.c (insert): Clear NEW sets before each iteration. + +2013-10-16 Ganesh Gopalasubramanian + + Backport from mainline + 2013-10-16 Ganesh Gopalasubramanian + + + * config/i386/i386.c (ix86_option_override_internal): Enable FMA4 + for AMD bdver3. + +2013-10-16 Jakub Jelinek + + * BASE-VER: Set to 4.8.3. + * DEV-PHASE: Set to prerelease. + 2013-10-16 Release Manager * GCC 4.8.2 released. @@ -639,7 +766,7 @@ 2013-07-31 Andreas Krebbel Backport from mainline - 2013-03-27 Andreas Krebbel + 2013-03-27 Andreas Krebbel * config/s390/s390.h (TARGET_FLT_EVAL_METHOD): Define. Index: gcc/testsuite/gcc.target/arm/require-pic-register-loc.c =================================================================== --- gcc/testsuite/gcc.target/arm/require-pic-register-loc.c (.../tags/gcc_4_8_2_release) (revision 0) +++ gcc/testsuite/gcc.target/arm/require-pic-register-loc.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-g -fPIC" } */ + +void *v; +void a (void *x) { } +void b (void) { } + /* line 7. */ +int /* line 8. */ +main (int argc) /* line 9. */ +{ /* line 10. */ + if (argc == 12345) /* line 11. */ + { + a (v); + return 1; + } + b (); + + return 0; +} + +/* { dg-final { scan-assembler-not "\.loc 1 7 0" } } */ +/* { dg-final { scan-assembler-not "\.loc 1 8 0" } } */ +/* { dg-final { scan-assembler-not "\.loc 1 9 0" } } */ + +/* The loc at the start of the prologue. */ +/* { dg-final { scan-assembler-times "\.loc 1 10 0" 1 } } */ + +/* The loc at the end of the prologue, with the first user line. */ +/* { dg-final { scan-assembler-times "\.loc 1 11 0" 1 } } */ Index: gcc/testsuite/gcc.target/i386/pr58690.c =================================================================== --- gcc/testsuite/gcc.target/i386/pr58690.c (.../tags/gcc_4_8_2_release) (revision 0) +++ gcc/testsuite/gcc.target/i386/pr58690.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -0,0 +1,14 @@ +/* { dg-do compile { target { ! { ia32 } } } } */ +/* { dg-require-effective-target maybe_x32 } */ +/* { dg-options "-O2 -mx32 -maddress-mode=short" } */ + +struct gomp_thread +{ + char foo[41]; +}; +extern __thread struct gomp_thread gomp_tls_data; +void +foo (void) +{ + __builtin_memset (&gomp_tls_data, '\0', sizeof (gomp_tls_data)); +} Index: gcc/testsuite/gcc.target/i386/pr30315.c =================================================================== --- gcc/testsuite/gcc.target/i386/pr30315.c (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/testsuite/gcc.target/i386/pr30315.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2" } */ -/* { dg-final { scan-assembler-times "cmp" 4 } } */ +/* { dg-final { scan-assembler-not "cmp" } } */ extern void abort (void); int c; @@ -34,39 +34,10 @@ } #define PLUSCCONLY(T, t) PLUSCCONLY1(T, t, a) PLUSCCONLY1(T, t, b) -#define MINUSCC(T, t) \ -T minuscc##t (T a, T b) \ -{ \ - T difference = a - b; \ - if (difference > a) \ - abort (); \ - return difference; \ -} - -#define DECCC(T, t) \ -T deccc##t (T a, T b) \ -{ \ - T difference = a - b; \ - if (difference > a) \ - c --; \ - return difference; \ -} - -#define MINUSCCONLY(T, t) \ -void minuscconly##t (T a, T b) \ -{ \ - T difference = a - b; \ - if (difference > a) \ - abort (); \ -} - #define TEST(T, t) \ PLUSCC(T, t) \ PLUSCCONLY(T, t) \ - INCCC(T, t) \ - MINUSCC(T, t) \ - MINUSCCONLY(T, t) \ - DECCC(T, t) + INCCC(T, t) TEST (unsigned long, l) TEST (unsigned int, i) @@ -84,14 +55,3 @@ PLUSCCZEXT(a) PLUSCCZEXT(b) - -#define MINUSCCZEXT \ -unsigned long minuscczext (unsigned int a, unsigned int b) \ -{ \ - unsigned int difference = a - b; \ - if (difference > a) \ - abort (); \ - return difference; \ -} - -MINUSCCZEXT Index: gcc/testsuite/gcc.target/sh/pr54089-3.c =================================================================== --- gcc/testsuite/gcc.target/sh/pr54089-3.c (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/testsuite/gcc.target/sh/pr54089-3.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -5,7 +5,7 @@ /* { dg-options "-O1" } */ /* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m1*" "-m2" "-m2e*" } } */ /* { dg-final { scan-assembler-not "and" } } */ -/* { dg-final { scan-assembler-not "31" } } */ +/* { dg-final { scan-assembler-not "#31" } } */ int test00 (unsigned int a, int* b, int c, int* d, unsigned int e) Index: gcc/testsuite/gfortran.dg/extends_15.f90 =================================================================== --- gcc/testsuite/gfortran.dg/extends_15.f90 (.../tags/gcc_4_8_2_release) (revision 0) +++ gcc/testsuite/gfortran.dg/extends_15.f90 (.../branches/gcc-4_8-branch) (revision 204344) @@ -0,0 +1,16 @@ +! { dg-do compile } +! +! PR 58355: [4.7/4.8/4.9 Regression] [F03] ICE with TYPE, EXTENDS before parent TYPE defined +! +! Contributed by Andrew Benson + +module ct + public :: t1 + + type, extends(t1) :: t2 ! { dg-error "has not been previously defined" } + + type :: t1 + end type +end + +! { dg-final { cleanup-modules "ct" } } Index: gcc/testsuite/gcc.c-torture/execute/pr58831.c =================================================================== --- gcc/testsuite/gcc.c-torture/execute/pr58831.c (.../tags/gcc_4_8_2_release) (revision 0) +++ gcc/testsuite/gcc.c-torture/execute/pr58831.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -0,0 +1,40 @@ +#include + +int a, *b, c, d, f, **i, p, q, *r; +short o, j; + +static int __attribute__((noinline, noclone)) +fn1 (int *p1, int **p2) +{ + int **e = &b; + for (; p; p++) + *p1 = 1; + *e = *p2 = &d; + + assert (r); + + return c; +} + +static int ** __attribute__((noinline, noclone)) +fn2 (void) +{ + for (f = 0; f != 42; f++) + { + int *g[3] = {0, 0, 0}; + for (o = 0; o; o--) + for (; a > 1;) + { + int **h[1] = { &g[2] }; + } + } + return &r; +} + +int +main (void) +{ + i = fn2 (); + fn1 (b, i); + return 0; +} Index: gcc/testsuite/gcc.dg/atomic-store-6.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-store-6.c (.../tags/gcc_4_8_2_release) (revision 0) +++ gcc/testsuite/gcc.dg/atomic-store-6.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -0,0 +1,13 @@ +/* { dg-do run } */ +/* { dg-require-effective-target sync_int_128_runtime } */ +/* { dg-options "-mcx16" { target { i?86-*-* x86_64-*-* } } } */ + +__int128_t i; + +int main() +{ + __atomic_store_16(&i, -1, 0); + if (i != -1) + __builtin_abort(); + return 0; +} Index: gcc/testsuite/gcc.dg/pr58805.c =================================================================== --- gcc/testsuite/gcc.dg/pr58805.c (.../tags/gcc_4_8_2_release) (revision 0) +++ gcc/testsuite/gcc.dg/pr58805.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-tail-merge -fdump-tree-pre" } */ + +/* Type that matches the 'p' constraint. */ +#define TYPE void * + +static inline +void bar (TYPE *r) +{ + TYPE t; + __asm__ ("" : "=&p" (t), "=p" (*r)); +} + +void +foo (int n, TYPE *x, TYPE *y) +{ + if (n == 0) + bar (x); + else + bar (y); +} + +/* { dg-final { scan-tree-dump-times "__asm__" 2 "pre"} } */ +/* { dg-final { cleanup-tree-dump "pre" } } */ Index: gcc/testsuite/gcc.dg/torture/pr58779.c =================================================================== --- gcc/testsuite/gcc.dg/torture/pr58779.c (.../tags/gcc_4_8_2_release) (revision 0) +++ gcc/testsuite/gcc.dg/torture/pr58779.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -0,0 +1,12 @@ +/* { dg-do run } */ + +int a, c; + +int main () +{ + int e = -1; + short d = (c <= 0) ^ e; + if ((unsigned int) a - (a || d) <= (unsigned int) a) + __builtin_abort (); + return 0; +} Index: gcc/testsuite/gcc.dg/torture/pr58079.c =================================================================== --- gcc/testsuite/gcc.dg/torture/pr58079.c (.../tags/gcc_4_8_2_release) (revision 0) +++ gcc/testsuite/gcc.dg/torture/pr58079.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -0,0 +1,107 @@ +/* { dg-options "-mlong-calls" { target mips*-*-* } } */ + +typedef unsigned char u8; +typedef unsigned short u16; +typedef unsigned int __kernel_size_t; +typedef __kernel_size_t size_t; +struct list_head { + struct list_head *next; +}; + +struct dmx_ts_feed { + int is_filtering; +}; +struct dmx_section_feed { + u16 secbufp; + u16 seclen; + u16 tsfeedp; +}; + +typedef int (*dmx_ts_cb) ( + const u8 * buffer1, + size_t buffer1_length, + const u8 * buffer2, + size_t buffer2_length +); + +struct dvb_demux_feed { + union { + struct dmx_ts_feed ts; + struct dmx_section_feed sec; + } feed; + union { + dmx_ts_cb ts; + } cb; + int type; + u16 pid; + int ts_type; + struct list_head list_head; +}; + +struct dvb_demux { + int (*stop_feed)(struct dvb_demux_feed *feed); + struct list_head feed_list; +}; + + +static +inline +__attribute__((always_inline)) +u8 +payload(const u8 *tsp) +{ + if (tsp[3] & 0x20) { + return 184 - 1 - tsp[4]; + } + return 184; +} + +static +inline +__attribute__((always_inline)) +int +dvb_dmx_swfilter_payload(struct dvb_demux_feed *feed, const u8 *buf) +{ + int count = payload(buf); + int p; + if (count == 0) + return -1; + return feed->cb.ts(&buf[p], count, ((void *)0), 0); +} + +static +inline +__attribute__((always_inline)) +void +dvb_dmx_swfilter_packet_type(struct dvb_demux_feed *feed, const u8 *buf) +{ + switch (feed->type) { + case 0: + if (feed->ts_type & 1) { + dvb_dmx_swfilter_payload(feed, buf); + } + if (dvb_dmx_swfilter_section_packet(feed, buf) < 0) + feed->feed.sec.seclen = feed->feed.sec.secbufp = 0; + } +} + +static +void +dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf) +{ + struct dvb_demux_feed *feed; + int dvr_done = 0; + + for (feed = ({ const typeof( ((typeof(*feed) *)0)->list_head ) *__mptr = ((&demux->feed_list)->next); (typeof(*feed) *)( (char *)__mptr - __builtin_offsetof(typeof(*feed),list_head) );}); __builtin_prefetch(feed->list_head.next), &feed->list_head != (&demux->feed_list); feed = ({ const typeof( ((typeof(*feed) *)0)->list_head ) *__mptr = (feed->list_head.next); (typeof(*feed) *)( (char *)__mptr - __builtin_offsetof(typeof(*feed),list_head) );})) { + if (((((feed)->type == 0) && ((feed)->feed.ts.is_filtering) && (((feed)->ts_type & (1 | 8)) == 1))) && (dvr_done++)) + dvb_dmx_swfilter_packet_type(feed, buf); + else if (feed->pid == 0x2000) + feed->cb.ts(buf, 188, ((void *)0), 0); + } +} +void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf, size_t count) +{ + while (count--) { + dvb_dmx_swfilter_packet(demux, buf); + } +} Index: gcc/testsuite/gcc.dg/torture/pr58830.c =================================================================== --- gcc/testsuite/gcc.dg/torture/pr58830.c (.../tags/gcc_4_8_2_release) (revision 0) +++ gcc/testsuite/gcc.dg/torture/pr58830.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-additional-options "-ftree-pre -ftree-partial-pre" } */ + +extern void abort (void); + +int b, c, d, f, g, h, i, j[6], *l = &b, *m, n, *o, r; +char k; + +static int +foo () +{ + char *p = &k; + + for (; d; d++) + if (i) + h = 0; + else + h = c || (r = 0); + + for (f = 0; f < 2; f++) + { + unsigned int q; + *l = 0; + if (n) + *m = g; + if (g) + o = 0; + for (q = -8; q >= 5; q++) + (*p)--; + } + + return 0; +} + +int +main () +{ + foo (); + if (j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[0]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] ^ (k & 15)] != 0) + abort (); + return 0; +} Index: gcc/testsuite/gcc.dg/torture/pr57488.c =================================================================== --- gcc/testsuite/gcc.dg/torture/pr57488.c (.../tags/gcc_4_8_2_release) (revision 0) +++ gcc/testsuite/gcc.dg/torture/pr57488.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -0,0 +1,58 @@ +/* { dg-do run } */ + +extern void abort (void); + +int i, j, *pj = &j, **ppj = &pj; +int x, *px = &x; + +short s, *ps = &s, k; + +unsigned short u, *pu = &u, **ppu = &pu; + +char c, *pc = &c; + +unsigned char v = 48; + +static int +bar (int p) +{ + p = k; + *px = **ppu = i; + *ppj = &p; + if (**ppj) + *pj = p; + return p; +} + +void __attribute__((noinline)) +foo () +{ + for (; i <= 3; i++) + for (; j; j--); + + u ^= bar (*pj); + + for (k = 1; k >= 0; k--) + { + int l; + bar (0); + for (l = 1; l < 5; l++) + { + int m; + for (m = 6; m; m--) + { + v--; + *ps = *pc; + } + } + } +} + +int +main () +{ + foo (); + if (v != 0) + abort (); + return 0; +} Index: gcc/testsuite/ChangeLog =================================================================== --- gcc/testsuite/ChangeLog (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/testsuite/ChangeLog (.../branches/gcc-4_8-branch) (revision 204344) @@ -1,3 +1,85 @@ +2013-11-03 H.J. Lu + + Backport from mainline + 2013-10-12 H.J. Lu + + PR target/58690 + * gcc.target/i386/pr58690.c: New test + +2013-11-02 Janus Weil + + Backport from mainline + 2013-09-23 Janus Weil + + PR fortran/58355 + * gfortran.dg/extends_15.f90: New. + +2013-10-29 Uros Bizjak + + Backport from mainline + 2013-08-08 Richard Sandiford + + PR rtl-optimization/58079 + * gcc.dg/torture/pr58079.c: New test. + +2013-10-28 Tom de Vries + + * gcc.target/arm/require-pic-register-loc.c: New test. + +2013-10-26 Uros Bizjak + + Backport from mainline + 2013-10-22 Uros Bizjak + + PR target/58779 + * gcc.target/i386/pr30315.c: Remove MINUSCC, DECCC, MINUSCCONLY + and MINUSCCZEXT defines. Update scan-assembler dg directive. + * gcc.dg/torture/pr58779.c: New test. + +2013-10-25 Richard Henderson + + PR rtl/58542 + * gcc.dg/atomic-store-6.c: New. + +2013-10-25 Tom de Vries + + PR c++/58282 + * g++.dg/tm/noexcept-6.C: New test. + +2013-10-25 Eric Botcazou + + * gcc.c-torture/execute/pr58831.c: New test. + +2013-10-23 Tom de Vries + + PR tree-optimization/58805 + * gcc.dg/pr58805.c: New test. + +2013-10-23 Richard Biener + + * gcc.dg/torture/pr58830.c: New testcase. + + Backport from mainline + 2013-06-24 Richard Biener + + PR tree-optimization/57488 + * gcc.dg/torture/pr57488.c: New testcase. + +2013-10-19 Oleg Endo + + * gcc.target/sh/pr54089-3.c: Fix test for load of constant 31. + +2013-10-17 Paolo Carlini + + PR c++/58596 + * g++.dg/cpp0x/lambda/lambda-nsdmi5.C: New + +2013-10-16 Paolo Carlini + + PR c++/58633 + * g++.dg/cpp0x/decltype57.C: New. + * g++.dg/cpp0x/enum18.C: Revert r174385 changes. + 2013-10-16 Release Manager * GCC 4.8.2 released. @@ -39,9 +121,9 @@ Backport from mainline 2013-06-27 Andreas Krebbel - * gcc.target/s390/htm-1.c: New file. - * gcc.target/s390/htm-nofloat-1.c: New file. - * gcc.target/s390/htm-xl-intrin-1.c: New file. + * gcc.target/s390/htm-1.c: New file. + * gcc.target/s390/htm-nofloat-1.c: New file. + * gcc.target/s390/htm-xl-intrin-1.c: New file. 2013-10-04 Tobias Burnus @@ -307,8 +389,8 @@ Backport from mainline 2013-08-12 Perez Read - PR target/58132 - * gcc.target/i386/movabs-1.c: New test. + PR target/58132 + * gcc.target/i386/movabs-1.c: New test. 2013-08-11 Janus Weil @@ -623,8 +705,8 @@ 2013-05-09 Martin Jambor - PR middle-end/56988 - * gcc.dg/ipa/pr56988.c: New test. + PR middle-end/56988 + * gcc.dg/ipa/pr56988.c: New test. 2013-05-08 Marc Glisse @@ -701,7 +783,7 @@ 2013-04-25 Marek Polacek PR tree-optimization/57066 - * gcc.dg/torture/builtin-logb-1.c: Adjust testcase. + * gcc.dg/torture/builtin-logb-1.c: Adjust testcase. 2013-05-02 Jakub Jelinek @@ -727,8 +809,8 @@ Backport from mainline 2013-04-24 Vladimir Makarov - PR rtl-optimizations/57046 - * gcc.target/i386/pr57046.c: New test. + PR rtl-optimizations/57046 + * gcc.target/i386/pr57046.c: New test. 2013-05-02 Vladimir Makarov @@ -735,8 +817,8 @@ Backport from mainline 2013-04-22 Vladimir Makarov - PR target/57018 - * gcc.target/i386/pr57018.c: New test. + PR target/57018 + * gcc.target/i386/pr57018.c: New test. 2013-05-02 Vladimir Makarov @@ -743,8 +825,8 @@ Backport from mainline 2013-04-18 Jakub Jelinek - PR rtl-optimization/56999 - * g++.dg/opt/pr56999.C: New test. + PR rtl-optimization/56999 + * g++.dg/opt/pr56999.C: New test. 2013-05-02 Vladimir Makarov @@ -751,8 +833,8 @@ Backport from mainline 2013-04-19 Vladimir Makarov - PR rtl-optimization/56847 - * gcc.dg/pr56847.c: New test. + PR rtl-optimization/56847 + * gcc.dg/pr56847.c: New test. 2013-05-02 Ian Bolton Index: gcc/testsuite/g++.dg/tm/noexcept-6.C =================================================================== --- gcc/testsuite/g++.dg/tm/noexcept-6.C (.../tags/gcc_4_8_2_release) (revision 0) +++ gcc/testsuite/g++.dg/tm/noexcept-6.C (.../branches/gcc-4_8-branch) (revision 204344) @@ -0,0 +1,23 @@ +// { dg-do compile } +// { dg-options "-fno-exceptions -fgnu-tm -O -std=c++0x -fdump-tree-tmlower" } + +struct TrueFalse +{ + static constexpr bool v() { return true; } +}; + +int global; + +template int foo() +{ + return __transaction_atomic noexcept(T::v()) (global + 1); +} + +int f1() +{ + return foo(); +} + +/* { dg-final { scan-tree-dump-times "eh_must_not_throw" 0 "tmlower" } } */ +/* { dg-final { scan-tree-dump-times "__transaction_atomic" 1 "tmlower" } } */ +/* { dg-final { cleanup-tree-dump "tmlower" } } */ Index: gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi5.C =================================================================== --- gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi5.C (.../tags/gcc_4_8_2_release) (revision 0) +++ gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi5.C (.../branches/gcc-4_8-branch) (revision 204344) @@ -0,0 +1,7 @@ +// PR c++/58596 +// { dg-do compile { target c++11 } } + +struct A +{ + int i = [] { return decltype(i)(); }(); +}; Index: gcc/testsuite/g++.dg/cpp0x/enum18.C =================================================================== --- gcc/testsuite/g++.dg/cpp0x/enum18.C (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/testsuite/g++.dg/cpp0x/enum18.C (.../branches/gcc-4_8-branch) (revision 204344) @@ -4,5 +4,5 @@ int main(void) { enum e {}; e ev; - ev.e::~e_u(); // { dg-error "e_u. has not been declared" } + ev.e::~e_u(); // { dg-error "" } } Index: gcc/testsuite/g++.dg/cpp0x/decltype57.C =================================================================== --- gcc/testsuite/g++.dg/cpp0x/decltype57.C (.../tags/gcc_4_8_2_release) (revision 0) +++ gcc/testsuite/g++.dg/cpp0x/decltype57.C (.../branches/gcc-4_8-branch) (revision 204344) @@ -0,0 +1,8 @@ +// PR c++/58633 +// { dg-do compile { target c++11 } } + +void foo(int i) +{ + typedef int I; + decltype(i.I::~I())* p; +} Index: gcc/cp/except.c =================================================================== --- gcc/cp/except.c (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/cp/except.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -380,6 +380,9 @@ { tree type = body ? TREE_TYPE (body) : void_type_node; + if (!flag_exceptions) + return body; + if (cond && !value_dependent_expression_p (cond)) { cond = cxx_constant_value (cond); Index: gcc/cp/ChangeLog =================================================================== --- gcc/cp/ChangeLog (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/cp/ChangeLog (.../branches/gcc-4_8-branch) (revision 204344) @@ -1,3 +1,26 @@ +2013-10-25 Tom de Vries + + PR c++/58282 + * except.c (build_must_not_throw_expr): Handle + flag_exceptions. + +2013-10-17 Paolo Carlini + + PR c++/58596 + * semantics.c (lambda_expr_this_capture): Handle NSDMIs in the + cp_unevaluated_operand case. + +2013-10-16 Paolo Carlini + + PR c++/58633 + * parser.c (cp_parser_pseudo_destructor_name): Revert r174385 changes. + +2013-10-16 Jason Merrill + + PR c++/57850 + * decl2.c (dump_tu): Split out from... + (cp_write_global_declarations): ...here. Call it in PCH mode. + 2013-10-16 Release Manager * GCC 4.8.2 released. Index: gcc/cp/semantics.c =================================================================== --- gcc/cp/semantics.c (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/cp/semantics.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -9481,7 +9481,14 @@ /* In unevaluated context this isn't an odr-use, so just return the nearest 'this'. */ if (cp_unevaluated_operand) - return lookup_name (this_identifier); + { + /* In an NSDMI the fake 'this' pointer that we're using for + parsing is in scope_chain. */ + if (LAMBDA_EXPR_EXTRA_SCOPE (lambda) + && TREE_CODE (LAMBDA_EXPR_EXTRA_SCOPE (lambda)) == FIELD_DECL) + return scope_chain->x_current_class_ptr; + return lookup_name (this_identifier); + } /* Try to default capture 'this' if we can. */ if (!this_capture Index: gcc/cp/decl2.c =================================================================== --- gcc/cp/decl2.c (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/cp/decl2.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -3960,6 +3960,22 @@ expand_or_defer_fn (finish_function (0)); } +/* The entire file is now complete. If requested, dump everything + to a file. */ + +static void +dump_tu (void) +{ + int flags; + FILE *stream = dump_begin (TDI_tu, &flags); + + if (stream) + { + dump_node (global_namespace, flags & ~TDF_SLIM, stream); + dump_end (TDI_tu, stream); + } +} + /* This routine is called at the end of compilation. Its job is to create all the code needed to initialize and destroy the global aggregates. We do the destruction @@ -3990,6 +4006,7 @@ if (pch_file) { c_common_write_pch (); + dump_tu (); return; } @@ -4359,17 +4376,8 @@ /* The entire file is now complete. If requested, dump everything to a file. */ - { - int flags; - FILE *stream = dump_begin (TDI_tu, &flags); + dump_tu (); - if (stream) - { - dump_node (global_namespace, flags & ~TDF_SLIM, stream); - dump_end (TDI_tu, stream); - } - } - if (flag_detailed_statistics) { dump_tree_statistics (); Index: gcc/cp/parser.c =================================================================== --- gcc/cp/parser.c (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/cp/parser.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -6421,10 +6421,6 @@ /* Look for the `~'. */ cp_parser_require (parser, CPP_COMPL, RT_COMPL); - /* Once we see the ~, this has to be a pseudo-destructor. */ - if (!processing_template_decl && !cp_parser_error_occurred (parser)) - cp_parser_commit_to_tentative_parse (parser); - /* Look for the type-name again. We are not responsible for checking that it matches the first type-name. */ *type = cp_parser_nonclass_name (parser); Index: gcc/go/go-gcc.cc =================================================================== --- gcc/go/go-gcc.cc (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/go/go-gcc.cc (.../branches/gcc-4_8-branch) (revision 204344) @@ -232,6 +232,9 @@ Bexpression* convert_expression(Btype* type, Bexpression* expr, Location); + Bexpression* + function_code_expression(Bfunction*, Location); + // Statements. Bstatement* @@ -334,6 +337,17 @@ Bexpression* label_address(Blabel*, Location); + // Functions. + + Bfunction* + error_function() + { return this->make_function(error_mark_node); } + + Bfunction* + function(Btype* fntype, const std::string& name, const std::string& asm_name, + bool is_visible, bool is_declaration, bool is_inlinable, + bool disable_split_stack, bool in_unique_section, Location); + private: // Make a Bexpression from a tree. Bexpression* @@ -350,6 +364,10 @@ make_type(tree t) { return new Btype(t); } + Bfunction* + make_function(tree t) + { return new Bfunction(t); } + Btype* fill_in_struct(Btype*, const std::vector&); @@ -966,6 +984,19 @@ return tree_to_expr(ret); } +// Get the address of a function. + +Bexpression* +Gcc_backend::function_code_expression(Bfunction* bfunc, Location location) +{ + tree func = bfunc->get_tree(); + if (func == error_mark_node) + return this->error_expression(); + + tree ret = build_fold_addr_expr_loc(location.gcc_location(), func); + return this->make_expression(ret); +} + // An expression as a statement. Bstatement* @@ -1724,6 +1755,56 @@ return this->make_expression(ret); } +// Declare or define a new function. + +Bfunction* +Gcc_backend::function(Btype* fntype, const std::string& name, + const std::string& asm_name, bool is_visible, + bool is_declaration, bool is_inlinable, + bool disable_split_stack, bool in_unique_section, + Location location) +{ + tree functype = fntype->get_tree(); + if (functype != error_mark_node) + { + gcc_assert(FUNCTION_POINTER_TYPE_P(functype)); + functype = TREE_TYPE(functype); + } + tree id = get_identifier_from_string(name); + if (functype == error_mark_node || id == error_mark_node) + return this->error_function(); + + tree decl = build_decl(location.gcc_location(), FUNCTION_DECL, id, functype); + if (!asm_name.empty()) + SET_DECL_ASSEMBLER_NAME(decl, get_identifier_from_string(asm_name)); + if (is_visible) + TREE_PUBLIC(decl) = 1; + if (is_declaration) + DECL_EXTERNAL(decl) = 1; + else + { + tree restype = TREE_TYPE(functype); + tree resdecl = + build_decl(location.gcc_location(), RESULT_DECL, NULL_TREE, restype); + DECL_ARTIFICIAL(resdecl) = 1; + DECL_IGNORED_P(resdecl) = 1; + DECL_CONTEXT(resdecl) = decl; + DECL_RESULT(decl) = resdecl; + } + if (!is_inlinable) + DECL_UNINLINABLE(decl) = 1; + if (disable_split_stack) + { + tree attr = get_identifier("__no_split_stack__"); + DECL_ATTRIBUTES(decl) = tree_cons(attr, NULL_TREE, NULL_TREE); + } + if (in_unique_section) + resolve_unique_section(decl, 0, 1); + + go_preserve_from_gc(decl); + return new Bfunction(decl); +} + // The single backend. static Gcc_backend gcc_backend; @@ -1799,3 +1880,9 @@ { return bv->get_tree(); } + +tree +function_to_tree(Bfunction* bf) +{ + return bf->get_tree(); +} Index: gcc/go/ChangeLog =================================================================== --- gcc/go/ChangeLog (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/go/ChangeLog (.../branches/gcc-4_8-branch) (revision 204344) @@ -1,3 +1,17 @@ +2013-10-16 Ian Lance Taylor + + Bring in from mainline: + + 2013-10-11 Chris Manghane + * go-gcc.cc (Gcc_backend::function_code_expression): New + function. + + 2013-10-10 Chris Manghane + * go-gcc.cc (Backend::error_function): New function. + (Backend::function): New function. + (Backend::make_function): New function. + (function_to_tree): New function. + 2013-10-16 Release Manager * GCC 4.8.2 released. Index: gcc/go/gofrontend/gogo.cc =================================================================== --- gcc/go/gofrontend/gogo.cc (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/go/gofrontend/gogo.cc (.../branches/gcc-4_8-branch) (revision 204344) @@ -3320,7 +3320,8 @@ closure_var_(NULL), block_(block), location_(location), labels_(), local_type_count_(0), descriptor_(NULL), fndecl_(NULL), defer_stack_(NULL), is_sink_(false), results_are_named_(false), nointerface_(false), - calls_recover_(false), is_recover_thunk_(false), has_recover_thunk_(false), + is_unnamed_type_stub_method_(false), calls_recover_(false), + is_recover_thunk_(false), has_recover_thunk_(false), in_unique_section_(false) { } @@ -3819,6 +3820,81 @@ *presults = results; } +// Get the backend representation. + +Bfunction* +Function::get_or_make_decl(Gogo* gogo, Named_object* no) +{ + if (this->fndecl_ == NULL) + { + std::string asm_name; + bool is_visible = false; + if (no->package() != NULL) + ; + else if (this->enclosing_ != NULL || Gogo::is_thunk(no)) + ; + else if (Gogo::unpack_hidden_name(no->name()) == "init" + && !this->type_->is_method()) + ; + else if (Gogo::unpack_hidden_name(no->name()) == "main" + && gogo->is_main_package()) + is_visible = true; + // Methods have to be public even if they are hidden because + // they can be pulled into type descriptors when using + // anonymous fields. + else if (!Gogo::is_hidden_name(no->name()) + || this->type_->is_method()) + { + if (!this->is_unnamed_type_stub_method_) + is_visible = true; + std::string pkgpath = gogo->pkgpath_symbol(); + if (this->type_->is_method() + && Gogo::is_hidden_name(no->name()) + && Gogo::hidden_name_pkgpath(no->name()) != gogo->pkgpath()) + { + // This is a method we created for an unexported + // method of an imported embedded type. We need to + // use the pkgpath of the imported package to avoid + // a possible name collision. See bug478 for a test + // case. + pkgpath = Gogo::hidden_name_pkgpath(no->name()); + pkgpath = Gogo::pkgpath_for_symbol(pkgpath); + } + + asm_name = pkgpath; + asm_name.append(1, '.'); + asm_name.append(Gogo::unpack_hidden_name(no->name())); + if (this->type_->is_method()) + { + asm_name.append(1, '.'); + Type* rtype = this->type_->receiver()->type(); + asm_name.append(rtype->mangled_name(gogo)); + } + } + + // If a function calls the predeclared recover function, we + // can't inline it, because recover behaves differently in a + // function passed directly to defer. If this is a recover + // thunk that we built to test whether a function can be + // recovered, we can't inline it, because that will mess up + // our return address comparison. + bool is_inlinable = !(this->calls_recover_ || this->is_recover_thunk_); + + // If this is a thunk created to call a function which calls + // the predeclared recover function, we need to disable + // stack splitting for the thunk. + bool disable_split_stack = this->is_recover_thunk_; + + Btype* functype = this->type_->get_backend_fntype(gogo); + this->fndecl_ = + gogo->backend()->function(functype, no->get_id(gogo), asm_name, + is_visible, false, is_inlinable, + disable_split_stack, + this->in_unique_section_, this->location()); + } + return this->fndecl_; +} + // Class Block. Block::Block(Block* enclosing, Location location) @@ -5110,6 +5186,75 @@ go_unreachable(); } + +// Return the external identifier for this object. + +std::string +Named_object::get_id(Gogo* gogo) +{ + go_assert(!this->is_variable() && !this->is_result_variable()); + std::string decl_name; + if (this->is_function_declaration() + && !this->func_declaration_value()->asm_name().empty()) + decl_name = this->func_declaration_value()->asm_name(); + else if (this->is_type() + && Linemap::is_predeclared_location(this->type_value()->location())) + { + // We don't need the package name for builtin types. + decl_name = Gogo::unpack_hidden_name(this->name_); + } + else + { + std::string package_name; + if (this->package_ == NULL) + package_name = gogo->package_name(); + else + package_name = this->package_->package_name(); + + // Note that this will be misleading if this is an unexported + // method generated for an embedded imported type. In that case + // the unexported method should have the package name of the + // package from which it is imported, but we are going to give + // it our package name. Fixing this would require knowing the + // package name, but we only know the package path. It might be + // better to use package paths here anyhow. This doesn't affect + // the assembler code, because we always set that name in + // Function::get_or_make_decl anyhow. FIXME. + + decl_name = package_name + '.' + Gogo::unpack_hidden_name(this->name_); + + Function_type* fntype; + if (this->is_function()) + fntype = this->func_value()->type(); + else if (this->is_function_declaration()) + fntype = this->func_declaration_value()->type(); + else + fntype = NULL; + if (fntype != NULL && fntype->is_method()) + { + decl_name.push_back('.'); + decl_name.append(fntype->receiver()->type()->mangled_name(gogo)); + } + } + if (this->is_type()) + { + unsigned int index; + const Named_object* in_function = this->type_value()->in_function(&index); + if (in_function != NULL) + { + decl_name += '$' + Gogo::unpack_hidden_name(in_function->name()); + if (index > 0) + { + char buf[30]; + snprintf(buf, sizeof buf, "%u", index); + decl_name += '$'; + decl_name += buf; + } + } + } + return decl_name; +} + // Class Bindings. Bindings::Bindings(Bindings* enclosing) Index: gcc/go/gofrontend/runtime.def =================================================================== --- gcc/go/gofrontend/runtime.def (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/go/gofrontend/runtime.def (.../branches/gcc-4_8-branch) (revision 204344) @@ -68,6 +68,12 @@ P1(STRING), R1(SLICE)) +// Complex division. +DEF_GO_RUNTIME(COMPLEX64_DIV, "__go_complex64_div", + P2(COMPLEX64, COMPLEX64), R1(COMPLEX64)) +DEF_GO_RUNTIME(COMPLEX128_DIV, "__go_complex128_div", + P2(COMPLEX128, COMPLEX128), R1(COMPLEX128)) + // Make a slice. DEF_GO_RUNTIME(MAKESLICE1, "__go_make_slice1", P2(TYPE, UINTPTR), R1(SLICE)) DEF_GO_RUNTIME(MAKESLICE2, "__go_make_slice2", P3(TYPE, UINTPTR, UINTPTR), Index: gcc/go/gofrontend/gogo.h =================================================================== --- gcc/go/gofrontend/gogo.h (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/go/gofrontend/gogo.h (.../branches/gcc-4_8-branch) (revision 204344) @@ -48,6 +48,7 @@ class Bblock; class Bvariable; class Blabel; +class Bfunction; // This file declares the basic classes used to hold the internal // representation of Go which is built by the parser. @@ -952,6 +953,15 @@ this->nointerface_ = true; } + // Record that this function is a stub method created for an unnamed + // type. + void + set_is_unnamed_type_stub_method() + { + go_assert(this->is_method()); + this->is_unnamed_type_stub_method_ = true; + } + // Add a new field to the closure variable. void add_closure_field(Named_object* var, Location loc) @@ -1089,17 +1099,13 @@ this->descriptor_ = descriptor; } - // Return the function's decl given an identifier. - tree - get_or_make_decl(Gogo*, Named_object*, tree id); + // Return the backend representation. + Bfunction* + get_or_make_decl(Gogo*, Named_object*); // Return the function's decl after it has been built. tree - get_decl() const - { - go_assert(this->fndecl_ != NULL); - return this->fndecl_; - } + get_decl() const; // Set the function decl to hold a tree of the function code. void @@ -1170,7 +1176,7 @@ // The function descriptor, if any. Expression* descriptor_; // The function decl. - tree fndecl_; + Bfunction* fndecl_; // The defer stack variable. A pointer to this variable is used to // distinguish the defer stack for one function from another. This // is NULL unless we actually need a defer stack. @@ -1181,6 +1187,9 @@ bool results_are_named_ : 1; // True if this method should not be included in the type descriptor. bool nointerface_ : 1; + // True if this function is a stub method created for an unnamed + // type. + bool is_unnamed_type_stub_method_ : 1; // True if this function calls the predeclared recover function. bool calls_recover_ : 1; // True if this a thunk built for a function which calls recover. @@ -1265,9 +1274,9 @@ has_descriptor() const { return this->descriptor_ != NULL; } - // Return a decl for the function given an identifier. - tree - get_or_make_decl(Gogo*, Named_object*, tree id); + // Return a backend representation. + Bfunction* + get_or_make_decl(Gogo*, Named_object*); // If there is a descriptor, build it into the backend // representation. @@ -1290,7 +1299,7 @@ // The function descriptor, if any. Expression* descriptor_; // The function decl if needed. - tree fndecl_; + Bfunction* fndecl_; }; // A variable. @@ -2181,8 +2190,8 @@ Bvariable* get_backend_variable(Gogo*, Named_object* function); - // Return a tree for the external identifier for this object. - tree + // Return the external identifier for this object. + std::string get_id(Gogo*); // Return a tree representing this object. Index: gcc/go/gofrontend/types.h =================================================================== --- gcc/go/gofrontend/types.h (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/go/gofrontend/types.h (.../branches/gcc-4_8-branch) (revision 204344) @@ -1717,7 +1717,8 @@ Typed_identifier_list* results, Location location) : Type(TYPE_FUNCTION), receiver_(receiver), parameters_(parameters), results_(results), - location_(location), is_varargs_(false), is_builtin_(false) + location_(location), is_varargs_(false), is_builtin_(false), + fnbtype_(NULL) { } // Get the receiver. @@ -1798,6 +1799,11 @@ static Type* make_function_type_descriptor_type(); + // Return the backend representation of this function type. This is used + // as the real type of a backend function declaration or defintion. + Btype* + get_backend_fntype(Gogo*); + protected: int do_traverse(Traverse*); @@ -1851,6 +1857,9 @@ // Whether this is a special builtin function which can not simply // be called. This is used for len, cap, etc. bool is_builtin_; + // The backend representation of this type for backend function + // declarations and definitions. + Btype* fnbtype_; }; // The type of a pointer. @@ -1915,7 +1924,7 @@ { public: explicit Struct_field(const Typed_identifier& typed_identifier) - : typed_identifier_(typed_identifier), tag_(NULL) + : typed_identifier_(typed_identifier), tag_(NULL), is_imported_(false) { } // The field name. @@ -1926,6 +1935,10 @@ bool is_field_name(const std::string& name) const; + // Return whether this struct field is an unexported field named NAME. + bool + is_unexported_field_name(Gogo*, const std::string& name) const; + // Return whether this struct field is an embedded built-in type. bool is_embedded_builtin(Gogo*) const; @@ -1963,6 +1976,11 @@ set_tag(const std::string& tag) { this->tag_ = new std::string(tag); } + // Record that this field is defined in an imported struct. + void + set_is_imported() + { this->is_imported_ = true; } + // Set the type. This is only used in error cases. void set_type(Type* type) @@ -1973,6 +1991,8 @@ Typed_identifier typed_identifier_; // The field tag. This is NULL if the field has no tag. std::string* tag_; + // Whether this field is defined in an imported struct. + bool is_imported_; }; // A list of struct fields. Index: gcc/go/gofrontend/parse.cc =================================================================== --- gcc/go/gofrontend/parse.cc (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/go/gofrontend/parse.cc (.../branches/gcc-4_8-branch) (revision 204344) @@ -744,6 +744,8 @@ return NULL; Parse::Names names; + if (receiver != NULL) + names[receiver->name()] = receiver; if (params != NULL) this->check_signature_names(params, &names); if (results != NULL) Index: gcc/go/gofrontend/import.h =================================================================== --- gcc/go/gofrontend/import.h (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/go/gofrontend/import.h (.../branches/gcc-4_8-branch) (revision 204344) @@ -149,6 +149,11 @@ location() const { return this->location_; } + // Return the package we are importing. + Package* + package() const + { return this->package_; } + // Return the next character. int peek_char() Index: gcc/go/gofrontend/runtime.cc =================================================================== --- gcc/go/gofrontend/runtime.cc (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/go/gofrontend/runtime.cc (.../branches/gcc-4_8-branch) (revision 204344) @@ -42,6 +42,8 @@ RFT_RUNE, // Go type float64, C type double. RFT_FLOAT64, + // Go type complex64, C type __complex float. + RFT_COMPLEX64, // Go type complex128, C type __complex double. RFT_COMPLEX128, // Go type string, C type struct __go_string. @@ -126,6 +128,10 @@ t = Type::lookup_float_type("float64"); break; + case RFT_COMPLEX64: + t = Type::lookup_complex_type("complex64"); + break; + case RFT_COMPLEX128: t = Type::lookup_complex_type("complex128"); break; @@ -216,6 +222,7 @@ case RFT_UINTPTR: case RFT_RUNE: case RFT_FLOAT64: + case RFT_COMPLEX64: case RFT_COMPLEX128: case RFT_STRING: case RFT_POINTER: Index: gcc/go/gofrontend/expressions.h =================================================================== --- gcc/go/gofrontend/expressions.h (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/go/gofrontend/expressions.h (.../branches/gcc-4_8-branch) (revision 204344) @@ -1514,8 +1514,8 @@ closure() { return this->closure_; } - // Return a tree for the code for a function. - static tree + // Return a backend expression for the code of a function. + static Bexpression* get_code_pointer(Gogo*, Named_object* function, Location loc); protected: Index: gcc/go/gofrontend/gogo-tree.cc =================================================================== --- gcc/go/gofrontend/gogo-tree.cc (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/go/gofrontend/gogo-tree.cc (.../branches/gcc-4_8-branch) (revision 204344) @@ -985,74 +985,6 @@ delete[] vec; } -// Get a tree for the identifier for a named object. - -tree -Named_object::get_id(Gogo* gogo) -{ - go_assert(!this->is_variable() && !this->is_result_variable()); - std::string decl_name; - if (this->is_function_declaration() - && !this->func_declaration_value()->asm_name().empty()) - decl_name = this->func_declaration_value()->asm_name(); - else if (this->is_type() - && Linemap::is_predeclared_location(this->type_value()->location())) - { - // We don't need the package name for builtin types. - decl_name = Gogo::unpack_hidden_name(this->name_); - } - else - { - std::string package_name; - if (this->package_ == NULL) - package_name = gogo->package_name(); - else - package_name = this->package_->package_name(); - - // Note that this will be misleading if this is an unexported - // method generated for an embedded imported type. In that case - // the unexported method should have the package name of the - // package from which it is imported, but we are going to give - // it our package name. Fixing this would require knowing the - // package name, but we only know the package path. It might be - // better to use package paths here anyhow. This doesn't affect - // the assembler code, because we always set that name in - // Function::get_or_make_decl anyhow. FIXME. - - decl_name = package_name + '.' + Gogo::unpack_hidden_name(this->name_); - - Function_type* fntype; - if (this->is_function()) - fntype = this->func_value()->type(); - else if (this->is_function_declaration()) - fntype = this->func_declaration_value()->type(); - else - fntype = NULL; - if (fntype != NULL && fntype->is_method()) - { - decl_name.push_back('.'); - decl_name.append(fntype->receiver()->type()->mangled_name(gogo)); - } - } - if (this->is_type()) - { - unsigned int index; - const Named_object* in_function = this->type_value()->in_function(&index); - if (in_function != NULL) - { - decl_name += '$' + Gogo::unpack_hidden_name(in_function->name()); - if (index > 0) - { - char buf[30]; - snprintf(buf, sizeof buf, "%u", index); - decl_name += '$'; - decl_name += buf; - } - } - } - return get_identifier_from_string(decl_name); -} - // Get a tree for a named object. tree @@ -1067,11 +999,6 @@ return error_mark_node; } - tree name; - if (this->classification_ == NAMED_OBJECT_TYPE) - name = NULL_TREE; - else - name = this->get_id(gogo); tree decl; switch (this->classification_) { @@ -1099,6 +1026,7 @@ decl = error_mark_node; else if (INTEGRAL_TYPE_P(TREE_TYPE(expr_tree))) { + tree name = get_identifier_from_string(this->get_id(gogo)); decl = build_decl(named_constant->location().gcc_location(), CONST_DECL, name, TREE_TYPE(expr_tree)); DECL_INITIAL(decl) = expr_tree; @@ -1161,7 +1089,7 @@ case NAMED_OBJECT_FUNC: { Function* func = this->u_.func_value; - decl = func->get_or_make_decl(gogo, this, name); + decl = function_to_tree(func->get_or_make_decl(gogo, this)); if (decl != error_mark_node) { if (func->block() != NULL) @@ -1286,124 +1214,13 @@ return block_tree; } -// Get a tree for a function decl. +// Get the backend representation. -tree -Function::get_or_make_decl(Gogo* gogo, Named_object* no, tree id) +Bfunction* +Function_declaration::get_or_make_decl(Gogo* gogo, Named_object* no) { - if (this->fndecl_ == NULL_TREE) + if (this->fndecl_ == NULL) { - tree functype = type_to_tree(this->type_->get_backend(gogo)); - - if (functype != error_mark_node) - { - // The type of a function comes back as a pointer to a - // struct whose first field is the function, but we want the - // real function type for a function declaration. - go_assert(POINTER_TYPE_P(functype) - && TREE_CODE(TREE_TYPE(functype)) == RECORD_TYPE); - functype = TREE_TYPE(TYPE_FIELDS(TREE_TYPE(functype))); - go_assert(FUNCTION_POINTER_TYPE_P(functype)); - functype = TREE_TYPE(functype); - } - - if (functype == error_mark_node) - this->fndecl_ = error_mark_node; - else - { - tree decl = build_decl(this->location().gcc_location(), FUNCTION_DECL, - id, functype); - - this->fndecl_ = decl; - - if (no->package() != NULL) - ; - else if (this->enclosing_ != NULL || Gogo::is_thunk(no)) - ; - else if (Gogo::unpack_hidden_name(no->name()) == "init" - && !this->type_->is_method()) - ; - else if (Gogo::unpack_hidden_name(no->name()) == "main" - && gogo->is_main_package()) - TREE_PUBLIC(decl) = 1; - // Methods have to be public even if they are hidden because - // they can be pulled into type descriptors when using - // anonymous fields. - else if (!Gogo::is_hidden_name(no->name()) - || this->type_->is_method()) - { - TREE_PUBLIC(decl) = 1; - std::string pkgpath = gogo->pkgpath_symbol(); - if (this->type_->is_method() - && Gogo::is_hidden_name(no->name()) - && Gogo::hidden_name_pkgpath(no->name()) != gogo->pkgpath()) - { - // This is a method we created for an unexported - // method of an imported embedded type. We need to - // use the pkgpath of the imported package to avoid - // a possible name collision. See bug478 for a test - // case. - pkgpath = Gogo::hidden_name_pkgpath(no->name()); - pkgpath = Gogo::pkgpath_for_symbol(pkgpath); - } - - std::string asm_name = pkgpath; - asm_name.append(1, '.'); - asm_name.append(Gogo::unpack_hidden_name(no->name())); - if (this->type_->is_method()) - { - asm_name.append(1, '.'); - Type* rtype = this->type_->receiver()->type(); - asm_name.append(rtype->mangled_name(gogo)); - } - SET_DECL_ASSEMBLER_NAME(decl, - get_identifier_from_string(asm_name)); - } - - // Why do we have to do this in the frontend? - tree restype = TREE_TYPE(functype); - tree resdecl = - build_decl(this->location().gcc_location(), RESULT_DECL, NULL_TREE, - restype); - DECL_ARTIFICIAL(resdecl) = 1; - DECL_IGNORED_P(resdecl) = 1; - DECL_CONTEXT(resdecl) = decl; - DECL_RESULT(decl) = resdecl; - - // If a function calls the predeclared recover function, we - // can't inline it, because recover behaves differently in a - // function passed directly to defer. If this is a recover - // thunk that we built to test whether a function can be - // recovered, we can't inline it, because that will mess up - // our return address comparison. - if (this->calls_recover_ || this->is_recover_thunk_) - DECL_UNINLINABLE(decl) = 1; - - // If this is a thunk created to call a function which calls - // the predeclared recover function, we need to disable - // stack splitting for the thunk. - if (this->is_recover_thunk_) - { - tree attr = get_identifier("__no_split_stack__"); - DECL_ATTRIBUTES(decl) = tree_cons(attr, NULL_TREE, NULL_TREE); - } - - if (this->in_unique_section_) - resolve_unique_section (decl, 0, 1); - - go_preserve_from_gc(decl); - } - } - return this->fndecl_; -} - -// Get a tree for a function declaration. - -tree -Function_declaration::get_or_make_decl(Gogo* gogo, Named_object* no, tree id) -{ - if (this->fndecl_ == NULL_TREE) - { // Let Go code use an asm declaration to pick up a builtin // function. if (!this->asm_name_.empty()) @@ -1412,58 +1229,46 @@ builtin_functions.find(this->asm_name_); if (p != builtin_functions.end()) { - this->fndecl_ = p->second; + this->fndecl_ = tree_to_function(p->second); return this->fndecl_; } } - tree functype = type_to_tree(this->fntype_->get_backend(gogo)); + std::string asm_name; + if (this->asm_name_.empty()) + { + asm_name = (no->package() == NULL + ? gogo->pkgpath_symbol() + : no->package()->pkgpath_symbol()); + asm_name.append(1, '.'); + asm_name.append(Gogo::unpack_hidden_name(no->name())); + if (this->fntype_->is_method()) + { + asm_name.append(1, '.'); + Type* rtype = this->fntype_->receiver()->type(); + asm_name.append(rtype->mangled_name(gogo)); + } + } - if (functype != error_mark_node) - { - // The type of a function comes back as a pointer to a - // struct whose first field is the function, but we want the - // real function type for a function declaration. - go_assert(POINTER_TYPE_P(functype) - && TREE_CODE(TREE_TYPE(functype)) == RECORD_TYPE); - functype = TREE_TYPE(TYPE_FIELDS(TREE_TYPE(functype))); - go_assert(FUNCTION_POINTER_TYPE_P(functype)); - functype = TREE_TYPE(functype); - } + Btype* functype = this->fntype_->get_backend_fntype(gogo); + this->fndecl_ = + gogo->backend()->function(functype, no->get_id(gogo), asm_name, + true, true, true, false, false, + this->location()); + } - tree decl; - if (functype == error_mark_node) - decl = error_mark_node; - else - { - decl = build_decl(this->location().gcc_location(), FUNCTION_DECL, id, - functype); - TREE_PUBLIC(decl) = 1; - DECL_EXTERNAL(decl) = 1; - - if (this->asm_name_.empty()) - { - std::string asm_name = (no->package() == NULL - ? gogo->pkgpath_symbol() - : no->package()->pkgpath_symbol()); - asm_name.append(1, '.'); - asm_name.append(Gogo::unpack_hidden_name(no->name())); - if (this->fntype_->is_method()) - { - asm_name.append(1, '.'); - Type* rtype = this->fntype_->receiver()->type(); - asm_name.append(rtype->mangled_name(gogo)); - } - SET_DECL_ASSEMBLER_NAME(decl, - get_identifier_from_string(asm_name)); - } - } - this->fndecl_ = decl; - go_preserve_from_gc(decl); - } return this->fndecl_; } +// Return the function's decl after it has been built. + +tree +Function::get_decl() const +{ + go_assert(this->fndecl_ != NULL); + return function_to_tree(this->fndecl_); +} + // We always pass the receiver to a method as a pointer. If the // receiver is actually declared as a non-pointer type, then we copy // the value into a local variable, so that it has the right type. In @@ -1558,7 +1363,7 @@ void Function::build_tree(Gogo* gogo, Named_object* named_function) { - tree fndecl = this->fndecl_; + tree fndecl = this->get_decl(); go_assert(fndecl != NULL_TREE); tree params = NULL_TREE; @@ -1796,7 +1601,7 @@ set = NULL_TREE; else set = fold_build2_loc(end_loc.gcc_location(), MODIFY_EXPR, void_type_node, - DECL_RESULT(this->fndecl_), retval); + DECL_RESULT(this->get_decl()), retval); tree ret_stmt = fold_build1_loc(end_loc.gcc_location(), RETURN_EXPR, void_type_node, set); append_to_statement_list(ret_stmt, &stmt_list); @@ -1851,7 +1656,7 @@ retval = this->return_value(gogo, named_function, end_loc, &stmt_list); set = fold_build2_loc(end_loc.gcc_location(), MODIFY_EXPR, void_type_node, - DECL_RESULT(this->fndecl_), retval); + DECL_RESULT(this->get_decl()), retval); ret_stmt = fold_build1_loc(end_loc.gcc_location(), RETURN_EXPR, void_type_node, set); @@ -1869,7 +1674,7 @@ *fini = stmt_list; } -// Return the value to assign to DECL_RESULT(this->fndecl_). This may +// Return the value to assign to DECL_RESULT(this->get_decl()). This may // also add statements to STMT_LIST, which need to be executed before // the assignment. This is used for a return statement with no // explicit values. @@ -1902,7 +1707,7 @@ } else { - tree rettype = TREE_TYPE(DECL_RESULT(this->fndecl_)); + tree rettype = TREE_TYPE(DECL_RESULT(this->get_decl())); retval = create_tmp_var(rettype, "RESULT"); tree field = TYPE_FIELDS(rettype); int index = 0; @@ -2323,18 +2128,14 @@ go_assert(m != NULL); Named_object* no = m->named_object(); - - tree fnid = no->get_id(this); - - tree fndecl; + Bfunction* bf; if (no->is_function()) - fndecl = no->func_value()->get_or_make_decl(this, no, fnid); + bf = no->func_value()->get_or_make_decl(this, no); else if (no->is_function_declaration()) - fndecl = no->func_declaration_value()->get_or_make_decl(this, no, - fnid); + bf = no->func_declaration_value()->get_or_make_decl(this, no); else go_unreachable(); - fndecl = build_fold_addr_expr(fndecl); + tree fndecl = build_fold_addr_expr(function_to_tree(bf)); elt = pointers->quick_push(empty); elt->index = size_int(i); @@ -2353,10 +2154,11 @@ TREE_CONSTANT(decl) = 1; DECL_INITIAL(decl) = constructor; - // If the interface type has hidden methods, then this is the only - // definition of the table. Otherwise it is a comdat table which - // may be defined in multiple packages. - if (has_hidden_methods) + // If the interface type has hidden methods, and the table is for a + // named type, then this is the only definition of the table. + // Otherwise it is a comdat table which may be defined in multiple + // packages. + if (has_hidden_methods && type->named_type() != NULL) TREE_PUBLIC(decl) = 1; else { Index: gcc/go/gofrontend/lex.cc =================================================================== --- gcc/go/gofrontend/lex.cc (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/go/gofrontend/lex.cc (.../branches/gcc-4_8-branch) (revision 204344) @@ -873,7 +873,28 @@ && (cc < 'a' || cc > 'z') && cc != '_' && (cc < '0' || cc > '9')) - break; + { + // Check for an invalid character here, as we get better + // error behaviour if we swallow them as part of the + // identifier we are building. + if ((cc >= ' ' && cc < 0x7f) + || cc == '\t' + || cc == '\r' + || cc == '\n') + break; + + this->lineoff_ = p - this->linebuf_; + error_at(this->location(), + "invalid character 0x%x in identifier", + cc); + if (!has_non_ascii_char) + { + buf.assign(pstart, p - pstart); + has_non_ascii_char = true; + } + if (!Lex::is_invalid_identifier(buf)) + buf.append("$INVALID$"); + } ++p; if (is_first) { Index: gcc/go/gofrontend/backend.h =================================================================== --- gcc/go/gofrontend/backend.h (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/go/gofrontend/backend.h (.../branches/gcc-4_8-branch) (revision 204344) @@ -23,7 +23,7 @@ // The backend representation of a statement. class Bstatement; -// The backend representation of a function definition. +// The backend representation of a function definition or declaration. class Bfunction; // The backend representation of a block. @@ -266,6 +266,11 @@ virtual Bexpression* convert_expression(Btype* type, Bexpression* expr, Location) = 0; + // Create an expression for the address of a function. This is used to + // get the address of the code for a function. + virtual Bexpression* + function_code_expression(Bfunction*, Location) = 0; + // Statements. // Create an error statement. This is used for cases which should @@ -498,6 +503,32 @@ // recover. virtual Bexpression* label_address(Blabel*, Location) = 0; + + // Functions. + + // Create an error function. This is used for cases which should + // not occur in a correct program, in order to keep the compilation + // going without crashing. + virtual Bfunction* + error_function() = 0; + + // Declare or define a function of FNTYPE. + // NAME is the Go name of the function. ASM_NAME, if not the empty string, is + // the name that should be used in the symbol table; this will be non-empty if + // a magic extern comment is used. + // IS_VISIBLE is true if this function should be visible outside of the + // current compilation unit. IS_DECLARATION is true if this is a function + // declaration rather than a definition; the function definition will be in + // another compilation unit. + // IS_INLINABLE is true if the function can be inlined. + // DISABLE_SPLIT_STACK is true if this function may not split the stack; this + // is used for the implementation of recover. + // IN_UNIQUE_SECTION is true if this function should be put into a unique + // location if possible; this is used for field tracking. + virtual Bfunction* + function(Btype* fntype, const std::string& name, const std::string& asm_name, + bool is_visible, bool is_declaration, bool is_inlinable, + bool disable_split_stack, bool in_unique_section, Location) = 0; }; // The backend interface has to define this function. @@ -517,5 +548,6 @@ extern tree stat_to_tree(Bstatement*); extern tree block_to_tree(Bblock*); extern tree var_to_tree(Bvariable*); +extern tree function_to_tree(Bfunction*); #endif // !defined(GO_BACKEND_H) Index: gcc/go/gofrontend/types.cc =================================================================== --- gcc/go/gofrontend/types.cc (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/go/gofrontend/types.cc (.../branches/gcc-4_8-branch) (revision 204344) @@ -3383,6 +3383,68 @@ // Get the backend representation for a function type. Btype* +Function_type::get_backend_fntype(Gogo* gogo) +{ + if (this->fnbtype_ == NULL) + { + Backend::Btyped_identifier breceiver; + if (this->receiver_ != NULL) + { + breceiver.name = Gogo::unpack_hidden_name(this->receiver_->name()); + + // We always pass the address of the receiver parameter, in + // order to make interface calls work with unknown types. + Type* rtype = this->receiver_->type(); + if (rtype->points_to() == NULL) + rtype = Type::make_pointer_type(rtype); + breceiver.btype = rtype->get_backend(gogo); + breceiver.location = this->receiver_->location(); + } + + std::vector bparameters; + if (this->parameters_ != NULL) + { + bparameters.resize(this->parameters_->size()); + size_t i = 0; + for (Typed_identifier_list::const_iterator p = + this->parameters_->begin(); p != this->parameters_->end(); + ++p, ++i) + { + bparameters[i].name = Gogo::unpack_hidden_name(p->name()); + bparameters[i].btype = p->type()->get_backend(gogo); + bparameters[i].location = p->location(); + } + go_assert(i == bparameters.size()); + } + + std::vector bresults; + if (this->results_ != NULL) + { + bresults.resize(this->results_->size()); + size_t i = 0; + for (Typed_identifier_list::const_iterator p = + this->results_->begin(); p != this->results_->end(); + ++p, ++i) + { + bresults[i].name = Gogo::unpack_hidden_name(p->name()); + bresults[i].btype = p->type()->get_backend(gogo); + bresults[i].location = p->location(); + } + go_assert(i == bresults.size()); + } + + this->fnbtype_ = gogo->backend()->function_type(breceiver, bparameters, + bresults, + this->location()); + + } + + return this->fnbtype_; +} + +// Get the backend representation for a Go function type. + +Btype* Function_type::do_get_backend(Gogo* gogo) { // When we do anything with a function value other than call it, it @@ -3395,57 +3457,9 @@ gogo->backend()->placeholder_struct_type("__go_descriptor", loc); Btype* ptr_struct_type = gogo->backend()->pointer_type(struct_type); - Backend::Btyped_identifier breceiver; - if (this->receiver_ != NULL) - { - breceiver.name = Gogo::unpack_hidden_name(this->receiver_->name()); - - // We always pass the address of the receiver parameter, in - // order to make interface calls work with unknown types. - Type* rtype = this->receiver_->type(); - if (rtype->points_to() == NULL) - rtype = Type::make_pointer_type(rtype); - breceiver.btype = rtype->get_backend(gogo); - breceiver.location = this->receiver_->location(); - } - - std::vector bparameters; - if (this->parameters_ != NULL) - { - bparameters.resize(this->parameters_->size()); - size_t i = 0; - for (Typed_identifier_list::const_iterator p = this->parameters_->begin(); - p != this->parameters_->end(); - ++p, ++i) - { - bparameters[i].name = Gogo::unpack_hidden_name(p->name()); - bparameters[i].btype = p->type()->get_backend(gogo); - bparameters[i].location = p->location(); - } - go_assert(i == bparameters.size()); - } - - std::vector bresults; - if (this->results_ != NULL) - { - bresults.resize(this->results_->size()); - size_t i = 0; - for (Typed_identifier_list::const_iterator p = this->results_->begin(); - p != this->results_->end(); - ++p, ++i) - { - bresults[i].name = Gogo::unpack_hidden_name(p->name()); - bresults[i].btype = p->type()->get_backend(gogo); - bresults[i].location = p->location(); - } - go_assert(i == bresults.size()); - } - - Btype* fntype = gogo->backend()->function_type(breceiver, bparameters, - bresults, loc); std::vector fields(1); fields[0].name = "code"; - fields[0].btype = fntype; + fields[0].btype = this->get_backend_fntype(gogo); fields[0].location = loc; if (!gogo->backend()->set_placeholder_struct_type(struct_type, fields)) return gogo->backend()->error_type(); @@ -4195,7 +4209,8 @@ // This is a horrible hack caused by the fact that we don't pack // the names of builtin types. FIXME. - if (nt != NULL + if (!this->is_imported_ + && nt != NULL && nt->is_builtin() && nt->name() == Gogo::unpack_hidden_name(name)) return true; @@ -4204,6 +4219,36 @@ } } +// Return whether this field is an unexported field named NAME. + +bool +Struct_field::is_unexported_field_name(Gogo* gogo, + const std::string& name) const +{ + const std::string& field_name(this->field_name()); + if (Gogo::is_hidden_name(field_name) + && name == Gogo::unpack_hidden_name(field_name) + && gogo->pack_hidden_name(name, false) != field_name) + return true; + + // Check for the name of a builtin type. This is like the test in + // is_field_name, only there we return false if this->is_imported_, + // and here we return true. + if (this->is_imported_ && this->is_anonymous()) + { + Type* t = this->typed_identifier_.type(); + if (t->points_to() != NULL) + t = t->points_to(); + Named_type* nt = t->named_type(); + if (nt != NULL + && nt->is_builtin() + && nt->name() == Gogo::unpack_hidden_name(name)) + return true; + } + + return false; +} + // Return whether this field is an embedded built-in type. bool @@ -4264,13 +4309,8 @@ ++p) { Type* t = p->type(); - if (t->is_undefined()) + if (p->is_anonymous()) { - error_at(p->location(), "struct field type is incomplete"); - p->set_type(Type::make_error_type()); - } - else if (p->is_anonymous()) - { if (t->named_type() != NULL && t->points_to() != NULL) { error_at(p->location(), "embedded type may not be a pointer"); @@ -4641,13 +4681,8 @@ for (Struct_field_list::const_iterator pf = fields->begin(); pf != fields->end(); ++pf) - { - const std::string& field_name(pf->field_name()); - if (Gogo::is_hidden_name(field_name) - && name == Gogo::unpack_hidden_name(field_name) - && gogo->pack_hidden_name(name, false) != field_name) - return true; - } + if (pf->is_unexported_field_name(gogo, name)) + return true; } return false; } @@ -5250,6 +5285,7 @@ Type* ftype = imp->read_type(); Struct_field sf(Typed_identifier(name, ftype, imp->location())); + sf.set_is_imported(); if (imp->peek_char() == ' ') { @@ -9022,6 +9058,8 @@ fntype->is_varargs(), location); gogo->finish_function(fntype->location()); + if (type->named_type() == NULL && stub->is_function()) + stub->func_value()->set_is_unnamed_type_stub_method(); if (m->nointerface() && stub->is_function()) stub->func_value()->set_nointerface(); } @@ -9289,7 +9327,9 @@ else { bool is_unexported; - if (!Gogo::is_hidden_name(name)) + // The test for 'a' and 'z' is to handle builtin names, + // which are not hidden. + if (!Gogo::is_hidden_name(name) && (name[0] < 'a' || name[0] > 'z')) is_unexported = false; else { Index: gcc/go/gofrontend/expressions.cc =================================================================== --- gcc/go/gofrontend/expressions.cc (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/go/gofrontend/expressions.cc (.../branches/gcc-4_8-branch) (revision 204344) @@ -1219,7 +1219,7 @@ // Get the tree for the code of a function expression. -tree +Bexpression* Func_expression::get_code_pointer(Gogo* gogo, Named_object* no, Location loc) { Function_type* fntype; @@ -1237,25 +1237,18 @@ error_at(loc, "invalid use of special builtin function %qs; must be called", no->message_name().c_str()); - return error_mark_node; + return gogo->backend()->error_expression(); } - tree id = no->get_id(gogo); - if (id == error_mark_node) - return error_mark_node; - - tree fndecl; + Bfunction* fndecl; if (no->is_function()) - fndecl = no->func_value()->get_or_make_decl(gogo, no, id); + fndecl = no->func_value()->get_or_make_decl(gogo, no); else if (no->is_function_declaration()) - fndecl = no->func_declaration_value()->get_or_make_decl(gogo, no, id); + fndecl = no->func_declaration_value()->get_or_make_decl(gogo, no); else go_unreachable(); - if (fndecl == error_mark_node) - return error_mark_node; - - return build_fold_addr_expr_loc(loc.gcc_location(), fndecl); + return gogo->backend()->function_code_expression(fndecl, loc); } // Get the tree for a function expression. This is used when we take @@ -1492,8 +1485,10 @@ tree Func_code_reference_expression::do_get_tree(Translate_context* context) { - return Func_expression::get_code_pointer(context->gogo(), this->function_, - this->location()); + Bexpression* ret = + Func_expression::get_code_pointer(context->gogo(), this->function_, + this->location()); + return expr_to_tree(ret); } // Make a reference to the code of a function. @@ -3055,8 +3050,7 @@ do_lower(Gogo*, Named_object*, Statement_inserter*, int); bool - do_is_constant() const - { return this->expr_->is_constant(); } + do_is_constant() const; bool do_numeric_constant_value(Numeric_constant*) const; @@ -3198,6 +3192,27 @@ return this; } +// Return whether a type conversion is a constant. + +bool +Type_conversion_expression::do_is_constant() const +{ + if (!this->expr_->is_constant()) + return false; + + // A conversion to a type that may not be used as a constant is not + // a constant. For example, []byte(nil). + Type* type = this->type_; + if (type->integer_type() == NULL + && type->float_type() == NULL + && type->complex_type() == NULL + && !type->is_boolean_type() + && !type->is_string_type()) + return false; + + return true; +} + // Return the constant numeric value if there is one. bool @@ -5586,6 +5601,15 @@ subcontext.type = NULL; } + if (this->op_ == OPERATOR_ANDAND || this->op_ == OPERATOR_OROR) + { + // For a logical operation, the context does not determine the + // types of the operands. The operands must be some boolean + // type but if the context has a boolean type they do not + // inherit it. See http://golang.org/issue/3924. + subcontext.type = NULL; + } + // Set the context for the left hand operand. if (is_shift_op) { @@ -5967,6 +5991,43 @@ right); } + // For complex division Go wants slightly different results than the + // GCC library provides, so we have our own runtime routine. + if (this->op_ == OPERATOR_DIV && this->left_->type()->complex_type() != NULL) + { + const char *name; + tree *pdecl; + Type* ctype; + static tree complex64_div_decl; + static tree complex128_div_decl; + switch (this->left_->type()->complex_type()->bits()) + { + case 64: + name = "__go_complex64_div"; + pdecl = &complex64_div_decl; + ctype = Type::lookup_complex_type("complex64"); + break; + case 128: + name = "__go_complex128_div"; + pdecl = &complex128_div_decl; + ctype = Type::lookup_complex_type("complex128"); + break; + default: + go_unreachable(); + } + Btype* cbtype = ctype->get_backend(gogo); + tree ctype_tree = type_to_tree(cbtype); + return Gogo::call_builtin(pdecl, + this->location(), + name, + 2, + ctype_tree, + ctype_tree, + fold_convert_loc(gccloc, ctype_tree, left), + type, + fold_convert_loc(gccloc, ctype_tree, right)); + } + tree compute_type = excess_precision_type(type); if (compute_type != NULL_TREE) { @@ -7191,6 +7252,15 @@ if (this->code_ == BUILTIN_OFFSETOF) { Expression* arg = this->one_arg(); + + if (arg->bound_method_expression() != NULL + || arg->interface_field_reference_expression() != NULL) + { + this->report_error(_("invalid use of method value as argument " + "of Offsetof")); + return this; + } + Field_reference_expression* farg = arg->field_reference_expression(); while (farg != NULL) { @@ -7200,7 +7270,8 @@ // it must not be reached through pointer indirections. if (farg->expr()->deref() != farg->expr()) { - this->report_error(_("argument of Offsetof implies indirection of an embedded field")); + this->report_error(_("argument of Offsetof implies " + "indirection of an embedded field")); return this; } // Go up until we reach the original base. @@ -7476,7 +7547,7 @@ switch (nc.to_unsigned_long(&v)) { case Numeric_constant::NC_UL_VALID: - return true; + break; case Numeric_constant::NC_UL_NOTINT: error_at(e->location(), "non-integer %s argument to make", is_length ? "len" : "cap"); @@ -7488,8 +7559,23 @@ case Numeric_constant::NC_UL_BIG: // We don't want to give a compile-time error for a 64-bit // value on a 32-bit target. - return true; + break; } + + mpz_t val; + if (!nc.to_int(&val)) + go_unreachable(); + int bits = mpz_sizeinbase(val, 2); + mpz_clear(val); + Type* int_type = Type::lookup_integer_type("int"); + if (bits >= int_type->integer_type()->bits()) + { + error_at(e->location(), "%s argument too large for make", + is_length ? "len" : "cap"); + return false; + } + + return true; } if (e->type()->integer_type() != NULL) @@ -7595,6 +7681,8 @@ bool Builtin_call_expression::do_is_constant() const { + if (this->is_error_expression()) + return true; switch (this->code_) { case BUILTIN_LEN: @@ -9744,15 +9832,9 @@ } tree fntype_tree = type_to_tree(fntype->get_backend(gogo)); - if (fntype_tree == error_mark_node) + tree fnfield_type = type_to_tree(fntype->get_backend_fntype(gogo)); + if (fntype_tree == error_mark_node || fnfield_type == error_mark_node) return error_mark_node; - go_assert(POINTER_TYPE_P(fntype_tree)); - if (TREE_TYPE(fntype_tree) == error_mark_node) - return error_mark_node; - go_assert(TREE_CODE(TREE_TYPE(fntype_tree)) == RECORD_TYPE); - tree fnfield_type = TREE_TYPE(TYPE_FIELDS(TREE_TYPE(fntype_tree))); - if (fnfield_type == error_mark_node) - return error_mark_node; go_assert(FUNCTION_POINTER_TYPE_P(fnfield_type)); tree rettype = TREE_TYPE(TREE_TYPE(fnfield_type)); if (rettype == error_mark_node) @@ -9763,7 +9845,7 @@ if (func != NULL) { Named_object* no = func->named_object(); - fn = Func_expression::get_code_pointer(gogo, no, location); + fn = expr_to_tree(Func_expression::get_code_pointer(gogo, no, location)); if (!has_closure) closure_tree = NULL_TREE; else @@ -10817,11 +10899,20 @@ void String_index_expression::do_check_types(Gogo*) { - if (this->start_->type()->integer_type() == NULL) + Numeric_constant nc; + unsigned long v; + if (this->start_->type()->integer_type() == NULL + && !this->start_->type()->is_error() + && (!this->start_->numeric_constant_value(&nc) + || nc.to_unsigned_long(&v) == Numeric_constant::NC_UL_NOTINT)) this->report_error(_("index must be integer")); if (this->end_ != NULL && this->end_->type()->integer_type() == NULL - && !this->end_->is_nil_expression()) + && !this->end_->type()->is_error() + && !this->end_->is_nil_expression() + && !this->end_->is_error_expression() + && (!this->end_->numeric_constant_value(&nc) + || nc.to_unsigned_long(&v) == Numeric_constant::NC_UL_NOTINT)) this->report_error(_("slice end must be integer")); std::string sval; Index: gcc/recog.c =================================================================== --- gcc/recog.c (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/recog.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -3061,6 +3061,9 @@ return 1; } +/* Regno offset to be used in the register search. */ +static int search_ofs; + /* Try to find a hard register of mode MODE, matching the register class in CLASS_STR, which is available at the beginning of insn CURRENT_INSN and remains available until the end of LAST_INSN. LAST_INSN may be NULL_RTX, @@ -3076,7 +3079,6 @@ peep2_find_free_register (int from, int to, const char *class_str, enum machine_mode mode, HARD_REG_SET *reg_set) { - static int search_ofs; enum reg_class cl; HARD_REG_SET live; df_ref *def_rec; @@ -3541,6 +3543,7 @@ /* Initialize the regsets we're going to use. */ for (i = 0; i < MAX_INSNS_PER_PEEP2 + 1; ++i) peep2_insn_data[i].live_before = BITMAP_ALLOC (®_obstack); + search_ofs = 0; live = BITMAP_ALLOC (®_obstack); FOR_EACH_BB_REVERSE (bb) Index: gcc/ada/ChangeLog =================================================================== --- gcc/ada/ChangeLog (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/ada/ChangeLog (.../branches/gcc-4_8-branch) (revision 204344) @@ -1,3 +1,15 @@ +2013-10-19 Eric Botcazou + + * gcc-interface/utils.c (scale_by_factor_of): New function. + (rest_of_record_type_compilation): Use scale_by_factor_of in order to + scale the original offset for both rounding cases; in the second case, + take into accout the addend to compute the alignment. Tidy up. + +2013-10-19 Eric Botcazou + + * gcc-interface/utils.c (gnat_set_type_context): New function. + (gnat_pushdecl): Use it to set the context of the type. + 2013-10-16 Release Manager * GCC 4.8.2 released. Index: gcc/ada/gcc-interface/utils.c =================================================================== --- gcc/ada/gcc-interface/utils.c (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/ada/gcc-interface/utils.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -232,6 +232,7 @@ static tree split_plus (tree, tree *); static tree float_type_for_precision (int, enum machine_mode); static tree convert_to_fat_pointer (tree, tree); +static unsigned int scale_by_factor_of (tree, unsigned int); static bool potential_alignment_gap (tree, tree, tree); static void process_attributes (tree, struct attrib *); @@ -532,6 +533,22 @@ free_binding_level = level; } +/* Set the context of TYPE and its parallel types (if any) to CONTEXT. */ + +static void +gnat_set_type_context (tree type, tree context) +{ + tree decl = TYPE_STUB_DECL (type); + + TYPE_CONTEXT (type) = context; + + while (decl && DECL_PARALLEL_TYPE (decl)) + { + TYPE_CONTEXT (DECL_PARALLEL_TYPE (decl)) = context; + decl = TYPE_STUB_DECL (DECL_PARALLEL_TYPE (decl)); + } +} + /* Record DECL as belonging to the current lexical scope and use GNAT_NODE for location information and flag propagation. */ @@ -613,7 +630,7 @@ if (TREE_CODE (t) == POINTER_TYPE) TYPE_NEXT_PTR_TO (t) = tt; TYPE_NAME (tt) = DECL_NAME (decl); - TYPE_CONTEXT (tt) = DECL_CONTEXT (decl); + gnat_set_type_context (tt, DECL_CONTEXT (decl)); TYPE_STUB_DECL (tt) = TYPE_STUB_DECL (t); DECL_ORIGINAL_TYPE (decl) = tt; } @@ -623,7 +640,7 @@ /* We need a variant for the placeholder machinery to work. */ tree tt = build_variant_type_copy (t); TYPE_NAME (tt) = decl; - TYPE_CONTEXT (tt) = DECL_CONTEXT (decl); + gnat_set_type_context (tt, DECL_CONTEXT (decl)); TREE_USED (tt) = TREE_USED (t); TREE_TYPE (decl) = tt; if (DECL_ORIGINAL_TYPE (TYPE_NAME (t))) @@ -645,7 +662,7 @@ if (!(TYPE_NAME (t) && TREE_CODE (TYPE_NAME (t)) == TYPE_DECL)) { TYPE_NAME (t) = decl; - TYPE_CONTEXT (t) = DECL_CONTEXT (decl); + gnat_set_type_context (t, DECL_CONTEXT (decl)); } } } @@ -1692,93 +1709,74 @@ TYPE_SIZE_UNIT (new_record_type) = size_int (TYPE_ALIGN (record_type) / BITS_PER_UNIT); - /* Now scan all the fields, replacing each field with a new - field corresponding to the new encoding. */ + /* Now scan all the fields, replacing each field with a new field + corresponding to the new encoding. */ for (old_field = TYPE_FIELDS (record_type); old_field; old_field = DECL_CHAIN (old_field)) { tree field_type = TREE_TYPE (old_field); tree field_name = DECL_NAME (old_field); - tree new_field; tree curpos = bit_position (old_field); + tree pos, new_field; bool var = false; unsigned int align = 0; - tree pos; + /* We're going to do some pattern matching below so remove as many + conversions as possible. */ + curpos = remove_conversions (curpos, true); + /* See how the position was modified from the last position. - There are two basic cases we support: a value was added - to the last position or the last position was rounded to - a boundary and they something was added. Check for the - first case first. If not, see if there is any evidence - of rounding. If so, round the last position and try - again. + There are two basic cases we support: a value was added + to the last position or the last position was rounded to + a boundary and they something was added. Check for the + first case first. If not, see if there is any evidence + of rounding. If so, round the last position and retry. - If this is a union, the position can be taken as zero. */ - - /* Some computations depend on the shape of the position expression, - so strip conversions to make sure it's exposed. */ - curpos = remove_conversions (curpos, true); - + If this is a union, the position can be taken as zero. */ if (TREE_CODE (new_record_type) == UNION_TYPE) - pos = bitsize_zero_node, align = 0; + pos = bitsize_zero_node; else pos = compute_related_constant (curpos, last_pos); - if (!pos && TREE_CODE (curpos) == MULT_EXPR + if (!pos + && TREE_CODE (curpos) == MULT_EXPR && host_integerp (TREE_OPERAND (curpos, 1), 1)) { tree offset = TREE_OPERAND (curpos, 0); align = tree_low_cst (TREE_OPERAND (curpos, 1), 1); - - /* An offset which is a bitwise AND with a mask increases the - alignment according to the number of trailing zeros. */ - offset = remove_conversions (offset, true); - if (TREE_CODE (offset) == BIT_AND_EXPR - && TREE_CODE (TREE_OPERAND (offset, 1)) == INTEGER_CST) - { - unsigned HOST_WIDE_INT mask - = TREE_INT_CST_LOW (TREE_OPERAND (offset, 1)); - unsigned int i; - - for (i = 0; i < HOST_BITS_PER_WIDE_INT; i++) - { - if (mask & 1) - break; - mask >>= 1; - align *= 2; - } - } - - pos = compute_related_constant (curpos, - round_up (last_pos, align)); + align = scale_by_factor_of (offset, align); + last_pos = round_up (last_pos, align); + pos = compute_related_constant (curpos, last_pos); } - else if (!pos && TREE_CODE (curpos) == PLUS_EXPR - && TREE_CODE (TREE_OPERAND (curpos, 1)) == INTEGER_CST + else if (!pos + && TREE_CODE (curpos) == PLUS_EXPR + && host_integerp (TREE_OPERAND (curpos, 1), 1) && TREE_CODE (TREE_OPERAND (curpos, 0)) == MULT_EXPR - && host_integerp (TREE_OPERAND - (TREE_OPERAND (curpos, 0), 1), - 1)) + && host_integerp + (TREE_OPERAND (TREE_OPERAND (curpos, 0), 1), 1)) { + tree offset = TREE_OPERAND (TREE_OPERAND (curpos, 0), 0); + unsigned HOST_WIDE_INT addend + = tree_low_cst (TREE_OPERAND (curpos, 1), 1); align - = tree_low_cst - (TREE_OPERAND (TREE_OPERAND (curpos, 0), 1), 1); - pos = compute_related_constant (curpos, - round_up (last_pos, align)); + = tree_low_cst (TREE_OPERAND (TREE_OPERAND (curpos, 0), 1), 1); + align = scale_by_factor_of (offset, align); + align = MIN (align, addend & -addend); + last_pos = round_up (last_pos, align); + pos = compute_related_constant (curpos, last_pos); } - else if (potential_alignment_gap (prev_old_field, old_field, - pos)) + else if (potential_alignment_gap (prev_old_field, old_field, pos)) { align = TYPE_ALIGN (field_type); - pos = compute_related_constant (curpos, - round_up (last_pos, align)); + last_pos = round_up (last_pos, align); + pos = compute_related_constant (curpos, last_pos); } /* If we can't compute a position, set it to zero. - ??? We really should abort here, but it's too much work - to get this correct for all cases. */ - + ??? We really should abort here, but it's too much work + to get this correct for all cases. */ if (!pos) pos = bitsize_zero_node; @@ -2553,6 +2551,32 @@ return false; } +/* Return VALUE scaled by the biggest power-of-2 factor of EXPR. */ + +static unsigned int +scale_by_factor_of (tree expr, unsigned int value) +{ + expr = remove_conversions (expr, true); + + /* An expression which is a bitwise AND with a mask has a power-of-2 factor + corresponding to the number of trailing zeros of the mask. */ + if (TREE_CODE (expr) == BIT_AND_EXPR + && TREE_CODE (TREE_OPERAND (expr, 1)) == INTEGER_CST) + { + unsigned HOST_WIDE_INT mask = TREE_INT_CST_LOW (TREE_OPERAND (expr, 1)); + unsigned int i = 0; + + while ((mask & 1) == 0 && i < HOST_BITS_PER_WIDE_INT) + { + mask >>= 1; + value *= 2; + i++; + } + } + + return value; +} + /* Given two consecutive field decls PREV_FIELD and CURR_FIELD, return true unless we can prove these 2 fields are laid out in such a way that no gap exist between the end of PREV_FIELD and the beginning of CURR_FIELD. OFFSET Index: gcc/fortran/decl.c =================================================================== --- gcc/fortran/decl.c (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/fortran/decl.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -7384,6 +7384,7 @@ /* Check a derived type that is being extended. */ + static gfc_symbol* check_extended_derived_type (char *name) { @@ -7395,14 +7396,15 @@ return NULL; } + extended = gfc_find_dt_in_generic (extended); + + /* F08:C428. */ if (!extended) { - gfc_error ("No such symbol in TYPE definition at %C"); + gfc_error ("Symbol '%s' at %C has not been previously defined", name); return NULL; } - extended = gfc_find_dt_in_generic (extended); - if (extended->attr.flavor != FL_DERIVED) { gfc_error ("'%s' in EXTENDS expression at %C is not a " Index: gcc/fortran/ChangeLog =================================================================== --- gcc/fortran/ChangeLog (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/fortran/ChangeLog (.../branches/gcc-4_8-branch) (revision 204344) @@ -1,3 +1,12 @@ +2013-11-02 Janus Weil + + Backport from mainline + 2013-09-23 Janus Weil + + PR fortran/58355 + * decl.c (check_extended_derived_type): Prevent segfault, modify error + message. + 2013-10-16 Release Manager * GCC 4.8.2 released. Index: gcc/BASE-VER =================================================================== --- gcc/BASE-VER (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/BASE-VER (.../branches/gcc-4_8-branch) (revision 204344) @@ -1 +1 @@ -4.8.2 +4.8.3 Index: gcc/alias.c =================================================================== --- gcc/alias.c (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/alias.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -2871,17 +2871,14 @@ /* Wipe the reg_seen array clean. */ bitmap_clear (reg_seen); - /* Mark all hard registers which may contain an address. - The stack, frame and argument pointers may contain an address. - An argument register which can hold a Pmode value may contain - an address even if it is not in BASE_REGS. + /* Initialize the alias information for this pass. */ + for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) + if (static_reg_base_value[i]) + { + new_reg_base_value[i] = static_reg_base_value[i]; + bitmap_set_bit (reg_seen, i); + } - The address expression is VOIDmode for an argument and - Pmode for other registers. */ - - memcpy (new_reg_base_value, static_reg_base_value, - FIRST_PSEUDO_REGISTER * sizeof (rtx)); - /* Walk the insns adding values to the new_reg_base_value array. */ for (i = 0; i < rpo_cnt; i++) { Index: gcc/gimple-fold.c =================================================================== --- gcc/gimple-fold.c (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/gimple-fold.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -178,7 +178,7 @@ /* Make sure we create a cgraph node for functions we'll reference. They can be non-existent if the reference comes from an entry of an external vtable for example. */ - cgraph_get_create_node (base); + cgraph_get_create_real_symbol_node (base); } /* Fixup types in global initializers. */ if (TREE_TYPE (TREE_TYPE (cval)) != TREE_TYPE (TREE_OPERAND (cval, 0))) Index: gcc/cfgexpand.c =================================================================== --- gcc/cfgexpand.c (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/cfgexpand.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -4707,14 +4707,18 @@ if (e->insns.r) { rebuild_jump_labels_chain (e->insns.r); - /* Avoid putting insns before parm_birth_insn. */ + /* Put insns after parm birth, but before + NOTE_INSNS_FUNCTION_BEG. */ if (e->src == ENTRY_BLOCK_PTR - && single_succ_p (ENTRY_BLOCK_PTR) - && parm_birth_insn) + && single_succ_p (ENTRY_BLOCK_PTR)) { rtx insns = e->insns.r; e->insns.r = NULL_RTX; - emit_insn_after_noloc (insns, parm_birth_insn, e->dest); + if (NOTE_P (parm_birth_insn) + && NOTE_KIND (parm_birth_insn) == NOTE_INSN_FUNCTION_BEG) + emit_insn_before_noloc (insns, parm_birth_insn, e->dest); + else + emit_insn_after_noloc (insns, parm_birth_insn, e->dest); } else commit_one_edge_insertion (e); Index: gcc/tree-ssa-pre.c =================================================================== --- gcc/tree-ssa-pre.c (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/tree-ssa-pre.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -3664,6 +3664,12 @@ if (dump_file && dump_flags & TDF_DETAILS) fprintf (dump_file, "Starting insert iteration %d\n", num_iterations); new_stuff = insert_aux (ENTRY_BLOCK_PTR); + + /* Clear the NEW sets before the next iteration. We have already + fully propagated its contents. */ + if (new_stuff) + FOR_ALL_BB (bb) + bitmap_set_free (NEW_SETS (bb)); } statistics_histogram_event (cfun, "insert iterations", num_iterations); } Index: gcc/ipa-prop.c =================================================================== --- gcc/ipa-prop.c (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/ipa-prop.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -2126,7 +2126,6 @@ we may create the first reference to the object in the unit. */ if (!callee || callee->global.inlined_to) { - struct cgraph_node *first_clone = callee; /* We are better to ensure we can refer to it. In the case of static functions we are out of luck, since we already @@ -2142,31 +2141,7 @@ xstrdup (cgraph_node_name (ie->callee)), ie->callee->uid); return NULL; } - - /* Create symbol table node. Even if inline clone exists, we can not take - it as a target of non-inlined call. */ - callee = cgraph_create_node (target); - - /* OK, we previously inlined the function, then removed the offline copy and - now we want it back for external call. This can happen when devirtualizing - while inlining function called once that happens after extern inlined and - virtuals are already removed. In this case introduce the external node - and make it available for call. */ - if (first_clone) - { - first_clone->clone_of = callee; - callee->clones = first_clone; - symtab_prevail_in_asm_name_hash ((symtab_node)callee); - symtab_insert_node_to_hashtable ((symtab_node)callee); - if (dump_file) - fprintf (dump_file, "ipa-prop: Introduced new external node " - "(%s/%i) and turned into root of the clone tree.\n", - xstrdup (cgraph_node_name (callee)), callee->uid); - } - else if (dump_file) - fprintf (dump_file, "ipa-prop: Introduced new external node " - "(%s/%i).\n", - xstrdup (cgraph_node_name (callee)), callee->uid); + callee = cgraph_get_create_real_symbol_node (target); } ipa_check_create_node_params (); Index: gcc/combine.c =================================================================== --- gcc/combine.c (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/combine.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -5798,8 +5798,15 @@ return x; } - /* If the code changed, return a whole new comparison. */ - if (new_code != code) + /* If the code changed, return a whole new comparison. + We also need to avoid using SUBST in cases where + simplify_comparison has widened a comparison with a CONST_INT, + since in that case the wider CONST_INT may fail the sanity + checks in do_SUBST. */ + if (new_code != code + || (CONST_INT_P (op1) + && GET_MODE (op0) != GET_MODE (XEXP (x, 0)) + && GET_MODE (op0) != GET_MODE (XEXP (x, 1)))) return gen_rtx_fmt_ee (new_code, mode, op0, op1); /* Otherwise, keep this operation, but maybe change its operands. Index: gcc/config/i386/i386.md =================================================================== --- gcc/config/i386/i386.md (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/config/i386/i386.md (.../branches/gcc-4_8-branch) (revision 204344) @@ -6589,7 +6589,7 @@ (set_attr "use_carry" "1") (set_attr "mode" "")]) -;; Overflow setting add and subtract instructions +;; Overflow setting add instructions (define_insn "*add3_cconly_overflow" [(set (reg:CCC FLAGS_REG) @@ -6604,43 +6604,31 @@ [(set_attr "type" "alu") (set_attr "mode" "")]) -(define_insn "*sub3_cconly_overflow" +(define_insn "*add3_cc_overflow" [(set (reg:CCC FLAGS_REG) (compare:CCC - (minus:SWI - (match_operand:SWI 0 "nonimmediate_operand" "m,") - (match_operand:SWI 1 "" ",m")) - (match_dup 0)))] - "" - "cmp{}\t{%1, %0|%0, %1}" - [(set_attr "type" "icmp") - (set_attr "mode" "")]) - -(define_insn "*3_cc_overflow" - [(set (reg:CCC FLAGS_REG) - (compare:CCC - (plusminus:SWI - (match_operand:SWI 1 "nonimmediate_operand" "0,0") + (plus:SWI + (match_operand:SWI 1 "nonimmediate_operand" "%0,0") (match_operand:SWI 2 "" ",m")) (match_dup 1))) (set (match_operand:SWI 0 "nonimmediate_operand" "=m,") - (plusminus:SWI (match_dup 1) (match_dup 2)))] - "ix86_binary_operator_ok (, mode, operands)" - "{}\t{%2, %0|%0, %2}" + (plus:SWI (match_dup 1) (match_dup 2)))] + "ix86_binary_operator_ok (PLUS, mode, operands)" + "add{}\t{%2, %0|%0, %2}" [(set_attr "type" "alu") (set_attr "mode" "")]) -(define_insn "*si3_zext_cc_overflow" +(define_insn "*addsi3_zext_cc_overflow" [(set (reg:CCC FLAGS_REG) (compare:CCC - (plusminus:SI - (match_operand:SI 1 "nonimmediate_operand" "0") + (plus:SI + (match_operand:SI 1 "nonimmediate_operand" "%0") (match_operand:SI 2 "x86_64_general_operand" "rme")) (match_dup 1))) (set (match_operand:DI 0 "register_operand" "=r") - (zero_extend:DI (plusminus:SI (match_dup 1) (match_dup 2))))] - "TARGET_64BIT && ix86_binary_operator_ok (, SImode, operands)" - "{l}\t{%2, %k0|%k0, %2}" + (zero_extend:DI (plus:SI (match_dup 1) (match_dup 2))))] + "TARGET_64BIT && ix86_binary_operator_ok (PLUS, SImode, operands)" + "add{l}\t{%2, %k0|%k0, %2}" [(set_attr "type" "alu") (set_attr "mode" "SI")]) Index: gcc/config/i386/i386.c =================================================================== --- gcc/config/i386/i386.c (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/config/i386/i386.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -2983,7 +2983,7 @@ {"bdver3", PROCESSOR_BDVER3, CPU_BDVER3, PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_SSE3 | PTA_SSE4A | PTA_CX16 | PTA_ABM | PTA_SSSE3 | PTA_SSE4_1 - | PTA_SSE4_2 | PTA_AES | PTA_PCLMUL | PTA_AVX + | PTA_SSE4_2 | PTA_AES | PTA_PCLMUL | PTA_AVX | PTA_FMA4 | PTA_XOP | PTA_LWP | PTA_BMI | PTA_TBM | PTA_F16C | PTA_FMA | PTA_PRFCHW | PTA_FXSR | PTA_XSAVE | PTA_XSAVEOPT}, @@ -7235,9 +7235,15 @@ switch (regno) { case AX_REG: + case DX_REG: return true; + case DI_REG: + case SI_REG: + return TARGET_64BIT && ix86_abi != MS_ABI; - case FIRST_FLOAT_REG: + /* Complex values are returned in %st(0)/%st(1) pair. */ + case ST0_REG: + case ST1_REG: /* TODO: The function should depend on current function ABI but builtins.c would need updating then. Therefore we use the default ABI. */ @@ -7245,10 +7251,12 @@ return false; return TARGET_FLOAT_RETURNS_IN_80387; - case FIRST_SSE_REG: + /* Complex values are returned in %xmm0/%xmm1 pair. */ + case XMM0_REG: + case XMM1_REG: return TARGET_SSE; - case FIRST_MMX_REG: + case MM0_REG: if (TARGET_MACHO || TARGET_64BIT) return false; return TARGET_MMX; @@ -13817,8 +13825,6 @@ Those same assemblers have the same but opposite lossage on cmov. */ if (mode == CCmode) suffix = fp ? "nbe" : "a"; - else if (mode == CCCmode) - suffix = "b"; else gcc_unreachable (); break; @@ -13840,8 +13846,12 @@ } break; case LTU: - gcc_assert (mode == CCmode || mode == CCCmode); - suffix = "b"; + if (mode == CCmode) + suffix = "b"; + else if (mode == CCCmode) + suffix = "c"; + else + gcc_unreachable (); break; case GE: switch (mode) @@ -13861,9 +13871,12 @@ } break; case GEU: - /* ??? As above. */ - gcc_assert (mode == CCmode || mode == CCCmode); - suffix = fp ? "nb" : "ae"; + if (mode == CCmode) + suffix = fp ? "nb" : "ae"; + else if (mode == CCCmode) + suffix = "nc"; + else + gcc_unreachable (); break; case LE: gcc_assert (mode == CCmode || mode == CCGCmode || mode == CCNOmode); @@ -13870,11 +13883,8 @@ suffix = "le"; break; case LEU: - /* ??? As above. */ if (mode == CCmode) suffix = "be"; - else if (mode == CCCmode) - suffix = fp ? "nb" : "ae"; else gcc_unreachable (); break; @@ -18486,12 +18496,7 @@ return CCmode; case GTU: /* CF=0 & ZF=0 */ case LEU: /* CF=1 | ZF=1 */ - /* Detect overflow checks. They need just the carry flag. */ - if (GET_CODE (op0) == MINUS - && rtx_equal_p (op1, XEXP (op0, 0))) - return CCCmode; - else - return CCmode; + return CCmode; /* Codes possibly doable only with sign flag when comparing against zero. */ case GE: /* SF=OF or SF=0 */ @@ -21740,6 +21745,21 @@ return SImode; } +/* Copy the address to a Pmode register. This is used for x32 to + truncate DImode TLS address to a SImode register. */ + +static rtx +ix86_copy_addr_to_reg (rtx addr) +{ + if (GET_MODE (addr) == Pmode) + return copy_addr_to_reg (addr); + else + { + gcc_assert (GET_MODE (addr) == DImode && Pmode == SImode); + return gen_rtx_SUBREG (SImode, copy_to_mode_reg (DImode, addr), 0); + } +} + /* When SRCPTR is non-NULL, output simple loop to move memory pointer to SRCPTR to DESTPTR via chunks of MODE unrolled UNROLL times, overall size is COUNT specified in bytes. When SRCPTR is NULL, output the @@ -22728,8 +22748,8 @@ gcc_assert (alg != no_stringop); if (!count) count_exp = copy_to_mode_reg (GET_MODE (count_exp), count_exp); - destreg = copy_addr_to_reg (XEXP (dst, 0)); - srcreg = copy_addr_to_reg (XEXP (src, 0)); + destreg = ix86_copy_addr_to_reg (XEXP (dst, 0)); + srcreg = ix86_copy_addr_to_reg (XEXP (src, 0)); switch (alg) { case libcall: @@ -23119,7 +23139,7 @@ gcc_assert (alg != no_stringop); if (!count) count_exp = copy_to_mode_reg (counter_mode (count_exp), count_exp); - destreg = copy_addr_to_reg (XEXP (dst, 0)); + destreg = ix86_copy_addr_to_reg (XEXP (dst, 0)); switch (alg) { case libcall: Index: gcc/config/sh/sh.opt =================================================================== --- gcc/config/sh/sh.opt (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/config/sh/sh.opt (.../branches/gcc-4_8-branch) (revision 204344) @@ -21,7 +21,7 @@ ;; Used for various architecture options. Mask(SH_E) -;; Set if the default precision of th FPU is single. +;; Set if the default precision of the FPU is single. Mask(FPU_SINGLE) ;; Set if the a double-precision FPU is present but is restricted to Index: gcc/config/rs6000/rs6000.md =================================================================== --- gcc/config/rs6000/rs6000.md (.../tags/gcc_4_8_2_release) (revision 204344) +++ gcc/config/rs6000/rs6000.md (.../branches/gcc-4_8-branch) (revision 204344) @@ -2412,7 +2412,7 @@ (match_operand:SI 2 "gpc_reg_operand" "r,r")) (const_int 0))) (clobber (match_scratch:SI 3 "=r,r"))] - "" + "TARGET_32BIT" "@ mullw. %3,%1,%2 #" @@ -2425,7 +2425,7 @@ (match_operand:SI 2 "gpc_reg_operand" "")) (const_int 0))) (clobber (match_scratch:SI 3 ""))] - "reload_completed" + "TARGET_32BIT && reload_completed" [(set (match_dup 3) (mult:SI (match_dup 1) (match_dup 2))) (set (match_dup 0) @@ -2440,7 +2440,7 @@ (const_int 0))) (set (match_operand:SI 0 "gpc_reg_operand" "=r,r") (mult:SI (match_dup 1) (match_dup 2)))] - "" + "TARGET_32BIT" "@ mullw. %0,%1,%2 #" @@ -2454,7 +2454,7 @@ (const_int 0))) (set (match_operand:SI 0 "gpc_reg_operand" "") (mult:SI (match_dup 1) (match_dup 2)))] - "reload_completed" + "TARGET_32BIT && reload_completed" [(set (match_dup 0) (mult:SI (match_dup 1) (match_dup 2))) (set (match_dup 3) Index: libgo/configure =================================================================== --- libgo/configure (.../tags/gcc_4_8_2_release) (revision 204344) +++ libgo/configure (.../branches/gcc-4_8-branch) (revision 204344) @@ -14700,7 +14700,7 @@ fi -for ac_func in accept4 epoll_create1 faccessat fallocate fchmodat fchownat futimesat inotify_add_watch inotify_init inotify_init1 inotify_rm_watch mkdirat mknodat openat pipe2 renameat sync_file_range splice tee unlinkat unshare utimensat +for ac_func in accept4 dup3 epoll_create1 faccessat fallocate fchmodat fchownat futimesat getxattr inotify_add_watch inotify_init inotify_init1 inotify_rm_watch listxattr mkdirat mknodat openat pipe2 removexattr renameat setxattr sync_file_range splice tee unlinkat unshare utimensat do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" Index: libgo/Makefile.in =================================================================== --- libgo/Makefile.in (.../tags/gcc_4_8_2_release) (revision 204344) +++ libgo/Makefile.in (.../branches/gcc-4_8-branch) (revision 204344) @@ -195,7 +195,7 @@ @LIBGO_IS_LINUX_TRUE@am__objects_5 = getncpu-linux.lo am__objects_6 = go-append.lo go-assert.lo go-assert-interface.lo \ go-byte-array-to-string.lo go-breakpoint.lo go-caller.lo \ - go-callers.lo go-can-convert-interface.lo go-cgo.lo \ + go-callers.lo go-can-convert-interface.lo go-cdiv.lo go-cgo.lo \ go-check-interface.lo go-construct-map.lo \ go-convert-interface.lo go-copy.lo go-defer.lo \ go-deferred-recover.lo go-eface-compare.lo \ @@ -757,6 +757,7 @@ runtime/go-caller.c \ runtime/go-callers.c \ runtime/go-can-convert-interface.c \ + runtime/go-cdiv.c \ runtime/go-cgo.c \ runtime/go-check-interface.c \ runtime/go-construct-map.c \ @@ -2368,6 +2369,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-caller.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-callers.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-can-convert-interface.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-cdiv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-cgo.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-check-interface.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-construct-map.Plo@am__quote@ @@ -2554,6 +2556,13 @@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-can-convert-interface.lo `test -f 'runtime/go-can-convert-interface.c' || echo '$(srcdir)/'`runtime/go-can-convert-interface.c +go-cdiv.lo: runtime/go-cdiv.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-cdiv.lo -MD -MP -MF $(DEPDIR)/go-cdiv.Tpo -c -o go-cdiv.lo `test -f 'runtime/go-cdiv.c' || echo '$(srcdir)/'`runtime/go-cdiv.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-cdiv.Tpo $(DEPDIR)/go-cdiv.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-cdiv.c' object='go-cdiv.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-cdiv.lo `test -f 'runtime/go-cdiv.c' || echo '$(srcdir)/'`runtime/go-cdiv.c + go-cgo.lo: runtime/go-cgo.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-cgo.lo -MD -MP -MF $(DEPDIR)/go-cgo.Tpo -c -o go-cgo.lo `test -f 'runtime/go-cgo.c' || echo '$(srcdir)/'`runtime/go-cgo.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-cgo.Tpo $(DEPDIR)/go-cgo.Plo Index: libgo/runtime/go-nosys.c =================================================================== --- libgo/runtime/go-nosys.c (.../tags/gcc_4_8_2_release) (revision 204344) +++ libgo/runtime/go-nosys.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -43,6 +43,17 @@ } #endif +#ifndef HAVE_DUP3 +int +dup3 (int oldfd __attribute__ ((unused)), + int newfd __attribute__ ((unused)), + int flags __attribute__ ((unused))) +{ + errno = ENOSYS; + return -1; +} +#endif + #ifndef HAVE_EPOLL_CREATE1 int epoll_create1 (int flags __attribute__ ((unused))) @@ -112,6 +123,18 @@ } #endif +#ifndef HAVE_GETXATTR +ssize_t +getxattr (const char *path __attribute__ ((unused)), + const char *name __attribute__ ((unused)), + void *value __attribute__ ((unused)), + size_t size __attribute__ ((unused))) +{ + errno = ENOSYS; + return -1; +} +#endif + #ifndef HAVE_INOTIFY_ADD_WATCH int inotify_add_watch (int fd __attribute__ ((unused)), @@ -151,6 +174,17 @@ } #endif +#ifndef HAVE_LISTXATTR +ssize_t +listxattr (const char *path __attribute__ ((unused)), + char *list __attribute__ ((unused)), + size_t size __attribute__ ((unused))) +{ + errno = ENOSYS; + return -1; +} +#endif + #ifndef HAVE_MKDIRAT int mkdirat (int dirfd __attribute__ ((unused)), @@ -196,6 +230,16 @@ } #endif +#ifndef HAVE_REMOVEXATTR +int +removexattr (const char *path __attribute__ ((unused)), + const char *name __attribute__ ((unused))) +{ + errno = ENOSYS; + return -1; +} +#endif + #ifndef HAVE_RENAMEAT int renameat (int olddirfd __attribute__ ((unused)), @@ -208,6 +252,19 @@ } #endif +#ifndef HAVE_SETXATTR +int +setxattr (const char *path __attribute__ ((unused)), + const char *name __attribute__ ((unused)), + const void *value __attribute__ ((unused)), + size_t size __attribute__ ((unused)), + int flags __attribute__ ((unused))) +{ + errno = ENOSYS; + return -1; +} +#endif + #ifndef HAVE_SPLICE int splice (int fd __attribute__ ((unused)), Index: libgo/runtime/go-signal.c =================================================================== --- libgo/runtime/go-signal.c (.../tags/gcc_4_8_2_release) (revision 204344) +++ libgo/runtime/go-signal.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -399,6 +399,9 @@ { G *gp; M *mp; +#ifdef USING_SPLIT_STACK + void *stack_context[10]; +#endif /* We are now running on the stack registered via sigaltstack. (Actually there is a small span of time between runtime_siginit @@ -409,7 +412,7 @@ if (gp != NULL) { #ifdef USING_SPLIT_STACK - __splitstack_getcontext (&gp->stack_context[0]); + __splitstack_getcontext (&stack_context[0]); #endif } @@ -432,7 +435,7 @@ if (gp != NULL) { #ifdef USING_SPLIT_STACK - __splitstack_setcontext (&gp->stack_context[0]); + __splitstack_setcontext (&stack_context[0]); #endif } } Index: libgo/runtime/go-cdiv.c =================================================================== --- libgo/runtime/go-cdiv.c (.../tags/gcc_4_8_2_release) (revision 0) +++ libgo/runtime/go-cdiv.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -0,0 +1,46 @@ +/* go-cdiv.c -- complex division routines + + Copyright 2013 The Go Authors. All rights reserved. + Use of this source code is governed by a BSD-style + license that can be found in the LICENSE file. */ + +/* Calls to these functions are generated by the Go frontend for + division of complex64 or complex128. We use these because Go's + complex division expects slightly different results from the GCC + default. When dividing NaN+1.0i / 0+0i, Go expects NaN+NaNi but + GCC generates NaN+Infi. NaN+Infi seems wrong seems the rules of + C99 Annex G specify that if either side of a complex number is Inf, + the the whole number is Inf, but an operation involving NaN ought + to result in NaN, not Inf. */ + +__complex float +__go_complex64_div (__complex float a, __complex float b) +{ + if (__builtin_expect (b == 0+0i, 0)) + { + if (!__builtin_isinff (__real__ a) + && !__builtin_isinff (__imag__ a) + && (__builtin_isnanf (__real__ a) || __builtin_isnanf (__imag__ a))) + { + /* Pass "1" to nanf to match math/bits.go. */ + return __builtin_nanf("1") + __builtin_nanf("1")*1i; + } + } + return a / b; +} + +__complex double +__go_complex128_div (__complex double a, __complex double b) +{ + if (__builtin_expect (b == 0+0i, 0)) + { + if (!__builtin_isinf (__real__ a) + && !__builtin_isinf (__imag__ a) + && (__builtin_isnan (__real__ a) || __builtin_isnan (__imag__ a))) + { + /* Pass "1" to nan to match math/bits.go. */ + return __builtin_nan("1") + __builtin_nan("1")*1i; + } + } + return a / b; +} Index: libgo/runtime/go-make-slice.c =================================================================== --- libgo/runtime/go-make-slice.c (.../tags/gcc_4_8_2_release) (revision 204344) +++ libgo/runtime/go-make-slice.c (.../branches/gcc-4_8-branch) (revision 204344) @@ -34,7 +34,10 @@ std = (const struct __go_slice_type *) td; ilen = (intgo) len; - if (ilen < 0 || (uintptr_t) ilen != len) + if (ilen < 0 + || (uintptr_t) ilen != len + || (std->__element_type->__size > 0 + && len > MaxMem / std->__element_type->__size)) runtime_panicstring ("makeslice: len out of range"); icap = (intgo) cap; Index: libgo/mksysinfo.sh =================================================================== --- libgo/mksysinfo.sh (.../tags/gcc_4_8_2_release) (revision 204344) +++ libgo/mksysinfo.sh (.../branches/gcc-4_8-branch) (revision 204344) @@ -1035,6 +1035,10 @@ grep '^const _LOCK_' gen-sysinfo.go | sed -e 's/^\(const \)_\(LOCK_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT} +# The PRIO constants. +grep '^const _PRIO_' gen-sysinfo.go | \ + sed -e 's/^\(const \)_\(PRIO_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT} + # The GNU/Linux LINUX_REBOOT flags. grep '^const _LINUX_REBOOT_' gen-sysinfo.go | sed -e 's/^\(const \)_\(LINUX_REBOOT_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT} Index: libgo/config.h.in =================================================================== --- libgo/config.h.in (.../tags/gcc_4_8_2_release) (revision 204344) +++ libgo/config.h.in (.../branches/gcc-4_8-branch) (revision 204344) @@ -39,6 +39,9 @@ /* Define to 1 if you have the `dl_iterate_phdr' function. */ #undef HAVE_DL_ITERATE_PHDR +/* Define to 1 if you have the `dup3' function. */ +#undef HAVE_DUP3 + /* Define to 1 if you have the `epoll_create1' function. */ #undef HAVE_EPOLL_CREATE1 @@ -66,6 +69,9 @@ /* Define if _Unwind_GetIPInfo is available. */ #undef HAVE_GETIPINFO +/* Define to 1 if you have the `getxattr' function. */ +#undef HAVE_GETXATTR + /* Define to 1 if you have the `inotify_add_watch' function. */ #undef HAVE_INOTIFY_ADD_WATCH @@ -111,6 +117,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_RTNETLINK_H +/* Define to 1 if you have the `listxattr' function. */ +#undef HAVE_LISTXATTR + /* Define to 1 if the system has the type `loff_t'. */ #undef HAVE_LOFF_T @@ -171,6 +180,9 @@ /* Define to 1 if you have the `pipe2' function. */ #undef HAVE_PIPE2 +/* Define to 1 if you have the `removexattr' function. */ +#undef HAVE_REMOVEXATTR + /* Define to 1 if you have the `renameat' function. */ #undef HAVE_RENAMEAT @@ -180,6 +192,9 @@ /* Define to 1 if you have the `setenv' function. */ #undef HAVE_SETENV +/* Define to 1 if you have the `setxattr' function. */ +#undef HAVE_SETXATTR + /* Define to 1 if you have the `sinl' function. */ #undef HAVE_SINL Index: libgo/configure.ac =================================================================== --- libgo/configure.ac (.../tags/gcc_4_8_2_release) (revision 204344) +++ libgo/configure.ac (.../branches/gcc-4_8-branch) (revision 204344) @@ -503,7 +503,7 @@ AM_CONDITIONAL(HAVE_STRERROR_R, test "$ac_cv_func_strerror_r" = yes) AM_CONDITIONAL(HAVE_WAIT4, test "$ac_cv_func_wait4" = yes) -AC_CHECK_FUNCS(accept4 epoll_create1 faccessat fallocate fchmodat fchownat futimesat inotify_add_watch inotify_init inotify_init1 inotify_rm_watch mkdirat mknodat openat pipe2 renameat sync_file_range splice tee unlinkat unshare utimensat) +AC_CHECK_FUNCS(accept4 dup3 epoll_create1 faccessat fallocate fchmodat fchownat futimesat getxattr inotify_add_watch inotify_init inotify_init1 inotify_rm_watch listxattr mkdirat mknodat openat pipe2 removexattr renameat setxattr sync_file_range splice tee unlinkat unshare utimensat) AC_TYPE_OFF_T AC_CHECK_TYPES([loff_t]) Index: libgo/go/syscall/libcall_linux.go =================================================================== --- libgo/go/syscall/libcall_linux.go (.../tags/gcc_4_8_2_release) (revision 204344) +++ libgo/go/syscall/libcall_linux.go (.../branches/gcc-4_8-branch) (revision 204344) @@ -190,6 +190,9 @@ //sys Adjtimex(buf *Timex) (state int, err error) //adjtimex(buf *Timex) _C_int +//sysnb Dup3(oldfd int, newfd int, flags int) (err error) +//dup3(oldfd _C_int, newfd _C_int, flags _C_int) _C_int + //sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error) //faccessat(dirfd _C_int, pathname *byte, mode _C_int, flags _C_int) _C_int @@ -268,6 +271,9 @@ return origlen - len(buf), count, names } +//sys Getxattr(path string, attr string, dest []byte) (sz int, err error) +//getxattr(path *byte, attr *byte, buf *byte, count Size_t) Ssize_t + //sys InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) //inotify_add_watch(fd _C_int, pathname *byte, mask uint32) _C_int @@ -283,6 +289,9 @@ //sys Klogctl(typ int, buf []byte) (n int, err error) //klogctl(typ _C_int, bufp *byte, len _C_int) _C_int +//sys Listxattr(path string, dest []byte) (sz int, err error) +//listxattr(path *byte, list *byte, size Size_t) Ssize_t + //sys Mkdirat(dirfd int, path string, mode uint32) (err error) //mkdirat(dirfd _C_int, path *byte, mode Mode_t) _C_int @@ -305,6 +314,9 @@ //sys PivotRoot(newroot string, putold string) (err error) //pivot_root(newroot *byte, putold *byte) _C_int +//sys Removexattr(path string, attr string) (err error) +//removexattr(path *byte, name *byte) _C_int + //sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) //renameat(olddirfd _C_int, oldpath *byte, newdirfd _C_int, newpath *byte) _C_int @@ -338,6 +350,9 @@ //sysnb Setresuid(ruid int, eguid int, suid int) (err error) //setresuid(ruid Uid_t, euid Uid_t, suid Uid_t) _C_int +//sys Setxattr(path string, attr string, data []byte, flags int) (err error) +//setxattr(path *byte, name *byte, value *byte, size Size_t, flags _C_int) _C_int + //sys splice(rfd int, roff *_loff_t, wfd int, woff *_loff_t, len int, flags int) (n int64, err error) //splice(rfd _C_int, roff *_loff_t, wfd _C_int, woff *_loff_t, len Size_t, flags _C_uint) Ssize_t func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) { Index: libgo/go/syscall/libcall_posix.go =================================================================== --- libgo/go/syscall/libcall_posix.go (.../tags/gcc_4_8_2_release) (revision 204344) +++ libgo/go/syscall/libcall_posix.go (.../branches/gcc-4_8-branch) (revision 204344) @@ -238,6 +238,9 @@ //sysnb Getppid() (ppid int) //getppid() Pid_t +//sys Getpriority(which int, who int) (prio int, err error) +//getpriority(which _C_int, who _C_int) _C_int + //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) //getrlimit(resource _C_int, rlim *Rlimit) _C_int @@ -307,6 +310,9 @@ //sysnb Setpgid(pid int, pgid int) (err error) //setpgid(pid Pid_t, pgid Pid_t) _C_int +//sys Setpriority(which int, who int, prio int) (err error) +//setpriority(which _C_int, who _C_int, prio _C_int) _C_int + //sysnb Setreuid(ruid int, euid int) (err error) //setreuid(ruid Uid_t, euid Uid_t) _C_int Index: libgo/Makefile.am =================================================================== --- libgo/Makefile.am (.../tags/gcc_4_8_2_release) (revision 204344) +++ libgo/Makefile.am (.../branches/gcc-4_8-branch) (revision 204344) @@ -424,6 +424,7 @@ runtime/go-caller.c \ runtime/go-callers.c \ runtime/go-can-convert-interface.c \ + runtime/go-cdiv.c \ runtime/go-cgo.c \ runtime/go-check-interface.c \ runtime/go-construct-map.c \ Index: libcpp/po/ChangeLog =================================================================== --- libcpp/po/ChangeLog (.../tags/gcc_4_8_2_release) (revision 204344) +++ libcpp/po/ChangeLog (.../branches/gcc-4_8-branch) (revision 204344) @@ -1,3 +1,7 @@ +2013-11-01 Joseph Myers + + * tr.po: Update. + 2013-10-16 Release Manager * GCC 4.8.2 released. Index: libcpp/po/tr.po =================================================================== --- libcpp/po/tr.po (.../tags/gcc_4_8_2_release) (revision 204344) +++ libcpp/po/tr.po (.../branches/gcc-4_8-branch) (revision 204344) @@ -1,20 +1,22 @@ # Turkish translations for cpplib messages. # Copyright (C) 2007 Free Software Foundation, Inc. +# This file is distributed under the same license as the gcc package. # # Nilgün Belma Bugüner , 2001, ..., 2007. +# Volkan Gezer , 2013. msgid "" msgstr "" -"Project-Id-Version: cpplib 4.2.0\n" +"Project-Id-Version: cpplib 4.8.0\n" "Report-Msgid-Bugs-To: http://gcc.gnu.org/bugs.html\n" -"POT-Creation-Date: 2013-02-24 01:05+0000\n" -"PO-Revision-Date: 2007-05-23 01:17+0300\n" -"Last-Translator: Nilgün Belma Bugüner \n" +"POT-Creation-Date: 2013-03-15 17:42+0000\n" +"PO-Revision-Date: 2013-11-01 22:29+0100\n" +"Last-Translator: Volkan Gezer \n" "Language-Team: Turkish \n" "Language: tr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: KBabel 1.11.4\n" +"X-Generator: Lokalize 1.5\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: charset.c:673 @@ -121,10 +123,9 @@ msgstr "ISO standardı olmayan önceleme dizgesi, '\\%c'" #: charset.c:1320 -#, fuzzy, c-format -#| msgid "unknown escape sequence '\\%c'" +#, c-format msgid "unknown escape sequence: '\\%c'" -msgstr "bilinmeyen önceleme dizgesi '\\%c'" +msgstr "bilinmeyen kaçış dizgesi: '\\%c'" #: charset.c:1328 #, c-format @@ -163,10 +164,9 @@ msgstr "#%s bir GCC uzantısıdır" #: directives.c:362 -#, fuzzy, c-format -#| msgid "#%s is a GCC extension" +#, c-format msgid "#%s is a deprecated GCC extension" -msgstr "#%s bir GCC uzantısıdır" +msgstr "#%s eskimiş bir GCC uzantısıdır" #: directives.c:375 msgid "suggest not using #elif in traditional C" @@ -247,7 +247,7 @@ #: directives.c:909 msgid "unexpected end of file after #line" -msgstr "" +msgstr "#line satırından sonra beklenmeyen dosya sonu" #: directives.c:912 #, c-format @@ -271,7 +271,7 @@ #: directives.c:1068 directives.c:1070 directives.c:1072 directives.c:1658 #, c-format msgid "%s" -msgstr "" +msgstr "%s" #: directives.c:1096 #, c-format @@ -312,16 +312,12 @@ msgstr "main dosyasında '#pragma once'" #: directives.c:1462 -#, fuzzy -#| msgid "invalid #pragma GCC poison directive" msgid "invalid #pragma push_macro directive" -msgstr "geçersiz #pragma GCC poison yönergesi" +msgstr "geçersiz #pragma güdümlü_makro yönergesi" #: directives.c:1517 -#, fuzzy -#| msgid "invalid #pragma GCC poison directive" msgid "invalid #pragma pop_macro directive" -msgstr "geçersiz #pragma GCC poison yönergesi" +msgstr "geçersiz #pragma güdümlü_makro yönergesi" #: directives.c:1572 msgid "invalid #pragma GCC poison directive" @@ -347,10 +343,9 @@ msgstr "mevcut dosya %s den daha eski" #: directives.c:1653 -#, fuzzy, c-format -#| msgid "invalid #pragma GCC poison directive" +#, c-format msgid "invalid \"#pragma GCC %s\" directive" -msgstr "geçersiz #pragma GCC poison yönergesi" +msgstr "geçersiz \"#pragma GCC %s\" yönergesi" #: directives.c:1847 msgid "_Pragma takes a parenthesized string literal" @@ -405,7 +400,7 @@ msgid "\"%s\" re-asserted" msgstr "\"%s\" tekrar olumlanmış" -#: directives.c:2566 +#: directives.c:2567 #, c-format msgid "unterminated #%s" msgstr "sonlandırılmamış #%s" @@ -424,16 +419,12 @@ msgstr "%s: %s" #: expr.c:479 expr.c:577 -#, fuzzy -#| msgid "imaginary constants are a GCC extension" msgid "fixed-point constants are a GCC extension" -msgstr "sanal sabitler bir GCC genişletmesidir" +msgstr "sabit noktalı sabitler bir GCC uzantısıdır" #: expr.c:504 -#, fuzzy -#| msgid "invalid suffix \"%.*s\" on floating constant" msgid "invalid prefix \"0b\" for floating constant" -msgstr "gerçel sabitin \"%.*s\" soneki geçersiz" +msgstr "kayan nokta için geçerisz \"0b\" öntakısı" #: expr.c:514 msgid "use of C99 hexadecimal floating constant" @@ -450,10 +441,8 @@ msgstr "geleneksel C \"%.*s\" sonekini kullanmaz" #: expr.c:564 -#, fuzzy -#| msgid "imaginary constants are a GCC extension" msgid "suffix for double constant is a GCC extension" -msgstr "sanal sabitler bir GCC genişletmesidir" +msgstr "çift sabit için öntakı bir GCC uzantısıdır" #: expr.c:570 #, c-format @@ -461,10 +450,8 @@ msgstr "onaltılık kayan sabitli \"%.*s\" soneki geçersiz" #: expr.c:581 -#, fuzzy -#| msgid "imaginary constants are a GCC extension" msgid "decimal float constants are a GCC extension" -msgstr "sanal sabitler bir GCC genişletmesidir" +msgstr "onluk kayan sabitler bir GCC uzantısıdır" #: expr.c:599 #, c-format @@ -472,10 +459,8 @@ msgstr "tamsayı sabitte sonek \"%.*s\" soneki geçersiz" #: expr.c:624 -#, fuzzy -#| msgid "use of C99 long long integer constant" msgid "use of C++0x long long integer constant" -msgstr "ISO C99 long long tamsayı sabitleri yasaklar" +msgstr "ISO C++0x long long tamsayı sabitlerinin kullanımı" #: expr.c:625 msgid "use of C99 long long integer constant" @@ -486,10 +471,8 @@ msgstr "sanal sabitler bir GCC genişletmesidir" #: expr.c:644 -#, fuzzy -#| msgid "imaginary constants are a GCC extension" msgid "binary constants are a GCC extension" -msgstr "sanal sabitler bir GCC genişletmesidir" +msgstr "ikili sabitler bir GCC uzantısıdır" #: expr.c:737 msgid "integer constant is too large for its type" @@ -517,10 +500,8 @@ msgstr "\"defined\" bu kullanımıyla uyarlanabilir olmayabilir" #: expr.c:948 -#, fuzzy -#| msgid "integer overflow in preprocessor expression" msgid "user-defined literal in preprocessor expression" -msgstr "önişlemci ifadesinde tamsayı taşması" +msgstr "önişleyici ifadesinde kullanıcı tanımlı bağımlı" #: expr.c:953 msgid "floating constant in preprocessor expression" @@ -536,20 +517,17 @@ msgstr "\"%s\" tanımlı değil" #: expr.c:1020 -#, fuzzy -#| msgid "#%s is a GCC extension" msgid "assertions are a GCC extension" -msgstr "#%s bir GCC uzantısıdır" +msgstr "belirteçler bir GCC uzantısıdır" #: expr.c:1023 msgid "assertions are a deprecated extension" -msgstr "" +msgstr "belirteçler artık kullanılmayan bir ifadedir" #: expr.c:1268 -#, fuzzy, c-format -#| msgid "unbalanced stack in #if" +#, c-format msgid "unbalanced stack in %s" -msgstr "#if ifadesinde karşılıksız yığın" +msgstr "%s içinde dengelenmemiş yığın" #: expr.c:1288 #, c-format @@ -594,39 +572,39 @@ msgid "division by zero in #if" msgstr "#if içinde sıfırla bölme" -#: files.c:504 +#: files.c:505 msgid "NULL directory in find_file" msgstr "find_file içinde boş dizin" -#: files.c:542 +#: files.c:553 msgid "one or more PCH files were found, but they were invalid" msgstr "bir veya daha fazla PCH dosyası bulundu ama bunlar geçersiz" -#: files.c:545 +#: files.c:556 msgid "use -Winvalid-pch for more information" msgstr "daha fazla bilgi almak için -Winvalid-pch kullanın" -#: files.c:643 +#: files.c:660 #, c-format msgid "%s is a block device" msgstr "%s bir blok aygıtıdır" -#: files.c:660 +#: files.c:677 #, c-format msgid "%s is too large" msgstr "%s çok büyük" -#: files.c:700 +#: files.c:717 #, c-format msgid "%s is shorter than expected" msgstr "%s beklenenden daha kısa" -#: files.c:935 +#: files.c:953 #, c-format msgid "no include path in which to search for %s" msgstr "%s için aranacaklar içinde başlık dosyaları yolu yok" -#: files.c:1363 +#: files.c:1381 msgid "Multiple include guards may be useful for:\n" msgstr "Çoklu include önlemleri aşağıdakiler için kullanışlı olabilir:\n" @@ -717,27 +695,24 @@ #: lex.c:1178 lex.c:1255 #, c-format msgid "identifier \"%s\" is a special operator name in C++" -msgstr "" +msgstr "\"%s\" belirteci, C++'da özel bir işleç adıdır" #: lex.c:1399 msgid "raw string delimiter longer than 16 characters" -msgstr "" +msgstr "ham dizge ayracı 16 karakterden uzun" #: lex.c:1402 -#, fuzzy, c-format -#| msgid "universal character %.*s is not valid in an identifier" +#, c-format msgid "invalid character '%c' in raw string delimiter" -msgstr "evrensel karakter %.*s bir belirteç içinde geçerli değil" +msgstr "ham dizge ayracında geçersiz karakter '%c'" #: lex.c:1525 lex.c:1547 -#, fuzzy -#| msgid "unterminated #%s" msgid "unterminated raw string" -msgstr "sonlandırılmamış #%s" +msgstr "bitirilmemiş ham dizge" #: lex.c:1573 lex.c:1706 msgid "invalid suffix on literal; C++11 requires a space between literal and identifier" -msgstr "" +msgstr "geçersiz ifade soneki; C++11 ifade ve tanımlayıcı arasında bir boşluk gerektirir" #: lex.c:1684 msgid "null character(s) preserved in literal" @@ -785,7 +760,7 @@ #: macro.c:377 msgid "__COUNTER__ expanded inside directive with -fdirectives-only" -msgstr "" +msgstr "__COUNTER__ -fdirectives-only ile talimat içerisinde genişletildi" #: macro.c:535 msgid "invalid string literal, ignoring final '\\'" @@ -823,7 +798,7 @@ #: macro.c:1746 #, c-format msgid "invoking macro %s argument %d: empty macro arguments are undefined in ISO C90 and ISO C++98" -msgstr "" +msgstr "%s makrosu %d argümanı uygulanıyor: ISO C90 ve ISO C++98 içerisinde boş makro argümanları tanımsızdır" #: macro.c:2708 #, c-format @@ -890,38 +865,36 @@ msgid "invalid hash type %d in cpp_macro_definition" msgstr "cpp_macro_definition içindeki isimli yapı türü %d geçersiz" -#: pch.c:87 pch.c:335 pch.c:347 pch.c:365 pch.c:371 pch.c:380 pch.c:387 +#: pch.c:87 pch.c:345 pch.c:359 pch.c:377 pch.c:383 pch.c:392 pch.c:399 msgid "while writing precompiled header" msgstr "önderlemeli başlık yazılırken" -#: pch.c:607 -#, fuzzy, c-format -#| msgid "%s: not used because `%s' is defined" +#: pch.c:619 +#, c-format msgid "%s: not used because `%.*s' is poisoned" -msgstr "%s: `%s' tanımlı olduğundan kullanılmadı" +msgstr "%s: `%.*s' zehirli olduğu için kullanılmadı" -#: pch.c:629 +#: pch.c:641 #, c-format msgid "%s: not used because `%.*s' not defined" msgstr "%s: `%.*s' tanımlı olmadığından kullanılmadı" -#: pch.c:641 +#: pch.c:653 #, c-format msgid "%s: not used because `%.*s' defined as `%s' not `%.*s'" msgstr "%s: `%.*s' kullanılmadı çünkü `%s' olarak tanımlı, `%.*s' değil" -#: pch.c:682 +#: pch.c:694 #, c-format msgid "%s: not used because `%s' is defined" msgstr "%s: `%s' tanımlı olduğundan kullanılmadı" -#: pch.c:702 -#, fuzzy, c-format -#| msgid "%s: not used because `%s' is defined" +#: pch.c:714 +#, c-format msgid "%s: not used because `__COUNTER__' is invalid" -msgstr "%s: `%s' tanımlı olduğundan kullanılmadı" +msgstr "%s: `__COUNTER__' geçersiz olduğundan kullanılmadı" -#: pch.c:711 pch.c:886 +#: pch.c:723 pch.c:898 msgid "while reading precompiled header" msgstr "önderlemeli başlık okunurken"