source:
patches/gcc-4.8.2-branch_update-1.patch@
bd60f9e
Last change on this file since bd60f9e was 88af5df, checked in by , 11 years ago | |
---|---|
|
|
File size: 251.5 KB |
-
ChangeLog
Submitted By: Jim Gifford (jim at cross-lfs dot org) Date: 11-01-2013 Initial Package Version: 4.8.2 Origin: Upstream Upstream Status: Applied Description: This is a branch update for gcc-4.8.2, and should be rechecked periodically. Includes PR tree-optimization/54094 This patch was made from Revision # 204292. diff -Naur gcc-4.8.2.orig/ChangeLog gcc-4.8.2/ChangeLog
old new 7 7 * configure.ac: Also allow ISL 0.12. 8 8 * configure: Regenerated. 9 9 10 PR tree-optimization/54094 11 * graphite-clast-to-gimple.c (translate_clast_for_loop): Derive the 12 scheduling dimension for the parallelism check from the polyhedral 13 information in the AST. 14 * graphite-dependences.c (carries_deps): Do not assume the schedule is 15 in 2D + 1 form. 16 10 17 2013-05-31 Release Manager 11 18 12 19 * GCC 4.8.1 released. -
contrib/gcc_update
diff -Naur gcc-4.8.2.orig/contrib/gcc_update gcc-4.8.2/contrib/gcc_update
old new 382 382 fi 383 383 384 384 revision=`$GCC_SVN info | awk '/Revision:/ { print $2 }'` 385 branch=`$GCC_SVN info | sed -ne "/ URL:/ {385 branch=`$GCC_SVN info | sed -ne "/^URL:/ { 386 386 s,.*/trunk,trunk, 387 387 s,.*/branches/,, 388 388 s,.*/tags/,, -
gcc/DATESTAMP
diff -Naur gcc-4.8.2.orig/gcc/DATESTAMP gcc-4.8.2/gcc/DATESTAMP
old new 1 20131 0161 20131101 -
gcc/ada/gcc-interface/utils.c
diff -Naur gcc-4.8.2.orig/gcc/ada/gcc-interface/utils.c gcc-4.8.2/gcc/ada/gcc-interface/utils.c
old new 232 232 static tree split_plus (tree, tree *); 233 233 static tree float_type_for_precision (int, enum machine_mode); 234 234 static tree convert_to_fat_pointer (tree, tree); 235 static unsigned int scale_by_factor_of (tree, unsigned int); 235 236 static bool potential_alignment_gap (tree, tree, tree); 236 237 static void process_attributes (tree, struct attrib *); 237 238 -
gcc/alias.c
@@ -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; - - /* 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. + /* We're going to do some pattern matching below so remove as many + conversions as possible. */ + curpos = remove_conversions (curpos, true); - If this is a union, the position can be taken as zero. */ + /* See how the position was modified from the last position. - /* Some computations depend on the shape of the position expression, - so strip conversions to make sure it's exposed. */ - curpos = remove_conversions (curpos, true); + 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. */ 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 diff -Naur gcc-4.8.2.orig/gcc/alias.c gcc-4.8.2/gcc/alias.c
old new 2871 2871 /* Wipe the reg_seen array clean. */ 2872 2872 bitmap_clear (reg_seen); 2873 2873 2874 /* Mark all hard registers which may contain an address. 2875 The stack, frame and argument pointers may contain an address. 2876 An argument register which can hold a Pmode value may contain 2877 an address even if it is not in BASE_REGS. 2878 2879 The address expression is VOIDmode for an argument and 2880 Pmode for other registers. */ 2881 2882 memcpy (new_reg_base_value, static_reg_base_value, 2883 FIRST_PSEUDO_REGISTER * sizeof (rtx)); 2874 /* Initialize the alias information for this pass. */ 2875 for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) 2876 if (static_reg_base_value[i]) 2877 { 2878 new_reg_base_value[i] = static_reg_base_value[i]; 2879 bitmap_set_bit (reg_seen, i); 2880 } 2884 2881 2885 2882 /* Walk the insns adding values to the new_reg_base_value array. */ 2886 2883 for (i = 0; i < rpo_cnt; i++) -
gcc/cfgexpand.c
diff -Naur gcc-4.8.2.orig/gcc/cfgexpand.c gcc-4.8.2/gcc/cfgexpand.c
old new 4707 4707 if (e->insns.r) 4708 4708 { 4709 4709 rebuild_jump_labels_chain (e->insns.r); 4710 /* Avoid putting insns before parm_birth_insn. */ 4710 /* Put insns after parm birth, but before 4711 NOTE_INSNS_FUNCTION_BEG. */ 4711 4712 if (e->src == ENTRY_BLOCK_PTR 4712 && single_succ_p (ENTRY_BLOCK_PTR) 4713 && parm_birth_insn) 4713 && single_succ_p (ENTRY_BLOCK_PTR)) 4714 4714 { 4715 4715 rtx insns = e->insns.r; 4716 4716 e->insns.r = NULL_RTX; 4717 emit_insn_after_noloc (insns, parm_birth_insn, e->dest); 4717 if (NOTE_P (parm_birth_insn) 4718 && NOTE_KIND (parm_birth_insn) == NOTE_INSN_FUNCTION_BEG) 4719 emit_insn_before_noloc (insns, parm_birth_insn, e->dest); 4720 else 4721 emit_insn_after_noloc (insns, parm_birth_insn, e->dest); 4718 4722 } 4719 4723 else 4720 4724 commit_one_edge_insertion (e); -
gcc/cgraph.c
diff -Naur gcc-4.8.2.orig/gcc/cgraph.c gcc-4.8.2/gcc/cgraph.c
old new 2596 2596 FOR_EACH_FUNCTION (node) 2597 2597 verify_cgraph_node (node); 2598 2598 } 2599 2600 /* Create external decl node for DECL. 2601 The difference i nbetween cgraph_get_create_node and 2602 cgraph_get_create_real_symbol_node is that cgraph_get_create_node 2603 may return inline clone, while cgraph_get_create_real_symbol_node 2604 will create a new node in this case. 2605 FIXME: This function should be removed once clones are put out of decl 2606 hash. */ 2607 2608 struct cgraph_node * 2609 cgraph_get_create_real_symbol_node (tree decl) 2610 { 2611 struct cgraph_node *first_clone = cgraph_get_node (decl); 2612 struct cgraph_node *node; 2613 /* create symbol table node. even if inline clone exists, we can not take 2614 it as a target of non-inlined call. */ 2615 node = cgraph_get_node (decl); 2616 if (node && !node->global.inlined_to) 2617 return node; 2618 2619 node = cgraph_create_node (decl); 2620 2621 /* ok, we previously inlined the function, then removed the offline copy and 2622 now we want it back for external call. this can happen when devirtualizing 2623 while inlining function called once that happens after extern inlined and 2624 virtuals are already removed. in this case introduce the external node 2625 and make it available for call. */ 2626 if (first_clone) 2627 { 2628 first_clone->clone_of = node; 2629 node->clones = first_clone; 2630 symtab_prevail_in_asm_name_hash ((symtab_node) node); 2631 symtab_insert_node_to_hashtable ((symtab_node) node); 2632 if (dump_file) 2633 fprintf (dump_file, "Introduced new external node " 2634 "(%s/%i) and turned into root of the clone tree.\n", 2635 xstrdup (cgraph_node_name (node)), node->uid); 2636 } 2637 else if (dump_file) 2638 fprintf (dump_file, "Introduced new external node " 2639 "(%s/%i).\n", xstrdup (cgraph_node_name (node)), node->uid); 2640 return node; 2641 } 2599 2642 #include "gt-cgraph.h" -
gcc/cgraph.h
diff -Naur gcc-4.8.2.orig/gcc/cgraph.h gcc-4.8.2/gcc/cgraph.h
old new 575 575 struct cgraph_node * cgraph_create_node (tree); 576 576 struct cgraph_node * cgraph_create_empty_node (void); 577 577 struct cgraph_node * cgraph_get_create_node (tree); 578 struct cgraph_node * cgraph_get_create_real_symbol_node (tree); 578 579 struct cgraph_node * cgraph_same_body_alias (struct cgraph_node *, tree, tree); 579 580 struct cgraph_node * cgraph_add_thunk (struct cgraph_node *, tree, tree, bool, HOST_WIDE_INT, 580 581 HOST_WIDE_INT, tree, tree); -
gcc/cgraphbuild.c
diff -Naur gcc-4.8.2.orig/gcc/cgraphbuild.c gcc-4.8.2/gcc/cgraphbuild.c
old new 73 73 decl = get_base_var (*tp); 74 74 if (TREE_CODE (decl) == FUNCTION_DECL) 75 75 { 76 struct cgraph_node *node = cgraph_get_create_ node (decl);76 struct cgraph_node *node = cgraph_get_create_real_symbol_node (decl); 77 77 if (!ctx->only_vars) 78 78 cgraph_mark_address_taken_node (node); 79 79 ipa_record_reference ((symtab_node)ctx->varpool_node, … … 143 143 { 144 144 struct cgraph_node *per_node; 145 145 146 per_node = cgraph_get_create_ node (DECL_FUNCTION_PERSONALITY (node->symbol.decl));146 per_node = cgraph_get_create_real_symbol_node (DECL_FUNCTION_PERSONALITY (node->symbol.decl)); 147 147 ipa_record_reference ((symtab_node)node, (symtab_node)per_node, IPA_REF_ADDR, NULL); 148 148 cgraph_mark_address_taken_node (per_node); 149 149 } … … 223 223 addr = get_base_address (addr); 224 224 if (TREE_CODE (addr) == FUNCTION_DECL) 225 225 { 226 struct cgraph_node *node = cgraph_get_create_ node (addr);226 struct cgraph_node *node = cgraph_get_create_real_symbol_node (addr); 227 227 cgraph_mark_address_taken_node (node); 228 228 ipa_record_reference ((symtab_node)data, 229 229 (symtab_node)node, … … 252 252 { 253 253 /* ??? This can happen on platforms with descriptors when these are 254 254 directly manipulated in the code. Pretend that it's an address. */ 255 struct cgraph_node *node = cgraph_get_create_ node (t);255 struct cgraph_node *node = cgraph_get_create_real_symbol_node (t); 256 256 cgraph_mark_address_taken_node (node); 257 257 ipa_record_reference ((symtab_node)data, 258 258 (symtab_node)node, … … 330 330 { 331 331 tree fn = gimple_omp_parallel_child_fn (stmt); 332 332 ipa_record_reference ((symtab_node)node, 333 (symtab_node)cgraph_get_create_ node (fn),333 (symtab_node)cgraph_get_create_real_symbol_node (fn), 334 334 IPA_REF_ADDR, stmt); 335 335 } 336 336 if (gimple_code (stmt) == GIMPLE_OMP_TASK) … … 338 338 tree fn = gimple_omp_task_child_fn (stmt); 339 339 if (fn) 340 340 ipa_record_reference ((symtab_node)node, 341 (symtab_node) cgraph_get_create_ node (fn),341 (symtab_node) cgraph_get_create_real_symbol_node (fn), 342 342 IPA_REF_ADDR, stmt); 343 343 fn = gimple_omp_task_copy_fn (stmt); 344 344 if (fn) 345 345 ipa_record_reference ((symtab_node)node, 346 (symtab_node)cgraph_get_create_ node (fn),346 (symtab_node)cgraph_get_create_real_symbol_node (fn), 347 347 IPA_REF_ADDR, stmt); 348 348 } 349 349 } -
gcc/combine.c
diff -Naur gcc-4.8.2.orig/gcc/combine.c gcc-4.8.2/gcc/combine.c
old new 5798 5798 return x; 5799 5799 } 5800 5800 5801 /* If the code changed, return a whole new comparison. */ 5802 if (new_code != code) 5801 /* If the code changed, return a whole new comparison. 5802 We also need to avoid using SUBST in cases where 5803 simplify_comparison has widened a comparison with a CONST_INT, 5804 since in that case the wider CONST_INT may fail the sanity 5805 checks in do_SUBST. */ 5806 if (new_code != code 5807 || (CONST_INT_P (op1) 5808 && GET_MODE (op0) != GET_MODE (XEXP (x, 0)) 5809 && GET_MODE (op0) != GET_MODE (XEXP (x, 1)))) 5803 5810 return gen_rtx_fmt_ee (new_code, mode, op0, op1); 5804 5811 5805 5812 /* Otherwise, keep this operation, but maybe change its operands. -
gcc/config/i386/i386.c
diff -Naur gcc-4.8.2.orig/gcc/config/i386/i386.c gcc-4.8.2/gcc/config/i386/i386.c
old new 2983 2983 {"bdver3", PROCESSOR_BDVER3, CPU_BDVER3, 2984 2984 PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_SSE3 2985 2985 | PTA_SSE4A | PTA_CX16 | PTA_ABM | PTA_SSSE3 | PTA_SSE4_1 2986 | PTA_SSE4_2 | PTA_AES | PTA_PCLMUL | PTA_AVX 2986 | PTA_SSE4_2 | PTA_AES | PTA_PCLMUL | PTA_AVX | PTA_FMA4 2987 2987 | PTA_XOP | PTA_LWP | PTA_BMI | PTA_TBM | PTA_F16C 2988 2988 | PTA_FMA | PTA_PRFCHW | PTA_FXSR | PTA_XSAVE 2989 2989 | PTA_XSAVEOPT}, … … 7235 7235 switch (regno) 7236 7236 { 7237 7237 case AX_REG: 7238 case DX_REG: 7238 7239 return true; 7239 7240 case FIRST_FLOAT_REG: 7240 case DI_REG: 7241 case SI_REG: 7242 return TARGET_64BIT && ix86_abi != MS_ABI; 7243 7244 /* Complex values are returned in %st(0)/%st(1) pair. */ 7245 case ST0_REG: 7246 case ST1_REG: 7241 7247 /* TODO: The function should depend on current function ABI but 7242 7248 builtins.c would need updating then. Therefore we use the 7243 7249 default ABI. */ … … 7245 7251 return false; 7246 7252 return TARGET_FLOAT_RETURNS_IN_80387; 7247 7253 7248 case FIRST_SSE_REG: 7254 /* Complex values are returned in %xmm0/%xmm1 pair. */ 7255 case XMM0_REG: 7256 case XMM1_REG: 7249 7257 return TARGET_SSE; 7250 7258 7251 case FIRST_MMX_REG:7259 case MM0_REG: 7252 7260 if (TARGET_MACHO || TARGET_64BIT) 7253 7261 return false; 7254 7262 return TARGET_MMX; … … 13817 13825 Those same assemblers have the same but opposite lossage on cmov. */ 13818 13826 if (mode == CCmode) 13819 13827 suffix = fp ? "nbe" : "a"; 13820 else if (mode == CCCmode)13821 suffix = "b";13822 13828 else 13823 13829 gcc_unreachable (); 13824 13830 break; … … 13840 13846 } 13841 13847 break; 13842 13848 case LTU: 13843 gcc_assert (mode == CCmode || mode == CCCmode); 13844 suffix = "b"; 13849 if (mode == CCmode) 13850 suffix = "b"; 13851 else if (mode == CCCmode) 13852 suffix = "c"; 13853 else 13854 gcc_unreachable (); 13845 13855 break; 13846 13856 case GE: 13847 13857 switch (mode) … … 13861 13871 } 13862 13872 break; 13863 13873 case GEU: 13864 /* ??? As above. */ 13865 gcc_assert (mode == CCmode || mode == CCCmode); 13866 suffix = fp ? "nb" : "ae"; 13874 if (mode == CCmode) 13875 suffix = fp ? "nb" : "ae"; 13876 else if (mode == CCCmode) 13877 suffix = "nc"; 13878 else 13879 gcc_unreachable (); 13867 13880 break; 13868 13881 case LE: 13869 13882 gcc_assert (mode == CCmode || mode == CCGCmode || mode == CCNOmode); 13870 13883 suffix = "le"; 13871 13884 break; 13872 13885 case LEU: 13873 /* ??? As above. */13874 13886 if (mode == CCmode) 13875 13887 suffix = "be"; 13876 else if (mode == CCCmode)13877 suffix = fp ? "nb" : "ae";13878 13888 else 13879 13889 gcc_unreachable (); 13880 13890 break; … … 18486 18496 return CCmode; 18487 18497 case GTU: /* CF=0 & ZF=0 */ 18488 18498 case LEU: /* CF=1 | ZF=1 */ 18489 /* Detect overflow checks. They need just the carry flag. */ 18490 if (GET_CODE (op0) == MINUS 18491 && rtx_equal_p (op1, XEXP (op0, 0))) 18492 return CCCmode; 18493 else 18494 return CCmode; 18499 return CCmode; 18495 18500 /* Codes possibly doable only with sign flag when 18496 18501 comparing against zero. */ 18497 18502 case GE: /* SF=OF or SF=0 */ -
gcc/config/i386/i386.md
diff -Naur gcc-4.8.2.orig/gcc/config/i386/i386.md gcc-4.8.2/gcc/config/i386/i386.md
old new 6589 6589 (set_attr "use_carry" "1") 6590 6590 (set_attr "mode" "<MODE>")]) 6591 6591 6592 6592 6593 ;; Overflow setting add and subtractinstructions6593 ;; Overflow setting add instructions 6594 6594 6595 6595 (define_insn "*add<mode>3_cconly_overflow" -
gcc/config/rs6000/rs6000.md
[(set (reg:CCC FLAGS_REG) @@ -6604,43 +6604,31 @@ [(set_attr "type" "alu") (set_attr "mode" "<MODE>")]) -(define_insn "*sub<mode>3_cconly_overflow" +(define_insn "*add<mode>3_cc_overflow" [(set (reg:CCC FLAGS_REG) (compare:CCC - (minus:SWI - (match_operand:SWI 0 "nonimmediate_operand" "<r>m,<r>") - (match_operand:SWI 1 "<general_operand>" "<r><i>,<r>m")) - (match_dup 0)))] - "" - "cmp{<imodesuffix>}\t{%1, %0|%0, %1}" - [(set_attr "type" "icmp") - (set_attr "mode" "<MODE>")]) - -(define_insn "*<plusminus_insn><mode>3_cc_overflow" - [(set (reg:CCC FLAGS_REG) - (compare:CCC - (plusminus:SWI - (match_operand:SWI 1 "nonimmediate_operand" "<comm>0,0") + (plus:SWI + (match_operand:SWI 1 "nonimmediate_operand" "%0,0") (match_operand:SWI 2 "<general_operand>" "<r><i>,<r>m")) (match_dup 1))) (set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,<r>") - (plusminus:SWI (match_dup 1) (match_dup 2)))] - "ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)" - "<plusminus_mnemonic>{<imodesuffix>}\t{%2, %0|%0, %2}" + (plus:SWI (match_dup 1) (match_dup 2)))] + "ix86_binary_operator_ok (PLUS, <MODE>mode, operands)" + "add{<imodesuffix>}\t{%2, %0|%0, %2}" [(set_attr "type" "alu") (set_attr "mode" "<MODE>")]) -(define_insn "*<plusminus_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" "<comm>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 (<CODE>, SImode, operands)" - "<plusminus_mnemonic>{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")]) diff -Naur gcc-4.8.2.orig/gcc/config/rs6000/rs6000.md gcc-4.8.2/gcc/config/rs6000/rs6000.md
old new 2412 2412 (match_operand:SI 2 "gpc_reg_operand" "r,r")) 2413 2413 (const_int 0))) 2414 2414 (clobber (match_scratch:SI 3 "=r,r"))] 2415 " "2415 "TARGET_32BIT" 2416 2416 "@ 2417 2417 mullw. %3,%1,%2 2418 2418 #" … … 2425 2425 (match_operand:SI 2 "gpc_reg_operand" "")) 2426 2426 (const_int 0))) 2427 2427 (clobber (match_scratch:SI 3 ""))] 2428 " reload_completed"2428 "TARGET_32BIT && reload_completed" 2429 2429 [(set (match_dup 3) 2430 2430 (mult:SI (match_dup 1) (match_dup 2))) 2431 2431 (set (match_dup 0) … … 2440 2440 (const_int 0))) 2441 2441 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r") 2442 2442 (mult:SI (match_dup 1) (match_dup 2)))] 2443 " "2443 "TARGET_32BIT" 2444 2444 "@ 2445 2445 mullw. %0,%1,%2 2446 2446 #" … … 2454 2454 (const_int 0))) 2455 2455 (set (match_operand:SI 0 "gpc_reg_operand" "") 2456 2456 (mult:SI (match_dup 1) (match_dup 2)))] 2457 " reload_completed"2457 "TARGET_32BIT && reload_completed" 2458 2458 [(set (match_dup 0) 2459 2459 (mult:SI (match_dup 1) (match_dup 2))) 2460 2460 (set (match_dup 3) -
gcc/config/sh/sh.opt
diff -Naur gcc-4.8.2.orig/gcc/config/sh/sh.opt gcc-4.8.2/gcc/config/sh/sh.opt
old new 21 21 ;; Used for various architecture options. 22 22 Mask(SH_E) 23 23 24 ;; Set if the default precision of th FPU is single.24 ;; Set if the default precision of the FPU is single. 25 25 Mask(FPU_SINGLE) 26 26 27 27 ;; Set if the a double-precision FPU is present but is restricted to -
gcc/cp/decl2.c
diff -Naur gcc-4.8.2.orig/gcc/cp/decl2.c gcc-4.8.2/gcc/cp/decl2.c
old new 3960 3960 expand_or_defer_fn (finish_function (0)); 3961 3961 } 3962 3962 3963 /* The entire file is now complete. If requested, dump everything 3964 to a file. */ 3965 3966 static void 3967 dump_tu (void) 3968 { 3969 int flags; 3970 FILE *stream = dump_begin (TDI_tu, &flags); 3971 3972 if (stream) 3973 { 3974 dump_node (global_namespace, flags & ~TDF_SLIM, stream); 3975 dump_end (TDI_tu, stream); 3976 } 3977 } 3978 3963 3979 /* This routine is called at the end of compilation. 3964 3980 Its job is to create all the code needed to initialize and 3965 3981 destroy the global aggregates. We do the destruction … … 3990 4006 if (pch_file) 3991 4007 { 3992 4008 c_common_write_pch (); 4009 dump_tu (); 3993 4010 return; 3994 4011 } 3995 4012 … … 4359 4376 4360 4377 /* The entire file is now complete. If requested, dump everything 4361 4378 to a file. */ 4362 { 4363 int flags; 4364 FILE *stream = dump_begin (TDI_tu, &flags); 4365 4366 if (stream) 4367 { 4368 dump_node (global_namespace, flags & ~TDF_SLIM, stream); 4369 dump_end (TDI_tu, stream); 4370 } 4371 } 4379 dump_tu (); 4372 4380 4373 4381 if (flag_detailed_statistics) 4374 4382 { -
gcc/cp/except.c
diff -Naur gcc-4.8.2.orig/gcc/cp/except.c gcc-4.8.2/gcc/cp/except.c
old new 380 380 { 381 381 tree type = body ? TREE_TYPE (body) : void_type_node; 382 382 383 if (!flag_exceptions) 384 return body; 385 383 386 if (cond && !value_dependent_expression_p (cond)) 384 387 { 385 388 cond = cxx_constant_value (cond); -
gcc/cp/parser.c
diff -Naur gcc-4.8.2.orig/gcc/cp/parser.c gcc-4.8.2/gcc/cp/parser.c
old new 6421 6421 /* Look for the `~'. */ 6422 6422 cp_parser_require (parser, CPP_COMPL, RT_COMPL); 6423 6423 6424 /* Once we see the ~, this has to be a pseudo-destructor. */6425 if (!processing_template_decl && !cp_parser_error_occurred (parser))6426 cp_parser_commit_to_tentative_parse (parser);6427 6428 6424 /* Look for the type-name again. We are not responsible for 6429 6425 checking that it matches the first type-name. */ 6430 6426 *type = cp_parser_nonclass_name (parser); -
gcc/cp/semantics.c
diff -Naur gcc-4.8.2.orig/gcc/cp/semantics.c gcc-4.8.2/gcc/cp/semantics.c
old new 9481 9481 /* In unevaluated context this isn't an odr-use, so just return the 9482 9482 nearest 'this'. */ 9483 9483 if (cp_unevaluated_operand) 9484 return lookup_name (this_identifier); 9484 { 9485 /* In an NSDMI the fake 'this' pointer that we're using for 9486 parsing is in scope_chain. */ 9487 if (LAMBDA_EXPR_EXTRA_SCOPE (lambda) 9488 && TREE_CODE (LAMBDA_EXPR_EXTRA_SCOPE (lambda)) == FIELD_DECL) 9489 return scope_chain->x_current_class_ptr; 9490 return lookup_name (this_identifier); 9491 } 9485 9492 9486 9493 /* Try to default capture 'this' if we can. */ 9487 9494 if (!this_capture -
gcc/gimple-fold.c
diff -Naur gcc-4.8.2.orig/gcc/gimple-fold.c gcc-4.8.2/gcc/gimple-fold.c
old new 178 178 /* Make sure we create a cgraph node for functions we'll reference. 179 179 They can be non-existent if the reference comes from an entry 180 180 of an external vtable for example. */ 181 cgraph_get_create_ node (base);181 cgraph_get_create_real_symbol_node (base); 182 182 } 183 183 /* Fixup types in global initializers. */ 184 184 if (TREE_TYPE (TREE_TYPE (cval)) != TREE_TYPE (TREE_OPERAND (cval, 0))) -
gcc/go/go-gcc.cc
diff -Naur gcc-4.8.2.orig/gcc/go/go-gcc.cc gcc-4.8.2/gcc/go/go-gcc.cc
old new 232 232 Bexpression* 233 233 convert_expression(Btype* type, Bexpression* expr, Location); 234 234 235 Bexpression* 236 function_code_expression(Bfunction*, Location); 237 235 238 // Statements. 236 239 237 240 Bstatement* … … 334 337 Bexpression* 335 338 label_address(Blabel*, Location); 336 339 340 // Functions. 341 342 Bfunction* 343 error_function() 344 { return this->make_function(error_mark_node); } 345 346 Bfunction* 347 function(Btype* fntype, const std::string& name, const std::string& asm_name, 348 bool is_visible, bool is_declaration, bool is_inlinable, 349 bool disable_split_stack, bool in_unique_section, Location); 350 337 351 private: 338 352 // Make a Bexpression from a tree. 339 353 Bexpression* … … 350 364 make_type(tree t) 351 365 { return new Btype(t); } 352 366 367 Bfunction* 368 make_function(tree t) 369 { return new Bfunction(t); } 370 353 371 Btype* 354 372 fill_in_struct(Btype*, const std::vector<Btyped_identifier>&); 355 373 … … 966 984 return tree_to_expr(ret); 967 985 } 968 986 987 // Get the address of a function. 988 989 Bexpression* 990 Gcc_backend::function_code_expression(Bfunction* bfunc, Location location) 991 { 992 tree func = bfunc->get_tree(); 993 if (func == error_mark_node) 994 return this->error_expression(); 995 996 tree ret = build_fold_addr_expr_loc(location.gcc_location(), func); 997 return this->make_expression(ret); 998 } 999 969 1000 // An expression as a statement. 970 1001 971 1002 Bstatement* … … 1724 1755 return this->make_expression(ret); 1725 1756 } 1726 1757 1758 // Declare or define a new function. 1759 1760 Bfunction* 1761 Gcc_backend::function(Btype* fntype, const std::string& name, 1762 const std::string& asm_name, bool is_visible, 1763 bool is_declaration, bool is_inlinable, 1764 bool disable_split_stack, bool in_unique_section, 1765 Location location) 1766 { 1767 tree functype = fntype->get_tree(); 1768 if (functype != error_mark_node) 1769 { 1770 gcc_assert(FUNCTION_POINTER_TYPE_P(functype)); 1771 functype = TREE_TYPE(functype); 1772 } 1773 tree id = get_identifier_from_string(name); 1774 if (functype == error_mark_node || id == error_mark_node) 1775 return this->error_function(); 1776 1777 tree decl = build_decl(location.gcc_location(), FUNCTION_DECL, id, functype); 1778 if (!asm_name.empty()) 1779 SET_DECL_ASSEMBLER_NAME(decl, get_identifier_from_string(asm_name)); 1780 if (is_visible) 1781 TREE_PUBLIC(decl) = 1; 1782 if (is_declaration) 1783 DECL_EXTERNAL(decl) = 1; 1784 else 1785 { 1786 tree restype = TREE_TYPE(functype); 1787 tree resdecl = 1788 build_decl(location.gcc_location(), RESULT_DECL, NULL_TREE, restype); 1789 DECL_ARTIFICIAL(resdecl) = 1; 1790 DECL_IGNORED_P(resdecl) = 1; 1791 DECL_CONTEXT(resdecl) = decl; 1792 DECL_RESULT(decl) = resdecl; 1793 } 1794 if (!is_inlinable) 1795 DECL_UNINLINABLE(decl) = 1; 1796 if (disable_split_stack) 1797 { 1798 tree attr = get_identifier("__no_split_stack__"); 1799 DECL_ATTRIBUTES(decl) = tree_cons(attr, NULL_TREE, NULL_TREE); 1800 } 1801 if (in_unique_section) 1802 resolve_unique_section(decl, 0, 1); 1803 1804 go_preserve_from_gc(decl); 1805 return new Bfunction(decl); 1806 } 1807 1727 1808 // The single backend. 1728 1809 1729 1810 static Gcc_backend gcc_backend; … … 1799 1880 { 1800 1881 return bv->get_tree(); 1801 1882 } 1883 1884 tree 1885 function_to_tree(Bfunction* bf) 1886 { 1887 return bf->get_tree(); 1888 } -
gcc/go/gofrontend/backend.h
diff -Naur gcc-4.8.2.orig/gcc/go/gofrontend/backend.h gcc-4.8.2/gcc/go/gofrontend/backend.h
old new 23 23 // The backend representation of a statement. 24 24 class Bstatement; 25 25 26 // The backend representation of a function definition .26 // The backend representation of a function definition or declaration. 27 27 class Bfunction; 28 28 29 29 // The backend representation of a block. … … 266 266 virtual Bexpression* 267 267 convert_expression(Btype* type, Bexpression* expr, Location) = 0; 268 268 269 // Create an expression for the address of a function. This is used to 270 // get the address of the code for a function. 271 virtual Bexpression* 272 function_code_expression(Bfunction*, Location) = 0; 273 269 274 // Statements. 270 275 271 276 // Create an error statement. This is used for cases which should … … 498 503 // recover. 499 504 virtual Bexpression* 500 505 label_address(Blabel*, Location) = 0; 506 507 // Functions. 508 509 // Create an error function. This is used for cases which should 510 // not occur in a correct program, in order to keep the compilation 511 // going without crashing. 512 virtual Bfunction* 513 error_function() = 0; 514 515 // Declare or define a function of FNTYPE. 516 // NAME is the Go name of the function. ASM_NAME, if not the empty string, is 517 // the name that should be used in the symbol table; this will be non-empty if 518 // a magic extern comment is used. 519 // IS_VISIBLE is true if this function should be visible outside of the 520 // current compilation unit. IS_DECLARATION is true if this is a function 521 // declaration rather than a definition; the function definition will be in 522 // another compilation unit. 523 // IS_INLINABLE is true if the function can be inlined. 524 // DISABLE_SPLIT_STACK is true if this function may not split the stack; this 525 // is used for the implementation of recover. 526 // IN_UNIQUE_SECTION is true if this function should be put into a unique 527 // location if possible; this is used for field tracking. 528 virtual Bfunction* 529 function(Btype* fntype, const std::string& name, const std::string& asm_name, 530 bool is_visible, bool is_declaration, bool is_inlinable, 531 bool disable_split_stack, bool in_unique_section, Location) = 0; 501 532 }; 502 533 503 534 // The backend interface has to define this function. … … 517 548 extern tree stat_to_tree(Bstatement*); 518 549 extern tree block_to_tree(Bblock*); 519 550 extern tree var_to_tree(Bvariable*); 551 extern tree function_to_tree(Bfunction*); 520 552 521 553 #endif // !defined(GO_BACKEND_H) -
gcc/go/gofrontend/expressions.cc
diff -Naur gcc-4.8.2.orig/gcc/go/gofrontend/expressions.cc gcc-4.8.2/gcc/go/gofrontend/expressions.cc
old new 1219 1219 1220 1220 // Get the tree for the code of a function expression. 1221 1221 1222 tree 1222 Bexpression* 1223 1223 Func_expression::get_code_pointer(Gogo* gogo, Named_object* no, Location loc) 1224 1224 { 1225 1225 Function_type* fntype; … … 1237 1237 error_at(loc, 1238 1238 "invalid use of special builtin function %qs; must be called", 1239 1239 no->message_name().c_str()); 1240 return error_mark_node;1240 return gogo->backend()->error_expression(); 1241 1241 } 1242 1242 1243 tree id = no->get_id(gogo); 1244 if (id == error_mark_node) 1245 return error_mark_node; 1246 1247 tree fndecl; 1243 Bfunction* fndecl; 1248 1244 if (no->is_function()) 1249 fndecl = no->func_value()->get_or_make_decl(gogo, no , id);1245 fndecl = no->func_value()->get_or_make_decl(gogo, no); 1250 1246 else if (no->is_function_declaration()) 1251 fndecl = no->func_declaration_value()->get_or_make_decl(gogo, no , id);1247 fndecl = no->func_declaration_value()->get_or_make_decl(gogo, no); 1252 1248 else 1253 1249 go_unreachable(); 1254 1250 1255 if (fndecl == error_mark_node) 1256 return error_mark_node; 1257 1258 return build_fold_addr_expr_loc(loc.gcc_location(), fndecl); 1251 return gogo->backend()->function_code_expression(fndecl, loc); 1259 1252 } 1260 1253 1261 1254 // Get the tree for a function expression. This is used when we take … … 1492 1485 tree 1493 1486 Func_code_reference_expression::do_get_tree(Translate_context* context) 1494 1487 { 1495 return Func_expression::get_code_pointer(context->gogo(), this->function_, 1496 this->location()); 1488 Bexpression* ret = 1489 Func_expression::get_code_pointer(context->gogo(), this->function_, 1490 this->location()); 1491 return expr_to_tree(ret); 1497 1492 } 1498 1493 1499 1494 // Make a reference to the code of a function. … … 3055 3050 do_lower(Gogo*, Named_object*, Statement_inserter*, int); 3056 3051 3057 3052 bool 3058 do_is_constant() const 3059 { return this->expr_->is_constant(); } 3053 do_is_constant() const; 3060 3054 3061 3055 bool 3062 3056 do_numeric_constant_value(Numeric_constant*) const; … … 3198 3192 return this; 3199 3193 } 3200 3194 3195 // Return whether a type conversion is a constant. 3196 3197 bool 3198 Type_conversion_expression::do_is_constant() const 3199 { 3200 if (!this->expr_->is_constant()) 3201 return false; 3202 3203 // A conversion to a type that may not be used as a constant is not 3204 // a constant. For example, []byte(nil). 3205 Type* type = this->type_; 3206 if (type->integer_type() == NULL 3207 && type->float_type() == NULL 3208 && type->complex_type() == NULL 3209 && !type->is_boolean_type() 3210 && !type->is_string_type()) 3211 return false; 3212 3213 return true; 3214 } 3215 3201 3216 // Return the constant numeric value if there is one. 3202 3217 3203 3218 bool … … 5586 5601 subcontext.type = NULL; 5587 5602 } 5588 5603 5604 if (this->op_ == OPERATOR_ANDAND || this->op_ == OPERATOR_OROR) 5605 { 5606 // For a logical operation, the context does not determine the 5607 // types of the operands. The operands must be some boolean 5608 // type but if the context has a boolean type they do not 5609 // inherit it. See http://golang.org/issue/3924. 5610 subcontext.type = NULL; 5611 } 5612 5589 5613 // Set the context for the left hand operand. 5590 5614 if (is_shift_op) 5591 5615 { … … 5967 5991 right); 5968 5992 } 5969 5993 5994 // For complex division Go wants slightly different results than the 5995 // GCC library provides, so we have our own runtime routine. 5996 if (this->op_ == OPERATOR_DIV && this->left_->type()->complex_type() != NULL) 5997 { 5998 const char *name; 5999 tree *pdecl; 6000 Type* ctype; 6001 static tree complex64_div_decl; 6002 static tree complex128_div_decl; 6003 switch (this->left_->type()->complex_type()->bits()) 6004 { 6005 case 64: 6006 name = "__go_complex64_div"; 6007 pdecl = &complex64_div_decl; 6008 ctype = Type::lookup_complex_type("complex64"); 6009 break; 6010 case 128: 6011 name = "__go_complex128_div"; 6012 pdecl = &complex128_div_decl; 6013 ctype = Type::lookup_complex_type("complex128"); 6014 break; 6015 default: 6016 go_unreachable(); 6017 } 6018 Btype* cbtype = ctype->get_backend(gogo); 6019 tree ctype_tree = type_to_tree(cbtype); 6020 return Gogo::call_builtin(pdecl, 6021 this->location(), 6022 name, 6023 2, 6024 ctype_tree, 6025 ctype_tree, 6026 fold_convert_loc(gccloc, ctype_tree, left), 6027 type, 6028 fold_convert_loc(gccloc, ctype_tree, right)); 6029 } 6030 5970 6031 tree compute_type = excess_precision_type(type); 5971 6032 if (compute_type != NULL_TREE) 5972 6033 { … … 7191 7252 if (this->code_ == BUILTIN_OFFSETOF) 7192 7253 { 7193 7254 Expression* arg = this->one_arg(); 7255 7256 if (arg->bound_method_expression() != NULL 7257 || arg->interface_field_reference_expression() != NULL) 7258 { 7259 this->report_error(_("invalid use of method value as argument " 7260 "of Offsetof")); 7261 return this; 7262 } 7263 7194 7264 Field_reference_expression* farg = arg->field_reference_expression(); 7195 7265 while (farg != NULL) 7196 7266 { … … 7200 7270 // it must not be reached through pointer indirections. 7201 7271 if (farg->expr()->deref() != farg->expr()) 7202 7272 { 7203 this->report_error(_("argument of Offsetof implies indirection of an embedded field")); 7273 this->report_error(_("argument of Offsetof implies " 7274 "indirection of an embedded field")); 7204 7275 return this; 7205 7276 } 7206 7277 // Go up until we reach the original base. … … 7476 7547 switch (nc.to_unsigned_long(&v)) 7477 7548 { 7478 7549 case Numeric_constant::NC_UL_VALID: 7479 return true;7550 break; 7480 7551 case Numeric_constant::NC_UL_NOTINT: 7481 7552 error_at(e->location(), "non-integer %s argument to make", 7482 7553 is_length ? "len" : "cap"); … … 7488 7559 case Numeric_constant::NC_UL_BIG: 7489 7560 // We don't want to give a compile-time error for a 64-bit 7490 7561 // value on a 32-bit target. 7491 return true;7562 break; 7492 7563 } 7564 7565 mpz_t val; 7566 if (!nc.to_int(&val)) 7567 go_unreachable(); 7568 int bits = mpz_sizeinbase(val, 2); 7569 mpz_clear(val); 7570 Type* int_type = Type::lookup_integer_type("int"); 7571 if (bits >= int_type->integer_type()->bits()) 7572 { 7573 error_at(e->location(), "%s argument too large for make", 7574 is_length ? "len" : "cap"); 7575 return false; 7576 } 7577 7578 return true; 7493 7579 } 7494 7580 7495 7581 if (e->type()->integer_type() != NULL) … … 7595 7681 bool 7596 7682 Builtin_call_expression::do_is_constant() const 7597 7683 { 7684 if (this->is_error_expression()) 7685 return true; 7598 7686 switch (this->code_) 7599 7687 { 7600 7688 case BUILTIN_LEN: … … 9744 9832 } 9745 9833 9746 9834 tree fntype_tree = type_to_tree(fntype->get_backend(gogo)); 9747 if (fntype_tree == error_mark_node) 9748 return error_mark_node; 9749 go_assert(POINTER_TYPE_P(fntype_tree)); 9750 if (TREE_TYPE(fntype_tree) == error_mark_node) 9751 return error_mark_node; 9752 go_assert(TREE_CODE(TREE_TYPE(fntype_tree)) == RECORD_TYPE); 9753 tree fnfield_type = TREE_TYPE(TYPE_FIELDS(TREE_TYPE(fntype_tree))); 9754 if (fnfield_type == error_mark_node) 9835 tree fnfield_type = type_to_tree(fntype->get_backend_fntype(gogo)); 9836 if (fntype_tree == error_mark_node || fnfield_type == error_mark_node) 9755 9837 return error_mark_node; 9756 9838 go_assert(FUNCTION_POINTER_TYPE_P(fnfield_type)); 9757 9839 tree rettype = TREE_TYPE(TREE_TYPE(fnfield_type)); … … 9763 9845 if (func != NULL) 9764 9846 { 9765 9847 Named_object* no = func->named_object(); 9766 fn = Func_expression::get_code_pointer(gogo, no, location);9848 fn = expr_to_tree(Func_expression::get_code_pointer(gogo, no, location)); 9767 9849 if (!has_closure) 9768 9850 closure_tree = NULL_TREE; 9769 9851 else … … 10817 10899 void 10818 10900 String_index_expression::do_check_types(Gogo*) 10819 10901 { 10820 if (this->start_->type()->integer_type() == NULL) 10902 Numeric_constant nc; 10903 unsigned long v; 10904 if (this->start_->type()->integer_type() == NULL 10905 && !this->start_->type()->is_error() 10906 && (!this->start_->numeric_constant_value(&nc) 10907 || nc.to_unsigned_long(&v) == Numeric_constant::NC_UL_NOTINT)) 10821 10908 this->report_error(_("index must be integer")); 10822 10909 if (this->end_ != NULL 10823 10910 && this->end_->type()->integer_type() == NULL 10824 && !this->end_->is_nil_expression()) 10911 && !this->end_->type()->is_error() 10912 && !this->end_->is_nil_expression() 10913 && !this->end_->is_error_expression() 10914 && (!this->end_->numeric_constant_value(&nc) 10915 || nc.to_unsigned_long(&v) == Numeric_constant::NC_UL_NOTINT)) 10825 10916 this->report_error(_("slice end must be integer")); 10826 10917 10827 10918 std::string sval; -
gcc/go/gofrontend/expressions.h
diff -Naur gcc-4.8.2.orig/gcc/go/gofrontend/expressions.h gcc-4.8.2/gcc/go/gofrontend/expressions.h
old new 1514 1514 closure() 1515 1515 { return this->closure_; } 1516 1516 1517 // Return a tree for the code fora function.1518 static tree1517 // Return a backend expression for the code of a function. 1518 static Bexpression* 1519 1519 get_code_pointer(Gogo*, Named_object* function, Location loc); 1520 1520 1521 1521 protected: -
gcc/go/gofrontend/gogo-tree.cc
diff -Naur gcc-4.8.2.orig/gcc/go/gofrontend/gogo-tree.cc gcc-4.8.2/gcc/go/gofrontend/gogo-tree.cc
old new 985 985 delete[] vec; 986 986 } 987 987 988 // Get a tree for the identifier for a named object.989 990 tree991 Named_object::get_id(Gogo* gogo)992 {993 go_assert(!this->is_variable() && !this->is_result_variable());994 std::string decl_name;995 if (this->is_function_declaration()996 && !this->func_declaration_value()->asm_name().empty())997 decl_name = this->func_declaration_value()->asm_name();998 else if (this->is_type()999 && Linemap::is_predeclared_location(this->type_value()->location()))1000 {1001 // We don't need the package name for builtin types.1002 decl_name = Gogo::unpack_hidden_name(this->name_);1003 }1004 else1005 {1006 std::string package_name;1007 if (this->package_ == NULL)1008 package_name = gogo->package_name();1009 else1010 package_name = this->package_->package_name();1011 1012 // Note that this will be misleading if this is an unexported1013 // method generated for an embedded imported type. In that case1014 // the unexported method should have the package name of the1015 // package from which it is imported, but we are going to give1016 // it our package name. Fixing this would require knowing the1017 // package name, but we only know the package path. It might be1018 // better to use package paths here anyhow. This doesn't affect1019 // the assembler code, because we always set that name in1020 // Function::get_or_make_decl anyhow. FIXME.1021 1022 decl_name = package_name + '.' + Gogo::unpack_hidden_name(this->name_);1023 1024 Function_type* fntype;1025 if (this->is_function())1026 fntype = this->func_value()->type();1027 else if (this->is_function_declaration())1028 fntype = this->func_declaration_value()->type();1029 else1030 fntype = NULL;1031 if (fntype != NULL && fntype->is_method())1032 {1033 decl_name.push_back('.');1034 decl_name.append(fntype->receiver()->type()->mangled_name(gogo));1035 }1036 }1037 if (this->is_type())1038 {1039 unsigned int index;1040 const Named_object* in_function = this->type_value()->in_function(&index);1041 if (in_function != NULL)1042 {1043 decl_name += '$' + Gogo::unpack_hidden_name(in_function->name());1044 if (index > 0)1045 {1046 char buf[30];1047 snprintf(buf, sizeof buf, "%u", index);1048 decl_name += '$';1049 decl_name += buf;1050 }1051 }1052 }1053 return get_identifier_from_string(decl_name);1054 }1055 1056 988 // Get a tree for a named object. 1057 989 1058 990 tree … … 1067 999 return error_mark_node; 1068 1000 } 1069 1001 1070 tree name;1071 if (this->classification_ == NAMED_OBJECT_TYPE)1072 name = NULL_TREE;1073 else1074 name = this->get_id(gogo);1075 1002 tree decl; 1076 1003 switch (this->classification_) 1077 1004 { … … 1099 1026 decl = error_mark_node; 1100 1027 else if (INTEGRAL_TYPE_P(TREE_TYPE(expr_tree))) 1101 1028 { 1029 tree name = get_identifier_from_string(this->get_id(gogo)); 1102 1030 decl = build_decl(named_constant->location().gcc_location(), 1103 1031 CONST_DECL, name, TREE_TYPE(expr_tree)); 1104 1032 DECL_INITIAL(decl) = expr_tree; … … 1161 1089 case NAMED_OBJECT_FUNC: 1162 1090 { 1163 1091 Function* func = this->u_.func_value; 1164 decl = func ->get_or_make_decl(gogo, this, name);1092 decl = function_to_tree(func->get_or_make_decl(gogo, this)); 1165 1093 if (decl != error_mark_node) 1166 1094 { 1167 1095 if (func->block() != NULL) … … 1286 1214 return block_tree; 1287 1215 } 1288 1216 1289 // Get a tree for a function decl.1217 // Get the backend representation. 1290 1218 1291 tree 1292 Function ::get_or_make_decl(Gogo* gogo, Named_object* no, tree id)1219 Bfunction* 1220 Function_declaration::get_or_make_decl(Gogo* gogo, Named_object* no) 1293 1221 { 1294 if (this->fndecl_ == NULL_TREE) 1295 { 1296 tree functype = type_to_tree(this->type_->get_backend(gogo)); 1297 1298 if (functype != error_mark_node) 1299 { 1300 // The type of a function comes back as a pointer to a 1301 // struct whose first field is the function, but we want the 1302 // real function type for a function declaration. 1303 go_assert(POINTER_TYPE_P(functype) 1304 && TREE_CODE(TREE_TYPE(functype)) == RECORD_TYPE); 1305 functype = TREE_TYPE(TYPE_FIELDS(TREE_TYPE(functype))); 1306 go_assert(FUNCTION_POINTER_TYPE_P(functype)); 1307 functype = TREE_TYPE(functype); 1308 } 1309 1310 if (functype == error_mark_node) 1311 this->fndecl_ = error_mark_node; 1312 else 1313 { 1314 tree decl = build_decl(this->location().gcc_location(), FUNCTION_DECL, 1315 id, functype); 1316 1317 this->fndecl_ = decl; 1318 1319 if (no->package() != NULL) 1320 ; 1321 else if (this->enclosing_ != NULL || Gogo::is_thunk(no)) 1322 ; 1323 else if (Gogo::unpack_hidden_name(no->name()) == "init" 1324 && !this->type_->is_method()) 1325 ; 1326 else if (Gogo::unpack_hidden_name(no->name()) == "main" 1327 && gogo->is_main_package()) 1328 TREE_PUBLIC(decl) = 1; 1329 // Methods have to be public even if they are hidden because 1330 // they can be pulled into type descriptors when using 1331 // anonymous fields. 1332 else if (!Gogo::is_hidden_name(no->name()) 1333 || this->type_->is_method()) 1334 { 1335 TREE_PUBLIC(decl) = 1; 1336 std::string pkgpath = gogo->pkgpath_symbol(); 1337 if (this->type_->is_method() 1338 && Gogo::is_hidden_name(no->name()) 1339 && Gogo::hidden_name_pkgpath(no->name()) != gogo->pkgpath()) 1340 { 1341 // This is a method we created for an unexported 1342 // method of an imported embedded type. We need to 1343 // use the pkgpath of the imported package to avoid 1344 // a possible name collision. See bug478 for a test 1345 // case. 1346 pkgpath = Gogo::hidden_name_pkgpath(no->name()); 1347 pkgpath = Gogo::pkgpath_for_symbol(pkgpath); 1348 } 1349 1350 std::string asm_name = pkgpath; 1351 asm_name.append(1, '.'); 1352 asm_name.append(Gogo::unpack_hidden_name(no->name())); 1353 if (this->type_->is_method()) 1354 { 1355 asm_name.append(1, '.'); 1356 Type* rtype = this->type_->receiver()->type(); 1357 asm_name.append(rtype->mangled_name(gogo)); 1358 } 1359 SET_DECL_ASSEMBLER_NAME(decl, 1360 get_identifier_from_string(asm_name)); 1361 } 1362 1363 // Why do we have to do this in the frontend? 1364 tree restype = TREE_TYPE(functype); 1365 tree resdecl = 1366 build_decl(this->location().gcc_location(), RESULT_DECL, NULL_TREE, 1367 restype); 1368 DECL_ARTIFICIAL(resdecl) = 1; 1369 DECL_IGNORED_P(resdecl) = 1; 1370 DECL_CONTEXT(resdecl) = decl; 1371 DECL_RESULT(decl) = resdecl; 1372 1373 // If a function calls the predeclared recover function, we 1374 // can't inline it, because recover behaves differently in a 1375 // function passed directly to defer. If this is a recover 1376 // thunk that we built to test whether a function can be 1377 // recovered, we can't inline it, because that will mess up 1378 // our return address comparison. 1379 if (this->calls_recover_ || this->is_recover_thunk_) 1380 DECL_UNINLINABLE(decl) = 1; 1381 1382 // If this is a thunk created to call a function which calls 1383 // the predeclared recover function, we need to disable 1384 // stack splitting for the thunk. 1385 if (this->is_recover_thunk_) 1386 { 1387 tree attr = get_identifier("__no_split_stack__"); 1388 DECL_ATTRIBUTES(decl) = tree_cons(attr, NULL_TREE, NULL_TREE); 1389 } 1390 1391 if (this->in_unique_section_) 1392 resolve_unique_section (decl, 0, 1); 1393 1394 go_preserve_from_gc(decl); 1395 } 1396 } 1397 return this->fndecl_; 1398 } 1399 1400 // Get a tree for a function declaration. 1401 1402 tree 1403 Function_declaration::get_or_make_decl(Gogo* gogo, Named_object* no, tree id) 1404 { 1405 if (this->fndecl_ == NULL_TREE) 1222 if (this->fndecl_ == NULL) 1406 1223 { 1407 1224 // Let Go code use an asm declaration to pick up a builtin 1408 1225 // function. … … 1412 1229 builtin_functions.find(this->asm_name_); 1413 1230 if (p != builtin_functions.end()) 1414 1231 { 1415 this->fndecl_ = p->second;1232 this->fndecl_ = tree_to_function(p->second); 1416 1233 return this->fndecl_; 1417 1234 } 1418 1235 } 1419 1236 1420 tree functype = type_to_tree(this->fntype_->get_backend(gogo)); 1237 std::string asm_name; 1238 if (this->asm_name_.empty()) 1239 { 1240 asm_name = (no->package() == NULL 1241 ? gogo->pkgpath_symbol() 1242 : no->package()->pkgpath_symbol()); 1243 asm_name.append(1, '.'); 1244 asm_name.append(Gogo::unpack_hidden_name(no->name())); 1245 if (this->fntype_->is_method()) 1246 { 1247 asm_name.append(1, '.'); 1248 Type* rtype = this->fntype_->receiver()->type(); 1249 asm_name.append(rtype->mangled_name(gogo)); 1250 } 1251 } 1252 1253 Btype* functype = this->fntype_->get_backend_fntype(gogo); 1254 this->fndecl_ = 1255 gogo->backend()->function(functype, no->get_id(gogo), asm_name, 1256 true, true, true, false, false, 1257 this->location()); 1258 } 1421 1259 1422 if (functype != error_mark_node) 1423 { 1424 // The type of a function comes back as a pointer to a 1425 // struct whose first field is the function, but we want the 1426 // real function type for a function declaration. 1427 go_assert(POINTER_TYPE_P(functype) 1428 && TREE_CODE(TREE_TYPE(functype)) == RECORD_TYPE); 1429 functype = TREE_TYPE(TYPE_FIELDS(TREE_TYPE(functype))); 1430 go_assert(FUNCTION_POINTER_TYPE_P(functype)); 1431 functype = TREE_TYPE(functype); 1432 } 1260 return this->fndecl_; 1261 } 1433 1262 1434 tree decl; 1435 if (functype == error_mark_node) 1436 decl = error_mark_node; 1437 else 1438 { 1439 decl = build_decl(this->location().gcc_location(), FUNCTION_DECL, id, 1440 functype); 1441 TREE_PUBLIC(decl) = 1; 1442 DECL_EXTERNAL(decl) = 1; 1263 // Return the function's decl after it has been built. 1443 1264 1444 if (this->asm_name_.empty()) 1445 { 1446 std::string asm_name = (no->package() == NULL 1447 ? gogo->pkgpath_symbol() 1448 : no->package()->pkgpath_symbol()); 1449 asm_name.append(1, '.'); 1450 asm_name.append(Gogo::unpack_hidden_name(no->name())); 1451 if (this->fntype_->is_method()) 1452 { 1453 asm_name.append(1, '.'); 1454 Type* rtype = this->fntype_->receiver()->type(); 1455 asm_name.append(rtype->mangled_name(gogo)); 1456 } 1457 SET_DECL_ASSEMBLER_NAME(decl, 1458 get_identifier_from_string(asm_name)); 1459 } 1460 } 1461 this->fndecl_ = decl; 1462 go_preserve_from_gc(decl); 1463 } 1464 return this->fndecl_; 1265 tree 1266 Function::get_decl() const 1267 { 1268 go_assert(this->fndecl_ != NULL); 1269 return function_to_tree(this->fndecl_); 1465 1270 } 1466 1271 1467 1272 // We always pass the receiver to a method as a pointer. If the … … 1558 1363 void 1559 1364 Function::build_tree(Gogo* gogo, Named_object* named_function) 1560 1365 { 1561 tree fndecl = this-> fndecl_;1366 tree fndecl = this->get_decl(); 1562 1367 go_assert(fndecl != NULL_TREE); 1563 1368 1564 1369 tree params = NULL_TREE; … … 1796 1601 set = NULL_TREE; 1797 1602 else 1798 1603 set = fold_build2_loc(end_loc.gcc_location(), MODIFY_EXPR, void_type_node, 1799 DECL_RESULT(this-> fndecl_), retval);1604 DECL_RESULT(this->get_decl()), retval); 1800 1605 tree ret_stmt = fold_build1_loc(end_loc.gcc_location(), RETURN_EXPR, 1801 1606 void_type_node, set); 1802 1607 append_to_statement_list(ret_stmt, &stmt_list); … … 1851 1656 retval = this->return_value(gogo, named_function, end_loc, 1852 1657 &stmt_list); 1853 1658 set = fold_build2_loc(end_loc.gcc_location(), MODIFY_EXPR, void_type_node, 1854 DECL_RESULT(this-> fndecl_), retval);1659 DECL_RESULT(this->get_decl()), retval); 1855 1660 ret_stmt = fold_build1_loc(end_loc.gcc_location(), RETURN_EXPR, 1856 1661 void_type_node, set); 1857 1662 … … 1869 1674 *fini = stmt_list; 1870 1675 } 1871 1676 1872 // Return the value to assign to DECL_RESULT(this-> fndecl_). This may1677 // Return the value to assign to DECL_RESULT(this->get_decl()). This may 1873 1678 // also add statements to STMT_LIST, which need to be executed before 1874 1679 // the assignment. This is used for a return statement with no 1875 1680 // explicit values. … … 1902 1707 } 1903 1708 else 1904 1709 { 1905 tree rettype = TREE_TYPE(DECL_RESULT(this-> fndecl_));1710 tree rettype = TREE_TYPE(DECL_RESULT(this->get_decl())); 1906 1711 retval = create_tmp_var(rettype, "RESULT"); 1907 1712 tree field = TYPE_FIELDS(rettype); 1908 1713 int index = 0; … … 2323 2128 go_assert(m != NULL); 2324 2129 2325 2130 Named_object* no = m->named_object(); 2326 2327 tree fnid = no->get_id(this); 2328 2329 tree fndecl; 2131 Bfunction* bf; 2330 2132 if (no->is_function()) 2331 fndecl = no->func_value()->get_or_make_decl(this, no, fnid);2133 bf = no->func_value()->get_or_make_decl(this, no); 2332 2134 else if (no->is_function_declaration()) 2333 fndecl = no->func_declaration_value()->get_or_make_decl(this, no, 2334 fnid); 2135 bf = no->func_declaration_value()->get_or_make_decl(this, no); 2335 2136 else 2336 2137 go_unreachable(); 2337 fndecl = build_fold_addr_expr(fndecl);2138 tree fndecl = build_fold_addr_expr(function_to_tree(bf)); 2338 2139 2339 2140 elt = pointers->quick_push(empty); 2340 2141 elt->index = size_int(i); … … 2353 2154 TREE_CONSTANT(decl) = 1; 2354 2155 DECL_INITIAL(decl) = constructor; 2355 2156 2356 // If the interface type has hidden methods, then this is the only 2357 // definition of the table. Otherwise it is a comdat table which 2358 // may be defined in multiple packages. 2359 if (has_hidden_methods) 2157 // If the interface type has hidden methods, and the table is for a 2158 // named type, then this is the only definition of the table. 2159 // Otherwise it is a comdat table which may be defined in multiple 2160 // packages. 2161 if (has_hidden_methods && type->named_type() != NULL) 2360 2162 TREE_PUBLIC(decl) = 1; 2361 2163 else 2362 2164 { -
gcc/go/gofrontend/gogo.cc
diff -Naur gcc-4.8.2.orig/gcc/go/gofrontend/gogo.cc gcc-4.8.2/gcc/go/gofrontend/gogo.cc
old new 3320 3320 closure_var_(NULL), block_(block), location_(location), labels_(), 3321 3321 local_type_count_(0), descriptor_(NULL), fndecl_(NULL), defer_stack_(NULL), 3322 3322 is_sink_(false), results_are_named_(false), nointerface_(false), 3323 calls_recover_(false), is_recover_thunk_(false), has_recover_thunk_(false), 3323 is_unnamed_type_stub_method_(false), calls_recover_(false), 3324 is_recover_thunk_(false), has_recover_thunk_(false), 3324 3325 in_unique_section_(false) 3325 3326 { 3326 3327 } … … 3819 3820 *presults = results; 3820 3821 } 3821 3822 3823 // Get the backend representation. 3824 3825 Bfunction* 3826 Function::get_or_make_decl(Gogo* gogo, Named_object* no) 3827 { 3828 if (this->fndecl_ == NULL) 3829 { 3830 std::string asm_name; 3831 bool is_visible = false; 3832 if (no->package() != NULL) 3833 ; 3834 else if (this->enclosing_ != NULL || Gogo::is_thunk(no)) 3835 ; 3836 else if (Gogo::unpack_hidden_name(no->name()) == "init" 3837 && !this->type_->is_method()) 3838 ; 3839 else if (Gogo::unpack_hidden_name(no->name()) == "main" 3840 && gogo->is_main_package()) 3841 is_visible = true; 3842 // Methods have to be public even if they are hidden because 3843 // they can be pulled into type descriptors when using 3844 // anonymous fields. 3845 else if (!Gogo::is_hidden_name(no->name()) 3846 || this->type_->is_method()) 3847 { 3848 if (!this->is_unnamed_type_stub_method_) 3849 is_visible = true; 3850 std::string pkgpath = gogo->pkgpath_symbol(); 3851 if (this->type_->is_method() 3852 && Gogo::is_hidden_name(no->name()) 3853 && Gogo::hidden_name_pkgpath(no->name()) != gogo->pkgpath()) 3854 { 3855 // This is a method we created for an unexported 3856 // method of an imported embedded type. We need to 3857 // use the pkgpath of the imported package to avoid 3858 // a possible name collision. See bug478 for a test 3859 // case. 3860 pkgpath = Gogo::hidden_name_pkgpath(no->name()); 3861 pkgpath = Gogo::pkgpath_for_symbol(pkgpath); 3862 } 3863 3864 asm_name = pkgpath; 3865 asm_name.append(1, '.'); 3866 asm_name.append(Gogo::unpack_hidden_name(no->name())); 3867 if (this->type_->is_method()) 3868 { 3869 asm_name.append(1, '.'); 3870 Type* rtype = this->type_->receiver()->type(); 3871 asm_name.append(rtype->mangled_name(gogo)); 3872 } 3873 } 3874 3875 // If a function calls the predeclared recover function, we 3876 // can't inline it, because recover behaves differently in a 3877 // function passed directly to defer. If this is a recover 3878 // thunk that we built to test whether a function can be 3879 // recovered, we can't inline it, because that will mess up 3880 // our return address comparison. 3881 bool is_inlinable = !(this->calls_recover_ || this->is_recover_thunk_); 3882 3883 // If this is a thunk created to call a function which calls 3884 // the predeclared recover function, we need to disable 3885 // stack splitting for the thunk. 3886 bool disable_split_stack = this->is_recover_thunk_; 3887 3888 Btype* functype = this->type_->get_backend_fntype(gogo); 3889 this->fndecl_ = 3890 gogo->backend()->function(functype, no->get_id(gogo), asm_name, 3891 is_visible, false, is_inlinable, 3892 disable_split_stack, 3893 this->in_unique_section_, this->location()); 3894 } 3895 return this->fndecl_; 3896 } 3897 3822 3898 // Class Block. 3823 3899 3824 3900 Block::Block(Block* enclosing, Location location) … … 5110 5186 go_unreachable(); 5111 5187 } 5112 5188 5189 5190 // Return the external identifier for this object. 5191 5192 std::string 5193 Named_object::get_id(Gogo* gogo) 5194 { 5195 go_assert(!this->is_variable() && !this->is_result_variable()); 5196 std::string decl_name; 5197 if (this->is_function_declaration() 5198 && !this->func_declaration_value()->asm_name().empty()) 5199 decl_name = this->func_declaration_value()->asm_name(); 5200 else if (this->is_type() 5201 && Linemap::is_predeclared_location(this->type_value()->location())) 5202 { 5203 // We don't need the package name for builtin types. 5204 decl_name = Gogo::unpack_hidden_name(this->name_); 5205 } 5206 else 5207 { 5208 std::string package_name; 5209 if (this->package_ == NULL) 5210 package_name = gogo->package_name(); 5211 else 5212 package_name = this->package_->package_name(); 5213 5214 // Note that this will be misleading if this is an unexported 5215 // method generated for an embedded imported type. In that case 5216 // the unexported method should have the package name of the 5217 // package from which it is imported, but we are going to give 5218 // it our package name. Fixing this would require knowing the 5219 // package name, but we only know the package path. It might be 5220 // better to use package paths here anyhow. This doesn't affect 5221 // the assembler code, because we always set that name in 5222 // Function::get_or_make_decl anyhow. FIXME. 5223 5224 decl_name = package_name + '.' + Gogo::unpack_hidden_name(this->name_); 5225 5226 Function_type* fntype; 5227 if (this->is_function()) 5228 fntype = this->func_value()->type(); 5229 else if (this->is_function_declaration()) 5230 fntype = this->func_declaration_value()->type(); 5231 else 5232 fntype = NULL; 5233 if (fntype != NULL && fntype->is_method()) 5234 { 5235 decl_name.push_back('.'); 5236 decl_name.append(fntype->receiver()->type()->mangled_name(gogo)); 5237 } 5238 } 5239 if (this->is_type()) 5240 { 5241 unsigned int index; 5242 const Named_object* in_function = this->type_value()->in_function(&index); 5243 if (in_function != NULL) 5244 { 5245 decl_name += '$' + Gogo::unpack_hidden_name(in_function->name()); 5246 if (index > 0) 5247 { 5248 char buf[30]; 5249 snprintf(buf, sizeof buf, "%u", index); 5250 decl_name += '$'; 5251 decl_name += buf; 5252 } 5253 } 5254 } 5255 return decl_name; 5256 } 5257 5113 5258 // Class Bindings. 5114 5259 5115 5260 Bindings::Bindings(Bindings* enclosing) -
gcc/go/gofrontend/gogo.h
diff -Naur gcc-4.8.2.orig/gcc/go/gofrontend/gogo.h gcc-4.8.2/gcc/go/gofrontend/gogo.h
old new 48 48 class Bblock; 49 49 class Bvariable; 50 50 class Blabel; 51 class Bfunction; 51 52 52 53 // This file declares the basic classes used to hold the internal 53 54 // representation of Go which is built by the parser. … … 952 953 this->nointerface_ = true; 953 954 } 954 955 956 // Record that this function is a stub method created for an unnamed 957 // type. 958 void 959 set_is_unnamed_type_stub_method() 960 { 961 go_assert(this->is_method()); 962 this->is_unnamed_type_stub_method_ = true; 963 } 964 955 965 // Add a new field to the closure variable. 956 966 void 957 967 add_closure_field(Named_object* var, Location loc) … … 1089 1099 this->descriptor_ = descriptor; 1090 1100 } 1091 1101 1092 // Return the function's decl given an identifier.1093 tree1094 get_or_make_decl(Gogo*, Named_object* , tree id);1102 // Return the backend representation. 1103 Bfunction* 1104 get_or_make_decl(Gogo*, Named_object*); 1095 1105 1096 1106 // Return the function's decl after it has been built. 1097 1107 tree 1098 get_decl() const 1099 { 1100 go_assert(this->fndecl_ != NULL); 1101 return this->fndecl_; 1102 } 1108 get_decl() const; 1103 1109 1104 1110 // Set the function decl to hold a tree of the function code. 1105 1111 void … … 1170 1176 // The function descriptor, if any. 1171 1177 Expression* descriptor_; 1172 1178 // The function decl. 1173 treefndecl_;1179 Bfunction* fndecl_; 1174 1180 // The defer stack variable. A pointer to this variable is used to 1175 1181 // distinguish the defer stack for one function from another. This 1176 1182 // is NULL unless we actually need a defer stack. … … 1181 1187 bool results_are_named_ : 1; 1182 1188 // True if this method should not be included in the type descriptor. 1183 1189 bool nointerface_ : 1; 1190 // True if this function is a stub method created for an unnamed 1191 // type. 1192 bool is_unnamed_type_stub_method_ : 1; 1184 1193 // True if this function calls the predeclared recover function. 1185 1194 bool calls_recover_ : 1; 1186 1195 // True if this a thunk built for a function which calls recover. … … 1265 1274 has_descriptor() const 1266 1275 { return this->descriptor_ != NULL; } 1267 1276 1268 // Return a decl for the function given an identifier.1269 tree1270 get_or_make_decl(Gogo*, Named_object* , tree id);1277 // Return a backend representation. 1278 Bfunction* 1279 get_or_make_decl(Gogo*, Named_object*); 1271 1280 1272 1281 // If there is a descriptor, build it into the backend 1273 1282 // representation. … … 1290 1299 // The function descriptor, if any. 1291 1300 Expression* descriptor_; 1292 1301 // The function decl if needed. 1293 treefndecl_;1302 Bfunction* fndecl_; 1294 1303 }; 1295 1304 1296 1305 // A variable. … … 2181 2190 Bvariable* 2182 2191 get_backend_variable(Gogo*, Named_object* function); 2183 2192 2184 // Return a tree forthe external identifier for this object.2185 tree2193 // Return the external identifier for this object. 2194 std::string 2186 2195 get_id(Gogo*); 2187 2196 2188 2197 // Return a tree representing this object. -
gcc/go/gofrontend/import.h
diff -Naur gcc-4.8.2.orig/gcc/go/gofrontend/import.h gcc-4.8.2/gcc/go/gofrontend/import.h
old new 149 149 location() const 150 150 { return this->location_; } 151 151 152 // Return the package we are importing. 153 Package* 154 package() const 155 { return this->package_; } 156 152 157 // Return the next character. 153 158 int 154 159 peek_char() -
gcc/go/gofrontend/lex.cc
diff -Naur gcc-4.8.2.orig/gcc/go/gofrontend/lex.cc gcc-4.8.2/gcc/go/gofrontend/lex.cc
old new 873 873 && (cc < 'a' || cc > 'z') 874 874 && cc != '_' 875 875 && (cc < '0' || cc > '9')) 876 break; 876 { 877 // Check for an invalid character here, as we get better 878 // error behaviour if we swallow them as part of the 879 // identifier we are building. 880 if ((cc >= ' ' && cc < 0x7f) 881 || cc == '\t' 882 || cc == '\r' 883 || cc == '\n') 884 break; 885 886 this->lineoff_ = p - this->linebuf_; 887 error_at(this->location(), 888 "invalid character 0x%x in identifier", 889 cc); 890 if (!has_non_ascii_char) 891 { 892 buf.assign(pstart, p - pstart); 893 has_non_ascii_char = true; 894 } 895 if (!Lex::is_invalid_identifier(buf)) 896 buf.append("$INVALID$"); 897 } 877 898 ++p; 878 899 if (is_first) 879 900 { -
gcc/go/gofrontend/parse.cc
diff -Naur gcc-4.8.2.orig/gcc/go/gofrontend/parse.cc gcc-4.8.2/gcc/go/gofrontend/parse.cc
old new 744 744 return NULL; 745 745 746 746 Parse::Names names; 747 if (receiver != NULL) 748 names[receiver->name()] = receiver; 747 749 if (params != NULL) 748 750 this->check_signature_names(params, &names); 749 751 if (results != NULL) -
gcc/go/gofrontend/runtime.cc
diff -Naur gcc-4.8.2.orig/gcc/go/gofrontend/runtime.cc gcc-4.8.2/gcc/go/gofrontend/runtime.cc
old new 42 42 RFT_RUNE, 43 43 // Go type float64, C type double. 44 44 RFT_FLOAT64, 45 // Go type complex64, C type __complex float. 46 RFT_COMPLEX64, 45 47 // Go type complex128, C type __complex double. 46 48 RFT_COMPLEX128, 47 49 // Go type string, C type struct __go_string. … … 126 128 t = Type::lookup_float_type("float64"); 127 129 break; 128 130 131 case RFT_COMPLEX64: 132 t = Type::lookup_complex_type("complex64"); 133 break; 134 129 135 case RFT_COMPLEX128: 130 136 t = Type::lookup_complex_type("complex128"); 131 137 break; … … 216 222 case RFT_UINTPTR: 217 223 case RFT_RUNE: 218 224 case RFT_FLOAT64: 225 case RFT_COMPLEX64: 219 226 case RFT_COMPLEX128: 220 227 case RFT_STRING: 221 228 case RFT_POINTER: -
gcc/go/gofrontend/runtime.def
diff -Naur gcc-4.8.2.orig/gcc/go/gofrontend/runtime.def gcc-4.8.2/gcc/go/gofrontend/runtime.def
old new 68 68 P1(STRING), R1(SLICE)) 69 69 70 70 71 // Complex division. 72 DEF_GO_RUNTIME(COMPLEX64_DIV, "__go_complex64_div", 73 P2(COMPLEX64, COMPLEX64), R1(COMPLEX64)) 74 DEF_GO_RUNTIME(COMPLEX128_DIV, "__go_complex128_div", 75 P2(COMPLEX128, COMPLEX128), R1(COMPLEX128)) 76 71 77 // Make a slice. 72 78 DEF_GO_RUNTIME(MAKESLICE1, "__go_make_slice1", P2(TYPE, UINTPTR), R1(SLICE)) 73 79 DEF_GO_RUNTIME(MAKESLICE2, "__go_make_slice2", P3(TYPE, UINTPTR, UINTPTR), -
gcc/go/gofrontend/types.cc
diff -Naur gcc-4.8.2.orig/gcc/go/gofrontend/types.cc gcc-4.8.2/gcc/go/gofrontend/types.cc
old new 3383 3383 // Get the backend representation for a function type. 3384 3384 3385 3385 Btype* 3386 Function_type::get_backend_fntype(Gogo* gogo) 3387 { 3388 if (this->fnbtype_ == NULL) 3389 { 3390 Backend::Btyped_identifier breceiver; 3391 if (this->receiver_ != NULL) 3392 { 3393 breceiver.name = Gogo::unpack_hidden_name(this->receiver_->name()); 3394 3395 // We always pass the address of the receiver parameter, in 3396 // order to make interface calls work with unknown types. 3397 Type* rtype = this->receiver_->type(); 3398 if (rtype->points_to() == NULL) 3399 rtype = Type::make_pointer_type(rtype); 3400 breceiver.btype = rtype->get_backend(gogo); 3401 breceiver.location = this->receiver_->location(); 3402 } 3403 3404 std::vector<Backend::Btyped_identifier> bparameters; 3405 if (this->parameters_ != NULL) 3406 { 3407 bparameters.resize(this->parameters_->size()); 3408 size_t i = 0; 3409 for (Typed_identifier_list::const_iterator p = 3410 this->parameters_->begin(); p != this->parameters_->end(); 3411 ++p, ++i) 3412 { 3413 bparameters[i].name = Gogo::unpack_hidden_name(p->name()); 3414 bparameters[i].btype = p->type()->get_backend(gogo); 3415 bparameters[i].location = p->location(); 3416 } 3417 go_assert(i == bparameters.size()); 3418 } 3419 3420 std::vector<Backend::Btyped_identifier> bresults; 3421 if (this->results_ != NULL) 3422 { 3423 bresults.resize(this->results_->size()); 3424 size_t i = 0; 3425 for (Typed_identifier_list::const_iterator p = 3426 this->results_->begin(); p != this->results_->end(); 3427 ++p, ++i) 3428 { 3429 bresults[i].name = Gogo::unpack_hidden_name(p->name()); 3430 bresults[i].btype = p->type()->get_backend(gogo); 3431 bresults[i].location = p->location(); 3432 } 3433 go_assert(i == bresults.size()); 3434 } 3435 3436 this->fnbtype_ = gogo->backend()->function_type(breceiver, bparameters, 3437 bresults, 3438 this->location()); 3439 3440 } 3441 3442 return this->fnbtype_; 3443 } 3444 3445 // Get the backend representation for a Go function type. 3446 3447 Btype* 3386 3448 Function_type::do_get_backend(Gogo* gogo) 3387 3449 { 3388 3450 // When we do anything with a function value other than call it, it … … 3395 3457 gogo->backend()->placeholder_struct_type("__go_descriptor", loc); 3396 3458 Btype* ptr_struct_type = gogo->backend()->pointer_type(struct_type); 3397 3459 3398 Backend::Btyped_identifier breceiver;3399 if (this->receiver_ != NULL)3400 {3401 breceiver.name = Gogo::unpack_hidden_name(this->receiver_->name());3402 3403 // We always pass the address of the receiver parameter, in3404 // order to make interface calls work with unknown types.3405 Type* rtype = this->receiver_->type();3406 if (rtype->points_to() == NULL)3407 rtype = Type::make_pointer_type(rtype);3408 breceiver.btype = rtype->get_backend(gogo);3409 breceiver.location = this->receiver_->location();3410 }3411 3412 std::vector<Backend::Btyped_identifier> bparameters;3413 if (this->parameters_ != NULL)3414 {3415 bparameters.resize(this->parameters_->size());3416 size_t i = 0;3417 for (Typed_identifier_list::const_iterator p = this->parameters_->begin();3418 p != this->parameters_->end();3419 ++p, ++i)3420 {3421 bparameters[i].name = Gogo::unpack_hidden_name(p->name());3422 bparameters[i].btype = p->type()->get_backend(gogo);3423 bparameters[i].location = p->location();3424 }3425 go_assert(i == bparameters.size());3426 }3427 3428 std::vector<Backend::Btyped_identifier> bresults;3429 if (this->results_ != NULL)3430 {3431 bresults.resize(this->results_->size());3432 size_t i = 0;3433 for (Typed_identifier_list::const_iterator p = this->results_->begin();3434 p != this->results_->end();3435 ++p, ++i)3436 {3437 bresults[i].name = Gogo::unpack_hidden_name(p->name());3438 bresults[i].btype = p->type()->get_backend(gogo);3439 bresults[i].location = p->location();3440 }3441 go_assert(i == bresults.size());3442 }3443 3444 Btype* fntype = gogo->backend()->function_type(breceiver, bparameters,3445 bresults, loc);3446 3460 std::vector<Backend::Btyped_identifier> fields(1); 3447 3461 fields[0].name = "code"; 3448 fields[0].btype = fntype;3462 fields[0].btype = this->get_backend_fntype(gogo); 3449 3463 fields[0].location = loc; 3450 3464 if (!gogo->backend()->set_placeholder_struct_type(struct_type, fields)) 3451 3465 return gogo->backend()->error_type(); … … 4195 4209 4196 4210 // This is a horrible hack caused by the fact that we don't pack 4197 4211 // the names of builtin types. FIXME. 4198 if (nt != NULL 4212 if (!this->is_imported_ 4213 && nt != NULL 4199 4214 && nt->is_builtin() 4200 4215 && nt->name() == Gogo::unpack_hidden_name(name)) 4201 4216 return true; … … 4204 4219 } 4205 4220 } 4206 4221 4222 // Return whether this field is an unexported field named NAME. 4223 4224 bool 4225 Struct_field::is_unexported_field_name(Gogo* gogo, 4226 const std::string& name) const 4227 { 4228 const std::string& field_name(this->field_name()); 4229 if (Gogo::is_hidden_name(field_name) 4230 && name == Gogo::unpack_hidden_name(field_name) 4231 && gogo->pack_hidden_name(name, false) != field_name) 4232 return true; 4233 4234 // Check for the name of a builtin type. This is like the test in 4235 // is_field_name, only there we return false if this->is_imported_, 4236 // and here we return true. 4237 if (this->is_imported_ && this->is_anonymous()) 4238 { 4239 Type* t = this->typed_identifier_.type(); 4240 if (t->points_to() != NULL) 4241 t = t->points_to(); 4242 Named_type* nt = t->named_type(); 4243 if (nt != NULL 4244 && nt->is_builtin() 4245 && nt->name() == Gogo::unpack_hidden_name(name)) 4246 return true; 4247 } 4248 4249 return false; 4250 } 4251 4207 4252 // Return whether this field is an embedded built-in type. 4208 4253 4209 4254 bool … … 4264 4309 ++p) 4265 4310 { 4266 4311 Type* t = p->type(); 4267 if (t->is_undefined()) 4268 { 4269 error_at(p->location(), "struct field type is incomplete"); 4270 p->set_type(Type::make_error_type()); 4271 } 4272 else if (p->is_anonymous()) 4312 if (p->is_anonymous()) 4273 4313 { 4274 4314 if (t->named_type() != NULL && t->points_to() != NULL) 4275 4315 { … … 4641 4681 for (Struct_field_list::const_iterator pf = fields->begin(); 4642 4682 pf != fields->end(); 4643 4683 ++pf) 4644 { 4645 const std::string& field_name(pf->field_name()); 4646 if (Gogo::is_hidden_name(field_name) 4647 && name == Gogo::unpack_hidden_name(field_name) 4648 && gogo->pack_hidden_name(name, false) != field_name) 4649 return true; 4650 } 4684 if (pf->is_unexported_field_name(gogo, name)) 4685 return true; 4651 4686 } 4652 4687 return false; 4653 4688 } … … 5250 5285 Type* ftype = imp->read_type(); 5251 5286 5252 5287 Struct_field sf(Typed_identifier(name, ftype, imp->location())); 5288 sf.set_is_imported(); 5253 5289 5254 5290 if (imp->peek_char() == ' ') 5255 5291 { … … 9022 9058 fntype->is_varargs(), location); 9023 9059 gogo->finish_function(fntype->location()); 9024 9060 9061 if (type->named_type() == NULL && stub->is_function()) 9062 stub->func_value()->set_is_unnamed_type_stub_method(); 9025 9063 if (m->nointerface() && stub->is_function()) 9026 9064 stub->func_value()->set_nointerface(); 9027 9065 } … … 9289 9327 else 9290 9328 { 9291 9329 bool is_unexported; 9292 if (!Gogo::is_hidden_name(name)) 9330 // The test for 'a' and 'z' is to handle builtin names, 9331 // which are not hidden. 9332 if (!Gogo::is_hidden_name(name) && (name[0] < 'a' || name[0] > 'z')) 9293 9333 is_unexported = false; 9294 9334 else 9295 9335 { -
gcc/go/gofrontend/types.h
diff -Naur gcc-4.8.2.orig/gcc/go/gofrontend/types.h gcc-4.8.2/gcc/go/gofrontend/types.h
old new 1717 1717 Typed_identifier_list* results, Location location) 1718 1718 : Type(TYPE_FUNCTION), 1719 1719 receiver_(receiver), parameters_(parameters), results_(results), 1720 location_(location), is_varargs_(false), is_builtin_(false) 1720 location_(location), is_varargs_(false), is_builtin_(false), 1721 fnbtype_(NULL) 1721 1722 { } 1722 1723 1723 1724 // Get the receiver. … … 1798 1799 static Type* 1799 1800 make_function_type_descriptor_type(); 1800 1801 1802 // Return the backend representation of this function type. This is used 1803 // as the real type of a backend function declaration or defintion. 1804 Btype* 1805 get_backend_fntype(Gogo*); 1806 1801 1807 protected: 1802 1808 int 1803 1809 do_traverse(Traverse*); … … 1851 1857 // Whether this is a special builtin function which can not simply 1852 1858 // be called. This is used for len, cap, etc. 1853 1859 bool is_builtin_; 1860 // The backend representation of this type for backend function 1861 // declarations and definitions. 1862 Btype* fnbtype_; 1854 1863 }; 1855 1864 1856 1865 // The type of a pointer. … … 1915 1924 { 1916 1925 public: 1917 1926 explicit Struct_field(const Typed_identifier& typed_identifier) 1918 : typed_identifier_(typed_identifier), tag_(NULL) 1927 : typed_identifier_(typed_identifier), tag_(NULL), is_imported_(false) 1919 1928 { } 1920 1929 1921 1930 // The field name. … … 1926 1935 bool 1927 1936 is_field_name(const std::string& name) const; 1928 1937 1938 // Return whether this struct field is an unexported field named NAME. 1939 bool 1940 is_unexported_field_name(Gogo*, const std::string& name) const; 1941 1929 1942 // Return whether this struct field is an embedded built-in type. 1930 1943 bool 1931 1944 is_embedded_builtin(Gogo*) const; … … 1963 1976 set_tag(const std::string& tag) 1964 1977 { this->tag_ = new std::string(tag); } 1965 1978 1979 // Record that this field is defined in an imported struct. 1980 void 1981 set_is_imported() 1982 { this->is_imported_ = true; } 1983 1966 1984 // Set the type. This is only used in error cases. 1967 1985 void 1968 1986 set_type(Type* type) … … 1973 1991 Typed_identifier typed_identifier_; 1974 1992 // The field tag. This is NULL if the field has no tag. 1975 1993 std::string* tag_; 1994 // Whether this field is defined in an imported struct. 1995 bool is_imported_; 1976 1996 }; 1977 1997 1978 1998 // A list of struct fields. -
gcc/graphite-clast-to-gimple.c
diff -Naur gcc-4.8.2.orig/gcc/graphite-clast-to-gimple.c gcc-4.8.2/gcc/graphite-clast-to-gimple.c
old new 1170 1170 redirect_edge_succ_nodup (next_e, after); 1171 1171 set_immediate_dominator (CDI_DOMINATORS, next_e->dest, next_e->src); 1172 1172 1173 isl_set *domain = isl_set_from_cloog_domain (stmt->domain); 1174 int scheduling_dim = isl_set_n_dim (domain); 1175 1173 1176 if (flag_loop_parallelize_all 1174 && loop_is_parallel_p (loop, bb_pbb_mapping, level))1177 && loop_is_parallel_p (loop, bb_pbb_mapping, scheduling_dim)) 1175 1178 loop->can_be_parallel = true; 1176 1179 1177 1180 return last_e; -
gcc/graphite-dependences.c
diff -Naur gcc-4.8.2.orig/gcc/graphite-dependences.c gcc-4.8.2/gcc/graphite-dependences.c
old new 297 297 int depth) 298 298 { 299 299 bool res; 300 int i dx, i;300 int i; 301 301 isl_space *space; 302 302 isl_map *lex, *x; 303 303 isl_constraint *ineq; … … 312 312 space = isl_map_get_space (x); 313 313 ineq = isl_inequality_alloc (isl_local_space_from_space (space)); 314 314 315 idx = 2 * depth + 1; 316 for (i = 0; i < idx; i++) 315 for (i = 0; i < depth - 1; i++) 317 316 lex = isl_map_equate (lex, isl_dim_in, i, isl_dim_out, i); 318 317 319 318 /* in + 1 <= out */ 320 ineq = isl_constraint_set_coefficient_si (ineq, isl_dim_out, idx, 1);321 ineq = isl_constraint_set_coefficient_si (ineq, isl_dim_in, idx, -1);319 ineq = isl_constraint_set_coefficient_si (ineq, isl_dim_out, depth - 1, 1); 320 ineq = isl_constraint_set_coefficient_si (ineq, isl_dim_in, depth - 1, -1); 322 321 ineq = isl_constraint_set_constant_si (ineq, -1); 323 322 lex = isl_map_add_constraint (lex, ineq); 324 323 x = isl_map_intersect (x, lex); -
gcc/ipa-prop.c
diff -Naur gcc-4.8.2.orig/gcc/ipa-prop.c gcc-4.8.2/gcc/ipa-prop.c
old new 2126 2126 we may create the first reference to the object in the unit. */ 2127 2127 if (!callee || callee->global.inlined_to) 2128 2128 { 2129 struct cgraph_node *first_clone = callee;2130 2129 2131 2130 /* We are better to ensure we can refer to it. 2132 2131 In the case of static functions we are out of luck, since we already … … 2142 2141 xstrdup (cgraph_node_name (ie->callee)), ie->callee->uid); 2143 2142 return NULL; 2144 2143 } 2145 2146 /* Create symbol table node. Even if inline clone exists, we can not take 2147 it as a target of non-inlined call. */ 2148 callee = cgraph_create_node (target); 2149 2150 /* OK, we previously inlined the function, then removed the offline copy and 2151 now we want it back for external call. This can happen when devirtualizing 2152 while inlining function called once that happens after extern inlined and 2153 virtuals are already removed. In this case introduce the external node 2154 and make it available for call. */ 2155 if (first_clone) 2156 { 2157 first_clone->clone_of = callee; 2158 callee->clones = first_clone; 2159 symtab_prevail_in_asm_name_hash ((symtab_node)callee); 2160 symtab_insert_node_to_hashtable ((symtab_node)callee); 2161 if (dump_file) 2162 fprintf (dump_file, "ipa-prop: Introduced new external node " 2163 "(%s/%i) and turned into root of the clone tree.\n", 2164 xstrdup (cgraph_node_name (callee)), callee->uid); 2165 } 2166 else if (dump_file) 2167 fprintf (dump_file, "ipa-prop: Introduced new external node " 2168 "(%s/%i).\n", 2169 xstrdup (cgraph_node_name (callee)), callee->uid); 2144 callee = cgraph_get_create_real_symbol_node (target); 2170 2145 } 2171 2146 ipa_check_create_node_params (); 2172 2147 -
gcc/optabs.c
diff -Naur gcc-4.8.2.orig/gcc/optabs.c gcc-4.8.2/gcc/optabs.c
old new 7035 7035 7036 7036 create_output_operand (&ops[0], target, mode); 7037 7037 create_fixed_operand (&ops[1], mem); 7038 /* VAL may have been promoted to a wider mode. Shrink it if so. */ 7039 create_convert_operand_to (&ops[2], val, mode, true); 7038 create_input_operand (&ops[2], val, mode); 7040 7039 create_integer_operand (&ops[3], model); 7041 7040 if (maybe_expand_insn (icode, 4, ops)) 7042 7041 return ops[0].value; … … 7075 7074 struct expand_operand ops[3]; 7076 7075 create_output_operand (&ops[0], target, mode); 7077 7076 create_fixed_operand (&ops[1], mem); 7078 /* VAL may have been promoted to a wider mode. Shrink it if so. */ 7079 create_convert_operand_to (&ops[2], val, mode, true); 7077 create_input_operand (&ops[2], val, mode); 7080 7078 if (maybe_expand_insn (icode, 3, ops)) 7081 7079 return ops[0].value; 7082 7080 } … … 7118 7116 { 7119 7117 if (!target || !register_operand (target, mode)) 7120 7118 target = gen_reg_rtx (mode); 7121 if (GET_MODE (val) != VOIDmode && GET_MODE (val) != mode)7122 val = convert_modes (mode, GET_MODE (val), val, 1);7123 7119 if (expand_compare_and_swap_loop (mem, target, val, NULL_RTX)) 7124 7120 return target; 7125 7121 } … … 7331 7327 create_output_operand (&ops[0], target_bool, bool_mode); 7332 7328 create_output_operand (&ops[1], target_oval, mode); 7333 7329 create_fixed_operand (&ops[2], mem); 7334 create_ convert_operand_to (&ops[3], expected, mode, true);7335 create_ convert_operand_to (&ops[4], desired, mode, true);7330 create_input_operand (&ops[3], expected, mode); 7331 create_input_operand (&ops[4], desired, mode); 7336 7332 create_integer_operand (&ops[5], is_weak); 7337 7333 create_integer_operand (&ops[6], succ_model); 7338 7334 create_integer_operand (&ops[7], fail_model); … … 7353 7349 7354 7350 create_output_operand (&ops[0], target_oval, mode); 7355 7351 create_fixed_operand (&ops[1], mem); 7356 create_ convert_operand_to (&ops[2], expected, mode, true);7357 create_ convert_operand_to (&ops[3], desired, mode, true);7352 create_input_operand (&ops[2], expected, mode); 7353 create_input_operand (&ops[3], desired, mode); 7358 7354 if (!maybe_expand_insn (icode, 4, ops)) 7359 7355 return false; 7360 7356 -
gcc/recog.c
diff -Naur gcc-4.8.2.orig/gcc/recog.c gcc-4.8.2/gcc/recog.c
old new 3061 3061 return 1; 3062 3062 } 3063 3063 3064 /* Regno offset to be used in the register search. */ 3065 static int search_ofs; 3066 3064 3067 /* Try to find a hard register of mode MODE, matching the register class in 3065 3068 CLASS_STR, which is available at the beginning of insn CURRENT_INSN and 3066 3069 remains available until the end of LAST_INSN. LAST_INSN may be NULL_RTX, … … 3076 3079 peep2_find_free_register (int from, int to, const char *class_str, 3077 3080 enum machine_mode mode, HARD_REG_SET *reg_set) 3078 3081 { 3079 static int search_ofs;3080 3082 enum reg_class cl; 3081 3083 HARD_REG_SET live; 3082 3084 df_ref *def_rec; … … 3541 3543 /* Initialize the regsets we're going to use. */ 3542 3544 for (i = 0; i < MAX_INSNS_PER_PEEP2 + 1; ++i) 3543 3545 peep2_insn_data[i].live_before = BITMAP_ALLOC (®_obstack); 3546 search_ofs = 0; 3544 3547 live = BITMAP_ALLOC (®_obstack); 3545 3548 3546 3549 FOR_EACH_BB_REVERSE (bb) -
gcc/testsuite/g++.dg/cpp0x/decltype57.C
diff -Naur gcc-4.8.2.orig/gcc/testsuite/g++.dg/cpp0x/decltype57.C gcc-4.8.2/gcc/testsuite/g++.dg/cpp0x/decltype57.C
old new 1 // PR c++/58633 2 // { dg-do compile { target c++11 } } 3 4 void foo(int i) 5 { 6 typedef int I; 7 decltype(i.I::~I())* p; 8 } -
gcc/testsuite/g++.dg/cpp0x/enum18.C
diff -Naur gcc-4.8.2.orig/gcc/testsuite/g++.dg/cpp0x/enum18.C gcc-4.8.2/gcc/testsuite/g++.dg/cpp0x/enum18.C
old new 4 4 int main(void) { 5 5 enum e {}; 6 6 e ev; 7 ev.e::~e_u(); // { dg-error " e_u. has not been declared" }7 ev.e::~e_u(); // { dg-error "" } 8 8 } -
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi5.C
diff -Naur gcc-4.8.2.orig/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi5.C gcc-4.8.2/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi5.C
old new 1 // PR c++/58596 2 // { dg-do compile { target c++11 } } 3 4 struct A 5 { 6 int i = [] { return decltype(i)(); }(); 7 }; -
gcc/testsuite/g++.dg/tm/noexcept-6.C
diff -Naur gcc-4.8.2.orig/gcc/testsuite/g++.dg/tm/noexcept-6.C gcc-4.8.2/gcc/testsuite/g++.dg/tm/noexcept-6.C
old new 1 // { dg-do compile } 2 // { dg-options "-fno-exceptions -fgnu-tm -O -std=c++0x -fdump-tree-tmlower" } 3 4 struct TrueFalse 5 { 6 static constexpr bool v() { return true; } 7 }; 8 9 int global; 10 11 template<typename T> int foo() 12 { 13 return __transaction_atomic noexcept(T::v()) (global + 1); 14 } 15 16 int f1() 17 { 18 return foo<TrueFalse>(); 19 } 20 21 /* { dg-final { scan-tree-dump-times "eh_must_not_throw" 0 "tmlower" } } */ 22 /* { dg-final { scan-tree-dump-times "__transaction_atomic" 1 "tmlower" } } */ 23 /* { dg-final { cleanup-tree-dump "tmlower" } } */ -
gcc/testsuite/gcc.c-torture/execute/pr58831.c
diff -Naur gcc-4.8.2.orig/gcc/testsuite/gcc.c-torture/execute/pr58831.c gcc-4.8.2/gcc/testsuite/gcc.c-torture/execute/pr58831.c
old new 1 #include <assert.h> 2 3 int a, *b, c, d, f, **i, p, q, *r; 4 short o, j; 5 6 static int __attribute__((noinline, noclone)) 7 fn1 (int *p1, int **p2) 8 { 9 int **e = &b; 10 for (; p; p++) 11 *p1 = 1; 12 *e = *p2 = &d; 13 14 assert (r); 15 16 return c; 17 } 18 19 static int ** __attribute__((noinline, noclone)) 20 fn2 (void) 21 { 22 for (f = 0; f != 42; f++) 23 { 24 int *g[3] = {0, 0, 0}; 25 for (o = 0; o; o--) 26 for (; a > 1;) 27 { 28 int **h[1] = { &g[2] }; 29 } 30 } 31 return &r; 32 } 33 34 int 35 main (void) 36 { 37 i = fn2 (); 38 fn1 (b, i); 39 return 0; 40 } -
gcc/testsuite/gcc.dg/atomic-store-6.c
diff -Naur gcc-4.8.2.orig/gcc/testsuite/gcc.dg/atomic-store-6.c gcc-4.8.2/gcc/testsuite/gcc.dg/atomic-store-6.c
old new 1 /* { dg-do run } */ 2 /* { dg-require-effective-target sync_int_128_runtime } */ 3 /* { dg-options "-mcx16" { target { i?86-*-* x86_64-*-* } } } */ 4 5 __int128_t i; 6 7 int main() 8 { 9 __atomic_store_16(&i, -1, 0); 10 if (i != -1) 11 __builtin_abort(); 12 return 0; 13 } -
gcc/testsuite/gcc.dg/graphite/pr54094.c
diff -Naur gcc-4.8.2.orig/gcc/testsuite/gcc.dg/graphite/pr54094.c gcc-4.8.2/gcc/testsuite/gcc.dg/graphite/pr54094.c
old new 1 /* { dg-options "-O2 -floop-parallelize-all -floop-nest-optimize" } */ 2 void dwt_deinterleave_h(int *a, int *b, int dn, int sn, int cas) 3 { 4 int i; 5 for (i=0; i<sn; i++) 6 b[i]=a[2*i+cas]; 7 for (i=0; i<dn; i++) 8 b[sn+i]=a[(2*i+1-cas)]; 9 } 10 -
gcc/testsuite/gcc.dg/pr58805.c
diff -Naur gcc-4.8.2.orig/gcc/testsuite/gcc.dg/pr58805.c gcc-4.8.2/gcc/testsuite/gcc.dg/pr58805.c
old new 1 /* { dg-do compile } */ 2 /* { dg-options "-O2 -ftree-tail-merge -fdump-tree-pre" } */ 3 4 /* Type that matches the 'p' constraint. */ 5 #define TYPE void * 6 7 static inline 8 void bar (TYPE *r) 9 { 10 TYPE t; 11 __asm__ ("" : "=&p" (t), "=p" (*r)); 12 } 13 14 void 15 foo (int n, TYPE *x, TYPE *y) 16 { 17 if (n == 0) 18 bar (x); 19 else 20 bar (y); 21 } 22 23 /* { dg-final { scan-tree-dump-times "__asm__" 2 "pre"} } */ 24 /* { dg-final { cleanup-tree-dump "pre" } } */ -
gcc/testsuite/gcc.dg/torture/pr57488.c
diff -Naur gcc-4.8.2.orig/gcc/testsuite/gcc.dg/torture/pr57488.c gcc-4.8.2/gcc/testsuite/gcc.dg/torture/pr57488.c
old new 1 /* { dg-do run } */ 2 3 extern void abort (void); 4 5 int i, j, *pj = &j, **ppj = &pj; 6 int x, *px = &x; 7 8 short s, *ps = &s, k; 9 10 unsigned short u, *pu = &u, **ppu = &pu; 11 12 char c, *pc = &c; 13 14 unsigned char v = 48; 15 16 static int 17 bar (int p) 18 { 19 p = k; 20 *px = **ppu = i; 21 *ppj = &p; 22 if (**ppj) 23 *pj = p; 24 return p; 25 } 26 27 void __attribute__((noinline)) 28 foo () 29 { 30 for (; i <= 3; i++) 31 for (; j; j--); 32 33 u ^= bar (*pj); 34 35 for (k = 1; k >= 0; k--) 36 { 37 int l; 38 bar (0); 39 for (l = 1; l < 5; l++) 40 { 41 int m; 42 for (m = 6; m; m--) 43 { 44 v--; 45 *ps = *pc; 46 } 47 } 48 } 49 } 50 51 int 52 main () 53 { 54 foo (); 55 if (v != 0) 56 abort (); 57 return 0; 58 } -
gcc/testsuite/gcc.dg/torture/pr58079.c
diff -Naur gcc-4.8.2.orig/gcc/testsuite/gcc.dg/torture/pr58079.c gcc-4.8.2/gcc/testsuite/gcc.dg/torture/pr58079.c
old new 1 /* { dg-options "-mlong-calls" { target mips*-*-* } } */ 2 3 typedef unsigned char u8; 4 typedef unsigned short u16; 5 typedef unsigned int __kernel_size_t; 6 typedef __kernel_size_t size_t; 7 struct list_head { 8 struct list_head *next; 9 }; 10 11 struct dmx_ts_feed { 12 int is_filtering; 13 }; 14 struct dmx_section_feed { 15 u16 secbufp; 16 u16 seclen; 17 u16 tsfeedp; 18 }; 19 20 typedef int (*dmx_ts_cb) ( 21 const u8 * buffer1, 22 size_t buffer1_length, 23 const u8 * buffer2, 24 size_t buffer2_length 25 ); 26 27 struct dvb_demux_feed { 28 union { 29 struct dmx_ts_feed ts; 30 struct dmx_section_feed sec; 31 } feed; 32 union { 33 dmx_ts_cb ts; 34 } cb; 35 int type; 36 u16 pid; 37 int ts_type; 38 struct list_head list_head; 39 }; 40 41 struct dvb_demux { 42 int (*stop_feed)(struct dvb_demux_feed *feed); 43 struct list_head feed_list; 44 }; 45 46 47 static 48 inline 49 __attribute__((always_inline)) 50 u8 51 payload(const u8 *tsp) 52 { 53 if (tsp[3] & 0x20) { 54 return 184 - 1 - tsp[4]; 55 } 56 return 184; 57 } 58 59 static 60 inline 61 __attribute__((always_inline)) 62 int 63 dvb_dmx_swfilter_payload(struct dvb_demux_feed *feed, const u8 *buf) 64 { 65 int count = payload(buf); 66 int p; 67 if (count == 0) 68 return -1; 69 return feed->cb.ts(&buf[p], count, ((void *)0), 0); 70 } 71 72 static 73 inline 74 __attribute__((always_inline)) 75 void 76 dvb_dmx_swfilter_packet_type(struct dvb_demux_feed *feed, const u8 *buf) 77 { 78 switch (feed->type) { 79 case 0: 80 if (feed->ts_type & 1) { 81 dvb_dmx_swfilter_payload(feed, buf); 82 } 83 if (dvb_dmx_swfilter_section_packet(feed, buf) < 0) 84 feed->feed.sec.seclen = feed->feed.sec.secbufp = 0; 85 } 86 } 87 88 static 89 void 90 dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf) 91 { 92 struct dvb_demux_feed *feed; 93 int dvr_done = 0; 94 95 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) );})) { 96 if (((((feed)->type == 0) && ((feed)->feed.ts.is_filtering) && (((feed)->ts_type & (1 | 8)) == 1))) && (dvr_done++)) 97 dvb_dmx_swfilter_packet_type(feed, buf); 98 else if (feed->pid == 0x2000) 99 feed->cb.ts(buf, 188, ((void *)0), 0); 100 } 101 } 102 void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf, size_t count) 103 { 104 while (count--) { 105 dvb_dmx_swfilter_packet(demux, buf); 106 } 107 } -
gcc/testsuite/gcc.dg/torture/pr58779.c
diff -Naur gcc-4.8.2.orig/gcc/testsuite/gcc.dg/torture/pr58779.c gcc-4.8.2/gcc/testsuite/gcc.dg/torture/pr58779.c
old new 1 /* { dg-do run } */ 2 3 int a, c; 4 5 int main () 6 { 7 int e = -1; 8 short d = (c <= 0) ^ e; 9 if ((unsigned int) a - (a || d) <= (unsigned int) a) 10 __builtin_abort (); 11 return 0; 12 } -
gcc/testsuite/gcc.dg/torture/pr58830.c
diff -Naur gcc-4.8.2.orig/gcc/testsuite/gcc.dg/torture/pr58830.c gcc-4.8.2/gcc/testsuite/gcc.dg/torture/pr58830.c
old new 1 /* { dg-do run } */ 2 /* { dg-additional-options "-ftree-pre -ftree-partial-pre" } */ 3 4 extern void abort (void); 5 6 int b, c, d, f, g, h, i, j[6], *l = &b, *m, n, *o, r; 7 char k; 8 9 static int 10 foo () 11 { 12 char *p = &k; 13 14 for (; d; d++) 15 if (i) 16 h = 0; 17 else 18 h = c || (r = 0); 19 20 for (f = 0; f < 2; f++) 21 { 22 unsigned int q; 23 *l = 0; 24 if (n) 25 *m = g; 26 if (g) 27 o = 0; 28 for (q = -8; q >= 5; q++) 29 (*p)--; 30 } 31 32 return 0; 33 } 34 35 int 36 main () 37 { 38 foo (); 39 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) 40 abort (); 41 return 0; 42 } -
gcc/testsuite/gcc.target/arm/require-pic-register-loc.c
diff -Naur gcc-4.8.2.orig/gcc/testsuite/gcc.target/arm/require-pic-register-loc.c gcc-4.8.2/gcc/testsuite/gcc.target/arm/require-pic-register-loc.c
old new 1 /* { dg-do compile } */ 2 /* { dg-options "-g -fPIC" } */ 3 4 void *v; 5 void a (void *x) { } 6 void b (void) { } 7 /* line 7. */ 8 int /* line 8. */ 9 main (int argc) /* line 9. */ 10 { /* line 10. */ 11 if (argc == 12345) /* line 11. */ 12 { 13 a (v); 14 return 1; 15 } 16 b (); 17 18 return 0; 19 } 20 21 /* { dg-final { scan-assembler-not "\.loc 1 7 0" } } */ 22 /* { dg-final { scan-assembler-not "\.loc 1 8 0" } } */ 23 /* { dg-final { scan-assembler-not "\.loc 1 9 0" } } */ 24 25 /* The loc at the start of the prologue. */ 26 /* { dg-final { scan-assembler-times "\.loc 1 10 0" 1 } } */ 27 28 /* The loc at the end of the prologue, with the first user line. */ 29 /* { dg-final { scan-assembler-times "\.loc 1 11 0" 1 } } */ -
gcc/testsuite/gcc.target/i386/pr30315.c
diff -Naur gcc-4.8.2.orig/gcc/testsuite/gcc.target/i386/pr30315.c gcc-4.8.2/gcc/testsuite/gcc.target/i386/pr30315.c
old new 1 1 /* { dg-do compile } */ 2 2 /* { dg-options "-O2" } */ 3 /* { dg-final { scan-assembler- times "cmp" 4} } */3 /* { dg-final { scan-assembler-not "cmp" } } */ 4 4 5 5 extern void abort (void); 6 6 int c; … … 34 34 } 35 35 #define PLUSCCONLY(T, t) PLUSCCONLY1(T, t, a) PLUSCCONLY1(T, t, b) 36 36 37 #define MINUSCC(T, t) \38 T minuscc##t (T a, T b) \39 { \40 T difference = a - b; \41 if (difference > a) \42 abort (); \43 return difference; \44 }45 46 #define DECCC(T, t) \47 T deccc##t (T a, T b) \48 { \49 T difference = a - b; \50 if (difference > a) \51 c --; \52 return difference; \53 }54 55 #define MINUSCCONLY(T, t) \56 void minuscconly##t (T a, T b) \57 { \58 T difference = a - b; \59 if (difference > a) \60 abort (); \61 }62 63 37 #define TEST(T, t) \ 64 38 PLUSCC(T, t) \ 65 39 PLUSCCONLY(T, t) \ 66 INCCC(T, t) \ 67 MINUSCC(T, t) \ 68 MINUSCCONLY(T, t) \ 69 DECCC(T, t) 40 INCCC(T, t) 70 41 71 42 TEST (unsigned long, l) 72 43 TEST (unsigned int, i) … … 84 55 85 56 PLUSCCZEXT(a) 86 57 PLUSCCZEXT(b) 87 88 #define MINUSCCZEXT \89 unsigned long minuscczext (unsigned int a, unsigned int b) \90 { \91 unsigned int difference = a - b; \92 if (difference > a) \93 abort (); \94 return difference; \95 }96 97 MINUSCCZEXT -
gcc/testsuite/gcc.target/sh/pr54089-3.c
diff -Naur gcc-4.8.2.orig/gcc/testsuite/gcc.target/sh/pr54089-3.c gcc-4.8.2/gcc/testsuite/gcc.target/sh/pr54089-3.c
old new 5 5 /* { dg-options "-O1" } */ 6 6 /* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m1*" "-m2" "-m2e*" } } */ 7 7 /* { dg-final { scan-assembler-not "and" } } */ 8 /* { dg-final { scan-assembler-not " 31" } } */8 /* { dg-final { scan-assembler-not "#31" } } */ 9 9 10 10 int 11 11 test00 (unsigned int a, int* b, int c, int* d, unsigned int e) -
gcc/tree-ssa-pre.c
diff -Naur gcc-4.8.2.orig/gcc/tree-ssa-pre.c gcc-4.8.2/gcc/tree-ssa-pre.c
old new 3664 3664 if (dump_file && dump_flags & TDF_DETAILS) 3665 3665 fprintf (dump_file, "Starting insert iteration %d\n", num_iterations); 3666 3666 new_stuff = insert_aux (ENTRY_BLOCK_PTR); 3667 3668 /* Clear the NEW sets before the next iteration. We have already 3669 fully propagated its contents. */ 3670 if (new_stuff) 3671 FOR_ALL_BB (bb) 3672 bitmap_set_free (NEW_SETS (bb)); 3667 3673 } 3668 3674 statistics_histogram_event (cfun, "insert iterations", num_iterations); 3669 3675 } -
gcc/tree-ssa-tail-merge.c
diff -Naur gcc-4.8.2.orig/gcc/tree-ssa-tail-merge.c gcc-4.8.2/gcc/tree-ssa-tail-merge.c
old new 297 297 tree val; 298 298 def_operand_p def_p; 299 299 300 if (gimple_has_side_effects (stmt)) 300 if (gimple_has_side_effects (stmt) 301 || gimple_vdef (stmt) != NULL_TREE) 301 302 return false; 302 303 303 304 def_p = SINGLE_SSA_DEF_OPERAND (stmt, SSA_OP_DEF); -
gcc/version.c
diff -Naur gcc-4.8.2.orig/gcc/version.c gcc-4.8.2/gcc/version.c
old new 32 32 Makefile. */ 33 33 34 34 const char version_string[] = BASEVER DATESTAMP DEVPHASE REVISION; 35 const char pkgversion_string[] = PKGVERSION;35 const char pkgversion_string[] = "(GCC for Cross-LFS 4.8.2.20131101) "; -
libffi/doc/libffi.info
diff -Naur gcc-4.8.2.orig/libffi/doc/libffi.info gcc-4.8.2/libffi/doc/libffi.info
old new 1 This is libffi.info, produced by makeinfo version 5.1 from libffi.texi.2 3 This manual is for Libffi, a portable foreign-function interface4 library.5 6 Copyright (C) 2008, 2010, 2011 Red Hat, Inc.7 8 Permission is granted to copy, distribute and/or modify this9 document under the terms of the GNU General Public License as10 published by the Free Software Foundation; either version 2, or (at11 your option) any later version. A copy of the license is included12 in the section entitled "GNU General Public License".13 14 INFO-DIR-SECTION Development15 START-INFO-DIR-ENTRY16 * libffi: (libffi). Portable foreign-function interface library.17 END-INFO-DIR-ENTRY18 19 20 File: libffi.info, Node: Top, Next: Introduction, Up: (dir)21 22 libffi23 ******24 25 This manual is for Libffi, a portable foreign-function interface26 library.27 28 Copyright (C) 2008, 2010, 2011 Red Hat, Inc.29 30 Permission is granted to copy, distribute and/or modify this31 document under the terms of the GNU General Public License as32 published by the Free Software Foundation; either version 2, or (at33 your option) any later version. A copy of the license is included34 in the section entitled "GNU General Public License".35 36 * Menu:37 38 * Introduction:: What is libffi?39 * Using libffi:: How to use libffi.40 * Missing Features:: Things libffi can't do.41 * Index:: Index.42 43 44 File: libffi.info, Node: Introduction, Next: Using libffi, Prev: Top, Up: Top45 46 1 What is libffi?47 *****************48 49 Compilers for high level languages generate code that follow certain50 conventions. These conventions are necessary, in part, for separate51 compilation to work. One such convention is the "calling convention".52 The calling convention is a set of assumptions made by the compiler53 about where function arguments will be found on entry to a function. A54 calling convention also specifies where the return value for a function55 is found. The calling convention is also sometimes called the "ABI" or56 "Application Binary Interface".57 58 Some programs may not know at the time of compilation what arguments59 are to be passed to a function. For instance, an interpreter may be60 told at run-time about the number and types of arguments used to call a61 given function. 'Libffi' can be used in such programs to provide a62 bridge from the interpreter program to compiled code.63 64 The 'libffi' library provides a portable, high level programming65 interface to various calling conventions. This allows a programmer to66 call any function specified by a call interface description at run time.67 68 FFI stands for Foreign Function Interface. A foreign function69 interface is the popular name for the interface that allows code written70 in one language to call code written in another language. The 'libffi'71 library really only provides the lowest, machine dependent layer of a72 fully featured foreign function interface. A layer must exist above73 'libffi' that handles type conversions for values passed between the two74 languages.75 76 77 File: libffi.info, Node: Using libffi, Next: Missing Features, Prev: Introduction, Up: Top78 79 2 Using libffi80 **************81 82 * Menu:83 84 * The Basics:: The basic libffi API.85 * Simple Example:: A simple example.86 * Types:: libffi type descriptions.87 * Multiple ABIs:: Different passing styles on one platform.88 * The Closure API:: Writing a generic function.89 * Closure Example:: A closure example.90 91 92 File: libffi.info, Node: The Basics, Next: Simple Example, Up: Using libffi93 94 2.1 The Basics95 ==============96 97 'Libffi' assumes that you have a pointer to the function you wish to98 call and that you know the number and types of arguments to pass it, as99 well as the return type of the function.100 101 The first thing you must do is create an 'ffi_cif' object that102 matches the signature of the function you wish to call. This is a103 separate step because it is common to make multiple calls using a single104 'ffi_cif'. The "cif" in 'ffi_cif' stands for Call InterFace. To105 prepare a call interface object, use the function 'ffi_prep_cif'.106 107 -- Function: ffi_status ffi_prep_cif (ffi_cif *CIF, ffi_abi ABI,108 unsigned int NARGS, ffi_type *RTYPE, ffi_type **ARGTYPES)109 This initializes CIF according to the given parameters.110 111 ABI is the ABI to use; normally 'FFI_DEFAULT_ABI' is what you want.112 *note Multiple ABIs:: for more information.113 114 NARGS is the number of arguments that this function accepts.115 116 RTYPE is a pointer to an 'ffi_type' structure that describes the117 return type of the function. *Note Types::.118 119 ARGTYPES is a vector of 'ffi_type' pointers. ARGTYPES must have120 NARGS elements. If NARGS is 0, this argument is ignored.121 122 'ffi_prep_cif' returns a 'libffi' status code, of type123 'ffi_status'. This will be either 'FFI_OK' if everything worked124 properly; 'FFI_BAD_TYPEDEF' if one of the 'ffi_type' objects is125 incorrect; or 'FFI_BAD_ABI' if the ABI parameter is invalid.126 127 If the function being called is variadic (varargs) then128 'ffi_prep_cif_var' must be used instead of 'ffi_prep_cif'.129 130 -- Function: ffi_status ffi_prep_cif_var (ffi_cif *CIF, ffi_abi varabi,131 unsigned int NFIXEDARGS, unsigned int varntotalargs, ffi_type132 *RTYPE, ffi_type **ARGTYPES)133 This initializes CIF according to the given parameters for a call134 to a variadic function. In general it's operation is the same as135 for 'ffi_prep_cif' except that:136 137 NFIXEDARGS is the number of fixed arguments, prior to any variadic138 arguments. It must be greater than zero.139 140 NTOTALARGS the total number of arguments, including variadic and141 fixed arguments.142 143 Note that, different cif's must be prepped for calls to the same144 function when different numbers of arguments are passed.145 146 Also note that a call to 'ffi_prep_cif_var' with147 NFIXEDARGS=NOTOTALARGS is NOT equivalent to a call to148 'ffi_prep_cif'.149 150 To call a function using an initialized 'ffi_cif', use the 'ffi_call'151 function:152 153 -- Function: void ffi_call (ffi_cif *CIF, void *FN, void *RVALUE, void154 **AVALUES)155 This calls the function FN according to the description given in156 CIF. CIF must have already been prepared using 'ffi_prep_cif'.157 158 RVALUE is a pointer to a chunk of memory that will hold the result159 of the function call. This must be large enough to hold the result160 and must be suitably aligned; it is the caller's responsibility to161 ensure this. If CIF declares that the function returns 'void'162 (using 'ffi_type_void'), then RVALUE is ignored. If RVALUE is163 'NULL', then the return value is discarded.164 165 AVALUES is a vector of 'void *' pointers that point to the memory166 locations holding the argument values for a call. If CIF declares167 that the function has no arguments (i.e., NARGS was 0), then168 AVALUES is ignored. Note that argument values may be modified by169 the callee (for instance, structs passed by value); the burden of170 copying pass-by-value arguments is placed on the caller.171 172 173 File: libffi.info, Node: Simple Example, Next: Types, Prev: The Basics, Up: Using libffi174 175 2.2 Simple Example176 ==================177 178 Here is a trivial example that calls 'puts' a few times.179 180 #include <stdio.h>181 #include <ffi.h>182 183 int main()184 {185 ffi_cif cif;186 ffi_type *args[1];187 void *values[1];188 char *s;189 int rc;190 191 /* Initialize the argument info vectors */192 args[0] = &ffi_type_pointer;193 values[0] = &s;194 195 /* Initialize the cif */196 if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,197 &ffi_type_uint, args) == FFI_OK)198 {199 s = "Hello World!";200 ffi_call(&cif, puts, &rc, values);201 /* rc now holds the result of the call to puts */202 203 /* values holds a pointer to the function's arg, so to204 call puts() again all we need to do is change the205 value of s */206 s = "This is cool!";207 ffi_call(&cif, puts, &rc, values);208 }209 210 return 0;211 }212 213 214 File: libffi.info, Node: Types, Next: Multiple ABIs, Prev: Simple Example, Up: Using libffi215 216 2.3 Types217 =========218 219 * Menu:220 221 * Primitive Types:: Built-in types.222 * Structures:: Structure types.223 * Type Example:: Structure type example.224 225 226 File: libffi.info, Node: Primitive Types, Next: Structures, Up: Types227 228 2.3.1 Primitive Types229 ---------------------230 231 'Libffi' provides a number of built-in type descriptors that can be used232 to describe argument and return types:233 234 'ffi_type_void'235 The type 'void'. This cannot be used for argument types, only for236 return values.237 238 'ffi_type_uint8'239 An unsigned, 8-bit integer type.240 241 'ffi_type_sint8'242 A signed, 8-bit integer type.243 244 'ffi_type_uint16'245 An unsigned, 16-bit integer type.246 247 'ffi_type_sint16'248 A signed, 16-bit integer type.249 250 'ffi_type_uint32'251 An unsigned, 32-bit integer type.252 253 'ffi_type_sint32'254 A signed, 32-bit integer type.255 256 'ffi_type_uint64'257 An unsigned, 64-bit integer type.258 259 'ffi_type_sint64'260 A signed, 64-bit integer type.261 262 'ffi_type_float'263 The C 'float' type.264 265 'ffi_type_double'266 The C 'double' type.267 268 'ffi_type_uchar'269 The C 'unsigned char' type.270 271 'ffi_type_schar'272 The C 'signed char' type. (Note that there is not an exact273 equivalent to the C 'char' type in 'libffi'; ordinarily you should274 either use 'ffi_type_schar' or 'ffi_type_uchar' depending on275 whether 'char' is signed.)276 277 'ffi_type_ushort'278 The C 'unsigned short' type.279 280 'ffi_type_sshort'281 The C 'short' type.282 283 'ffi_type_uint'284 The C 'unsigned int' type.285 286 'ffi_type_sint'287 The C 'int' type.288 289 'ffi_type_ulong'290 The C 'unsigned long' type.291 292 'ffi_type_slong'293 The C 'long' type.294 295 'ffi_type_longdouble'296 On platforms that have a C 'long double' type, this is defined. On297 other platforms, it is not.298 299 'ffi_type_pointer'300 A generic 'void *' pointer. You should use this for all pointers,301 regardless of their real type.302 303 Each of these is of type 'ffi_type', so you must take the address304 when passing to 'ffi_prep_cif'.305 306 307 File: libffi.info, Node: Structures, Next: Type Example, Prev: Primitive Types, Up: Types308 309 2.3.2 Structures310 ----------------311 312 Although 'libffi' has no special support for unions or bit-fields, it is313 perfectly happy passing structures back and forth. You must first314 describe the structure to 'libffi' by creating a new 'ffi_type' object315 for it.316 317 -- ffi_type:318 The 'ffi_type' has the following members:319 'size_t size'320 This is set by 'libffi'; you should initialize it to zero.321 322 'unsigned short alignment'323 This is set by 'libffi'; you should initialize it to zero.324 325 'unsigned short type'326 For a structure, this should be set to 'FFI_TYPE_STRUCT'.327 328 'ffi_type **elements'329 This is a 'NULL'-terminated array of pointers to 'ffi_type'330 objects. There is one element per field of the struct.331 332 333 File: libffi.info, Node: Type Example, Prev: Structures, Up: Types334 335 2.3.3 Type Example336 ------------------337 338 The following example initializes a 'ffi_type' object representing the339 'tm' struct from Linux's 'time.h'.340 341 Here is how the struct is defined:342 343 struct tm {344 int tm_sec;345 int tm_min;346 int tm_hour;347 int tm_mday;348 int tm_mon;349 int tm_year;350 int tm_wday;351 int tm_yday;352 int tm_isdst;353 /* Those are for future use. */354 long int __tm_gmtoff__;355 __const char *__tm_zone__;356 };357 358 Here is the corresponding code to describe this struct to 'libffi':359 360 {361 ffi_type tm_type;362 ffi_type *tm_type_elements[12];363 int i;364 365 tm_type.size = tm_type.alignment = 0;366 tm_type.elements = &tm_type_elements;367 368 for (i = 0; i < 9; i++)369 tm_type_elements[i] = &ffi_type_sint;370 371 tm_type_elements[9] = &ffi_type_slong;372 tm_type_elements[10] = &ffi_type_pointer;373 tm_type_elements[11] = NULL;374 375 /* tm_type can now be used to represent tm argument types and376 return types for ffi_prep_cif() */377 }378 379 380 File: libffi.info, Node: Multiple ABIs, Next: The Closure API, Prev: Types, Up: Using libffi381 382 2.4 Multiple ABIs383 =================384 385 A given platform may provide multiple different ABIs at once. For386 instance, the x86 platform has both 'stdcall' and 'fastcall' functions.387 388 'libffi' provides some support for this. However, this is389 necessarily platform-specific.390 391 392 File: libffi.info, Node: The Closure API, Next: Closure Example, Prev: Multiple ABIs, Up: Using libffi393 394 2.5 The Closure API395 ===================396 397 'libffi' also provides a way to write a generic function - a function398 that can accept and decode any combination of arguments. This can be399 useful when writing an interpreter, or to provide wrappers for arbitrary400 functions.401 402 This facility is called the "closure API". Closures are not supported403 on all platforms; you can check the 'FFI_CLOSURES' define to determine404 whether they are supported on the current platform.405 406 Because closures work by assembling a tiny function at runtime, they407 require special allocation on platforms that have a non-executable heap.408 Memory management for closures is handled by a pair of functions:409 410 -- Function: void *ffi_closure_alloc (size_t SIZE, void **CODE)411 Allocate a chunk of memory holding SIZE bytes. This returns a412 pointer to the writable address, and sets *CODE to the413 corresponding executable address.414 415 SIZE should be sufficient to hold a 'ffi_closure' object.416 417 -- Function: void ffi_closure_free (void *WRITABLE)418 Free memory allocated using 'ffi_closure_alloc'. The argument is419 the writable address that was returned.420 421 Once you have allocated the memory for a closure, you must construct422 a 'ffi_cif' describing the function call. Finally you can prepare the423 closure function:424 425 -- Function: ffi_status ffi_prep_closure_loc (ffi_closure *CLOSURE,426 ffi_cif *CIF, void (*FUN) (ffi_cif *CIF, void *RET, void427 **ARGS, void *USER_DATA), void *USER_DATA, void *CODELOC)428 Prepare a closure function.429 430 CLOSURE is the address of a 'ffi_closure' object; this is the431 writable address returned by 'ffi_closure_alloc'.432 433 CIF is the 'ffi_cif' describing the function parameters.434 435 USER_DATA is an arbitrary datum that is passed, uninterpreted, to436 your closure function.437 438 CODELOC is the executable address returned by 'ffi_closure_alloc'.439 440 FUN is the function which will be called when the closure is441 invoked. It is called with the arguments:442 CIF443 The 'ffi_cif' passed to 'ffi_prep_closure_loc'.444 445 RET446 A pointer to the memory used for the function's return value.447 FUN must fill this, unless the function is declared as448 returning 'void'.449 450 ARGS451 A vector of pointers to memory holding the arguments to the452 function.453 454 USER_DATA455 The same USER_DATA that was passed to 'ffi_prep_closure_loc'.456 457 'ffi_prep_closure_loc' will return 'FFI_OK' if everything went ok,458 and something else on error.459 460 After calling 'ffi_prep_closure_loc', you can cast CODELOC to the461 appropriate pointer-to-function type.462 463 You may see old code referring to 'ffi_prep_closure'. This function464 is deprecated, as it cannot handle the need for separate writable and465 executable addresses.466 467 468 File: libffi.info, Node: Closure Example, Prev: The Closure API, Up: Using libffi469 470 2.6 Closure Example471 ===================472 473 A trivial example that creates a new 'puts' by binding 'fputs' with474 'stdin'.475 476 #include <stdio.h>477 #include <ffi.h>478 479 /* Acts like puts with the file given at time of enclosure. */480 void puts_binding(ffi_cif *cif, unsigned int *ret, void* args[],481 FILE *stream)482 {483 *ret = fputs(*(char **)args[0], stream);484 }485 486 int main()487 {488 ffi_cif cif;489 ffi_type *args[1];490 ffi_closure *closure;491 492 int (*bound_puts)(char *);493 int rc;494 495 /* Allocate closure and bound_puts */496 closure = ffi_closure_alloc(sizeof(ffi_closure), &bound_puts);497 498 if (closure)499 {500 /* Initialize the argument info vectors */501 args[0] = &ffi_type_pointer;502 503 /* Initialize the cif */504 if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,505 &ffi_type_uint, args) == FFI_OK)506 {507 /* Initialize the closure, setting stream to stdout */508 if (ffi_prep_closure_loc(closure, &cif, puts_binding,509 stdout, bound_puts) == FFI_OK)510 {511 rc = bound_puts("Hello World!");512 /* rc now holds the result of the call to fputs */513 }514 }515 }516 517 /* Deallocate both closure, and bound_puts */518 ffi_closure_free(closure);519 520 return 0;521 }522 523 524 File: libffi.info, Node: Missing Features, Next: Index, Prev: Using libffi, Up: Top525 526 3 Missing Features527 ******************528 529 'libffi' is missing a few features. We welcome patches to add support530 for these.531 532 * Variadic closures.533 534 * There is no support for bit fields in structures.535 536 * The closure API is537 538 * The "raw" API is undocumented.539 540 Note that variadic support is very new and tested on a relatively541 small number of platforms.542 543 544 File: libffi.info, Node: Index, Prev: Missing Features, Up: Top545 546 Index547 *****548 549 [index]550 * Menu:551 552 * ABI: Introduction. (line 13)553 * Application Binary Interface: Introduction. (line 13)554 * calling convention: Introduction. (line 13)555 * cif: The Basics. (line 14)556 * closure API: The Closure API. (line 13)557 * closures: The Closure API. (line 13)558 * FFI: Introduction. (line 31)559 * ffi_call: The Basics. (line 62)560 * FFI_CLOSURES: The Closure API. (line 13)561 * ffi_closure_alloc: The Closure API. (line 19)562 * ffi_closure_free: The Closure API. (line 26)563 * ffi_prep_cif: The Basics. (line 16)564 * ffi_prep_cif_var: The Basics. (line 39)565 * ffi_prep_closure_loc: The Closure API. (line 34)566 * ffi_status: The Basics. (line 16)567 * ffi_status <1>: The Basics. (line 39)568 * ffi_status <2>: The Closure API. (line 34)569 * ffi_type: Structures. (line 11)570 * ffi_type_double: Primitive Types. (line 41)571 * ffi_type_float: Primitive Types. (line 38)572 * ffi_type_longdouble: Primitive Types. (line 71)573 * ffi_type_pointer: Primitive Types. (line 75)574 * ffi_type_schar: Primitive Types. (line 47)575 * ffi_type_sint: Primitive Types. (line 62)576 * ffi_type_sint16: Primitive Types. (line 23)577 * ffi_type_sint32: Primitive Types. (line 29)578 * ffi_type_sint64: Primitive Types. (line 35)579 * ffi_type_sint8: Primitive Types. (line 17)580 * ffi_type_slong: Primitive Types. (line 68)581 * ffi_type_sshort: Primitive Types. (line 56)582 * ffi_type_uchar: Primitive Types. (line 44)583 * ffi_type_uint: Primitive Types. (line 59)584 * ffi_type_uint16: Primitive Types. (line 20)585 * ffi_type_uint32: Primitive Types. (line 26)586 * ffi_type_uint64: Primitive Types. (line 32)587 * ffi_type_uint8: Primitive Types. (line 14)588 * ffi_type_ulong: Primitive Types. (line 65)589 * ffi_type_ushort: Primitive Types. (line 53)590 * ffi_type_void: Primitive Types. (line 10)591 * Foreign Function Interface: Introduction. (line 31)592 * void: The Basics. (line 62)593 * void <1>: The Closure API. (line 19)594 * void <2>: The Closure API. (line 26)595 596 597 598 Tag Table:599 Node: Top682600 Node: Introduction1429601 Node: Using libffi3061602 Node: The Basics3547603 Node: Simple Example7187604 Node: Types8214605 Node: Primitive Types8497606 Node: Structures10318607 Node: Type Example11182608 Node: Multiple ABIs12405609 Node: The Closure API12776610 Node: Closure Example15720611 Node: Missing Features17279612 Node: Index17732613 614 End Tag Table -
libgo/Makefile.am
diff -Naur gcc-4.8.2.orig/libgo/Makefile.am gcc-4.8.2/libgo/Makefile.am
old new 424 424 runtime/go-caller.c \ 425 425 runtime/go-callers.c \ 426 426 runtime/go-can-convert-interface.c \ 427 runtime/go-cdiv.c \ 427 428 runtime/go-cgo.c \ 428 429 runtime/go-check-interface.c \ 429 430 runtime/go-construct-map.c \ -
libgo/Makefile.in
diff -Naur gcc-4.8.2.orig/libgo/Makefile.in gcc-4.8.2/libgo/Makefile.in
old new 195 195 @LIBGO_IS_LINUX_TRUE@am__objects_5 = getncpu-linux.lo 196 196 am__objects_6 = go-append.lo go-assert.lo go-assert-interface.lo \ 197 197 go-byte-array-to-string.lo go-breakpoint.lo go-caller.lo \ 198 go-callers.lo go-can-convert-interface.lo go-c go.lo \198 go-callers.lo go-can-convert-interface.lo go-cdiv.lo go-cgo.lo \ 199 199 go-check-interface.lo go-construct-map.lo \ 200 200 go-convert-interface.lo go-copy.lo go-defer.lo \ 201 201 go-deferred-recover.lo go-eface-compare.lo \ … … 757 757 runtime/go-caller.c \ 758 758 runtime/go-callers.c \ 759 759 runtime/go-can-convert-interface.c \ 760 runtime/go-cdiv.c \ 760 761 runtime/go-cgo.c \ 761 762 runtime/go-check-interface.c \ 762 763 runtime/go-construct-map.c \ … … 2368 2369 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-caller.Plo@am__quote@ 2369 2370 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-callers.Plo@am__quote@ 2370 2371 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-can-convert-interface.Plo@am__quote@ 2372 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-cdiv.Plo@am__quote@ 2371 2373 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-cgo.Plo@am__quote@ 2372 2374 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-check-interface.Plo@am__quote@ 2373 2375 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-construct-map.Plo@am__quote@ … … 2554 2556 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 2555 2557 @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 2556 2558 2559 go-cdiv.lo: runtime/go-cdiv.c 2560 @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 2561 @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-cdiv.Tpo $(DEPDIR)/go-cdiv.Plo 2562 @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-cdiv.c' object='go-cdiv.lo' libtool=yes @AMDEPBACKSLASH@ 2563 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 2564 @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 2565 2557 2566 go-cgo.lo: runtime/go-cgo.c 2558 2567 @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 2559 2568 @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-cgo.Tpo $(DEPDIR)/go-cgo.Plo -
libgo/config.h.in
diff -Naur gcc-4.8.2.orig/libgo/config.h.in gcc-4.8.2/libgo/config.h.in
old new 39 39 /* Define to 1 if you have the `dl_iterate_phdr' function. */ 40 40 #undef HAVE_DL_ITERATE_PHDR 41 41 42 /* Define to 1 if you have the `dup3' function. */ 43 #undef HAVE_DUP3 44 42 45 /* Define to 1 if you have the `epoll_create1' function. */ 43 46 #undef HAVE_EPOLL_CREATE1 44 47 … … 66 69 /* Define if _Unwind_GetIPInfo is available. */ 67 70 #undef HAVE_GETIPINFO 68 71 72 /* Define to 1 if you have the `getxattr' function. */ 73 #undef HAVE_GETXATTR 74 69 75 /* Define to 1 if you have the `inotify_add_watch' function. */ 70 76 #undef HAVE_INOTIFY_ADD_WATCH 71 77 … … 111 117 /* Define to 1 if you have the <linux/rtnetlink.h> header file. */ 112 118 #undef HAVE_LINUX_RTNETLINK_H 113 119 120 /* Define to 1 if you have the `listxattr' function. */ 121 #undef HAVE_LISTXATTR 122 114 123 /* Define to 1 if the system has the type `loff_t'. */ 115 124 #undef HAVE_LOFF_T 116 125 … … 171 180 /* Define to 1 if you have the `pipe2' function. */ 172 181 #undef HAVE_PIPE2 173 182 183 /* Define to 1 if you have the `removexattr' function. */ 184 #undef HAVE_REMOVEXATTR 185 174 186 /* Define to 1 if you have the `renameat' function. */ 175 187 #undef HAVE_RENAMEAT 176 188 … … 180 192 /* Define to 1 if you have the `setenv' function. */ 181 193 #undef HAVE_SETENV 182 194 195 /* Define to 1 if you have the `setxattr' function. */ 196 #undef HAVE_SETXATTR 197 183 198 /* Define to 1 if you have the `sinl' function. */ 184 199 #undef HAVE_SINL 185 200 -
libgo/configure
diff -Naur gcc-4.8.2.orig/libgo/configure gcc-4.8.2/libgo/configure
old new 14700 14700 fi 14701 14701 14702 14702 14703 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 renameatsync_file_range splice tee unlinkat unshare utimensat14703 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 14704 14704 do : 14705 14705 as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` 14706 14706 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -
libgo/configure.ac
diff -Naur gcc-4.8.2.orig/libgo/configure.ac gcc-4.8.2/libgo/configure.ac
old new 503 503 AM_CONDITIONAL(HAVE_STRERROR_R, test "$ac_cv_func_strerror_r" = yes) 504 504 AM_CONDITIONAL(HAVE_WAIT4, test "$ac_cv_func_wait4" = yes) 505 505 506 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 renameatsync_file_range splice tee unlinkat unshare utimensat)506 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) 507 507 AC_TYPE_OFF_T 508 508 AC_CHECK_TYPES([loff_t]) 509 509 -
libgo/go/syscall/libcall_linux.go
diff -Naur gcc-4.8.2.orig/libgo/go/syscall/libcall_linux.go gcc-4.8.2/libgo/go/syscall/libcall_linux.go
old new 190 190 //sys Adjtimex(buf *Timex) (state int, err error) 191 191 //adjtimex(buf *Timex) _C_int 192 192 193 //sysnb Dup3(oldfd int, newfd int, flags int) (err error) 194 //dup3(oldfd _C_int, newfd _C_int, flags _C_int) _C_int 195 193 196 //sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error) 194 197 //faccessat(dirfd _C_int, pathname *byte, mode _C_int, flags _C_int) _C_int 195 198 … … 268 271 return origlen - len(buf), count, names 269 272 } 270 273 274 //sys Getxattr(path string, attr string, dest []byte) (sz int, err error) 275 //getxattr(path *byte, attr *byte, buf *byte, count Size_t) Ssize_t 276 271 277 //sys InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) 272 278 //inotify_add_watch(fd _C_int, pathname *byte, mask uint32) _C_int 273 279 … … 283 289 //sys Klogctl(typ int, buf []byte) (n int, err error) 284 290 //klogctl(typ _C_int, bufp *byte, len _C_int) _C_int 285 291 292 //sys Listxattr(path string, dest []byte) (sz int, err error) 293 //listxattr(path *byte, list *byte, size Size_t) Ssize_t 294 286 295 //sys Mkdirat(dirfd int, path string, mode uint32) (err error) 287 296 //mkdirat(dirfd _C_int, path *byte, mode Mode_t) _C_int 288 297 … … 305 314 //sys PivotRoot(newroot string, putold string) (err error) 306 315 //pivot_root(newroot *byte, putold *byte) _C_int 307 316 317 //sys Removexattr(path string, attr string) (err error) 318 //removexattr(path *byte, name *byte) _C_int 319 308 320 //sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) 309 321 //renameat(olddirfd _C_int, oldpath *byte, newdirfd _C_int, newpath *byte) _C_int 310 322 … … 338 350 //sysnb Setresuid(ruid int, eguid int, suid int) (err error) 339 351 //setresuid(ruid Uid_t, euid Uid_t, suid Uid_t) _C_int 340 352 353 //sys Setxattr(path string, attr string, data []byte, flags int) (err error) 354 //setxattr(path *byte, name *byte, value *byte, size Size_t, flags _C_int) _C_int 355 341 356 //sys splice(rfd int, roff *_loff_t, wfd int, woff *_loff_t, len int, flags int) (n int64, err error) 342 357 //splice(rfd _C_int, roff *_loff_t, wfd _C_int, woff *_loff_t, len Size_t, flags _C_uint) Ssize_t 343 358 func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) { -
libgo/go/syscall/libcall_posix.go
diff -Naur gcc-4.8.2.orig/libgo/go/syscall/libcall_posix.go gcc-4.8.2/libgo/go/syscall/libcall_posix.go
old new 238 238 //sysnb Getppid() (ppid int) 239 239 //getppid() Pid_t 240 240 241 //sys Getpriority(which int, who int) (prio int, err error) 242 //getpriority(which _C_int, who _C_int) _C_int 243 241 244 //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) 242 245 //getrlimit(resource _C_int, rlim *Rlimit) _C_int 243 246 … … 307 310 //sysnb Setpgid(pid int, pgid int) (err error) 308 311 //setpgid(pid Pid_t, pgid Pid_t) _C_int 309 312 313 //sys Setpriority(which int, who int, prio int) (err error) 314 //setpriority(which _C_int, who _C_int, prio _C_int) _C_int 315 310 316 //sysnb Setreuid(ruid int, euid int) (err error) 311 317 //setreuid(ruid Uid_t, euid Uid_t) _C_int 312 318 -
libgo/mksysinfo.sh
diff -Naur gcc-4.8.2.orig/libgo/mksysinfo.sh gcc-4.8.2/libgo/mksysinfo.sh
old new 1035 1035 grep '^const _LOCK_' gen-sysinfo.go | 1036 1036 sed -e 's/^\(const \)_\(LOCK_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT} 1037 1037 1038 # The PRIO constants. 1039 grep '^const _PRIO_' gen-sysinfo.go | \ 1040 sed -e 's/^\(const \)_\(PRIO_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT} 1041 1038 1042 # The GNU/Linux LINUX_REBOOT flags. 1039 1043 grep '^const _LINUX_REBOOT_' gen-sysinfo.go | 1040 1044 sed -e 's/^\(const \)_\(LINUX_REBOOT_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT} -
libgo/runtime/go-cdiv.c
diff -Naur gcc-4.8.2.orig/libgo/runtime/go-cdiv.c gcc-4.8.2/libgo/runtime/go-cdiv.c
old new 1 /* go-cdiv.c -- complex division routines 2 3 Copyright 2013 The Go Authors. All rights reserved. 4 Use of this source code is governed by a BSD-style 5 license that can be found in the LICENSE file. */ 6 7 /* Calls to these functions are generated by the Go frontend for 8 division of complex64 or complex128. We use these because Go's 9 complex division expects slightly different results from the GCC 10 default. When dividing NaN+1.0i / 0+0i, Go expects NaN+NaNi but 11 GCC generates NaN+Infi. NaN+Infi seems wrong seems the rules of 12 C99 Annex G specify that if either side of a complex number is Inf, 13 the the whole number is Inf, but an operation involving NaN ought 14 to result in NaN, not Inf. */ 15 16 __complex float 17 __go_complex64_div (__complex float a, __complex float b) 18 { 19 if (__builtin_expect (b == 0+0i, 0)) 20 { 21 if (!__builtin_isinff (__real__ a) 22 && !__builtin_isinff (__imag__ a) 23 && (__builtin_isnanf (__real__ a) || __builtin_isnanf (__imag__ a))) 24 { 25 /* Pass "1" to nanf to match math/bits.go. */ 26 return __builtin_nanf("1") + __builtin_nanf("1")*1i; 27 } 28 } 29 return a / b; 30 } 31 32 __complex double 33 __go_complex128_div (__complex double a, __complex double b) 34 { 35 if (__builtin_expect (b == 0+0i, 0)) 36 { 37 if (!__builtin_isinf (__real__ a) 38 && !__builtin_isinf (__imag__ a) 39 && (__builtin_isnan (__real__ a) || __builtin_isnan (__imag__ a))) 40 { 41 /* Pass "1" to nan to match math/bits.go. */ 42 return __builtin_nan("1") + __builtin_nan("1")*1i; 43 } 44 } 45 return a / b; 46 } -
libgo/runtime/go-make-slice.c
diff -Naur gcc-4.8.2.orig/libgo/runtime/go-make-slice.c gcc-4.8.2/libgo/runtime/go-make-slice.c
old new 34 34 std = (const struct __go_slice_type *) td; 35 35 36 36 ilen = (intgo) len; 37 if (ilen < 0 || (uintptr_t) ilen != len) 37 if (ilen < 0 38 || (uintptr_t) ilen != len 39 || (std->__element_type->__size > 0 40 && len > MaxMem / std->__element_type->__size)) 38 41 runtime_panicstring ("makeslice: len out of range"); 39 42 40 43 icap = (intgo) cap; -
libgo/runtime/go-nosys.c
diff -Naur gcc-4.8.2.orig/libgo/runtime/go-nosys.c gcc-4.8.2/libgo/runtime/go-nosys.c
old new 43 43 } 44 44 #endif 45 45 46 #ifndef HAVE_DUP3 47 int 48 dup3 (int oldfd __attribute__ ((unused)), 49 int newfd __attribute__ ((unused)), 50 int flags __attribute__ ((unused))) 51 { 52 errno = ENOSYS; 53 return -1; 54 } 55 #endif 56 46 57 #ifndef HAVE_EPOLL_CREATE1 47 58 int 48 59 epoll_create1 (int flags __attribute__ ((unused))) … … 112 123 } 113 124 #endif 114 125 126 #ifndef HAVE_GETXATTR 127 ssize_t 128 getxattr (const char *path __attribute__ ((unused)), 129 const char *name __attribute__ ((unused)), 130 void *value __attribute__ ((unused)), 131 size_t size __attribute__ ((unused))) 132 { 133 errno = ENOSYS; 134 return -1; 135 } 136 #endif 137 115 138 #ifndef HAVE_INOTIFY_ADD_WATCH 116 139 int 117 140 inotify_add_watch (int fd __attribute__ ((unused)), … … 151 174 } 152 175 #endif 153 176 177 #ifndef HAVE_LISTXATTR 178 ssize_t 179 listxattr (const char *path __attribute__ ((unused)), 180 char *list __attribute__ ((unused)), 181 size_t size __attribute__ ((unused))) 182 { 183 errno = ENOSYS; 184 return -1; 185 } 186 #endif 187 154 188 #ifndef HAVE_MKDIRAT 155 189 int 156 190 mkdirat (int dirfd __attribute__ ((unused)), … … 196 230 } 197 231 #endif 198 232 233 #ifndef HAVE_REMOVEXATTR 234 int 235 removexattr (const char *path __attribute__ ((unused)), 236 const char *name __attribute__ ((unused))) 237 { 238 errno = ENOSYS; 239 return -1; 240 } 241 #endif 242 199 243 #ifndef HAVE_RENAMEAT 200 244 int 201 245 renameat (int olddirfd __attribute__ ((unused)), … … 205 249 { 206 250 errno = ENOSYS; 207 251 return -1; 252 } 253 #endif 254 255 #ifndef HAVE_SETXATTR 256 int 257 setxattr (const char *path __attribute__ ((unused)), 258 const char *name __attribute__ ((unused)), 259 const void *value __attribute__ ((unused)), 260 size_t size __attribute__ ((unused)), 261 int flags __attribute__ ((unused))) 262 { 263 errno = ENOSYS; 264 return -1; 208 265 } 209 266 #endif 210 267 -
libgo/runtime/go-signal.c
diff -Naur gcc-4.8.2.orig/libgo/runtime/go-signal.c gcc-4.8.2/libgo/runtime/go-signal.c
old new 399 399 { 400 400 G *gp; 401 401 M *mp; 402 #ifdef USING_SPLIT_STACK 403 void *stack_context[10]; 404 #endif 402 405 403 406 /* We are now running on the stack registered via sigaltstack. 404 407 (Actually there is a small span of time between runtime_siginit … … 409 412 if (gp != NULL) 410 413 { 411 414 #ifdef USING_SPLIT_STACK 412 __splitstack_getcontext (& gp->stack_context[0]);415 __splitstack_getcontext (&stack_context[0]); 413 416 #endif 414 417 } 415 418 … … 432 435 if (gp != NULL) 433 436 { 434 437 #ifdef USING_SPLIT_STACK 435 __splitstack_setcontext (& gp->stack_context[0]);438 __splitstack_setcontext (&stack_context[0]); 436 439 #endif 437 440 } 438 441 } -
libitm/libitm.info
diff -Naur gcc-4.8.2.orig/libitm/libitm.info gcc-4.8.2/libitm/libitm.info
old new 1 This is libitm.info, produced by makeinfo version 5.1 from libitm.texi.2 3 Copyright (C) 2011-2013 Free Software Foundation, Inc.4 5 Permission is granted to copy, distribute and/or modify this document6 under the terms of the GNU Free Documentation License, Version 1.2 or7 any later version published by the Free Software Foundation; with no8 Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A9 copy of the license is included in the section entitled "GNU Free10 Documentation License".11 INFO-DIR-SECTION GNU Libraries12 START-INFO-DIR-ENTRY13 * libitm: (libitm). GNU Transactional Memory Library14 END-INFO-DIR-ENTRY15 16 This manual documents the GNU Transactional Memory Library.17 18 Copyright (C) 2011-2013 Free Software Foundation, Inc.19 20 Permission is granted to copy, distribute and/or modify this document21 under the terms of the GNU Free Documentation License, Version 1.2 or22 any later version published by the Free Software Foundation; with no23 Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A24 copy of the license is included in the section entitled "GNU Free25 Documentation License".26 27 28 File: libitm.info, Node: Top, Next: Enabling libitm, Up: (dir)29 30 Introduction31 ************32 33 This manual documents the usage and internals of libitm, the GNU34 Transactional Memory Library. It provides transaction support for35 accesses to a process' memory, enabling easy-to-use synchronization of36 accesses to shared memory by several threads.37 38 * Menu:39 40 * Enabling libitm:: How to enable libitm for your applications.41 * C/C++ Language Constructs for TM::42 Notes on the language-level interface supported43 by gcc.44 * The libitm ABI:: Notes on the external ABI provided by libitm.45 * Internals:: Notes on libitm's internal synchronization.46 * GNU Free Documentation License::47 How you can copy and share this manual.48 * Index:: Index of this documentation.49 50 51 File: libitm.info, Node: Enabling libitm, Next: C/C++ Language Constructs for TM, Prev: Top, Up: Top52 53 1 Enabling libitm54 *****************55 56 To activate support for TM in C/C++, the compile-time flag '-fgnu-tm'57 must be specified. This enables TM language-level constructs such as58 transaction statements (e.g., '__transaction_atomic', *note C/C++59 Language Constructs for TM:: for details).60 61 62 File: libitm.info, Node: C/C++ Language Constructs for TM, Next: The libitm ABI, Prev: Enabling libitm, Up: Top63 64 2 C/C++ Language Constructs for TM65 **********************************66 67 Transactions are supported in C++ and C in the form of transaction68 statements, transaction expressions, and function transactions. In the69 following example, both 'a' and 'b' will be read and the difference will70 be written to 'c', all atomically and isolated from other transactions:71 72 __transaction_atomic { c = a - b; }73 74 Therefore, another thread can use the following code to concurrently75 update 'b' without ever causing 'c' to hold a negative value (and76 without having to use other synchronization constructs such as locks or77 C++11 atomics):78 79 __transaction_atomic { if (a > b) b++; }80 81 GCC follows the Draft Specification of Transactional Language82 Constructs for C++ (v1.1)83 (https://sites.google.com/site/tmforcplusplus/) in its implementation of84 transactions.85 86 The precise semantics of transactions are defined in terms of the87 C++11/C11 memory model (see the specification). Roughly, transactions88 provide synchronization guarantees that are similar to what would be89 guaranteed when using a single global lock as a guard for all90 transactions. Note that like other synchronization constructs in C/C++,91 transactions rely on a data-race-free program (e.g., a nontransactional92 write that is concurrent with a transactional read to the same memory93 location is a data race).94 95 96 File: libitm.info, Node: The libitm ABI, Next: Internals, Prev: C/C++ Language Constructs for TM, Up: Top97 98 3 The libitm ABI99 ****************100 101 The ABI provided by libitm is basically equal to the Linux variant of102 Intel's current TM ABI specification document (Revision 1.1, May 6 2009)103 but with the differences listed in this chapter. It would be good if104 these changes would eventually be merged into a future version of this105 specification. To ease look-up, the following subsections mirror the106 structure of this specification.107 108 3.1 [No changes] Objectives109 ===========================110 111 3.2 [No changes] Non-objectives112 ===============================113 114 3.3 Library design principles115 =============================116 117 3.3.1 [No changes] Calling conventions118 --------------------------------------119 120 3.3.2 [No changes] TM library algorithms121 ----------------------------------------122 123 3.3.3 [No changes] Optimized load and store routines124 ----------------------------------------------------125 126 3.3.4 [No changes] Aligned load and store routines127 --------------------------------------------------128 129 3.3.5 Data logging functions130 ----------------------------131 132 The memory locations accessed with transactional loads and stores and133 the memory locations whose values are logged must not overlap. This134 required separation only extends to the scope of the execution of one135 transaction including all the executions of all nested transactions.136 137 The compiler must be consistent (within the scope of a single138 transaction) about which memory locations are shared and which are not139 shared with other threads (i.e., data must be accessed either140 transactionally or nontransactionally). Otherwise, non-write-through TM141 algorithms would not work.142 143 For memory locations on the stack, this requirement extends to only144 the lifetime of the stack frame that the memory location belongs to (or145 the lifetime of the transaction, whichever is shorter). Thus, memory146 that is reused for several stack frames could be target of both data147 logging and transactional accesses; however, this is harmless because148 these stack frames' lifetimes will end before the transaction finishes.149 150 3.3.6 [No changes] Scatter/gather calls151 ---------------------------------------152 153 3.3.7 [No changes] Serial and irrevocable mode154 ----------------------------------------------155 156 3.3.8 [No changes] Transaction descriptor157 -----------------------------------------158 159 3.3.9 Store allocation160 ----------------------161 162 There is no 'getTransaction' function.163 164 3.3.10 [No changes] Naming conventions165 --------------------------------------166 167 3.3.11 Function pointer encryption168 ----------------------------------169 170 Currently, this is not implemented.171 172 3.4 Types and macros list173 =========================174 175 '_ITM_codeProperties' has changed, *note Starting a transaction:176 txn-code-properties. '_ITM_srcLocation' is not used.177 178 3.5 Function list179 =================180 181 3.5.1 Initialization and finalization functions182 -----------------------------------------------183 184 These functions are not part of the ABI.185 186 3.5.2 [No changes] Version checking187 -----------------------------------188 189 3.5.3 [No changes] Error reporting190 ----------------------------------191 192 3.5.4 [No changes] inTransaction call193 -------------------------------------194 195 3.5.5 State manipulation functions196 ----------------------------------197 198 There is no 'getTransaction' function. Transaction identifiers for199 nested transactions will be ordered but not necessarily sequential200 (i.e., for a nested transaction's identifier IN and its enclosing201 transaction's identifier IE, it is guaranteed that IN >= IE).202 203 3.5.6 [No changes] Source locations204 -----------------------------------205 206 3.5.7 Starting a transaction207 ----------------------------208 209 3.5.7.1 Transaction code properties210 ...................................211 212 The bit 'hasNoXMMUpdate' is instead called 'hasNoVectorUpdate'. Iff it213 is set, vector register save/restore is not necessary for any target214 machine.215 216 The 'hasNoFloatUpdate' bit ('0x0010') is new. Iff it is set,217 floating point register save/restore is not necessary for any target218 machine.219 220 'undoLogCode' is not supported and a fatal runtime error will be221 raised if this bit is set. It is not properly defined in the ABI why222 barriers other than undo logging are not present; Are they not necessary223 (e.g., a transaction operating purely on thread-local data) or have they224 been omitted by the compiler because it thinks that some kind of global225 synchronization (e.g., serial mode) might perform better? The226 specification suggests that the latter might be the case, but the former227 seems to be more useful.228 229 The 'readOnly' bit ('0x4000') is new. *TODO* Lexical or dynamic230 scope?231 232 'hasNoRetry' is not supported. If this bit is not set, but233 'hasNoAbort' is set, the library can assume that transaction rollback234 will not be requested.235 236 It would be useful if the absence of externally-triggered rollbacks237 would be reported for the dynamic scope as well, not just for the238 lexical scope ('hasNoAbort'). Without this, a library cannot exploit239 this together with flat nesting.240 241 'exceptionBlock' is not supported because exception blocks are not242 used.243 244 3.5.7.2 [No changes] Windows exception state245 ............................................246 247 3.5.7.3 [No changes] Other machine state248 ........................................249 250 3.5.7.4 [No changes] Results from beginTransaction251 ..................................................252 253 3.5.8 Aborting a transaction254 ----------------------------255 256 '_ITM_rollbackTransaction' is not supported. '_ITM_abortTransaction' is257 supported but the abort reasons 'exceptionBlockAbort', 'TMConflict', and258 'userRetry' are not supported. There are no exception blocks in259 general, so the related cases also do not have to be considered. To260 encode '__transaction_cancel [[outer]]', compilers must set the new261 'outerAbort' bit ('0x10') additionally to the 'userAbort' bit in the262 abort reason.263 264 3.5.9 Committing a transaction265 ------------------------------266 267 The exception handling (EH) scheme is different. The Intel ABI requires268 the '_ITM_tryCommitTransaction' function that will return even when the269 commit failed and will have to be matched with calls to either270 '_ITM_abortTransaction' or '_ITM_commitTransaction'. In contrast, gcc271 relies on transactional wrappers for the functions of the Exception272 Handling ABI and on one additional commit function (shown below). This273 allows the TM to keep track of EH internally and thus it does not have274 to embed the cleanup of EH state into the existing EH code in the275 program. '_ITM_tryCommitTransaction' is not supported.276 '_ITM_commitTransactionToId' is also not supported because the277 propagation of thrown exceptions will not bypass commits of nested278 transactions.279 280 void _ITM_commitTransactionEH(void *exc_ptr) ITM_REGPARM;281 void *_ITM_cxa_allocate_exception (size_t);282 void _ITM_cxa_throw (void *obj, void *tinfo, void *dest);283 void *_ITM_cxa_begin_catch (void *exc_ptr);284 void _ITM_cxa_end_catch (void);285 286 '_ITM_commitTransactionEH' must be called to commit a transaction if287 an exception could be in flight at this position in the code. 'exc_ptr'288 is the current exception or zero if there is no current exception. The289 '_ITM_cxa...' functions are transactional wrappers for the respective290 '__cxa...' functions and must be called instead of these in291 transactional code.292 293 To support this EH scheme, libstdc++ needs to provide one additional294 function ('_cxa_tm_cleanup'), which is used by the TM to clean up the295 exception handling state while rolling back a transaction:296 297 void __cxa_tm_cleanup (void *unthrown_obj, void *cleanup_exc,298 unsigned int caught_count);299 300 'unthrown_obj' is non-null if the program called301 '__cxa_allocate_exception' for this exception but did not yet called302 '__cxa_throw' for it. 'cleanup_exc' is non-null if the program is303 currently processing a cleanup along an exception path but has not304 caught this exception yet. 'caught_count' is the nesting depth of305 '__cxa_begin_catch' within the transaction (which can be counted by the306 TM using '_ITM_cxa_begin_catch' and '_ITM_cxa_end_catch');307 '__cxa_tm_cleanup' then performs rollback by essentially performing308 '__cxa_end_catch' that many times.309 310 3.5.10 Exception handling support311 ---------------------------------312 313 Currently, there is no support for functionality like314 '__transaction_cancel throw' as described in the C++ TM specification.315 Supporting this should be possible with the EH scheme explained316 previously because via the transactional wrappers for the EH ABI, the TM317 is able to observe and intercept EH.318 319 3.5.11 [No changes] Transition to serial-irrevocable mode320 ---------------------------------------------------------321 322 3.5.12 [No changes] Data transfer functions323 -------------------------------------------324 325 3.5.13 [No changes] Transactional memory copies326 -----------------------------------------------327 328 3.5.14 Transactional versions of memmove329 ----------------------------------------330 331 If either the source or destination memory region is to be accessed332 nontransactionally, then source and destination regions must not be333 overlapping. The respective '_ITM_memmove' functions are still334 available but a fatal runtime error will be raised if such regions do335 overlap. To support this functionality, the ABI would have to specify336 how the intersection of the regions has to be accessed (i.e.,337 transactionally or nontransactionally).338 339 3.5.15 [No changes] Transactional versions of memset340 ----------------------------------------------------341 342 3.5.16 [No changes] Logging functions343 -------------------------------------344 345 3.5.17 User-registered commit and undo actions346 ----------------------------------------------347 348 Commit actions will get executed in the same order in which the349 respective calls to '_ITM_addUserCommitAction' happened. Only350 '_ITM_noTransactionId' is allowed as value for the351 'resumingTransactionId' argument. Commit actions get executed after352 privatization safety has been ensured.353 354 Undo actions will get executed in reverse order compared to the order355 in which the respective calls to '_ITM_addUserUndoAction' happened. The356 ordering of undo actions w.r.t. the roll-back of other actions (e.g.,357 data transfers or memory allocations) is undefined.358 359 '_ITM_getThreadnum' is not supported currently because its only360 purpose is to provide a thread ID that matches some assumed performance361 tuning output, but this output is not part of the ABI nor further362 defined by it.363 364 '_ITM_dropReferences' is not supported currently because its365 semantics and the intention behind it is not entirely clear. The366 specification suggests that this function is necessary because of367 certain orderings of data transfer undos and the releasing of memory368 regions (i.e., privatization). However, this ordering is never defined,369 nor is the ordering of dropping references w.r.t. other events.370 371 3.5.18 [New] Transactional indirect calls372 -----------------------------------------373 374 Indirect calls (i.e., calls through a function pointer) within375 transactions should execute the transactional clone of the original376 function (i.e., a clone of the original that has been fully instrumented377 to use the TM runtime), if such a clone is available. The runtime378 provides two functions to register/deregister clone tables:379 380 struct clone_entry381 {382 void *orig, *clone;383 };384 385 void _ITM_registerTMCloneTable (clone_entry *table, size_t entries);386 void _ITM_deregisterTMCloneTable (clone_entry *table);387 388 Registered tables must be writable by the TM runtime, and must be389 live throughout the life-time of the TM runtime.390 391 *TODO* The intention was always to drop the registration functions392 entirely, and create a new ELF Phdr describing the linker-sorted table.393 Much like what currently happens for 'PT_GNU_EH_FRAME'. This work kept394 getting bogged down in how to represent the N different code generation395 variants. We clearly needed at least two--SW and HW transactional396 clones--but there was always a suggestion of more variants for different397 TM assumptions/invariants.398 399 The compiler can then use two TM runtime functions to perform400 indirect calls in transactions:401 void *_ITM_getTMCloneOrIrrevocable (void *function) ITM_REGPARM;402 void *_ITM_getTMCloneSafe (void *function) ITM_REGPARM;403 404 If there is a registered clone for supplied function, both will405 return a pointer to the clone. If not, the first runtime function will406 attempt to switch to serial-irrevocable mode and return the original407 pointer, whereas the second will raise a fatal runtime error.408 409 3.5.19 [New] Transactional dynamic memory management410 ----------------------------------------------------411 412 void *_ITM_malloc (size_t)413 __attribute__((__malloc__)) ITM_PURE;414 void *_ITM_calloc (size_t, size_t)415 __attribute__((__malloc__)) ITM_PURE;416 void _ITM_free (void *) ITM_PURE;417 418 These functions are essentially transactional wrappers for 'malloc',419 'calloc', and 'free'. Within transactions, the compiler should replace420 calls to the original functions with calls to the wrapper functions.421 422 3.6 [No changes] Future Enhancements to the ABI423 ===============================================424 425 3.7 Sample code426 ===============427 428 The code examples might not be correct w.r.t. the current version of429 the ABI, especially everything related to exception handling.430 431 3.8 [New] Memory model432 ======================433 434 The ABI should define a memory model and the ordering that is guaranteed435 for data transfers and commit/undo actions, or at least refer to another436 memory model that needs to be preserved. Without that, the compiler437 cannot ensure the memory model specified on the level of the programming438 language (e.g., by the C++ TM specification).439 440 For example, if a transactional load is ordered before another441 load/store, then the TM runtime must also ensure this ordering when442 accessing shared state. If not, this might break the kind of443 publication safety used in the C++ TM specification. Likewise, the TM444 runtime must ensure privatization safety.445 446 447 File: libitm.info, Node: Internals, Next: GNU Free Documentation License, Prev: The libitm ABI, Up: Top448 449 4 Internals450 ***********451 452 4.1 TM methods and method groups453 ================================454 455 libitm supports several ways of synchronizing transactions with each456 other. These TM methods (or TM algorithms) are implemented in the form457 of subclasses of 'abi_dispatch', which provide methods for transactional458 loads and stores as well as callbacks for rollback and commit. All459 methods that are compatible with each other (i.e., that let concurrently460 running transactions still synchronize correctly even if different461 methods are used) belong to the same TM method group. Pointers to TM462 methods can be obtained using the factory methods prefixed with463 'dispatch_' in 'libitm_i.h'. There are two special methods,464 'dispatch_serial' and 'dispatch_serialirr', that are compatible with all465 methods because they run transactions completely in serial mode.466 467 4.1.1 TM method life cycle468 --------------------------469 470 The state of TM methods does not change after construction, but they do471 alter the state of transactions that use this method. However, because472 per-transaction data gets used by several methods, 'gtm_thread' is473 responsible for setting an initial state that is useful for all methods.474 After that, methods are responsible for resetting/clearing this state on475 each rollback or commit (of outermost transactions), so that the476 transaction executed next is not affected by the previous transaction.477 478 There is also global state associated with each method group, which479 is initialized and shut down ('method_group::init()' and 'fini()') when480 switching between method groups (see 'retry.cc').481 482 4.1.2 Selecting the default method483 ----------------------------------484 485 The default method that libitm uses for freshly started transactions486 (but not necessarily for restarted transactions) can be set via an487 environment variable ('ITM_DEFAULT_METHOD'), whose value should be equal488 to the name of one of the factory methods returning abi_dispatch489 subclasses but without the "dispatch_" prefix (e.g., "serialirr" instead490 of 'GTM::dispatch_serialirr()').491 492 Note that this environment variable is only a hint for libitm and493 might not be supported in the future.494 495 4.2 Nesting: flat vs. closed496 ============================497 498 We support two different kinds of nesting of transactions. In the case499 of _flat nesting_, the nesting structure is flattened and all nested500 transactions are subsumed by the enclosing transaction. In contrast,501 with _closed nesting_, nested transactions that have not yet committed502 can be rolled back separately from the enclosing transactions; when they503 commit, they are subsumed by the enclosing transaction, and their504 effects will be finally committed when the outermost transaction505 commits. _Open nesting_ (where nested transactions can commit506 independently of the enclosing transactions) are not supported.507 508 Flat nesting is the default nesting mode, but closed nesting is509 supported and used when transactions contain user-controlled aborts510 ('__transaction_cancel' statements). We assume that user-controlled511 aborts are rare in typical code and used mostly in exceptional512 situations. Thus, it makes more sense to use flat nesting by default to513 avoid the performance overhead of the additional checkpoints required514 for closed nesting. User-controlled aborts will correctly abort the515 innermost enclosing transaction, whereas the whole (i.e., outermost)516 transaction will be restarted otherwise (e.g., when a transaction517 encounters data conflicts during optimistic execution).518 519 4.3 Locking conventions520 =======================521 522 This section documents the locking scheme and rules for all uses of523 locking in libitm. We have to support serial(-irrevocable) mode, which524 is implemented using a global lock as explained next (called the _serial525 lock_). To simplify the overall design, we use the same lock as526 catch-all locking mechanism for other infrequent tasks such as527 (de)registering clone tables or threads. Besides the serial lock, there528 are _per-method-group locks_ that are managed by specific method groups529 (i.e., groups of similar TM concurrency control algorithms), and530 lock-like constructs for quiescence-based operations such as ensuring531 privatization safety.532 533 Thus, the actions that participate in the libitm-internal locking are534 either _active transactions_ that do not run in serial mode, _serial535 transactions_ (which (are about to) run in serial mode), and management536 tasks that do not execute within a transaction but have acquired the537 serial mode like a serial transaction would do (e.g., to be able to538 register threads with libitm). Transactions become active as soon as539 they have successfully used the serial lock to announce this globally540 (*note Serial lock implementation: serial-lock-impl.). Likewise,541 transactions become serial transactions as soon as they have acquired542 the exclusive rights provided by the serial lock (i.e., serial mode,543 which also means that there are no other concurrent active or serial544 transactions). Note that active transactions can become serial545 transactions when they enter serial mode during the runtime of the546 transaction.547 548 4.3.1 State-to-lock mapping549 ---------------------------550 551 Application data is protected by the serial lock if there is a serial552 transaction and no concurrently running active transaction (i.e.,553 non-serial). Otherwise, application data is protected by the currently554 selected method group, which might use per-method-group locks or other555 mechanisms. Also note that application data that is about to be556 privatized might not be allowed to be accessed by nontransactional code557 until privatization safety has been ensured; the details of this are558 handled by the current method group.559 560 libitm-internal state is either protected by the serial lock or561 accessed through custom concurrent code. The latter applies to the562 public/shared part of a transaction object and most typical563 method-group-specific state.564 565 The former category (protected by the serial lock) includes:566 * The list of active threads that have used transactions.567 * The tables that map functions to their transactional clones.568 * The current selection of which method group to use.569 * Some method-group-specific data, or invariants of this data. For570 example, resetting a method group to its initial state is handled571 by switching to the same method group, so the serial lock protects572 such resetting as well.573 In general, such state is immutable whenever there exists an active574 (non-serial) transaction. If there is no active transaction, a serial575 transaction (or a thread that is not currently executing a transaction576 but has acquired the serial lock) is allowed to modify this state (but577 must of course be careful to not surprise the current method group's578 implementation with such modifications).579 580 4.3.2 Lock acquisition order581 ----------------------------582 583 To prevent deadlocks, locks acquisition must happen in a globally584 agreed-upon order. Note that this applies to other forms of blocking585 too, but does not necessarily apply to lock acquisitions that do not586 block (e.g., trylock() calls that do not get retried forever). Note587 that serial transactions are never return back to active transactions588 until the transaction has committed. Likewise, active transactions stay589 active until they have committed. Per-method-group locks are typically590 also not released before commit.591 592 Lock acquisition / blocking rules:593 594 * Transactions must become active or serial before they are allowed595 to use method-group-specific locks or blocking (i.e., the serial596 lock must be acquired before those other locks, either in serial or597 nonserial mode).598 599 * Any number of threads that do not currently run active transactions600 can block while trying to get the serial lock in exclusive mode.601 Note that active transactions must not block when trying to upgrade602 to serial mode unless there is no other transaction that is trying603 that (the latter is ensured by the serial lock implementation.604 605 * Method groups must prevent deadlocks on their locks. In606 particular, they must also be prepared for another active607 transaction that has acquired method-group-specific locks but is608 blocked during an attempt to upgrade to being a serial transaction.609 See below for details.610 611 * Serial transactions can acquire method-group-specific locks because612 there will be no other active nor serial transaction.613 614 There is no single rule for per-method-group blocking because this615 depends on when a TM method might acquire locks. If no active616 transaction can upgrade to being a serial transaction after it has617 acquired per-method-group locks (e.g., when those locks are only618 acquired during an attempt to commit), then the TM method does not need619 to consider a potential deadlock due to serial mode.620 621 If there can be upgrades to serial mode after the acquisition of622 per-method-group locks, then TM methods need to avoid those deadlocks:623 * When upgrading to a serial transaction, after acquiring exclusive624 rights to the serial lock but before waiting for concurrent active625 transactions to finish (*note Serial lock implementation:626 serial-lock-impl. for details), we have to wake up all active627 transactions waiting on the upgrader's per-method-group locks.628 * Active transactions blocking on per-method-group locks need to629 check the serial lock and abort if there is a pending serial630 transaction.631 * Lost wake-ups have to be prevented (e.g., by changing a bit in each632 per-method-group lock before doing the wake-up, and only blocking633 on this lock using a futex if this bit is not group).634 635 *TODO*: Can reuse serial lock for gl-*? And if we can, does it make636 sense to introduce further complexity in the serial lock? For gl-*, we637 can really only avoid an abort if we do -wb and -vbv.638 639 4.3.3 Serial lock implementation640 --------------------------------641 642 The serial lock implementation is optimized towards assuming that serial643 transactions are infrequent and not the common case. However, the644 performance of entering serial mode can matter because when only few645 transactions are run concurrently or if there are few threads, then it646 can be efficient to run transactions serially.647 648 The serial lock is similar to a multi-reader-single-writer lock in649 that there can be several active transactions but only one serial650 transaction. However, we do want to avoid contention (in the lock651 implementation) between active transactions, so we split up the reader652 side of the lock into per-transaction flags that are true iff the653 transaction is active. The exclusive writer side remains a shared654 single flag, which is acquired using a CAS, for example. On the655 fast-path, the serial lock then works similar to Dekker's algorithm but656 with several reader flags that a serial transaction would have to check.657 A serial transaction thus requires a list of all threads with658 potentially active transactions; we can use the serial lock itself to659 protect this list (i.e., only threads that have acquired the serial lock660 can modify this list).661 662 We want starvation-freedom for the serial lock to allow for using it663 to ensure progress for potentially starved transactions (*note Progress664 Guarantees: progress-guarantees. for details). However, this is665 currently not enforced by the implementation of the serial lock.666 667 Here is pseudo-code for the read/write fast paths of acquiring the668 serial lock (read-to-write upgrade is similar to write_lock:669 // read_lock:670 tx->shared_state |= active;671 __sync_synchronize(); // or STLD membar, or C++0x seq-cst fence672 while (!serial_lock.exclusive)673 if (spinning_for_too_long) goto slowpath;674 675 // write_lock:676 if (CAS(&serial_lock.exclusive, 0, this) != 0)677 goto slowpath; // writer-writer contention678 // need a membar here, but CAS already has full membar semantics679 bool need_blocking = false;680 for (t: all txns)681 {682 for (;t->shared_state & active;)683 if (spinning_for_too_long) { need_blocking = true; break; }684 }685 if (need_blocking) goto slowpath;686 687 Releasing a lock in this spin-lock version then just consists of688 resetting 'tx->shared_state' to inactive or clearing689 'serial_lock.exclusive'.690 691 However, we can't rely on a pure spinlock because we need to get the692 OS involved at some time (e.g., when there are more threads than CPUs to693 run on). Therefore, the real implementation falls back to a blocking694 slow path, either based on pthread mutexes or Linux futexes.695 696 4.3.4 Reentrancy697 ----------------698 699 libitm has to consider the following cases of reentrancy:700 701 * Transaction calls unsafe code that starts a new transaction: The702 outer transaction will become a serial transaction before executing703 unsafe code. Therefore, nesting within serial transactions must704 work, even if the nested transaction is called from within705 uninstrumented code.706 707 * Transaction calls either a transactional wrapper or safe code,708 which in turn starts a new transaction: It is not yet defined in709 the specification whether this is allowed. Thus, it is undefined710 whether libitm supports this.711 712 * Code that starts new transactions might be called from within any713 part of libitm: This kind of reentrancy would likely be rather714 complex and can probably be avoided. Therefore, it is not715 supported.716 717 4.3.5 Privatization safety718 --------------------------719 720 Privatization safety is ensured by libitm using a quiescence-based721 approach. Basically, a privatizing transaction waits until all722 concurrent active transactions will either have finished (are not active723 anymore) or operate on a sufficiently recent snapshot to not access the724 privatized data anymore. This happens after the privatizing transaction725 has stopped being an active transaction, so waiting for quiescence does726 not contribute to deadlocks.727 728 In method groups that need to ensure publication safety explicitly,729 active transactions maintain a flag or timestamp in the public/shared730 part of the transaction descriptor. Before blocking, privatizers need731 to let the other transactions know that they should wake up the732 privatizer.733 734 *TODO* Ho to implement the waiters? Should those flags be735 per-transaction or at a central place? We want to avoid one wake/wait736 call per active transactions, so we might want to use either a tree or737 combining to reduce the syscall overhead, or rather spin for a long738 amount of time instead of doing blocking. Also, it would be good if739 only the last transaction that the privatizer waits for would do the740 wake-up.741 742 4.3.6 Progress guarantees743 -------------------------744 745 Transactions that do not make progress when using the current TM method746 will eventually try to execute in serial mode. Thus, the serial lock's747 progress guarantees determine the progress guarantees of the whole TM.748 Obviously, we at least need deadlock-freedom for the serial lock, but it749 would also be good to provide starvation-freedom (informally, all750 threads will finish executing a transaction eventually iff they get751 enough cycles).752 753 However, the scheduling of transactions (e.g., thread scheduling by754 the OS) also affects the handling of progress guarantees by the TM.755 First, the TM can only guarantee deadlock-freedom if threads do not get756 stopped. Likewise, low-priority threads can starve if they do not get757 scheduled when other high-priority threads get those cycles instead.758 759 If all threads get scheduled eventually, correct lock implementations760 will provide deadlock-freedom, but might not provide starvation-freedom.761 We can either enforce the latter in the TM's lock implementation, or762 assume that the scheduling is sufficiently random to yield a763 probabilistic guarantee that no thread will starve (because eventually,764 a transaction will encounter a scheduling that will allow it to run).765 This can indeed work well in practice but is not necessarily guaranteed766 to work (e.g., simple spin locks can be pretty efficient).767 768 Because enforcing stronger progress guarantees in the TM has a higher769 runtime overhead, we focus on deadlock-freedom right now and assume that770 the threads will get scheduled eventually by the OS (but don't consider771 threads with different priorities). We should support772 starvation-freedom for serial transactions in the future. Everything773 beyond that is highly related to proper contention management across all774 of the TM (including with TM method to choose), and is future work.775 776 *TODO* Handling thread priorities: We want to avoid priority777 inversion but it's unclear how often that actually matters in practice.778 Workloads that have threads with different priorities will likely also779 require lower latency or higher throughput for high-priority threads.780 Therefore, it probably makes not that much sense (except for eventual781 progress guarantees) to use priority inheritance until the TM has782 priority-aware contention management.783 784 785 File: libitm.info, Node: GNU Free Documentation License, Next: Index, Prev: Internals, Up: Top786 787 GNU Free Documentation License788 ******************************789 790 Version 1.3, 3 November 2008791 792 Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.793 <http://fsf.org/>794 795 Everyone is permitted to copy and distribute verbatim copies796 of this license document, but changing it is not allowed.797 798 0. PREAMBLE799 800 The purpose of this License is to make a manual, textbook, or other801 functional and useful document "free" in the sense of freedom: to802 assure everyone the effective freedom to copy and redistribute it,803 with or without modifying it, either commercially or804 noncommercially. Secondarily, this License preserves for the805 author and publisher a way to get credit for their work, while not806 being considered responsible for modifications made by others.807 808 This License is a kind of "copyleft", which means that derivative809 works of the document must themselves be free in the same sense.810 It complements the GNU General Public License, which is a copyleft811 license designed for free software.812 813 We have designed this License in order to use it for manuals for814 free software, because free software needs free documentation: a815 free program should come with manuals providing the same freedoms816 that the software does. But this License is not limited to817 software manuals; it can be used for any textual work, regardless818 of subject matter or whether it is published as a printed book. We819 recommend this License principally for works whose purpose is820 instruction or reference.821 822 1. APPLICABILITY AND DEFINITIONS823 824 This License applies to any manual or other work, in any medium,825 that contains a notice placed by the copyright holder saying it can826 be distributed under the terms of this License. Such a notice827 grants a world-wide, royalty-free license, unlimited in duration,828 to use that work under the conditions stated herein. The829 "Document", below, refers to any such manual or work. Any member830 of the public is a licensee, and is addressed as "you". You accept831 the license if you copy, modify or distribute the work in a way832 requiring permission under copyright law.833 834 A "Modified Version" of the Document means any work containing the835 Document or a portion of it, either copied verbatim, or with836 modifications and/or translated into another language.837 838 A "Secondary Section" is a named appendix or a front-matter section839 of the Document that deals exclusively with the relationship of the840 publishers or authors of the Document to the Document's overall841 subject (or to related matters) and contains nothing that could842 fall directly within that overall subject. (Thus, if the Document843 is in part a textbook of mathematics, a Secondary Section may not844 explain any mathematics.) The relationship could be a matter of845 historical connection with the subject or with related matters, or846 of legal, commercial, philosophical, ethical or political position847 regarding them.848 849 The "Invariant Sections" are certain Secondary Sections whose850 titles are designated, as being those of Invariant Sections, in the851 notice that says that the Document is released under this License.852 If a section does not fit the above definition of Secondary then it853 is not allowed to be designated as Invariant. The Document may854 contain zero Invariant Sections. If the Document does not identify855 any Invariant Sections then there are none.856 857 The "Cover Texts" are certain short passages of text that are858 listed, as Front-Cover Texts or Back-Cover Texts, in the notice859 that says that the Document is released under this License. A860 Front-Cover Text may be at most 5 words, and a Back-Cover Text may861 be at most 25 words.862 863 A "Transparent" copy of the Document means a machine-readable copy,864 represented in a format whose specification is available to the865 general public, that is suitable for revising the document866 straightforwardly with generic text editors or (for images composed867 of pixels) generic paint programs or (for drawings) some widely868 available drawing editor, and that is suitable for input to text869 formatters or for automatic translation to a variety of formats870 suitable for input to text formatters. A copy made in an otherwise871 Transparent file format whose markup, or absence of markup, has872 been arranged to thwart or discourage subsequent modification by873 readers is not Transparent. An image format is not Transparent if874 used for any substantial amount of text. A copy that is not875 "Transparent" is called "Opaque".876 877 Examples of suitable formats for Transparent copies include plain878 ASCII without markup, Texinfo input format, LaTeX input format,879 SGML or XML using a publicly available DTD, and standard-conforming880 simple HTML, PostScript or PDF designed for human modification.881 Examples of transparent image formats include PNG, XCF and JPG.882 Opaque formats include proprietary formats that can be read and883 edited only by proprietary word processors, SGML or XML for which884 the DTD and/or processing tools are not generally available, and885 the machine-generated HTML, PostScript or PDF produced by some word886 processors for output purposes only.887 888 The "Title Page" means, for a printed book, the title page itself,889 plus such following pages as are needed to hold, legibly, the890 material this License requires to appear in the title page. For891 works in formats which do not have any title page as such, "Title892 Page" means the text near the most prominent appearance of the893 work's title, preceding the beginning of the body of the text.894 895 The "publisher" means any person or entity that distributes copies896 of the Document to the public.897 898 A section "Entitled XYZ" means a named subunit of the Document899 whose title either is precisely XYZ or contains XYZ in parentheses900 following text that translates XYZ in another language. (Here XYZ901 stands for a specific section name mentioned below, such as902 "Acknowledgements", "Dedications", "Endorsements", or "History".)903 To "Preserve the Title" of such a section when you modify the904 Document means that it remains a section "Entitled XYZ" according905 to this definition.906 907 The Document may include Warranty Disclaimers next to the notice908 which states that this License applies to the Document. These909 Warranty Disclaimers are considered to be included by reference in910 this License, but only as regards disclaiming warranties: any other911 implication that these Warranty Disclaimers may have is void and912 has no effect on the meaning of this License.913 914 2. VERBATIM COPYING915 916 You may copy and distribute the Document in any medium, either917 commercially or noncommercially, provided that this License, the918 copyright notices, and the license notice saying this License919 applies to the Document are reproduced in all copies, and that you920 add no other conditions whatsoever to those of this License. You921 may not use technical measures to obstruct or control the reading922 or further copying of the copies you make or distribute. However,923 you may accept compensation in exchange for copies. If you924 distribute a large enough number of copies you must also follow the925 conditions in section 3.926 927 You may also lend copies, under the same conditions stated above,928 and you may publicly display copies.929 930 3. COPYING IN QUANTITY931 932 If you publish printed copies (or copies in media that commonly933 have printed covers) of the Document, numbering more than 100, and934 the Document's license notice requires Cover Texts, you must935 enclose the copies in covers that carry, clearly and legibly, all936 these Cover Texts: Front-Cover Texts on the front cover, and937 Back-Cover Texts on the back cover. Both covers must also clearly938 and legibly identify you as the publisher of these copies. The939 front cover must present the full title with all words of the title940 equally prominent and visible. You may add other material on the941 covers in addition. Copying with changes limited to the covers, as942 long as they preserve the title of the Document and satisfy these943 conditions, can be treated as verbatim copying in other respects.944 945 If the required texts for either cover are too voluminous to fit946 legibly, you should put the first ones listed (as many as fit947 reasonably) on the actual cover, and continue the rest onto948 adjacent pages.949 950 If you publish or distribute Opaque copies of the Document951 numbering more than 100, you must either include a machine-readable952 Transparent copy along with each Opaque copy, or state in or with953 each Opaque copy a computer-network location from which the general954 network-using public has access to download using public-standard955 network protocols a complete Transparent copy of the Document, free956 of added material. If you use the latter option, you must take957 reasonably prudent steps, when you begin distribution of Opaque958 copies in quantity, to ensure that this Transparent copy will959 remain thus accessible at the stated location until at least one960 year after the last time you distribute an Opaque copy (directly or961 through your agents or retailers) of that edition to the public.962 963 It is requested, but not required, that you contact the authors of964 the Document well before redistributing any large number of copies,965 to give them a chance to provide you with an updated version of the966 Document.967 968 4. MODIFICATIONS969 970 You may copy and distribute a Modified Version of the Document971 under the conditions of sections 2 and 3 above, provided that you972 release the Modified Version under precisely this License, with the973 Modified Version filling the role of the Document, thus licensing974 distribution and modification of the Modified Version to whoever975 possesses a copy of it. In addition, you must do these things in976 the Modified Version:977 978 A. Use in the Title Page (and on the covers, if any) a title979 distinct from that of the Document, and from those of previous980 versions (which should, if there were any, be listed in the981 History section of the Document). You may use the same title982 as a previous version if the original publisher of that983 version gives permission.984 985 B. List on the Title Page, as authors, one or more persons or986 entities responsible for authorship of the modifications in987 the Modified Version, together with at least five of the988 principal authors of the Document (all of its principal989 authors, if it has fewer than five), unless they release you990 from this requirement.991 992 C. State on the Title page the name of the publisher of the993 Modified Version, as the publisher.994 995 D. Preserve all the copyright notices of the Document.996 997 E. Add an appropriate copyright notice for your modifications998 adjacent to the other copyright notices.999 1000 F. Include, immediately after the copyright notices, a license1001 notice giving the public permission to use the Modified1002 Version under the terms of this License, in the form shown in1003 the Addendum below.1004 1005 G. Preserve in that license notice the full lists of Invariant1006 Sections and required Cover Texts given in the Document's1007 license notice.1008 1009 H. Include an unaltered copy of this License.1010 1011 I. Preserve the section Entitled "History", Preserve its Title,1012 and add to it an item stating at least the title, year, new1013 authors, and publisher of the Modified Version as given on the1014 Title Page. If there is no section Entitled "History" in the1015 Document, create one stating the title, year, authors, and1016 publisher of the Document as given on its Title Page, then add1017 an item describing the Modified Version as stated in the1018 previous sentence.1019 1020 J. Preserve the network location, if any, given in the Document1021 for public access to a Transparent copy of the Document, and1022 likewise the network locations given in the Document for1023 previous versions it was based on. These may be placed in the1024 "History" section. You may omit a network location for a work1025 that was published at least four years before the Document1026 itself, or if the original publisher of the version it refers1027 to gives permission.1028 1029 K. For any section Entitled "Acknowledgements" or "Dedications",1030 Preserve the Title of the section, and preserve in the section1031 all the substance and tone of each of the contributor1032 acknowledgements and/or dedications given therein.1033 1034 L. Preserve all the Invariant Sections of the Document, unaltered1035 in their text and in their titles. Section numbers or the1036 equivalent are not considered part of the section titles.1037 1038 M. Delete any section Entitled "Endorsements". Such a section1039 may not be included in the Modified Version.1040 1041 N. Do not retitle any existing section to be Entitled1042 "Endorsements" or to conflict in title with any Invariant1043 Section.1044 1045 O. Preserve any Warranty Disclaimers.1046 1047 If the Modified Version includes new front-matter sections or1048 appendices that qualify as Secondary Sections and contain no1049 material copied from the Document, you may at your option designate1050 some or all of these sections as invariant. To do this, add their1051 titles to the list of Invariant Sections in the Modified Version's1052 license notice. These titles must be distinct from any other1053 section titles.1054 1055 You may add a section Entitled "Endorsements", provided it contains1056 nothing but endorsements of your Modified Version by various1057 parties--for example, statements of peer review or that the text1058 has been approved by an organization as the authoritative1059 definition of a standard.1060 1061 You may add a passage of up to five words as a Front-Cover Text,1062 and a passage of up to 25 words as a Back-Cover Text, to the end of1063 the list of Cover Texts in the Modified Version. Only one passage1064 of Front-Cover Text and one of Back-Cover Text may be added by (or1065 through arrangements made by) any one entity. If the Document1066 already includes a cover text for the same cover, previously added1067 by you or by arrangement made by the same entity you are acting on1068 behalf of, you may not add another; but you may replace the old1069 one, on explicit permission from the previous publisher that added1070 the old one.1071 1072 The author(s) and publisher(s) of the Document do not by this1073 License give permission to use their names for publicity for or to1074 assert or imply endorsement of any Modified Version.1075 1076 5. COMBINING DOCUMENTS1077 1078 You may combine the Document with other documents released under1079 this License, under the terms defined in section 4 above for1080 modified versions, provided that you include in the combination all1081 of the Invariant Sections of all of the original documents,1082 unmodified, and list them all as Invariant Sections of your1083 combined work in its license notice, and that you preserve all1084 their Warranty Disclaimers.1085 1086 The combined work need only contain one copy of this License, and1087 multiple identical Invariant Sections may be replaced with a single1088 copy. If there are multiple Invariant Sections with the same name1089 but different contents, make the title of each such section unique1090 by adding at the end of it, in parentheses, the name of the1091 original author or publisher of that section if known, or else a1092 unique number. Make the same adjustment to the section titles in1093 the list of Invariant Sections in the license notice of the1094 combined work.1095 1096 In the combination, you must combine any sections Entitled1097 "History" in the various original documents, forming one section1098 Entitled "History"; likewise combine any sections Entitled1099 "Acknowledgements", and any sections Entitled "Dedications". You1100 must delete all sections Entitled "Endorsements."1101 1102 6. COLLECTIONS OF DOCUMENTS1103 1104 You may make a collection consisting of the Document and other1105 documents released under this License, and replace the individual1106 copies of this License in the various documents with a single copy1107 that is included in the collection, provided that you follow the1108 rules of this License for verbatim copying of each of the documents1109 in all other respects.1110 1111 You may extract a single document from such a collection, and1112 distribute it individually under this License, provided you insert1113 a copy of this License into the extracted document, and follow this1114 License in all other respects regarding verbatim copying of that1115 document.1116 1117 7. AGGREGATION WITH INDEPENDENT WORKS1118 1119 A compilation of the Document or its derivatives with other1120 separate and independent documents or works, in or on a volume of a1121 storage or distribution medium, is called an "aggregate" if the1122 copyright resulting from the compilation is not used to limit the1123 legal rights of the compilation's users beyond what the individual1124 works permit. When the Document is included in an aggregate, this1125 License does not apply to the other works in the aggregate which1126 are not themselves derivative works of the Document.1127 1128 If the Cover Text requirement of section 3 is applicable to these1129 copies of the Document, then if the Document is less than one half1130 of the entire aggregate, the Document's Cover Texts may be placed1131 on covers that bracket the Document within the aggregate, or the1132 electronic equivalent of covers if the Document is in electronic1133 form. Otherwise they must appear on printed covers that bracket1134 the whole aggregate.1135 1136 8. TRANSLATION1137 1138 Translation is considered a kind of modification, so you may1139 distribute translations of the Document under the terms of section1140 4. Replacing Invariant Sections with translations requires special1141 permission from their copyright holders, but you may include1142 translations of some or all Invariant Sections in addition to the1143 original versions of these Invariant Sections. You may include a1144 translation of this License, and all the license notices in the1145 Document, and any Warranty Disclaimers, provided that you also1146 include the original English version of this License and the1147 original versions of those notices and disclaimers. In case of a1148 disagreement between the translation and the original version of1149 this License or a notice or disclaimer, the original version will1150 prevail.1151 1152 If a section in the Document is Entitled "Acknowledgements",1153 "Dedications", or "History", the requirement (section 4) to1154 Preserve its Title (section 1) will typically require changing the1155 actual title.1156 1157 9. TERMINATION1158 1159 You may not copy, modify, sublicense, or distribute the Document1160 except as expressly provided under this License. Any attempt1161 otherwise to copy, modify, sublicense, or distribute it is void,1162 and will automatically terminate your rights under this License.1163 1164 However, if you cease all violation of this License, then your1165 license from a particular copyright holder is reinstated (a)1166 provisionally, unless and until the copyright holder explicitly and1167 finally terminates your license, and (b) permanently, if the1168 copyright holder fails to notify you of the violation by some1169 reasonable means prior to 60 days after the cessation.1170 1171 Moreover, your license from a particular copyright holder is1172 reinstated permanently if the copyright holder notifies you of the1173 violation by some reasonable means, this is the first time you have1174 received notice of violation of this License (for any work) from1175 that copyright holder, and you cure the violation prior to 30 days1176 after your receipt of the notice.1177 1178 Termination of your rights under this section does not terminate1179 the licenses of parties who have received copies or rights from you1180 under this License. If your rights have been terminated and not1181 permanently reinstated, receipt of a copy of some or all of the1182 same material does not give you any rights to use it.1183 1184 10. FUTURE REVISIONS OF THIS LICENSE1185 1186 The Free Software Foundation may publish new, revised versions of1187 the GNU Free Documentation License from time to time. Such new1188 versions will be similar in spirit to the present version, but may1189 differ in detail to address new problems or concerns. See1190 <http://www.gnu.org/copyleft/>.1191 1192 Each version of the License is given a distinguishing version1193 number. If the Document specifies that a particular numbered1194 version of this License "or any later version" applies to it, you1195 have the option of following the terms and conditions either of1196 that specified version or of any later version that has been1197 published (not as a draft) by the Free Software Foundation. If the1198 Document does not specify a version number of this License, you may1199 choose any version ever published (not as a draft) by the Free1200 Software Foundation. If the Document specifies that a proxy can1201 decide which future versions of this License can be used, that1202 proxy's public statement of acceptance of a version permanently1203 authorizes you to choose that version for the Document.1204 1205 11. RELICENSING1206 1207 "Massive Multiauthor Collaboration Site" (or "MMC Site") means any1208 World Wide Web server that publishes copyrightable works and also1209 provides prominent facilities for anybody to edit those works. A1210 public wiki that anybody can edit is an example of such a server.1211 A "Massive Multiauthor Collaboration" (or "MMC") contained in the1212 site means any set of copyrightable works thus published on the MMC1213 site.1214 1215 "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.01216 license published by Creative Commons Corporation, a not-for-profit1217 corporation with a principal place of business in San Francisco,1218 California, as well as future copyleft versions of that license1219 published by that same organization.1220 1221 "Incorporate" means to publish or republish a Document, in whole or1222 in part, as part of another Document.1223 1224 An MMC is "eligible for relicensing" if it is licensed under this1225 License, and if all works that were first published under this1226 License somewhere other than this MMC, and subsequently1227 incorporated in whole or in part into the MMC, (1) had no cover1228 texts or invariant sections, and (2) were thus incorporated prior1229 to November 1, 2008.1230 1231 The operator of an MMC Site may republish an MMC contained in the1232 site under CC-BY-SA on the same site at any time before August 1,1233 2009, provided the MMC is eligible for relicensing.1234 1235 ADDENDUM: How to use this License for your documents1236 ====================================================1237 1238 To use this License in a document you have written, include a copy of1239 the License in the document and put the following copyright and license1240 notices just after the title page:1241 1242 Copyright (C) YEAR YOUR NAME.1243 Permission is granted to copy, distribute and/or modify this document1244 under the terms of the GNU Free Documentation License, Version 1.31245 or any later version published by the Free Software Foundation;1246 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover1247 Texts. A copy of the license is included in the section entitled ``GNU1248 Free Documentation License''.1249 1250 If you have Invariant Sections, Front-Cover Texts and Back-Cover1251 Texts, replace the "with...Texts." line with this:1252 1253 with the Invariant Sections being LIST THEIR TITLES, with1254 the Front-Cover Texts being LIST, and with the Back-Cover Texts1255 being LIST.1256 1257 If you have Invariant Sections without Cover Texts, or some other1258 combination of the three, merge those two alternatives to suit the1259 situation.1260 1261 If your document contains nontrivial examples of program code, we1262 recommend releasing these examples in parallel under your choice of free1263 software license, such as the GNU General Public License, to permit1264 their use in free software.1265 1266 1267 File: libitm.info, Node: Index, Prev: GNU Free Documentation License, Up: Top1268 1269 Index1270 *****1271 1272 [index]1273 * Menu:1274 1275 * FDL, GNU Free Documentation License: GNU Free Documentation License.1276 (line 6)1277 * Introduction: Top. (line 6)1278 1279 1280 1281 Tag Table:1282 Node: Top11411283 Node: Enabling libitm20451284 Node: C/C++ Language Constructs for TM24401285 Node: The libitm ABI39231286 Ref: txn-code-properties77211287 Node: Internals180261288 Ref: serial-lock-impl280641289 Ref: progress-guarantees328251290 Node: GNU Free Documentation License351031291 Node: Index602241292 1293 End Tag Table -
libquadmath/libquadmath.info
diff -Naur gcc-4.8.2.orig/libquadmath/libquadmath.info gcc-4.8.2/libquadmath/libquadmath.info
old new 1 This is libquadmath.info, produced by makeinfo version 5.1 from2 libquadmath.texi.3 4 Copyright (C) 2010-2013 Free Software Foundation, Inc.5 6 Permission is granted to copy, distribute and/or modify this7 document under the terms of the GNU Free Documentation License,8 Version 1.2 or any later version published by the Free Software9 Foundation; with no Invariant Sections, with the Front-Cover Texts10 being "A GNU Manual," and with the Back-Cover Texts as in (a)11 below. A copy of the license is included in the section entitled12 "GNU Free Documentation License."13 14 (a) The FSF's Back-Cover Text is: "You have the freedom to copy and15 modify this GNU manual.16 INFO-DIR-SECTION GNU Libraries17 START-INFO-DIR-ENTRY18 * libquadmath: (libquadmath). GCC Quad-Precision Math Library19 END-INFO-DIR-ENTRY20 21 This manual documents the GCC Quad-Precision Math Library API.22 23 Published by the Free Software Foundation 51 Franklin Street, Fifth24 Floor Boston, MA 02110-1301 USA25 26 Copyright (C) 2010-2013 Free Software Foundation, Inc.27 28 Permission is granted to copy, distribute and/or modify this29 document under the terms of the GNU Free Documentation License,30 Version 1.2 or any later version published by the Free Software31 Foundation; with no Invariant Sections, with the Front-Cover Texts32 being "A GNU Manual," and with the Back-Cover Texts as in (a)33 below. A copy of the license is included in the section entitled34 "GNU Free Documentation License."35 36 (a) The FSF's Back-Cover Text is: "You have the freedom to copy and37 modify this GNU manual.38 39 40 File: libquadmath.info, Node: Top, Next: Typedef and constants, Up: (dir)41 42 Introduction43 ************44 45 This manual documents the usage of libquadmath, the GCC Quad-Precision46 Math Library Application Programming Interface (API).47 48 * Menu:49 50 * Typedef and constants:: Defined data types and constants51 * Math Library Routines:: The Libquadmath math runtime application52 programming interface.53 * I/O Library Routines:: The Libquadmath I/O runtime application54 programming interface.55 * GNU Free Documentation License::56 How you can copy and share this manual.57 * Reporting Bugs:: How to report bugs in GCC Libquadmath.58 59 60 File: libquadmath.info, Node: Typedef and constants, Next: Math Library Routines, Prev: Top, Up: Top61 62 1 Typedef and constants63 ***********************64 65 The following data type has been defined via 'typedef'.66 67 '__complex128': '__float128'-based complex number68 69 The following macros are defined, which give the numeric limits of70 the '__float128' data type.71 72 'FLT128_MAX': largest finite number73 'FLT128_MIN': smallest positive number with full precision74 'FLT128_EPSILON': difference between 1 and the next larger75 representable number76 'FLT128_DENORM_MIN': smallest positive denormalized number77 'FLT128_MANT_DIG': number of digits in the mantissa (bit precision)78 'FLT128_MIN_EXP': maximal negative exponent79 'FLT128_MAX_EXP': maximal positive exponent80 'FLT128_DIG': number of decimal digits in the mantissa81 'FLT128_MIN_10_EXP': maximal negative decimal exponent82 'FLT128_MAX_10_EXP': maximal positive decimal exponent83 84 The following mathematical constants of type '__float128' are85 defined.86 87 'M_Eq': the constant e (Euler's number)88 'M_LOG2Eq': binary logarithm of 289 'M_LOG10Eq': common, decimal logarithm of 290 'M_LN2q': natural logarithm of 291 'M_LN10q': natural logarithm of 1092 'M_PIq': pi93 'M_PI_2q': pi divided by two94 'M_PI_4q': pi divided by four95 'M_1_PIq': one over pi96 'M_2_PIq': one over two pi97 'M_2_SQRTPIq': two over square root of pi98 'M_SQRT2q': square root of 299 'M_SQRT1_2q': one over square root of 2100 101 102 File: libquadmath.info, Node: Math Library Routines, Next: I/O Library Routines, Prev: Typedef and constants, Up: Top103 104 2 Math Library Routines105 ***********************106 107 The following mathematical functions are available:108 109 'acosq': arc cosine function110 'acoshq': inverse hyperbolic cosine function111 'asinq': arc sine function112 'asinhq': inverse hyperbolic sine function113 'atanq': arc tangent function114 'atanhq': inverse hyperbolic tangent function115 'atan2q': arc tangent function116 'cbrtq': cube root function117 'ceilq': ceiling value function118 'copysignq': copy sign of a number119 'coshq': hyperbolic cosine function120 'cosq': cosine function121 'erfq': error function122 'erfcq': complementary error function123 'expq': exponential function124 'expm1q': exponential minus 1 function125 'fabsq': absolute value function126 'fdimq': positive difference function127 'finiteq': check finiteness of value128 'floorq': floor value function129 'fmaq': fused multiply and add130 'fmaxq': determine maximum of two values131 'fminq': determine minimum of two values132 'fmodq': remainder value function133 'frexpq': extract mantissa and exponent134 'hypotq': Eucledian distance function135 'ilogbq': get exponent of the value136 'isinfq': check for infinity137 'isnanq': check for not a number138 'j0q': Bessel function of the first kind, first order139 'j1q': Bessel function of the first kind, second order140 'jnq': Bessel function of the first kind, N-th order141 'ldexpq': load exponent of the value142 'lgammaq': logarithmic gamma function143 'llrintq': round to nearest integer value144 'llroundq': round to nearest integer value away from zero145 'logq': natural logarithm function146 'log10q': base 10 logarithm function147 'log1pq': compute natural logarithm of the value plus one148 'log2q': base 2 logarithm function149 'lrintq': round to nearest integer value150 'lroundq': round to nearest integer value away from zero151 'modfq': decompose the floating-point number152 'nanq': return quiet NaN153 'nearbyintq': round to nearest integer154 'nextafterq': next representable floating-point number155 'powq': power function156 'remainderq': remainder function157 'remquoq': remainder and part of quotient158 'rintq': round-to-nearest integral value159 'roundq': round-to-nearest integral value, return '__float128'160 'scalblnq': compute exponent using 'FLT_RADIX'161 'scalbnq': compute exponent using 'FLT_RADIX'162 'signbitq': return sign bit163 'sincosq': calculate sine and cosine simulataneously164 'sinhq': hyperbolic sine function165 'sinq': sine function166 'sqrtq': square root function167 'tanq': tangent function168 'tanhq': hyperbolic tangent function169 'tgammaq': true gamma function170 'truncq': round to integer, towards zero171 'y0q': Bessel function of the second kind, first order172 'y1q': Bessel function of the second kind, second order173 'ynq': Bessel function of the second kind, N-th order174 'cabsq' complex absolute value function175 'cargq': calculate the argument176 'cimagq' imaginary part of complex number177 'crealq': real part of complex number178 'cacoshq': complex arc hyperbolic cosine function179 'cacosq': complex arc cosine function180 'casinhq': complex arc hyperbolic sine function181 'casinq': complex arc sine function182 'catanhq': complex arc hyperbolic tangent function183 'catanq': complex arc tangent function184 'ccosq' complex cosine function:185 'ccoshq': complex hyperbolic cosine function186 'cexpq': complex exponential function187 'cexpiq': computes the exponential function of "i" times a188 real value189 'clogq': complex natural logarithm190 'clog10q': complex base 10 logarithm191 'conjq': complex conjugate function192 'cpowq': complex power function193 'cprojq': project into Riemann Sphere194 'csinq': complex sine function195 'csinhq': complex hyperbolic sine function196 'csqrtq': complex square root197 'ctanq': complex tangent function198 'ctanhq': complex hyperbolic tangent function199 200 201 File: libquadmath.info, Node: I/O Library Routines, Next: GNU Free Documentation License, Prev: Math Library Routines, Up: Top202 203 3 I/O Library Routines204 **********************205 206 * Menu:207 208 * 'strtoflt128': strtoflt128, Convert from string209 * 'quadmath_snprintf': quadmath_snprintf, Convert to string210 211 212 File: libquadmath.info, Node: strtoflt128, Next: quadmath_snprintf, Up: I/O Library Routines213 214 3.1 'strtoflt128' -- Convert from string215 ========================================216 217 The function 'strtoflt128' converts a string into a '__float128' number.218 219 Syntax220 '__float128 strtoflt128 (const char *s, char **sp)'221 222 _Arguments_:223 S input string224 SP the address of the next character in the string225 226 The argument SP contains, if not 'NULL', the address of the next227 character following the parts of the string, which have been read.228 229 Example230 #include <quadmath.h>231 232 int main ()233 {234 __float128 r;235 236 r = strtoflt128 ("1.2345678", NULL);237 238 return 0;239 }240 241 242 File: libquadmath.info, Node: quadmath_snprintf, Prev: strtoflt128, Up: I/O Library Routines243 244 3.2 'quadmath_snprintf' -- Convert to string245 ============================================246 247 The function 'quadmath_snprintf' converts a '__float128' floating-point248 number into a string. It is a specialized alternative to 'snprintf',249 where the format string is restricted to a single conversion specifier250 with 'Q' modifier and conversion specifier 'e', 'E', 'f', 'F', 'g', 'G',251 'a' or 'A', with no extra characters before or after the conversion252 specifier. The '%m$' or '*m$' style must not be used in the format.253 254 Syntax255 'int quadmath_snprintf (char *s, size_t size, const char *format,256 ...)'257 258 _Arguments_:259 S output string260 SIZE byte size of the string, including tailing NUL261 FORMAT conversion specifier string262 263 Note264 On some targets when supported by the C library hooks are installed265 for 'printf' family of functions, so that 'printf ("%Qe", 1.2Q);'266 etc. works too.267 268 Example269 #include <quadmath.h>270 #include <stdlib.h>271 #include <stdio.h>272 273 int main ()274 {275 __float128 r;276 int prec = 20;277 int width = 46;278 char buf[128];279 280 r = 2.0q;281 r = sqrtq (r);282 int n = quadmath_snprintf (buf, sizeof buf, "%+-#*.20Qe", width, r);283 if ((size_t) n < sizeof buf)284 printf ("%s\n", buf);285 /* Prints: +1.41421356237309504880e+00 */286 quadmath_snprintf (buf, sizeof buf, "%Qa", r);287 if ((size_t) n < sizeof buf)288 printf ("%s\n", buf);289 /* Prints: 0x1.6a09e667f3bcc908b2fb1366ea96p+0 */290 n = quadmath_snprintf (NULL, 0, "%+-#46.*Qe", prec, r);291 if (n > -1)292 {293 char *str = malloc (n + 1);294 if (str)295 {296 quadmath_snprintf (str, n + 1, "%+-#46.*Qe", prec, r);297 printf ("%s\n", str);298 /* Prints: +1.41421356237309504880e+00 */299 }300 free (str);301 }302 return 0;303 }304 305 306 File: libquadmath.info, Node: GNU Free Documentation License, Next: Reporting Bugs, Prev: I/O Library Routines, Up: Top307 308 GNU Free Documentation License309 ******************************310 311 Version 1.3, 3 November 2008312 313 Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.314 <http://fsf.org/>315 316 Everyone is permitted to copy and distribute verbatim copies317 of this license document, but changing it is not allowed.318 319 0. PREAMBLE320 321 The purpose of this License is to make a manual, textbook, or other322 functional and useful document "free" in the sense of freedom: to323 assure everyone the effective freedom to copy and redistribute it,324 with or without modifying it, either commercially or325 noncommercially. Secondarily, this License preserves for the326 author and publisher a way to get credit for their work, while not327 being considered responsible for modifications made by others.328 329 This License is a kind of "copyleft", which means that derivative330 works of the document must themselves be free in the same sense.331 It complements the GNU General Public License, which is a copyleft332 license designed for free software.333 334 We have designed this License in order to use it for manuals for335 free software, because free software needs free documentation: a336 free program should come with manuals providing the same freedoms337 that the software does. But this License is not limited to338 software manuals; it can be used for any textual work, regardless339 of subject matter or whether it is published as a printed book. We340 recommend this License principally for works whose purpose is341 instruction or reference.342 343 1. APPLICABILITY AND DEFINITIONS344 345 This License applies to any manual or other work, in any medium,346 that contains a notice placed by the copyright holder saying it can347 be distributed under the terms of this License. Such a notice348 grants a world-wide, royalty-free license, unlimited in duration,349 to use that work under the conditions stated herein. The350 "Document", below, refers to any such manual or work. Any member351 of the public is a licensee, and is addressed as "you". You accept352 the license if you copy, modify or distribute the work in a way353 requiring permission under copyright law.354 355 A "Modified Version" of the Document means any work containing the356 Document or a portion of it, either copied verbatim, or with357 modifications and/or translated into another language.358 359 A "Secondary Section" is a named appendix or a front-matter section360 of the Document that deals exclusively with the relationship of the361 publishers or authors of the Document to the Document's overall362 subject (or to related matters) and contains nothing that could363 fall directly within that overall subject. (Thus, if the Document364 is in part a textbook of mathematics, a Secondary Section may not365 explain any mathematics.) The relationship could be a matter of366 historical connection with the subject or with related matters, or367 of legal, commercial, philosophical, ethical or political position368 regarding them.369 370 The "Invariant Sections" are certain Secondary Sections whose371 titles are designated, as being those of Invariant Sections, in the372 notice that says that the Document is released under this License.373 If a section does not fit the above definition of Secondary then it374 is not allowed to be designated as Invariant. The Document may375 contain zero Invariant Sections. If the Document does not identify376 any Invariant Sections then there are none.377 378 The "Cover Texts" are certain short passages of text that are379 listed, as Front-Cover Texts or Back-Cover Texts, in the notice380 that says that the Document is released under this License. A381 Front-Cover Text may be at most 5 words, and a Back-Cover Text may382 be at most 25 words.383 384 A "Transparent" copy of the Document means a machine-readable copy,385 represented in a format whose specification is available to the386 general public, that is suitable for revising the document387 straightforwardly with generic text editors or (for images composed388 of pixels) generic paint programs or (for drawings) some widely389 available drawing editor, and that is suitable for input to text390 formatters or for automatic translation to a variety of formats391 suitable for input to text formatters. A copy made in an otherwise392 Transparent file format whose markup, or absence of markup, has393 been arranged to thwart or discourage subsequent modification by394 readers is not Transparent. An image format is not Transparent if395 used for any substantial amount of text. A copy that is not396 "Transparent" is called "Opaque".397 398 Examples of suitable formats for Transparent copies include plain399 ASCII without markup, Texinfo input format, LaTeX input format,400 SGML or XML using a publicly available DTD, and standard-conforming401 simple HTML, PostScript or PDF designed for human modification.402 Examples of transparent image formats include PNG, XCF and JPG.403 Opaque formats include proprietary formats that can be read and404 edited only by proprietary word processors, SGML or XML for which405 the DTD and/or processing tools are not generally available, and406 the machine-generated HTML, PostScript or PDF produced by some word407 processors for output purposes only.408 409 The "Title Page" means, for a printed book, the title page itself,410 plus such following pages as are needed to hold, legibly, the411 material this License requires to appear in the title page. For412 works in formats which do not have any title page as such, "Title413 Page" means the text near the most prominent appearance of the414 work's title, preceding the beginning of the body of the text.415 416 The "publisher" means any person or entity that distributes copies417 of the Document to the public.418 419 A section "Entitled XYZ" means a named subunit of the Document420 whose title either is precisely XYZ or contains XYZ in parentheses421 following text that translates XYZ in another language. (Here XYZ422 stands for a specific section name mentioned below, such as423 "Acknowledgements", "Dedications", "Endorsements", or "History".)424 To "Preserve the Title" of such a section when you modify the425 Document means that it remains a section "Entitled XYZ" according426 to this definition.427 428 The Document may include Warranty Disclaimers next to the notice429 which states that this License applies to the Document. These430 Warranty Disclaimers are considered to be included by reference in431 this License, but only as regards disclaiming warranties: any other432 implication that these Warranty Disclaimers may have is void and433 has no effect on the meaning of this License.434 435 2. VERBATIM COPYING436 437 You may copy and distribute the Document in any medium, either438 commercially or noncommercially, provided that this License, the439 copyright notices, and the license notice saying this License440 applies to the Document are reproduced in all copies, and that you441 add no other conditions whatsoever to those of this License. You442 may not use technical measures to obstruct or control the reading443 or further copying of the copies you make or distribute. However,444 you may accept compensation in exchange for copies. If you445 distribute a large enough number of copies you must also follow the446 conditions in section 3.447 448 You may also lend copies, under the same conditions stated above,449 and you may publicly display copies.450 451 3. COPYING IN QUANTITY452 453 If you publish printed copies (or copies in media that commonly454 have printed covers) of the Document, numbering more than 100, and455 the Document's license notice requires Cover Texts, you must456 enclose the copies in covers that carry, clearly and legibly, all457 these Cover Texts: Front-Cover Texts on the front cover, and458 Back-Cover Texts on the back cover. Both covers must also clearly459 and legibly identify you as the publisher of these copies. The460 front cover must present the full title with all words of the title461 equally prominent and visible. You may add other material on the462 covers in addition. Copying with changes limited to the covers, as463 long as they preserve the title of the Document and satisfy these464 conditions, can be treated as verbatim copying in other respects.465 466 If the required texts for either cover are too voluminous to fit467 legibly, you should put the first ones listed (as many as fit468 reasonably) on the actual cover, and continue the rest onto469 adjacent pages.470 471 If you publish or distribute Opaque copies of the Document472 numbering more than 100, you must either include a machine-readable473 Transparent copy along with each Opaque copy, or state in or with474 each Opaque copy a computer-network location from which the general475 network-using public has access to download using public-standard476 network protocols a complete Transparent copy of the Document, free477 of added material. If you use the latter option, you must take478 reasonably prudent steps, when you begin distribution of Opaque479 copies in quantity, to ensure that this Transparent copy will480 remain thus accessible at the stated location until at least one481 year after the last time you distribute an Opaque copy (directly or482 through your agents or retailers) of that edition to the public.483 484 It is requested, but not required, that you contact the authors of485 the Document well before redistributing any large number of copies,486 to give them a chance to provide you with an updated version of the487 Document.488 489 4. MODIFICATIONS490 491 You may copy and distribute a Modified Version of the Document492 under the conditions of sections 2 and 3 above, provided that you493 release the Modified Version under precisely this License, with the494 Modified Version filling the role of the Document, thus licensing495 distribution and modification of the Modified Version to whoever496 possesses a copy of it. In addition, you must do these things in497 the Modified Version:498 499 A. Use in the Title Page (and on the covers, if any) a title500 distinct from that of the Document, and from those of previous501 versions (which should, if there were any, be listed in the502 History section of the Document). You may use the same title503 as a previous version if the original publisher of that504 version gives permission.505 506 B. List on the Title Page, as authors, one or more persons or507 entities responsible for authorship of the modifications in508 the Modified Version, together with at least five of the509 principal authors of the Document (all of its principal510 authors, if it has fewer than five), unless they release you511 from this requirement.512 513 C. State on the Title page the name of the publisher of the514 Modified Version, as the publisher.515 516 D. Preserve all the copyright notices of the Document.517 518 E. Add an appropriate copyright notice for your modifications519 adjacent to the other copyright notices.520 521 F. Include, immediately after the copyright notices, a license522 notice giving the public permission to use the Modified523 Version under the terms of this License, in the form shown in524 the Addendum below.525 526 G. Preserve in that license notice the full lists of Invariant527 Sections and required Cover Texts given in the Document's528 license notice.529 530 H. Include an unaltered copy of this License.531 532 I. Preserve the section Entitled "History", Preserve its Title,533 and add to it an item stating at least the title, year, new534 authors, and publisher of the Modified Version as given on the535 Title Page. If there is no section Entitled "History" in the536 Document, create one stating the title, year, authors, and537 publisher of the Document as given on its Title Page, then add538 an item describing the Modified Version as stated in the539 previous sentence.540 541 J. Preserve the network location, if any, given in the Document542 for public access to a Transparent copy of the Document, and543 likewise the network locations given in the Document for544 previous versions it was based on. These may be placed in the545 "History" section. You may omit a network location for a work546 that was published at least four years before the Document547 itself, or if the original publisher of the version it refers548 to gives permission.549 550 K. For any section Entitled "Acknowledgements" or "Dedications",551 Preserve the Title of the section, and preserve in the section552 all the substance and tone of each of the contributor553 acknowledgements and/or dedications given therein.554 555 L. Preserve all the Invariant Sections of the Document, unaltered556 in their text and in their titles. Section numbers or the557 equivalent are not considered part of the section titles.558 559 M. Delete any section Entitled "Endorsements". Such a section560 may not be included in the Modified Version.561 562 N. Do not retitle any existing section to be Entitled563 "Endorsements" or to conflict in title with any Invariant564 Section.565 566 O. Preserve any Warranty Disclaimers.567 568 If the Modified Version includes new front-matter sections or569 appendices that qualify as Secondary Sections and contain no570 material copied from the Document, you may at your option designate571 some or all of these sections as invariant. To do this, add their572 titles to the list of Invariant Sections in the Modified Version's573 license notice. These titles must be distinct from any other574 section titles.575 576 You may add a section Entitled "Endorsements", provided it contains577 nothing but endorsements of your Modified Version by various578 parties--for example, statements of peer review or that the text579 has been approved by an organization as the authoritative580 definition of a standard.581 582 You may add a passage of up to five words as a Front-Cover Text,583 and a passage of up to 25 words as a Back-Cover Text, to the end of584 the list of Cover Texts in the Modified Version. Only one passage585 of Front-Cover Text and one of Back-Cover Text may be added by (or586 through arrangements made by) any one entity. If the Document587 already includes a cover text for the same cover, previously added588 by you or by arrangement made by the same entity you are acting on589 behalf of, you may not add another; but you may replace the old590 one, on explicit permission from the previous publisher that added591 the old one.592 593 The author(s) and publisher(s) of the Document do not by this594 License give permission to use their names for publicity for or to595 assert or imply endorsement of any Modified Version.596 597 5. COMBINING DOCUMENTS598 599 You may combine the Document with other documents released under600 this License, under the terms defined in section 4 above for601 modified versions, provided that you include in the combination all602 of the Invariant Sections of all of the original documents,603 unmodified, and list them all as Invariant Sections of your604 combined work in its license notice, and that you preserve all605 their Warranty Disclaimers.606 607 The combined work need only contain one copy of this License, and608 multiple identical Invariant Sections may be replaced with a single609 copy. If there are multiple Invariant Sections with the same name610 but different contents, make the title of each such section unique611 by adding at the end of it, in parentheses, the name of the612 original author or publisher of that section if known, or else a613 unique number. Make the same adjustment to the section titles in614 the list of Invariant Sections in the license notice of the615 combined work.616 617 In the combination, you must combine any sections Entitled618 "History" in the various original documents, forming one section619 Entitled "History"; likewise combine any sections Entitled620 "Acknowledgements", and any sections Entitled "Dedications". You621 must delete all sections Entitled "Endorsements."622 623 6. COLLECTIONS OF DOCUMENTS624 625 You may make a collection consisting of the Document and other626 documents released under this License, and replace the individual627 copies of this License in the various documents with a single copy628 that is included in the collection, provided that you follow the629 rules of this License for verbatim copying of each of the documents630 in all other respects.631 632 You may extract a single document from such a collection, and633 distribute it individually under this License, provided you insert634 a copy of this License into the extracted document, and follow this635 License in all other respects regarding verbatim copying of that636 document.637 638 7. AGGREGATION WITH INDEPENDENT WORKS639 640 A compilation of the Document or its derivatives with other641 separate and independent documents or works, in or on a volume of a642 storage or distribution medium, is called an "aggregate" if the643 copyright resulting from the compilation is not used to limit the644 legal rights of the compilation's users beyond what the individual645 works permit. When the Document is included in an aggregate, this646 License does not apply to the other works in the aggregate which647 are not themselves derivative works of the Document.648 649 If the Cover Text requirement of section 3 is applicable to these650 copies of the Document, then if the Document is less than one half651 of the entire aggregate, the Document's Cover Texts may be placed652 on covers that bracket the Document within the aggregate, or the653 electronic equivalent of covers if the Document is in electronic654 form. Otherwise they must appear on printed covers that bracket655 the whole aggregate.656 657 8. TRANSLATION658 659 Translation is considered a kind of modification, so you may660 distribute translations of the Document under the terms of section661 4. Replacing Invariant Sections with translations requires special662 permission from their copyright holders, but you may include663 translations of some or all Invariant Sections in addition to the664 original versions of these Invariant Sections. You may include a665 translation of this License, and all the license notices in the666 Document, and any Warranty Disclaimers, provided that you also667 include the original English version of this License and the668 original versions of those notices and disclaimers. In case of a669 disagreement between the translation and the original version of670 this License or a notice or disclaimer, the original version will671 prevail.672 673 If a section in the Document is Entitled "Acknowledgements",674 "Dedications", or "History", the requirement (section 4) to675 Preserve its Title (section 1) will typically require changing the676 actual title.677 678 9. TERMINATION679 680 You may not copy, modify, sublicense, or distribute the Document681 except as expressly provided under this License. Any attempt682 otherwise to copy, modify, sublicense, or distribute it is void,683 and will automatically terminate your rights under this License.684 685 However, if you cease all violation of this License, then your686 license from a particular copyright holder is reinstated (a)687 provisionally, unless and until the copyright holder explicitly and688 finally terminates your license, and (b) permanently, if the689 copyright holder fails to notify you of the violation by some690 reasonable means prior to 60 days after the cessation.691 692 Moreover, your license from a particular copyright holder is693 reinstated permanently if the copyright holder notifies you of the694 violation by some reasonable means, this is the first time you have695 received notice of violation of this License (for any work) from696 that copyright holder, and you cure the violation prior to 30 days697 after your receipt of the notice.698 699 Termination of your rights under this section does not terminate700 the licenses of parties who have received copies or rights from you701 under this License. If your rights have been terminated and not702 permanently reinstated, receipt of a copy of some or all of the703 same material does not give you any rights to use it.704 705 10. FUTURE REVISIONS OF THIS LICENSE706 707 The Free Software Foundation may publish new, revised versions of708 the GNU Free Documentation License from time to time. Such new709 versions will be similar in spirit to the present version, but may710 differ in detail to address new problems or concerns. See711 <http://www.gnu.org/copyleft/>.712 713 Each version of the License is given a distinguishing version714 number. If the Document specifies that a particular numbered715 version of this License "or any later version" applies to it, you716 have the option of following the terms and conditions either of717 that specified version or of any later version that has been718 published (not as a draft) by the Free Software Foundation. If the719 Document does not specify a version number of this License, you may720 choose any version ever published (not as a draft) by the Free721 Software Foundation. If the Document specifies that a proxy can722 decide which future versions of this License can be used, that723 proxy's public statement of acceptance of a version permanently724 authorizes you to choose that version for the Document.725 726 11. RELICENSING727 728 "Massive Multiauthor Collaboration Site" (or "MMC Site") means any729 World Wide Web server that publishes copyrightable works and also730 provides prominent facilities for anybody to edit those works. A731 public wiki that anybody can edit is an example of such a server.732 A "Massive Multiauthor Collaboration" (or "MMC") contained in the733 site means any set of copyrightable works thus published on the MMC734 site.735 736 "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0737 license published by Creative Commons Corporation, a not-for-profit738 corporation with a principal place of business in San Francisco,739 California, as well as future copyleft versions of that license740 published by that same organization.741 742 "Incorporate" means to publish or republish a Document, in whole or743 in part, as part of another Document.744 745 An MMC is "eligible for relicensing" if it is licensed under this746 License, and if all works that were first published under this747 License somewhere other than this MMC, and subsequently748 incorporated in whole or in part into the MMC, (1) had no cover749 texts or invariant sections, and (2) were thus incorporated prior750 to November 1, 2008.751 752 The operator of an MMC Site may republish an MMC contained in the753 site under CC-BY-SA on the same site at any time before August 1,754 2009, provided the MMC is eligible for relicensing.755 756 ADDENDUM: How to use this License for your documents757 ====================================================758 759 To use this License in a document you have written, include a copy of760 the License in the document and put the following copyright and license761 notices just after the title page:762 763 Copyright (C) YEAR YOUR NAME.764 Permission is granted to copy, distribute and/or modify this document765 under the terms of the GNU Free Documentation License, Version 1.3766 or any later version published by the Free Software Foundation;767 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover768 Texts. A copy of the license is included in the section entitled ``GNU769 Free Documentation License''.770 771 If you have Invariant Sections, Front-Cover Texts and Back-Cover772 Texts, replace the "with...Texts." line with this:773 774 with the Invariant Sections being LIST THEIR TITLES, with775 the Front-Cover Texts being LIST, and with the Back-Cover Texts776 being LIST.777 778 If you have Invariant Sections without Cover Texts, or some other779 combination of the three, merge those two alternatives to suit the780 situation.781 782 If your document contains nontrivial examples of program code, we783 recommend releasing these examples in parallel under your choice of free784 software license, such as the GNU General Public License, to permit785 their use in free software.786 787 788 File: libquadmath.info, Node: Reporting Bugs, Prev: GNU Free Documentation License, Up: Top789 790 4 Reporting Bugs791 ****************792 793 Bugs in the GCC Quad-Precision Math Library implementation should be794 reported via <http://gcc.gnu.org/bugs.html>.795 796 797 798 Tag Table:799 Node: Top1633800 Node: Typedef and constants2367801 Node: Math Library Routines3786802 Node: I/O Library Routines7503803 Node: strtoflt1287828804 Node: quadmath_snprintf8588805 Node: GNU Free Documentation License10798806 Node: Reporting Bugs35944807 808 End Tag Table -
libstdc++-v3/include/bits/shared_ptr_base.h
diff -Naur gcc-4.8.2.orig/libstdc++-v3/include/bits/shared_ptr_base.h gcc-4.8.2/libstdc++-v3/include/bits/shared_ptr_base.h
old new 391 391 public: 392 392 template<typename... _Args> 393 393 _Sp_counted_ptr_inplace(_Alloc __a, _Args&&... __args) 394 : _M_impl(__a) , _M_storage()394 : _M_impl(__a) 395 395 { 396 396 _M_impl._M_ptr = static_cast<_Tp*>(static_cast<void*>(&_M_storage)); 397 397 // _GLIBCXX_RESOLVE_LIB_DEFECTS … … 819 819 : _M_ptr(__r.get()), _M_refcount() 820 820 { 821 821 __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) 822 auto __tmp = std::__addressof(*__r.get());822 auto __tmp = __r.get(); 823 823 _M_refcount = __shared_count<_Lp>(std::move(__r)); 824 824 __enable_shared_from_this_helper(_M_refcount, __tmp, __tmp); 825 825 } -
libstdc++-v3/include/bits/stl_algo.h
diff -Naur gcc-4.8.2.orig/libstdc++-v3/include/bits/stl_algo.h gcc-4.8.2/libstdc++-v3/include/bits/stl_algo.h
old new 2279 2279 _RandomAccessIterator __last) 2280 2280 { 2281 2281 _RandomAccessIterator __mid = __first + (__last - __first) / 2; 2282 std::__move_median_to_first(__first, __first + 1, __mid, (__last - 2));2282 std::__move_median_to_first(__first, __first + 1, __mid, __last - 1); 2283 2283 return std::__unguarded_partition(__first + 1, __last, *__first); 2284 2284 } 2285 2285 … … 2291 2291 _RandomAccessIterator __last, _Compare __comp) 2292 2292 { 2293 2293 _RandomAccessIterator __mid = __first + (__last - __first) / 2; 2294 std::__move_median_to_first(__first, __first + 1, __mid, (__last - 2),2294 std::__move_median_to_first(__first, __first + 1, __mid, __last - 1, 2295 2295 __comp); 2296 2296 return std::__unguarded_partition(__first + 1, __last, *__first, __comp); 2297 2297 } -
libstdc++-v3/include/c_global/cstdio
diff -Naur gcc-4.8.2.orig/libstdc++-v3/include/c_global/cstdio gcc-4.8.2/libstdc++-v3/include/c_global/cstdio
old new 69 69 #undef ftell 70 70 #undef fwrite 71 71 #undef getc 72 #undef getchar 72 73 #undef gets 73 74 #undef perror 74 75 #undef printf -
libstdc++-v3/include/debug/functions.h
diff -Naur gcc-4.8.2.orig/libstdc++-v3/include/debug/functions.h gcc-4.8.2/libstdc++-v3/include/debug/functions.h
old new 345 345 return __check_sorted_set_aux(__first, __last, __pred, _SameType()); 346 346 } 347 347 348 // _GLIBCXX_RESOLVE_LIB_DEFECTS 349 // 270. Binary search requirements overly strict 350 // Determine if a sequence is partitioned w.r.t. this element. 348 351 template<typename _ForwardIterator, typename _Tp> 349 352 inline bool 350 __check_partitioned_lower_aux(_ForwardIterator __first, 351 _ForwardIterator __last, const _Tp& __value, 352 std::forward_iterator_tag) 353 __check_partitioned_lower(_ForwardIterator __first, 354 _ForwardIterator __last, const _Tp& __value) 353 355 { 354 356 while (__first != __last && *__first < __value) 355 357 ++__first; … … 362 364 return __first == __last; 363 365 } 364 366 365 // For performance reason, as the iterator range has been validated, check on366 // random access safe iterators is done using the base iterator.367 template<typename _Iterator, typename _Sequence, typename _Tp>368 inline bool369 __check_partitioned_lower_aux(370 const _Safe_iterator<_Iterator, _Sequence>& __first,371 const _Safe_iterator<_Iterator, _Sequence>& __last,372 const _Tp& __value,373 std::random_access_iterator_tag __tag)374 {375 return __check_partitioned_lower_aux(__first.base(), __last.base(),376 __value, __tag);377 }378 379 // _GLIBCXX_RESOLVE_LIB_DEFECTS380 // 270. Binary search requirements overly strict381 // Determine if a sequence is partitioned w.r.t. this element.382 367 template<typename _ForwardIterator, typename _Tp> 383 368 inline bool 384 __check_partitioned_ lower(_ForwardIterator __first,369 __check_partitioned_upper(_ForwardIterator __first, 385 370 _ForwardIterator __last, const _Tp& __value) 386 371 { 387 return __check_partitioned_lower_aux(__first, __last, __value,388 std::__iterator_category(__first));389 }390 391 template<typename _ForwardIterator, typename _Tp>392 inline bool393 __check_partitioned_upper_aux(_ForwardIterator __first,394 _ForwardIterator __last, const _Tp& __value,395 std::forward_iterator_tag)396 {397 372 while (__first != __last && !(__value < *__first)) 398 373 ++__first; 399 374 if (__first != __last) … … 405 380 return __first == __last; 406 381 } 407 382 408 // For performance reason, as the iterator range has been validated, check on 409 // random access safe iterators is done using the base iterator. 410 template<typename _Iterator, typename _Sequence, typename _Tp> 411 inline bool 412 __check_partitioned_upper_aux( 413 const _Safe_iterator<_Iterator, _Sequence>& __first, 414 const _Safe_iterator<_Iterator, _Sequence>& __last, 415 const _Tp& __value, 416 std::random_access_iterator_tag __tag) 417 { 418 return __check_partitioned_upper_aux(__first.base(), __last.base(), 419 __value, __tag); 420 } 421 422 template<typename _ForwardIterator, typename _Tp> 423 inline bool 424 __check_partitioned_upper(_ForwardIterator __first, 425 _ForwardIterator __last, const _Tp& __value) 426 { 427 return __check_partitioned_upper_aux(__first, __last, __value, 428 std::__iterator_category(__first)); 429 } 430 383 // Determine if a sequence is partitioned w.r.t. this element. 431 384 template<typename _ForwardIterator, typename _Tp, typename _Pred> 432 385 inline bool 433 __check_partitioned_lower_aux(_ForwardIterator __first, 434 _ForwardIterator __last, const _Tp& __value, 435 _Pred __pred, 436 std::forward_iterator_tag) 386 __check_partitioned_lower(_ForwardIterator __first, 387 _ForwardIterator __last, const _Tp& __value, 388 _Pred __pred) 437 389 { 438 390 while (__first != __last && bool(__pred(*__first, __value))) 439 391 ++__first; … … 446 398 return __first == __last; 447 399 } 448 400 449 // For performance reason, as the iterator range has been validated, check on450 // random access safe iterators is done using the base iterator.451 template<typename _Iterator, typename _Sequence,452 typename _Tp, typename _Pred>453 inline bool454 __check_partitioned_lower_aux(455 const _Safe_iterator<_Iterator, _Sequence>& __first,456 const _Safe_iterator<_Iterator, _Sequence>& __last,457 const _Tp& __value, _Pred __pred,458 std::random_access_iterator_tag __tag)459 {460 return __check_partitioned_lower_aux(__first.base(), __last.base(),461 __value, __pred, __tag);462 }463 464 // Determine if a sequence is partitioned w.r.t. this element.465 401 template<typename _ForwardIterator, typename _Tp, typename _Pred> 466 402 inline bool 467 __check_partitioned_ lower(_ForwardIterator __first,403 __check_partitioned_upper(_ForwardIterator __first, 468 404 _ForwardIterator __last, const _Tp& __value, 469 405 _Pred __pred) 470 406 { 471 return __check_partitioned_lower_aux(__first, __last, __value, __pred,472 std::__iterator_category(__first));473 }474 475 template<typename _ForwardIterator, typename _Tp, typename _Pred>476 inline bool477 __check_partitioned_upper_aux(_ForwardIterator __first,478 _ForwardIterator __last, const _Tp& __value,479 _Pred __pred,480 std::forward_iterator_tag)481 {482 407 while (__first != __last && !bool(__pred(__value, *__first))) 483 408 ++__first; 484 409 if (__first != __last) … … 490 415 return __first == __last; 491 416 } 492 417 493 // For performance reason, as the iterator range has been validated, check on494 // random access safe iterators is done using the base iterator.495 template<typename _Iterator, typename _Sequence,496 typename _Tp, typename _Pred>497 inline bool498 __check_partitioned_upper_aux(499 const _Safe_iterator<_Iterator, _Sequence>& __first,500 const _Safe_iterator<_Iterator, _Sequence>& __last,501 const _Tp& __value, _Pred __pred,502 std::random_access_iterator_tag __tag)503 {504 return __check_partitioned_upper_aux(__first.base(), __last.base(),505 __value, __pred, __tag);506 }507 508 template<typename _ForwardIterator, typename _Tp, typename _Pred>509 inline bool510 __check_partitioned_upper(_ForwardIterator __first,511 _ForwardIterator __last, const _Tp& __value,512 _Pred __pred)513 {514 return __check_partitioned_upper_aux(__first, __last, __value, __pred,515 std::__iterator_category(__first));516 }517 518 418 // Helper struct to detect random access safe iterators. 519 419 template<typename _Iterator> 520 420 struct __is_safe_random_iterator -
libstdc++-v3/include/debug/macros.h
diff -Naur gcc-4.8.2.orig/libstdc++-v3/include/debug/macros.h gcc-4.8.2/libstdc++-v3/include/debug/macros.h
old new 261 261 w.r.t. the value _Value. */ 262 262 #define __glibcxx_check_partitioned_lower(_First,_Last,_Value) \ 263 263 __glibcxx_check_valid_range(_First,_Last); \ 264 _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower(_First, _Last, \ 265 _Value), \ 264 _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower( \ 265 __gnu_debug::__base(_First), \ 266 __gnu_debug::__base(_Last), _Value), \ 266 267 _M_message(__gnu_debug::__msg_unpartitioned) \ 267 268 ._M_iterator(_First, #_First) \ 268 269 ._M_iterator(_Last, #_Last) \ … … 270 271 271 272 #define __glibcxx_check_partitioned_upper(_First,_Last,_Value) \ 272 273 __glibcxx_check_valid_range(_First,_Last); \ 273 _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper(_First, _Last, \ 274 _Value), \ 274 _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper( \ 275 __gnu_debug::__base(_First), \ 276 __gnu_debug::__base(_Last), _Value), \ 275 277 _M_message(__gnu_debug::__msg_unpartitioned) \ 276 278 ._M_iterator(_First, #_First) \ 277 279 ._M_iterator(_Last, #_Last) \ … … 281 283 w.r.t. the value _Value and predicate _Pred. */ 282 284 #define __glibcxx_check_partitioned_lower_pred(_First,_Last,_Value,_Pred) \ 283 285 __glibcxx_check_valid_range(_First,_Last); \ 284 _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower(_First, _Last, \ 285 _Value, _Pred), \ 286 _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower( \ 287 __gnu_debug::__base(_First), \ 288 __gnu_debug::__base(_Last), _Value, _Pred), \ 286 289 _M_message(__gnu_debug::__msg_unpartitioned_pred) \ 287 290 ._M_iterator(_First, #_First) \ 288 291 ._M_iterator(_Last, #_Last) \ … … 293 296 w.r.t. the value _Value and predicate _Pred. */ 294 297 #define __glibcxx_check_partitioned_upper_pred(_First,_Last,_Value,_Pred) \ 295 298 __glibcxx_check_valid_range(_First,_Last); \ 296 _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper(_First, _Last, \ 297 _Value, _Pred), \ 299 _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper( \ 300 __gnu_debug::__base(_First), \ 301 __gnu_debug::__base(_Last), _Value, _Pred), \ 298 302 _M_message(__gnu_debug::__msg_unpartitioned_pred) \ 299 303 ._M_iterator(_First, #_First) \ 300 304 ._M_iterator(_Last, #_Last) \ -
libstdc++-v3/testsuite/20_util/shared_ptr/cons/58839.cc
diff -Naur gcc-4.8.2.orig/libstdc++-v3/testsuite/20_util/shared_ptr/cons/58839.cc gcc-4.8.2/libstdc++-v3/testsuite/20_util/shared_ptr/cons/58839.cc
old new 1 // { dg-options "-std=gnu++11" } 2 // { dg-do compile } 3 4 // Copyright (C) 2013 Free Software Foundation, Inc. 5 // 6 // This file is part of the GNU ISO C++ Library. This library is free 7 // software; you can redistribute it and/or modify it under the 8 // terms of the GNU General Public License as published by the 9 // Free Software Foundation; either version 3, or (at your option) 10 // any later version. 11 12 // This library is distributed in the hope that it will be useful, 13 // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 // GNU General Public License for more details. 16 17 // You should have received a copy of the GNU General Public License along 18 // with this library; see the file COPYING3. If not see 19 // <http://www.gnu.org/licenses/>. 20 21 #include <memory> 22 23 // libstdc++/58839 24 25 struct D { 26 void operator()(void*) const noexcept { } 27 }; 28 29 void test01() 30 { 31 std::unique_ptr<void, D> y; 32 std::shared_ptr<void> x = std::move(y); 33 } -
libstdc++-v3/testsuite/25_algorithms/nth_element/58800.cc
diff -Naur gcc-4.8.2.orig/libstdc++-v3/testsuite/25_algorithms/nth_element/58800.cc gcc-4.8.2/libstdc++-v3/testsuite/25_algorithms/nth_element/58800.cc
old new 1 // Copyright (C) 2013 Free Software Foundation, Inc. 2 // 3 // This file is part of the GNU ISO C++ Library. This library is free 4 // software; you can redistribute it and/or modify it under the 5 // terms of the GNU General Public License as published by the 6 // Free Software Foundation; either version 3, or (at your option) 7 // any later version. 8 9 // This library is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 14 // You should have received a copy of the GNU General Public License along 15 // with this library; see the file COPYING3. If not see 16 // <http://www.gnu.org/licenses/>. 17 18 // 25.3.2 [lib.alg.nth.element] 19 20 // { dg-options "-std=gnu++11" } 21 22 #include <algorithm> 23 #include <testsuite_hooks.h> 24 #include <testsuite_iterators.h> 25 26 using __gnu_test::test_container; 27 using __gnu_test::random_access_iterator_wrapper; 28 29 typedef test_container<int, random_access_iterator_wrapper> Container; 30 31 void test01() 32 { 33 std::vector<int> v = { 34 207089, 35 202585, 36 180067, 37 157549, 38 211592, 39 216096, 40 207089 41 }; 42 43 Container con(v.data(), v.data() + 7); 44 45 std::nth_element(con.begin(), con.begin() + 3, con.end()); 46 } 47 48 int main() 49 { 50 test01(); 51 return 0; 52 }
Note:
See TracBrowser
for help on using the repository browser.