source: patches/gcc-4.8.2-branch_update-1.patch @ 87ac89d

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