source: patches/gcc-4.8.2-branch_update-1.patch@ 434f910

clfs-3.0.0-systemd systemd
Last change on this file since 434f910 was 88af5df, checked in by William Harrington <kb0iic@…>, 11 years ago

Fix gcc 4.8.2 branch update 1 patch.

  • Property mode set to 100644
File size: 251.5 KB
RevLine 
[2e59d11]1Submitted By: Jim Gifford (jim at cross-lfs dot org)
[88af5df]2Date: 11-01-2013
[2e59d11]3Initial Package Version: 4.8.2
4Origin: Upstream
5Upstream Status: Applied
6Description: This is a branch update for gcc-4.8.2, and should be
7 rechecked periodically.
8
[88af5df]9Includes PR tree-optimization/54094
[2e59d11]10
[88af5df]11This patch was made from Revision # 204292.
12
13diff -Naur gcc-4.8.2.orig/ChangeLog gcc-4.8.2/ChangeLog
14--- gcc-4.8.2.orig/ChangeLog 2013-10-16 07:18:46.000000000 +0000
15+++ gcc-4.8.2/ChangeLog 2013-11-01 16:12:34.459877324 +0000
16@@ -7,6 +7,13 @@
17 * configure.ac: Also allow ISL 0.12.
18 * configure: Regenerated.
19
20+ PR tree-optimization/54094
21+ * graphite-clast-to-gimple.c (translate_clast_for_loop): Derive the
22+ scheduling dimension for the parallelism check from the polyhedral
23+ information in the AST.
24+ * graphite-dependences.c (carries_deps): Do not assume the schedule is
25+ in 2D + 1 form.
26+
27 2013-05-31 Release Manager
28
29 * GCC 4.8.1 released.
[2e59d11]30diff -Naur gcc-4.8.2.orig/contrib/gcc_update gcc-4.8.2/contrib/gcc_update
[88af5df]31--- gcc-4.8.2.orig/contrib/gcc_update 2012-11-14 11:09:00.000000000 +0000
32+++ gcc-4.8.2/contrib/gcc_update 2013-11-01 16:12:29.807076533 +0000
[2e59d11]33@@ -382,7 +382,7 @@
34 fi
35
36 revision=`$GCC_SVN info | awk '/Revision:/ { print $2 }'`
37- branch=`$GCC_SVN info | sed -ne "/URL:/ {
38+ branch=`$GCC_SVN info | sed -ne "/^URL:/ {
39 s,.*/trunk,trunk,
40 s,.*/branches/,,
41 s,.*/tags/,,
[88af5df]42diff -Naur gcc-4.8.2.orig/gcc/DATESTAMP gcc-4.8.2/gcc/DATESTAMP
43--- gcc-4.8.2.orig/gcc/DATESTAMP 2013-10-16 00:16:34.000000000 +0000
44+++ gcc-4.8.2/gcc/DATESTAMP 2013-11-01 16:12:33.423698996 +0000
45@@ -1 +1 @@
46-20131016
47+20131101
[2e59d11]48diff -Naur gcc-4.8.2.orig/gcc/ada/gcc-interface/utils.c gcc-4.8.2/gcc/ada/gcc-interface/utils.c
[88af5df]49--- gcc-4.8.2.orig/gcc/ada/gcc-interface/utils.c 2013-06-13 07:51:32.000000000 +0000
50+++ gcc-4.8.2/gcc/ada/gcc-interface/utils.c 2013-11-01 16:12:30.359171559 +0000
[2e59d11]51@@ -232,6 +232,7 @@
52 static tree split_plus (tree, tree *);
53 static tree float_type_for_precision (int, enum machine_mode);
54 static tree convert_to_fat_pointer (tree, tree);
55+static unsigned int scale_by_factor_of (tree, unsigned int);
56 static bool potential_alignment_gap (tree, tree, tree);
57 static void process_attributes (tree, struct attrib *);
58
59
60@@ -532,6 +533,22 @@
61 free_binding_level = level;
62 }
63
64
65+/* Set the context of TYPE and its parallel types (if any) to CONTEXT. */
66+
67+static void
68+gnat_set_type_context (tree type, tree context)
69+{
70+ tree decl = TYPE_STUB_DECL (type);
71+
72+ TYPE_CONTEXT (type) = context;
73+
74+ while (decl && DECL_PARALLEL_TYPE (decl))
75+ {
76+ TYPE_CONTEXT (DECL_PARALLEL_TYPE (decl)) = context;
77+ decl = TYPE_STUB_DECL (DECL_PARALLEL_TYPE (decl));
78+ }
79+}
80+
81 /* Record DECL as belonging to the current lexical scope and use GNAT_NODE
82 for location information and flag propagation. */
83
84@@ -613,7 +630,7 @@
85 if (TREE_CODE (t) == POINTER_TYPE)
86 TYPE_NEXT_PTR_TO (t) = tt;
87 TYPE_NAME (tt) = DECL_NAME (decl);
88- TYPE_CONTEXT (tt) = DECL_CONTEXT (decl);
89+ gnat_set_type_context (tt, DECL_CONTEXT (decl));
90 TYPE_STUB_DECL (tt) = TYPE_STUB_DECL (t);
91 DECL_ORIGINAL_TYPE (decl) = tt;
92 }
93@@ -623,7 +640,7 @@
94 /* We need a variant for the placeholder machinery to work. */
95 tree tt = build_variant_type_copy (t);
96 TYPE_NAME (tt) = decl;
97- TYPE_CONTEXT (tt) = DECL_CONTEXT (decl);
98+ gnat_set_type_context (tt, DECL_CONTEXT (decl));
99 TREE_USED (tt) = TREE_USED (t);
100 TREE_TYPE (decl) = tt;
101 if (DECL_ORIGINAL_TYPE (TYPE_NAME (t)))
102@@ -645,7 +662,7 @@
103 if (!(TYPE_NAME (t) && TREE_CODE (TYPE_NAME (t)) == TYPE_DECL))
104 {
105 TYPE_NAME (t) = decl;
106- TYPE_CONTEXT (t) = DECL_CONTEXT (decl);
107+ gnat_set_type_context (t, DECL_CONTEXT (decl));
108 }
109 }
110 }
111@@ -1692,93 +1709,74 @@
112 TYPE_SIZE_UNIT (new_record_type)
113 = size_int (TYPE_ALIGN (record_type) / BITS_PER_UNIT);
114
115- /* Now scan all the fields, replacing each field with a new
116- field corresponding to the new encoding. */
117+ /* Now scan all the fields, replacing each field with a new field
118+ corresponding to the new encoding. */
119 for (old_field = TYPE_FIELDS (record_type); old_field;
120 old_field = DECL_CHAIN (old_field))
121 {
122 tree field_type = TREE_TYPE (old_field);
123 tree field_name = DECL_NAME (old_field);
124- tree new_field;
125 tree curpos = bit_position (old_field);
126+ tree pos, new_field;
127 bool var = false;
128 unsigned int align = 0;
129- tree pos;
130-
131- /* See how the position was modified from the last position.
132
133- There are two basic cases we support: a value was added
134- to the last position or the last position was rounded to
135- a boundary and they something was added. Check for the
136- first case first. If not, see if there is any evidence
137- of rounding. If so, round the last position and try
138- again.
139+ /* We're going to do some pattern matching below so remove as many
140+ conversions as possible. */
141+ curpos = remove_conversions (curpos, true);
142
143- If this is a union, the position can be taken as zero. */
144+ /* See how the position was modified from the last position.
145
146- /* Some computations depend on the shape of the position expression,
147- so strip conversions to make sure it's exposed. */
148- curpos = remove_conversions (curpos, true);
149+ There are two basic cases we support: a value was added
150+ to the last position or the last position was rounded to
151+ a boundary and they something was added. Check for the
152+ first case first. If not, see if there is any evidence
153+ of rounding. If so, round the last position and retry.
154
155+ If this is a union, the position can be taken as zero. */
156 if (TREE_CODE (new_record_type) == UNION_TYPE)
157- pos = bitsize_zero_node, align = 0;
158+ pos = bitsize_zero_node;
159 else
160 pos = compute_related_constant (curpos, last_pos);
161
162- if (!pos && TREE_CODE (curpos) == MULT_EXPR
163+ if (!pos
164+ && TREE_CODE (curpos) == MULT_EXPR
165 && host_integerp (TREE_OPERAND (curpos, 1), 1))
166 {
167 tree offset = TREE_OPERAND (curpos, 0);
168 align = tree_low_cst (TREE_OPERAND (curpos, 1), 1);
169-
170- /* An offset which is a bitwise AND with a mask increases the
171- alignment according to the number of trailing zeros. */
172- offset = remove_conversions (offset, true);
173- if (TREE_CODE (offset) == BIT_AND_EXPR
174- && TREE_CODE (TREE_OPERAND (offset, 1)) == INTEGER_CST)
175- {
176- unsigned HOST_WIDE_INT mask
177- = TREE_INT_CST_LOW (TREE_OPERAND (offset, 1));
178- unsigned int i;
179-
180- for (i = 0; i < HOST_BITS_PER_WIDE_INT; i++)
181- {
182- if (mask & 1)
183- break;
184- mask >>= 1;
185- align *= 2;
186- }
187- }
188-
189- pos = compute_related_constant (curpos,
190- round_up (last_pos, align));
191+ align = scale_by_factor_of (offset, align);
192+ last_pos = round_up (last_pos, align);
193+ pos = compute_related_constant (curpos, last_pos);
194 }
195- else if (!pos && TREE_CODE (curpos) == PLUS_EXPR
196- && TREE_CODE (TREE_OPERAND (curpos, 1)) == INTEGER_CST
197+ else if (!pos
198+ && TREE_CODE (curpos) == PLUS_EXPR
199+ && host_integerp (TREE_OPERAND (curpos, 1), 1)
200 && TREE_CODE (TREE_OPERAND (curpos, 0)) == MULT_EXPR
201- && host_integerp (TREE_OPERAND
202- (TREE_OPERAND (curpos, 0), 1),
203- 1))
204+ && host_integerp
205+ (TREE_OPERAND (TREE_OPERAND (curpos, 0), 1), 1))
206 {
207+ tree offset = TREE_OPERAND (TREE_OPERAND (curpos, 0), 0);
208+ unsigned HOST_WIDE_INT addend
209+ = tree_low_cst (TREE_OPERAND (curpos, 1), 1);
210 align
211- = tree_low_cst
212- (TREE_OPERAND (TREE_OPERAND (curpos, 0), 1), 1);
213- pos = compute_related_constant (curpos,
214- round_up (last_pos, align));
215+ = tree_low_cst (TREE_OPERAND (TREE_OPERAND (curpos, 0), 1), 1);
216+ align = scale_by_factor_of (offset, align);
217+ align = MIN (align, addend & -addend);
218+ last_pos = round_up (last_pos, align);
219+ pos = compute_related_constant (curpos, last_pos);
220 }
221- else if (potential_alignment_gap (prev_old_field, old_field,
222- pos))
223+ else if (potential_alignment_gap (prev_old_field, old_field, pos))
224 {
225 align = TYPE_ALIGN (field_type);
226- pos = compute_related_constant (curpos,
227- round_up (last_pos, align));
228+ last_pos = round_up (last_pos, align);
229+ pos = compute_related_constant (curpos, last_pos);
230 }
231
232 /* If we can't compute a position, set it to zero.
233
234- ??? We really should abort here, but it's too much work
235- to get this correct for all cases. */
236-
237+ ??? We really should abort here, but it's too much work
238+ to get this correct for all cases. */
239 if (!pos)
240 pos = bitsize_zero_node;
241
242@@ -2553,6 +2551,32 @@
243 return false;
244 }
245
246+/* Return VALUE scaled by the biggest power-of-2 factor of EXPR. */
247+
248+static unsigned int
249+scale_by_factor_of (tree expr, unsigned int value)
250+{
251+ expr = remove_conversions (expr, true);
252+
253+ /* An expression which is a bitwise AND with a mask has a power-of-2 factor
254+ corresponding to the number of trailing zeros of the mask. */
255+ if (TREE_CODE (expr) == BIT_AND_EXPR
256+ && TREE_CODE (TREE_OPERAND (expr, 1)) == INTEGER_CST)
257+ {
258+ unsigned HOST_WIDE_INT mask = TREE_INT_CST_LOW (TREE_OPERAND (expr, 1));
259+ unsigned int i = 0;
260+
261+ while ((mask & 1) == 0 && i < HOST_BITS_PER_WIDE_INT)
262+ {
263+ mask >>= 1;
264+ value *= 2;
265+ i++;
266+ }
267+ }
268+
269+ return value;
270+}
271+
272 /* Given two consecutive field decls PREV_FIELD and CURR_FIELD, return true
[88af5df]273 unless we can prove these 2 fields are laid out in such a way that no gap
274 exist between the end of PREV_FIELD and the beginning of CURR_FIELD. OFFSET
275diff -Naur gcc-4.8.2.orig/gcc/alias.c gcc-4.8.2/gcc/alias.c
276--- gcc-4.8.2.orig/gcc/alias.c 2013-03-05 09:40:38.000000000 +0000
277+++ gcc-4.8.2/gcc/alias.c 2013-11-01 16:12:30.359171559 +0000
278@@ -2871,16 +2871,13 @@
279 /* Wipe the reg_seen array clean. */
280 bitmap_clear (reg_seen);
281
282- /* Mark all hard registers which may contain an address.
283- The stack, frame and argument pointers may contain an address.
284- An argument register which can hold a Pmode value may contain
285- an address even if it is not in BASE_REGS.
286-
287- The address expression is VOIDmode for an argument and
288- Pmode for other registers. */
289-
290- memcpy (new_reg_base_value, static_reg_base_value,
291- FIRST_PSEUDO_REGISTER * sizeof (rtx));
292+ /* Initialize the alias information for this pass. */
293+ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
294+ if (static_reg_base_value[i])
295+ {
296+ new_reg_base_value[i] = static_reg_base_value[i];
297+ bitmap_set_bit (reg_seen, i);
298+ }
299
300 /* Walk the insns adding values to the new_reg_base_value array. */
301 for (i = 0; i < rpo_cnt; i++)
302diff -Naur gcc-4.8.2.orig/gcc/cfgexpand.c gcc-4.8.2/gcc/cfgexpand.c
303--- gcc-4.8.2.orig/gcc/cfgexpand.c 2013-03-05 22:31:50.000000000 +0000
304+++ gcc-4.8.2/gcc/cfgexpand.c 2013-11-01 16:12:30.363172247 +0000
305@@ -4707,14 +4707,18 @@
306 if (e->insns.r)
307 {
308 rebuild_jump_labels_chain (e->insns.r);
309- /* Avoid putting insns before parm_birth_insn. */
310+ /* Put insns after parm birth, but before
311+ NOTE_INSNS_FUNCTION_BEG. */
312 if (e->src == ENTRY_BLOCK_PTR
313- && single_succ_p (ENTRY_BLOCK_PTR)
314- && parm_birth_insn)
315+ && single_succ_p (ENTRY_BLOCK_PTR))
316 {
317 rtx insns = e->insns.r;
318 e->insns.r = NULL_RTX;
319- emit_insn_after_noloc (insns, parm_birth_insn, e->dest);
320+ if (NOTE_P (parm_birth_insn)
321+ && NOTE_KIND (parm_birth_insn) == NOTE_INSN_FUNCTION_BEG)
322+ emit_insn_before_noloc (insns, parm_birth_insn, e->dest);
323+ else
324+ emit_insn_after_noloc (insns, parm_birth_insn, e->dest);
325 }
326 else
327 commit_one_edge_insertion (e);
328diff -Naur gcc-4.8.2.orig/gcc/cgraph.c gcc-4.8.2/gcc/cgraph.c
329--- gcc-4.8.2.orig/gcc/cgraph.c 2013-05-22 07:50:40.000000000 +0000
330+++ gcc-4.8.2/gcc/cgraph.c 2013-11-01 16:12:30.367172935 +0000
331@@ -2596,4 +2596,47 @@
332 FOR_EACH_FUNCTION (node)
333 verify_cgraph_node (node);
334 }
335+
336+/* Create external decl node for DECL.
337+ The difference i nbetween cgraph_get_create_node and
338+ cgraph_get_create_real_symbol_node is that cgraph_get_create_node
339+ may return inline clone, while cgraph_get_create_real_symbol_node
340+ will create a new node in this case.
341+ FIXME: This function should be removed once clones are put out of decl
342+ hash. */
343+
344+struct cgraph_node *
345+cgraph_get_create_real_symbol_node (tree decl)
346+{
347+ struct cgraph_node *first_clone = cgraph_get_node (decl);
348+ struct cgraph_node *node;
349+ /* create symbol table node. even if inline clone exists, we can not take
350+ it as a target of non-inlined call. */
351+ node = cgraph_get_node (decl);
352+ if (node && !node->global.inlined_to)
353+ return node;
354+
355+ node = cgraph_create_node (decl);
356+
357+ /* ok, we previously inlined the function, then removed the offline copy and
358+ now we want it back for external call. this can happen when devirtualizing
359+ while inlining function called once that happens after extern inlined and
360+ virtuals are already removed. in this case introduce the external node
361+ and make it available for call. */
362+ if (first_clone)
363+ {
364+ first_clone->clone_of = node;
365+ node->clones = first_clone;
366+ symtab_prevail_in_asm_name_hash ((symtab_node) node);
367+ symtab_insert_node_to_hashtable ((symtab_node) node);
368+ if (dump_file)
369+ fprintf (dump_file, "Introduced new external node "
370+ "(%s/%i) and turned into root of the clone tree.\n",
371+ xstrdup (cgraph_node_name (node)), node->uid);
372+ }
373+ else if (dump_file)
374+ fprintf (dump_file, "Introduced new external node "
375+ "(%s/%i).\n", xstrdup (cgraph_node_name (node)), node->uid);
376+ return node;
377+}
378 #include "gt-cgraph.h"
379diff -Naur gcc-4.8.2.orig/gcc/cgraph.h gcc-4.8.2/gcc/cgraph.h
380--- gcc-4.8.2.orig/gcc/cgraph.h 2013-01-17 11:43:14.000000000 +0000
381+++ gcc-4.8.2/gcc/cgraph.h 2013-11-01 16:12:30.371173624 +0000
382@@ -575,6 +575,7 @@
383 struct cgraph_node * cgraph_create_node (tree);
384 struct cgraph_node * cgraph_create_empty_node (void);
385 struct cgraph_node * cgraph_get_create_node (tree);
386+struct cgraph_node * cgraph_get_create_real_symbol_node (tree);
387 struct cgraph_node * cgraph_same_body_alias (struct cgraph_node *, tree, tree);
388 struct cgraph_node * cgraph_add_thunk (struct cgraph_node *, tree, tree, bool, HOST_WIDE_INT,
389 HOST_WIDE_INT, tree, tree);
390diff -Naur gcc-4.8.2.orig/gcc/cgraphbuild.c gcc-4.8.2/gcc/cgraphbuild.c
391--- gcc-4.8.2.orig/gcc/cgraphbuild.c 2013-01-10 20:38:27.000000000 +0000
392+++ gcc-4.8.2/gcc/cgraphbuild.c 2013-11-01 16:12:30.367172935 +0000
393@@ -73,7 +73,7 @@
394 decl = get_base_var (*tp);
395 if (TREE_CODE (decl) == FUNCTION_DECL)
396 {
397- struct cgraph_node *node = cgraph_get_create_node (decl);
398+ struct cgraph_node *node = cgraph_get_create_real_symbol_node (decl);
399 if (!ctx->only_vars)
400 cgraph_mark_address_taken_node (node);
401 ipa_record_reference ((symtab_node)ctx->varpool_node,
402@@ -143,7 +143,7 @@
403 {
404 struct cgraph_node *per_node;
405
406- per_node = cgraph_get_create_node (DECL_FUNCTION_PERSONALITY (node->symbol.decl));
407+ per_node = cgraph_get_create_real_symbol_node (DECL_FUNCTION_PERSONALITY (node->symbol.decl));
408 ipa_record_reference ((symtab_node)node, (symtab_node)per_node, IPA_REF_ADDR, NULL);
409 cgraph_mark_address_taken_node (per_node);
410 }
411@@ -223,7 +223,7 @@
412 addr = get_base_address (addr);
413 if (TREE_CODE (addr) == FUNCTION_DECL)
414 {
415- struct cgraph_node *node = cgraph_get_create_node (addr);
416+ struct cgraph_node *node = cgraph_get_create_real_symbol_node (addr);
417 cgraph_mark_address_taken_node (node);
418 ipa_record_reference ((symtab_node)data,
419 (symtab_node)node,
420@@ -252,7 +252,7 @@
421 {
422 /* ??? This can happen on platforms with descriptors when these are
423 directly manipulated in the code. Pretend that it's an address. */
424- struct cgraph_node *node = cgraph_get_create_node (t);
425+ struct cgraph_node *node = cgraph_get_create_real_symbol_node (t);
426 cgraph_mark_address_taken_node (node);
427 ipa_record_reference ((symtab_node)data,
428 (symtab_node)node,
429@@ -330,7 +330,7 @@
430 {
431 tree fn = gimple_omp_parallel_child_fn (stmt);
432 ipa_record_reference ((symtab_node)node,
433- (symtab_node)cgraph_get_create_node (fn),
434+ (symtab_node)cgraph_get_create_real_symbol_node (fn),
435 IPA_REF_ADDR, stmt);
436 }
437 if (gimple_code (stmt) == GIMPLE_OMP_TASK)
438@@ -338,12 +338,12 @@
439 tree fn = gimple_omp_task_child_fn (stmt);
440 if (fn)
441 ipa_record_reference ((symtab_node)node,
442- (symtab_node) cgraph_get_create_node (fn),
443+ (symtab_node) cgraph_get_create_real_symbol_node (fn),
444 IPA_REF_ADDR, stmt);
445 fn = gimple_omp_task_copy_fn (stmt);
446 if (fn)
447 ipa_record_reference ((symtab_node)node,
448- (symtab_node)cgraph_get_create_node (fn),
449+ (symtab_node)cgraph_get_create_real_symbol_node (fn),
450 IPA_REF_ADDR, stmt);
451 }
452 }
453diff -Naur gcc-4.8.2.orig/gcc/combine.c gcc-4.8.2/gcc/combine.c
454--- gcc-4.8.2.orig/gcc/combine.c 2013-05-03 13:19:51.000000000 +0000
455+++ gcc-4.8.2/gcc/combine.c 2013-11-01 16:12:30.379175001 +0000
456@@ -5798,8 +5798,15 @@
457 return x;
458 }
459
460- /* If the code changed, return a whole new comparison. */
461- if (new_code != code)
462+ /* If the code changed, return a whole new comparison.
463+ We also need to avoid using SUBST in cases where
464+ simplify_comparison has widened a comparison with a CONST_INT,
465+ since in that case the wider CONST_INT may fail the sanity
466+ checks in do_SUBST. */
467+ if (new_code != code
468+ || (CONST_INT_P (op1)
469+ && GET_MODE (op0) != GET_MODE (XEXP (x, 0))
470+ && GET_MODE (op0) != GET_MODE (XEXP (x, 1))))
471 return gen_rtx_fmt_ee (new_code, mode, op0, op1);
[2e59d11]472
[88af5df]473 /* Otherwise, keep this operation, but maybe change its operands.
474diff -Naur gcc-4.8.2.orig/gcc/config/i386/i386.c gcc-4.8.2/gcc/config/i386/i386.c
[2e59d11]475--- gcc-4.8.2.orig/gcc/config/i386/i386.c 2013-08-23 10:01:34.000000000 +0000
476+++ gcc-4.8.2/gcc/config/i386/i386.c 2013-11-01 16:12:30.487193593 +0000
477@@ -2983,7 +2983,7 @@
478 {"bdver3", PROCESSOR_BDVER3, CPU_BDVER3,
479 PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_SSE3
480 | PTA_SSE4A | PTA_CX16 | PTA_ABM | PTA_SSSE3 | PTA_SSE4_1
481- | PTA_SSE4_2 | PTA_AES | PTA_PCLMUL | PTA_AVX
482+ | PTA_SSE4_2 | PTA_AES | PTA_PCLMUL | PTA_AVX | PTA_FMA4
483 | PTA_XOP | PTA_LWP | PTA_BMI | PTA_TBM | PTA_F16C
[88af5df]484 | PTA_FMA | PTA_PRFCHW | PTA_FXSR | PTA_XSAVE
485 | PTA_XSAVEOPT},
486@@ -7235,9 +7235,15 @@
487 switch (regno)
488 {
489 case AX_REG:
490+ case DX_REG:
491 return true;
492-
493- case FIRST_FLOAT_REG:
494+ case DI_REG:
495+ case SI_REG:
496+ return TARGET_64BIT && ix86_abi != MS_ABI;
497+
498+ /* Complex values are returned in %st(0)/%st(1) pair. */
499+ case ST0_REG:
500+ case ST1_REG:
501 /* TODO: The function should depend on current function ABI but
502 builtins.c would need updating then. Therefore we use the
503 default ABI. */
504@@ -7245,10 +7251,12 @@
505 return false;
506 return TARGET_FLOAT_RETURNS_IN_80387;
507
508- case FIRST_SSE_REG:
509+ /* Complex values are returned in %xmm0/%xmm1 pair. */
510+ case XMM0_REG:
511+ case XMM1_REG:
512 return TARGET_SSE;
513
514- case FIRST_MMX_REG:
515+ case MM0_REG:
516 if (TARGET_MACHO || TARGET_64BIT)
517 return false;
518 return TARGET_MMX;
519@@ -13817,8 +13825,6 @@
520 Those same assemblers have the same but opposite lossage on cmov. */
521 if (mode == CCmode)
522 suffix = fp ? "nbe" : "a";
523- else if (mode == CCCmode)
524- suffix = "b";
525 else
526 gcc_unreachable ();
527 break;
528@@ -13840,8 +13846,12 @@
529 }
530 break;
531 case LTU:
532- gcc_assert (mode == CCmode || mode == CCCmode);
533- suffix = "b";
534+ if (mode == CCmode)
535+ suffix = "b";
536+ else if (mode == CCCmode)
537+ suffix = "c";
538+ else
539+ gcc_unreachable ();
540 break;
541 case GE:
542 switch (mode)
543@@ -13861,20 +13871,20 @@
544 }
545 break;
546 case GEU:
547- /* ??? As above. */
548- gcc_assert (mode == CCmode || mode == CCCmode);
549- suffix = fp ? "nb" : "ae";
550+ if (mode == CCmode)
551+ suffix = fp ? "nb" : "ae";
552+ else if (mode == CCCmode)
553+ suffix = "nc";
554+ else
555+ gcc_unreachable ();
556 break;
557 case LE:
558 gcc_assert (mode == CCmode || mode == CCGCmode || mode == CCNOmode);
559 suffix = "le";
560 break;
561 case LEU:
562- /* ??? As above. */
563 if (mode == CCmode)
564 suffix = "be";
565- else if (mode == CCCmode)
566- suffix = fp ? "nb" : "ae";
567 else
568 gcc_unreachable ();
569 break;
570@@ -18486,12 +18496,7 @@
571 return CCmode;
572 case GTU: /* CF=0 & ZF=0 */
573 case LEU: /* CF=1 | ZF=1 */
574- /* Detect overflow checks. They need just the carry flag. */
575- if (GET_CODE (op0) == MINUS
576- && rtx_equal_p (op1, XEXP (op0, 0)))
577- return CCCmode;
578- else
579- return CCmode;
580+ return CCmode;
581 /* Codes possibly doable only with sign flag when
582 comparing against zero. */
583 case GE: /* SF=OF or SF=0 */
584diff -Naur gcc-4.8.2.orig/gcc/config/i386/i386.md gcc-4.8.2/gcc/config/i386/i386.md
585--- gcc-4.8.2.orig/gcc/config/i386/i386.md 2013-08-13 12:45:06.000000000 +0000
586+++ gcc-4.8.2/gcc/config/i386/i386.md 2013-11-01 16:12:31.467362295 +0000
587@@ -6589,7 +6589,7 @@
588 (set_attr "use_carry" "1")
589 (set_attr "mode" "<MODE>")])
590
591
592-;; Overflow setting add and subtract instructions
593+;; Overflow setting add instructions
594
595 (define_insn "*add<mode>3_cconly_overflow"
596 [(set (reg:CCC FLAGS_REG)
597@@ -6604,43 +6604,31 @@
598 [(set_attr "type" "alu")
599 (set_attr "mode" "<MODE>")])
600
601-(define_insn "*sub<mode>3_cconly_overflow"
602+(define_insn "*add<mode>3_cc_overflow"
603 [(set (reg:CCC FLAGS_REG)
604 (compare:CCC
605- (minus:SWI
606- (match_operand:SWI 0 "nonimmediate_operand" "<r>m,<r>")
607- (match_operand:SWI 1 "<general_operand>" "<r><i>,<r>m"))
608- (match_dup 0)))]
609- ""
610- "cmp{<imodesuffix>}\t{%1, %0|%0, %1}"
611- [(set_attr "type" "icmp")
612- (set_attr "mode" "<MODE>")])
613-
614-(define_insn "*<plusminus_insn><mode>3_cc_overflow"
615- [(set (reg:CCC FLAGS_REG)
616- (compare:CCC
617- (plusminus:SWI
618- (match_operand:SWI 1 "nonimmediate_operand" "<comm>0,0")
619+ (plus:SWI
620+ (match_operand:SWI 1 "nonimmediate_operand" "%0,0")
621 (match_operand:SWI 2 "<general_operand>" "<r><i>,<r>m"))
622 (match_dup 1)))
623 (set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,<r>")
624- (plusminus:SWI (match_dup 1) (match_dup 2)))]
625- "ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
626- "<plusminus_mnemonic>{<imodesuffix>}\t{%2, %0|%0, %2}"
627+ (plus:SWI (match_dup 1) (match_dup 2)))]
628+ "ix86_binary_operator_ok (PLUS, <MODE>mode, operands)"
629+ "add{<imodesuffix>}\t{%2, %0|%0, %2}"
630 [(set_attr "type" "alu")
631 (set_attr "mode" "<MODE>")])
632
633-(define_insn "*<plusminus_insn>si3_zext_cc_overflow"
634+(define_insn "*addsi3_zext_cc_overflow"
635 [(set (reg:CCC FLAGS_REG)
636 (compare:CCC
637- (plusminus:SI
638- (match_operand:SI 1 "nonimmediate_operand" "<comm>0")
639+ (plus:SI
640+ (match_operand:SI 1 "nonimmediate_operand" "%0")
641 (match_operand:SI 2 "x86_64_general_operand" "rme"))
642 (match_dup 1)))
643 (set (match_operand:DI 0 "register_operand" "=r")
644- (zero_extend:DI (plusminus:SI (match_dup 1) (match_dup 2))))]
645- "TARGET_64BIT && ix86_binary_operator_ok (<CODE>, SImode, operands)"
646- "<plusminus_mnemonic>{l}\t{%2, %k0|%k0, %2}"
647+ (zero_extend:DI (plus:SI (match_dup 1) (match_dup 2))))]
648+ "TARGET_64BIT && ix86_binary_operator_ok (PLUS, SImode, operands)"
649+ "add{l}\t{%2, %k0|%k0, %2}"
[2e59d11]650 [(set_attr "type" "alu")
[88af5df]651 (set_attr "mode" "SI")])
652
[2e59d11]653diff -Naur gcc-4.8.2.orig/gcc/config/rs6000/rs6000.md gcc-4.8.2/gcc/config/rs6000/rs6000.md
654--- gcc-4.8.2.orig/gcc/config/rs6000/rs6000.md 2013-09-23 14:27:06.000000000 +0000
655+++ gcc-4.8.2/gcc/config/rs6000/rs6000.md 2013-11-01 16:12:31.479364360 +0000
656@@ -2412,7 +2412,7 @@
657 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
658 (const_int 0)))
659 (clobber (match_scratch:SI 3 "=r,r"))]
660- ""
661+ "TARGET_32BIT"
662 "@
663 mullw. %3,%1,%2
664 #"
665@@ -2425,7 +2425,7 @@
666 (match_operand:SI 2 "gpc_reg_operand" ""))
667 (const_int 0)))
668 (clobber (match_scratch:SI 3 ""))]
669- "reload_completed"
670+ "TARGET_32BIT && reload_completed"
671 [(set (match_dup 3)
672 (mult:SI (match_dup 1) (match_dup 2)))
673 (set (match_dup 0)
674@@ -2440,7 +2440,7 @@
675 (const_int 0)))
676 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
677 (mult:SI (match_dup 1) (match_dup 2)))]
678- ""
679+ "TARGET_32BIT"
680 "@
681 mullw. %0,%1,%2
682 #"
683@@ -2454,7 +2454,7 @@
684 (const_int 0)))
685 (set (match_operand:SI 0 "gpc_reg_operand" "")
686 (mult:SI (match_dup 1) (match_dup 2)))]
687- "reload_completed"
688+ "TARGET_32BIT && reload_completed"
689 [(set (match_dup 0)
[88af5df]690 (mult:SI (match_dup 1) (match_dup 2)))
691 (set (match_dup 3)
[2e59d11]692diff -Naur gcc-4.8.2.orig/gcc/config/sh/sh.opt gcc-4.8.2/gcc/config/sh/sh.opt
693--- gcc-4.8.2.orig/gcc/config/sh/sh.opt 2013-03-13 18:09:10.000000000 +0000
694+++ gcc-4.8.2/gcc/config/sh/sh.opt 2013-11-01 16:12:32.375518598 +0000
695@@ -21,7 +21,7 @@
696 ;; Used for various architecture options.
697 Mask(SH_E)
698
699-;; Set if the default precision of th FPU is single.
700+;; Set if the default precision of the FPU is single.
701 Mask(FPU_SINGLE)
[88af5df]702
703 ;; Set if the a double-precision FPU is present but is restricted to
[2e59d11]704diff -Naur gcc-4.8.2.orig/gcc/cp/decl2.c gcc-4.8.2/gcc/cp/decl2.c
705--- gcc-4.8.2.orig/gcc/cp/decl2.c 2013-05-20 13:37:44.000000000 +0000
706+++ gcc-4.8.2/gcc/cp/decl2.c 2013-11-01 16:12:32.379519286 +0000
707@@ -3960,6 +3960,22 @@
708 expand_or_defer_fn (finish_function (0));
709 }
710
711+/* The entire file is now complete. If requested, dump everything
712+ to a file. */
713+
714+static void
715+dump_tu (void)
716+{
717+ int flags;
718+ FILE *stream = dump_begin (TDI_tu, &flags);
719+
720+ if (stream)
721+ {
722+ dump_node (global_namespace, flags & ~TDF_SLIM, stream);
723+ dump_end (TDI_tu, stream);
724+ }
725+}
726+
727 /* This routine is called at the end of compilation.
728 Its job is to create all the code needed to initialize and
729 destroy the global aggregates. We do the destruction
730@@ -3990,6 +4006,7 @@
731 if (pch_file)
732 {
733 c_common_write_pch ();
734+ dump_tu ();
735 return;
736 }
737
738@@ -4359,16 +4376,7 @@
739
740 /* The entire file is now complete. If requested, dump everything
741 to a file. */
742- {
743- int flags;
744- FILE *stream = dump_begin (TDI_tu, &flags);
745-
746- if (stream)
747- {
748- dump_node (global_namespace, flags & ~TDF_SLIM, stream);
749- dump_end (TDI_tu, stream);
750- }
751- }
752+ dump_tu ();
[88af5df]753
754 if (flag_detailed_statistics)
755 {
756diff -Naur gcc-4.8.2.orig/gcc/cp/except.c gcc-4.8.2/gcc/cp/except.c
757--- gcc-4.8.2.orig/gcc/cp/except.c 2013-01-10 20:38:27.000000000 +0000
758+++ gcc-4.8.2/gcc/cp/except.c 2013-11-01 16:12:32.995625323 +0000
759@@ -380,6 +380,9 @@
760 {
761 tree type = body ? TREE_TYPE (body) : void_type_node;
762
763+ if (!flag_exceptions)
764+ return body;
765+
[2e59d11]766 if (cond && !value_dependent_expression_p (cond))
[88af5df]767 {
768 cond = cxx_constant_value (cond);
[2e59d11]769diff -Naur gcc-4.8.2.orig/gcc/cp/parser.c gcc-4.8.2/gcc/cp/parser.c
770--- gcc-4.8.2.orig/gcc/cp/parser.c 2013-10-02 18:27:30.000000000 +0000
771+++ gcc-4.8.2/gcc/cp/parser.c 2013-11-01 16:12:33.015628766 +0000
772@@ -6421,10 +6421,6 @@
773 /* Look for the `~'. */
774 cp_parser_require (parser, CPP_COMPL, RT_COMPL);
775
776- /* Once we see the ~, this has to be a pseudo-destructor. */
777- if (!processing_template_decl && !cp_parser_error_occurred (parser))
778- cp_parser_commit_to_tentative_parse (parser);
779-
780 /* Look for the type-name again. We are not responsible for
[88af5df]781 checking that it matches the first type-name. */
782 *type = cp_parser_nonclass_name (parser);
[2e59d11]783diff -Naur gcc-4.8.2.orig/gcc/cp/semantics.c gcc-4.8.2/gcc/cp/semantics.c
784--- gcc-4.8.2.orig/gcc/cp/semantics.c 2013-10-08 22:29:49.000000000 +0000
785+++ gcc-4.8.2/gcc/cp/semantics.c 2013-11-01 16:12:33.423698996 +0000
786@@ -9481,7 +9481,14 @@
787 /* In unevaluated context this isn't an odr-use, so just return the
788 nearest 'this'. */
789 if (cp_unevaluated_operand)
790- return lookup_name (this_identifier);
791+ {
792+ /* In an NSDMI the fake 'this' pointer that we're using for
793+ parsing is in scope_chain. */
794+ if (LAMBDA_EXPR_EXTRA_SCOPE (lambda)
795+ && TREE_CODE (LAMBDA_EXPR_EXTRA_SCOPE (lambda)) == FIELD_DECL)
796+ return scope_chain->x_current_class_ptr;
797+ return lookup_name (this_identifier);
798+ }
[88af5df]799
800 /* Try to default capture 'this' if we can. */
801 if (!this_capture
802diff -Naur gcc-4.8.2.orig/gcc/gimple-fold.c gcc-4.8.2/gcc/gimple-fold.c
803--- gcc-4.8.2.orig/gcc/gimple-fold.c 2013-01-13 12:33:43.000000000 +0000
804+++ gcc-4.8.2/gcc/gimple-fold.c 2013-11-01 16:12:33.427699685 +0000
805@@ -178,7 +178,7 @@
806 /* Make sure we create a cgraph node for functions we'll reference.
807 They can be non-existent if the reference comes from an entry
808 of an external vtable for example. */
809- cgraph_get_create_node (base);
810+ cgraph_get_create_real_symbol_node (base);
811 }
812 /* Fixup types in global initializers. */
813 if (TREE_TYPE (TREE_TYPE (cval)) != TREE_TYPE (TREE_OPERAND (cval, 0)))
814diff -Naur gcc-4.8.2.orig/gcc/go/go-gcc.cc gcc-4.8.2/gcc/go/go-gcc.cc
815--- gcc-4.8.2.orig/gcc/go/go-gcc.cc 2013-10-04 18:07:35.000000000 +0000
816+++ gcc-4.8.2/gcc/go/go-gcc.cc 2013-11-01 16:12:34.067809850 +0000
817@@ -232,6 +232,9 @@
818 Bexpression*
819 convert_expression(Btype* type, Bexpression* expr, Location);
820
821+ Bexpression*
822+ function_code_expression(Bfunction*, Location);
823+
824 // Statements.
825
826 Bstatement*
827@@ -334,6 +337,17 @@
828 Bexpression*
829 label_address(Blabel*, Location);
830
831+ // Functions.
832+
833+ Bfunction*
834+ error_function()
835+ { return this->make_function(error_mark_node); }
836+
837+ Bfunction*
838+ function(Btype* fntype, const std::string& name, const std::string& asm_name,
839+ bool is_visible, bool is_declaration, bool is_inlinable,
840+ bool disable_split_stack, bool in_unique_section, Location);
841+
842 private:
843 // Make a Bexpression from a tree.
844 Bexpression*
845@@ -350,6 +364,10 @@
846 make_type(tree t)
847 { return new Btype(t); }
848
849+ Bfunction*
850+ make_function(tree t)
851+ { return new Bfunction(t); }
852+
853 Btype*
854 fill_in_struct(Btype*, const std::vector<Btyped_identifier>&);
855
856@@ -966,6 +984,19 @@
857 return tree_to_expr(ret);
858 }
859
860+// Get the address of a function.
861+
862+Bexpression*
863+Gcc_backend::function_code_expression(Bfunction* bfunc, Location location)
864+{
865+ tree func = bfunc->get_tree();
866+ if (func == error_mark_node)
867+ return this->error_expression();
868+
869+ tree ret = build_fold_addr_expr_loc(location.gcc_location(), func);
870+ return this->make_expression(ret);
871+}
872+
873 // An expression as a statement.
874
875 Bstatement*
876@@ -1724,6 +1755,56 @@
877 return this->make_expression(ret);
878 }
879
880+// Declare or define a new function.
881+
882+Bfunction*
883+Gcc_backend::function(Btype* fntype, const std::string& name,
884+ const std::string& asm_name, bool is_visible,
885+ bool is_declaration, bool is_inlinable,
886+ bool disable_split_stack, bool in_unique_section,
887+ Location location)
888+{
889+ tree functype = fntype->get_tree();
890+ if (functype != error_mark_node)
891+ {
892+ gcc_assert(FUNCTION_POINTER_TYPE_P(functype));
893+ functype = TREE_TYPE(functype);
894+ }
895+ tree id = get_identifier_from_string(name);
896+ if (functype == error_mark_node || id == error_mark_node)
897+ return this->error_function();
898+
899+ tree decl = build_decl(location.gcc_location(), FUNCTION_DECL, id, functype);
900+ if (!asm_name.empty())
901+ SET_DECL_ASSEMBLER_NAME(decl, get_identifier_from_string(asm_name));
902+ if (is_visible)
903+ TREE_PUBLIC(decl) = 1;
904+ if (is_declaration)
905+ DECL_EXTERNAL(decl) = 1;
906+ else
907+ {
908+ tree restype = TREE_TYPE(functype);
909+ tree resdecl =
910+ build_decl(location.gcc_location(), RESULT_DECL, NULL_TREE, restype);
911+ DECL_ARTIFICIAL(resdecl) = 1;
912+ DECL_IGNORED_P(resdecl) = 1;
913+ DECL_CONTEXT(resdecl) = decl;
914+ DECL_RESULT(decl) = resdecl;
915+ }
916+ if (!is_inlinable)
917+ DECL_UNINLINABLE(decl) = 1;
918+ if (disable_split_stack)
919+ {
920+ tree attr = get_identifier("__no_split_stack__");
921+ DECL_ATTRIBUTES(decl) = tree_cons(attr, NULL_TREE, NULL_TREE);
922+ }
923+ if (in_unique_section)
924+ resolve_unique_section(decl, 0, 1);
925+
926+ go_preserve_from_gc(decl);
927+ return new Bfunction(decl);
928+}
929+
930 // The single backend.
931
932 static Gcc_backend gcc_backend;
933@@ -1799,3 +1880,9 @@
934 {
935 return bv->get_tree();
936 }
937+
938+tree
939+function_to_tree(Bfunction* bf)
[2e59d11]940+{
[88af5df]941+ return bf->get_tree();
942+}
[2e59d11]943diff -Naur gcc-4.8.2.orig/gcc/go/gofrontend/backend.h gcc-4.8.2/gcc/go/gofrontend/backend.h
944--- gcc-4.8.2.orig/gcc/go/gofrontend/backend.h 2013-10-04 18:07:35.000000000 +0000
945+++ gcc-4.8.2/gcc/go/gofrontend/backend.h 2013-11-01 16:12:33.427699685 +0000
946@@ -23,7 +23,7 @@
947 // The backend representation of a statement.
948 class Bstatement;
949
950-// The backend representation of a function definition.
951+// The backend representation of a function definition or declaration.
952 class Bfunction;
953
954 // The backend representation of a block.
955@@ -266,6 +266,11 @@
956 virtual Bexpression*
957 convert_expression(Btype* type, Bexpression* expr, Location) = 0;
958
959+ // Create an expression for the address of a function. This is used to
960+ // get the address of the code for a function.
961+ virtual Bexpression*
962+ function_code_expression(Bfunction*, Location) = 0;
963+
964 // Statements.
965
966 // Create an error statement. This is used for cases which should
967@@ -498,6 +503,32 @@
968 // recover.
969 virtual Bexpression*
970 label_address(Blabel*, Location) = 0;
971+
972+ // Functions.
973+
974+ // Create an error function. This is used for cases which should
975+ // not occur in a correct program, in order to keep the compilation
976+ // going without crashing.
977+ virtual Bfunction*
978+ error_function() = 0;
979+
980+ // Declare or define a function of FNTYPE.
981+ // NAME is the Go name of the function. ASM_NAME, if not the empty string, is
982+ // the name that should be used in the symbol table; this will be non-empty if
983+ // a magic extern comment is used.
984+ // IS_VISIBLE is true if this function should be visible outside of the
985+ // current compilation unit. IS_DECLARATION is true if this is a function
986+ // declaration rather than a definition; the function definition will be in
987+ // another compilation unit.
988+ // IS_INLINABLE is true if the function can be inlined.
989+ // DISABLE_SPLIT_STACK is true if this function may not split the stack; this
990+ // is used for the implementation of recover.
991+ // IN_UNIQUE_SECTION is true if this function should be put into a unique
992+ // location if possible; this is used for field tracking.
993+ virtual Bfunction*
994+ function(Btype* fntype, const std::string& name, const std::string& asm_name,
995+ bool is_visible, bool is_declaration, bool is_inlinable,
996+ bool disable_split_stack, bool in_unique_section, Location) = 0;
997 };
998
999 // The backend interface has to define this function.
1000@@ -517,5 +548,6 @@
1001 extern tree stat_to_tree(Bstatement*);
1002 extern tree block_to_tree(Bblock*);
1003 extern tree var_to_tree(Bvariable*);
1004+extern tree function_to_tree(Bfunction*);
[88af5df]1005
1006 #endif // !defined(GO_BACKEND_H)
[2e59d11]1007diff -Naur gcc-4.8.2.orig/gcc/go/gofrontend/expressions.cc gcc-4.8.2/gcc/go/gofrontend/expressions.cc
1008--- gcc-4.8.2.orig/gcc/go/gofrontend/expressions.cc 2013-10-08 23:54:31.000000000 +0000
1009+++ gcc-4.8.2/gcc/go/gofrontend/expressions.cc 2013-11-01 16:12:33.435701062 +0000
1010@@ -1219,7 +1219,7 @@
1011
1012 // Get the tree for the code of a function expression.
1013
1014-tree
1015+Bexpression*
1016 Func_expression::get_code_pointer(Gogo* gogo, Named_object* no, Location loc)
1017 {
1018 Function_type* fntype;
1019@@ -1237,25 +1237,18 @@
1020 error_at(loc,
1021 "invalid use of special builtin function %qs; must be called",
1022 no->message_name().c_str());
1023- return error_mark_node;
1024+ return gogo->backend()->error_expression();
1025 }
1026
1027- tree id = no->get_id(gogo);
1028- if (id == error_mark_node)
1029- return error_mark_node;
1030-
1031- tree fndecl;
1032+ Bfunction* fndecl;
1033 if (no->is_function())
1034- fndecl = no->func_value()->get_or_make_decl(gogo, no, id);
1035+ fndecl = no->func_value()->get_or_make_decl(gogo, no);
1036 else if (no->is_function_declaration())
1037- fndecl = no->func_declaration_value()->get_or_make_decl(gogo, no, id);
1038+ fndecl = no->func_declaration_value()->get_or_make_decl(gogo, no);
1039 else
1040 go_unreachable();
1041
1042- if (fndecl == error_mark_node)
1043- return error_mark_node;
1044-
1045- return build_fold_addr_expr_loc(loc.gcc_location(), fndecl);
1046+ return gogo->backend()->function_code_expression(fndecl, loc);
1047 }
1048
1049 // Get the tree for a function expression. This is used when we take
1050@@ -1492,8 +1485,10 @@
1051 tree
1052 Func_code_reference_expression::do_get_tree(Translate_context* context)
1053 {
1054- return Func_expression::get_code_pointer(context->gogo(), this->function_,
1055- this->location());
1056+ Bexpression* ret =
1057+ Func_expression::get_code_pointer(context->gogo(), this->function_,
1058+ this->location());
1059+ return expr_to_tree(ret);
1060 }
1061
1062 // Make a reference to the code of a function.
1063@@ -3055,8 +3050,7 @@
1064 do_lower(Gogo*, Named_object*, Statement_inserter*, int);
1065
1066 bool
1067- do_is_constant() const
1068- { return this->expr_->is_constant(); }
1069+ do_is_constant() const;
1070
1071 bool
1072 do_numeric_constant_value(Numeric_constant*) const;
1073@@ -3198,6 +3192,27 @@
1074 return this;
1075 }
1076
1077+// Return whether a type conversion is a constant.
1078+
1079+bool
1080+Type_conversion_expression::do_is_constant() const
1081+{
1082+ if (!this->expr_->is_constant())
1083+ return false;
1084+
1085+ // A conversion to a type that may not be used as a constant is not
1086+ // a constant. For example, []byte(nil).
1087+ Type* type = this->type_;
1088+ if (type->integer_type() == NULL
1089+ && type->float_type() == NULL
1090+ && type->complex_type() == NULL
1091+ && !type->is_boolean_type()
1092+ && !type->is_string_type())
1093+ return false;
1094+
1095+ return true;
1096+}
1097+
1098 // Return the constant numeric value if there is one.
1099
1100 bool
1101@@ -5586,6 +5601,15 @@
1102 subcontext.type = NULL;
1103 }
1104
1105+ if (this->op_ == OPERATOR_ANDAND || this->op_ == OPERATOR_OROR)
1106+ {
1107+ // For a logical operation, the context does not determine the
1108+ // types of the operands. The operands must be some boolean
1109+ // type but if the context has a boolean type they do not
1110+ // inherit it. See http://golang.org/issue/3924.
1111+ subcontext.type = NULL;
1112+ }
1113+
1114 // Set the context for the left hand operand.
1115 if (is_shift_op)
1116 {
1117@@ -5967,6 +5991,43 @@
1118 right);
1119 }
1120
1121+ // For complex division Go wants slightly different results than the
1122+ // GCC library provides, so we have our own runtime routine.
1123+ if (this->op_ == OPERATOR_DIV && this->left_->type()->complex_type() != NULL)
1124+ {
1125+ const char *name;
1126+ tree *pdecl;
1127+ Type* ctype;
1128+ static tree complex64_div_decl;
1129+ static tree complex128_div_decl;
1130+ switch (this->left_->type()->complex_type()->bits())
1131+ {
1132+ case 64:
1133+ name = "__go_complex64_div";
1134+ pdecl = &complex64_div_decl;
1135+ ctype = Type::lookup_complex_type("complex64");
1136+ break;
1137+ case 128:
1138+ name = "__go_complex128_div";
1139+ pdecl = &complex128_div_decl;
1140+ ctype = Type::lookup_complex_type("complex128");
1141+ break;
1142+ default:
1143+ go_unreachable();
1144+ }
1145+ Btype* cbtype = ctype->get_backend(gogo);
1146+ tree ctype_tree = type_to_tree(cbtype);
1147+ return Gogo::call_builtin(pdecl,
1148+ this->location(),
1149+ name,
1150+ 2,
1151+ ctype_tree,
1152+ ctype_tree,
1153+ fold_convert_loc(gccloc, ctype_tree, left),
1154+ type,
1155+ fold_convert_loc(gccloc, ctype_tree, right));
1156+ }
1157+
1158 tree compute_type = excess_precision_type(type);
1159 if (compute_type != NULL_TREE)
1160 {
1161@@ -7191,6 +7252,15 @@
1162 if (this->code_ == BUILTIN_OFFSETOF)
1163 {
1164 Expression* arg = this->one_arg();
1165+
1166+ if (arg->bound_method_expression() != NULL
1167+ || arg->interface_field_reference_expression() != NULL)
1168+ {
1169+ this->report_error(_("invalid use of method value as argument "
1170+ "of Offsetof"));
1171+ return this;
1172+ }
1173+
1174 Field_reference_expression* farg = arg->field_reference_expression();
1175 while (farg != NULL)
1176 {
1177@@ -7200,7 +7270,8 @@
1178 // it must not be reached through pointer indirections.
1179 if (farg->expr()->deref() != farg->expr())
1180 {
1181- this->report_error(_("argument of Offsetof implies indirection of an embedded field"));
1182+ this->report_error(_("argument of Offsetof implies "
1183+ "indirection of an embedded field"));
1184 return this;
1185 }
1186 // Go up until we reach the original base.
1187@@ -7476,7 +7547,7 @@
1188 switch (nc.to_unsigned_long(&v))
1189 {
1190 case Numeric_constant::NC_UL_VALID:
1191- return true;
1192+ break;
1193 case Numeric_constant::NC_UL_NOTINT:
1194 error_at(e->location(), "non-integer %s argument to make",
1195 is_length ? "len" : "cap");
1196@@ -7488,8 +7559,23 @@
1197 case Numeric_constant::NC_UL_BIG:
1198 // We don't want to give a compile-time error for a 64-bit
1199 // value on a 32-bit target.
1200- return true;
1201+ break;
1202 }
1203+
1204+ mpz_t val;
1205+ if (!nc.to_int(&val))
1206+ go_unreachable();
1207+ int bits = mpz_sizeinbase(val, 2);
1208+ mpz_clear(val);
1209+ Type* int_type = Type::lookup_integer_type("int");
1210+ if (bits >= int_type->integer_type()->bits())
1211+ {
1212+ error_at(e->location(), "%s argument too large for make",
1213+ is_length ? "len" : "cap");
1214+ return false;
1215+ }
1216+
1217+ return true;
1218 }
1219
1220 if (e->type()->integer_type() != NULL)
1221@@ -7595,6 +7681,8 @@
1222 bool
1223 Builtin_call_expression::do_is_constant() const
1224 {
1225+ if (this->is_error_expression())
1226+ return true;
1227 switch (this->code_)
1228 {
1229 case BUILTIN_LEN:
1230@@ -9744,14 +9832,8 @@
1231 }
1232
1233 tree fntype_tree = type_to_tree(fntype->get_backend(gogo));
1234- if (fntype_tree == error_mark_node)
1235- return error_mark_node;
1236- go_assert(POINTER_TYPE_P(fntype_tree));
1237- if (TREE_TYPE(fntype_tree) == error_mark_node)
1238- return error_mark_node;
1239- go_assert(TREE_CODE(TREE_TYPE(fntype_tree)) == RECORD_TYPE);
1240- tree fnfield_type = TREE_TYPE(TYPE_FIELDS(TREE_TYPE(fntype_tree)));
1241- if (fnfield_type == error_mark_node)
1242+ tree fnfield_type = type_to_tree(fntype->get_backend_fntype(gogo));
1243+ if (fntype_tree == error_mark_node || fnfield_type == error_mark_node)
1244 return error_mark_node;
1245 go_assert(FUNCTION_POINTER_TYPE_P(fnfield_type));
1246 tree rettype = TREE_TYPE(TREE_TYPE(fnfield_type));
1247@@ -9763,7 +9845,7 @@
1248 if (func != NULL)
1249 {
1250 Named_object* no = func->named_object();
1251- fn = Func_expression::get_code_pointer(gogo, no, location);
1252+ fn = expr_to_tree(Func_expression::get_code_pointer(gogo, no, location));
1253 if (!has_closure)
1254 closure_tree = NULL_TREE;
1255 else
1256@@ -10817,11 +10899,20 @@
1257 void
1258 String_index_expression::do_check_types(Gogo*)
1259 {
1260- if (this->start_->type()->integer_type() == NULL)
1261+ Numeric_constant nc;
1262+ unsigned long v;
1263+ if (this->start_->type()->integer_type() == NULL
1264+ && !this->start_->type()->is_error()
1265+ && (!this->start_->numeric_constant_value(&nc)
1266+ || nc.to_unsigned_long(&v) == Numeric_constant::NC_UL_NOTINT))
1267 this->report_error(_("index must be integer"));
1268 if (this->end_ != NULL
1269 && this->end_->type()->integer_type() == NULL
1270- && !this->end_->is_nil_expression())
1271+ && !this->end_->type()->is_error()
1272+ && !this->end_->is_nil_expression()
1273+ && !this->end_->is_error_expression()
1274+ && (!this->end_->numeric_constant_value(&nc)
1275+ || nc.to_unsigned_long(&v) == Numeric_constant::NC_UL_NOTINT))
1276 this->report_error(_("slice end must be integer"));
[88af5df]1277
1278 std::string sval;
[2e59d11]1279diff -Naur gcc-4.8.2.orig/gcc/go/gofrontend/expressions.h gcc-4.8.2/gcc/go/gofrontend/expressions.h
1280--- gcc-4.8.2.orig/gcc/go/gofrontend/expressions.h 2013-10-08 23:54:31.000000000 +0000
1281+++ gcc-4.8.2/gcc/go/gofrontend/expressions.h 2013-11-01 16:12:33.963791948 +0000
1282@@ -1514,8 +1514,8 @@
1283 closure()
1284 { return this->closure_; }
1285
1286- // Return a tree for the code for a function.
1287- static tree
1288+ // Return a backend expression for the code of a function.
1289+ static Bexpression*
[88af5df]1290 get_code_pointer(Gogo*, Named_object* function, Location loc);
1291
1292 protected:
1293diff -Naur gcc-4.8.2.orig/gcc/go/gofrontend/gogo-tree.cc gcc-4.8.2/gcc/go/gofrontend/gogo-tree.cc
1294--- gcc-4.8.2.orig/gcc/go/gofrontend/gogo-tree.cc 2013-09-28 20:23:56.000000000 +0000
[2e59d11]1295+++ gcc-4.8.2/gcc/go/gofrontend/gogo-tree.cc 2013-11-01 16:12:33.975794014 +0000
1296@@ -985,74 +985,6 @@
1297 delete[] vec;
1298 }
1299
1300-// Get a tree for the identifier for a named object.
1301-
1302-tree
1303-Named_object::get_id(Gogo* gogo)
1304-{
1305- go_assert(!this->is_variable() && !this->is_result_variable());
1306- std::string decl_name;
1307- if (this->is_function_declaration()
1308- && !this->func_declaration_value()->asm_name().empty())
1309- decl_name = this->func_declaration_value()->asm_name();
1310- else if (this->is_type()
1311- && Linemap::is_predeclared_location(this->type_value()->location()))
1312- {
1313- // We don't need the package name for builtin types.
1314- decl_name = Gogo::unpack_hidden_name(this->name_);
1315- }
1316- else
1317- {
1318- std::string package_name;
1319- if (this->package_ == NULL)
1320- package_name = gogo->package_name();
1321- else
1322- package_name = this->package_->package_name();
1323-
1324- // Note that this will be misleading if this is an unexported
1325- // method generated for an embedded imported type. In that case
1326- // the unexported method should have the package name of the
1327- // package from which it is imported, but we are going to give
1328- // it our package name. Fixing this would require knowing the
1329- // package name, but we only know the package path. It might be
1330- // better to use package paths here anyhow. This doesn't affect
1331- // the assembler code, because we always set that name in
1332- // Function::get_or_make_decl anyhow. FIXME.
1333-
1334- decl_name = package_name + '.' + Gogo::unpack_hidden_name(this->name_);
1335-
1336- Function_type* fntype;
1337- if (this->is_function())
1338- fntype = this->func_value()->type();
1339- else if (this->is_function_declaration())
1340- fntype = this->func_declaration_value()->type();
1341- else
1342- fntype = NULL;
1343- if (fntype != NULL && fntype->is_method())
1344- {
1345- decl_name.push_back('.');
1346- decl_name.append(fntype->receiver()->type()->mangled_name(gogo));
1347- }
1348- }
1349- if (this->is_type())
1350- {
1351- unsigned int index;
1352- const Named_object* in_function = this->type_value()->in_function(&index);
1353- if (in_function != NULL)
1354- {
1355- decl_name += '$' + Gogo::unpack_hidden_name(in_function->name());
1356- if (index > 0)
1357- {
1358- char buf[30];
1359- snprintf(buf, sizeof buf, "%u", index);
1360- decl_name += '$';
1361- decl_name += buf;
1362- }
1363- }
1364- }
1365- return get_identifier_from_string(decl_name);
1366-}
1367-
1368 // Get a tree for a named object.
1369
1370 tree
1371@@ -1067,11 +999,6 @@
1372 return error_mark_node;
1373 }
1374
1375- tree name;
1376- if (this->classification_ == NAMED_OBJECT_TYPE)
1377- name = NULL_TREE;
1378- else
1379- name = this->get_id(gogo);
1380 tree decl;
1381 switch (this->classification_)
1382 {
1383@@ -1099,6 +1026,7 @@
1384 decl = error_mark_node;
1385 else if (INTEGRAL_TYPE_P(TREE_TYPE(expr_tree)))
1386 {
1387+ tree name = get_identifier_from_string(this->get_id(gogo));
1388 decl = build_decl(named_constant->location().gcc_location(),
1389 CONST_DECL, name, TREE_TYPE(expr_tree));
1390 DECL_INITIAL(decl) = expr_tree;
1391@@ -1161,7 +1089,7 @@
1392 case NAMED_OBJECT_FUNC:
1393 {
1394 Function* func = this->u_.func_value;
1395- decl = func->get_or_make_decl(gogo, this, name);
1396+ decl = function_to_tree(func->get_or_make_decl(gogo, this));
1397 if (decl != error_mark_node)
1398 {
1399 if (func->block() != NULL)
1400@@ -1286,123 +1214,12 @@
1401 return block_tree;
1402 }
1403
1404-// Get a tree for a function decl.
1405+// Get the backend representation.
1406
1407-tree
1408-Function::get_or_make_decl(Gogo* gogo, Named_object* no, tree id)
1409+Bfunction*
1410+Function_declaration::get_or_make_decl(Gogo* gogo, Named_object* no)
1411 {
1412- if (this->fndecl_ == NULL_TREE)
1413- {
1414- tree functype = type_to_tree(this->type_->get_backend(gogo));
1415-
1416- if (functype != error_mark_node)
1417- {
1418- // The type of a function comes back as a pointer to a
1419- // struct whose first field is the function, but we want the
1420- // real function type for a function declaration.
1421- go_assert(POINTER_TYPE_P(functype)
1422- && TREE_CODE(TREE_TYPE(functype)) == RECORD_TYPE);
1423- functype = TREE_TYPE(TYPE_FIELDS(TREE_TYPE(functype)));
1424- go_assert(FUNCTION_POINTER_TYPE_P(functype));
1425- functype = TREE_TYPE(functype);
1426- }
1427-
1428- if (functype == error_mark_node)
1429- this->fndecl_ = error_mark_node;
1430- else
1431- {
1432- tree decl = build_decl(this->location().gcc_location(), FUNCTION_DECL,
1433- id, functype);
1434-
1435- this->fndecl_ = decl;
1436-
1437- if (no->package() != NULL)
1438- ;
1439- else if (this->enclosing_ != NULL || Gogo::is_thunk(no))
1440- ;
1441- else if (Gogo::unpack_hidden_name(no->name()) == "init"
1442- && !this->type_->is_method())
1443- ;
1444- else if (Gogo::unpack_hidden_name(no->name()) == "main"
1445- && gogo->is_main_package())
1446- TREE_PUBLIC(decl) = 1;
1447- // Methods have to be public even if they are hidden because
1448- // they can be pulled into type descriptors when using
1449- // anonymous fields.
1450- else if (!Gogo::is_hidden_name(no->name())
1451- || this->type_->is_method())
1452- {
1453- TREE_PUBLIC(decl) = 1;
1454- std::string pkgpath = gogo->pkgpath_symbol();
1455- if (this->type_->is_method()
1456- && Gogo::is_hidden_name(no->name())
1457- && Gogo::hidden_name_pkgpath(no->name()) != gogo->pkgpath())
1458- {
1459- // This is a method we created for an unexported
1460- // method of an imported embedded type. We need to
1461- // use the pkgpath of the imported package to avoid
1462- // a possible name collision. See bug478 for a test
1463- // case.
1464- pkgpath = Gogo::hidden_name_pkgpath(no->name());
1465- pkgpath = Gogo::pkgpath_for_symbol(pkgpath);
1466- }
1467-
1468- std::string asm_name = pkgpath;
1469- asm_name.append(1, '.');
1470- asm_name.append(Gogo::unpack_hidden_name(no->name()));
1471- if (this->type_->is_method())
1472- {
1473- asm_name.append(1, '.');
1474- Type* rtype = this->type_->receiver()->type();
1475- asm_name.append(rtype->mangled_name(gogo));
1476- }
1477- SET_DECL_ASSEMBLER_NAME(decl,
1478- get_identifier_from_string(asm_name));
1479- }
1480-
1481- // Why do we have to do this in the frontend?
1482- tree restype = TREE_TYPE(functype);
1483- tree resdecl =
1484- build_decl(this->location().gcc_location(), RESULT_DECL, NULL_TREE,
1485- restype);
1486- DECL_ARTIFICIAL(resdecl) = 1;
1487- DECL_IGNORED_P(resdecl) = 1;
1488- DECL_CONTEXT(resdecl) = decl;
1489- DECL_RESULT(decl) = resdecl;
1490-
1491- // If a function calls the predeclared recover function, we
1492- // can't inline it, because recover behaves differently in a
1493- // function passed directly to defer. If this is a recover
1494- // thunk that we built to test whether a function can be
1495- // recovered, we can't inline it, because that will mess up
1496- // our return address comparison.
1497- if (this->calls_recover_ || this->is_recover_thunk_)
1498- DECL_UNINLINABLE(decl) = 1;
1499-
1500- // If this is a thunk created to call a function which calls
1501- // the predeclared recover function, we need to disable
1502- // stack splitting for the thunk.
1503- if (this->is_recover_thunk_)
1504- {
1505- tree attr = get_identifier("__no_split_stack__");
1506- DECL_ATTRIBUTES(decl) = tree_cons(attr, NULL_TREE, NULL_TREE);
1507- }
1508-
1509- if (this->in_unique_section_)
1510- resolve_unique_section (decl, 0, 1);
1511-
1512- go_preserve_from_gc(decl);
1513- }
1514- }
1515- return this->fndecl_;
1516-}
1517-
1518-// Get a tree for a function declaration.
1519-
1520-tree
1521-Function_declaration::get_or_make_decl(Gogo* gogo, Named_object* no, tree id)
1522-{
1523- if (this->fndecl_ == NULL_TREE)
1524+ if (this->fndecl_ == NULL)
1525 {
1526 // Let Go code use an asm declaration to pick up a builtin
1527 // function.
1528@@ -1412,56 +1229,44 @@
1529 builtin_functions.find(this->asm_name_);
1530 if (p != builtin_functions.end())
1531 {
1532- this->fndecl_ = p->second;
1533+ this->fndecl_ = tree_to_function(p->second);
1534 return this->fndecl_;
1535 }
1536 }
1537
1538- tree functype = type_to_tree(this->fntype_->get_backend(gogo));
1539+ std::string asm_name;
1540+ if (this->asm_name_.empty())
1541+ {
1542+ asm_name = (no->package() == NULL
1543+ ? gogo->pkgpath_symbol()
1544+ : no->package()->pkgpath_symbol());
1545+ asm_name.append(1, '.');
1546+ asm_name.append(Gogo::unpack_hidden_name(no->name()));
1547+ if (this->fntype_->is_method())
1548+ {
1549+ asm_name.append(1, '.');
1550+ Type* rtype = this->fntype_->receiver()->type();
1551+ asm_name.append(rtype->mangled_name(gogo));
1552+ }
1553+ }
1554+
1555+ Btype* functype = this->fntype_->get_backend_fntype(gogo);
1556+ this->fndecl_ =
1557+ gogo->backend()->function(functype, no->get_id(gogo), asm_name,
1558+ true, true, true, false, false,
1559+ this->location());
1560+ }
1561
1562- if (functype != error_mark_node)
1563- {
1564- // The type of a function comes back as a pointer to a
1565- // struct whose first field is the function, but we want the
1566- // real function type for a function declaration.
1567- go_assert(POINTER_TYPE_P(functype)
1568- && TREE_CODE(TREE_TYPE(functype)) == RECORD_TYPE);
1569- functype = TREE_TYPE(TYPE_FIELDS(TREE_TYPE(functype)));
1570- go_assert(FUNCTION_POINTER_TYPE_P(functype));
1571- functype = TREE_TYPE(functype);
1572- }
1573+ return this->fndecl_;
1574+}
1575
1576- tree decl;
1577- if (functype == error_mark_node)
1578- decl = error_mark_node;
1579- else
1580- {
1581- decl = build_decl(this->location().gcc_location(), FUNCTION_DECL, id,
1582- functype);
1583- TREE_PUBLIC(decl) = 1;
1584- DECL_EXTERNAL(decl) = 1;
1585+// Return the function's decl after it has been built.
1586
1587- if (this->asm_name_.empty())
1588- {
1589- std::string asm_name = (no->package() == NULL
1590- ? gogo->pkgpath_symbol()
1591- : no->package()->pkgpath_symbol());
1592- asm_name.append(1, '.');
1593- asm_name.append(Gogo::unpack_hidden_name(no->name()));
1594- if (this->fntype_->is_method())
1595- {
1596- asm_name.append(1, '.');
1597- Type* rtype = this->fntype_->receiver()->type();
1598- asm_name.append(rtype->mangled_name(gogo));
1599- }
1600- SET_DECL_ASSEMBLER_NAME(decl,
1601- get_identifier_from_string(asm_name));
1602- }
1603- }
1604- this->fndecl_ = decl;
1605- go_preserve_from_gc(decl);
1606- }
1607- return this->fndecl_;
1608+tree
1609+Function::get_decl() const
1610+{
1611+ go_assert(this->fndecl_ != NULL);
[88af5df]1612+ return function_to_tree(this->fndecl_);
1613 }
1614
1615 // We always pass the receiver to a method as a pointer. If the
1616@@ -1558,7 +1363,7 @@
1617 void
1618 Function::build_tree(Gogo* gogo, Named_object* named_function)
1619 {
1620- tree fndecl = this->fndecl_;
1621+ tree fndecl = this->get_decl();
1622 go_assert(fndecl != NULL_TREE);
1623
1624 tree params = NULL_TREE;
1625@@ -1796,7 +1601,7 @@
1626 set = NULL_TREE;
1627 else
1628 set = fold_build2_loc(end_loc.gcc_location(), MODIFY_EXPR, void_type_node,
1629- DECL_RESULT(this->fndecl_), retval);
1630+ DECL_RESULT(this->get_decl()), retval);
1631 tree ret_stmt = fold_build1_loc(end_loc.gcc_location(), RETURN_EXPR,
1632 void_type_node, set);
1633 append_to_statement_list(ret_stmt, &stmt_list);
1634@@ -1851,7 +1656,7 @@
1635 retval = this->return_value(gogo, named_function, end_loc,
1636 &stmt_list);
1637 set = fold_build2_loc(end_loc.gcc_location(), MODIFY_EXPR, void_type_node,
1638- DECL_RESULT(this->fndecl_), retval);
1639+ DECL_RESULT(this->get_decl()), retval);
1640 ret_stmt = fold_build1_loc(end_loc.gcc_location(), RETURN_EXPR,
1641 void_type_node, set);
1642
1643@@ -1869,7 +1674,7 @@
1644 *fini = stmt_list;
1645 }
1646
1647-// Return the value to assign to DECL_RESULT(this->fndecl_). This may
1648+// Return the value to assign to DECL_RESULT(this->get_decl()). This may
1649 // also add statements to STMT_LIST, which need to be executed before
1650 // the assignment. This is used for a return statement with no
1651 // explicit values.
1652@@ -1902,7 +1707,7 @@
1653 }
1654 else
1655 {
1656- tree rettype = TREE_TYPE(DECL_RESULT(this->fndecl_));
1657+ tree rettype = TREE_TYPE(DECL_RESULT(this->get_decl()));
1658 retval = create_tmp_var(rettype, "RESULT");
1659 tree field = TYPE_FIELDS(rettype);
1660 int index = 0;
1661@@ -2323,18 +2128,14 @@
1662 go_assert(m != NULL);
1663
1664 Named_object* no = m->named_object();
1665-
1666- tree fnid = no->get_id(this);
1667-
1668- tree fndecl;
1669+ Bfunction* bf;
1670 if (no->is_function())
1671- fndecl = no->func_value()->get_or_make_decl(this, no, fnid);
1672+ bf = no->func_value()->get_or_make_decl(this, no);
1673 else if (no->is_function_declaration())
1674- fndecl = no->func_declaration_value()->get_or_make_decl(this, no,
1675- fnid);
1676+ bf = no->func_declaration_value()->get_or_make_decl(this, no);
1677 else
1678 go_unreachable();
1679- fndecl = build_fold_addr_expr(fndecl);
1680+ tree fndecl = build_fold_addr_expr(function_to_tree(bf));
1681
1682 elt = pointers->quick_push(empty);
1683 elt->index = size_int(i);
1684@@ -2353,10 +2154,11 @@
1685 TREE_CONSTANT(decl) = 1;
1686 DECL_INITIAL(decl) = constructor;
1687
1688- // If the interface type has hidden methods, then this is the only
1689- // definition of the table. Otherwise it is a comdat table which
1690- // may be defined in multiple packages.
1691- if (has_hidden_methods)
1692+ // If the interface type has hidden methods, and the table is for a
1693+ // named type, then this is the only definition of the table.
1694+ // Otherwise it is a comdat table which may be defined in multiple
1695+ // packages.
1696+ if (has_hidden_methods && type->named_type() != NULL)
1697 TREE_PUBLIC(decl) = 1;
1698 else
1699 {
1700diff -Naur gcc-4.8.2.orig/gcc/go/gofrontend/gogo.cc gcc-4.8.2/gcc/go/gofrontend/gogo.cc
1701--- gcc-4.8.2.orig/gcc/go/gofrontend/gogo.cc 2013-09-28 20:23:56.000000000 +0000
1702+++ gcc-4.8.2/gcc/go/gofrontend/gogo.cc 2013-11-01 16:12:33.967792637 +0000
1703@@ -3320,7 +3320,8 @@
1704 closure_var_(NULL), block_(block), location_(location), labels_(),
1705 local_type_count_(0), descriptor_(NULL), fndecl_(NULL), defer_stack_(NULL),
1706 is_sink_(false), results_are_named_(false), nointerface_(false),
1707- calls_recover_(false), is_recover_thunk_(false), has_recover_thunk_(false),
1708+ is_unnamed_type_stub_method_(false), calls_recover_(false),
1709+ is_recover_thunk_(false), has_recover_thunk_(false),
1710 in_unique_section_(false)
1711 {
1712 }
1713@@ -3819,6 +3820,81 @@
1714 *presults = results;
1715 }
1716
1717+// Get the backend representation.
1718+
1719+Bfunction*
1720+Function::get_or_make_decl(Gogo* gogo, Named_object* no)
1721+{
1722+ if (this->fndecl_ == NULL)
1723+ {
1724+ std::string asm_name;
1725+ bool is_visible = false;
1726+ if (no->package() != NULL)
1727+ ;
1728+ else if (this->enclosing_ != NULL || Gogo::is_thunk(no))
1729+ ;
1730+ else if (Gogo::unpack_hidden_name(no->name()) == "init"
1731+ && !this->type_->is_method())
1732+ ;
1733+ else if (Gogo::unpack_hidden_name(no->name()) == "main"
1734+ && gogo->is_main_package())
1735+ is_visible = true;
1736+ // Methods have to be public even if they are hidden because
1737+ // they can be pulled into type descriptors when using
1738+ // anonymous fields.
1739+ else if (!Gogo::is_hidden_name(no->name())
1740+ || this->type_->is_method())
1741+ {
1742+ if (!this->is_unnamed_type_stub_method_)
1743+ is_visible = true;
1744+ std::string pkgpath = gogo->pkgpath_symbol();
1745+ if (this->type_->is_method()
1746+ && Gogo::is_hidden_name(no->name())
1747+ && Gogo::hidden_name_pkgpath(no->name()) != gogo->pkgpath())
1748+ {
1749+ // This is a method we created for an unexported
1750+ // method of an imported embedded type. We need to
1751+ // use the pkgpath of the imported package to avoid
1752+ // a possible name collision. See bug478 for a test
1753+ // case.
1754+ pkgpath = Gogo::hidden_name_pkgpath(no->name());
1755+ pkgpath = Gogo::pkgpath_for_symbol(pkgpath);
1756+ }
1757+
1758+ asm_name = pkgpath;
1759+ asm_name.append(1, '.');
1760+ asm_name.append(Gogo::unpack_hidden_name(no->name()));
1761+ if (this->type_->is_method())
1762+ {
1763+ asm_name.append(1, '.');
1764+ Type* rtype = this->type_->receiver()->type();
1765+ asm_name.append(rtype->mangled_name(gogo));
1766+ }
1767+ }
1768+
1769+ // If a function calls the predeclared recover function, we
1770+ // can't inline it, because recover behaves differently in a
1771+ // function passed directly to defer. If this is a recover
1772+ // thunk that we built to test whether a function can be
1773+ // recovered, we can't inline it, because that will mess up
1774+ // our return address comparison.
1775+ bool is_inlinable = !(this->calls_recover_ || this->is_recover_thunk_);
1776+
1777+ // If this is a thunk created to call a function which calls
1778+ // the predeclared recover function, we need to disable
1779+ // stack splitting for the thunk.
1780+ bool disable_split_stack = this->is_recover_thunk_;
1781+
1782+ Btype* functype = this->type_->get_backend_fntype(gogo);
1783+ this->fndecl_ =
1784+ gogo->backend()->function(functype, no->get_id(gogo), asm_name,
1785+ is_visible, false, is_inlinable,
1786+ disable_split_stack,
1787+ this->in_unique_section_, this->location());
1788+ }
1789+ return this->fndecl_;
1790+}
1791+
1792 // Class Block.
1793
1794 Block::Block(Block* enclosing, Location location)
1795@@ -5110,6 +5186,75 @@
1796 go_unreachable();
1797 }
1798
1799+
1800+// Return the external identifier for this object.
1801+
1802+std::string
1803+Named_object::get_id(Gogo* gogo)
1804+{
1805+ go_assert(!this->is_variable() && !this->is_result_variable());
1806+ std::string decl_name;
1807+ if (this->is_function_declaration()
1808+ && !this->func_declaration_value()->asm_name().empty())
1809+ decl_name = this->func_declaration_value()->asm_name();
1810+ else if (this->is_type()
1811+ && Linemap::is_predeclared_location(this->type_value()->location()))
1812+ {
1813+ // We don't need the package name for builtin types.
1814+ decl_name = Gogo::unpack_hidden_name(this->name_);
1815+ }
1816+ else
1817+ {
1818+ std::string package_name;
1819+ if (this->package_ == NULL)
1820+ package_name = gogo->package_name();
1821+ else
1822+ package_name = this->package_->package_name();
1823+
1824+ // Note that this will be misleading if this is an unexported
1825+ // method generated for an embedded imported type. In that case
1826+ // the unexported method should have the package name of the
1827+ // package from which it is imported, but we are going to give
1828+ // it our package name. Fixing this would require knowing the
1829+ // package name, but we only know the package path. It might be
1830+ // better to use package paths here anyhow. This doesn't affect
1831+ // the assembler code, because we always set that name in
1832+ // Function::get_or_make_decl anyhow. FIXME.
1833+
1834+ decl_name = package_name + '.' + Gogo::unpack_hidden_name(this->name_);
1835+
1836+ Function_type* fntype;
1837+ if (this->is_function())
1838+ fntype = this->func_value()->type();
1839+ else if (this->is_function_declaration())
1840+ fntype = this->func_declaration_value()->type();
1841+ else
1842+ fntype = NULL;
1843+ if (fntype != NULL && fntype->is_method())
1844+ {
1845+ decl_name.push_back('.');
1846+ decl_name.append(fntype->receiver()->type()->mangled_name(gogo));
1847+ }
1848+ }
1849+ if (this->is_type())
1850+ {
1851+ unsigned int index;
1852+ const Named_object* in_function = this->type_value()->in_function(&index);
1853+ if (in_function != NULL)
1854+ {
1855+ decl_name += '$' + Gogo::unpack_hidden_name(in_function->name());
1856+ if (index > 0)
1857+ {
1858+ char buf[30];
1859+ snprintf(buf, sizeof buf, "%u", index);
1860+ decl_name += '$';
1861+ decl_name += buf;
1862+ }
1863+ }
1864+ }
1865+ return decl_name;
1866+}
1867+
1868 // Class Bindings.
1869
1870 Bindings::Bindings(Bindings* enclosing)
1871diff -Naur gcc-4.8.2.orig/gcc/go/gofrontend/gogo.h gcc-4.8.2/gcc/go/gofrontend/gogo.h
1872--- gcc-4.8.2.orig/gcc/go/gofrontend/gogo.h 2013-09-28 20:23:56.000000000 +0000
1873+++ gcc-4.8.2/gcc/go/gofrontend/gogo.h 2013-11-01 16:12:33.971793325 +0000
1874@@ -48,6 +48,7 @@
1875 class Bblock;
1876 class Bvariable;
1877 class Blabel;
1878+class Bfunction;
1879
1880 // This file declares the basic classes used to hold the internal
1881 // representation of Go which is built by the parser.
1882@@ -952,6 +953,15 @@
1883 this->nointerface_ = true;
1884 }
1885
1886+ // Record that this function is a stub method created for an unnamed
1887+ // type.
1888+ void
1889+ set_is_unnamed_type_stub_method()
1890+ {
1891+ go_assert(this->is_method());
1892+ this->is_unnamed_type_stub_method_ = true;
1893+ }
1894+
1895 // Add a new field to the closure variable.
1896 void
1897 add_closure_field(Named_object* var, Location loc)
1898@@ -1089,17 +1099,13 @@
1899 this->descriptor_ = descriptor;
1900 }
1901
1902- // Return the function's decl given an identifier.
1903- tree
1904- get_or_make_decl(Gogo*, Named_object*, tree id);
[2e59d11]1905+ // Return the backend representation.
[88af5df]1906+ Bfunction*
1907+ get_or_make_decl(Gogo*, Named_object*);
1908
1909 // Return the function's decl after it has been built.
1910 tree
1911- get_decl() const
1912- {
1913- go_assert(this->fndecl_ != NULL);
[2e59d11]1914- return this->fndecl_;
[88af5df]1915- }
1916+ get_decl() const;
1917
1918 // Set the function decl to hold a tree of the function code.
1919 void
1920@@ -1170,7 +1176,7 @@
1921 // The function descriptor, if any.
1922 Expression* descriptor_;
1923 // The function decl.
1924- tree fndecl_;
1925+ Bfunction* fndecl_;
1926 // The defer stack variable. A pointer to this variable is used to
1927 // distinguish the defer stack for one function from another. This
1928 // is NULL unless we actually need a defer stack.
1929@@ -1181,6 +1187,9 @@
1930 bool results_are_named_ : 1;
1931 // True if this method should not be included in the type descriptor.
1932 bool nointerface_ : 1;
1933+ // True if this function is a stub method created for an unnamed
1934+ // type.
1935+ bool is_unnamed_type_stub_method_ : 1;
1936 // True if this function calls the predeclared recover function.
1937 bool calls_recover_ : 1;
1938 // True if this a thunk built for a function which calls recover.
[2e59d11]1939@@ -1265,9 +1274,9 @@
[88af5df]1940 has_descriptor() const
1941 { return this->descriptor_ != NULL; }
1942
1943- // Return a decl for the function given an identifier.
1944- tree
1945- get_or_make_decl(Gogo*, Named_object*, tree id);
[2e59d11]1946+ // Return a backend representation.
[88af5df]1947+ Bfunction*
1948+ get_or_make_decl(Gogo*, Named_object*);
1949
1950 // If there is a descriptor, build it into the backend
1951 // representation.
1952@@ -1290,7 +1299,7 @@
1953 // The function descriptor, if any.
1954 Expression* descriptor_;
1955 // The function decl if needed.
[2e59d11]1956- tree fndecl_;
[88af5df]1957+ Bfunction* fndecl_;
1958 };
1959
1960 // A variable.
[2e59d11]1961@@ -2181,8 +2190,8 @@
[88af5df]1962 Bvariable*
1963 get_backend_variable(Gogo*, Named_object* function);
1964
1965- // Return a tree for the external identifier for this object.
1966- tree
1967+ // Return the external identifier for this object.
1968+ std::string
[2e59d11]1969 get_id(Gogo*);
[88af5df]1970
1971 // Return a tree representing this object.
[2e59d11]1972diff -Naur gcc-4.8.2.orig/gcc/go/gofrontend/import.h gcc-4.8.2/gcc/go/gofrontend/import.h
1973--- gcc-4.8.2.orig/gcc/go/gofrontend/import.h 2012-10-31 00:38:49.000000000 +0000
1974+++ gcc-4.8.2/gcc/go/gofrontend/import.h 2013-11-01 16:12:33.975794014 +0000
1975@@ -149,6 +149,11 @@
1976 location() const
1977 { return this->location_; }
1978
1979+ // Return the package we are importing.
1980+ Package*
1981+ package() const
1982+ { return this->package_; }
1983+
1984 // Return the next character.
[88af5df]1985 int
1986 peek_char()
[2e59d11]1987diff -Naur gcc-4.8.2.orig/gcc/go/gofrontend/lex.cc gcc-4.8.2/gcc/go/gofrontend/lex.cc
1988--- gcc-4.8.2.orig/gcc/go/gofrontend/lex.cc 2012-12-03 06:57:04.000000000 +0000
1989+++ gcc-4.8.2/gcc/go/gofrontend/lex.cc 2013-11-01 16:12:33.979794702 +0000
1990@@ -873,7 +873,28 @@
1991 && (cc < 'a' || cc > 'z')
1992 && cc != '_'
1993 && (cc < '0' || cc > '9'))
1994- break;
1995+ {
1996+ // Check for an invalid character here, as we get better
1997+ // error behaviour if we swallow them as part of the
1998+ // identifier we are building.
1999+ if ((cc >= ' ' && cc < 0x7f)
2000+ || cc == '\t'
2001+ || cc == '\r'
2002+ || cc == '\n')
2003+ break;
2004+
2005+ this->lineoff_ = p - this->linebuf_;
2006+ error_at(this->location(),
2007+ "invalid character 0x%x in identifier",
2008+ cc);
2009+ if (!has_non_ascii_char)
2010+ {
2011+ buf.assign(pstart, p - pstart);
2012+ has_non_ascii_char = true;
2013+ }
2014+ if (!Lex::is_invalid_identifier(buf))
2015+ buf.append("$INVALID$");
2016+ }
2017 ++p;
[88af5df]2018 if (is_first)
2019 {
[2e59d11]2020diff -Naur gcc-4.8.2.orig/gcc/go/gofrontend/parse.cc gcc-4.8.2/gcc/go/gofrontend/parse.cc
2021--- gcc-4.8.2.orig/gcc/go/gofrontend/parse.cc 2013-10-08 23:54:31.000000000 +0000
2022+++ gcc-4.8.2/gcc/go/gofrontend/parse.cc 2013-11-01 16:12:33.979794702 +0000
2023@@ -744,6 +744,8 @@
2024 return NULL;
2025
2026 Parse::Names names;
2027+ if (receiver != NULL)
2028+ names[receiver->name()] = receiver;
2029 if (params != NULL)
[88af5df]2030 this->check_signature_names(params, &names);
2031 if (results != NULL)
[2e59d11]2032diff -Naur gcc-4.8.2.orig/gcc/go/gofrontend/runtime.cc gcc-4.8.2/gcc/go/gofrontend/runtime.cc
2033--- gcc-4.8.2.orig/gcc/go/gofrontend/runtime.cc 2012-12-21 15:59:27.000000000 +0000
2034+++ gcc-4.8.2/gcc/go/gofrontend/runtime.cc 2013-11-01 16:12:34.055807784 +0000
2035@@ -42,6 +42,8 @@
2036 RFT_RUNE,
2037 // Go type float64, C type double.
2038 RFT_FLOAT64,
2039+ // Go type complex64, C type __complex float.
2040+ RFT_COMPLEX64,
2041 // Go type complex128, C type __complex double.
2042 RFT_COMPLEX128,
2043 // Go type string, C type struct __go_string.
2044@@ -126,6 +128,10 @@
2045 t = Type::lookup_float_type("float64");
2046 break;
2047
2048+ case RFT_COMPLEX64:
2049+ t = Type::lookup_complex_type("complex64");
2050+ break;
2051+
2052 case RFT_COMPLEX128:
2053 t = Type::lookup_complex_type("complex128");
2054 break;
2055@@ -216,6 +222,7 @@
2056 case RFT_UINTPTR:
2057 case RFT_RUNE:
2058 case RFT_FLOAT64:
2059+ case RFT_COMPLEX64:
2060 case RFT_COMPLEX128:
[88af5df]2061 case RFT_STRING:
2062 case RFT_POINTER:
[2e59d11]2063diff -Naur gcc-4.8.2.orig/gcc/go/gofrontend/runtime.def gcc-4.8.2/gcc/go/gofrontend/runtime.def
2064--- gcc-4.8.2.orig/gcc/go/gofrontend/runtime.def 2013-06-18 23:50:42.000000000 +0000
2065+++ gcc-4.8.2/gcc/go/gofrontend/runtime.def 2013-11-01 16:12:34.055807784 +0000
2066@@ -68,6 +68,12 @@
2067 P1(STRING), R1(SLICE))
2068
2069
2070+// Complex division.
2071+DEF_GO_RUNTIME(COMPLEX64_DIV, "__go_complex64_div",
2072+ P2(COMPLEX64, COMPLEX64), R1(COMPLEX64))
2073+DEF_GO_RUNTIME(COMPLEX128_DIV, "__go_complex128_div",
2074+ P2(COMPLEX128, COMPLEX128), R1(COMPLEX128))
2075+
2076 // Make a slice.
[88af5df]2077 DEF_GO_RUNTIME(MAKESLICE1, "__go_make_slice1", P2(TYPE, UINTPTR), R1(SLICE))
2078 DEF_GO_RUNTIME(MAKESLICE2, "__go_make_slice2", P3(TYPE, UINTPTR, UINTPTR),
[2e59d11]2079diff -Naur gcc-4.8.2.orig/gcc/go/gofrontend/types.cc gcc-4.8.2/gcc/go/gofrontend/types.cc
2080--- gcc-4.8.2.orig/gcc/go/gofrontend/types.cc 2013-10-02 19:22:30.000000000 +0000
2081+++ gcc-4.8.2/gcc/go/gofrontend/types.cc 2013-11-01 16:12:34.063809161 +0000
2082@@ -3383,6 +3383,68 @@
2083 // Get the backend representation for a function type.
2084
2085 Btype*
2086+Function_type::get_backend_fntype(Gogo* gogo)
2087+{
2088+ if (this->fnbtype_ == NULL)
2089+ {
2090+ Backend::Btyped_identifier breceiver;
2091+ if (this->receiver_ != NULL)
2092+ {
2093+ breceiver.name = Gogo::unpack_hidden_name(this->receiver_->name());
2094+
2095+ // We always pass the address of the receiver parameter, in
2096+ // order to make interface calls work with unknown types.
2097+ Type* rtype = this->receiver_->type();
2098+ if (rtype->points_to() == NULL)
2099+ rtype = Type::make_pointer_type(rtype);
2100+ breceiver.btype = rtype->get_backend(gogo);
2101+ breceiver.location = this->receiver_->location();
2102+ }
2103+
2104+ std::vector<Backend::Btyped_identifier> bparameters;
2105+ if (this->parameters_ != NULL)
2106+ {
2107+ bparameters.resize(this->parameters_->size());
2108+ size_t i = 0;
2109+ for (Typed_identifier_list::const_iterator p =
2110+ this->parameters_->begin(); p != this->parameters_->end();
2111+ ++p, ++i)
2112+ {
2113+ bparameters[i].name = Gogo::unpack_hidden_name(p->name());
2114+ bparameters[i].btype = p->type()->get_backend(gogo);
2115+ bparameters[i].location = p->location();
2116+ }
2117+ go_assert(i == bparameters.size());
2118+ }
2119+
2120+ std::vector<Backend::Btyped_identifier> bresults;
2121+ if (this->results_ != NULL)
2122+ {
2123+ bresults.resize(this->results_->size());
2124+ size_t i = 0;
2125+ for (Typed_identifier_list::const_iterator p =
2126+ this->results_->begin(); p != this->results_->end();
2127+ ++p, ++i)
2128+ {
2129+ bresults[i].name = Gogo::unpack_hidden_name(p->name());
2130+ bresults[i].btype = p->type()->get_backend(gogo);
2131+ bresults[i].location = p->location();
2132+ }
2133+ go_assert(i == bresults.size());
2134+ }
2135+
2136+ this->fnbtype_ = gogo->backend()->function_type(breceiver, bparameters,
2137+ bresults,
2138+ this->location());
2139+
2140+ }
2141+
2142+ return this->fnbtype_;
2143+}
2144+
2145+// Get the backend representation for a Go function type.
2146+
2147+Btype*
2148 Function_type::do_get_backend(Gogo* gogo)
2149 {
2150 // When we do anything with a function value other than call it, it
2151@@ -3395,57 +3457,9 @@
2152 gogo->backend()->placeholder_struct_type("__go_descriptor", loc);
2153 Btype* ptr_struct_type = gogo->backend()->pointer_type(struct_type);
2154
2155- Backend::Btyped_identifier breceiver;
2156- if (this->receiver_ != NULL)
2157- {
2158- breceiver.name = Gogo::unpack_hidden_name(this->receiver_->name());
2159-
2160- // We always pass the address of the receiver parameter, in
2161- // order to make interface calls work with unknown types.
2162- Type* rtype = this->receiver_->type();
2163- if (rtype->points_to() == NULL)
2164- rtype = Type::make_pointer_type(rtype);
2165- breceiver.btype = rtype->get_backend(gogo);
2166- breceiver.location = this->receiver_->location();
2167- }
2168-
2169- std::vector<Backend::Btyped_identifier> bparameters;
2170- if (this->parameters_ != NULL)
2171- {
2172- bparameters.resize(this->parameters_->size());
2173- size_t i = 0;
2174- for (Typed_identifier_list::const_iterator p = this->parameters_->begin();
2175- p != this->parameters_->end();
2176- ++p, ++i)
2177- {
2178- bparameters[i].name = Gogo::unpack_hidden_name(p->name());
2179- bparameters[i].btype = p->type()->get_backend(gogo);
2180- bparameters[i].location = p->location();
2181- }
2182- go_assert(i == bparameters.size());
2183- }
2184-
2185- std::vector<Backend::Btyped_identifier> bresults;
2186- if (this->results_ != NULL)
2187- {
2188- bresults.resize(this->results_->size());
2189- size_t i = 0;
2190- for (Typed_identifier_list::const_iterator p = this->results_->begin();
2191- p != this->results_->end();
2192- ++p, ++i)
2193- {
2194- bresults[i].name = Gogo::unpack_hidden_name(p->name());
2195- bresults[i].btype = p->type()->get_backend(gogo);
2196- bresults[i].location = p->location();
2197- }
2198- go_assert(i == bresults.size());
2199- }
2200-
2201- Btype* fntype = gogo->backend()->function_type(breceiver, bparameters,
2202- bresults, loc);
2203 std::vector<Backend::Btyped_identifier> fields(1);
2204 fields[0].name = "code";
2205- fields[0].btype = fntype;
2206+ fields[0].btype = this->get_backend_fntype(gogo);
2207 fields[0].location = loc;
2208 if (!gogo->backend()->set_placeholder_struct_type(struct_type, fields))
2209 return gogo->backend()->error_type();
2210@@ -4195,7 +4209,8 @@
2211
2212 // This is a horrible hack caused by the fact that we don't pack
2213 // the names of builtin types. FIXME.
2214- if (nt != NULL
2215+ if (!this->is_imported_
2216+ && nt != NULL
2217 && nt->is_builtin()
2218 && nt->name() == Gogo::unpack_hidden_name(name))
2219 return true;
2220@@ -4204,6 +4219,36 @@
2221 }
2222 }
2223
2224+// Return whether this field is an unexported field named NAME.
2225+
2226+bool
2227+Struct_field::is_unexported_field_name(Gogo* gogo,
2228+ const std::string& name) const
2229+{
2230+ const std::string& field_name(this->field_name());
2231+ if (Gogo::is_hidden_name(field_name)
2232+ && name == Gogo::unpack_hidden_name(field_name)
2233+ && gogo->pack_hidden_name(name, false) != field_name)
2234+ return true;
2235+
2236+ // Check for the name of a builtin type. This is like the test in
2237+ // is_field_name, only there we return false if this->is_imported_,
2238+ // and here we return true.
2239+ if (this->is_imported_ && this->is_anonymous())
2240+ {
2241+ Type* t = this->typed_identifier_.type();
2242+ if (t->points_to() != NULL)
2243+ t = t->points_to();
2244+ Named_type* nt = t->named_type();
2245+ if (nt != NULL
2246+ && nt->is_builtin()
2247+ && nt->name() == Gogo::unpack_hidden_name(name))
2248+ return true;
2249+ }
2250+
2251+ return false;
2252+}
2253+
2254 // Return whether this field is an embedded built-in type.
2255
2256 bool
2257@@ -4264,12 +4309,7 @@
2258 ++p)
2259 {
2260 Type* t = p->type();
2261- if (t->is_undefined())
2262- {
2263- error_at(p->location(), "struct field type is incomplete");
2264- p->set_type(Type::make_error_type());
2265- }
2266- else if (p->is_anonymous())
2267+ if (p->is_anonymous())
2268 {
2269 if (t->named_type() != NULL && t->points_to() != NULL)
2270 {
2271@@ -4641,13 +4681,8 @@
2272 for (Struct_field_list::const_iterator pf = fields->begin();
2273 pf != fields->end();
2274 ++pf)
2275- {
2276- const std::string& field_name(pf->field_name());
2277- if (Gogo::is_hidden_name(field_name)
2278- && name == Gogo::unpack_hidden_name(field_name)
2279- && gogo->pack_hidden_name(name, false) != field_name)
2280- return true;
2281- }
2282+ if (pf->is_unexported_field_name(gogo, name))
2283+ return true;
2284 }
2285 return false;
2286 }
2287@@ -5250,6 +5285,7 @@
2288 Type* ftype = imp->read_type();
2289
2290 Struct_field sf(Typed_identifier(name, ftype, imp->location()));
2291+ sf.set_is_imported();
2292
2293 if (imp->peek_char() == ' ')
2294 {
2295@@ -9022,6 +9058,8 @@
2296 fntype->is_varargs(), location);
2297 gogo->finish_function(fntype->location());
2298
2299+ if (type->named_type() == NULL && stub->is_function())
2300+ stub->func_value()->set_is_unnamed_type_stub_method();
2301 if (m->nointerface() && stub->is_function())
2302 stub->func_value()->set_nointerface();
2303 }
2304@@ -9289,7 +9327,9 @@
2305 else
2306 {
2307 bool is_unexported;
2308- if (!Gogo::is_hidden_name(name))
2309+ // The test for 'a' and 'z' is to handle builtin names,
2310+ // which are not hidden.
2311+ if (!Gogo::is_hidden_name(name) && (name[0] < 'a' || name[0] > 'z'))
2312 is_unexported = false;
[88af5df]2313 else
2314 {
[2e59d11]2315diff -Naur gcc-4.8.2.orig/gcc/go/gofrontend/types.h gcc-4.8.2/gcc/go/gofrontend/types.h
2316--- gcc-4.8.2.orig/gcc/go/gofrontend/types.h 2013-09-18 21:54:08.000000000 +0000
2317+++ gcc-4.8.2/gcc/go/gofrontend/types.h 2013-11-01 16:12:34.063809161 +0000
2318@@ -1717,7 +1717,8 @@
2319 Typed_identifier_list* results, Location location)
2320 : Type(TYPE_FUNCTION),
2321 receiver_(receiver), parameters_(parameters), results_(results),
2322- location_(location), is_varargs_(false), is_builtin_(false)
2323+ location_(location), is_varargs_(false), is_builtin_(false),
2324+ fnbtype_(NULL)
2325 { }
2326
2327 // Get the receiver.
2328@@ -1798,6 +1799,11 @@
2329 static Type*
2330 make_function_type_descriptor_type();
2331
2332+ // Return the backend representation of this function type. This is used
2333+ // as the real type of a backend function declaration or defintion.
2334+ Btype*
2335+ get_backend_fntype(Gogo*);
2336+
2337 protected:
2338 int
2339 do_traverse(Traverse*);
2340@@ -1851,6 +1857,9 @@
2341 // Whether this is a special builtin function which can not simply
2342 // be called. This is used for len, cap, etc.
2343 bool is_builtin_;
2344+ // The backend representation of this type for backend function
2345+ // declarations and definitions.
2346+ Btype* fnbtype_;
2347 };
2348
2349 // The type of a pointer.
2350@@ -1915,7 +1924,7 @@
2351 {
2352 public:
2353 explicit Struct_field(const Typed_identifier& typed_identifier)
2354- : typed_identifier_(typed_identifier), tag_(NULL)
2355+ : typed_identifier_(typed_identifier), tag_(NULL), is_imported_(false)
2356 { }
2357
2358 // The field name.
2359@@ -1926,6 +1935,10 @@
2360 bool
2361 is_field_name(const std::string& name) const;
2362
2363+ // Return whether this struct field is an unexported field named NAME.
2364+ bool
2365+ is_unexported_field_name(Gogo*, const std::string& name) const;
2366+
2367 // Return whether this struct field is an embedded built-in type.
2368 bool
2369 is_embedded_builtin(Gogo*) const;
2370@@ -1963,6 +1976,11 @@
2371 set_tag(const std::string& tag)
2372 { this->tag_ = new std::string(tag); }
2373
2374+ // Record that this field is defined in an imported struct.
2375+ void
2376+ set_is_imported()
2377+ { this->is_imported_ = true; }
2378+
2379 // Set the type. This is only used in error cases.
2380 void
2381 set_type(Type* type)
2382@@ -1973,6 +1991,8 @@
2383 Typed_identifier typed_identifier_;
2384 // The field tag. This is NULL if the field has no tag.
2385 std::string* tag_;
2386+ // Whether this field is defined in an imported struct.
2387+ bool is_imported_;
[88af5df]2388 };
2389
2390 // A list of struct fields.
2391diff -Naur gcc-4.8.2.orig/gcc/graphite-clast-to-gimple.c gcc-4.8.2/gcc/graphite-clast-to-gimple.c
2392--- gcc-4.8.2.orig/gcc/graphite-clast-to-gimple.c 2013-01-10 20:38:27.000000000 +0000
2393+++ gcc-4.8.2/gcc/graphite-clast-to-gimple.c 2013-11-01 16:12:34.503884898 +0000
2394@@ -1170,8 +1170,11 @@
2395 redirect_edge_succ_nodup (next_e, after);
2396 set_immediate_dominator (CDI_DOMINATORS, next_e->dest, next_e->src);
[2e59d11]2397
[88af5df]2398+ isl_set *domain = isl_set_from_cloog_domain (stmt->domain);
2399+ int scheduling_dim = isl_set_n_dim (domain);
2400+
2401 if (flag_loop_parallelize_all
2402- && loop_is_parallel_p (loop, bb_pbb_mapping, level))
2403+ && loop_is_parallel_p (loop, bb_pbb_mapping, scheduling_dim))
2404 loop->can_be_parallel = true;
2405
2406 return last_e;
2407diff -Naur gcc-4.8.2.orig/gcc/graphite-dependences.c gcc-4.8.2/gcc/graphite-dependences.c
2408--- gcc-4.8.2.orig/gcc/graphite-dependences.c 2013-01-10 20:38:27.000000000 +0000
2409+++ gcc-4.8.2/gcc/graphite-dependences.c 2013-11-01 16:12:34.503884898 +0000
2410@@ -297,7 +297,7 @@
2411 int depth)
2412 {
2413 bool res;
2414- int idx, i;
2415+ int i;
2416 isl_space *space;
2417 isl_map *lex, *x;
2418 isl_constraint *ineq;
2419@@ -312,13 +312,12 @@
2420 space = isl_map_get_space (x);
2421 ineq = isl_inequality_alloc (isl_local_space_from_space (space));
2422
2423- idx = 2 * depth + 1;
2424- for (i = 0; i < idx; i++)
2425+ for (i = 0; i < depth - 1; i++)
2426 lex = isl_map_equate (lex, isl_dim_in, i, isl_dim_out, i);
2427
2428 /* in + 1 <= out */
2429- ineq = isl_constraint_set_coefficient_si (ineq, isl_dim_out, idx, 1);
2430- ineq = isl_constraint_set_coefficient_si (ineq, isl_dim_in, idx, -1);
2431+ ineq = isl_constraint_set_coefficient_si (ineq, isl_dim_out, depth - 1, 1);
2432+ ineq = isl_constraint_set_coefficient_si (ineq, isl_dim_in, depth - 1, -1);
2433 ineq = isl_constraint_set_constant_si (ineq, -1);
2434 lex = isl_map_add_constraint (lex, ineq);
2435 x = isl_map_intersect (x, lex);
2436diff -Naur gcc-4.8.2.orig/gcc/ipa-prop.c gcc-4.8.2/gcc/ipa-prop.c
2437--- gcc-4.8.2.orig/gcc/ipa-prop.c 2013-06-24 12:57:52.000000000 +0000
2438+++ gcc-4.8.2/gcc/ipa-prop.c 2013-11-01 16:12:34.071810538 +0000
2439@@ -2126,7 +2126,6 @@
2440 we may create the first reference to the object in the unit. */
[2e59d11]2441 if (!callee || callee->global.inlined_to)
[88af5df]2442 {
2443- struct cgraph_node *first_clone = callee;
2444
2445 /* We are better to ensure we can refer to it.
2446 In the case of static functions we are out of luck, since we already
2447@@ -2142,31 +2141,7 @@
2448 xstrdup (cgraph_node_name (ie->callee)), ie->callee->uid);
2449 return NULL;
2450 }
2451-
2452- /* Create symbol table node. Even if inline clone exists, we can not take
2453- it as a target of non-inlined call. */
2454- callee = cgraph_create_node (target);
2455-
2456- /* OK, we previously inlined the function, then removed the offline copy and
2457- now we want it back for external call. This can happen when devirtualizing
2458- while inlining function called once that happens after extern inlined and
2459- virtuals are already removed. In this case introduce the external node
2460- and make it available for call. */
2461- if (first_clone)
2462- {
2463- first_clone->clone_of = callee;
2464- callee->clones = first_clone;
2465- symtab_prevail_in_asm_name_hash ((symtab_node)callee);
2466- symtab_insert_node_to_hashtable ((symtab_node)callee);
2467- if (dump_file)
2468- fprintf (dump_file, "ipa-prop: Introduced new external node "
2469- "(%s/%i) and turned into root of the clone tree.\n",
2470- xstrdup (cgraph_node_name (callee)), callee->uid);
2471- }
2472- else if (dump_file)
2473- fprintf (dump_file, "ipa-prop: Introduced new external node "
2474- "(%s/%i).\n",
2475- xstrdup (cgraph_node_name (callee)), callee->uid);
2476+ callee = cgraph_get_create_real_symbol_node (target);
2477 }
2478 ipa_check_create_node_params ();
2479
2480diff -Naur gcc-4.8.2.orig/gcc/optabs.c gcc-4.8.2/gcc/optabs.c
2481--- gcc-4.8.2.orig/gcc/optabs.c 2013-03-09 07:54:02.000000000 +0000
2482+++ gcc-4.8.2/gcc/optabs.c 2013-11-01 16:12:34.075811227 +0000
2483@@ -7035,8 +7035,7 @@
2484
2485 create_output_operand (&ops[0], target, mode);
2486 create_fixed_operand (&ops[1], mem);
2487- /* VAL may have been promoted to a wider mode. Shrink it if so. */
2488- create_convert_operand_to (&ops[2], val, mode, true);
2489+ create_input_operand (&ops[2], val, mode);
2490 create_integer_operand (&ops[3], model);
2491 if (maybe_expand_insn (icode, 4, ops))
2492 return ops[0].value;
2493@@ -7075,8 +7074,7 @@
2494 struct expand_operand ops[3];
2495 create_output_operand (&ops[0], target, mode);
2496 create_fixed_operand (&ops[1], mem);
2497- /* VAL may have been promoted to a wider mode. Shrink it if so. */
2498- create_convert_operand_to (&ops[2], val, mode, true);
2499+ create_input_operand (&ops[2], val, mode);
2500 if (maybe_expand_insn (icode, 3, ops))
2501 return ops[0].value;
2502 }
2503@@ -7118,8 +7116,6 @@
2504 {
2505 if (!target || !register_operand (target, mode))
2506 target = gen_reg_rtx (mode);
2507- if (GET_MODE (val) != VOIDmode && GET_MODE (val) != mode)
2508- val = convert_modes (mode, GET_MODE (val), val, 1);
2509 if (expand_compare_and_swap_loop (mem, target, val, NULL_RTX))
2510 return target;
2511 }
2512@@ -7331,8 +7327,8 @@
2513 create_output_operand (&ops[0], target_bool, bool_mode);
2514 create_output_operand (&ops[1], target_oval, mode);
2515 create_fixed_operand (&ops[2], mem);
2516- create_convert_operand_to (&ops[3], expected, mode, true);
2517- create_convert_operand_to (&ops[4], desired, mode, true);
2518+ create_input_operand (&ops[3], expected, mode);
2519+ create_input_operand (&ops[4], desired, mode);
2520 create_integer_operand (&ops[5], is_weak);
2521 create_integer_operand (&ops[6], succ_model);
2522 create_integer_operand (&ops[7], fail_model);
2523@@ -7353,8 +7349,8 @@
2524
2525 create_output_operand (&ops[0], target_oval, mode);
2526 create_fixed_operand (&ops[1], mem);
2527- create_convert_operand_to (&ops[2], expected, mode, true);
2528- create_convert_operand_to (&ops[3], desired, mode, true);
2529+ create_input_operand (&ops[2], expected, mode);
2530+ create_input_operand (&ops[3], desired, mode);
2531 if (!maybe_expand_insn (icode, 4, ops))
2532 return false;
2533
2534diff -Naur gcc-4.8.2.orig/gcc/recog.c gcc-4.8.2/gcc/recog.c
2535--- gcc-4.8.2.orig/gcc/recog.c 2013-08-05 20:24:39.000000000 +0000
2536+++ gcc-4.8.2/gcc/recog.c 2013-11-01 16:12:34.219836014 +0000
[2e59d11]2537@@ -3061,6 +3061,9 @@
[88af5df]2538 return 1;
2539 }
[2e59d11]2540
[88af5df]2541+/* Regno offset to be used in the register search. */
2542+static int search_ofs;
2543+
2544 /* Try to find a hard register of mode MODE, matching the register class in
2545 CLASS_STR, which is available at the beginning of insn CURRENT_INSN and
2546 remains available until the end of LAST_INSN. LAST_INSN may be NULL_RTX,
2547@@ -3076,7 +3079,6 @@
2548 peep2_find_free_register (int from, int to, const char *class_str,
2549 enum machine_mode mode, HARD_REG_SET *reg_set)
2550 {
2551- static int search_ofs;
2552 enum reg_class cl;
2553 HARD_REG_SET live;
2554 df_ref *def_rec;
2555@@ -3541,6 +3543,7 @@
2556 /* Initialize the regsets we're going to use. */
2557 for (i = 0; i < MAX_INSNS_PER_PEEP2 + 1; ++i)
2558 peep2_insn_data[i].live_before = BITMAP_ALLOC (&reg_obstack);
2559+ search_ofs = 0;
2560 live = BITMAP_ALLOC (&reg_obstack);
2561
2562 FOR_EACH_BB_REVERSE (bb)
2563diff -Naur gcc-4.8.2.orig/gcc/testsuite/g++.dg/cpp0x/decltype57.C gcc-4.8.2/gcc/testsuite/g++.dg/cpp0x/decltype57.C
2564--- gcc-4.8.2.orig/gcc/testsuite/g++.dg/cpp0x/decltype57.C 1970-01-01 00:00:00.000000000 +0000
2565+++ gcc-4.8.2/gcc/testsuite/g++.dg/cpp0x/decltype57.C 2013-11-01 16:12:34.223836702 +0000
[2e59d11]2566@@ -0,0 +1,8 @@
[88af5df]2567+// PR c++/58633
2568+// { dg-do compile { target c++11 } }
2569+
2570+void foo(int i)
2571+{
2572+ typedef int I;
2573+ decltype(i.I::~I())* p;
2574+}
2575diff -Naur gcc-4.8.2.orig/gcc/testsuite/g++.dg/cpp0x/enum18.C gcc-4.8.2/gcc/testsuite/g++.dg/cpp0x/enum18.C
2576--- gcc-4.8.2.orig/gcc/testsuite/g++.dg/cpp0x/enum18.C 2011-05-28 22:01:28.000000000 +0000
2577+++ gcc-4.8.2/gcc/testsuite/g++.dg/cpp0x/enum18.C 2013-11-01 16:12:34.227837390 +0000
2578@@ -4,5 +4,5 @@
2579 int main(void) {
2580 enum e {};
[2e59d11]2581 e ev;
[88af5df]2582- ev.e::~e_u(); // { dg-error "e_u. has not been declared" }
2583+ ev.e::~e_u(); // { dg-error "" }
2584 }
2585diff -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
2586--- gcc-4.8.2.orig/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi5.C 1970-01-01 00:00:00.000000000 +0000
2587+++ gcc-4.8.2/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi5.C 2013-11-01 16:12:34.227837390 +0000
[2e59d11]2588@@ -0,0 +1,7 @@
[88af5df]2589+// PR c++/58596
[2e59d11]2590+// { dg-do compile { target c++11 } }
[88af5df]2591+
2592+struct A
2593+{
2594+ int i = [] { return decltype(i)(); }();
2595+};
2596diff -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
2597--- gcc-4.8.2.orig/gcc/testsuite/g++.dg/tm/noexcept-6.C 1970-01-01 00:00:00.000000000 +0000
2598+++ gcc-4.8.2/gcc/testsuite/g++.dg/tm/noexcept-6.C 2013-11-01 16:12:34.227837390 +0000
[2e59d11]2599@@ -0,0 +1,23 @@
[88af5df]2600+// { dg-do compile }
2601+// { dg-options "-fno-exceptions -fgnu-tm -O -std=c++0x -fdump-tree-tmlower" }
2602+
2603+struct TrueFalse
[2e59d11]2604+{
[88af5df]2605+ static constexpr bool v() { return true; }
[2e59d11]2606+};
[88af5df]2607+
[2e59d11]2608+int global;
[88af5df]2609+
2610+template<typename T> int foo()
2611+{
2612+ return __transaction_atomic noexcept(T::v()) (global + 1);
2613+}
2614+
2615+int f1()
[2e59d11]2616+{
[88af5df]2617+ return foo<TrueFalse>();
2618+}
2619+
2620+/* { dg-final { scan-tree-dump-times "eh_must_not_throw" 0 "tmlower" } } */
2621+/* { dg-final { scan-tree-dump-times "__transaction_atomic" 1 "tmlower" } } */
2622+/* { dg-final { cleanup-tree-dump "tmlower" } } */
2623diff -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
2624--- gcc-4.8.2.orig/gcc/testsuite/gcc.c-torture/execute/pr58831.c 1970-01-01 00:00:00.000000000 +0000
2625+++ gcc-4.8.2/gcc/testsuite/gcc.c-torture/execute/pr58831.c 2013-11-01 16:12:34.223836702 +0000
2626@@ -0,0 +1,40 @@
2627+#include <assert.h>
2628+
2629+int a, *b, c, d, f, **i, p, q, *r;
2630+short o, j;
2631+
2632+static int __attribute__((noinline, noclone))
2633+fn1 (int *p1, int **p2)
2634+{
2635+ int **e = &b;
2636+ for (; p; p++)
2637+ *p1 = 1;
2638+ *e = *p2 = &d;
2639+
2640+ assert (r);
2641+
2642+ return c;
2643+}
2644+
2645+static int ** __attribute__((noinline, noclone))
[2e59d11]2646+fn2 (void)
[88af5df]2647+{
2648+ for (f = 0; f != 42; f++)
2649+ {
2650+ int *g[3] = {0, 0, 0};
2651+ for (o = 0; o; o--)
2652+ for (; a > 1;)
[2e59d11]2653+ {
[88af5df]2654+ int **h[1] = { &g[2] };
2655+ }
[2e59d11]2656+ }
[88af5df]2657+ return &r;
2658+}
2659+
2660+int
2661+main (void)
2662+{
[2e59d11]2663+ i = fn2 ();
[88af5df]2664+ fn1 (b, i);
2665+ return 0;
2666+}
2667diff -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
2668--- gcc-4.8.2.orig/gcc/testsuite/gcc.dg/atomic-store-6.c 1970-01-01 00:00:00.000000000 +0000
2669+++ gcc-4.8.2/gcc/testsuite/gcc.dg/atomic-store-6.c 2013-11-01 16:12:34.223836702 +0000
2670@@ -0,0 +1,13 @@
[2e59d11]2671+/* { dg-do run } */
[88af5df]2672+/* { dg-require-effective-target sync_int_128_runtime } */
[2e59d11]2673+/* { dg-options "-mcx16" { target { i?86-*-* x86_64-*-* } } } */
[88af5df]2674+
[2e59d11]2675+__int128_t i;
[88af5df]2676+
2677+int main()
2678+{
2679+ __atomic_store_16(&i, -1, 0);
2680+ if (i != -1)
2681+ __builtin_abort();
2682+ return 0;
2683+}
2684diff -Naur gcc-4.8.2.orig/gcc/testsuite/gcc.dg/graphite/pr54094.c gcc-4.8.2/gcc/testsuite/gcc.dg/graphite/pr54094.c
2685--- gcc-4.8.2.orig/gcc/testsuite/gcc.dg/graphite/pr54094.c 1970-01-01 00:00:00.000000000 +0000
2686+++ gcc-4.8.2/gcc/testsuite/gcc.dg/graphite/pr54094.c 2013-11-01 16:12:34.503884898 +0000
2687@@ -0,0 +1,10 @@
2688+/* { dg-options "-O2 -floop-parallelize-all -floop-nest-optimize" } */
2689+void dwt_deinterleave_h(int *a, int *b, int dn, int sn, int cas)
2690+{
2691+ int i;
2692+ for (i=0; i<sn; i++)
[2e59d11]2693+ b[i]=a[2*i+cas];
[88af5df]2694+ for (i=0; i<dn; i++)
[2e59d11]2695+ b[sn+i]=a[(2*i+1-cas)];
[88af5df]2696+}
2697+
[2e59d11]2698diff -Naur gcc-4.8.2.orig/gcc/testsuite/gcc.dg/pr58805.c gcc-4.8.2/gcc/testsuite/gcc.dg/pr58805.c
2699--- gcc-4.8.2.orig/gcc/testsuite/gcc.dg/pr58805.c 1970-01-01 00:00:00.000000000 +0000
2700+++ gcc-4.8.2/gcc/testsuite/gcc.dg/pr58805.c 2013-11-01 16:12:34.223836702 +0000
2701@@ -0,0 +1,24 @@
2702+/* { dg-do compile } */
2703+/* { dg-options "-O2 -ftree-tail-merge -fdump-tree-pre" } */
2704+
2705+/* Type that matches the 'p' constraint. */
2706+#define TYPE void *
2707+
2708+static inline
2709+void bar (TYPE *r)
2710+{
2711+ TYPE t;
2712+ __asm__ ("" : "=&p" (t), "=p" (*r));
2713+}
2714+
2715+void
2716+foo (int n, TYPE *x, TYPE *y)
2717+{
2718+ if (n == 0)
2719+ bar (x);
2720+ else
2721+ bar (y);
2722+}
2723+
[88af5df]2724+/* { dg-final { scan-tree-dump-times "__asm__" 2 "pre"} } */
2725+/* { dg-final { cleanup-tree-dump "pre" } } */
[2e59d11]2726diff -Naur gcc-4.8.2.orig/gcc/testsuite/gcc.dg/torture/pr57488.c gcc-4.8.2/gcc/testsuite/gcc.dg/torture/pr57488.c
2727--- gcc-4.8.2.orig/gcc/testsuite/gcc.dg/torture/pr57488.c 1970-01-01 00:00:00.000000000 +0000
2728+++ gcc-4.8.2/gcc/testsuite/gcc.dg/torture/pr57488.c 2013-11-01 16:12:34.223836702 +0000
2729@@ -0,0 +1,58 @@
2730+/* { dg-do run } */
2731+
2732+extern void abort (void);
2733+
2734+int i, j, *pj = &j, **ppj = &pj;
2735+int x, *px = &x;
2736+
2737+short s, *ps = &s, k;
2738+
2739+unsigned short u, *pu = &u, **ppu = &pu;
2740+
2741+char c, *pc = &c;
2742+
2743+unsigned char v = 48;
2744+
2745+static int
2746+bar (int p)
2747+{
2748+ p = k;
2749+ *px = **ppu = i;
2750+ *ppj = &p;
2751+ if (**ppj)
2752+ *pj = p;
2753+ return p;
2754+}
2755+
2756+void __attribute__((noinline))
2757+foo ()
2758+{
2759+ for (; i <= 3; i++)
2760+ for (; j; j--);
2761+
2762+ u ^= bar (*pj);
2763+
2764+ for (k = 1; k >= 0; k--)
2765+ {
2766+ int l;
2767+ bar (0);
2768+ for (l = 1; l < 5; l++)
2769+ {
2770+ int m;
2771+ for (m = 6; m; m--)
2772+ {
2773+ v--;
2774+ *ps = *pc;
2775+ }
2776+ }
2777+ }
2778+}
2779+
2780+int
2781+main ()
2782+{
2783+ foo ();
2784+ if (v != 0)
[88af5df]2785+ abort ();
2786+ return 0;
2787+}
2788diff -Naur gcc-4.8.2.orig/gcc/testsuite/gcc.dg/torture/pr58079.c gcc-4.8.2/gcc/testsuite/gcc.dg/torture/pr58079.c
2789--- gcc-4.8.2.orig/gcc/testsuite/gcc.dg/torture/pr58079.c 1970-01-01 00:00:00.000000000 +0000
2790+++ gcc-4.8.2/gcc/testsuite/gcc.dg/torture/pr58079.c 2013-11-01 16:12:34.223836702 +0000
2791@@ -0,0 +1,107 @@
2792+/* { dg-options "-mlong-calls" { target mips*-*-* } } */
2793+
2794+typedef unsigned char u8;
2795+typedef unsigned short u16;
2796+typedef unsigned int __kernel_size_t;
2797+typedef __kernel_size_t size_t;
2798+struct list_head {
2799+ struct list_head *next;
2800+};
2801+
2802+struct dmx_ts_feed {
2803+ int is_filtering;
2804+};
2805+struct dmx_section_feed {
2806+ u16 secbufp;
2807+ u16 seclen;
2808+ u16 tsfeedp;
2809+};
2810+
2811+typedef int (*dmx_ts_cb) (
2812+ const u8 * buffer1,
2813+ size_t buffer1_length,
2814+ const u8 * buffer2,
2815+ size_t buffer2_length
2816+);
2817+
2818+struct dvb_demux_feed {
2819+ union {
2820+ struct dmx_ts_feed ts;
2821+ struct dmx_section_feed sec;
2822+ } feed;
2823+ union {
2824+ dmx_ts_cb ts;
2825+ } cb;
2826+ int type;
2827+ u16 pid;
2828+ int ts_type;
2829+ struct list_head list_head;
2830+};
2831+
2832+struct dvb_demux {
2833+ int (*stop_feed)(struct dvb_demux_feed *feed);
2834+ struct list_head feed_list;
2835+};
2836+
2837+
2838+static
2839+inline
2840+__attribute__((always_inline))
2841+u8
2842+payload(const u8 *tsp)
2843+{
2844+ if (tsp[3] & 0x20) {
2845+ return 184 - 1 - tsp[4];
2846+ }
2847+ return 184;
2848+}
2849+
2850+static
2851+inline
2852+__attribute__((always_inline))
2853+int
2854+dvb_dmx_swfilter_payload(struct dvb_demux_feed *feed, const u8 *buf)
2855+{
2856+ int count = payload(buf);
2857+ int p;
2858+ if (count == 0)
2859+ return -1;
2860+ return feed->cb.ts(&buf[p], count, ((void *)0), 0);
2861+}
2862+
2863+static
2864+inline
2865+__attribute__((always_inline))
2866+void
2867+dvb_dmx_swfilter_packet_type(struct dvb_demux_feed *feed, const u8 *buf)
2868+{
2869+ switch (feed->type) {
2870+ case 0:
2871+ if (feed->ts_type & 1) {
2872+ dvb_dmx_swfilter_payload(feed, buf);
2873+ }
2874+ if (dvb_dmx_swfilter_section_packet(feed, buf) < 0)
2875+ feed->feed.sec.seclen = feed->feed.sec.secbufp = 0;
2876+ }
2877+}
2878+
2879+static
2880+void
2881+dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf)
2882+{
2883+ struct dvb_demux_feed *feed;
2884+ int dvr_done = 0;
2885+
2886+ 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) );})) {
2887+ if (((((feed)->type == 0) && ((feed)->feed.ts.is_filtering) && (((feed)->ts_type & (1 | 8)) == 1))) && (dvr_done++))
2888+ dvb_dmx_swfilter_packet_type(feed, buf);
2889+ else if (feed->pid == 0x2000)
2890+ feed->cb.ts(buf, 188, ((void *)0), 0);
2891+ }
2892+}
2893+void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf, size_t count)
2894+{
2895+ while (count--) {
2896+ dvb_dmx_swfilter_packet(demux, buf);
2897+ }
2898+}
2899diff -Naur gcc-4.8.2.orig/gcc/testsuite/gcc.dg/torture/pr58779.c gcc-4.8.2/gcc/testsuite/gcc.dg/torture/pr58779.c
2900--- gcc-4.8.2.orig/gcc/testsuite/gcc.dg/torture/pr58779.c 1970-01-01 00:00:00.000000000 +0000
2901+++ gcc-4.8.2/gcc/testsuite/gcc.dg/torture/pr58779.c 2013-11-01 16:12:34.223836702 +0000
2902@@ -0,0 +1,12 @@
2903+/* { dg-do run } */
2904+
2905+int a, c;
2906+
2907+int main ()
2908+{
2909+ int e = -1;
2910+ short d = (c <= 0) ^ e;
2911+ if ((unsigned int) a - (a || d) <= (unsigned int) a)
[2e59d11]2912+ __builtin_abort ();
[88af5df]2913+ return 0;
2914+}
[2e59d11]2915diff -Naur gcc-4.8.2.orig/gcc/testsuite/gcc.dg/torture/pr58830.c gcc-4.8.2/gcc/testsuite/gcc.dg/torture/pr58830.c
2916--- gcc-4.8.2.orig/gcc/testsuite/gcc.dg/torture/pr58830.c 1970-01-01 00:00:00.000000000 +0000
2917+++ gcc-4.8.2/gcc/testsuite/gcc.dg/torture/pr58830.c 2013-11-01 16:12:34.223836702 +0000
2918@@ -0,0 +1,42 @@
2919+/* { dg-do run } */
2920+/* { dg-additional-options "-ftree-pre -ftree-partial-pre" } */
2921+
2922+extern void abort (void);
2923+
2924+int b, c, d, f, g, h, i, j[6], *l = &b, *m, n, *o, r;
2925+char k;
2926+
2927+static int
2928+foo ()
2929+{
2930+ char *p = &k;
2931+
2932+ for (; d; d++)
2933+ if (i)
2934+ h = 0;
2935+ else
2936+ h = c || (r = 0);
2937+
2938+ for (f = 0; f < 2; f++)
2939+ {
2940+ unsigned int q;
2941+ *l = 0;
2942+ if (n)
2943+ *m = g;
2944+ if (g)
2945+ o = 0;
2946+ for (q = -8; q >= 5; q++)
2947+ (*p)--;
2948+ }
2949+
2950+ return 0;
2951+}
2952+
2953+int
2954+main ()
2955+{
2956+ foo ();
2957+ 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)
[88af5df]2958+ abort ();
2959+ return 0;
2960+}
2961diff -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
2962--- gcc-4.8.2.orig/gcc/testsuite/gcc.target/arm/require-pic-register-loc.c 1970-01-01 00:00:00.000000000 +0000
2963+++ gcc-4.8.2/gcc/testsuite/gcc.target/arm/require-pic-register-loc.c 2013-11-01 16:12:34.223836702 +0000
2964@@ -0,0 +1,29 @@
2965+/* { dg-do compile } */
2966+/* { dg-options "-g -fPIC" } */
2967+
2968+void *v;
2969+void a (void *x) { }
2970+void b (void) { }
2971+ /* line 7. */
2972+int /* line 8. */
2973+main (int argc) /* line 9. */
2974+{ /* line 10. */
2975+ if (argc == 12345) /* line 11. */
2976+ {
2977+ a (v);
2978+ return 1;
2979+ }
2980+ b ();
2981+
2982+ return 0;
2983+}
2984+
2985+/* { dg-final { scan-assembler-not "\.loc 1 7 0" } } */
2986+/* { dg-final { scan-assembler-not "\.loc 1 8 0" } } */
2987+/* { dg-final { scan-assembler-not "\.loc 1 9 0" } } */
2988+
2989+/* The loc at the start of the prologue. */
2990+/* { dg-final { scan-assembler-times "\.loc 1 10 0" 1 } } */
2991+
2992+/* The loc at the end of the prologue, with the first user line. */
2993+/* { dg-final { scan-assembler-times "\.loc 1 11 0" 1 } } */
2994diff -Naur gcc-4.8.2.orig/gcc/testsuite/gcc.target/i386/pr30315.c gcc-4.8.2/gcc/testsuite/gcc.target/i386/pr30315.c
2995--- gcc-4.8.2.orig/gcc/testsuite/gcc.target/i386/pr30315.c 2007-08-14 14:39:24.000000000 +0000
2996+++ gcc-4.8.2/gcc/testsuite/gcc.target/i386/pr30315.c 2013-11-01 16:12:34.223836702 +0000
2997@@ -1,6 +1,6 @@
2998 /* { dg-do compile } */
2999 /* { dg-options "-O2" } */
3000-/* { dg-final { scan-assembler-times "cmp" 4 } } */
3001+/* { dg-final { scan-assembler-not "cmp" } } */
3002
3003 extern void abort (void);
3004 int c;
3005@@ -34,39 +34,10 @@
3006 }
3007 #define PLUSCCONLY(T, t) PLUSCCONLY1(T, t, a) PLUSCCONLY1(T, t, b)
3008
3009-#define MINUSCC(T, t) \
3010-T minuscc##t (T a, T b) \
3011-{ \
3012- T difference = a - b; \
3013- if (difference > a) \
3014- abort (); \
3015- return difference; \
3016-}
3017-
3018-#define DECCC(T, t) \
3019-T deccc##t (T a, T b) \
3020-{ \
3021- T difference = a - b; \
3022- if (difference > a) \
3023- c --; \
3024- return difference; \
3025-}
3026-
3027-#define MINUSCCONLY(T, t) \
3028-void minuscconly##t (T a, T b) \
3029-{ \
3030- T difference = a - b; \
3031- if (difference > a) \
3032- abort (); \
3033-}
3034-
3035 #define TEST(T, t) \
3036 PLUSCC(T, t) \
3037 PLUSCCONLY(T, t) \
3038- INCCC(T, t) \
3039- MINUSCC(T, t) \
3040- MINUSCCONLY(T, t) \
3041- DECCC(T, t)
3042+ INCCC(T, t)
3043
3044 TEST (unsigned long, l)
3045 TEST (unsigned int, i)
3046@@ -84,14 +55,3 @@
3047
3048 PLUSCCZEXT(a)
3049 PLUSCCZEXT(b)
3050-
3051-#define MINUSCCZEXT \
3052-unsigned long minuscczext (unsigned int a, unsigned int b) \
3053-{ \
3054- unsigned int difference = a - b; \
3055- if (difference > a) \
3056- abort (); \
3057- return difference; \
[2e59d11]3058-}
[88af5df]3059-
3060-MINUSCCZEXT
[2e59d11]3061diff -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
3062--- gcc-4.8.2.orig/gcc/testsuite/gcc.target/sh/pr54089-3.c 2012-09-10 20:35:25.000000000 +0000
3063+++ gcc-4.8.2/gcc/testsuite/gcc.target/sh/pr54089-3.c 2013-11-01 16:12:34.223836702 +0000
3064@@ -5,7 +5,7 @@
3065 /* { dg-options "-O1" } */
3066 /* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m1*" "-m2" "-m2e*" } } */
3067 /* { dg-final { scan-assembler-not "and" } } */
3068-/* { dg-final { scan-assembler-not "31" } } */
3069+/* { dg-final { scan-assembler-not "#31" } } */
3070
[88af5df]3071 int
3072 test00 (unsigned int a, int* b, int c, int* d, unsigned int e)
[2e59d11]3073diff -Naur gcc-4.8.2.orig/gcc/tree-ssa-pre.c gcc-4.8.2/gcc/tree-ssa-pre.c
3074--- gcc-4.8.2.orig/gcc/tree-ssa-pre.c 2013-02-19 06:43:34.000000000 +0000
3075+++ gcc-4.8.2/gcc/tree-ssa-pre.c 2013-11-01 16:12:34.227837390 +0000
3076@@ -3664,6 +3664,12 @@
3077 if (dump_file && dump_flags & TDF_DETAILS)
3078 fprintf (dump_file, "Starting insert iteration %d\n", num_iterations);
3079 new_stuff = insert_aux (ENTRY_BLOCK_PTR);
3080+
3081+ /* Clear the NEW sets before the next iteration. We have already
3082+ fully propagated its contents. */
3083+ if (new_stuff)
3084+ FOR_ALL_BB (bb)
3085+ bitmap_set_free (NEW_SETS (bb));
3086 }
[88af5df]3087 statistics_histogram_event (cfun, "insert iterations", num_iterations);
3088 }
[2e59d11]3089diff -Naur gcc-4.8.2.orig/gcc/tree-ssa-tail-merge.c gcc-4.8.2/gcc/tree-ssa-tail-merge.c
3090--- gcc-4.8.2.orig/gcc/tree-ssa-tail-merge.c 2013-01-31 08:52:56.000000000 +0000
3091+++ gcc-4.8.2/gcc/tree-ssa-tail-merge.c 2013-11-01 16:12:34.231838079 +0000
3092@@ -297,7 +297,8 @@
3093 tree val;
3094 def_operand_p def_p;
3095
3096- if (gimple_has_side_effects (stmt))
3097+ if (gimple_has_side_effects (stmt)
3098+ || gimple_vdef (stmt) != NULL_TREE)
3099 return false;
[88af5df]3100
3101 def_p = SINGLE_SSA_DEF_OPERAND (stmt, SSA_OP_DEF);
[2e59d11]3102diff -Naur gcc-4.8.2.orig/gcc/version.c gcc-4.8.2/gcc/version.c
3103--- gcc-4.8.2.orig/gcc/version.c 2013-01-10 20:38:27.000000000 +0000
3104+++ gcc-4.8.2/gcc/version.c 2013-11-01 16:12:34.231838079 +0000
3105@@ -32,4 +32,4 @@
3106 Makefile. */
[88af5df]3107
[2e59d11]3108 const char version_string[] = BASEVER DATESTAMP DEVPHASE REVISION;
[88af5df]3109-const char pkgversion_string[] = PKGVERSION;
3110+const char pkgversion_string[] = "(GCC for Cross-LFS 4.8.2.20131101) ";
[2e59d11]3111diff -Naur gcc-4.8.2.orig/libffi/doc/libffi.info gcc-4.8.2/libffi/doc/libffi.info
3112--- gcc-4.8.2.orig/libffi/doc/libffi.info 2013-10-16 08:21:34.000000000 +0000
3113+++ gcc-4.8.2/libffi/doc/libffi.info 1970-01-01 00:00:00.000000000 +0000
3114@@ -1,614 +0,0 @@
3115-This is libffi.info, produced by makeinfo version 5.1 from libffi.texi.
3116-
3117-This manual is for Libffi, a portable foreign-function interface
3118-library.
3119-
3120- Copyright (C) 2008, 2010, 2011 Red Hat, Inc.
3121-
3122- Permission is granted to copy, distribute and/or modify this
3123- document under the terms of the GNU General Public License as
3124- published by the Free Software Foundation; either version 2, or (at
3125- your option) any later version. A copy of the license is included
3126- in the section entitled "GNU General Public License".
3127-
3128-INFO-DIR-SECTION Development
3129-START-INFO-DIR-ENTRY
3130-* libffi: (libffi). Portable foreign-function interface library.
3131-END-INFO-DIR-ENTRY
3132-
3133-
3134-File: libffi.info, Node: Top, Next: Introduction, Up: (dir)
3135-
3136-libffi
3137-******
3138-
3139-This manual is for Libffi, a portable foreign-function interface
3140-library.
3141-
3142- Copyright (C) 2008, 2010, 2011 Red Hat, Inc.
3143-
3144- Permission is granted to copy, distribute and/or modify this
3145- document under the terms of the GNU General Public License as
3146- published by the Free Software Foundation; either version 2, or (at
3147- your option) any later version. A copy of the license is included
3148- in the section entitled "GNU General Public License".
3149-
3150-* Menu:
3151-
3152-* Introduction:: What is libffi?
3153-* Using libffi:: How to use libffi.
3154-* Missing Features:: Things libffi can't do.
3155-* Index:: Index.
3156-
3157-
3158-File: libffi.info, Node: Introduction, Next: Using libffi, Prev: Top, Up: Top
3159-
3160-1 What is libffi?
3161-*****************
3162-
3163-Compilers for high level languages generate code that follow certain
3164-conventions. These conventions are necessary, in part, for separate
3165-compilation to work. One such convention is the "calling convention".
3166-The calling convention is a set of assumptions made by the compiler
3167-about where function arguments will be found on entry to a function. A
3168-calling convention also specifies where the return value for a function
3169-is found. The calling convention is also sometimes called the "ABI" or
3170-"Application Binary Interface".
3171-
3172- Some programs may not know at the time of compilation what arguments
3173-are to be passed to a function. For instance, an interpreter may be
3174-told at run-time about the number and types of arguments used to call a
3175-given function. 'Libffi' can be used in such programs to provide a
3176-bridge from the interpreter program to compiled code.
3177-
3178- The 'libffi' library provides a portable, high level programming
3179-interface to various calling conventions. This allows a programmer to
3180-call any function specified by a call interface description at run time.
3181-
3182- FFI stands for Foreign Function Interface. A foreign function
3183-interface is the popular name for the interface that allows code written
3184-in one language to call code written in another language. The 'libffi'
3185-library really only provides the lowest, machine dependent layer of a
3186-fully featured foreign function interface. A layer must exist above
3187-'libffi' that handles type conversions for values passed between the two
3188-languages.
3189-
3190-
3191-File: libffi.info, Node: Using libffi, Next: Missing Features, Prev: Introduction, Up: Top
3192-
3193-2 Using libffi
3194-**************
3195-
3196-* Menu:
3197-
3198-* The Basics:: The basic libffi API.
3199-* Simple Example:: A simple example.
3200-* Types:: libffi type descriptions.
3201-* Multiple ABIs:: Different passing styles on one platform.
3202-* The Closure API:: Writing a generic function.
3203-* Closure Example:: A closure example.
3204-
3205-
3206-File: libffi.info, Node: The Basics, Next: Simple Example, Up: Using libffi
3207-
3208-2.1 The Basics
3209-==============
3210-
3211-'Libffi' assumes that you have a pointer to the function you wish to
3212-call and that you know the number and types of arguments to pass it, as
3213-well as the return type of the function.
3214-
3215- The first thing you must do is create an 'ffi_cif' object that
3216-matches the signature of the function you wish to call. This is a
3217-separate step because it is common to make multiple calls using a single
3218-'ffi_cif'. The "cif" in 'ffi_cif' stands for Call InterFace. To
3219-prepare a call interface object, use the function 'ffi_prep_cif'.
3220-
3221- -- Function: ffi_status ffi_prep_cif (ffi_cif *CIF, ffi_abi ABI,
3222- unsigned int NARGS, ffi_type *RTYPE, ffi_type **ARGTYPES)
3223- This initializes CIF according to the given parameters.
3224-
3225- ABI is the ABI to use; normally 'FFI_DEFAULT_ABI' is what you want.
3226- *note Multiple ABIs:: for more information.
3227-
3228- NARGS is the number of arguments that this function accepts.
3229-
3230- RTYPE is a pointer to an 'ffi_type' structure that describes the
3231- return type of the function. *Note Types::.
3232-
3233- ARGTYPES is a vector of 'ffi_type' pointers. ARGTYPES must have
3234- NARGS elements. If NARGS is 0, this argument is ignored.
3235-
3236- 'ffi_prep_cif' returns a 'libffi' status code, of type
3237- 'ffi_status'. This will be either 'FFI_OK' if everything worked
3238- properly; 'FFI_BAD_TYPEDEF' if one of the 'ffi_type' objects is
3239- incorrect; or 'FFI_BAD_ABI' if the ABI parameter is invalid.
3240-
3241- If the function being called is variadic (varargs) then
3242-'ffi_prep_cif_var' must be used instead of 'ffi_prep_cif'.
3243-
3244- -- Function: ffi_status ffi_prep_cif_var (ffi_cif *CIF, ffi_abi varabi,
3245- unsigned int NFIXEDARGS, unsigned int varntotalargs, ffi_type
3246- *RTYPE, ffi_type **ARGTYPES)
3247- This initializes CIF according to the given parameters for a call
3248- to a variadic function. In general it's operation is the same as
3249- for 'ffi_prep_cif' except that:
3250-
3251- NFIXEDARGS is the number of fixed arguments, prior to any variadic
3252- arguments. It must be greater than zero.
3253-
3254- NTOTALARGS the total number of arguments, including variadic and
3255- fixed arguments.
3256-
3257- Note that, different cif's must be prepped for calls to the same
3258- function when different numbers of arguments are passed.
3259-
3260- Also note that a call to 'ffi_prep_cif_var' with
3261- NFIXEDARGS=NOTOTALARGS is NOT equivalent to a call to
3262- 'ffi_prep_cif'.
3263-
3264- To call a function using an initialized 'ffi_cif', use the 'ffi_call'
3265-function:
3266-
3267- -- Function: void ffi_call (ffi_cif *CIF, void *FN, void *RVALUE, void
3268- **AVALUES)
3269- This calls the function FN according to the description given in
3270- CIF. CIF must have already been prepared using 'ffi_prep_cif'.
3271-
3272- RVALUE is a pointer to a chunk of memory that will hold the result
3273- of the function call. This must be large enough to hold the result
3274- and must be suitably aligned; it is the caller's responsibility to
3275- ensure this. If CIF declares that the function returns 'void'
3276- (using 'ffi_type_void'), then RVALUE is ignored. If RVALUE is
3277- 'NULL', then the return value is discarded.
3278-
3279- AVALUES is a vector of 'void *' pointers that point to the memory
3280- locations holding the argument values for a call. If CIF declares
3281- that the function has no arguments (i.e., NARGS was 0), then
3282- AVALUES is ignored. Note that argument values may be modified by
3283- the callee (for instance, structs passed by value); the burden of
3284- copying pass-by-value arguments is placed on the caller.
3285-
3286-
3287-File: libffi.info, Node: Simple Example, Next: Types, Prev: The Basics, Up: Using libffi
3288-
3289-2.2 Simple Example
3290-==================
3291-
3292-Here is a trivial example that calls 'puts' a few times.
3293-
3294- #include <stdio.h>
3295- #include <ffi.h>
3296-
3297- int main()
3298- {
3299- ffi_cif cif;
3300- ffi_type *args[1];
3301- void *values[1];
3302- char *s;
3303- int rc;
3304-
3305- /* Initialize the argument info vectors */
3306- args[0] = &ffi_type_pointer;
3307- values[0] = &s;
3308-
3309- /* Initialize the cif */
3310- if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
3311- &ffi_type_uint, args) == FFI_OK)
3312- {
3313- s = "Hello World!";
3314- ffi_call(&cif, puts, &rc, values);
3315- /* rc now holds the result of the call to puts */
3316-
3317- /* values holds a pointer to the function's arg, so to
3318- call puts() again all we need to do is change the
3319- value of s */
3320- s = "This is cool!";
3321- ffi_call(&cif, puts, &rc, values);
3322- }
3323-
3324- return 0;
3325- }
3326-
3327-
3328-File: libffi.info, Node: Types, Next: Multiple ABIs, Prev: Simple Example, Up: Using libffi
3329-
3330-2.3 Types
3331-=========
3332-
3333-* Menu:
3334-
3335-* Primitive Types:: Built-in types.
3336-* Structures:: Structure types.
3337-* Type Example:: Structure type example.
3338-
3339-
3340-File: libffi.info, Node: Primitive Types, Next: Structures, Up: Types
3341-
3342-2.3.1 Primitive Types
3343----------------------
3344-
3345-'Libffi' provides a number of built-in type descriptors that can be used
3346-to describe argument and return types:
3347-
3348-'ffi_type_void'
3349- The type 'void'. This cannot be used for argument types, only for
3350- return values.
3351-
3352-'ffi_type_uint8'
3353- An unsigned, 8-bit integer type.
3354-
3355-'ffi_type_sint8'
3356- A signed, 8-bit integer type.
3357-
3358-'ffi_type_uint16'
3359- An unsigned, 16-bit integer type.
3360-
3361-'ffi_type_sint16'
3362- A signed, 16-bit integer type.
3363-
3364-'ffi_type_uint32'
3365- An unsigned, 32-bit integer type.
3366-
3367-'ffi_type_sint32'
3368- A signed, 32-bit integer type.
3369-
3370-'ffi_type_uint64'
3371- An unsigned, 64-bit integer type.
3372-
3373-'ffi_type_sint64'
3374- A signed, 64-bit integer type.
3375-
3376-'ffi_type_float'
3377- The C 'float' type.
3378-
3379-'ffi_type_double'
3380- The C 'double' type.
3381-
3382-'ffi_type_uchar'
3383- The C 'unsigned char' type.
3384-
3385-'ffi_type_schar'
3386- The C 'signed char' type. (Note that there is not an exact
3387- equivalent to the C 'char' type in 'libffi'; ordinarily you should
3388- either use 'ffi_type_schar' or 'ffi_type_uchar' depending on
3389- whether 'char' is signed.)
3390-
3391-'ffi_type_ushort'
3392- The C 'unsigned short' type.
3393-
3394-'ffi_type_sshort'
3395- The C 'short' type.
3396-
3397-'ffi_type_uint'
3398- The C 'unsigned int' type.
3399-
3400-'ffi_type_sint'
3401- The C 'int' type.
3402-
3403-'ffi_type_ulong'
3404- The C 'unsigned long' type.
3405-
3406-'ffi_type_slong'
3407- The C 'long' type.
3408-
3409-'ffi_type_longdouble'
3410- On platforms that have a C 'long double' type, this is defined. On
3411- other platforms, it is not.
3412-
3413-'ffi_type_pointer'
3414- A generic 'void *' pointer. You should use this for all pointers,
3415- regardless of their real type.
3416-
3417- Each of these is of type 'ffi_type', so you must take the address
3418-when passing to 'ffi_prep_cif'.
3419-
3420-
3421-File: libffi.info, Node: Structures, Next: Type Example, Prev: Primitive Types, Up: Types
3422-
3423-2.3.2 Structures
3424-----------------
3425-
3426-Although 'libffi' has no special support for unions or bit-fields, it is
3427-perfectly happy passing structures back and forth. You must first
3428-describe the structure to 'libffi' by creating a new 'ffi_type' object
3429-for it.
3430-
3431- -- ffi_type:
3432- The 'ffi_type' has the following members:
3433- 'size_t size'
3434- This is set by 'libffi'; you should initialize it to zero.
3435-
3436- 'unsigned short alignment'
3437- This is set by 'libffi'; you should initialize it to zero.
3438-
3439- 'unsigned short type'
3440- For a structure, this should be set to 'FFI_TYPE_STRUCT'.
3441-
3442- 'ffi_type **elements'
3443- This is a 'NULL'-terminated array of pointers to 'ffi_type'
3444- objects. There is one element per field of the struct.
3445-
3446-
3447-File: libffi.info, Node: Type Example, Prev: Structures, Up: Types
3448-
3449-2.3.3 Type Example
3450-------------------
3451-
3452-The following example initializes a 'ffi_type' object representing the
3453-'tm' struct from Linux's 'time.h'.
3454-
3455- Here is how the struct is defined:
3456-
3457- struct tm {
3458- int tm_sec;
3459- int tm_min;
3460- int tm_hour;
3461- int tm_mday;
3462- int tm_mon;
3463- int tm_year;
3464- int tm_wday;
3465- int tm_yday;
3466- int tm_isdst;
3467- /* Those are for future use. */
3468- long int __tm_gmtoff__;
3469- __const char *__tm_zone__;
3470- };
3471-
3472- Here is the corresponding code to describe this struct to 'libffi':
3473-
3474- {
3475- ffi_type tm_type;
3476- ffi_type *tm_type_elements[12];
3477- int i;
3478-
3479- tm_type.size = tm_type.alignment = 0;
3480- tm_type.elements = &tm_type_elements;
3481-
3482- for (i = 0; i < 9; i++)
3483- tm_type_elements[i] = &ffi_type_sint;
3484-
3485- tm_type_elements[9] = &ffi_type_slong;
3486- tm_type_elements[10] = &ffi_type_pointer;
3487- tm_type_elements[11] = NULL;
3488-
3489- /* tm_type can now be used to represent tm argument types and
3490- return types for ffi_prep_cif() */
3491- }
3492-
3493-
3494-File: libffi.info, Node: Multiple ABIs, Next: The Closure API, Prev: Types, Up: Using libffi
3495-
3496-2.4 Multiple ABIs
3497-=================
3498-
3499-A given platform may provide multiple different ABIs at once. For
3500-instance, the x86 platform has both 'stdcall' and 'fastcall' functions.
3501-
3502- 'libffi' provides some support for this. However, this is
3503-necessarily platform-specific.
3504-
3505-
3506-File: libffi.info, Node: The Closure API, Next: Closure Example, Prev: Multiple ABIs, Up: Using libffi
3507-
3508-2.5 The Closure API
3509-===================
3510-
3511-'libffi' also provides a way to write a generic function - a function
3512-that can accept and decode any combination of arguments. This can be
3513-useful when writing an interpreter, or to provide wrappers for arbitrary
3514-functions.
3515-
3516- This facility is called the "closure API". Closures are not supported
3517-on all platforms; you can check the 'FFI_CLOSURES' define to determine
3518-whether they are supported on the current platform.
3519-
3520- Because closures work by assembling a tiny function at runtime, they
3521-require special allocation on platforms that have a non-executable heap.
3522-Memory management for closures is handled by a pair of functions:
3523-
3524- -- Function: void *ffi_closure_alloc (size_t SIZE, void **CODE)
3525- Allocate a chunk of memory holding SIZE bytes. This returns a
3526- pointer to the writable address, and sets *CODE to the
3527- corresponding executable address.
3528-
3529- SIZE should be sufficient to hold a 'ffi_closure' object.
3530-
3531- -- Function: void ffi_closure_free (void *WRITABLE)
3532- Free memory allocated using 'ffi_closure_alloc'. The argument is
3533- the writable address that was returned.
3534-
3535- Once you have allocated the memory for a closure, you must construct
3536-a 'ffi_cif' describing the function call. Finally you can prepare the
3537-closure function:
3538-
3539- -- Function: ffi_status ffi_prep_closure_loc (ffi_closure *CLOSURE,
3540- ffi_cif *CIF, void (*FUN) (ffi_cif *CIF, void *RET, void
3541- **ARGS, void *USER_DATA), void *USER_DATA, void *CODELOC)
3542- Prepare a closure function.
3543-
3544- CLOSURE is the address of a 'ffi_closure' object; this is the
3545- writable address returned by 'ffi_closure_alloc'.
3546-
3547- CIF is the 'ffi_cif' describing the function parameters.
3548-
3549- USER_DATA is an arbitrary datum that is passed, uninterpreted, to
3550- your closure function.
3551-
3552- CODELOC is the executable address returned by 'ffi_closure_alloc'.
3553-
3554- FUN is the function which will be called when the closure is
3555- invoked. It is called with the arguments:
3556- CIF
3557- The 'ffi_cif' passed to 'ffi_prep_closure_loc'.
3558-
3559- RET
3560- A pointer to the memory used for the function's return value.
3561- FUN must fill this, unless the function is declared as
3562- returning 'void'.
3563-
3564- ARGS
3565- A vector of pointers to memory holding the arguments to the
3566- function.
3567-
3568- USER_DATA
3569- The same USER_DATA that was passed to 'ffi_prep_closure_loc'.
3570-
3571- 'ffi_prep_closure_loc' will return 'FFI_OK' if everything went ok,
3572- and something else on error.
3573-
3574- After calling 'ffi_prep_closure_loc', you can cast CODELOC to the
3575- appropriate pointer-to-function type.
3576-
3577- You may see old code referring to 'ffi_prep_closure'. This function
3578-is deprecated, as it cannot handle the need for separate writable and
3579-executable addresses.
3580-
3581-
3582-File: libffi.info, Node: Closure Example, Prev: The Closure API, Up: Using libffi
3583-
3584-2.6 Closure Example
3585-===================
3586-
3587-A trivial example that creates a new 'puts' by binding 'fputs' with
3588-'stdin'.
3589-
3590- #include <stdio.h>
3591- #include <ffi.h>
3592-
3593- /* Acts like puts with the file given at time of enclosure. */
3594- void puts_binding(ffi_cif *cif, unsigned int *ret, void* args[],
3595- FILE *stream)
3596- {
3597- *ret = fputs(*(char **)args[0], stream);
3598- }
3599-
3600- int main()
3601- {
3602- ffi_cif cif;
3603- ffi_type *args[1];
3604- ffi_closure *closure;
3605-
3606- int (*bound_puts)(char *);
3607- int rc;
3608-
3609- /* Allocate closure and bound_puts */
3610- closure = ffi_closure_alloc(sizeof(ffi_closure), &bound_puts);
3611-
3612- if (closure)
3613- {
3614- /* Initialize the argument info vectors */
3615- args[0] = &ffi_type_pointer;
3616-
3617- /* Initialize the cif */
3618- if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
3619- &ffi_type_uint, args) == FFI_OK)
3620- {
3621- /* Initialize the closure, setting stream to stdout */
3622- if (ffi_prep_closure_loc(closure, &cif, puts_binding,
3623- stdout, bound_puts) == FFI_OK)
3624- {
3625- rc = bound_puts("Hello World!");
3626- /* rc now holds the result of the call to fputs */
3627- }
3628- }
3629- }
3630-
3631- /* Deallocate both closure, and bound_puts */
3632- ffi_closure_free(closure);
3633-
3634- return 0;
3635- }
3636-
3637-
3638-File: libffi.info, Node: Missing Features, Next: Index, Prev: Using libffi, Up: Top
3639-
3640-3 Missing Features
3641-******************
3642-
3643-'libffi' is missing a few features. We welcome patches to add support
3644-for these.
3645-
3646- * Variadic closures.
3647-
3648- * There is no support for bit fields in structures.
3649-
3650- * The closure API is
3651-
3652- * The "raw" API is undocumented.
3653-
3654- Note that variadic support is very new and tested on a relatively
3655-small number of platforms.
3656-
3657-
3658-File: libffi.info, Node: Index, Prev: Missing Features, Up: Top
3659-
3660-Index
3661-*****
3662-
3663-[index]
3664-* Menu:
3665-
3666-* ABI: Introduction. (line 13)
3667-* Application Binary Interface: Introduction. (line 13)
3668-* calling convention: Introduction. (line 13)
3669-* cif: The Basics. (line 14)
3670-* closure API: The Closure API. (line 13)
3671-* closures: The Closure API. (line 13)
3672-* FFI: Introduction. (line 31)
3673-* ffi_call: The Basics. (line 62)
3674-* FFI_CLOSURES: The Closure API. (line 13)
3675-* ffi_closure_alloc: The Closure API. (line 19)
3676-* ffi_closure_free: The Closure API. (line 26)
3677-* ffi_prep_cif: The Basics. (line 16)
3678-* ffi_prep_cif_var: The Basics. (line 39)
3679-* ffi_prep_closure_loc: The Closure API. (line 34)
3680-* ffi_status: The Basics. (line 16)
3681-* ffi_status <1>: The Basics. (line 39)
3682-* ffi_status <2>: The Closure API. (line 34)
3683-* ffi_type: Structures. (line 11)
3684-* ffi_type_double: Primitive Types. (line 41)
3685-* ffi_type_float: Primitive Types. (line 38)
3686-* ffi_type_longdouble: Primitive Types. (line 71)
3687-* ffi_type_pointer: Primitive Types. (line 75)
3688-* ffi_type_schar: Primitive Types. (line 47)
3689-* ffi_type_sint: Primitive Types. (line 62)
3690-* ffi_type_sint16: Primitive Types. (line 23)
3691-* ffi_type_sint32: Primitive Types. (line 29)
3692-* ffi_type_sint64: Primitive Types. (line 35)
3693-* ffi_type_sint8: Primitive Types. (line 17)
3694-* ffi_type_slong: Primitive Types. (line 68)
3695-* ffi_type_sshort: Primitive Types. (line 56)
3696-* ffi_type_uchar: Primitive Types. (line 44)
3697-* ffi_type_uint: Primitive Types. (line 59)
3698-* ffi_type_uint16: Primitive Types. (line 20)
3699-* ffi_type_uint32: Primitive Types. (line 26)
3700-* ffi_type_uint64: Primitive Types. (line 32)
3701-* ffi_type_uint8: Primitive Types. (line 14)
3702-* ffi_type_ulong: Primitive Types. (line 65)
3703-* ffi_type_ushort: Primitive Types. (line 53)
3704-* ffi_type_void: Primitive Types. (line 10)
3705-* Foreign Function Interface: Introduction. (line 31)
3706-* void: The Basics. (line 62)
3707-* void <1>: The Closure API. (line 19)
3708-* void <2>: The Closure API. (line 26)
3709-
3710-
3711-
3712-Tag Table:
3713-Node: Top682
3714-Node: Introduction1429
3715-Node: Using libffi3061
3716-Node: The Basics3547
3717-Node: Simple Example7187
3718-Node: Types8214
3719-Node: Primitive Types8497
3720-Node: Structures10318
3721-Node: Type Example11182
3722-Node: Multiple ABIs12405
3723-Node: The Closure API12776
3724-Node: Closure Example15720
3725-Node: Missing Features17279
[88af5df]3726-Node: Index17732
3727-
3728-End Tag Table
3729diff -Naur gcc-4.8.2.orig/libgo/Makefile.am gcc-4.8.2/libgo/Makefile.am
3730--- gcc-4.8.2.orig/libgo/Makefile.am 2013-09-27 21:34:43.000000000 +0000
3731+++ gcc-4.8.2/libgo/Makefile.am 2013-11-01 16:12:34.291848407 +0000
3732@@ -424,6 +424,7 @@
3733 runtime/go-caller.c \
3734 runtime/go-callers.c \
3735 runtime/go-can-convert-interface.c \
3736+ runtime/go-cdiv.c \
3737 runtime/go-cgo.c \
3738 runtime/go-check-interface.c \
3739 runtime/go-construct-map.c \
3740diff -Naur gcc-4.8.2.orig/libgo/Makefile.in gcc-4.8.2/libgo/Makefile.in
3741--- gcc-4.8.2.orig/libgo/Makefile.in 2013-09-27 21:34:43.000000000 +0000
3742+++ gcc-4.8.2/libgo/Makefile.in 2013-11-01 16:12:34.299849784 +0000
3743@@ -195,7 +195,7 @@
3744 @LIBGO_IS_LINUX_TRUE@am__objects_5 = getncpu-linux.lo
3745 am__objects_6 = go-append.lo go-assert.lo go-assert-interface.lo \
3746 go-byte-array-to-string.lo go-breakpoint.lo go-caller.lo \
3747- go-callers.lo go-can-convert-interface.lo go-cgo.lo \
3748+ go-callers.lo go-can-convert-interface.lo go-cdiv.lo go-cgo.lo \
3749 go-check-interface.lo go-construct-map.lo \
3750 go-convert-interface.lo go-copy.lo go-defer.lo \
3751 go-deferred-recover.lo go-eface-compare.lo \
3752@@ -757,6 +757,7 @@
3753 runtime/go-caller.c \
3754 runtime/go-callers.c \
3755 runtime/go-can-convert-interface.c \
3756+ runtime/go-cdiv.c \
3757 runtime/go-cgo.c \
3758 runtime/go-check-interface.c \
3759 runtime/go-construct-map.c \
3760@@ -2368,6 +2369,7 @@
3761 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-caller.Plo@am__quote@
3762 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-callers.Plo@am__quote@
3763 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-can-convert-interface.Plo@am__quote@
3764+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-cdiv.Plo@am__quote@
3765 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-cgo.Plo@am__quote@
3766 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-check-interface.Plo@am__quote@
3767 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-construct-map.Plo@am__quote@
3768@@ -2554,6 +2556,13 @@
3769 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
3770 @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
3771
3772+go-cdiv.lo: runtime/go-cdiv.c
3773+@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
3774+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-cdiv.Tpo $(DEPDIR)/go-cdiv.Plo
3775+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-cdiv.c' object='go-cdiv.lo' libtool=yes @AMDEPBACKSLASH@
3776+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
3777+@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
3778+
[2e59d11]3779 go-cgo.lo: runtime/go-cgo.c
[88af5df]3780 @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
3781 @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-cgo.Tpo $(DEPDIR)/go-cgo.Plo
[2e59d11]3782diff -Naur gcc-4.8.2.orig/libgo/config.h.in gcc-4.8.2/libgo/config.h.in
3783--- gcc-4.8.2.orig/libgo/config.h.in 2013-10-02 17:32:00.000000000 +0000
3784+++ gcc-4.8.2/libgo/config.h.in 2013-11-01 16:12:34.235838767 +0000
3785@@ -39,6 +39,9 @@
3786 /* Define to 1 if you have the `dl_iterate_phdr' function. */
3787 #undef HAVE_DL_ITERATE_PHDR
3788
3789+/* Define to 1 if you have the `dup3' function. */
3790+#undef HAVE_DUP3
3791+
3792 /* Define to 1 if you have the `epoll_create1' function. */
3793 #undef HAVE_EPOLL_CREATE1
3794
3795@@ -66,6 +69,9 @@
3796 /* Define if _Unwind_GetIPInfo is available. */
3797 #undef HAVE_GETIPINFO
3798
3799+/* Define to 1 if you have the `getxattr' function. */
3800+#undef HAVE_GETXATTR
3801+
3802 /* Define to 1 if you have the `inotify_add_watch' function. */
3803 #undef HAVE_INOTIFY_ADD_WATCH
3804
3805@@ -111,6 +117,9 @@
3806 /* Define to 1 if you have the <linux/rtnetlink.h> header file. */
3807 #undef HAVE_LINUX_RTNETLINK_H
3808
3809+/* Define to 1 if you have the `listxattr' function. */
3810+#undef HAVE_LISTXATTR
3811+
3812 /* Define to 1 if the system has the type `loff_t'. */
3813 #undef HAVE_LOFF_T
3814
3815@@ -171,6 +180,9 @@
3816 /* Define to 1 if you have the `pipe2' function. */
3817 #undef HAVE_PIPE2
3818
3819+/* Define to 1 if you have the `removexattr' function. */
3820+#undef HAVE_REMOVEXATTR
3821+
3822 /* Define to 1 if you have the `renameat' function. */
3823 #undef HAVE_RENAMEAT
3824
3825@@ -180,6 +192,9 @@
3826 /* Define to 1 if you have the `setenv' function. */
3827 #undef HAVE_SETENV
3828
3829+/* Define to 1 if you have the `setxattr' function. */
3830+#undef HAVE_SETXATTR
3831+
3832 /* Define to 1 if you have the `sinl' function. */
[88af5df]3833 #undef HAVE_SINL
3834
[2e59d11]3835diff -Naur gcc-4.8.2.orig/libgo/configure gcc-4.8.2/libgo/configure
3836--- gcc-4.8.2.orig/libgo/configure 2013-10-02 17:32:00.000000000 +0000
3837+++ gcc-4.8.2/libgo/configure 2013-11-01 16:12:34.243840144 +0000
3838@@ -14700,7 +14700,7 @@
3839 fi
3840
3841
3842-for ac_func in accept4 epoll_create1 faccessat fallocate fchmodat fchownat futimesat inotify_add_watch inotify_init inotify_init1 inotify_rm_watch mkdirat mknodat openat pipe2 renameat sync_file_range splice tee unlinkat unshare utimensat
3843+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
3844 do :
[88af5df]3845 as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
3846 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
[2e59d11]3847diff -Naur gcc-4.8.2.orig/libgo/configure.ac gcc-4.8.2/libgo/configure.ac
3848--- gcc-4.8.2.orig/libgo/configure.ac 2013-10-02 17:32:00.000000000 +0000
3849+++ gcc-4.8.2/libgo/configure.ac 2013-11-01 16:12:34.291848407 +0000
3850@@ -503,7 +503,7 @@
3851 AM_CONDITIONAL(HAVE_STRERROR_R, test "$ac_cv_func_strerror_r" = yes)
3852 AM_CONDITIONAL(HAVE_WAIT4, test "$ac_cv_func_wait4" = yes)
3853
3854-AC_CHECK_FUNCS(accept4 epoll_create1 faccessat fallocate fchmodat fchownat futimesat inotify_add_watch inotify_init inotify_init1 inotify_rm_watch mkdirat mknodat openat pipe2 renameat sync_file_range splice tee unlinkat unshare utimensat)
3855+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)
3856 AC_TYPE_OFF_T
[88af5df]3857 AC_CHECK_TYPES([loff_t])
3858
[2e59d11]3859diff -Naur gcc-4.8.2.orig/libgo/go/syscall/libcall_linux.go gcc-4.8.2/libgo/go/syscall/libcall_linux.go
3860--- gcc-4.8.2.orig/libgo/go/syscall/libcall_linux.go 2013-02-08 19:24:26.000000000 +0000
3861+++ gcc-4.8.2/libgo/go/syscall/libcall_linux.go 2013-11-01 16:12:34.291848407 +0000
3862@@ -190,6 +190,9 @@
3863 //sys Adjtimex(buf *Timex) (state int, err error)
3864 //adjtimex(buf *Timex) _C_int
3865
3866+//sysnb Dup3(oldfd int, newfd int, flags int) (err error)
3867+//dup3(oldfd _C_int, newfd _C_int, flags _C_int) _C_int
3868+
3869 //sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error)
3870 //faccessat(dirfd _C_int, pathname *byte, mode _C_int, flags _C_int) _C_int
3871
3872@@ -268,6 +271,9 @@
3873 return origlen - len(buf), count, names
3874 }
3875
3876+//sys Getxattr(path string, attr string, dest []byte) (sz int, err error)
3877+//getxattr(path *byte, attr *byte, buf *byte, count Size_t) Ssize_t
3878+
3879 //sys InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error)
3880 //inotify_add_watch(fd _C_int, pathname *byte, mask uint32) _C_int
3881
3882@@ -283,6 +289,9 @@
3883 //sys Klogctl(typ int, buf []byte) (n int, err error)
3884 //klogctl(typ _C_int, bufp *byte, len _C_int) _C_int
3885
3886+//sys Listxattr(path string, dest []byte) (sz int, err error)
3887+//listxattr(path *byte, list *byte, size Size_t) Ssize_t
3888+
3889 //sys Mkdirat(dirfd int, path string, mode uint32) (err error)
3890 //mkdirat(dirfd _C_int, path *byte, mode Mode_t) _C_int
3891
3892@@ -305,6 +314,9 @@
3893 //sys PivotRoot(newroot string, putold string) (err error)
3894 //pivot_root(newroot *byte, putold *byte) _C_int
3895
3896+//sys Removexattr(path string, attr string) (err error)
3897+//removexattr(path *byte, name *byte) _C_int
3898+
3899 //sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
3900 //renameat(olddirfd _C_int, oldpath *byte, newdirfd _C_int, newpath *byte) _C_int
3901
3902@@ -338,6 +350,9 @@
3903 //sysnb Setresuid(ruid int, eguid int, suid int) (err error)
3904 //setresuid(ruid Uid_t, euid Uid_t, suid Uid_t) _C_int
3905
3906+//sys Setxattr(path string, attr string, data []byte, flags int) (err error)
3907+//setxattr(path *byte, name *byte, value *byte, size Size_t, flags _C_int) _C_int
3908+
3909 //sys splice(rfd int, roff *_loff_t, wfd int, woff *_loff_t, len int, flags int) (n int64, err error)
[88af5df]3910 //splice(rfd _C_int, roff *_loff_t, wfd _C_int, woff *_loff_t, len Size_t, flags _C_uint) Ssize_t
3911 func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) {
[2e59d11]3912diff -Naur gcc-4.8.2.orig/libgo/go/syscall/libcall_posix.go gcc-4.8.2/libgo/go/syscall/libcall_posix.go
3913--- gcc-4.8.2.orig/libgo/go/syscall/libcall_posix.go 2013-02-08 19:24:26.000000000 +0000
3914+++ gcc-4.8.2/libgo/go/syscall/libcall_posix.go 2013-11-01 16:12:34.291848407 +0000
3915@@ -238,6 +238,9 @@
3916 //sysnb Getppid() (ppid int)
3917 //getppid() Pid_t
3918
3919+//sys Getpriority(which int, who int) (prio int, err error)
3920+//getpriority(which _C_int, who _C_int) _C_int
3921+
3922 //sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
3923 //getrlimit(resource _C_int, rlim *Rlimit) _C_int
3924
3925@@ -307,6 +310,9 @@
3926 //sysnb Setpgid(pid int, pgid int) (err error)
3927 //setpgid(pid Pid_t, pgid Pid_t) _C_int
3928
3929+//sys Setpriority(which int, who int, prio int) (err error)
3930+//setpriority(which _C_int, who _C_int, prio _C_int) _C_int
3931+
3932 //sysnb Setreuid(ruid int, euid int) (err error)
[88af5df]3933 //setreuid(ruid Uid_t, euid Uid_t) _C_int
3934
[2e59d11]3935diff -Naur gcc-4.8.2.orig/libgo/mksysinfo.sh gcc-4.8.2/libgo/mksysinfo.sh
3936--- gcc-4.8.2.orig/libgo/mksysinfo.sh 2013-02-11 19:03:04.000000000 +0000
3937+++ gcc-4.8.2/libgo/mksysinfo.sh 2013-11-01 16:12:34.299849784 +0000
3938@@ -1035,6 +1035,10 @@
3939 grep '^const _LOCK_' gen-sysinfo.go |
3940 sed -e 's/^\(const \)_\(LOCK_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}
3941
3942+# The PRIO constants.
3943+grep '^const _PRIO_' gen-sysinfo.go | \
3944+ sed -e 's/^\(const \)_\(PRIO_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}
3945+
3946 # The GNU/Linux LINUX_REBOOT flags.
[88af5df]3947 grep '^const _LINUX_REBOOT_' gen-sysinfo.go |
3948 sed -e 's/^\(const \)_\(LINUX_REBOOT_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}
[2e59d11]3949diff -Naur gcc-4.8.2.orig/libgo/runtime/go-cdiv.c gcc-4.8.2/libgo/runtime/go-cdiv.c
3950--- gcc-4.8.2.orig/libgo/runtime/go-cdiv.c 1970-01-01 00:00:00.000000000 +0000
3951+++ gcc-4.8.2/libgo/runtime/go-cdiv.c 2013-11-01 16:12:34.299849784 +0000
3952@@ -0,0 +1,46 @@
3953+/* go-cdiv.c -- complex division routines
3954+
3955+ Copyright 2013 The Go Authors. All rights reserved.
3956+ Use of this source code is governed by a BSD-style
3957+ license that can be found in the LICENSE file. */
3958+
3959+/* Calls to these functions are generated by the Go frontend for
3960+ division of complex64 or complex128. We use these because Go's
3961+ complex division expects slightly different results from the GCC
3962+ default. When dividing NaN+1.0i / 0+0i, Go expects NaN+NaNi but
3963+ GCC generates NaN+Infi. NaN+Infi seems wrong seems the rules of
3964+ C99 Annex G specify that if either side of a complex number is Inf,
3965+ the the whole number is Inf, but an operation involving NaN ought
3966+ to result in NaN, not Inf. */
3967+
3968+__complex float
3969+__go_complex64_div (__complex float a, __complex float b)
3970+{
3971+ if (__builtin_expect (b == 0+0i, 0))
3972+ {
3973+ if (!__builtin_isinff (__real__ a)
3974+ && !__builtin_isinff (__imag__ a)
3975+ && (__builtin_isnanf (__real__ a) || __builtin_isnanf (__imag__ a)))
3976+ {
3977+ /* Pass "1" to nanf to match math/bits.go. */
3978+ return __builtin_nanf("1") + __builtin_nanf("1")*1i;
3979+ }
3980+ }
3981+ return a / b;
3982+}
3983+
3984+__complex double
3985+__go_complex128_div (__complex double a, __complex double b)
3986+{
3987+ if (__builtin_expect (b == 0+0i, 0))
3988+ {
3989+ if (!__builtin_isinf (__real__ a)
3990+ && !__builtin_isinf (__imag__ a)
3991+ && (__builtin_isnan (__real__ a) || __builtin_isnan (__imag__ a)))
3992+ {
3993+ /* Pass "1" to nan to match math/bits.go. */
3994+ return __builtin_nan("1") + __builtin_nan("1")*1i;
3995+ }
3996+ }
[88af5df]3997+ return a / b;
3998+}
[2e59d11]3999diff -Naur gcc-4.8.2.orig/libgo/runtime/go-make-slice.c gcc-4.8.2/libgo/runtime/go-make-slice.c
4000--- gcc-4.8.2.orig/libgo/runtime/go-make-slice.c 2012-11-21 07:03:38.000000000 +0000
4001+++ gcc-4.8.2/libgo/runtime/go-make-slice.c 2013-11-01 16:12:34.303850472 +0000
4002@@ -34,7 +34,10 @@
4003 std = (const struct __go_slice_type *) td;
4004
4005 ilen = (intgo) len;
4006- if (ilen < 0 || (uintptr_t) ilen != len)
4007+ if (ilen < 0
4008+ || (uintptr_t) ilen != len
4009+ || (std->__element_type->__size > 0
4010+ && len > MaxMem / std->__element_type->__size))
4011 runtime_panicstring ("makeslice: len out of range");
[88af5df]4012
4013 icap = (intgo) cap;
[2e59d11]4014diff -Naur gcc-4.8.2.orig/libgo/runtime/go-nosys.c gcc-4.8.2/libgo/runtime/go-nosys.c
4015--- gcc-4.8.2.orig/libgo/runtime/go-nosys.c 2013-01-29 20:52:43.000000000 +0000
4016+++ gcc-4.8.2/libgo/runtime/go-nosys.c 2013-11-01 16:12:34.303850472 +0000
4017@@ -43,6 +43,17 @@
4018 }
4019 #endif
4020
4021+#ifndef HAVE_DUP3
4022+int
4023+dup3 (int oldfd __attribute__ ((unused)),
4024+ int newfd __attribute__ ((unused)),
4025+ int flags __attribute__ ((unused)))
4026+{
4027+ errno = ENOSYS;
4028+ return -1;
4029+}
4030+#endif
4031+
4032 #ifndef HAVE_EPOLL_CREATE1
4033 int
4034 epoll_create1 (int flags __attribute__ ((unused)))
4035@@ -112,6 +123,18 @@
4036 }
4037 #endif
4038
4039+#ifndef HAVE_GETXATTR
4040+ssize_t
4041+getxattr (const char *path __attribute__ ((unused)),
4042+ const char *name __attribute__ ((unused)),
4043+ void *value __attribute__ ((unused)),
4044+ size_t size __attribute__ ((unused)))
4045+{
4046+ errno = ENOSYS;
4047+ return -1;
4048+}
4049+#endif
4050+
4051 #ifndef HAVE_INOTIFY_ADD_WATCH
4052 int
4053 inotify_add_watch (int fd __attribute__ ((unused)),
4054@@ -151,6 +174,17 @@
4055 }
4056 #endif
4057
4058+#ifndef HAVE_LISTXATTR
4059+ssize_t
4060+listxattr (const char *path __attribute__ ((unused)),
4061+ char *list __attribute__ ((unused)),
4062+ size_t size __attribute__ ((unused)))
4063+{
4064+ errno = ENOSYS;
4065+ return -1;
4066+}
4067+#endif
4068+
4069 #ifndef HAVE_MKDIRAT
4070 int
4071 mkdirat (int dirfd __attribute__ ((unused)),
4072@@ -196,6 +230,16 @@
4073 }
4074 #endif
4075
4076+#ifndef HAVE_REMOVEXATTR
4077+int
4078+removexattr (const char *path __attribute__ ((unused)),
4079+ const char *name __attribute__ ((unused)))
4080+{
4081+ errno = ENOSYS;
4082+ return -1;
4083+}
4084+#endif
4085+
4086 #ifndef HAVE_RENAMEAT
4087 int
4088 renameat (int olddirfd __attribute__ ((unused)),
4089@@ -205,6 +249,19 @@
4090 {
4091 errno = ENOSYS;
4092 return -1;
4093+}
4094+#endif
4095+
4096+#ifndef HAVE_SETXATTR
4097+int
4098+setxattr (const char *path __attribute__ ((unused)),
4099+ const char *name __attribute__ ((unused)),
4100+ const void *value __attribute__ ((unused)),
4101+ size_t size __attribute__ ((unused)),
4102+ int flags __attribute__ ((unused)))
4103+{
4104+ errno = ENOSYS;
4105+ return -1;
4106 }
[88af5df]4107 #endif
4108
[2e59d11]4109diff -Naur gcc-4.8.2.orig/libgo/runtime/go-signal.c gcc-4.8.2/libgo/runtime/go-signal.c
4110--- gcc-4.8.2.orig/libgo/runtime/go-signal.c 2013-07-23 04:42:18.000000000 +0000
4111+++ gcc-4.8.2/libgo/runtime/go-signal.c 2013-11-01 16:12:34.303850472 +0000
4112@@ -399,6 +399,9 @@
4113 {
4114 G *gp;
4115 M *mp;
4116+#ifdef USING_SPLIT_STACK
4117+ void *stack_context[10];
4118+#endif
4119
4120 /* We are now running on the stack registered via sigaltstack.
4121 (Actually there is a small span of time between runtime_siginit
4122@@ -409,7 +412,7 @@
4123 if (gp != NULL)
4124 {
4125 #ifdef USING_SPLIT_STACK
4126- __splitstack_getcontext (&gp->stack_context[0]);
4127+ __splitstack_getcontext (&stack_context[0]);
4128 #endif
4129 }
4130
4131@@ -432,7 +435,7 @@
4132 if (gp != NULL)
4133 {
4134 #ifdef USING_SPLIT_STACK
4135- __splitstack_setcontext (&gp->stack_context[0]);
4136+ __splitstack_setcontext (&stack_context[0]);
4137 #endif
[88af5df]4138 }
4139 }
[2e59d11]4140diff -Naur gcc-4.8.2.orig/libitm/libitm.info gcc-4.8.2/libitm/libitm.info
4141--- gcc-4.8.2.orig/libitm/libitm.info 2013-10-16 08:29:00.000000000 +0000
4142+++ gcc-4.8.2/libitm/libitm.info 1970-01-01 00:00:00.000000000 +0000
4143@@ -1,1293 +0,0 @@
4144-This is libitm.info, produced by makeinfo version 5.1 from libitm.texi.
4145-
4146-Copyright (C) 2011-2013 Free Software Foundation, Inc.
4147-
4148- Permission is granted to copy, distribute and/or modify this document
4149-under the terms of the GNU Free Documentation License, Version 1.2 or
4150-any later version published by the Free Software Foundation; with no
4151-Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
4152-copy of the license is included in the section entitled "GNU Free
4153-Documentation License".
4154-INFO-DIR-SECTION GNU Libraries
4155-START-INFO-DIR-ENTRY
4156-* libitm: (libitm). GNU Transactional Memory Library
4157-END-INFO-DIR-ENTRY
4158-
4159- This manual documents the GNU Transactional Memory Library.
4160-
4161- Copyright (C) 2011-2013 Free Software Foundation, Inc.
4162-
4163- Permission is granted to copy, distribute and/or modify this document
4164-under the terms of the GNU Free Documentation License, Version 1.2 or
4165-any later version published by the Free Software Foundation; with no
4166-Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
4167-copy of the license is included in the section entitled "GNU Free
4168-Documentation License".
4169-
4170-
4171-File: libitm.info, Node: Top, Next: Enabling libitm, Up: (dir)
4172-
4173-Introduction
4174-************
4175-
4176-This manual documents the usage and internals of libitm, the GNU
4177-Transactional Memory Library. It provides transaction support for
4178-accesses to a process' memory, enabling easy-to-use synchronization of
4179-accesses to shared memory by several threads.
4180-
4181-* Menu:
4182-
4183-* Enabling libitm:: How to enable libitm for your applications.
4184-* C/C++ Language Constructs for TM::
4185- Notes on the language-level interface supported
4186- by gcc.
4187-* The libitm ABI:: Notes on the external ABI provided by libitm.
4188-* Internals:: Notes on libitm's internal synchronization.
4189-* GNU Free Documentation License::
4190- How you can copy and share this manual.
4191-* Index:: Index of this documentation.
4192-
4193-
4194-File: libitm.info, Node: Enabling libitm, Next: C/C++ Language Constructs for TM, Prev: Top, Up: Top
4195-
4196-1 Enabling libitm
4197-*****************
4198-
4199-To activate support for TM in C/C++, the compile-time flag '-fgnu-tm'
4200-must be specified. This enables TM language-level constructs such as
4201-transaction statements (e.g., '__transaction_atomic', *note C/C++
4202-Language Constructs for TM:: for details).
4203-
4204-
4205-File: libitm.info, Node: C/C++ Language Constructs for TM, Next: The libitm ABI, Prev: Enabling libitm, Up: Top
4206-
4207-2 C/C++ Language Constructs for TM
4208-**********************************
4209-
4210-Transactions are supported in C++ and C in the form of transaction
4211-statements, transaction expressions, and function transactions. In the
4212-following example, both 'a' and 'b' will be read and the difference will
4213-be written to 'c', all atomically and isolated from other transactions:
4214-
4215- __transaction_atomic { c = a - b; }
4216-
4217- Therefore, another thread can use the following code to concurrently
4218-update 'b' without ever causing 'c' to hold a negative value (and
4219-without having to use other synchronization constructs such as locks or
4220-C++11 atomics):
4221-
4222- __transaction_atomic { if (a > b) b++; }
4223-
4224- GCC follows the Draft Specification of Transactional Language
4225-Constructs for C++ (v1.1)
4226-(https://sites.google.com/site/tmforcplusplus/) in its implementation of
4227-transactions.
4228-
4229- The precise semantics of transactions are defined in terms of the
4230-C++11/C11 memory model (see the specification). Roughly, transactions
4231-provide synchronization guarantees that are similar to what would be
4232-guaranteed when using a single global lock as a guard for all
4233-transactions. Note that like other synchronization constructs in C/C++,
4234-transactions rely on a data-race-free program (e.g., a nontransactional
4235-write that is concurrent with a transactional read to the same memory
4236-location is a data race).
4237-
4238-
4239-File: libitm.info, Node: The libitm ABI, Next: Internals, Prev: C/C++ Language Constructs for TM, Up: Top
4240-
4241-3 The libitm ABI
4242-****************
4243-
4244-The ABI provided by libitm is basically equal to the Linux variant of
4245-Intel's current TM ABI specification document (Revision 1.1, May 6 2009)
4246-but with the differences listed in this chapter. It would be good if
4247-these changes would eventually be merged into a future version of this
4248-specification. To ease look-up, the following subsections mirror the
4249-structure of this specification.
4250-
4251-3.1 [No changes] Objectives
4252-===========================
4253-
4254-3.2 [No changes] Non-objectives
4255-===============================
4256-
4257-3.3 Library design principles
4258-=============================
4259-
4260-3.3.1 [No changes] Calling conventions
4261---------------------------------------
4262-
4263-3.3.2 [No changes] TM library algorithms
4264-----------------------------------------
4265-
4266-3.3.3 [No changes] Optimized load and store routines
4267-----------------------------------------------------
4268-
4269-3.3.4 [No changes] Aligned load and store routines
4270---------------------------------------------------
4271-
4272-3.3.5 Data logging functions
4273-----------------------------
4274-
4275-The memory locations accessed with transactional loads and stores and
4276-the memory locations whose values are logged must not overlap. This
4277-required separation only extends to the scope of the execution of one
4278-transaction including all the executions of all nested transactions.
4279-
4280- The compiler must be consistent (within the scope of a single
4281-transaction) about which memory locations are shared and which are not
4282-shared with other threads (i.e., data must be accessed either
4283-transactionally or nontransactionally). Otherwise, non-write-through TM
4284-algorithms would not work.
4285-
4286- For memory locations on the stack, this requirement extends to only
4287-the lifetime of the stack frame that the memory location belongs to (or
4288-the lifetime of the transaction, whichever is shorter). Thus, memory
4289-that is reused for several stack frames could be target of both data
4290-logging and transactional accesses; however, this is harmless because
4291-these stack frames' lifetimes will end before the transaction finishes.
4292-
4293-3.3.6 [No changes] Scatter/gather calls
4294----------------------------------------
4295-
4296-3.3.7 [No changes] Serial and irrevocable mode
4297-----------------------------------------------
4298-
4299-3.3.8 [No changes] Transaction descriptor
4300------------------------------------------
4301-
4302-3.3.9 Store allocation
4303-----------------------
4304-
4305-There is no 'getTransaction' function.
4306-
4307-3.3.10 [No changes] Naming conventions
4308---------------------------------------
4309-
4310-3.3.11 Function pointer encryption
4311-----------------------------------
4312-
4313-Currently, this is not implemented.
4314-
4315-3.4 Types and macros list
4316-=========================
4317-
4318-'_ITM_codeProperties' has changed, *note Starting a transaction:
4319-txn-code-properties. '_ITM_srcLocation' is not used.
4320-
4321-3.5 Function list
4322-=================
4323-
4324-3.5.1 Initialization and finalization functions
4325------------------------------------------------
4326-
4327-These functions are not part of the ABI.
4328-
4329-3.5.2 [No changes] Version checking
4330------------------------------------
4331-
4332-3.5.3 [No changes] Error reporting
4333-----------------------------------
4334-
4335-3.5.4 [No changes] inTransaction call
4336--------------------------------------
4337-
4338-3.5.5 State manipulation functions
4339-----------------------------------
4340-
4341-There is no 'getTransaction' function. Transaction identifiers for
4342-nested transactions will be ordered but not necessarily sequential
4343-(i.e., for a nested transaction's identifier IN and its enclosing
4344-transaction's identifier IE, it is guaranteed that IN >= IE).
4345-
4346-3.5.6 [No changes] Source locations
4347------------------------------------
4348-
4349-3.5.7 Starting a transaction
4350-----------------------------
4351-
4352-3.5.7.1 Transaction code properties
4353-...................................
4354-
4355-The bit 'hasNoXMMUpdate' is instead called 'hasNoVectorUpdate'. Iff it
4356-is set, vector register save/restore is not necessary for any target
4357-machine.
4358-
4359- The 'hasNoFloatUpdate' bit ('0x0010') is new. Iff it is set,
4360-floating point register save/restore is not necessary for any target
4361-machine.
4362-
4363- 'undoLogCode' is not supported and a fatal runtime error will be
4364-raised if this bit is set. It is not properly defined in the ABI why
4365-barriers other than undo logging are not present; Are they not necessary
4366-(e.g., a transaction operating purely on thread-local data) or have they
4367-been omitted by the compiler because it thinks that some kind of global
4368-synchronization (e.g., serial mode) might perform better? The
4369-specification suggests that the latter might be the case, but the former
4370-seems to be more useful.
4371-
4372- The 'readOnly' bit ('0x4000') is new. *TODO* Lexical or dynamic
4373-scope?
4374-
4375- 'hasNoRetry' is not supported. If this bit is not set, but
4376-'hasNoAbort' is set, the library can assume that transaction rollback
4377-will not be requested.
4378-
4379- It would be useful if the absence of externally-triggered rollbacks
4380-would be reported for the dynamic scope as well, not just for the
4381-lexical scope ('hasNoAbort'). Without this, a library cannot exploit
4382-this together with flat nesting.
4383-
4384- 'exceptionBlock' is not supported because exception blocks are not
4385-used.
4386-
4387-3.5.7.2 [No changes] Windows exception state
4388-............................................
4389-
4390-3.5.7.3 [No changes] Other machine state
4391-........................................
4392-
4393-3.5.7.4 [No changes] Results from beginTransaction
4394-..................................................
4395-
4396-3.5.8 Aborting a transaction
4397-----------------------------
4398-
4399-'_ITM_rollbackTransaction' is not supported. '_ITM_abortTransaction' is
4400-supported but the abort reasons 'exceptionBlockAbort', 'TMConflict', and
4401-'userRetry' are not supported. There are no exception blocks in
4402-general, so the related cases also do not have to be considered. To
4403-encode '__transaction_cancel [[outer]]', compilers must set the new
4404-'outerAbort' bit ('0x10') additionally to the 'userAbort' bit in the
4405-abort reason.
4406-
4407-3.5.9 Committing a transaction
4408-------------------------------
4409-
4410-The exception handling (EH) scheme is different. The Intel ABI requires
4411-the '_ITM_tryCommitTransaction' function that will return even when the
4412-commit failed and will have to be matched with calls to either
4413-'_ITM_abortTransaction' or '_ITM_commitTransaction'. In contrast, gcc
4414-relies on transactional wrappers for the functions of the Exception
4415-Handling ABI and on one additional commit function (shown below). This
4416-allows the TM to keep track of EH internally and thus it does not have
4417-to embed the cleanup of EH state into the existing EH code in the
4418-program. '_ITM_tryCommitTransaction' is not supported.
4419-'_ITM_commitTransactionToId' is also not supported because the
4420-propagation of thrown exceptions will not bypass commits of nested
4421-transactions.
4422-
4423- void _ITM_commitTransactionEH(void *exc_ptr) ITM_REGPARM;
4424- void *_ITM_cxa_allocate_exception (size_t);
4425- void _ITM_cxa_throw (void *obj, void *tinfo, void *dest);
4426- void *_ITM_cxa_begin_catch (void *exc_ptr);
4427- void _ITM_cxa_end_catch (void);
4428-
4429- '_ITM_commitTransactionEH' must be called to commit a transaction if
4430-an exception could be in flight at this position in the code. 'exc_ptr'
4431-is the current exception or zero if there is no current exception. The
4432-'_ITM_cxa...' functions are transactional wrappers for the respective
4433-'__cxa...' functions and must be called instead of these in
4434-transactional code.
4435-
4436- To support this EH scheme, libstdc++ needs to provide one additional
4437-function ('_cxa_tm_cleanup'), which is used by the TM to clean up the
4438-exception handling state while rolling back a transaction:
4439-
4440- void __cxa_tm_cleanup (void *unthrown_obj, void *cleanup_exc,
4441- unsigned int caught_count);
4442-
4443- 'unthrown_obj' is non-null if the program called
4444-'__cxa_allocate_exception' for this exception but did not yet called
4445-'__cxa_throw' for it. 'cleanup_exc' is non-null if the program is
4446-currently processing a cleanup along an exception path but has not
4447-caught this exception yet. 'caught_count' is the nesting depth of
4448-'__cxa_begin_catch' within the transaction (which can be counted by the
4449-TM using '_ITM_cxa_begin_catch' and '_ITM_cxa_end_catch');
4450-'__cxa_tm_cleanup' then performs rollback by essentially performing
4451-'__cxa_end_catch' that many times.
4452-
4453-3.5.10 Exception handling support
4454----------------------------------
4455-
4456-Currently, there is no support for functionality like
4457-'__transaction_cancel throw' as described in the C++ TM specification.
4458-Supporting this should be possible with the EH scheme explained
4459-previously because via the transactional wrappers for the EH ABI, the TM
4460-is able to observe and intercept EH.
4461-
4462-3.5.11 [No changes] Transition to serial-irrevocable mode
4463----------------------------------------------------------
4464-
4465-3.5.12 [No changes] Data transfer functions
4466--------------------------------------------
4467-
4468-3.5.13 [No changes] Transactional memory copies
4469------------------------------------------------
4470-
4471-3.5.14 Transactional versions of memmove
4472-----------------------------------------
4473-
4474-If either the source or destination memory region is to be accessed
4475-nontransactionally, then source and destination regions must not be
4476-overlapping. The respective '_ITM_memmove' functions are still
4477-available but a fatal runtime error will be raised if such regions do
4478-overlap. To support this functionality, the ABI would have to specify
4479-how the intersection of the regions has to be accessed (i.e.,
4480-transactionally or nontransactionally).
4481-
4482-3.5.15 [No changes] Transactional versions of memset
4483-----------------------------------------------------
4484-
4485-3.5.16 [No changes] Logging functions
4486--------------------------------------
4487-
4488-3.5.17 User-registered commit and undo actions
4489-----------------------------------------------
4490-
4491-Commit actions will get executed in the same order in which the
4492-respective calls to '_ITM_addUserCommitAction' happened. Only
4493-'_ITM_noTransactionId' is allowed as value for the
4494-'resumingTransactionId' argument. Commit actions get executed after
4495-privatization safety has been ensured.
4496-
4497- Undo actions will get executed in reverse order compared to the order
4498-in which the respective calls to '_ITM_addUserUndoAction' happened. The
4499-ordering of undo actions w.r.t. the roll-back of other actions (e.g.,
4500-data transfers or memory allocations) is undefined.
4501-
4502- '_ITM_getThreadnum' is not supported currently because its only
4503-purpose is to provide a thread ID that matches some assumed performance
4504-tuning output, but this output is not part of the ABI nor further
4505-defined by it.
4506-
4507- '_ITM_dropReferences' is not supported currently because its
4508-semantics and the intention behind it is not entirely clear. The
4509-specification suggests that this function is necessary because of
4510-certain orderings of data transfer undos and the releasing of memory
4511-regions (i.e., privatization). However, this ordering is never defined,
4512-nor is the ordering of dropping references w.r.t. other events.
4513-
4514-3.5.18 [New] Transactional indirect calls
4515------------------------------------------
4516-
4517-Indirect calls (i.e., calls through a function pointer) within
4518-transactions should execute the transactional clone of the original
4519-function (i.e., a clone of the original that has been fully instrumented
4520-to use the TM runtime), if such a clone is available. The runtime
4521-provides two functions to register/deregister clone tables:
4522-
4523- struct clone_entry
4524- {
4525- void *orig, *clone;
4526- };
4527-
4528- void _ITM_registerTMCloneTable (clone_entry *table, size_t entries);
4529- void _ITM_deregisterTMCloneTable (clone_entry *table);
4530-
4531- Registered tables must be writable by the TM runtime, and must be
4532-live throughout the life-time of the TM runtime.
4533-
4534- *TODO* The intention was always to drop the registration functions
4535-entirely, and create a new ELF Phdr describing the linker-sorted table.
4536-Much like what currently happens for 'PT_GNU_EH_FRAME'. This work kept
4537-getting bogged down in how to represent the N different code generation
4538-variants. We clearly needed at least two--SW and HW transactional
4539-clones--but there was always a suggestion of more variants for different
4540-TM assumptions/invariants.
4541-
4542- The compiler can then use two TM runtime functions to perform
4543-indirect calls in transactions:
4544- void *_ITM_getTMCloneOrIrrevocable (void *function) ITM_REGPARM;
4545- void *_ITM_getTMCloneSafe (void *function) ITM_REGPARM;
4546-
4547- If there is a registered clone for supplied function, both will
4548-return a pointer to the clone. If not, the first runtime function will
4549-attempt to switch to serial-irrevocable mode and return the original
4550-pointer, whereas the second will raise a fatal runtime error.
4551-
4552-3.5.19 [New] Transactional dynamic memory management
4553-----------------------------------------------------
4554-
4555- void *_ITM_malloc (size_t)
4556- __attribute__((__malloc__)) ITM_PURE;
4557- void *_ITM_calloc (size_t, size_t)
4558- __attribute__((__malloc__)) ITM_PURE;
4559- void _ITM_free (void *) ITM_PURE;
4560-
4561- These functions are essentially transactional wrappers for 'malloc',
4562-'calloc', and 'free'. Within transactions, the compiler should replace
4563-calls to the original functions with calls to the wrapper functions.
4564-
4565-3.6 [No changes] Future Enhancements to the ABI
4566-===============================================
4567-
4568-3.7 Sample code
4569-===============
4570-
4571-The code examples might not be correct w.r.t. the current version of
4572-the ABI, especially everything related to exception handling.
4573-
4574-3.8 [New] Memory model
4575-======================
4576-
4577-The ABI should define a memory model and the ordering that is guaranteed
4578-for data transfers and commit/undo actions, or at least refer to another
4579-memory model that needs to be preserved. Without that, the compiler
4580-cannot ensure the memory model specified on the level of the programming
4581-language (e.g., by the C++ TM specification).
4582-
4583- For example, if a transactional load is ordered before another
4584-load/store, then the TM runtime must also ensure this ordering when
4585-accessing shared state. If not, this might break the kind of
4586-publication safety used in the C++ TM specification. Likewise, the TM
4587-runtime must ensure privatization safety.
4588-
4589-
4590-File: libitm.info, Node: Internals, Next: GNU Free Documentation License, Prev: The libitm ABI, Up: Top
4591-
4592-4 Internals
4593-***********
4594-
4595-4.1 TM methods and method groups
4596-================================
4597-
4598-libitm supports several ways of synchronizing transactions with each
4599-other. These TM methods (or TM algorithms) are implemented in the form
4600-of subclasses of 'abi_dispatch', which provide methods for transactional
4601-loads and stores as well as callbacks for rollback and commit. All
4602-methods that are compatible with each other (i.e., that let concurrently
4603-running transactions still synchronize correctly even if different
4604-methods are used) belong to the same TM method group. Pointers to TM
4605-methods can be obtained using the factory methods prefixed with
4606-'dispatch_' in 'libitm_i.h'. There are two special methods,
4607-'dispatch_serial' and 'dispatch_serialirr', that are compatible with all
4608-methods because they run transactions completely in serial mode.
4609-
4610-4.1.1 TM method life cycle
4611---------------------------
4612-
4613-The state of TM methods does not change after construction, but they do
4614-alter the state of transactions that use this method. However, because
4615-per-transaction data gets used by several methods, 'gtm_thread' is
4616-responsible for setting an initial state that is useful for all methods.
4617-After that, methods are responsible for resetting/clearing this state on
4618-each rollback or commit (of outermost transactions), so that the
4619-transaction executed next is not affected by the previous transaction.
4620-
4621- There is also global state associated with each method group, which
4622-is initialized and shut down ('method_group::init()' and 'fini()') when
4623-switching between method groups (see 'retry.cc').
4624-
4625-4.1.2 Selecting the default method
4626-----------------------------------
4627-
4628-The default method that libitm uses for freshly started transactions
4629-(but not necessarily for restarted transactions) can be set via an
4630-environment variable ('ITM_DEFAULT_METHOD'), whose value should be equal
4631-to the name of one of the factory methods returning abi_dispatch
4632-subclasses but without the "dispatch_" prefix (e.g., "serialirr" instead
4633-of 'GTM::dispatch_serialirr()').
4634-
4635- Note that this environment variable is only a hint for libitm and
4636-might not be supported in the future.
4637-
4638-4.2 Nesting: flat vs. closed
4639-============================
4640-
4641-We support two different kinds of nesting of transactions. In the case
4642-of _flat nesting_, the nesting structure is flattened and all nested
4643-transactions are subsumed by the enclosing transaction. In contrast,
4644-with _closed nesting_, nested transactions that have not yet committed
4645-can be rolled back separately from the enclosing transactions; when they
4646-commit, they are subsumed by the enclosing transaction, and their
4647-effects will be finally committed when the outermost transaction
4648-commits. _Open nesting_ (where nested transactions can commit
4649-independently of the enclosing transactions) are not supported.
4650-
4651- Flat nesting is the default nesting mode, but closed nesting is
4652-supported and used when transactions contain user-controlled aborts
4653-('__transaction_cancel' statements). We assume that user-controlled
4654-aborts are rare in typical code and used mostly in exceptional
4655-situations. Thus, it makes more sense to use flat nesting by default to
4656-avoid the performance overhead of the additional checkpoints required
4657-for closed nesting. User-controlled aborts will correctly abort the
4658-innermost enclosing transaction, whereas the whole (i.e., outermost)
4659-transaction will be restarted otherwise (e.g., when a transaction
4660-encounters data conflicts during optimistic execution).
4661-
4662-4.3 Locking conventions
4663-=======================
4664-
4665-This section documents the locking scheme and rules for all uses of
4666-locking in libitm. We have to support serial(-irrevocable) mode, which
4667-is implemented using a global lock as explained next (called the _serial
4668-lock_). To simplify the overall design, we use the same lock as
4669-catch-all locking mechanism for other infrequent tasks such as
4670-(de)registering clone tables or threads. Besides the serial lock, there
4671-are _per-method-group locks_ that are managed by specific method groups
4672-(i.e., groups of similar TM concurrency control algorithms), and
4673-lock-like constructs for quiescence-based operations such as ensuring
4674-privatization safety.
4675-
4676- Thus, the actions that participate in the libitm-internal locking are
4677-either _active transactions_ that do not run in serial mode, _serial
4678-transactions_ (which (are about to) run in serial mode), and management
4679-tasks that do not execute within a transaction but have acquired the
4680-serial mode like a serial transaction would do (e.g., to be able to
4681-register threads with libitm). Transactions become active as soon as
4682-they have successfully used the serial lock to announce this globally
4683-(*note Serial lock implementation: serial-lock-impl.). Likewise,
4684-transactions become serial transactions as soon as they have acquired
4685-the exclusive rights provided by the serial lock (i.e., serial mode,
4686-which also means that there are no other concurrent active or serial
4687-transactions). Note that active transactions can become serial
4688-transactions when they enter serial mode during the runtime of the
4689-transaction.
4690-
4691-4.3.1 State-to-lock mapping
4692----------------------------
4693-
4694-Application data is protected by the serial lock if there is a serial
4695-transaction and no concurrently running active transaction (i.e.,
4696-non-serial). Otherwise, application data is protected by the currently
4697-selected method group, which might use per-method-group locks or other
4698-mechanisms. Also note that application data that is about to be
4699-privatized might not be allowed to be accessed by nontransactional code
4700-until privatization safety has been ensured; the details of this are
4701-handled by the current method group.
4702-
4703- libitm-internal state is either protected by the serial lock or
4704-accessed through custom concurrent code. The latter applies to the
4705-public/shared part of a transaction object and most typical
4706-method-group-specific state.
4707-
4708- The former category (protected by the serial lock) includes:
4709- * The list of active threads that have used transactions.
4710- * The tables that map functions to their transactional clones.
4711- * The current selection of which method group to use.
4712- * Some method-group-specific data, or invariants of this data. For
4713- example, resetting a method group to its initial state is handled
4714- by switching to the same method group, so the serial lock protects
4715- such resetting as well.
4716- In general, such state is immutable whenever there exists an active
4717-(non-serial) transaction. If there is no active transaction, a serial
4718-transaction (or a thread that is not currently executing a transaction
4719-but has acquired the serial lock) is allowed to modify this state (but
4720-must of course be careful to not surprise the current method group's
4721-implementation with such modifications).
4722-
4723-4.3.2 Lock acquisition order
4724-----------------------------
4725-
4726-To prevent deadlocks, locks acquisition must happen in a globally
4727-agreed-upon order. Note that this applies to other forms of blocking
4728-too, but does not necessarily apply to lock acquisitions that do not
4729-block (e.g., trylock() calls that do not get retried forever). Note
4730-that serial transactions are never return back to active transactions
4731-until the transaction has committed. Likewise, active transactions stay
4732-active until they have committed. Per-method-group locks are typically
4733-also not released before commit.
4734-
4735- Lock acquisition / blocking rules:
4736-
4737- * Transactions must become active or serial before they are allowed
4738- to use method-group-specific locks or blocking (i.e., the serial
4739- lock must be acquired before those other locks, either in serial or
4740- nonserial mode).
4741-
4742- * Any number of threads that do not currently run active transactions
4743- can block while trying to get the serial lock in exclusive mode.
4744- Note that active transactions must not block when trying to upgrade
4745- to serial mode unless there is no other transaction that is trying
4746- that (the latter is ensured by the serial lock implementation.
4747-
4748- * Method groups must prevent deadlocks on their locks. In
4749- particular, they must also be prepared for another active
4750- transaction that has acquired method-group-specific locks but is
4751- blocked during an attempt to upgrade to being a serial transaction.
4752- See below for details.
4753-
4754- * Serial transactions can acquire method-group-specific locks because
4755- there will be no other active nor serial transaction.
4756-
4757- There is no single rule for per-method-group blocking because this
4758-depends on when a TM method might acquire locks. If no active
4759-transaction can upgrade to being a serial transaction after it has
4760-acquired per-method-group locks (e.g., when those locks are only
4761-acquired during an attempt to commit), then the TM method does not need
4762-to consider a potential deadlock due to serial mode.
4763-
4764- If there can be upgrades to serial mode after the acquisition of
4765-per-method-group locks, then TM methods need to avoid those deadlocks:
4766- * When upgrading to a serial transaction, after acquiring exclusive
4767- rights to the serial lock but before waiting for concurrent active
4768- transactions to finish (*note Serial lock implementation:
4769- serial-lock-impl. for details), we have to wake up all active
4770- transactions waiting on the upgrader's per-method-group locks.
4771- * Active transactions blocking on per-method-group locks need to
4772- check the serial lock and abort if there is a pending serial
4773- transaction.
4774- * Lost wake-ups have to be prevented (e.g., by changing a bit in each
4775- per-method-group lock before doing the wake-up, and only blocking
4776- on this lock using a futex if this bit is not group).
4777-
4778- *TODO*: Can reuse serial lock for gl-*? And if we can, does it make
4779-sense to introduce further complexity in the serial lock? For gl-*, we
4780-can really only avoid an abort if we do -wb and -vbv.
4781-
4782-4.3.3 Serial lock implementation
4783---------------------------------
4784-
4785-The serial lock implementation is optimized towards assuming that serial
4786-transactions are infrequent and not the common case. However, the
4787-performance of entering serial mode can matter because when only few
4788-transactions are run concurrently or if there are few threads, then it
4789-can be efficient to run transactions serially.
4790-
4791- The serial lock is similar to a multi-reader-single-writer lock in
4792-that there can be several active transactions but only one serial
4793-transaction. However, we do want to avoid contention (in the lock
4794-implementation) between active transactions, so we split up the reader
4795-side of the lock into per-transaction flags that are true iff the
4796-transaction is active. The exclusive writer side remains a shared
4797-single flag, which is acquired using a CAS, for example. On the
4798-fast-path, the serial lock then works similar to Dekker's algorithm but
4799-with several reader flags that a serial transaction would have to check.
4800-A serial transaction thus requires a list of all threads with
4801-potentially active transactions; we can use the serial lock itself to
4802-protect this list (i.e., only threads that have acquired the serial lock
4803-can modify this list).
4804-
4805- We want starvation-freedom for the serial lock to allow for using it
4806-to ensure progress for potentially starved transactions (*note Progress
4807-Guarantees: progress-guarantees. for details). However, this is
4808-currently not enforced by the implementation of the serial lock.
4809-
4810- Here is pseudo-code for the read/write fast paths of acquiring the
4811-serial lock (read-to-write upgrade is similar to write_lock:
4812- // read_lock:
4813- tx->shared_state |= active;
4814- __sync_synchronize(); // or STLD membar, or C++0x seq-cst fence
4815- while (!serial_lock.exclusive)
4816- if (spinning_for_too_long) goto slowpath;
4817-
4818- // write_lock:
4819- if (CAS(&serial_lock.exclusive, 0, this) != 0)
4820- goto slowpath; // writer-writer contention
4821- // need a membar here, but CAS already has full membar semantics
4822- bool need_blocking = false;
4823- for (t: all txns)
4824- {
4825- for (;t->shared_state & active;)
4826- if (spinning_for_too_long) { need_blocking = true; break; }
4827- }
4828- if (need_blocking) goto slowpath;
4829-
4830- Releasing a lock in this spin-lock version then just consists of
4831-resetting 'tx->shared_state' to inactive or clearing
4832-'serial_lock.exclusive'.
4833-
4834- However, we can't rely on a pure spinlock because we need to get the
4835-OS involved at some time (e.g., when there are more threads than CPUs to
4836-run on). Therefore, the real implementation falls back to a blocking
4837-slow path, either based on pthread mutexes or Linux futexes.
4838-
4839-4.3.4 Reentrancy
4840-----------------
4841-
4842-libitm has to consider the following cases of reentrancy:
4843-
4844- * Transaction calls unsafe code that starts a new transaction: The
4845- outer transaction will become a serial transaction before executing
4846- unsafe code. Therefore, nesting within serial transactions must
4847- work, even if the nested transaction is called from within
4848- uninstrumented code.
4849-
4850- * Transaction calls either a transactional wrapper or safe code,
4851- which in turn starts a new transaction: It is not yet defined in
4852- the specification whether this is allowed. Thus, it is undefined
4853- whether libitm supports this.
4854-
4855- * Code that starts new transactions might be called from within any
4856- part of libitm: This kind of reentrancy would likely be rather
4857- complex and can probably be avoided. Therefore, it is not
4858- supported.
4859-
4860-4.3.5 Privatization safety
4861---------------------------
4862-
4863-Privatization safety is ensured by libitm using a quiescence-based
4864-approach. Basically, a privatizing transaction waits until all
4865-concurrent active transactions will either have finished (are not active
4866-anymore) or operate on a sufficiently recent snapshot to not access the
4867-privatized data anymore. This happens after the privatizing transaction
4868-has stopped being an active transaction, so waiting for quiescence does
4869-not contribute to deadlocks.
4870-
4871- In method groups that need to ensure publication safety explicitly,
4872-active transactions maintain a flag or timestamp in the public/shared
4873-part of the transaction descriptor. Before blocking, privatizers need
4874-to let the other transactions know that they should wake up the
4875-privatizer.
4876-
4877- *TODO* Ho to implement the waiters? Should those flags be
4878-per-transaction or at a central place? We want to avoid one wake/wait
4879-call per active transactions, so we might want to use either a tree or
4880-combining to reduce the syscall overhead, or rather spin for a long
4881-amount of time instead of doing blocking. Also, it would be good if
4882-only the last transaction that the privatizer waits for would do the
4883-wake-up.
4884-
4885-4.3.6 Progress guarantees
4886--------------------------
4887-
4888-Transactions that do not make progress when using the current TM method
4889-will eventually try to execute in serial mode. Thus, the serial lock's
4890-progress guarantees determine the progress guarantees of the whole TM.
4891-Obviously, we at least need deadlock-freedom for the serial lock, but it
4892-would also be good to provide starvation-freedom (informally, all
4893-threads will finish executing a transaction eventually iff they get
4894-enough cycles).
4895-
4896- However, the scheduling of transactions (e.g., thread scheduling by
4897-the OS) also affects the handling of progress guarantees by the TM.
4898-First, the TM can only guarantee deadlock-freedom if threads do not get
4899-stopped. Likewise, low-priority threads can starve if they do not get
4900-scheduled when other high-priority threads get those cycles instead.
4901-
4902- If all threads get scheduled eventually, correct lock implementations
4903-will provide deadlock-freedom, but might not provide starvation-freedom.
4904-We can either enforce the latter in the TM's lock implementation, or
4905-assume that the scheduling is sufficiently random to yield a
4906-probabilistic guarantee that no thread will starve (because eventually,
4907-a transaction will encounter a scheduling that will allow it to run).
4908-This can indeed work well in practice but is not necessarily guaranteed
4909-to work (e.g., simple spin locks can be pretty efficient).
4910-
4911- Because enforcing stronger progress guarantees in the TM has a higher
4912-runtime overhead, we focus on deadlock-freedom right now and assume that
4913-the threads will get scheduled eventually by the OS (but don't consider
4914-threads with different priorities). We should support
4915-starvation-freedom for serial transactions in the future. Everything
4916-beyond that is highly related to proper contention management across all
4917-of the TM (including with TM method to choose), and is future work.
4918-
4919- *TODO* Handling thread priorities: We want to avoid priority
4920-inversion but it's unclear how often that actually matters in practice.
4921-Workloads that have threads with different priorities will likely also
4922-require lower latency or higher throughput for high-priority threads.
4923-Therefore, it probably makes not that much sense (except for eventual
4924-progress guarantees) to use priority inheritance until the TM has
4925-priority-aware contention management.
4926-
4927-
4928-File: libitm.info, Node: GNU Free Documentation License, Next: Index, Prev: Internals, Up: Top
4929-
4930-GNU Free Documentation License
4931-******************************
4932-
4933- Version 1.3, 3 November 2008
4934-
4935- Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
4936- <http://fsf.org/>
4937-
4938- Everyone is permitted to copy and distribute verbatim copies
4939- of this license document, but changing it is not allowed.
4940-
4941- 0. PREAMBLE
4942-
4943- The purpose of this License is to make a manual, textbook, or other
4944- functional and useful document "free" in the sense of freedom: to
4945- assure everyone the effective freedom to copy and redistribute it,
4946- with or without modifying it, either commercially or
4947- noncommercially. Secondarily, this License preserves for the
4948- author and publisher a way to get credit for their work, while not
4949- being considered responsible for modifications made by others.
4950-
4951- This License is a kind of "copyleft", which means that derivative
4952- works of the document must themselves be free in the same sense.
4953- It complements the GNU General Public License, which is a copyleft
4954- license designed for free software.
4955-
4956- We have designed this License in order to use it for manuals for
4957- free software, because free software needs free documentation: a
4958- free program should come with manuals providing the same freedoms
4959- that the software does. But this License is not limited to
4960- software manuals; it can be used for any textual work, regardless
4961- of subject matter or whether it is published as a printed book. We
4962- recommend this License principally for works whose purpose is
4963- instruction or reference.
4964-
4965- 1. APPLICABILITY AND DEFINITIONS
4966-
4967- This License applies to any manual or other work, in any medium,
4968- that contains a notice placed by the copyright holder saying it can
4969- be distributed under the terms of this License. Such a notice
4970- grants a world-wide, royalty-free license, unlimited in duration,
4971- to use that work under the conditions stated herein. The
4972- "Document", below, refers to any such manual or work. Any member
4973- of the public is a licensee, and is addressed as "you". You accept
4974- the license if you copy, modify or distribute the work in a way
4975- requiring permission under copyright law.
4976-
4977- A "Modified Version" of the Document means any work containing the
4978- Document or a portion of it, either copied verbatim, or with
4979- modifications and/or translated into another language.
4980-
4981- A "Secondary Section" is a named appendix or a front-matter section
4982- of the Document that deals exclusively with the relationship of the
4983- publishers or authors of the Document to the Document's overall
4984- subject (or to related matters) and contains nothing that could
4985- fall directly within that overall subject. (Thus, if the Document
4986- is in part a textbook of mathematics, a Secondary Section may not
4987- explain any mathematics.) The relationship could be a matter of
4988- historical connection with the subject or with related matters, or
4989- of legal, commercial, philosophical, ethical or political position
4990- regarding them.
4991-
4992- The "Invariant Sections" are certain Secondary Sections whose
4993- titles are designated, as being those of Invariant Sections, in the
4994- notice that says that the Document is released under this License.
4995- If a section does not fit the above definition of Secondary then it
4996- is not allowed to be designated as Invariant. The Document may
4997- contain zero Invariant Sections. If the Document does not identify
4998- any Invariant Sections then there are none.
4999-
5000- The "Cover Texts" are certain short passages of text that are
5001- listed, as Front-Cover Texts or Back-Cover Texts, in the notice
5002- that says that the Document is released under this License. A
5003- Front-Cover Text may be at most 5 words, and a Back-Cover Text may
5004- be at most 25 words.
5005-
5006- A "Transparent" copy of the Document means a machine-readable copy,
5007- represented in a format whose specification is available to the
5008- general public, that is suitable for revising the document
5009- straightforwardly with generic text editors or (for images composed
5010- of pixels) generic paint programs or (for drawings) some widely
5011- available drawing editor, and that is suitable for input to text
5012- formatters or for automatic translation to a variety of formats
5013- suitable for input to text formatters. A copy made in an otherwise
5014- Transparent file format whose markup, or absence of markup, has
5015- been arranged to thwart or discourage subsequent modification by
5016- readers is not Transparent. An image format is not Transparent if
5017- used for any substantial amount of text. A copy that is not
5018- "Transparent" is called "Opaque".
5019-
5020- Examples of suitable formats for Transparent copies include plain
5021- ASCII without markup, Texinfo input format, LaTeX input format,
5022- SGML or XML using a publicly available DTD, and standard-conforming
5023- simple HTML, PostScript or PDF designed for human modification.
5024- Examples of transparent image formats include PNG, XCF and JPG.
5025- Opaque formats include proprietary formats that can be read and
5026- edited only by proprietary word processors, SGML or XML for which
5027- the DTD and/or processing tools are not generally available, and
5028- the machine-generated HTML, PostScript or PDF produced by some word
5029- processors for output purposes only.
5030-
5031- The "Title Page" means, for a printed book, the title page itself,
5032- plus such following pages as are needed to hold, legibly, the
5033- material this License requires to appear in the title page. For
5034- works in formats which do not have any title page as such, "Title
5035- Page" means the text near the most prominent appearance of the
5036- work's title, preceding the beginning of the body of the text.
5037-
5038- The "publisher" means any person or entity that distributes copies
5039- of the Document to the public.
5040-
5041- A section "Entitled XYZ" means a named subunit of the Document
5042- whose title either is precisely XYZ or contains XYZ in parentheses
5043- following text that translates XYZ in another language. (Here XYZ
5044- stands for a specific section name mentioned below, such as
5045- "Acknowledgements", "Dedications", "Endorsements", or "History".)
5046- To "Preserve the Title" of such a section when you modify the
5047- Document means that it remains a section "Entitled XYZ" according
5048- to this definition.
5049-
5050- The Document may include Warranty Disclaimers next to the notice
5051- which states that this License applies to the Document. These
5052- Warranty Disclaimers are considered to be included by reference in
5053- this License, but only as regards disclaiming warranties: any other
5054- implication that these Warranty Disclaimers may have is void and
5055- has no effect on the meaning of this License.
5056-
5057- 2. VERBATIM COPYING
5058-
5059- You may copy and distribute the Document in any medium, either
5060- commercially or noncommercially, provided that this License, the
5061- copyright notices, and the license notice saying this License
5062- applies to the Document are reproduced in all copies, and that you
5063- add no other conditions whatsoever to those of this License. You
5064- may not use technical measures to obstruct or control the reading
5065- or further copying of the copies you make or distribute. However,
5066- you may accept compensation in exchange for copies. If you
5067- distribute a large enough number of copies you must also follow the
5068- conditions in section 3.
5069-
5070- You may also lend copies, under the same conditions stated above,
5071- and you may publicly display copies.
5072-
5073- 3. COPYING IN QUANTITY
5074-
5075- If you publish printed copies (or copies in media that commonly
5076- have printed covers) of the Document, numbering more than 100, and
5077- the Document's license notice requires Cover Texts, you must
5078- enclose the copies in covers that carry, clearly and legibly, all
5079- these Cover Texts: Front-Cover Texts on the front cover, and
5080- Back-Cover Texts on the back cover. Both covers must also clearly
5081- and legibly identify you as the publisher of these copies. The
5082- front cover must present the full title with all words of the title
5083- equally prominent and visible. You may add other material on the
5084- covers in addition. Copying with changes limited to the covers, as
5085- long as they preserve the title of the Document and satisfy these
5086- conditions, can be treated as verbatim copying in other respects.
5087-
5088- If the required texts for either cover are too voluminous to fit
5089- legibly, you should put the first ones listed (as many as fit
5090- reasonably) on the actual cover, and continue the rest onto
5091- adjacent pages.
5092-
5093- If you publish or distribute Opaque copies of the Document
5094- numbering more than 100, you must either include a machine-readable
5095- Transparent copy along with each Opaque copy, or state in or with
5096- each Opaque copy a computer-network location from which the general
5097- network-using public has access to download using public-standard
5098- network protocols a complete Transparent copy of the Document, free
5099- of added material. If you use the latter option, you must take
5100- reasonably prudent steps, when you begin distribution of Opaque
5101- copies in quantity, to ensure that this Transparent copy will
5102- remain thus accessible at the stated location until at least one
5103- year after the last time you distribute an Opaque copy (directly or
5104- through your agents or retailers) of that edition to the public.
5105-
5106- It is requested, but not required, that you contact the authors of
5107- the Document well before redistributing any large number of copies,
5108- to give them a chance to provide you with an updated version of the
5109- Document.
5110-
5111- 4. MODIFICATIONS
5112-
5113- You may copy and distribute a Modified Version of the Document
5114- under the conditions of sections 2 and 3 above, provided that you
5115- release the Modified Version under precisely this License, with the
5116- Modified Version filling the role of the Document, thus licensing
5117- distribution and modification of the Modified Version to whoever
5118- possesses a copy of it. In addition, you must do these things in
5119- the Modified Version:
5120-
5121- A. Use in the Title Page (and on the covers, if any) a title
5122- distinct from that of the Document, and from those of previous
5123- versions (which should, if there were any, be listed in the
5124- History section of the Document). You may use the same title
5125- as a previous version if the original publisher of that
5126- version gives permission.
5127-
5128- B. List on the Title Page, as authors, one or more persons or
5129- entities responsible for authorship of the modifications in
5130- the Modified Version, together with at least five of the
5131- principal authors of the Document (all of its principal
5132- authors, if it has fewer than five), unless they release you
5133- from this requirement.
5134-
5135- C. State on the Title page the name of the publisher of the
5136- Modified Version, as the publisher.
5137-
5138- D. Preserve all the copyright notices of the Document.
5139-
5140- E. Add an appropriate copyright notice for your modifications
5141- adjacent to the other copyright notices.
5142-
5143- F. Include, immediately after the copyright notices, a license
5144- notice giving the public permission to use the Modified
5145- Version under the terms of this License, in the form shown in
5146- the Addendum below.
5147-
5148- G. Preserve in that license notice the full lists of Invariant
5149- Sections and required Cover Texts given in the Document's
5150- license notice.
5151-
5152- H. Include an unaltered copy of this License.
5153-
5154- I. Preserve the section Entitled "History", Preserve its Title,
5155- and add to it an item stating at least the title, year, new
5156- authors, and publisher of the Modified Version as given on the
5157- Title Page. If there is no section Entitled "History" in the
5158- Document, create one stating the title, year, authors, and
5159- publisher of the Document as given on its Title Page, then add
5160- an item describing the Modified Version as stated in the
5161- previous sentence.
5162-
5163- J. Preserve the network location, if any, given in the Document
5164- for public access to a Transparent copy of the Document, and
5165- likewise the network locations given in the Document for
5166- previous versions it was based on. These may be placed in the
5167- "History" section. You may omit a network location for a work
5168- that was published at least four years before the Document
5169- itself, or if the original publisher of the version it refers
5170- to gives permission.
5171-
5172- K. For any section Entitled "Acknowledgements" or "Dedications",
5173- Preserve the Title of the section, and preserve in the section
5174- all the substance and tone of each of the contributor
5175- acknowledgements and/or dedications given therein.
5176-
5177- L. Preserve all the Invariant Sections of the Document, unaltered
5178- in their text and in their titles. Section numbers or the
5179- equivalent are not considered part of the section titles.
5180-
5181- M. Delete any section Entitled "Endorsements". Such a section
5182- may not be included in the Modified Version.
5183-
5184- N. Do not retitle any existing section to be Entitled
5185- "Endorsements" or to conflict in title with any Invariant
5186- Section.
5187-
5188- O. Preserve any Warranty Disclaimers.
5189-
5190- If the Modified Version includes new front-matter sections or
5191- appendices that qualify as Secondary Sections and contain no
5192- material copied from the Document, you may at your option designate
5193- some or all of these sections as invariant. To do this, add their
5194- titles to the list of Invariant Sections in the Modified Version's
5195- license notice. These titles must be distinct from any other
5196- section titles.
5197-
5198- You may add a section Entitled "Endorsements", provided it contains
5199- nothing but endorsements of your Modified Version by various
5200- parties--for example, statements of peer review or that the text
5201- has been approved by an organization as the authoritative
5202- definition of a standard.
5203-
5204- You may add a passage of up to five words as a Front-Cover Text,
5205- and a passage of up to 25 words as a Back-Cover Text, to the end of
5206- the list of Cover Texts in the Modified Version. Only one passage
5207- of Front-Cover Text and one of Back-Cover Text may be added by (or
5208- through arrangements made by) any one entity. If the Document
5209- already includes a cover text for the same cover, previously added
5210- by you or by arrangement made by the same entity you are acting on
5211- behalf of, you may not add another; but you may replace the old
5212- one, on explicit permission from the previous publisher that added
5213- the old one.
5214-
5215- The author(s) and publisher(s) of the Document do not by this
5216- License give permission to use their names for publicity for or to
5217- assert or imply endorsement of any Modified Version.
5218-
5219- 5. COMBINING DOCUMENTS
5220-
5221- You may combine the Document with other documents released under
5222- this License, under the terms defined in section 4 above for
5223- modified versions, provided that you include in the combination all
5224- of the Invariant Sections of all of the original documents,
5225- unmodified, and list them all as Invariant Sections of your
5226- combined work in its license notice, and that you preserve all
5227- their Warranty Disclaimers.
5228-
5229- The combined work need only contain one copy of this License, and
5230- multiple identical Invariant Sections may be replaced with a single
5231- copy. If there are multiple Invariant Sections with the same name
5232- but different contents, make the title of each such section unique
5233- by adding at the end of it, in parentheses, the name of the
5234- original author or publisher of that section if known, or else a
5235- unique number. Make the same adjustment to the section titles in
5236- the list of Invariant Sections in the license notice of the
5237- combined work.
5238-
5239- In the combination, you must combine any sections Entitled
5240- "History" in the various original documents, forming one section
5241- Entitled "History"; likewise combine any sections Entitled
5242- "Acknowledgements", and any sections Entitled "Dedications". You
5243- must delete all sections Entitled "Endorsements."
5244-
5245- 6. COLLECTIONS OF DOCUMENTS
5246-
5247- You may make a collection consisting of the Document and other
5248- documents released under this License, and replace the individual
5249- copies of this License in the various documents with a single copy
5250- that is included in the collection, provided that you follow the
5251- rules of this License for verbatim copying of each of the documents
5252- in all other respects.
5253-
5254- You may extract a single document from such a collection, and
5255- distribute it individually under this License, provided you insert
5256- a copy of this License into the extracted document, and follow this
5257- License in all other respects regarding verbatim copying of that
5258- document.
5259-
5260- 7. AGGREGATION WITH INDEPENDENT WORKS
5261-
5262- A compilation of the Document or its derivatives with other
5263- separate and independent documents or works, in or on a volume of a
5264- storage or distribution medium, is called an "aggregate" if the
5265- copyright resulting from the compilation is not used to limit the
5266- legal rights of the compilation's users beyond what the individual
5267- works permit. When the Document is included in an aggregate, this
5268- License does not apply to the other works in the aggregate which
5269- are not themselves derivative works of the Document.
5270-
5271- If the Cover Text requirement of section 3 is applicable to these
5272- copies of the Document, then if the Document is less than one half
5273- of the entire aggregate, the Document's Cover Texts may be placed
5274- on covers that bracket the Document within the aggregate, or the
5275- electronic equivalent of covers if the Document is in electronic
5276- form. Otherwise they must appear on printed covers that bracket
5277- the whole aggregate.
5278-
5279- 8. TRANSLATION
5280-
5281- Translation is considered a kind of modification, so you may
5282- distribute translations of the Document under the terms of section
5283- 4. Replacing Invariant Sections with translations requires special
5284- permission from their copyright holders, but you may include
5285- translations of some or all Invariant Sections in addition to the
5286- original versions of these Invariant Sections. You may include a
5287- translation of this License, and all the license notices in the
5288- Document, and any Warranty Disclaimers, provided that you also
5289- include the original English version of this License and the
5290- original versions of those notices and disclaimers. In case of a
5291- disagreement between the translation and the original version of
5292- this License or a notice or disclaimer, the original version will
5293- prevail.
5294-
5295- If a section in the Document is Entitled "Acknowledgements",
5296- "Dedications", or "History", the requirement (section 4) to
5297- Preserve its Title (section 1) will typically require changing the
5298- actual title.
5299-
5300- 9. TERMINATION
5301-
5302- You may not copy, modify, sublicense, or distribute the Document
5303- except as expressly provided under this License. Any attempt
5304- otherwise to copy, modify, sublicense, or distribute it is void,
5305- and will automatically terminate your rights under this License.
5306-
5307- However, if you cease all violation of this License, then your
5308- license from a particular copyright holder is reinstated (a)
5309- provisionally, unless and until the copyright holder explicitly and
5310- finally terminates your license, and (b) permanently, if the
5311- copyright holder fails to notify you of the violation by some
5312- reasonable means prior to 60 days after the cessation.
5313-
5314- Moreover, your license from a particular copyright holder is
5315- reinstated permanently if the copyright holder notifies you of the
5316- violation by some reasonable means, this is the first time you have
5317- received notice of violation of this License (for any work) from
5318- that copyright holder, and you cure the violation prior to 30 days
5319- after your receipt of the notice.
5320-
5321- Termination of your rights under this section does not terminate
5322- the licenses of parties who have received copies or rights from you
5323- under this License. If your rights have been terminated and not
5324- permanently reinstated, receipt of a copy of some or all of the
5325- same material does not give you any rights to use it.
5326-
5327- 10. FUTURE REVISIONS OF THIS LICENSE
5328-
5329- The Free Software Foundation may publish new, revised versions of
5330- the GNU Free Documentation License from time to time. Such new
5331- versions will be similar in spirit to the present version, but may
5332- differ in detail to address new problems or concerns. See
5333- <http://www.gnu.org/copyleft/>.
5334-
5335- Each version of the License is given a distinguishing version
5336- number. If the Document specifies that a particular numbered
5337- version of this License "or any later version" applies to it, you
5338- have the option of following the terms and conditions either of
5339- that specified version or of any later version that has been
5340- published (not as a draft) by the Free Software Foundation. If the
5341- Document does not specify a version number of this License, you may
5342- choose any version ever published (not as a draft) by the Free
5343- Software Foundation. If the Document specifies that a proxy can
5344- decide which future versions of this License can be used, that
5345- proxy's public statement of acceptance of a version permanently
5346- authorizes you to choose that version for the Document.
5347-
5348- 11. RELICENSING
5349-
5350- "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
5351- World Wide Web server that publishes copyrightable works and also
5352- provides prominent facilities for anybody to edit those works. A
5353- public wiki that anybody can edit is an example of such a server.
5354- A "Massive Multiauthor Collaboration" (or "MMC") contained in the
5355- site means any set of copyrightable works thus published on the MMC
5356- site.
5357-
5358- "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
5359- license published by Creative Commons Corporation, a not-for-profit
5360- corporation with a principal place of business in San Francisco,
5361- California, as well as future copyleft versions of that license
5362- published by that same organization.
5363-
5364- "Incorporate" means to publish or republish a Document, in whole or
5365- in part, as part of another Document.
5366-
5367- An MMC is "eligible for relicensing" if it is licensed under this
5368- License, and if all works that were first published under this
5369- License somewhere other than this MMC, and subsequently
5370- incorporated in whole or in part into the MMC, (1) had no cover
5371- texts or invariant sections, and (2) were thus incorporated prior
5372- to November 1, 2008.
5373-
5374- The operator of an MMC Site may republish an MMC contained in the
5375- site under CC-BY-SA on the same site at any time before August 1,
5376- 2009, provided the MMC is eligible for relicensing.
5377-
5378-ADDENDUM: How to use this License for your documents
5379-====================================================
5380-
5381-To use this License in a document you have written, include a copy of
5382-the License in the document and put the following copyright and license
5383-notices just after the title page:
5384-
5385- Copyright (C) YEAR YOUR NAME.
5386- Permission is granted to copy, distribute and/or modify this document
5387- under the terms of the GNU Free Documentation License, Version 1.3
5388- or any later version published by the Free Software Foundation;
5389- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
5390- Texts. A copy of the license is included in the section entitled ``GNU
5391- Free Documentation License''.
5392-
5393- If you have Invariant Sections, Front-Cover Texts and Back-Cover
5394-Texts, replace the "with...Texts." line with this:
5395-
5396- with the Invariant Sections being LIST THEIR TITLES, with
5397- the Front-Cover Texts being LIST, and with the Back-Cover Texts
5398- being LIST.
5399-
5400- If you have Invariant Sections without Cover Texts, or some other
5401-combination of the three, merge those two alternatives to suit the
5402-situation.
5403-
5404- If your document contains nontrivial examples of program code, we
5405-recommend releasing these examples in parallel under your choice of free
5406-software license, such as the GNU General Public License, to permit
5407-their use in free software.
5408-
5409-
5410-File: libitm.info, Node: Index, Prev: GNU Free Documentation License, Up: Top
5411-
5412-Index
5413-*****
5414-
5415-[index]
5416-* Menu:
5417-
5418-* FDL, GNU Free Documentation License: GNU Free Documentation License.
5419- (line 6)
5420-* Introduction: Top. (line 6)
5421-
5422-
5423-
5424-Tag Table:
5425-Node: Top1141
5426-Node: Enabling libitm2045
5427-Node: C/C++ Language Constructs for TM2440
5428-Node: The libitm ABI3923
5429-Ref: txn-code-properties7721
5430-Node: Internals18026
5431-Ref: serial-lock-impl28064
5432-Ref: progress-guarantees32825
5433-Node: GNU Free Documentation License35103
5434-Node: Index60224
[88af5df]5435-
5436-End Tag Table
[2e59d11]5437diff -Naur gcc-4.8.2.orig/libquadmath/libquadmath.info gcc-4.8.2/libquadmath/libquadmath.info
5438--- gcc-4.8.2.orig/libquadmath/libquadmath.info 2013-10-16 08:18:56.000000000 +0000
5439+++ gcc-4.8.2/libquadmath/libquadmath.info 1970-01-01 00:00:00.000000000 +0000
5440@@ -1,808 +0,0 @@
5441-This is libquadmath.info, produced by makeinfo version 5.1 from
5442-libquadmath.texi.
5443-
5444-Copyright (C) 2010-2013 Free Software Foundation, Inc.
5445-
5446- Permission is granted to copy, distribute and/or modify this
5447- document under the terms of the GNU Free Documentation License,
5448- Version 1.2 or any later version published by the Free Software
5449- Foundation; with no Invariant Sections, with the Front-Cover Texts
5450- being "A GNU Manual," and with the Back-Cover Texts as in (a)
5451- below. A copy of the license is included in the section entitled
5452- "GNU Free Documentation License."
5453-
5454- (a) The FSF's Back-Cover Text is: "You have the freedom to copy and
5455- modify this GNU manual.
5456-INFO-DIR-SECTION GNU Libraries
5457-START-INFO-DIR-ENTRY
5458-* libquadmath: (libquadmath). GCC Quad-Precision Math Library
5459-END-INFO-DIR-ENTRY
5460-
5461- This manual documents the GCC Quad-Precision Math Library API.
5462-
5463- Published by the Free Software Foundation 51 Franklin Street, Fifth
5464-Floor Boston, MA 02110-1301 USA
5465-
5466- Copyright (C) 2010-2013 Free Software Foundation, Inc.
5467-
5468- Permission is granted to copy, distribute and/or modify this
5469- document under the terms of the GNU Free Documentation License,
5470- Version 1.2 or any later version published by the Free Software
5471- Foundation; with no Invariant Sections, with the Front-Cover Texts
5472- being "A GNU Manual," and with the Back-Cover Texts as in (a)
5473- below. A copy of the license is included in the section entitled
5474- "GNU Free Documentation License."
5475-
5476- (a) The FSF's Back-Cover Text is: "You have the freedom to copy and
5477- modify this GNU manual.
5478-
5479-
5480-File: libquadmath.info, Node: Top, Next: Typedef and constants, Up: (dir)
5481-
5482-Introduction
5483-************
5484-
5485-This manual documents the usage of libquadmath, the GCC Quad-Precision
5486-Math Library Application Programming Interface (API).
5487-
5488-* Menu:
5489-
5490-* Typedef and constants:: Defined data types and constants
5491-* Math Library Routines:: The Libquadmath math runtime application
5492- programming interface.
5493-* I/O Library Routines:: The Libquadmath I/O runtime application
5494- programming interface.
5495-* GNU Free Documentation License::
5496- How you can copy and share this manual.
5497-* Reporting Bugs:: How to report bugs in GCC Libquadmath.
5498-
5499-
5500-File: libquadmath.info, Node: Typedef and constants, Next: Math Library Routines, Prev: Top, Up: Top
5501-
5502-1 Typedef and constants
5503-***********************
5504-
5505-The following data type has been defined via 'typedef'.
5506-
5507-'__complex128': '__float128'-based complex number
5508-
5509- The following macros are defined, which give the numeric limits of
5510-the '__float128' data type.
5511-
5512-'FLT128_MAX': largest finite number
5513-'FLT128_MIN': smallest positive number with full precision
5514-'FLT128_EPSILON': difference between 1 and the next larger
5515- representable number
5516-'FLT128_DENORM_MIN': smallest positive denormalized number
5517-'FLT128_MANT_DIG': number of digits in the mantissa (bit precision)
5518-'FLT128_MIN_EXP': maximal negative exponent
5519-'FLT128_MAX_EXP': maximal positive exponent
5520-'FLT128_DIG': number of decimal digits in the mantissa
5521-'FLT128_MIN_10_EXP': maximal negative decimal exponent
5522-'FLT128_MAX_10_EXP': maximal positive decimal exponent
5523-
5524- The following mathematical constants of type '__float128' are
5525-defined.
5526-
5527-'M_Eq': the constant e (Euler's number)
5528-'M_LOG2Eq': binary logarithm of 2
5529-'M_LOG10Eq': common, decimal logarithm of 2
5530-'M_LN2q': natural logarithm of 2
5531-'M_LN10q': natural logarithm of 10
5532-'M_PIq': pi
5533-'M_PI_2q': pi divided by two
5534-'M_PI_4q': pi divided by four
5535-'M_1_PIq': one over pi
5536-'M_2_PIq': one over two pi
5537-'M_2_SQRTPIq': two over square root of pi
5538-'M_SQRT2q': square root of 2
5539-'M_SQRT1_2q': one over square root of 2
5540-
5541-
5542-File: libquadmath.info, Node: Math Library Routines, Next: I/O Library Routines, Prev: Typedef and constants, Up: Top
5543-
5544-2 Math Library Routines
5545-***********************
5546-
5547-The following mathematical functions are available:
5548-
5549-'acosq': arc cosine function
5550-'acoshq': inverse hyperbolic cosine function
5551-'asinq': arc sine function
5552-'asinhq': inverse hyperbolic sine function
5553-'atanq': arc tangent function
5554-'atanhq': inverse hyperbolic tangent function
5555-'atan2q': arc tangent function
5556-'cbrtq': cube root function
5557-'ceilq': ceiling value function
5558-'copysignq': copy sign of a number
5559-'coshq': hyperbolic cosine function
5560-'cosq': cosine function
5561-'erfq': error function
5562-'erfcq': complementary error function
5563-'expq': exponential function
5564-'expm1q': exponential minus 1 function
5565-'fabsq': absolute value function
5566-'fdimq': positive difference function
5567-'finiteq': check finiteness of value
5568-'floorq': floor value function
5569-'fmaq': fused multiply and add
5570-'fmaxq': determine maximum of two values
5571-'fminq': determine minimum of two values
5572-'fmodq': remainder value function
5573-'frexpq': extract mantissa and exponent
5574-'hypotq': Eucledian distance function
5575-'ilogbq': get exponent of the value
5576-'isinfq': check for infinity
5577-'isnanq': check for not a number
5578-'j0q': Bessel function of the first kind, first order
5579-'j1q': Bessel function of the first kind, second order
5580-'jnq': Bessel function of the first kind, N-th order
5581-'ldexpq': load exponent of the value
5582-'lgammaq': logarithmic gamma function
5583-'llrintq': round to nearest integer value
5584-'llroundq': round to nearest integer value away from zero
5585-'logq': natural logarithm function
5586-'log10q': base 10 logarithm function
5587-'log1pq': compute natural logarithm of the value plus one
5588-'log2q': base 2 logarithm function
5589-'lrintq': round to nearest integer value
5590-'lroundq': round to nearest integer value away from zero
5591-'modfq': decompose the floating-point number
5592-'nanq': return quiet NaN
5593-'nearbyintq': round to nearest integer
5594-'nextafterq': next representable floating-point number
5595-'powq': power function
5596-'remainderq': remainder function
5597-'remquoq': remainder and part of quotient
5598-'rintq': round-to-nearest integral value
5599-'roundq': round-to-nearest integral value, return '__float128'
5600-'scalblnq': compute exponent using 'FLT_RADIX'
5601-'scalbnq': compute exponent using 'FLT_RADIX'
5602-'signbitq': return sign bit
5603-'sincosq': calculate sine and cosine simulataneously
5604-'sinhq': hyperbolic sine function
5605-'sinq': sine function
5606-'sqrtq': square root function
5607-'tanq': tangent function
5608-'tanhq': hyperbolic tangent function
5609-'tgammaq': true gamma function
5610-'truncq': round to integer, towards zero
5611-'y0q': Bessel function of the second kind, first order
5612-'y1q': Bessel function of the second kind, second order
5613-'ynq': Bessel function of the second kind, N-th order
5614-'cabsq' complex absolute value function
5615-'cargq': calculate the argument
5616-'cimagq' imaginary part of complex number
5617-'crealq': real part of complex number
5618-'cacoshq': complex arc hyperbolic cosine function
5619-'cacosq': complex arc cosine function
5620-'casinhq': complex arc hyperbolic sine function
5621-'casinq': complex arc sine function
5622-'catanhq': complex arc hyperbolic tangent function
5623-'catanq': complex arc tangent function
5624-'ccosq' complex cosine function:
5625-'ccoshq': complex hyperbolic cosine function
5626-'cexpq': complex exponential function
5627-'cexpiq': computes the exponential function of "i" times a
5628- real value
5629-'clogq': complex natural logarithm
5630-'clog10q': complex base 10 logarithm
5631-'conjq': complex conjugate function
5632-'cpowq': complex power function
5633-'cprojq': project into Riemann Sphere
5634-'csinq': complex sine function
5635-'csinhq': complex hyperbolic sine function
5636-'csqrtq': complex square root
5637-'ctanq': complex tangent function
5638-'ctanhq': complex hyperbolic tangent function
5639-
5640-
5641-File: libquadmath.info, Node: I/O Library Routines, Next: GNU Free Documentation License, Prev: Math Library Routines, Up: Top
5642-
5643-3 I/O Library Routines
5644-**********************
5645-
5646-* Menu:
5647-
5648-* 'strtoflt128': strtoflt128, Convert from string
5649-* 'quadmath_snprintf': quadmath_snprintf, Convert to string
5650-
5651-
5652-File: libquadmath.info, Node: strtoflt128, Next: quadmath_snprintf, Up: I/O Library Routines
5653-
5654-3.1 'strtoflt128' -- Convert from string
5655-========================================
5656-
5657-The function 'strtoflt128' converts a string into a '__float128' number.
5658-
5659-Syntax
5660- '__float128 strtoflt128 (const char *s, char **sp)'
5661-
5662-_Arguments_:
5663- S input string
5664- SP the address of the next character in the string
5665-
5666- The argument SP contains, if not 'NULL', the address of the next
5667- character following the parts of the string, which have been read.
5668-
5669-Example
5670- #include <quadmath.h>
5671-
5672- int main ()
5673- {
5674- __float128 r;
5675-
5676- r = strtoflt128 ("1.2345678", NULL);
5677-
5678- return 0;
5679- }
5680-
5681-
5682-File: libquadmath.info, Node: quadmath_snprintf, Prev: strtoflt128, Up: I/O Library Routines
5683-
5684-3.2 'quadmath_snprintf' -- Convert to string
5685-============================================
5686-
5687-The function 'quadmath_snprintf' converts a '__float128' floating-point
5688-number into a string. It is a specialized alternative to 'snprintf',
5689-where the format string is restricted to a single conversion specifier
5690-with 'Q' modifier and conversion specifier 'e', 'E', 'f', 'F', 'g', 'G',
5691-'a' or 'A', with no extra characters before or after the conversion
5692-specifier. The '%m$' or '*m$' style must not be used in the format.
5693-
5694-Syntax
5695- 'int quadmath_snprintf (char *s, size_t size, const char *format,
5696- ...)'
5697-
5698-_Arguments_:
5699- S output string
5700- SIZE byte size of the string, including tailing NUL
5701- FORMAT conversion specifier string
5702-
5703-Note
5704- On some targets when supported by the C library hooks are installed
5705- for 'printf' family of functions, so that 'printf ("%Qe", 1.2Q);'
5706- etc. works too.
5707-
5708-Example
5709- #include <quadmath.h>
5710- #include <stdlib.h>
5711- #include <stdio.h>
5712-
5713- int main ()
5714- {
5715- __float128 r;
5716- int prec = 20;
5717- int width = 46;
5718- char buf[128];
5719-
5720- r = 2.0q;
5721- r = sqrtq (r);
5722- int n = quadmath_snprintf (buf, sizeof buf, "%+-#*.20Qe", width, r);
5723- if ((size_t) n < sizeof buf)
5724- printf ("%s\n", buf);
5725- /* Prints: +1.41421356237309504880e+00 */
5726- quadmath_snprintf (buf, sizeof buf, "%Qa", r);
5727- if ((size_t) n < sizeof buf)
5728- printf ("%s\n", buf);
5729- /* Prints: 0x1.6a09e667f3bcc908b2fb1366ea96p+0 */
5730- n = quadmath_snprintf (NULL, 0, "%+-#46.*Qe", prec, r);
5731- if (n > -1)
5732- {
5733- char *str = malloc (n + 1);
5734- if (str)
5735- {
5736- quadmath_snprintf (str, n + 1, "%+-#46.*Qe", prec, r);
5737- printf ("%s\n", str);
5738- /* Prints: +1.41421356237309504880e+00 */
5739- }
5740- free (str);
5741- }
5742- return 0;
5743- }
5744-
5745-
5746-File: libquadmath.info, Node: GNU Free Documentation License, Next: Reporting Bugs, Prev: I/O Library Routines, Up: Top
5747-
5748-GNU Free Documentation License
5749-******************************
5750-
5751- Version 1.3, 3 November 2008
5752-
5753- Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
5754- <http://fsf.org/>
5755-
5756- Everyone is permitted to copy and distribute verbatim copies
5757- of this license document, but changing it is not allowed.
5758-
5759- 0. PREAMBLE
5760-
5761- The purpose of this License is to make a manual, textbook, or other
5762- functional and useful document "free" in the sense of freedom: to
5763- assure everyone the effective freedom to copy and redistribute it,
5764- with or without modifying it, either commercially or
5765- noncommercially. Secondarily, this License preserves for the
5766- author and publisher a way to get credit for their work, while not
5767- being considered responsible for modifications made by others.
5768-
5769- This License is a kind of "copyleft", which means that derivative
5770- works of the document must themselves be free in the same sense.
5771- It complements the GNU General Public License, which is a copyleft
5772- license designed for free software.
5773-
5774- We have designed this License in order to use it for manuals for
5775- free software, because free software needs free documentation: a
5776- free program should come with manuals providing the same freedoms
5777- that the software does. But this License is not limited to
5778- software manuals; it can be used for any textual work, regardless
5779- of subject matter or whether it is published as a printed book. We
5780- recommend this License principally for works whose purpose is
5781- instruction or reference.
5782-
5783- 1. APPLICABILITY AND DEFINITIONS
5784-
5785- This License applies to any manual or other work, in any medium,
5786- that contains a notice placed by the copyright holder saying it can
5787- be distributed under the terms of this License. Such a notice
5788- grants a world-wide, royalty-free license, unlimited in duration,
5789- to use that work under the conditions stated herein. The
5790- "Document", below, refers to any such manual or work. Any member
5791- of the public is a licensee, and is addressed as "you". You accept
5792- the license if you copy, modify or distribute the work in a way
5793- requiring permission under copyright law.
5794-
5795- A "Modified Version" of the Document means any work containing the
5796- Document or a portion of it, either copied verbatim, or with
5797- modifications and/or translated into another language.
5798-
5799- A "Secondary Section" is a named appendix or a front-matter section
5800- of the Document that deals exclusively with the relationship of the
5801- publishers or authors of the Document to the Document's overall
5802- subject (or to related matters) and contains nothing that could
5803- fall directly within that overall subject. (Thus, if the Document
5804- is in part a textbook of mathematics, a Secondary Section may not
5805- explain any mathematics.) The relationship could be a matter of
5806- historical connection with the subject or with related matters, or
5807- of legal, commercial, philosophical, ethical or political position
5808- regarding them.
5809-
5810- The "Invariant Sections" are certain Secondary Sections whose
5811- titles are designated, as being those of Invariant Sections, in the
5812- notice that says that the Document is released under this License.
5813- If a section does not fit the above definition of Secondary then it
5814- is not allowed to be designated as Invariant. The Document may
5815- contain zero Invariant Sections. If the Document does not identify
5816- any Invariant Sections then there are none.
5817-
5818- The "Cover Texts" are certain short passages of text that are
5819- listed, as Front-Cover Texts or Back-Cover Texts, in the notice
5820- that says that the Document is released under this License. A
5821- Front-Cover Text may be at most 5 words, and a Back-Cover Text may
5822- be at most 25 words.
5823-
5824- A "Transparent" copy of the Document means a machine-readable copy,
5825- represented in a format whose specification is available to the
5826- general public, that is suitable for revising the document
5827- straightforwardly with generic text editors or (for images composed
5828- of pixels) generic paint programs or (for drawings) some widely
5829- available drawing editor, and that is suitable for input to text
5830- formatters or for automatic translation to a variety of formats
5831- suitable for input to text formatters. A copy made in an otherwise
5832- Transparent file format whose markup, or absence of markup, has
5833- been arranged to thwart or discourage subsequent modification by
5834- readers is not Transparent. An image format is not Transparent if
5835- used for any substantial amount of text. A copy that is not
5836- "Transparent" is called "Opaque".
5837-
5838- Examples of suitable formats for Transparent copies include plain
5839- ASCII without markup, Texinfo input format, LaTeX input format,
5840- SGML or XML using a publicly available DTD, and standard-conforming
5841- simple HTML, PostScript or PDF designed for human modification.
5842- Examples of transparent image formats include PNG, XCF and JPG.
5843- Opaque formats include proprietary formats that can be read and
5844- edited only by proprietary word processors, SGML or XML for which
5845- the DTD and/or processing tools are not generally available, and
5846- the machine-generated HTML, PostScript or PDF produced by some word
5847- processors for output purposes only.
5848-
5849- The "Title Page" means, for a printed book, the title page itself,
5850- plus such following pages as are needed to hold, legibly, the
5851- material this License requires to appear in the title page. For
5852- works in formats which do not have any title page as such, "Title
5853- Page" means the text near the most prominent appearance of the
5854- work's title, preceding the beginning of the body of the text.
5855-
5856- The "publisher" means any person or entity that distributes copies
5857- of the Document to the public.
5858-
5859- A section "Entitled XYZ" means a named subunit of the Document
5860- whose title either is precisely XYZ or contains XYZ in parentheses
5861- following text that translates XYZ in another language. (Here XYZ
5862- stands for a specific section name mentioned below, such as
5863- "Acknowledgements", "Dedications", "Endorsements", or "History".)
5864- To "Preserve the Title" of such a section when you modify the
5865- Document means that it remains a section "Entitled XYZ" according
5866- to this definition.
5867-
5868- The Document may include Warranty Disclaimers next to the notice
5869- which states that this License applies to the Document. These
5870- Warranty Disclaimers are considered to be included by reference in
5871- this License, but only as regards disclaiming warranties: any other
5872- implication that these Warranty Disclaimers may have is void and
5873- has no effect on the meaning of this License.
5874-
5875- 2. VERBATIM COPYING
5876-
5877- You may copy and distribute the Document in any medium, either
5878- commercially or noncommercially, provided that this License, the
5879- copyright notices, and the license notice saying this License
5880- applies to the Document are reproduced in all copies, and that you
5881- add no other conditions whatsoever to those of this License. You
5882- may not use technical measures to obstruct or control the reading
5883- or further copying of the copies you make or distribute. However,
5884- you may accept compensation in exchange for copies. If you
5885- distribute a large enough number of copies you must also follow the
5886- conditions in section 3.
5887-
5888- You may also lend copies, under the same conditions stated above,
5889- and you may publicly display copies.
5890-
5891- 3. COPYING IN QUANTITY
5892-
5893- If you publish printed copies (or copies in media that commonly
5894- have printed covers) of the Document, numbering more than 100, and
5895- the Document's license notice requires Cover Texts, you must
5896- enclose the copies in covers that carry, clearly and legibly, all
5897- these Cover Texts: Front-Cover Texts on the front cover, and
5898- Back-Cover Texts on the back cover. Both covers must also clearly
5899- and legibly identify you as the publisher of these copies. The
5900- front cover must present the full title with all words of the title
5901- equally prominent and visible. You may add other material on the
5902- covers in addition. Copying with changes limited to the covers, as
5903- long as they preserve the title of the Document and satisfy these
5904- conditions, can be treated as verbatim copying in other respects.
5905-
5906- If the required texts for either cover are too voluminous to fit
5907- legibly, you should put the first ones listed (as many as fit
5908- reasonably) on the actual cover, and continue the rest onto
5909- adjacent pages.
5910-
5911- If you publish or distribute Opaque copies of the Document
5912- numbering more than 100, you must either include a machine-readable
5913- Transparent copy along with each Opaque copy, or state in or with
5914- each Opaque copy a computer-network location from which the general
5915- network-using public has access to download using public-standard
5916- network protocols a complete Transparent copy of the Document, free
5917- of added material. If you use the latter option, you must take
5918- reasonably prudent steps, when you begin distribution of Opaque
5919- copies in quantity, to ensure that this Transparent copy will
5920- remain thus accessible at the stated location until at least one
5921- year after the last time you distribute an Opaque copy (directly or
5922- through your agents or retailers) of that edition to the public.
5923-
5924- It is requested, but not required, that you contact the authors of
5925- the Document well before redistributing any large number of copies,
5926- to give them a chance to provide you with an updated version of the
5927- Document.
5928-
5929- 4. MODIFICATIONS
5930-
5931- You may copy and distribute a Modified Version of the Document
5932- under the conditions of sections 2 and 3 above, provided that you
5933- release the Modified Version under precisely this License, with the
5934- Modified Version filling the role of the Document, thus licensing
5935- distribution and modification of the Modified Version to whoever
5936- possesses a copy of it. In addition, you must do these things in
5937- the Modified Version:
5938-
5939- A. Use in the Title Page (and on the covers, if any) a title
5940- distinct from that of the Document, and from those of previous
5941- versions (which should, if there were any, be listed in the
5942- History section of the Document). You may use the same title
5943- as a previous version if the original publisher of that
5944- version gives permission.
5945-
5946- B. List on the Title Page, as authors, one or more persons or
5947- entities responsible for authorship of the modifications in
5948- the Modified Version, together with at least five of the
5949- principal authors of the Document (all of its principal
5950- authors, if it has fewer than five), unless they release you
5951- from this requirement.
5952-
5953- C. State on the Title page the name of the publisher of the
5954- Modified Version, as the publisher.
5955-
5956- D. Preserve all the copyright notices of the Document.
5957-
5958- E. Add an appropriate copyright notice for your modifications
5959- adjacent to the other copyright notices.
5960-
5961- F. Include, immediately after the copyright notices, a license
5962- notice giving the public permission to use the Modified
5963- Version under the terms of this License, in the form shown in
5964- the Addendum below.
5965-
5966- G. Preserve in that license notice the full lists of Invariant
5967- Sections and required Cover Texts given in the Document's
5968- license notice.
5969-
5970- H. Include an unaltered copy of this License.
5971-
5972- I. Preserve the section Entitled "History", Preserve its Title,
5973- and add to it an item stating at least the title, year, new
5974- authors, and publisher of the Modified Version as given on the
5975- Title Page. If there is no section Entitled "History" in the
5976- Document, create one stating the title, year, authors, and
5977- publisher of the Document as given on its Title Page, then add
5978- an item describing the Modified Version as stated in the
5979- previous sentence.
5980-
5981- J. Preserve the network location, if any, given in the Document
5982- for public access to a Transparent copy of the Document, and
5983- likewise the network locations given in the Document for
5984- previous versions it was based on. These may be placed in the
5985- "History" section. You may omit a network location for a work
5986- that was published at least four years before the Document
5987- itself, or if the original publisher of the version it refers
5988- to gives permission.
5989-
5990- K. For any section Entitled "Acknowledgements" or "Dedications",
5991- Preserve the Title of the section, and preserve in the section
5992- all the substance and tone of each of the contributor
5993- acknowledgements and/or dedications given therein.
5994-
5995- L. Preserve all the Invariant Sections of the Document, unaltered
5996- in their text and in their titles. Section numbers or the
5997- equivalent are not considered part of the section titles.
5998-
5999- M. Delete any section Entitled "Endorsements". Such a section
6000- may not be included in the Modified Version.
6001-
6002- N. Do not retitle any existing section to be Entitled
6003- "Endorsements" or to conflict in title with any Invariant
6004- Section.
6005-
6006- O. Preserve any Warranty Disclaimers.
6007-
6008- If the Modified Version includes new front-matter sections or
6009- appendices that qualify as Secondary Sections and contain no
6010- material copied from the Document, you may at your option designate
6011- some or all of these sections as invariant. To do this, add their
6012- titles to the list of Invariant Sections in the Modified Version's
6013- license notice. These titles must be distinct from any other
6014- section titles.
6015-
6016- You may add a section Entitled "Endorsements", provided it contains
6017- nothing but endorsements of your Modified Version by various
6018- parties--for example, statements of peer review or that the text
6019- has been approved by an organization as the authoritative
6020- definition of a standard.
6021-
6022- You may add a passage of up to five words as a Front-Cover Text,
6023- and a passage of up to 25 words as a Back-Cover Text, to the end of
6024- the list of Cover Texts in the Modified Version. Only one passage
6025- of Front-Cover Text and one of Back-Cover Text may be added by (or
6026- through arrangements made by) any one entity. If the Document
6027- already includes a cover text for the same cover, previously added
6028- by you or by arrangement made by the same entity you are acting on
6029- behalf of, you may not add another; but you may replace the old
6030- one, on explicit permission from the previous publisher that added
6031- the old one.
6032-
6033- The author(s) and publisher(s) of the Document do not by this
6034- License give permission to use their names for publicity for or to
6035- assert or imply endorsement of any Modified Version.
6036-
6037- 5. COMBINING DOCUMENTS
6038-
6039- You may combine the Document with other documents released under
6040- this License, under the terms defined in section 4 above for
6041- modified versions, provided that you include in the combination all
6042- of the Invariant Sections of all of the original documents,
6043- unmodified, and list them all as Invariant Sections of your
6044- combined work in its license notice, and that you preserve all
6045- their Warranty Disclaimers.
6046-
6047- The combined work need only contain one copy of this License, and
6048- multiple identical Invariant Sections may be replaced with a single
6049- copy. If there are multiple Invariant Sections with the same name
6050- but different contents, make the title of each such section unique
6051- by adding at the end of it, in parentheses, the name of the
6052- original author or publisher of that section if known, or else a
6053- unique number. Make the same adjustment to the section titles in
6054- the list of Invariant Sections in the license notice of the
6055- combined work.
6056-
6057- In the combination, you must combine any sections Entitled
6058- "History" in the various original documents, forming one section
6059- Entitled "History"; likewise combine any sections Entitled
6060- "Acknowledgements", and any sections Entitled "Dedications". You
6061- must delete all sections Entitled "Endorsements."
6062-
6063- 6. COLLECTIONS OF DOCUMENTS
6064-
6065- You may make a collection consisting of the Document and other
6066- documents released under this License, and replace the individual
6067- copies of this License in the various documents with a single copy
6068- that is included in the collection, provided that you follow the
6069- rules of this License for verbatim copying of each of the documents
6070- in all other respects.
6071-
6072- You may extract a single document from such a collection, and
6073- distribute it individually under this License, provided you insert
6074- a copy of this License into the extracted document, and follow this
6075- License in all other respects regarding verbatim copying of that
6076- document.
6077-
6078- 7. AGGREGATION WITH INDEPENDENT WORKS
6079-
6080- A compilation of the Document or its derivatives with other
6081- separate and independent documents or works, in or on a volume of a
6082- storage or distribution medium, is called an "aggregate" if the
6083- copyright resulting from the compilation is not used to limit the
6084- legal rights of the compilation's users beyond what the individual
6085- works permit. When the Document is included in an aggregate, this
6086- License does not apply to the other works in the aggregate which
6087- are not themselves derivative works of the Document.
6088-
6089- If the Cover Text requirement of section 3 is applicable to these
6090- copies of the Document, then if the Document is less than one half
6091- of the entire aggregate, the Document's Cover Texts may be placed
6092- on covers that bracket the Document within the aggregate, or the
6093- electronic equivalent of covers if the Document is in electronic
6094- form. Otherwise they must appear on printed covers that bracket
6095- the whole aggregate.
6096-
6097- 8. TRANSLATION
6098-
6099- Translation is considered a kind of modification, so you may
6100- distribute translations of the Document under the terms of section
6101- 4. Replacing Invariant Sections with translations requires special
6102- permission from their copyright holders, but you may include
6103- translations of some or all Invariant Sections in addition to the
6104- original versions of these Invariant Sections. You may include a
6105- translation of this License, and all the license notices in the
6106- Document, and any Warranty Disclaimers, provided that you also
6107- include the original English version of this License and the
6108- original versions of those notices and disclaimers. In case of a
6109- disagreement between the translation and the original version of
6110- this License or a notice or disclaimer, the original version will
6111- prevail.
6112-
6113- If a section in the Document is Entitled "Acknowledgements",
6114- "Dedications", or "History", the requirement (section 4) to
6115- Preserve its Title (section 1) will typically require changing the
6116- actual title.
6117-
6118- 9. TERMINATION
6119-
6120- You may not copy, modify, sublicense, or distribute the Document
6121- except as expressly provided under this License. Any attempt
6122- otherwise to copy, modify, sublicense, or distribute it is void,
6123- and will automatically terminate your rights under this License.
6124-
6125- However, if you cease all violation of this License, then your
6126- license from a particular copyright holder is reinstated (a)
6127- provisionally, unless and until the copyright holder explicitly and
6128- finally terminates your license, and (b) permanently, if the
6129- copyright holder fails to notify you of the violation by some
6130- reasonable means prior to 60 days after the cessation.
6131-
6132- Moreover, your license from a particular copyright holder is
6133- reinstated permanently if the copyright holder notifies you of the
6134- violation by some reasonable means, this is the first time you have
6135- received notice of violation of this License (for any work) from
6136- that copyright holder, and you cure the violation prior to 30 days
6137- after your receipt of the notice.
6138-
6139- Termination of your rights under this section does not terminate
6140- the licenses of parties who have received copies or rights from you
6141- under this License. If your rights have been terminated and not
6142- permanently reinstated, receipt of a copy of some or all of the
6143- same material does not give you any rights to use it.
6144-
6145- 10. FUTURE REVISIONS OF THIS LICENSE
6146-
6147- The Free Software Foundation may publish new, revised versions of
6148- the GNU Free Documentation License from time to time. Such new
6149- versions will be similar in spirit to the present version, but may
6150- differ in detail to address new problems or concerns. See
6151- <http://www.gnu.org/copyleft/>.
6152-
6153- Each version of the License is given a distinguishing version
6154- number. If the Document specifies that a particular numbered
6155- version of this License "or any later version" applies to it, you
6156- have the option of following the terms and conditions either of
6157- that specified version or of any later version that has been
6158- published (not as a draft) by the Free Software Foundation. If the
6159- Document does not specify a version number of this License, you may
6160- choose any version ever published (not as a draft) by the Free
6161- Software Foundation. If the Document specifies that a proxy can
6162- decide which future versions of this License can be used, that
6163- proxy's public statement of acceptance of a version permanently
6164- authorizes you to choose that version for the Document.
6165-
6166- 11. RELICENSING
6167-
6168- "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
6169- World Wide Web server that publishes copyrightable works and also
6170- provides prominent facilities for anybody to edit those works. A
6171- public wiki that anybody can edit is an example of such a server.
6172- A "Massive Multiauthor Collaboration" (or "MMC") contained in the
6173- site means any set of copyrightable works thus published on the MMC
6174- site.
6175-
6176- "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
6177- license published by Creative Commons Corporation, a not-for-profit
6178- corporation with a principal place of business in San Francisco,
6179- California, as well as future copyleft versions of that license
6180- published by that same organization.
6181-
6182- "Incorporate" means to publish or republish a Document, in whole or
6183- in part, as part of another Document.
6184-
6185- An MMC is "eligible for relicensing" if it is licensed under this
6186- License, and if all works that were first published under this
6187- License somewhere other than this MMC, and subsequently
6188- incorporated in whole or in part into the MMC, (1) had no cover
6189- texts or invariant sections, and (2) were thus incorporated prior
6190- to November 1, 2008.
6191-
6192- The operator of an MMC Site may republish an MMC contained in the
6193- site under CC-BY-SA on the same site at any time before August 1,
6194- 2009, provided the MMC is eligible for relicensing.
6195-
6196-ADDENDUM: How to use this License for your documents
6197-====================================================
6198-
6199-To use this License in a document you have written, include a copy of
6200-the License in the document and put the following copyright and license
6201-notices just after the title page:
6202-
6203- Copyright (C) YEAR YOUR NAME.
6204- Permission is granted to copy, distribute and/or modify this document
6205- under the terms of the GNU Free Documentation License, Version 1.3
6206- or any later version published by the Free Software Foundation;
6207- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
6208- Texts. A copy of the license is included in the section entitled ``GNU
6209- Free Documentation License''.
6210-
6211- If you have Invariant Sections, Front-Cover Texts and Back-Cover
6212-Texts, replace the "with...Texts." line with this:
6213-
6214- with the Invariant Sections being LIST THEIR TITLES, with
6215- the Front-Cover Texts being LIST, and with the Back-Cover Texts
6216- being LIST.
6217-
6218- If you have Invariant Sections without Cover Texts, or some other
6219-combination of the three, merge those two alternatives to suit the
6220-situation.
6221-
6222- If your document contains nontrivial examples of program code, we
6223-recommend releasing these examples in parallel under your choice of free
6224-software license, such as the GNU General Public License, to permit
6225-their use in free software.
6226-
6227-
6228-File: libquadmath.info, Node: Reporting Bugs, Prev: GNU Free Documentation License, Up: Top
6229-
6230-4 Reporting Bugs
6231-****************
6232-
6233-Bugs in the GCC Quad-Precision Math Library implementation should be
6234-reported via <http://gcc.gnu.org/bugs.html>.
6235-
6236-
6237-
6238-Tag Table:
6239-Node: Top1633
6240-Node: Typedef and constants2367
6241-Node: Math Library Routines3786
6242-Node: I/O Library Routines7503
6243-Node: strtoflt1287828
6244-Node: quadmath_snprintf8588
6245-Node: GNU Free Documentation License10798
[88af5df]6246-Node: Reporting Bugs35944
6247-
6248-End Tag Table
6249diff -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
6250--- gcc-4.8.2.orig/libstdc++-v3/include/bits/shared_ptr_base.h 2013-10-08 13:38:21.000000000 +0000
6251+++ gcc-4.8.2/libstdc++-v3/include/bits/shared_ptr_base.h 2013-11-01 16:12:34.311851849 +0000
6252@@ -391,7 +391,7 @@
6253 public:
6254 template<typename... _Args>
6255 _Sp_counted_ptr_inplace(_Alloc __a, _Args&&... __args)
6256- : _M_impl(__a), _M_storage()
6257+ : _M_impl(__a)
6258 {
6259 _M_impl._M_ptr = static_cast<_Tp*>(static_cast<void*>(&_M_storage));
6260 // _GLIBCXX_RESOLVE_LIB_DEFECTS
6261@@ -819,7 +819,7 @@
6262 : _M_ptr(__r.get()), _M_refcount()
6263 {
6264 __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
6265- auto __tmp = std::__addressof(*__r.get());
6266+ auto __tmp = __r.get();
[2e59d11]6267 _M_refcount = __shared_count<_Lp>(std::move(__r));
[88af5df]6268 __enable_shared_from_this_helper(_M_refcount, __tmp, __tmp);
6269 }
[2e59d11]6270diff -Naur gcc-4.8.2.orig/libstdc++-v3/include/bits/stl_algo.h gcc-4.8.2/libstdc++-v3/include/bits/stl_algo.h
6271--- gcc-4.8.2.orig/libstdc++-v3/include/bits/stl_algo.h 2013-09-30 17:42:52.000000000 +0000
6272+++ gcc-4.8.2/libstdc++-v3/include/bits/stl_algo.h 2013-11-01 16:12:34.399866997 +0000
6273@@ -2279,7 +2279,7 @@
6274 _RandomAccessIterator __last)
6275 {
6276 _RandomAccessIterator __mid = __first + (__last - __first) / 2;
6277- std::__move_median_to_first(__first, __first + 1, __mid, (__last - 2));
6278+ std::__move_median_to_first(__first, __first + 1, __mid, __last - 1);
6279 return std::__unguarded_partition(__first + 1, __last, *__first);
6280 }
6281
6282@@ -2291,7 +2291,7 @@
6283 _RandomAccessIterator __last, _Compare __comp)
6284 {
6285 _RandomAccessIterator __mid = __first + (__last - __first) / 2;
6286- std::__move_median_to_first(__first, __first + 1, __mid, (__last - 2),
6287+ std::__move_median_to_first(__first, __first + 1, __mid, __last - 1,
[88af5df]6288 __comp);
6289 return std::__unguarded_partition(__first + 1, __last, *__first, __comp);
6290 }
6291diff -Naur gcc-4.8.2.orig/libstdc++-v3/include/c_global/cstdio gcc-4.8.2/libstdc++-v3/include/c_global/cstdio
6292--- gcc-4.8.2.orig/libstdc++-v3/include/c_global/cstdio 2013-02-03 17:54:05.000000000 +0000
6293+++ gcc-4.8.2/libstdc++-v3/include/c_global/cstdio 2013-11-01 16:12:34.399866997 +0000
6294@@ -69,6 +69,7 @@
6295 #undef ftell
6296 #undef fwrite
6297 #undef getc
6298+#undef getchar
[2e59d11]6299 #undef gets
[88af5df]6300 #undef perror
6301 #undef printf
[2e59d11]6302diff -Naur gcc-4.8.2.orig/libstdc++-v3/include/debug/functions.h gcc-4.8.2/libstdc++-v3/include/debug/functions.h
6303--- gcc-4.8.2.orig/libstdc++-v3/include/debug/functions.h 2013-02-03 17:54:05.000000000 +0000
6304+++ gcc-4.8.2/libstdc++-v3/include/debug/functions.h 2013-11-01 16:12:34.399866997 +0000
6305@@ -345,11 +345,13 @@
6306 return __check_sorted_set_aux(__first, __last, __pred, _SameType());
6307 }
6308
6309+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
6310+ // 270. Binary search requirements overly strict
6311+ // Determine if a sequence is partitioned w.r.t. this element.
6312 template<typename _ForwardIterator, typename _Tp>
6313 inline bool
6314- __check_partitioned_lower_aux(_ForwardIterator __first,
6315- _ForwardIterator __last, const _Tp& __value,
6316- std::forward_iterator_tag)
6317+ __check_partitioned_lower(_ForwardIterator __first,
6318+ _ForwardIterator __last, const _Tp& __value)
6319 {
6320 while (__first != __last && *__first < __value)
6321 ++__first;
6322@@ -362,38 +364,11 @@
6323 return __first == __last;
6324 }
6325
6326- // For performance reason, as the iterator range has been validated, check on
6327- // random access safe iterators is done using the base iterator.
6328- template<typename _Iterator, typename _Sequence, typename _Tp>
6329- inline bool
6330- __check_partitioned_lower_aux(
6331- const _Safe_iterator<_Iterator, _Sequence>& __first,
6332- const _Safe_iterator<_Iterator, _Sequence>& __last,
6333- const _Tp& __value,
6334- std::random_access_iterator_tag __tag)
6335- {
6336- return __check_partitioned_lower_aux(__first.base(), __last.base(),
6337- __value, __tag);
6338- }
6339-
6340- // _GLIBCXX_RESOLVE_LIB_DEFECTS
6341- // 270. Binary search requirements overly strict
6342- // Determine if a sequence is partitioned w.r.t. this element.
6343 template<typename _ForwardIterator, typename _Tp>
6344 inline bool
6345- __check_partitioned_lower(_ForwardIterator __first,
6346+ __check_partitioned_upper(_ForwardIterator __first,
6347 _ForwardIterator __last, const _Tp& __value)
6348 {
6349- return __check_partitioned_lower_aux(__first, __last, __value,
6350- std::__iterator_category(__first));
6351- }
6352-
6353- template<typename _ForwardIterator, typename _Tp>
6354- inline bool
6355- __check_partitioned_upper_aux(_ForwardIterator __first,
6356- _ForwardIterator __last, const _Tp& __value,
6357- std::forward_iterator_tag)
6358- {
6359 while (__first != __last && !(__value < *__first))
6360 ++__first;
6361 if (__first != __last)
6362@@ -405,35 +380,12 @@
6363 return __first == __last;
6364 }
6365
6366- // For performance reason, as the iterator range has been validated, check on
6367- // random access safe iterators is done using the base iterator.
6368- template<typename _Iterator, typename _Sequence, typename _Tp>
6369- inline bool
6370- __check_partitioned_upper_aux(
6371- const _Safe_iterator<_Iterator, _Sequence>& __first,
6372- const _Safe_iterator<_Iterator, _Sequence>& __last,
6373- const _Tp& __value,
6374- std::random_access_iterator_tag __tag)
6375- {
6376- return __check_partitioned_upper_aux(__first.base(), __last.base(),
6377- __value, __tag);
6378- }
6379-
6380- template<typename _ForwardIterator, typename _Tp>
6381- inline bool
6382- __check_partitioned_upper(_ForwardIterator __first,
6383- _ForwardIterator __last, const _Tp& __value)
6384- {
6385- return __check_partitioned_upper_aux(__first, __last, __value,
6386- std::__iterator_category(__first));
6387- }
6388-
6389+ // Determine if a sequence is partitioned w.r.t. this element.
6390 template<typename _ForwardIterator, typename _Tp, typename _Pred>
6391 inline bool
6392- __check_partitioned_lower_aux(_ForwardIterator __first,
6393- _ForwardIterator __last, const _Tp& __value,
6394- _Pred __pred,
6395- std::forward_iterator_tag)
6396+ __check_partitioned_lower(_ForwardIterator __first,
6397+ _ForwardIterator __last, const _Tp& __value,
6398+ _Pred __pred)
6399 {
6400 while (__first != __last && bool(__pred(*__first, __value)))
6401 ++__first;
6402@@ -446,39 +398,12 @@
6403 return __first == __last;
6404 }
6405
6406- // For performance reason, as the iterator range has been validated, check on
6407- // random access safe iterators is done using the base iterator.
6408- template<typename _Iterator, typename _Sequence,
6409- typename _Tp, typename _Pred>
6410- inline bool
6411- __check_partitioned_lower_aux(
6412- const _Safe_iterator<_Iterator, _Sequence>& __first,
6413- const _Safe_iterator<_Iterator, _Sequence>& __last,
6414- const _Tp& __value, _Pred __pred,
6415- std::random_access_iterator_tag __tag)
6416- {
6417- return __check_partitioned_lower_aux(__first.base(), __last.base(),
6418- __value, __pred, __tag);
6419- }
6420-
6421- // Determine if a sequence is partitioned w.r.t. this element.
6422 template<typename _ForwardIterator, typename _Tp, typename _Pred>
6423 inline bool
6424- __check_partitioned_lower(_ForwardIterator __first,
6425+ __check_partitioned_upper(_ForwardIterator __first,
6426 _ForwardIterator __last, const _Tp& __value,
6427 _Pred __pred)
6428 {
6429- return __check_partitioned_lower_aux(__first, __last, __value, __pred,
6430- std::__iterator_category(__first));
6431- }
6432-
6433- template<typename _ForwardIterator, typename _Tp, typename _Pred>
6434- inline bool
6435- __check_partitioned_upper_aux(_ForwardIterator __first,
6436- _ForwardIterator __last, const _Tp& __value,
6437- _Pred __pred,
6438- std::forward_iterator_tag)
6439- {
6440 while (__first != __last && !bool(__pred(__value, *__first)))
6441 ++__first;
6442 if (__first != __last)
6443@@ -490,31 +415,6 @@
6444 return __first == __last;
6445 }
6446
6447- // For performance reason, as the iterator range has been validated, check on
6448- // random access safe iterators is done using the base iterator.
6449- template<typename _Iterator, typename _Sequence,
6450- typename _Tp, typename _Pred>
6451- inline bool
6452- __check_partitioned_upper_aux(
6453- const _Safe_iterator<_Iterator, _Sequence>& __first,
6454- const _Safe_iterator<_Iterator, _Sequence>& __last,
6455- const _Tp& __value, _Pred __pred,
6456- std::random_access_iterator_tag __tag)
6457- {
6458- return __check_partitioned_upper_aux(__first.base(), __last.base(),
6459- __value, __pred, __tag);
6460- }
6461-
6462- template<typename _ForwardIterator, typename _Tp, typename _Pred>
6463- inline bool
6464- __check_partitioned_upper(_ForwardIterator __first,
6465- _ForwardIterator __last, const _Tp& __value,
6466- _Pred __pred)
6467- {
6468- return __check_partitioned_upper_aux(__first, __last, __value, __pred,
6469- std::__iterator_category(__first));
6470- }
6471-
6472 // Helper struct to detect random access safe iterators.
[88af5df]6473 template<typename _Iterator>
6474 struct __is_safe_random_iterator
[2e59d11]6475diff -Naur gcc-4.8.2.orig/libstdc++-v3/include/debug/macros.h gcc-4.8.2/libstdc++-v3/include/debug/macros.h
6476--- gcc-4.8.2.orig/libstdc++-v3/include/debug/macros.h 2013-02-03 17:54:05.000000000 +0000
6477+++ gcc-4.8.2/libstdc++-v3/include/debug/macros.h 2013-11-01 16:12:34.403867685 +0000
6478@@ -261,8 +261,9 @@
6479 w.r.t. the value _Value. */
6480 #define __glibcxx_check_partitioned_lower(_First,_Last,_Value) \
6481 __glibcxx_check_valid_range(_First,_Last); \
6482-_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower(_First, _Last, \
6483- _Value), \
6484+_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower( \
6485+ __gnu_debug::__base(_First), \
6486+ __gnu_debug::__base(_Last), _Value), \
6487 _M_message(__gnu_debug::__msg_unpartitioned) \
6488 ._M_iterator(_First, #_First) \
6489 ._M_iterator(_Last, #_Last) \
6490@@ -270,8 +271,9 @@
6491
6492 #define __glibcxx_check_partitioned_upper(_First,_Last,_Value) \
6493 __glibcxx_check_valid_range(_First,_Last); \
6494-_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper(_First, _Last, \
6495- _Value), \
6496+_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper( \
6497+ __gnu_debug::__base(_First), \
6498+ __gnu_debug::__base(_Last), _Value), \
6499 _M_message(__gnu_debug::__msg_unpartitioned) \
6500 ._M_iterator(_First, #_First) \
6501 ._M_iterator(_Last, #_Last) \
6502@@ -281,8 +283,9 @@
6503 w.r.t. the value _Value and predicate _Pred. */
6504 #define __glibcxx_check_partitioned_lower_pred(_First,_Last,_Value,_Pred) \
6505 __glibcxx_check_valid_range(_First,_Last); \
6506-_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower(_First, _Last, \
6507- _Value, _Pred), \
6508+_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower( \
6509+ __gnu_debug::__base(_First), \
6510+ __gnu_debug::__base(_Last), _Value, _Pred), \
6511 _M_message(__gnu_debug::__msg_unpartitioned_pred) \
6512 ._M_iterator(_First, #_First) \
6513 ._M_iterator(_Last, #_Last) \
6514@@ -293,8 +296,9 @@
6515 w.r.t. the value _Value and predicate _Pred. */
6516 #define __glibcxx_check_partitioned_upper_pred(_First,_Last,_Value,_Pred) \
6517 __glibcxx_check_valid_range(_First,_Last); \
6518-_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper(_First, _Last, \
6519- _Value, _Pred), \
6520+_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper( \
6521+ __gnu_debug::__base(_First), \
6522+ __gnu_debug::__base(_Last), _Value, _Pred), \
[88af5df]6523 _M_message(__gnu_debug::__msg_unpartitioned_pred) \
6524 ._M_iterator(_First, #_First) \
6525 ._M_iterator(_Last, #_Last) \
6526diff -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
6527--- gcc-4.8.2.orig/libstdc++-v3/testsuite/20_util/shared_ptr/cons/58839.cc 1970-01-01 00:00:00.000000000 +0000
6528+++ gcc-4.8.2/libstdc++-v3/testsuite/20_util/shared_ptr/cons/58839.cc 2013-11-01 16:12:34.403867685 +0000
6529@@ -0,0 +1,33 @@
6530+// { dg-options "-std=gnu++11" }
6531+// { dg-do compile }
6532+
6533+// Copyright (C) 2013 Free Software Foundation, Inc.
6534+//
6535+// This file is part of the GNU ISO C++ Library. This library is free
6536+// software; you can redistribute it and/or modify it under the
6537+// terms of the GNU General Public License as published by the
6538+// Free Software Foundation; either version 3, or (at your option)
6539+// any later version.
6540+
6541+// This library is distributed in the hope that it will be useful,
6542+// but WITHOUT ANY WARRANTY; without even the implied warranty of
6543+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6544+// GNU General Public License for more details.
6545+
6546+// You should have received a copy of the GNU General Public License along
6547+// with this library; see the file COPYING3. If not see
6548+// <http://www.gnu.org/licenses/>.
6549+
6550+#include <memory>
6551+
6552+// libstdc++/58839
6553+
6554+struct D {
6555+ void operator()(void*) const noexcept { }
6556+};
6557+
6558+void test01()
6559+{
[2e59d11]6560+ std::unique_ptr<void, D> y;
[88af5df]6561+ std::shared_ptr<void> x = std::move(y);
6562+}
[2e59d11]6563diff -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
6564--- gcc-4.8.2.orig/libstdc++-v3/testsuite/25_algorithms/nth_element/58800.cc 1970-01-01 00:00:00.000000000 +0000
6565+++ gcc-4.8.2/libstdc++-v3/testsuite/25_algorithms/nth_element/58800.cc 2013-11-01 16:12:34.403867685 +0000
6566@@ -0,0 +1,52 @@
6567+// Copyright (C) 2013 Free Software Foundation, Inc.
6568+//
6569+// This file is part of the GNU ISO C++ Library. This library is free
6570+// software; you can redistribute it and/or modify it under the
6571+// terms of the GNU General Public License as published by the
6572+// Free Software Foundation; either version 3, or (at your option)
6573+// any later version.
6574+
6575+// This library is distributed in the hope that it will be useful,
6576+// but WITHOUT ANY WARRANTY; without even the implied warranty of
6577+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6578+// GNU General Public License for more details.
6579+
6580+// You should have received a copy of the GNU General Public License along
6581+// with this library; see the file COPYING3. If not see
6582+// <http://www.gnu.org/licenses/>.
6583+
6584+// 25.3.2 [lib.alg.nth.element]
6585+
6586+// { dg-options "-std=gnu++11" }
6587+
6588+#include <algorithm>
6589+#include <testsuite_hooks.h>
6590+#include <testsuite_iterators.h>
6591+
6592+using __gnu_test::test_container;
6593+using __gnu_test::random_access_iterator_wrapper;
6594+
6595+typedef test_container<int, random_access_iterator_wrapper> Container;
6596+
6597+void test01()
6598+{
6599+ std::vector<int> v = {
6600+ 207089,
6601+ 202585,
6602+ 180067,
6603+ 157549,
6604+ 211592,
6605+ 216096,
6606+ 207089
6607+ };
6608+
6609+ Container con(v.data(), v.data() + 7);
6610+
6611+ std::nth_element(con.begin(), con.begin() + 3, con.end());
6612+}
6613+
6614+int main()
6615+{
6616+ test01();
6617+ return 0;
6618+}
Note: See TracBrowser for help on using the repository browser.