Ignore:
Timestamp:
Jun 5, 2009, 1:56:57 PM (15 years ago)
Author:
Jim Gifford <clfs@…>
Branches:
clfs-1.2, clfs-2.1, clfs-3.0.0-systemd, clfs-3.0.0-sysvinit, master, systemd, sysvinit
Children:
b057cfe
Parents:
d8bd081
Message:

Updated GCC Branch Update Patch to -2

File:
1 moved

Legend:

Unmodified
Added
Removed
  • patches/gcc-4.4.0-branch_update-2.patch

    rd8bd081 rca9d9fb5  
    11Submitted By: Jim Gifford (jim at cross-lfs dot org)
    2 Date: 04-29-2009
     2Date: 06-05-2009
    33Initial Package Version: 4.4.0
    44Origin: Upstream
     
    6262 # Allow host libstdc++ to be specified for static linking with PPL.
    6363 AC_ARG_WITH(host-libstdcxx, [  --with-host-libstdcxx=L Use linker arguments L to link with libstdc++
    64 diff -Naur gcc-4.4.0.orig/contrib/ChangeLog gcc-4.4.0/contrib/ChangeLog
    65 --- gcc-4.4.0.orig/contrib/ChangeLog    2009-04-21 01:47:54.000000000 -0700
    66 +++ gcc-4.4.0/contrib/ChangeLog 2009-04-27 12:13:16.000000000 -0700
    67 @@ -1,3 +1,12 @@
    68 +2009-04-27  Jakub Jelinek  <jakub@redhat.com>
    69 +
    70 +       PR testsuite/39807
    71 +       * dg-extract-results.sh: Close open files and use >> instead of >
    72 +       to decrease number of concurrently open files from awk.  Avoid
    73 +       = at the beginning of a regexp and redirect to a file determined
    74 +       by curfile variable rather than concatenated strings to workaround
    75 +       Solaris nawk bug.
    76 +
    77  2009-04-21  Release Manager
    78  
    79         * GCC 4.4.0 released.
    8064diff -Naur gcc-4.4.0.orig/contrib/dg-extract-results.sh gcc-4.4.0/contrib/dg-extract-results.sh
    8165--- gcc-4.4.0.orig/contrib/dg-extract-results.sh        2008-10-24 02:00:54.000000000 -0700
     
    290274   if (! base_alias_check (x_addr, mem_addr, GET_MODE (x), mem_mode))
    291275     return 0;
    292 diff -Naur gcc-4.4.0.orig/gcc/ChangeLog gcc-4.4.0/gcc/ChangeLog
    293 --- gcc-4.4.0.orig/gcc/ChangeLog        2009-04-21 01:44:59.000000000 -0700
    294 +++ gcc-4.4.0/gcc/ChangeLog     2009-04-28 21:57:17.000000000 -0700
    295 @@ -1,3 +1,143 @@
    296 +2009-04-29  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
    297 +
    298 +       * toplev.c (print_version): Update GMP version string calculation.
    299 +
    300 +2009-04-28  H.J. Lu  <hongjiu.lu@intel.com>
    301 +
    302 +       Backport from mainline:
    303 +       2009-04-27  H.J. Lu  <hongjiu.lu@intel.com>
    304 +
    305 +       PR target/39903
    306 +       * config/i386/i386.c (construct_container): Don't call
    307 +       gen_reg_or_parallel with BLKmode on X86_64_SSE_CLASS,
    308 +       X86_64_SSESF_CLASS and X86_64_SSEDF_CLASS.
    309 +
    310 +2009-04-27  Jakub Jelinek  <jakub@redhat.com>
    311 +
    312 +       PR rtl-optimization/39794
    313 +       * alias.c (canon_true_dependence): Add x_addr argument.
    314 +       * rtl.h (canon_true_dependence): Adjust prototype.
    315 +       * cse.c (check_dependence): Adjust canon_true_dependence callers.
    316 +       * cselib.c (cselib_invalidate_mem): Likewise.
    317 +       * gcse.c (compute_transp): Likewise.
    318 +       * dse.c (scan_reads_nospill): Likewise.
    319 +       (record_store, check_mem_read_rtx): Likewise.  For non-const-or-frame
    320 +       addresses pass base->val_rtx as mem_addr, for const-or-frame addresses
    321 +       canon_base_addr of the group, plus optional offset.
    322 +       (struct group_info): Rename canon_base_mem to
    323 +       canon_base_addr.
    324 +       (get_group_info): Set canon_base_addr to canon_rtx of base, not
    325 +       canon_rtx of base_mem.
    326 +
    327 +2009-04-26  Jakub Jelinek  <jakub@redhat.com>
    328 +
    329 +       PR inline-asm/39543
    330 +       * fwprop.c (forward_propagate_asm): New function.
    331 +       (forward_propagate_and_simplify): Propagate also into __asm, if it
    332 +       doesn't increase the number of referenced registers.
    333 +
    334 +       PR c/39889
    335 +       * stmt.c (warn_if_unused_value): Look through NON_LVALUE_EXPR.
    336 +
    337 +2009-04-24  Andreas Krebbel  <krebbel1@de.ibm.com>
    338 +
    339 +       * config/s390/constraints.md ('I', 'J'): Fix condition.
    340 +
    341 +2009-04-24  Paolo Bonzini  <bonzini@gnu.org>
    342 +
    343 +       PR middle-end/39867
    344 +       * fold-const.c (fold_cond_expr_with_comparison): When folding
    345 +       > and >= to MAX, make sure the MAX uses the same type as the
    346 +       comparison's operands.
    347 +
    348 +2009-04-23  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
    349 +
    350 +       * config/spu/spu-builtins.h: Delete file.
    351 +
    352 +       * config/spu/spu.h (enum spu_builtin_type): Move here from
    353 +       spu-builtins.h.
    354 +       (struct spu_builtin_description): Likewise.  Add GTY marker.
    355 +       Do not use enum spu_function_code or enum insn_code.
    356 +       (spu_builtins): Add extern declaration.
    357 +
    358 +       * config/spu/spu.c: Do not include "spu-builtins.h".
    359 +       (enum spu_function_code, enum spu_builtin_type_index,
    360 +       V16QI_type_node, V8HI_type_node, V4SI_type_node, V2DI_type_node,
    361 +       V4SF_type_node, V2DF_type_node, unsigned_V16QI_type_node,
    362 +       unsigned_V8HI_type_node, unsigned_V4SI_type_node,
    363 +       unsigned_V2DI_type_node): Move here from spu-builtins.h.
    364 +       (spu_builtin_types): Make static.  Add GTY marker.
    365 +       (spu_builtins): Add extern declaration with GTY marker.
    366 +       Include "gt-spu.h".
    367 +
    368 +       * config/spu/spu-c.c: Do not include "spu-builtins.h".
    369 +       (spu_resolve_overloaded_builtin): Do not use spu_function_code.
    370 +       Check programmatically whether all parameters are scalar.
    371 +
    372 +       * config/spu/t-spu-elf (spu.o, spu-c.o): Update dependencies.
    373 +
    374 +2009-04-22  Jing Yu  <jingyu@google.com>
    375 +
    376 +       PR testsuite/39781
    377 +       * config/arm/arm.h: Define HANDLE_PRAGMA_PACK_PUSH_POP.
    378 +
    379 +2009-04-22  Eric Botcazou  <ebotcazou@adacore.com>
    380 +
    381 +       Backport from mainline:
    382 +       2009-04-17  Eric Botcazou  <ebotcazou@adacore.com>
    383 +       * dbxout.c (dbxout_block): Reinstate test on TREE_USED.
    384 +       * tree-ssa-live.c (remove_unused_scope_block_p): Update TREE_USED bit.
    385 +
    386 +2009-04-22  Jakub Jelinek  <jakub@redhat.com>
    387 +
    388 +       * alias.c (find_base_term): Move around LO_SUM case, so that
    389 +       CONST falls through into PLUS/MINUS handling.
    390 +
    391 +       PR c/39855
    392 +       * fold-const.c (fold_binary) <case LSHIFT_EXPR>: When optimizing
    393 +       into 0, use omit_one_operand.
    394 +
    395 +2009-04-22  Vladimir Makarov  <vmakarov@redhat.com>
    396 +
    397 +       PR rtl-optimization/39762
    398 +       * ira-int.h (ira_register_move_cost, ira_may_move_in_cost,
    399 +       ira_may_move_out_cost): Add comments about way of their usage.
    400 +       (ira_get_register_move_cost, ira_get_may_move_cost): New functions.
    401 +
    402 +       * ira-conflicts.c (process_regs_for_copy): Use function
    403 +       ira_get_register_move_cost instead of global
    404 +       ira_register_move_cost.
    405 +
    406 +       * ira-color.c (update_copy_costs, calculate_allocno_spill_cost,
    407 +       color_pass, move_spill_restore, update_curr_costs): Ditto.
    408 +
    409 +       * ira-lives.c (process_single_reg_class_operands): Ditto.
    410 +
    411 +       * ira-emit.c (emit_move_list): Ditto.
    412 +
    413 +       * ira-costs.c (copy_cost): Don't call ira_init_register_move_cost.
    414 +       (record_reg_classes): Ditto.  Use functions
    415 +       ira_get_register_move_cost and ira_get_may_move_cost instead of
    416 +       global vars ira_register_move_cost, ira_may_move_out_cost and
    417 +       ira_may_move_in_cost.
    418 +       (record_address_regs): Don't call ira_init_register_move_cost.
    419 +       Use function ira_get_may_move_cost instead of global
    420 +       ira_may_move_in_cost.
    421 +       (process_bb_node_for_hard_reg_moves): Use function
    422 +       ira_get_register_move_cost instead of global ira_register_move_cost.
    423 +       (ira_costs): Don't call ira_init_register_move_cost.
    424 +
    425 +2009-04-22  Richard Guenther  <rguenther@suse.de>
    426 +
    427 +       PR tree-optimization/39824
    428 +       * tree-ssa-ccp.c (fold_const_aggregate_ref): For INDIRECT_REFs
    429 +       make sure the types are compatible.
    430 +
    431 +2009-04-21  Jakub Jelinek  <jakub@redhat.com>
    432 +
    433 +       * BASE-VER: Set to 4.4.1.
    434 +       * DEV-PHASE: Set to prerelease.
    435 +
    436  2009-04-21  Release Manager
    437  
    438         * GCC 4.4.0 released.
     276diff -Naur gcc-4.4.0.orig/gcc/builtins.c gcc-4.4.0/gcc/builtins.c
     277--- gcc-4.4.0.orig/gcc/builtins.c       2009-03-30 10:42:27.000000000 -0700
     278+++ gcc-4.4.0/gcc/builtins.c    2009-05-29 08:47:31.000000000 -0700
     279@@ -4176,7 +4176,7 @@
     280 
     281     arg1_rtx = get_memory_rtx (arg1, len);
     282     arg2_rtx = get_memory_rtx (arg2, len);
     283-    arg3_rtx = expand_normal (len);
     284+    arg3_rtx = expand_normal (fold_convert (sizetype, len));
     285 
     286     /* Set MEM_SIZE as appropriate.  */
     287     if (GET_CODE (arg3_rtx) == CONST_INT)
     288diff -Naur gcc-4.4.0.orig/gcc/cfgrtl.c gcc-4.4.0/gcc/cfgrtl.c
     289--- gcc-4.4.0.orig/gcc/cfgrtl.c 2008-12-12 13:16:09.000000000 -0800
     290+++ gcc-4.4.0/gcc/cfgrtl.c      2009-05-21 16:17:37.000000000 -0700
     291@@ -53,6 +53,7 @@
     292 #include "toplev.h"
     293 #include "tm_p.h"
     294 #include "obstack.h"
     295+#include "insn-attr.h"
     296 #include "insn-config.h"
     297 #include "cfglayout.h"
     298 #include "expr.h"
     299@@ -427,13 +428,27 @@
     300   return 0;
     301 }
     302 
     303+static unsigned int
     304+rest_of_pass_free_cfg (void)
     305+{
     306+#ifdef DELAY_SLOTS
     307+  /* The resource.c machinery uses DF but the CFG isn't guaranteed to be
     308+     valid at that point so it would be too late to call df_analyze.  */
     309+  if (optimize > 0 && flag_delayed_branch)
     310+    df_analyze ();
     311+#endif
     312+
     313+  free_bb_for_insn ();
     314+  return 0;
     315+}
     316+
     317 struct rtl_opt_pass pass_free_cfg =
     318 {
     319  {
     320   RTL_PASS,
     321   NULL,                                 /* name */
     322   NULL,                                 /* gate */
     323-  free_bb_for_insn,                     /* execute */
     324+  rest_of_pass_free_cfg,                /* execute */
     325   NULL,                                 /* sub */
     326   NULL,                                 /* next */
     327   0,                                    /* static_pass_number */
     328diff -Naur gcc-4.4.0.orig/gcc/config/arm/arm.c gcc-4.4.0/gcc/config/arm/arm.c
     329--- gcc-4.4.0.orig/gcc/config/arm/arm.c 2009-02-24 23:18:01.000000000 -0800
     330+++ gcc-4.4.0/gcc/config/arm/arm.c      2009-06-02 00:18:16.000000000 -0700
     331@@ -16883,7 +16883,7 @@
     332 
     333   if (push && pushed_words && dwarf2out_do_frame ())
     334     {
     335-      char *l = dwarf2out_cfi_label ();
     336+      char *l = dwarf2out_cfi_label (false);
     337       int pushed_mask = real_regs;
     338 
     339       *cfa_offset += pushed_words * 4;
     340@@ -17781,7 +17781,7 @@
     341         the stack pointer.  */
     342       if (dwarf2out_do_frame ())
     343        {
     344-         char *l = dwarf2out_cfi_label ();
     345+         char *l = dwarf2out_cfi_label (false);
     346 
     347          cfa_offset = cfa_offset + crtl->args.pretend_args_size;
     348          dwarf2out_def_cfa (l, SP_REGNUM, cfa_offset);
     349@@ -17830,7 +17830,7 @@
     350 
     351       if (dwarf2out_do_frame ())
     352        {
     353-         char *l = dwarf2out_cfi_label ();
     354+         char *l = dwarf2out_cfi_label (false);
     355 
     356          cfa_offset = cfa_offset + 16;
     357          dwarf2out_def_cfa (l, SP_REGNUM, cfa_offset);
    439358diff -Naur gcc-4.4.0.orig/gcc/config/arm/arm.h gcc-4.4.0/gcc/config/arm/arm.h
    440359--- gcc-4.4.0.orig/gcc/config/arm/arm.h 2009-03-17 13:18:21.000000000 -0700
     
    452371 /* Specify the machine mode that this machine uses
    453372    for the index in the tablejump instruction.  */
     373diff -Naur gcc-4.4.0.orig/gcc/config/arm/arm.md gcc-4.4.0/gcc/config/arm/arm.md
     374--- gcc-4.4.0.orig/gcc/config/arm/arm.md        2009-04-04 05:25:06.000000000 -0700
     375+++ gcc-4.4.0/gcc/config/arm/arm.md     2009-05-16 06:28:27.000000000 -0700
     376@@ -8214,7 +8214,7 @@
     377 
     378 (define_insn "cstoresi_nltu_thumb1"
     379   [(set (match_operand:SI 0 "s_register_operand" "=l,l")
     380-        (neg:SI (gtu:SI (match_operand:SI 1 "s_register_operand" "l,*h")
     381+        (neg:SI (ltu:SI (match_operand:SI 1 "s_register_operand" "l,*h")
     382                        (match_operand:SI 2 "thumb1_cmp_operand" "lI*h,*r"))))]
     383   "TARGET_THUMB1"
     384   "cmp\\t%1, %2\;sbc\\t%0, %0, %0"
     385diff -Naur gcc-4.4.0.orig/gcc/config/i386/driver-i386.c gcc-4.4.0/gcc/config/i386/driver-i386.c
     386--- gcc-4.4.0.orig/gcc/config/i386/driver-i386.c        2008-11-04 05:29:43.000000000 -0800
     387+++ gcc-4.4.0/gcc/config/i386/driver-i386.c     2009-05-27 07:54:00.000000000 -0700
     388@@ -336,7 +336,11 @@
     389 enum vendor_signatures
     390 {
     391   SIG_INTEL =  0x756e6547 /* Genu */,
     392-  SIG_AMD =    0x68747541 /* Auth */,
     393+  SIG_AMD =    0x68747541 /* Auth */
     394+};
     395+
     396+enum processor_signatures
     397+{
     398   SIG_GEODE =  0x646f6547 /* Geod */
     399 };
     400 
     401@@ -374,6 +378,9 @@
     402   /* Extended features */
     403   unsigned int has_lahf_lm = 0, has_sse4a = 0;
     404   unsigned int has_longmode = 0, has_3dnowp = 0, has_3dnow = 0;
     405+  unsigned int has_sse4_1 = 0, has_sse4_2 = 0;
     406+  unsigned int has_popcnt = 0, has_aes = 0, has_avx = 0;
     407+  unsigned int has_pclmul = 0;
     408 
     409   bool arch;
     410 
     411@@ -397,7 +404,13 @@
     412 
     413   has_sse3 = ecx & bit_SSE3;
     414   has_ssse3 = ecx & bit_SSSE3;
     415+  has_sse4_1 = ecx & bit_SSE4_1;
     416+  has_sse4_2 = ecx & bit_SSE4_2;
     417+  has_avx = ecx & bit_AVX;
     418   has_cmpxchg16b = ecx & bit_CMPXCHG16B;
     419+  has_popcnt = ecx & bit_POPCNT;
     420+  has_aes = ecx & bit_AES;
     421+  has_pclmul = ecx & bit_PCLMUL;
     422 
     423   has_cmpxchg8b = edx & bit_CMPXCHG8B;
     424   has_cmov = edx & bit_CMOV;
     425@@ -433,19 +446,27 @@
     426 
     427   if (vendor == SIG_AMD)
     428     {
     429-      processor = PROCESSOR_PENTIUM;
     430+      unsigned int name;
     431 
     432-      if (has_mmx)
     433-       processor = PROCESSOR_K6;
     434-      if (has_3dnowp)
     435-       processor = PROCESSOR_ATHLON;
     436-      if (has_sse2 || has_longmode)
     437-       processor = PROCESSOR_K8;
     438-      if (has_sse4a)
     439+      /* Detect geode processor by its processor signature.  */
     440+      if (ext_level > 0x80000001)
     441+       __cpuid (0x80000002, name, ebx, ecx, edx);
     442+      else
     443+       name = 0;
     444+
     445+      if (name == SIG_GEODE)
     446+       processor = PROCESSOR_GEODE;
     447+      else if (has_sse4a)
     448        processor = PROCESSOR_AMDFAM10;
     449+      else if (has_sse2 || has_longmode)
     450+       processor = PROCESSOR_K8;
     451+      else if (has_3dnowp)
     452+       processor = PROCESSOR_ATHLON;
     453+      else if (has_mmx)
     454+       processor = PROCESSOR_K6;
     455+      else
     456+       processor = PROCESSOR_PENTIUM;
     457     }
     458-  else if (vendor == SIG_GEODE)
     459-    processor = PROCESSOR_GEODE;
     460   else
     461     {
     462       switch (family)
     463@@ -576,6 +597,18 @@
     464        options = concat (options, "-mcx16 ", NULL);
     465       if (has_lahf_lm)
     466        options = concat (options, "-msahf ", NULL);
     467+      if (has_aes)
     468+       options = concat (options, "-maes ", NULL);
     469+      if (has_pclmul)
     470+       options = concat (options, "-mpclmul ", NULL);
     471+      if (has_popcnt)
     472+       options = concat (options, "-mpopcnt ", NULL);
     473+      if (has_avx)
     474+       options = concat (options, "-mavx ", NULL);
     475+      else if (has_sse4_2)
     476+       options = concat (options, "-msse4.2 ", NULL);
     477+      else if (has_sse4_1)
     478+       options = concat (options, "-msse4.1 ", NULL);
     479     }
     480 
     481 done:
    454482diff -Naur gcc-4.4.0.orig/gcc/config/i386/i386.c gcc-4.4.0/gcc/config/i386/i386.c
    455483--- gcc-4.4.0.orig/gcc/config/i386/i386.c       2009-04-14 13:27:30.000000000 -0700
    456 +++ gcc-4.4.0/gcc/config/i386/i386.c    2009-04-28 07:35:12.000000000 -0700
     484+++ gcc-4.4.0/gcc/config/i386/i386.c    2009-05-25 05:13:38.000000000 -0700
    457485@@ -5357,7 +5357,10 @@
    458486       case X86_64_SSE_CLASS:
     
    467495       case X86_64_COMPLEX_X87_CLASS:
    468496        return gen_rtx_REG (mode, FIRST_STACK_REG);
     497@@ -7301,10 +7304,12 @@
     498   cfun->machine->accesses_prev_frame = 1;
     499 }
     500 
     501
     502-#if (defined(HAVE_GAS_HIDDEN) && (SUPPORTS_ONE_ONLY - 0)) || TARGET_MACHO
     503-# define USE_HIDDEN_LINKONCE 1
     504-#else
     505-# define USE_HIDDEN_LINKONCE 0
     506+#ifndef USE_HIDDEN_LINKONCE
     507+# if (defined(HAVE_GAS_HIDDEN) && (SUPPORTS_ONE_ONLY - 0)) || TARGET_MACHO
     508+#  define USE_HIDDEN_LINKONCE 1
     509+# else
     510+#  define USE_HIDDEN_LINKONCE 0
     511+# endif
     512 #endif
     513 
     514 static int pic_labels_used;
     515diff -Naur gcc-4.4.0.orig/gcc/config/i386/linux.h gcc-4.4.0/gcc/config/i386/linux.h
     516--- gcc-4.4.0.orig/gcc/config/i386/linux.h      2009-02-20 07:20:38.000000000 -0800
     517+++ gcc-4.4.0/gcc/config/i386/linux.h   2009-05-21 06:21:30.000000000 -0700
     518@@ -153,7 +153,9 @@
     519        fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP));     \
     520        /* Make sure that we have at least 8 byte alignment if > 8 byte \
     521           alignment is preferred.  */                                  \
     522-       if ((LOG) > 3 && (1 << (LOG)) > ((MAX_SKIP) + 1))               \
     523+       if ((LOG) > 3                                                   \
     524+           && (1 << (LOG)) > ((MAX_SKIP) + 1)                          \
     525+           && (MAX_SKIP) >= 7)                                         \
     526          fprintf ((FILE), "\t.p2align 3\n");                           \
     527       }                                                                        \
     528     }                                                                  \
     529diff -Naur gcc-4.4.0.orig/gcc/config/i386/sol2.h gcc-4.4.0/gcc/config/i386/sol2.h
     530--- gcc-4.4.0.orig/gcc/config/i386/sol2.h       2008-09-09 09:17:37.000000000 -0700
     531+++ gcc-4.4.0/gcc/config/i386/sol2.h    2009-05-25 05:13:38.000000000 -0700
     532@@ -1,6 +1,6 @@
     533 /* Target definitions for GCC for Intel 80386 running Solaris 2
     534    Copyright (C) 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
     535-   2004, 2007, 2008 Free Software Foundation, Inc.
     536+   2004, 2007, 2008, 2009 Free Software Foundation, Inc.
     537    Contributed by Fred Fish (fnf@cygnus.com).
     538 
     539 This file is part of GCC.
     540@@ -112,3 +112,9 @@
     541 /* We do not need NT_VERSION notes.  */
     542 #undef X86_FILE_START_VERSION_DIRECTIVE
     543 #define X86_FILE_START_VERSION_DIRECTIVE false
     544+
     545+/* Only recent versions of Solaris 11 ld properly support hidden .gnu.linkonce
     546+   sections, so don't use them.  */
     547+#ifndef TARGET_GNU_LD
     548+#define USE_HIDDEN_LINKONCE 0
     549+#endif
     550diff -Naur gcc-4.4.0.orig/gcc/config/i386/sse.md gcc-4.4.0/gcc/config/i386/sse.md
     551--- gcc-4.4.0.orig/gcc/config/i386/sse.md       2009-03-12 10:43:14.000000000 -0700
     552+++ gcc-4.4.0/gcc/config/i386/sse.md    2009-05-06 06:20:41.000000000 -0700
     553@@ -978,7 +978,7 @@
     554          (match_operand:AVXMODEF2P 2 "nonimmediate_operand" "xm")))]
     555   "AVX_VEC_FLOAT_MODE_P (<MODE>mode) && flag_finite_math_only
     556    && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
     557-  "v<maxminfprefix>p<ssemodesuffixf2c>\t{%2, %1, %0|%0, %1, %2}"
     558+  "v<maxminfprefix>p<avxmodesuffixf2c>\t{%2, %1, %0|%0, %1, %2}"
     559   [(set_attr "type" "sseadd")
     560    (set_attr "prefix" "vex")
     561    (set_attr "mode" "<MODE>")])
     562diff -Naur gcc-4.4.0.orig/gcc/config/i386/x86-64.h gcc-4.4.0/gcc/config/i386/x86-64.h
     563--- gcc-4.4.0.orig/gcc/config/i386/x86-64.h     2009-04-09 16:23:07.000000000 -0700
     564+++ gcc-4.4.0/gcc/config/i386/x86-64.h  2009-05-21 06:21:30.000000000 -0700
     565@@ -74,7 +74,9 @@
     566        fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP));     \
     567        /* Make sure that we have at least 8 byte alignment if > 8 byte \
     568           alignment is preferred.  */                                  \
     569-       if ((LOG) > 3 && (1 << (LOG)) > ((MAX_SKIP) + 1))               \
     570+       if ((LOG) > 3                                                   \
     571+           && (1 << (LOG)) > ((MAX_SKIP) + 1)                          \
     572+           && (MAX_SKIP) >= 7)                                         \
     573          fprintf ((FILE), "\t.p2align 3\n");                           \
     574       }                                                                        \
     575     }                                                                  \
     576diff -Naur gcc-4.4.0.orig/gcc/config/m32c/m32c.c gcc-4.4.0/gcc/config/m32c/m32c.c
     577--- gcc-4.4.0.orig/gcc/config/m32c/m32c.c       2009-02-20 07:20:38.000000000 -0800
     578+++ gcc-4.4.0/gcc/config/m32c/m32c.c    2009-05-04 16:53:28.000000000 -0700
     579@@ -417,6 +417,9 @@
     580     }
     581   else
     582     target_memregs = 16;
     583+
     584+  if (TARGET_A24)
     585+    flag_ivopts = 0;
     586 }
     587 
     588 /* Defining data structures for per-function information */
     589@@ -2043,6 +2046,31 @@
     590       return 1;
     591     }
     592 
     593+  /* If we see an RTX like (subreg:PSI (reg:SI ...)) we need to reload
     594+     the subreg.  We need to check for PLUS and non-PLUS cases.  */
     595+
     596+  if (GET_CODE (*x) == SUBREG
     597+      && GET_MODE (XEXP (*x, 0)) == SImode)
     598+    {
     599+      if (type == RELOAD_OTHER)
     600+       type = RELOAD_FOR_OTHER_ADDRESS;
     601+      push_reload (*x, NULL_RTX, x, NULL,
     602+                  A_REGS, Pmode, VOIDmode, 0, 0, opnum,
     603+                  type);
     604+      return 1;
     605+    }
     606+  if (GET_CODE (*x) == PLUS
     607+      && GET_CODE (XEXP (*x, 0)) == SUBREG
     608+      && GET_MODE (XEXP (XEXP (*x, 0), 0)) == SImode)
     609+    {
     610+      if (type == RELOAD_OTHER)
     611+       type = RELOAD_FOR_OTHER_ADDRESS;
     612+      push_reload (XEXP (*x, 0), NULL_RTX, &(XEXP (*x, 0)), NULL,
     613+                  A_REGS, Pmode, VOIDmode, 0, 0, opnum,
     614+                  type);
     615+      return 1;
     616+    }
     617+
     618   return 0;
     619 }
     620 
     621diff -Naur gcc-4.4.0.orig/gcc/config/rs6000/rs6000-c.c gcc-4.4.0/gcc/config/rs6000/rs6000-c.c
     622--- gcc-4.4.0.orig/gcc/config/rs6000/rs6000-c.c 2009-03-28 10:29:57.000000000 -0700
     623+++ gcc-4.4.0/gcc/config/rs6000/rs6000-c.c      2009-05-29 00:14:20.000000000 -0700
     624@@ -91,6 +91,7 @@
     625 static GTY(()) tree pixel_keyword;
     626 static GTY(()) tree __bool_keyword;
     627 static GTY(()) tree bool_keyword;
     628+static GTY(()) tree _Bool_keyword;
     629 
     630 /* Preserved across calls.  */
     631 static tree expand_bool_pixel;
     632@@ -111,6 +112,9 @@
     633       if (ident == C_CPP_HASHNODE (bool_keyword))
     634        return C_CPP_HASHNODE (__bool_keyword);
     635 
     636+      if (ident == C_CPP_HASHNODE (_Bool_keyword))
     637+       return C_CPP_HASHNODE (__bool_keyword);
     638+
     639       return ident;
     640     }
     641 
     642@@ -141,6 +145,9 @@
     643 
     644   bool_keyword = get_identifier ("bool");
     645   C_CPP_HASHNODE (bool_keyword)->flags |= NODE_CONDITIONAL;
     646+
     647+  _Bool_keyword = get_identifier ("_Bool");
     648+  C_CPP_HASHNODE (_Bool_keyword)->flags |= NODE_CONDITIONAL;
     649 }
     650 
     651 /* Called to decide whether a conditional macro should be expanded.
     652@@ -295,6 +302,7 @@
     653          builtin_define ("vector=vector");
     654          builtin_define ("pixel=pixel");
     655          builtin_define ("bool=bool");
     656+         builtin_define ("_Bool=_Bool");
     657          init_vector_keywords ();
     658 
     659          /* Enable context-sensitive macros.  */
    469660diff -Naur gcc-4.4.0.orig/gcc/config/s390/constraints.md gcc-4.4.0/gcc/config/s390/constraints.md
    470661--- gcc-4.4.0.orig/gcc/config/s390/constraints.md       2008-05-28 07:11:19.000000000 -0700
     
    486677 
    487678 (define_constraint "K"
     679diff -Naur gcc-4.4.0.orig/gcc/config/sh/sh.c gcc-4.4.0/gcc/config/sh/sh.c
     680--- gcc-4.4.0.orig/gcc/config/sh/sh.c   2009-03-25 15:23:27.000000000 -0700
     681+++ gcc-4.4.0/gcc/config/sh/sh.c        2009-05-24 15:18:47.000000000 -0700
     682@@ -6908,6 +6908,8 @@
     683 
     684   tmp = gen_frame_mem (Pmode, tmp);
     685   emit_insn (GEN_MOV (tmp, ra));
     686+  /* Tell this store isn't dead.  */
     687+  emit_use (tmp);
     688 }
     689 
     690 /* Clear variables at function end.  */
     691diff -Naur gcc-4.4.0.orig/gcc/config/sh/sh.md gcc-4.4.0/gcc/config/sh/sh.md
     692--- gcc-4.4.0.orig/gcc/config/sh/sh.md  2009-02-20 07:20:38.000000000 -0800
     693+++ gcc-4.4.0/gcc/config/sh/sh.md       2009-06-02 17:10:00.000000000 -0700
     694@@ -3999,6 +3999,34 @@
     695   [(set_attr "length" "4")
     696    (set_attr "type" "arith")])
     697 
     698+;; Expander for DImode shift left with SImode operations.
     699+
     700+(define_expand "ashldi3_std"
     701+  [(set (match_operand:DI 0 "arith_reg_dest" "=r")
     702+       (ashift:DI (match_operand:DI 1 "arith_reg_operand" "r")
     703+                   (match_operand:DI 2 "const_int_operand" "n")))]
     704+  "TARGET_SH1 && INTVAL (operands[2]) < 32"
     705+  "
     706+{
     707+  int low_word = (TARGET_LITTLE_ENDIAN ? 0 : 1);
     708+  int high_word = (TARGET_LITTLE_ENDIAN ? 1 : 0);
     709+  rtx low_src = operand_subword (operands[1], low_word, 0, DImode);
     710+  rtx high_src = operand_subword (operands[1], high_word, 0, DImode);
     711+  rtx dst = gen_reg_rtx (DImode);
     712+  rtx low_dst = operand_subword (dst, low_word, 1, DImode);
     713+  rtx high_dst = operand_subword (dst, high_word, 1, DImode);
     714+  rtx tmp0, tmp1;
     715+
     716+  tmp0 = gen_reg_rtx (SImode);
     717+  tmp1 = gen_reg_rtx (SImode);
     718+  emit_insn (gen_lshrsi3 (tmp0, low_src, GEN_INT (32 - INTVAL (operands[2]))));
     719+  emit_insn (gen_ashlsi3 (low_dst, low_src, operands[2])); 
     720+  emit_insn (gen_ashlsi3 (tmp1, high_src, operands[2])); 
     721+  emit_insn (gen_iorsi3 (high_dst, tmp0, tmp1));
     722+  emit_move_insn (operands[0], dst);
     723+  DONE;
     724+}")
     725+
     726 (define_insn "ashldi3_media"
     727   [(set (match_operand:DI 0 "arith_reg_dest" "=r,r")
     728        (ashift:DI (match_operand:DI 1 "arith_reg_operand" "r,r")
     729@@ -4031,8 +4059,19 @@
     730       emit_insn (gen_ashldi3_media (operands[0], operands[1], operands[2]));
     731       DONE;
     732     }
     733-  if (GET_CODE (operands[2]) != CONST_INT
     734-      || INTVAL (operands[2]) != 1)
     735+  if (GET_CODE (operands[2]) == CONST_INT
     736+      && INTVAL (operands[2]) == 1)
     737+    {
     738+      emit_insn (gen_ashldi3_k (operands[0], operands[1]));
     739+      DONE;
     740+    }
     741+  else if (GET_CODE (operands[2]) == CONST_INT
     742+      && INTVAL (operands[2]) < 32)
     743+    {
     744+      emit_insn (gen_ashldi3_std (operands[0], operands[1], operands[2]));
     745+      DONE;
     746+    }
     747+  else
     748     FAIL;
     749 }")
     750 
    488751diff -Naur gcc-4.4.0.orig/gcc/config/spu/spu-builtins.h gcc-4.4.0/gcc/config/spu/spu-builtins.h
    489752--- gcc-4.4.0.orig/gcc/config/spu/spu-builtins.h        2007-08-02 03:49:31.000000000 -0700
     
    8321095     $(TM_P_H) c-pragma.h errors.h coretypes.h $(TM_H) insn-codes.h
    8331096        $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/config/spu/spu-c.c
     1097diff -Naur gcc-4.4.0.orig/gcc/config/vax/vax.c gcc-4.4.0/gcc/config/vax/vax.c
     1098--- gcc-4.4.0.orig/gcc/config/vax/vax.c 2009-02-20 07:20:38.000000000 -0800
     1099+++ gcc-4.4.0/gcc/config/vax/vax.c      2009-06-02 00:18:16.000000000 -0700
     1100@@ -122,7 +122,7 @@
     1101 
     1102   if (dwarf2out_do_frame ())
     1103     {
     1104-      const char *label = dwarf2out_cfi_label ();
     1105+      const char *label = dwarf2out_cfi_label (false);
     1106       int offset = 0;
     1107 
     1108       for (regno = FIRST_PSEUDO_REGISTER-1; regno >= 0; --regno)
    8341109diff -Naur gcc-4.4.0.orig/gcc/cp/call.c gcc-4.4.0/gcc/cp/call.c
    8351110--- gcc-4.4.0.orig/gcc/cp/call.c        2009-04-13 13:56:45.000000000 -0700
    836 +++ gcc-4.4.0/gcc/cp/call.c     2009-04-23 04:13:57.000000000 -0700
    837 @@ -4069,8 +4069,20 @@
     1111+++ gcc-4.4.0/gcc/cp/call.c     2009-06-03 11:11:53.000000000 -0700
     1112@@ -1384,9 +1384,37 @@
     1113   if (conv)
     1114     return conv;
     1115 
     1116-  if (is_std_init_list (to) && expr
     1117-      && BRACE_ENCLOSED_INITIALIZER_P (expr))
     1118-    return build_list_conv (to, expr, flags);
     1119+  if (expr && BRACE_ENCLOSED_INITIALIZER_P (expr))
     1120+    {
     1121+      if (is_std_init_list (to))
     1122+       return build_list_conv (to, expr, flags);
     1123+
     1124+      /* Allow conversion from an initializer-list with one element to a
     1125+        scalar type.  */
     1126+      if (SCALAR_TYPE_P (to))
     1127+       {
     1128+         int nelts = CONSTRUCTOR_NELTS (expr);
     1129+         tree elt;
     1130+
     1131+         if (nelts == 0)
     1132+           elt = integer_zero_node;
     1133+         else if (nelts == 1)
     1134+           elt = CONSTRUCTOR_ELT (expr, 0)->value;
     1135+         else
     1136+           elt = error_mark_node;
     1137+
     1138+         conv = implicit_conversion (to, TREE_TYPE (elt), elt,
     1139+                                     c_cast_p, flags);
     1140+         if (conv)
     1141+           {
     1142+             conv->check_narrowing = true;
     1143+             if (BRACE_ENCLOSED_INITIALIZER_P (elt))
     1144+               /* Too many levels of braces, i.e. '{{1}}'.  */
     1145+               conv->bad_p = true;
     1146+             return conv;
     1147+           }
     1148+       }
     1149+    }
     1150 
     1151   if (expr != NULL_TREE
     1152       && (MAYBE_CLASS_TYPE_P (from)
     1153@@ -4069,8 +4097,20 @@
    8381154        default:
    8391155          if ((flags & LOOKUP_COMPLAIN) && (complain & tf_error))
     
    8581174          result = error_mark_node;
    8591175          break;
    860 diff -Naur gcc-4.4.0.orig/gcc/cp/ChangeLog gcc-4.4.0/gcc/cp/ChangeLog
    861 --- gcc-4.4.0.orig/gcc/cp/ChangeLog     2009-04-21 01:44:51.000000000 -0700
    862 +++ gcc-4.4.0/gcc/cp/ChangeLog  2009-04-23 04:13:57.000000000 -0700
    863 @@ -1,3 +1,22 @@
    864 +2009-04-23  Dodji Seketeli  <dodji@redhat.com>
    865 +
    866 +       PR c++/38228
    867 +       * pt.c (unify): Do not allow the result of a template argument
    868 +       deduction to be a METHOD_TYPE.
    869 +       * cvt.c (cp_convert): Report a meaningful error for non-valid use
    870 +       of pointer to member functions during conversions.
    871 +       * call.c (build_new_op): Report a meaningful error for non-valid
    872 +       use of pointer to member functions in binary expressions.
    873 +       * typeck.c (invalid_nonstatic_memfn_p): Do not crash when EXPR is
    874 +       NULL;
    875 +
    876 +2009-04-22  Dodji Seketeli  <dodji@redhat.com>
    877 +
    878 +       PR c++/39639
    879 +       * parser.c (cp_parser_template_argument_list): Display an error
    880 +       when an ellipsis is not preceded by a parameter pack. Also, warn
    881 +       about variadic templates usage without -std=c++0x.
    882 +
    883  2009-04-21  Release Manager
    884  
    885         * GCC 4.4.0 released.
     1176@@ -4517,12 +4557,21 @@
     1177 
     1178   if (convs->bad_p
     1179       && convs->kind != ck_user
     1180+      && convs->kind != ck_list
     1181       && convs->kind != ck_ambig
     1182       && convs->kind != ck_ref_bind
     1183       && convs->kind != ck_rvalue
     1184       && convs->kind != ck_base)
     1185     {
     1186       conversion *t = convs;
     1187+
     1188+      /* Give a helpful error if this is bad because of excess braces.  */
     1189+      if (BRACE_ENCLOSED_INITIALIZER_P (expr)
     1190+         && SCALAR_TYPE_P (totype)
     1191+         && CONSTRUCTOR_NELTS (expr) > 0
     1192+         && BRACE_ENCLOSED_INITIALIZER_P (CONSTRUCTOR_ELT (expr, 0)->value))
     1193+       permerror (input_location, "too many braces around initializer for %qT", totype);
     1194+
     1195       for (; t; t = convs->u.next)
     1196        {
     1197          if (t->kind == ck_user || !t->bad_p)
     1198@@ -4596,6 +4645,17 @@
     1199        return expr;
     1200       }
     1201     case ck_identity:
     1202+      if (BRACE_ENCLOSED_INITIALIZER_P (expr))
     1203+       {
     1204+         int nelts = CONSTRUCTOR_NELTS (expr);
     1205+         if (nelts == 0)
     1206+           expr = integer_zero_node;
     1207+         else if (nelts == 1)
     1208+           expr = CONSTRUCTOR_ELT (expr, 0)->value;
     1209+         else
     1210+           gcc_unreachable ();
     1211+       }
     1212+
     1213       if (type_unknown_p (expr))
     1214        expr = instantiate_type (totype, expr, complain);
     1215       /* Convert a constant to its underlying value, unless we are
    8861216diff -Naur gcc-4.4.0.orig/gcc/cp/cvt.c gcc-4.4.0/gcc/cp/cvt.c
    8871217--- gcc-4.4.0.orig/gcc/cp/cvt.c 2008-08-18 04:17:52.000000000 -0700
     
    9051235 }
    9061236 
     1237diff -Naur gcc-4.4.0.orig/gcc/cp/decl.c gcc-4.4.0/gcc/cp/decl.c
     1238--- gcc-4.4.0.orig/gcc/cp/decl.c        2009-04-06 21:38:10.000000000 -0700
     1239+++ gcc-4.4.0/gcc/cp/decl.c     2009-06-03 11:11:53.000000000 -0700
     1240@@ -5533,7 +5533,9 @@
     1241          TREE_TYPE (decl) = error_mark_node;
     1242          return;
     1243        }
     1244-      else if (describable_type (init))
     1245+      if (TREE_CODE (init) == TREE_LIST)
     1246+       init = build_x_compound_expr_from_list (init, "initializer");
     1247+      if (describable_type (init))
     1248        {
     1249          type = TREE_TYPE (decl) = do_auto_deduction (type, init, auto_node);
     1250          if (type == error_mark_node)
    9071251diff -Naur gcc-4.4.0.orig/gcc/cp/parser.c gcc-4.4.0/gcc/cp/parser.c
    9081252--- gcc-4.4.0.orig/gcc/cp/parser.c      2009-04-10 12:01:16.000000000 -0700
     
    9231267diff -Naur gcc-4.4.0.orig/gcc/cp/pt.c gcc-4.4.0/gcc/cp/pt.c
    9241268--- gcc-4.4.0.orig/gcc/cp/pt.c  2009-04-13 12:27:20.000000000 -0700
    925 +++ gcc-4.4.0/gcc/cp/pt.c       2009-04-23 04:13:57.000000000 -0700
    926 @@ -13532,6 +13532,13 @@
     1269+++ gcc-4.4.0/gcc/cp/pt.c       2009-05-06 13:43:41.000000000 -0700
     1270@@ -9144,6 +9144,14 @@
     1271 
     1272        max = tsubst_expr (omax, args, complain, in_decl,
     1273                           /*integral_constant_expression_p=*/false);
     1274+
     1275+       /* Fix up type of the magic NOP_EXPR with TREE_SIDE_EFFECTS if
     1276+          needed.  */
     1277+       if (TREE_CODE (max) == NOP_EXPR
     1278+           && TREE_SIDE_EFFECTS (omax)
     1279+           && !TREE_TYPE (max))
     1280+         TREE_TYPE (max) = TREE_TYPE (TREE_OPERAND (max, 0));
     1281+
     1282        max = fold_decl_constant_value (max);
     1283 
     1284        /* If we're in a partial instantiation, preserve the magic NOP_EXPR
     1285@@ -9974,11 +9982,15 @@
     1286 
     1287       if (r == NULL)
     1288        {
     1289+         tree c;
     1290          /* This can happen for a parameter name used later in a function
     1291             declaration (such as in a late-specified return type).  Just
     1292             make a dummy decl, since it's only used for its type.  */
     1293          gcc_assert (skip_evaluation);   
     1294-         r = tsubst_decl (t, args, complain);
     1295+         /* We copy T because want to tsubst the PARM_DECL only,
     1296+            not the following PARM_DECLs that are chained to T.  */
     1297+         c = copy_node (t);
     1298+         r = tsubst_decl (c, args, complain);
     1299          /* Give it the template pattern as its context; its true context
     1300             hasn't been instantiated yet and this is good enough for
     1301             mangling.  */
     1302@@ -13532,6 +13544,13 @@
    9271303          && !template_parameter_pack_p (parm))
    9281304        return 1;
     
    9381314       return 0;
    9391315 
     1316diff -Naur gcc-4.4.0.orig/gcc/cp/semantics.c gcc-4.4.0/gcc/cp/semantics.c
     1317--- gcc-4.4.0.orig/gcc/cp/semantics.c   2009-04-06 12:41:02.000000000 -0700
     1318+++ gcc-4.4.0/gcc/cp/semantics.c        2009-05-17 13:34:30.000000000 -0700
     1319@@ -2838,16 +2838,16 @@
     1320                                                     done, address_p,
     1321                                                     template_p,
     1322                                                     template_arg_p);
     1323-                 else if (dependent_scope_p (scope))
     1324-                   decl = build_qualified_name (/*type=*/NULL_TREE,
     1325-                                                scope,
     1326-                                                id_expression,
     1327-                                                template_p);
     1328-                 else if (DECL_P (decl))
     1329-                   decl = build_qualified_name (TREE_TYPE (decl),
     1330-                                                scope,
     1331-                                                id_expression,
     1332-                                                template_p);
     1333+                 else
     1334+                   {
     1335+                     tree type = NULL_TREE;
     1336+                     if (DECL_P (decl) && !dependent_scope_p (scope))
     1337+                       type = TREE_TYPE (decl);
     1338+                     decl = build_qualified_name (type,
     1339+                                                  scope,
     1340+                                                  id_expression,
     1341+                                                  template_p);
     1342+                   }
     1343                }
     1344              if (TREE_TYPE (decl))
     1345                decl = convert_from_reference (decl);
    9401346diff -Naur gcc-4.4.0.orig/gcc/cp/typeck.c gcc-4.4.0/gcc/cp/typeck.c
    9411347--- gcc-4.4.0.orig/gcc/cp/typeck.c      2009-04-06 21:38:10.000000000 -0700
    942 +++ gcc-4.4.0/gcc/cp/typeck.c   2009-04-23 04:13:57.000000000 -0700
    943 @@ -1508,7 +1508,7 @@
     1348+++ gcc-4.4.0/gcc/cp/typeck.c   2009-06-03 11:11:53.000000000 -0700
     1349@@ -260,6 +260,19 @@
     1350   enum tree_code code2 = TREE_CODE (t2);
     1351   tree attributes;
     1352 
     1353+  /* In what follows, we slightly generalize the rules given in [expr] so
     1354+     as to deal with `long long' and `complex'.  First, merge the
     1355+     attributes.  */
     1356+  attributes = (*targetm.merge_type_attributes) (t1, t2);
     1357+
     1358+  if (SCOPED_ENUM_P (t1) || SCOPED_ENUM_P (t2))
     1359+    {
     1360+      if (TYPE_MAIN_VARIANT (t1) == TYPE_MAIN_VARIANT (t2))
     1361+       return build_type_attribute_variant (t1, attributes);
     1362+      else
     1363+       return NULL_TREE;
     1364+    }
     1365+
     1366   /* FIXME: Attributes.  */
     1367   gcc_assert (ARITHMETIC_TYPE_P (t1)
     1368              || TREE_CODE (t1) == VECTOR_TYPE
     1369@@ -268,11 +281,6 @@
     1370              || TREE_CODE (t2) == VECTOR_TYPE
     1371              || UNSCOPED_ENUM_P (t2));
     1372 
     1373-  /* In what follows, we slightly generalize the rules given in [expr] so
     1374-     as to deal with `long long' and `complex'.  First, merge the
     1375-     attributes.  */
     1376-  attributes = (*targetm.merge_type_attributes) (t1, t2);
     1377-
     1378   /* If one type is complex, form the common type of the non-complex
     1379      components, then make that complex.  Use T1 or T2 if it is the
     1380      required type.  */
     1381@@ -1508,7 +1516,7 @@
    9441382 bool
    9451383 invalid_nonstatic_memfn_p (const_tree expr, tsubst_flags_t complain)
     
    9501388       if (complain & tf_error)
    9511389         error ("invalid use of non-static member function");
     1390@@ -2437,6 +2445,10 @@
     1391 
     1392   if (processing_template_decl)
     1393     {
     1394+      /* Retain the type if we know the operand is a pointer so that
     1395+        describable_type doesn't make auto deduction break.  */
     1396+      if (TREE_TYPE (expr) && POINTER_TYPE_P (TREE_TYPE (expr)))
     1397+       return build_min (INDIRECT_REF, TREE_TYPE (TREE_TYPE (expr)), expr);
     1398       if (type_dependent_expression_p (expr))
     1399        return build_min_nt (INDIRECT_REF, expr);
     1400       expr = build_non_dependent_expr (expr);
     1401@@ -3589,9 +3601,9 @@
     1402 
     1403       build_type = boolean_type_node;
     1404       if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE
     1405-          || code0 == COMPLEX_TYPE)
     1406+          || code0 == COMPLEX_TYPE || code0 == ENUMERAL_TYPE)
     1407          && (code1 == INTEGER_TYPE || code1 == REAL_TYPE
     1408-             || code1 == COMPLEX_TYPE))
     1409+             || code1 == COMPLEX_TYPE || code1 == ENUMERAL_TYPE))
     1410        short_compare = 1;
     1411       else if ((code0 == POINTER_TYPE && code1 == POINTER_TYPE)
     1412               || (TYPE_PTRMEM_P (type0) && TYPE_PTRMEM_P (type1)))
     1413@@ -3863,9 +3875,10 @@
     1414       break;
     1415     }
     1416 
     1417-  if (((code0 == INTEGER_TYPE || code0 == REAL_TYPE || code0 == COMPLEX_TYPE)
     1418+  if (((code0 == INTEGER_TYPE || code0 == REAL_TYPE || code0 == COMPLEX_TYPE
     1419+       || code0 == ENUMERAL_TYPE)
     1420        && (code1 == INTEGER_TYPE || code1 == REAL_TYPE
     1421-          || code1 == COMPLEX_TYPE)))
     1422+          || code1 == COMPLEX_TYPE || code1 == ENUMERAL_TYPE)))
     1423     arithmetic_types_p = 1;
     1424   else
     1425     {
     1426@@ -5967,8 +5980,11 @@
     1427 
     1428   if (modifycode == INIT_EXPR)
     1429     {
     1430-      if (TREE_CODE (rhs) == CONSTRUCTOR)
     1431+      if (BRACE_ENCLOSED_INITIALIZER_P (rhs))
     1432+       /* Do the default thing.  */;
     1433+      else if (TREE_CODE (rhs) == CONSTRUCTOR)
     1434        {
     1435+         /* Compound literal.  */
     1436          if (! same_type_p (TREE_TYPE (rhs), lhstype))
     1437            /* Call convert to generate an error; see PR 11063.  */
     1438            rhs = convert (lhstype, rhs);
    9521439diff -Naur gcc-4.4.0.orig/gcc/cse.c gcc-4.4.0/gcc/cse.c
    9531440--- gcc-4.4.0.orig/gcc/cse.c    2009-03-14 01:10:55.000000000 -0700
     
    9921479diff -Naur gcc-4.4.0.orig/gcc/DATESTAMP gcc-4.4.0/gcc/DATESTAMP
    9931480--- gcc-4.4.0.orig/gcc/DATESTAMP        2009-04-20 17:16:42.000000000 -0700
    994 +++ gcc-4.4.0/gcc/DATESTAMP     2009-04-28 17:16:54.000000000 -0700
     1481+++ gcc-4.4.0/gcc/DATESTAMP     2009-06-04 17:16:45.000000000 -0700
    9951482@@ -1 +1 @@
    9961483-20090421
    997 +20090429
     1484+20090605
    9981485diff -Naur gcc-4.4.0.orig/gcc/dbxout.c gcc-4.4.0/gcc/dbxout.c
    9991486--- gcc-4.4.0.orig/gcc/dbxout.c 2009-02-27 11:49:42.000000000 -0800
     
    10081495          int did_output;
    10091496          int blocknum = BLOCK_NUMBER (block);
     1497diff -Naur gcc-4.4.0.orig/gcc/dfp.c gcc-4.4.0/gcc/dfp.c
     1498--- gcc-4.4.0.orig/gcc/dfp.c    2008-06-18 18:13:53.000000000 -0700
     1499+++ gcc-4.4.0/gcc/dfp.c 2009-05-07 14:38:46.000000000 -0700
     1500@@ -1,5 +1,5 @@
     1501 /* Decimal floating point support.
     1502-   Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
     1503+   Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
     1504 
     1505 This file is part of GCC.
     1506 
     1507@@ -132,6 +132,7 @@
     1508   decNumber dn;
     1509   decimal32 d32;
     1510   decContext set;
     1511+  int32_t image;
     1512 
     1513   decContextDefault (&set, DEC_INIT_DECIMAL128);
     1514   set.traps = 0;
     1515@@ -139,7 +140,8 @@
     1516   decimal_to_decnumber (r, &dn);
     1517   decimal32FromNumber (&d32, &dn, &set);
     1518 
     1519-  buf[0] = *(uint32_t *) d32.bytes;
     1520+  memcpy (&image, d32.bytes, sizeof (int32_t));
     1521+  buf[0] = image;
     1522 }
     1523 
     1524 /* Decode an IEEE 754 decimal32 type into a real.  */
     1525@@ -151,11 +153,13 @@
     1526   decNumber dn;
     1527   decimal32 d32;
     1528   decContext set;
     1529+  int32_t image;
     1530 
     1531   decContextDefault (&set, DEC_INIT_DECIMAL128);
     1532   set.traps = 0;
     1533 
     1534-  *((uint32_t *) d32.bytes) = (uint32_t) buf[0];
     1535+  image = buf[0];
     1536+  memcpy (&d32.bytes, &image, sizeof (int32_t));
     1537 
     1538   decimal32ToNumber (&d32, &dn);
     1539   decimal_from_decnumber (r, &dn, &set);
     1540@@ -170,6 +174,7 @@
     1541   decNumber dn;
     1542   decimal64 d64;
     1543   decContext set;
     1544+  int32_t image;
     1545 
     1546   decContextDefault (&set, DEC_INIT_DECIMAL128);
     1547   set.traps = 0;
     1548@@ -179,13 +184,17 @@
     1549 
     1550   if (WORDS_BIGENDIAN == FLOAT_WORDS_BIG_ENDIAN)
     1551     {
     1552-      buf[0] = *(uint32_t *) &d64.bytes[0];
     1553-      buf[1] = *(uint32_t *) &d64.bytes[4];
     1554+      memcpy (&image, &d64.bytes[0], sizeof (int32_t));
     1555+      buf[0] = image;
     1556+      memcpy (&image, &d64.bytes[4], sizeof (int32_t));
     1557+      buf[1] = image;
     1558     }
     1559   else
     1560     {
     1561-      buf[0] = *(uint32_t *) &d64.bytes[4];
     1562-      buf[1] = *(uint32_t *) &d64.bytes[0];
     1563+      memcpy (&image, &d64.bytes[4], sizeof (int32_t));
     1564+      buf[0] = image;
     1565+      memcpy (&image, &d64.bytes[0], sizeof (int32_t));
     1566+      buf[1] = image;
     1567     }
     1568 }
     1569 
     1570@@ -198,19 +207,24 @@
     1571   decNumber dn;
     1572   decimal64 d64;
     1573   decContext set;
     1574+  int32_t image;
     1575 
     1576   decContextDefault (&set, DEC_INIT_DECIMAL128);
     1577   set.traps = 0;
     1578 
     1579   if (WORDS_BIGENDIAN == FLOAT_WORDS_BIG_ENDIAN)
     1580     {
     1581-      *((uint32_t *) &d64.bytes[0]) = (uint32_t) buf[0];
     1582-      *((uint32_t *) &d64.bytes[4]) = (uint32_t) buf[1];
     1583+      image = buf[0];
     1584+      memcpy (&d64.bytes[0], &image, sizeof (int32_t));
     1585+      image = buf[1];
     1586+      memcpy (&d64.bytes[4], &image, sizeof (int32_t));
     1587     }
     1588   else
     1589     {
     1590-      *((uint32_t *) &d64.bytes[0]) = (uint32_t) buf[1];
     1591-      *((uint32_t *) &d64.bytes[4]) = (uint32_t) buf[0];
     1592+      image = buf[1];
     1593+      memcpy (&d64.bytes[0], &image, sizeof (int32_t));
     1594+      image = buf[0];
     1595+      memcpy (&d64.bytes[4], &image, sizeof (int32_t));
     1596     }
     1597 
     1598   decimal64ToNumber (&d64, &dn);
     1599@@ -226,6 +240,7 @@
     1600   decNumber dn;
     1601   decContext set;
     1602   decimal128 d128;
     1603+  int32_t image;
     1604 
     1605   decContextDefault (&set, DEC_INIT_DECIMAL128);
     1606   set.traps = 0;
     1607@@ -235,17 +250,25 @@
     1608 
     1609   if (WORDS_BIGENDIAN == FLOAT_WORDS_BIG_ENDIAN)
     1610     {
     1611-      buf[0] = *(uint32_t *) &d128.bytes[0];
     1612-      buf[1] = *(uint32_t *) &d128.bytes[4];
     1613-      buf[2] = *(uint32_t *) &d128.bytes[8];
     1614-      buf[3] = *(uint32_t *) &d128.bytes[12];
     1615+      memcpy (&image, &d128.bytes[0], sizeof (int32_t));
     1616+      buf[0] = image;
     1617+      memcpy (&image, &d128.bytes[4], sizeof (int32_t));
     1618+      buf[1] = image;
     1619+      memcpy (&image, &d128.bytes[8], sizeof (int32_t));
     1620+      buf[2] = image;
     1621+      memcpy (&image, &d128.bytes[12], sizeof (int32_t));
     1622+      buf[3] = image;
     1623     }
     1624   else
     1625     {
     1626-      buf[0] = *(uint32_t *) &d128.bytes[12];
     1627-      buf[1] = *(uint32_t *) &d128.bytes[8];
     1628-      buf[2] = *(uint32_t *) &d128.bytes[4];
     1629-      buf[3] = *(uint32_t *) &d128.bytes[0];
     1630+      memcpy (&image, &d128.bytes[12], sizeof (int32_t));
     1631+      buf[0] = image;
     1632+      memcpy (&image, &d128.bytes[8], sizeof (int32_t));
     1633+      buf[1] = image;
     1634+      memcpy (&image, &d128.bytes[4], sizeof (int32_t));
     1635+      buf[2] = image;
     1636+      memcpy (&image, &d128.bytes[0], sizeof (int32_t));
     1637+      buf[3] = image;
     1638     }
     1639 }
     1640 
     1641@@ -258,23 +281,32 @@
     1642   decNumber dn;
     1643   decimal128 d128;
     1644   decContext set;
     1645+  int32_t image;
     1646 
     1647   decContextDefault (&set, DEC_INIT_DECIMAL128);
     1648   set.traps = 0;
     1649 
     1650   if (WORDS_BIGENDIAN == FLOAT_WORDS_BIG_ENDIAN)
     1651     {
     1652-      *((uint32_t *) &d128.bytes[0])  = (uint32_t) buf[0];
     1653-      *((uint32_t *) &d128.bytes[4])  = (uint32_t) buf[1];
     1654-      *((uint32_t *) &d128.bytes[8])  = (uint32_t) buf[2];
     1655-      *((uint32_t *) &d128.bytes[12]) = (uint32_t) buf[3];
     1656+      image = buf[0];
     1657+      memcpy (&d128.bytes[0],  &image, sizeof (int32_t));
     1658+      image = buf[1];
     1659+      memcpy (&d128.bytes[4],  &image, sizeof (int32_t));
     1660+      image = buf[2];
     1661+      memcpy (&d128.bytes[8],  &image, sizeof (int32_t));
     1662+      image = buf[3];
     1663+      memcpy (&d128.bytes[12], &image, sizeof (int32_t));
     1664     }
     1665   else
     1666     {
     1667-      *((uint32_t *) &d128.bytes[0])  = (uint32_t) buf[3];
     1668-      *((uint32_t *) &d128.bytes[4])  = (uint32_t) buf[2];
     1669-      *((uint32_t *) &d128.bytes[8])  = (uint32_t) buf[1];
     1670-      *((uint32_t *) &d128.bytes[12]) = (uint32_t) buf[0];
     1671+      image = buf[3];
     1672+      memcpy (&d128.bytes[0],  &image, sizeof (int32_t));
     1673+      image = buf[2];
     1674+      memcpy (&d128.bytes[4],  &image, sizeof (int32_t));
     1675+      image = buf[1];
     1676+      memcpy (&d128.bytes[8],  &image, sizeof (int32_t));
     1677+      image = buf[0];
     1678+      memcpy (&d128.bytes[12], &image, sizeof (int32_t));
     1679     }
     1680 
     1681   decimal128ToNumber (&d128, &dn);
     1682diff -Naur gcc-4.4.0.orig/gcc/doc/gccint.texi gcc-4.4.0/gcc/doc/gccint.texi
     1683--- gcc-4.4.0.orig/gcc/doc/gccint.texi  2008-09-21 08:05:14.000000000 -0700
     1684+++ gcc-4.4.0/gcc/doc/gccint.texi       2009-05-23 10:55:01.000000000 -0700
     1685@@ -109,10 +109,10 @@
     1686 * Options::         Option specification files.
     1687 * Passes::          Order of passes, what they do, and what each file is for.
     1688 * Trees::           The source representation used by the C and C++ front ends.
     1689-* RTL::             The intermediate representation that most passes work on.
     1690 * GENERIC::         Language-independent representation generated by Front Ends
     1691 * GIMPLE::          Tuple representation used by Tree SSA optimizers
     1692 * Tree SSA::        Analysis and optimization of GIMPLE
     1693+* RTL::             Machine-dependent low-level intermediate representation.
     1694 * Control Flow::    Maintaining and manipulating the control flow graph.
     1695 * Loop Analysis and Representation:: Analysis and representation of loops
     1696 * Machine Desc::    How to write machine description instruction patterns.
     1697diff -Naur gcc-4.4.0.orig/gcc/doc/md.texi gcc-4.4.0/gcc/doc/md.texi
     1698--- gcc-4.4.0.orig/gcc/doc/md.texi      2009-02-20 07:20:38.000000000 -0800
     1699+++ gcc-4.4.0/gcc/doc/md.texi   2009-05-07 01:14:55.000000000 -0700
     1700@@ -5111,8 +5111,6 @@
     1701 Operand 0 is the memory on which the atomic operation is performed.
     1702 Operand 1 is the second operand to the binary operator.
     1703 
     1704-The ``nand'' operation is @code{~op0 & op1}.
     1705-
     1706 This pattern must issue any memory barrier instructions such that all
     1707 memory operations before the atomic operation occur before the atomic
     1708 operation and all memory operations after the atomic operation occur
     1709diff -Naur gcc-4.4.0.orig/gcc/doc/passes.texi gcc-4.4.0/gcc/doc/passes.texi
     1710--- gcc-4.4.0.orig/gcc/doc/passes.texi  2009-02-20 07:20:38.000000000 -0800
     1711+++ gcc-4.4.0/gcc/doc/passes.texi       2009-05-23 10:55:01.000000000 -0700
     1712@@ -21,7 +21,7 @@
     1713 * Parsing pass::         The language front end turns text into bits.
     1714 * Gimplification pass::  The bits are turned into something we can optimize.
     1715 * Pass manager::         Sequencing the optimization passes.
     1716-* Tree-SSA passes::      Optimizations on a high-level representation.
     1717+* Tree SSA passes::      Optimizations on a high-level representation.
     1718 * RTL passes::           Optimizations on a low-level representation.
     1719 @end menu
     1720 
     1721@@ -94,8 +94,8 @@
     1722 should be passed to @code{cgraph_finalize_function}.
     1723 
     1724 TODO: I know rest_of_compilation currently has all sorts of
     1725-rtl-generation semantics.  I plan to move all code generation
     1726-bits (both tree and rtl) to compile_function.  Should we hide
     1727+RTL generation semantics.  I plan to move all code generation
     1728+bits (both Tree and RTL) to compile_function.  Should we hide
     1729 cgraph from the front ends and move back to rest_of_compilation
     1730 as the official interface?  Possibly we should rename all three
     1731 interfaces such that the names match in some meaningful way and
     1732@@ -172,12 +172,12 @@
     1733 
     1734 TODO: describe the global variables set up by the pass manager,
     1735 and a brief description of how a new pass should use it.
     1736-I need to look at what info rtl passes use first@enddots{}
     1737+I need to look at what info RTL passes use first@enddots{}
     1738 
     1739-@node Tree-SSA passes
     1740-@section Tree-SSA passes
     1741+@node Tree SSA passes
     1742+@section Tree SSA passes
     1743 
     1744-The following briefly describes the tree optimization passes that are
     1745+The following briefly describes the Tree optimization passes that are
     1746 run after gimplification and what source files they are located in.
     1747 
     1748 @itemize @bullet
     1749@@ -401,7 +401,7 @@
     1750 The optimizations performed by this pass are:
     1751 
     1752 Loop invariant motion.  This pass moves only invariants that
     1753-would be hard to handle on rtl level (function calls, operations that expand to
     1754+would be hard to handle on RTL level (function calls, operations that expand to
     1755 nontrivial sequences of insns).  With @option{-funswitch-loops} it also moves
     1756 operands of conditions that are invariant out of the loop, so that we can use
     1757 just trivial invariantness analysis in loop unswitching.  The pass also includes
     1758@@ -422,8 +422,8 @@
     1759 out of the loops.  To achieve this, a duplicate of the loop is created for
     1760 each possible outcome of conditional jump(s).  The pass is implemented in
     1761 @file{tree-ssa-loop-unswitch.c}.  This pass should eventually replace the
     1762-rtl-level loop unswitching in @file{loop-unswitch.c}, but currently
     1763-the rtl-level pass is not completely redundant yet due to deficiencies
     1764+RTL level loop unswitching in @file{loop-unswitch.c}, but currently
     1765+the RTL level pass is not completely redundant yet due to deficiencies
     1766 in tree level alias analysis.
     1767 
     1768 The optimizations also use various utility functions contained in
     1769@@ -651,8 +651,8 @@
     1770 @node RTL passes
     1771 @section RTL passes
     1772 
     1773-The following briefly describes the rtl generation and optimization
     1774-passes that are run after tree optimization.
     1775+The following briefly describes the RTL generation and optimization
     1776+passes that are run after the Tree optimization passes.
     1777 
     1778 @itemize @bullet
     1779 @item RTL generation
     1780@@ -679,15 +679,15 @@
     1781 and @code{gencodes}, tell this pass which standard names are available
     1782 for use and which patterns correspond to them.
     1783 
     1784-@item Generate exception handling landing pads
     1785+@item Generation of exception landing pads
     1786 
     1787 This pass generates the glue that handles communication between the
     1788 exception handling library routines and the exception handlers within
     1789 the function.  Entry points in the function that are invoked by the
     1790 exception handling library are called @dfn{landing pads}.  The code
     1791-for this pass is located within @file{except.c}.
     1792+for this pass is located in @file{except.c}.
     1793 
     1794-@item Cleanup control flow graph
     1795+@item Control flow graph cleanup
     1796 
     1797 This pass removes unreachable code, simplifies jumps to next, jumps to
     1798 jump, jumps across jumps, etc.  The pass is run multiple times.
     1799@@ -702,16 +702,16 @@
     1800 variables that come from a single definition, and
     1801 seeing if the result can be simplified.  It performs copy propagation
     1802 and addressing mode selection.  The pass is run twice, with values
     1803-being propagated into loops only on the second run.  It is located in
     1804-@file{fwprop.c}.
     1805+being propagated into loops only on the second run.  The code is
     1806+located in @file{fwprop.c}.
     1807 
     1808 @item Common subexpression elimination
     1809 
     1810 This pass removes redundant computation within basic blocks, and
     1811 optimizes addressing modes based on cost.  The pass is run twice.
     1812-The source is located in @file{cse.c}.
     1813+The code for this pass is located in @file{cse.c}.
     1814 
     1815-@item Global common subexpression elimination.
     1816+@item Global common subexpression elimination
     1817 
     1818 This pass performs two
     1819 different types of GCSE  depending on whether you are optimizing for
     1820@@ -755,22 +755,13 @@
     1821 assignments with arithmetic, boolean value producing comparison
     1822 instructions, and conditional move instructions.  In the very last
     1823 invocation after reload, it will generate predicated instructions
     1824-when supported by the target.  The pass is located in @file{ifcvt.c}.
     1825+when supported by the target.  The code is located in @file{ifcvt.c}.
     1826 
     1827 @item Web construction
     1828 
     1829 This pass splits independent uses of each pseudo-register.  This can
     1830 improve effect of the other transformation, such as CSE or register
     1831-allocation.  Its source files are @file{web.c}.
     1832-
     1833-@item Life analysis
     1834-
     1835-This pass computes which pseudo-registers are live at each point in
     1836-the program, and makes the first instruction that uses a value point
     1837-at the instruction that computed the value.  It then deletes
     1838-computations whose results are never used, and combines memory
     1839-references with add or subtract instructions to make autoincrement or
     1840-autodecrement addressing.  The pass is located in @file{flow.c}.
     1841+allocation.  The code for this pass is located in @file{web.c}.
     1842 
     1843 @item Instruction combination
     1844 
     1845@@ -778,23 +769,23 @@
     1846 are related by data flow into single instructions.  It combines the
     1847 RTL expressions for the instructions by substitution, simplifies the
     1848 result using algebra, and then attempts to match the result against
     1849-the machine description.  The pass is located in @file{combine.c}.
     1850+the machine description.  The code is located in @file{combine.c}.
     1851 
     1852 @item Register movement
     1853 
     1854 This pass looks for cases where matching constraints would force an
     1855 instruction to need a reload, and this reload would be a
     1856 register-to-register move.  It then attempts to change the registers
     1857-used by the instruction to avoid the move instruction.
     1858-The pass is located in @file{regmove.c}.
     1859+used by the instruction to avoid the move instruction.  The code is
     1860+located in @file{regmove.c}.
     1861 
     1862-@item Optimize mode switching
     1863+@item Mode switching optimization
     1864 
     1865 This pass looks for instructions that require the processor to be in a
     1866 specific ``mode'' and minimizes the number of mode changes required to
     1867 satisfy all users.  What these modes are, and what they apply to are
     1868-completely target-specific.
     1869-The source is located in @file{mode-switching.c}.
     1870+completely target-specific.  The code for this pass is located in
     1871+@file{mode-switching.c}.
     1872 
     1873 @cindex modulo scheduling
     1874 @cindex sms, swing, software pipelining
     1875@@ -802,8 +793,8 @@
     1876 
     1877 This pass looks at innermost loops and reorders their instructions
     1878 by overlapping different iterations.  Modulo scheduling is performed
     1879-immediately before instruction scheduling.
     1880-The pass is located in (@file{modulo-sched.c}).
     1881+immediately before instruction scheduling.  The code for this pass is
     1882+located in @file{modulo-sched.c}.
     1883 
     1884 @item Instruction scheduling
     1885 
     1886@@ -813,7 +804,7 @@
     1887 It re-orders instructions within a basic block to try to separate the
     1888 definition and use of items that otherwise would cause pipeline
     1889 stalls.  This pass is performed twice, before and after register
     1890-allocation.  The pass is located in @file{haifa-sched.c},
     1891+allocation.  The code for this pass is located in @file{haifa-sched.c},
     1892 @file{sched-deps.c}, @file{sched-ebb.c}, @file{sched-rgn.c} and
     1893 @file{sched-vis.c}.
     1894 
     1895@@ -884,13 +875,13 @@
     1896 position in code and generates notes describing the variable locations
     1897 to RTL code.  The location lists are then generated according to these
     1898 notes to debug information if the debugging information format supports
     1899-location lists.
     1900+location lists.  The code is located in @file{var-tracking.c}.
     1901 
     1902 @item Delayed branch scheduling
     1903 
     1904 This optional pass attempts to find instructions that can go into the
     1905-delay slots of other instructions, usually jumps and calls.  The
     1906-source file name is @file{reorg.c}.
     1907+delay slots of other instructions, usually jumps and calls.  The code
     1908+for this pass is located in @file{reorg.c}.
     1909 
     1910 @item Branch shortening
     1911 
     1912@@ -899,13 +890,14 @@
     1913 In this pass, the compiler figures out what how far each instruction
     1914 will be from each other instruction, and therefore whether the usual
     1915 instructions, or the longer sequences, must be used for each branch.
     1916+The code for this pass is located in @file{final.c}.
     1917 
     1918 @item Register-to-stack conversion
     1919 
     1920 Conversion from usage of some hard registers to usage of a register
     1921 stack may be done at this point.  Currently, this is supported only
     1922-for the floating-point registers of the Intel 80387 coprocessor.   The
     1923-source file name is @file{reg-stack.c}.
     1924+for the floating-point registers of the Intel 80387 coprocessor.  The
     1925+code for this pass is located in @file{reg-stack.c}.
     1926 
     1927 @item Final
     1928 
     1929diff -Naur gcc-4.4.0.orig/gcc/doc/rtl.texi gcc-4.4.0/gcc/doc/rtl.texi
     1930--- gcc-4.4.0.orig/gcc/doc/rtl.texi     2008-10-15 17:51:34.000000000 -0700
     1931+++ gcc-4.4.0/gcc/doc/rtl.texi  2009-05-23 10:55:01.000000000 -0700
     1932@@ -10,10 +10,10 @@
     1933 @cindex representation of RTL
     1934 @cindex Register Transfer Language (RTL)
     1935 
     1936-Most of the work of the compiler is done on an intermediate representation
     1937-called register transfer language.  In this language, the instructions to be
     1938-output are described, pretty much one by one, in an algebraic form that
     1939-describes what the instruction does.
     1940+The last part of the compiler work is done on a low-level intermediate
     1941+representation called Register Transfer Language.  In this language, the
     1942+instructions to be output are described, pretty much one by one, in an
     1943+algebraic form that describes what the instruction does.
     1944 
     1945 RTL is inspired by Lisp lists.  It has both an internal form, made up of
     1946 structures that point at other structures, and a textual form that is used
     1947diff -Naur gcc-4.4.0.orig/gcc/dojump.c gcc-4.4.0/gcc/dojump.c
     1948--- gcc-4.4.0.orig/gcc/dojump.c 2009-01-09 05:43:14.000000000 -0800
     1949+++ gcc-4.4.0/gcc/dojump.c      2009-05-07 08:36:23.000000000 -0700
     1950@@ -141,7 +141,8 @@
     1951     }
     1952 
     1953   /* Fill in the integers.  */
     1954-  XEXP (and_test, 1) = GEN_INT ((unsigned HOST_WIDE_INT) 1 << bitnum);
     1955+  XEXP (and_test, 1)
     1956+    = immed_double_const ((unsigned HOST_WIDE_INT) 1 << bitnum, 0, mode);
     1957   XEXP (XEXP (shift_test, 0), 1) = GEN_INT (bitnum);
     1958 
     1959   return (rtx_cost (and_test, IF_THEN_ELSE, optimize_insn_for_speed_p ())
     1960@@ -475,10 +476,10 @@
     1961                  && prefer_and_bit_test (TYPE_MODE (argtype),
     1962                                          TREE_INT_CST_LOW (shift)))
     1963                {
     1964-                 HOST_WIDE_INT mask = (HOST_WIDE_INT) 1
     1965-                                      << TREE_INT_CST_LOW (shift);
     1966+                 unsigned HOST_WIDE_INT mask
     1967+                   = (unsigned HOST_WIDE_INT) 1 << TREE_INT_CST_LOW (shift);
     1968                  do_jump (build2 (BIT_AND_EXPR, argtype, arg,
     1969-                                  build_int_cst_type (argtype, mask)),
     1970+                                  build_int_cst_wide_type (argtype, mask, 0)),
     1971                           clr_label, set_label);
     1972                  break;
     1973                }
    10101974diff -Naur gcc-4.4.0.orig/gcc/dse.c gcc-4.4.0/gcc/dse.c
    10111975--- gcc-4.4.0.orig/gcc/dse.c    2009-03-18 10:04:26.000000000 -0700
    1012 +++ gcc-4.4.0/gcc/dse.c 2009-04-27 04:55:13.000000000 -0700
     1976+++ gcc-4.4.0/gcc/dse.c 2009-05-13 14:42:03.000000000 -0700
    10131977@@ -223,7 +223,7 @@
    10141978   /* This canonized mem.  */
     
    11512115              /* If this read is just reading back something that we just
    11522116                 stored, rewrite the read.  */
    1153 @@ -2224,7 +2257,7 @@
     2117@@ -2212,6 +2245,7 @@
     2118          if (store_info->rhs
     2119              && store_info->group_id == -1
     2120              && store_info->cse_base == base
     2121+             && width != -1
     2122              && offset >= store_info->begin
     2123              && offset + width <= store_info->end
     2124              && all_positions_needed_p (store_info,
     2125@@ -2224,7 +2258,7 @@
    11542126            remove = canon_true_dependence (store_info->mem,
    11552127                                            GET_MODE (store_info->mem),
     
    11602132          if (remove)
    11612133            {
    1162 @@ -3066,8 +3099,9 @@
     2134@@ -3066,8 +3100,9 @@
    11632135                  if ((read_info->group_id < 0)
    11642136                      && canon_true_dependence (group->base_mem,
     
    11722144                      if (kill)
    11732145                        bitmap_ior_into (kill, group->group_kill);
     2146diff -Naur gcc-4.4.0.orig/gcc/dwarf2out.c gcc-4.4.0/gcc/dwarf2out.c
     2147--- gcc-4.4.0.orig/gcc/dwarf2out.c      2009-03-23 16:21:38.000000000 -0700
     2148+++ gcc-4.4.0/gcc/dwarf2out.c   2009-06-03 10:32:45.000000000 -0700
     2149@@ -694,14 +694,15 @@
     2150   *p = cfi;
     2151 }
     2152 
     2153-/* Generate a new label for the CFI info to refer to.  */
     2154+/* Generate a new label for the CFI info to refer to.  FORCE is true
     2155+   if a label needs to be output even when using .cfi_* directives.  */
     2156 
     2157 char *
     2158-dwarf2out_cfi_label (void)
     2159+dwarf2out_cfi_label (bool force)
     2160 {
     2161   static char label[20];
     2162 
     2163-  if (dwarf2out_do_cfi_asm ())
     2164+  if (!force && dwarf2out_do_cfi_asm ())
     2165     {
     2166       /* In this case, we will be emitting the asm directive instead of
     2167         the label, so just return a placeholder to keep the rest of the
     2168@@ -729,11 +730,59 @@
     2169     {
     2170       if (label)
     2171        {
     2172-         output_cfi_directive (cfi);
     2173+         dw_fde_ref fde = current_fde ();
     2174+
     2175+         gcc_assert (fde != NULL);
     2176 
     2177          /* We still have to add the cfi to the list so that
     2178-            lookup_cfa works later on.  */
     2179-         list_head = &current_fde ()->dw_fde_cfi;
     2180+            lookup_cfa works later on.  When -g2 and above we
     2181+            even need to force emitting of CFI labels and
     2182+            add to list a DW_CFA_set_loc for convert_cfa_to_fb_loc_list
     2183+            purposes.  */
     2184+         switch (cfi->dw_cfi_opc)
     2185+           {
     2186+           case DW_CFA_def_cfa_offset:
     2187+           case DW_CFA_def_cfa_offset_sf:
     2188+           case DW_CFA_def_cfa_register:
     2189+           case DW_CFA_def_cfa:
     2190+           case DW_CFA_def_cfa_sf:
     2191+           case DW_CFA_def_cfa_expression:
     2192+           case DW_CFA_restore_state:
     2193+             if (write_symbols != DWARF2_DEBUG
     2194+                 && write_symbols != VMS_AND_DWARF2_DEBUG)
     2195+               break;
     2196+             if (debug_info_level <= DINFO_LEVEL_TERSE)
     2197+               break;
     2198+
     2199+             if (*label == 0 || strcmp (label, "<do not output>") == 0)
     2200+               label = dwarf2out_cfi_label (true);
     2201+
     2202+             if (fde->dw_fde_current_label == NULL
     2203+                 || strcmp (label, fde->dw_fde_current_label) != 0)
     2204+               {
     2205+                 dw_cfi_ref xcfi;
     2206+
     2207+                 label = xstrdup (label);
     2208+
     2209+                 /* Set the location counter to the new label.  */
     2210+                 xcfi = new_cfi ();
     2211+                 /* It doesn't metter whether DW_CFA_set_loc
     2212+                    or DW_CFA_advance_loc4 is added here, those aren't
     2213+                    emitted into assembly, only looked up by
     2214+                    convert_cfa_to_fb_loc_list.  */
     2215+                 xcfi->dw_cfi_opc = DW_CFA_set_loc;
     2216+                 xcfi->dw_cfi_oprnd1.dw_cfi_addr = label;
     2217+                 add_cfi (&fde->dw_fde_cfi, xcfi);
     2218+                 fde->dw_fde_current_label = label;
     2219+               }
     2220+             break;
     2221+           default:
     2222+             break;
     2223+           }
     2224+
     2225+         output_cfi_directive (cfi);
     2226+
     2227+         list_head = &fde->dw_fde_cfi;
     2228        }
     2229       /* ??? If this is a CFI for the CIE, we don't emit.  This
     2230         assumes that the standard CIE contents that the assembler
     2231@@ -748,7 +797,7 @@
     2232       gcc_assert (fde != NULL);
     2233 
     2234       if (*label == 0)
     2235-       label = dwarf2out_cfi_label ();
     2236+       label = dwarf2out_cfi_label (false);
     2237 
     2238       if (fde->dw_fde_current_label == NULL
     2239          || strcmp (label, fde->dw_fde_current_label) != 0)
     2240@@ -1464,7 +1513,7 @@
     2241   if (offset == 0)
     2242     return;
     2243 
     2244-  label = dwarf2out_cfi_label ();
     2245+  label = dwarf2out_cfi_label (false);
     2246   dwarf2out_args_size_adjust (offset, label);
     2247 }
     2248 
     2249@@ -2417,7 +2466,7 @@
     2250       return;
     2251     }
     2252 
     2253-  label = dwarf2out_cfi_label ();
     2254+  label = dwarf2out_cfi_label (false);
     2255   src = find_reg_note (insn, REG_FRAME_RELATED_EXPR, NULL_RTX);
     2256   if (src)
     2257     insn = XEXP (src, 0);
     2258@@ -2731,42 +2780,42 @@
     2259     case DW_CFA_offset:
     2260     case DW_CFA_offset_extended:
     2261     case DW_CFA_offset_extended_sf:
     2262-      r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 0);
     2263+      r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1);
     2264       fprintf (asm_out_file, "\t.cfi_offset %lu, "HOST_WIDE_INT_PRINT_DEC"\n",
     2265               r, cfi->dw_cfi_oprnd2.dw_cfi_offset);
     2266       break;
     2267 
     2268     case DW_CFA_restore:
     2269     case DW_CFA_restore_extended:
     2270-      r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 0);
     2271+      r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1);
     2272       fprintf (asm_out_file, "\t.cfi_restore %lu\n", r);
     2273       break;
     2274 
     2275     case DW_CFA_undefined:
     2276-      r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 0);
     2277+      r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1);
     2278       fprintf (asm_out_file, "\t.cfi_undefined %lu\n", r);
     2279       break;
     2280 
     2281     case DW_CFA_same_value:
     2282-      r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 0);
     2283+      r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1);
     2284       fprintf (asm_out_file, "\t.cfi_same_value %lu\n", r);
     2285       break;
     2286 
     2287     case DW_CFA_def_cfa:
     2288     case DW_CFA_def_cfa_sf:
     2289-      r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 0);
     2290+      r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1);
     2291       fprintf (asm_out_file, "\t.cfi_def_cfa %lu, "HOST_WIDE_INT_PRINT_DEC"\n",
     2292               r, cfi->dw_cfi_oprnd2.dw_cfi_offset);
     2293       break;
     2294 
     2295     case DW_CFA_def_cfa_register:
     2296-      r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 0);
     2297+      r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1);
     2298       fprintf (asm_out_file, "\t.cfi_def_cfa_register %lu\n", r);
     2299       break;
     2300 
     2301     case DW_CFA_register:
     2302-      r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 0);
     2303-      r2 = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd2.dw_cfi_reg_num, 0);
     2304+      r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1);
     2305+      r2 = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd2.dw_cfi_reg_num, 1);
     2306       fprintf (asm_out_file, "\t.cfi_register %lu, %lu\n", r, r2);
     2307       break;
     2308 
     2309@@ -14646,6 +14695,12 @@
     2310       /* Prevent broken recursion; we can't hand off to the same type.  */
     2311       gcc_assert (DECL_ORIGINAL_TYPE (TYPE_NAME (type)) != type);
     2312 
     2313+      /* Use the DIE of the containing namespace as the parent DIE of
     2314+         the type description DIE we want to generate.  */
     2315+      if (DECL_CONTEXT (TYPE_NAME (type))
     2316+         && TREE_CODE (DECL_CONTEXT (TYPE_NAME (type))) == NAMESPACE_DECL)
     2317+       context_die = lookup_decl_die (DECL_CONTEXT (TYPE_NAME (type)));
     2318+
     2319       TREE_ASM_WRITTEN (type) = 1;
     2320       gen_decl_die (TYPE_NAME (type), NULL, context_die);
     2321       return;
    11742322diff -Naur gcc-4.4.0.orig/gcc/fold-const.c gcc-4.4.0/gcc/fold-const.c
    11752323--- gcc-4.4.0.orig/gcc/fold-const.c     2009-03-11 08:24:00.000000000 -0700
    1176 +++ gcc-4.4.0/gcc/fold-const.c  2009-04-24 04:34:59.000000000 -0700
     2324+++ gcc-4.4.0/gcc/fold-const.c  2009-05-20 14:11:10.000000000 -0700
    11772325@@ -5293,31 +5293,34 @@
    11782326        break;
     
    12202368       case NE_EXPR:
    12212369        break;
    1222 @@ -11861,7 +11864,8 @@
     2370@@ -11360,6 +11363,8 @@
     2371              if (prec < HOST_BITS_PER_WIDE_INT
     2372                  || newmask == ~(unsigned HOST_WIDE_INT) 0)
     2373                {
     2374+                 tree newmaskt;
     2375+
     2376                  if (shift_type != TREE_TYPE (arg0))
     2377                    {
     2378                      tem = fold_build2 (TREE_CODE (arg0), shift_type,
     2379@@ -11370,9 +11375,9 @@
     2380                    }
     2381                  else
     2382                    tem = op0;
     2383-                 return fold_build2 (BIT_AND_EXPR, type, tem,
     2384-                                     build_int_cst_type (TREE_TYPE (op1),
     2385-                                                         newmask));
     2386+                 newmaskt = build_int_cst_type (TREE_TYPE (op1), newmask);
     2387+                 if (!tree_int_cst_equal (newmaskt, arg1))
     2388+                   return fold_build2 (BIT_AND_EXPR, type, tem, newmaskt);
     2389                }
     2390            }
     2391        }
     2392@@ -11861,7 +11866,8 @@
    12232393              if (code == LROTATE_EXPR || code == RROTATE_EXPR)
    12242394                low = low % TYPE_PRECISION (type);
     
    12302400                low = TYPE_PRECISION (type) - 1;
    12312401            }
    1232 diff -Naur gcc-4.4.0.orig/gcc/fortran/ChangeLog gcc-4.4.0/gcc/fortran/ChangeLog
    1233 --- gcc-4.4.0.orig/gcc/fortran/ChangeLog        2009-04-21 01:44:29.000000000 -0700
    1234 +++ gcc-4.4.0/gcc/fortran/ChangeLog     2009-04-22 04:37:04.000000000 -0700
    1235 @@ -1,3 +1,13 @@
    1236 +2009-04-22  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
    1237 +
    1238 +       Backport from mainline:
    1239 +       2009-03-30  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
    1240 +
    1241 +       * f95-lang.c (gfc_init_builtin_functions): Define BUILT_IN_HUGE_VAL
    1242 +       family of intrinsics instead of BUILT_IN_INF family.
    1243 +       * trans-intrinsics.c (gfc_conv_intrinsic_nearest): Use
    1244 +       BUILT_IN_HUGE_VAL instead of BUILT_IN_INF.
    1245 +
    1246  2009-04-21  Release Manager
    1247  
    1248         * GCC 4.4.0 released.
     2402diff -Naur gcc-4.4.0.orig/gcc/fortran/data.c gcc-4.4.0/gcc/fortran/data.c
     2403--- gcc-4.4.0.orig/gcc/fortran/data.c   2008-07-28 17:45:52.000000000 -0700
     2404+++ gcc-4.4.0/gcc/fortran/data.c        2009-06-04 10:01:45.000000000 -0700
     2405@@ -416,7 +416,11 @@
     2406     }
     2407 
     2408   if (ref || last_ts->type == BT_CHARACTER)
     2409-    expr = create_character_intializer (init, last_ts, ref, rvalue);
     2410+    {
     2411+      if (lvalue->ts.cl->length == NULL && !(ref && ref->u.ss.length != NULL))
     2412+       return FAILURE;
     2413+      expr = create_character_intializer (init, last_ts, ref, rvalue);
     2414+    }
     2415   else
     2416     {
     2417       /* Overwriting an existing initializer is non-standard but usually only
    12492418diff -Naur gcc-4.4.0.orig/gcc/fortran/f95-lang.c gcc-4.4.0/gcc/fortran/f95-lang.c
    12502419--- gcc-4.4.0.orig/gcc/fortran/f95-lang.c       2008-10-07 11:15:32.000000000 -0700
     
    12692438   /* lround{f,,l} and llround{f,,l} */
    12702439   type = tree_cons (NULL_TREE, float_type_node, void_list_node);
     2440diff -Naur gcc-4.4.0.orig/gcc/fortran/module.c gcc-4.4.0/gcc/fortran/module.c
     2441--- gcc-4.4.0.orig/gcc/fortran/module.c 2009-02-26 23:45:47.000000000 -0800
     2442+++ gcc-4.4.0/gcc/fortran/module.c      2009-05-22 05:54:23.000000000 -0700
     2443@@ -4738,7 +4738,7 @@
     2444   if ((file = fopen (filename, "r")) == NULL)
     2445     return -1;
     2446 
     2447-  /* Read two lines.  */
     2448+  /* Read the first line.  */
     2449   if (fgets (buf, sizeof (buf) - 1, file) == NULL)
     2450     {
     2451       fclose (file);
     2452@@ -4748,8 +4748,12 @@
     2453   /* The file also needs to be overwritten if the version number changed.  */
     2454   n = strlen ("GFORTRAN module version '" MOD_VERSION "' created");
     2455   if (strncmp (buf, "GFORTRAN module version '" MOD_VERSION "' created", n) != 0)
     2456-    return -1;
     2457+    {
     2458+      fclose (file);
     2459+      return -1;
     2460+    }
     2461 
     2462+  /* Read a second line.  */
     2463   if (fgets (buf, sizeof (buf) - 1, file) == NULL)
     2464     {
     2465       fclose (file);
     2466diff -Naur gcc-4.4.0.orig/gcc/fortran/simplify.c gcc-4.4.0/gcc/fortran/simplify.c
     2467--- gcc-4.4.0.orig/gcc/fortran/simplify.c       2009-03-06 01:06:51.000000000 -0800
     2468+++ gcc-4.4.0/gcc/fortran/simplify.c    2009-06-03 12:39:09.000000000 -0700
     2469@@ -2410,10 +2410,13 @@
     2470   bs = gfc_integer_kinds[i].bit_size;
     2471   if (mpz_cmp_si (e->value.integer, 0) == 0)
     2472     lz = bs;
     2473+  else if (mpz_cmp_si (e->value.integer, 0) < 0)
     2474+    lz = 0;
     2475   else
     2476     lz = bs - mpz_sizeinbase (e->value.integer, 2);
     2477 
     2478-  result = gfc_constant_result (BT_INTEGER, gfc_default_integer_kind, &e->where);
     2479+  result = gfc_constant_result (BT_INTEGER, gfc_default_integer_kind,
     2480+                               &e->where);
     2481   mpz_set_ui (result->value.integer, lz);
     2482 
     2483   return result;
     2484diff -Naur gcc-4.4.0.orig/gcc/fortran/trans-array.c gcc-4.4.0/gcc/fortran/trans-array.c
     2485--- gcc-4.4.0.orig/gcc/fortran/trans-array.c    2009-02-25 22:23:42.000000000 -0800
     2486+++ gcc-4.4.0/gcc/fortran/trans-array.c 2009-05-10 09:14:37.000000000 -0700
     2487@@ -1246,10 +1246,11 @@
     2488                  gfc_init_se (&se, NULL);
     2489                  gfc_conv_constant (&se, p->expr);
     2490 
     2491+                 if (c->expr->ts.type != BT_CHARACTER)
     2492+                   se.expr = fold_convert (type, se.expr);
     2493                  /* For constant character array constructors we build
     2494                     an array of pointers.  */
     2495-                 if (p->expr->ts.type == BT_CHARACTER
     2496-                     && POINTER_TYPE_P (type))
     2497+                 else if (POINTER_TYPE_P (type))
     2498                    se.expr = gfc_build_addr_expr
     2499                                (gfc_get_pchar_type (p->expr->ts.kind),
     2500                                 se.expr);
     2501@@ -1618,7 +1619,9 @@
     2502     {
     2503       gfc_init_se (&se, NULL);
     2504       gfc_conv_constant (&se, c->expr);
     2505-      if (c->expr->ts.type == BT_CHARACTER && POINTER_TYPE_P (type))
     2506+      if (c->expr->ts.type != BT_CHARACTER)
     2507+       se.expr = fold_convert (type, se.expr);
     2508+      else if (POINTER_TYPE_P (type))
     2509        se.expr = gfc_build_addr_expr (gfc_get_pchar_type (c->expr->ts.kind),
     2510                                       se.expr);
     2511       list = tree_cons (build_int_cst (gfc_array_index_type, nelem),
     2512diff -Naur gcc-4.4.0.orig/gcc/fortran/trans.c gcc-4.4.0/gcc/fortran/trans.c
     2513--- gcc-4.4.0.orig/gcc/fortran/trans.c  2008-11-01 06:26:19.000000000 -0700
     2514+++ gcc-4.4.0/gcc/fortran/trans.c       2009-05-10 08:34:55.000000000 -0700
     2515@@ -1109,12 +1109,14 @@
     2516            if (code->resolved_isym
     2517                && code->resolved_isym->id == GFC_ISYM_MVBITS)
     2518              is_mvbits = true;
     2519-           res = gfc_trans_call (code, is_mvbits);
     2520+           res = gfc_trans_call (code, is_mvbits, NULL_TREE,
     2521+                                 NULL_TREE, false);
     2522          }
     2523          break;
     2524 
     2525        case EXEC_ASSIGN_CALL:
     2526-         res = gfc_trans_call (code, true);
     2527+         res = gfc_trans_call (code, true, NULL_TREE,
     2528+                               NULL_TREE, false);
     2529          break;
     2530 
     2531        case EXEC_RETURN:
     2532diff -Naur gcc-4.4.0.orig/gcc/fortran/trans-decl.c gcc-4.4.0/gcc/fortran/trans-decl.c
     2533--- gcc-4.4.0.orig/gcc/fortran/trans-decl.c     2009-04-08 07:03:33.000000000 -0700
     2534+++ gcc-4.4.0/gcc/fortran/trans-decl.c  2009-06-03 12:39:09.000000000 -0700
     2535@@ -141,6 +141,8 @@
     2536 tree gfor_fndecl_size0;
     2537 tree gfor_fndecl_size1;
     2538 tree gfor_fndecl_iargc;
     2539+tree gfor_fndecl_clz128;
     2540+tree gfor_fndecl_ctz128;
     2541 
     2542 /* Intrinsic functions implemented in Fortran.  */
     2543 tree gfor_fndecl_sc_kind;
     2544@@ -2488,6 +2490,19 @@
     2545     gfc_build_library_function_decl (get_identifier (PREFIX ("iargc")),
     2546                                     gfc_int4_type_node,
     2547                                     0);
     2548+
     2549+  if (gfc_type_for_size (128, true))
     2550+    {
     2551+      tree uint128 = gfc_type_for_size (128, true);
     2552+
     2553+      gfor_fndecl_clz128 =
     2554+       gfc_build_library_function_decl (get_identifier (PREFIX ("clz128")),
     2555+                                        integer_type_node, 1, uint128);
     2556+
     2557+      gfor_fndecl_ctz128 =
     2558+       gfc_build_library_function_decl (get_identifier (PREFIX ("ctz128")),
     2559+                                        integer_type_node, 1, uint128);
     2560+    }
     2561 }
     2562 
     2563 
     2564diff -Naur gcc-4.4.0.orig/gcc/fortran/trans-expr.c gcc-4.4.0/gcc/fortran/trans-expr.c
     2565--- gcc-4.4.0.orig/gcc/fortran/trans-expr.c     2009-02-20 07:20:38.000000000 -0800
     2566+++ gcc-4.4.0/gcc/fortran/trans-expr.c  2009-05-10 08:34:55.000000000 -0700
     2567@@ -1526,48 +1526,6 @@
     2568 }
     2569 
     2570 
     2571-/* Translate the call for an elemental subroutine call used in an operator
     2572-   assignment.  This is a simplified version of gfc_conv_function_call.  */
     2573-
     2574-tree
     2575-gfc_conv_operator_assign (gfc_se *lse, gfc_se *rse, gfc_symbol *sym)
     2576-{
     2577-  tree args;
     2578-  tree tmp;
     2579-  gfc_se se;
     2580-  stmtblock_t block;
     2581-
     2582-  /* Only elemental subroutines with two arguments.  */
     2583-  gcc_assert (sym->attr.elemental && sym->attr.subroutine);
     2584-  gcc_assert (sym->formal->next->next == NULL);
     2585-
     2586-  gfc_init_block (&block);
     2587-
     2588-  gfc_add_block_to_block (&block, &lse->pre);
     2589-  gfc_add_block_to_block (&block, &rse->pre);
     2590-
     2591-  /* Build the argument list for the call, including hidden string lengths.  */
     2592-  args = gfc_chainon_list (NULL_TREE, build_fold_addr_expr (lse->expr));
     2593-  args = gfc_chainon_list (args, build_fold_addr_expr (rse->expr));
     2594-  if (lse->string_length != NULL_TREE)
     2595-    args = gfc_chainon_list (args, lse->string_length);
     2596-  if (rse->string_length != NULL_TREE)
     2597-    args = gfc_chainon_list (args, rse->string_length);   
     2598-
     2599-  /* Build the function call.  */
     2600-  gfc_init_se (&se, NULL);
     2601-  gfc_conv_function_val (&se, sym);
     2602-  tmp = TREE_TYPE (TREE_TYPE (TREE_TYPE (se.expr)));
     2603-  tmp = build_call_list (tmp, se.expr, args);
     2604-  gfc_add_expr_to_block (&block, tmp);
     2605-
     2606-  gfc_add_block_to_block (&block, &lse->post);
     2607-  gfc_add_block_to_block (&block, &rse->post);
     2608-
     2609-  return gfc_finish_block (&block);
     2610-}
     2611-
     2612-
     2613 /* Initialize MAPPING.  */
     2614 
     2615 void
     2616@@ -2782,7 +2740,18 @@
     2617              break;
     2618            }
     2619 
     2620+         if (e->expr_type == EXPR_OP
     2621+               && e->value.op.op == INTRINSIC_PARENTHESES
     2622+               && e->value.op.op1->expr_type == EXPR_VARIABLE)
     2623+           {
     2624+             tree local_tmp;
     2625+             local_tmp = gfc_evaluate_now (tmp, &se->pre);
     2626+             local_tmp = gfc_copy_alloc_comp (e->ts.derived, local_tmp, tmp, parm_rank);
     2627+             gfc_add_expr_to_block (&se->post, local_tmp);
     2628+           }
     2629+
     2630          tmp = gfc_deallocate_alloc_comp (e->ts.derived, tmp, parm_rank);
     2631+
     2632          gfc_add_expr_to_block (&se->post, tmp);
     2633         }
     2634 
     2635diff -Naur gcc-4.4.0.orig/gcc/fortran/trans.h gcc-4.4.0/gcc/fortran/trans.h
     2636--- gcc-4.4.0.orig/gcc/fortran/trans.h  2008-12-18 02:05:54.000000000 -0800
     2637+++ gcc-4.4.0/gcc/fortran/trans.h       2009-06-03 12:39:09.000000000 -0700
     2638@@ -310,9 +310,6 @@
     2639 /* Does an intrinsic map directly to an external library call.  */
     2640 int gfc_is_intrinsic_libcall (gfc_expr *);
     2641 
     2642-/* Used to call the elemental subroutines used in operator assignments.  */
     2643-tree gfc_conv_operator_assign (gfc_se *, gfc_se *, gfc_symbol *);
     2644-
     2645 /* Also used to CALL subroutines.  */
     2646 int gfc_conv_function_call (gfc_se *, gfc_symbol *, gfc_actual_arglist *,
     2647                            tree);
     2648@@ -594,6 +591,8 @@
     2649 extern GTY(()) tree gfor_fndecl_size0;
     2650 extern GTY(()) tree gfor_fndecl_size1;
     2651 extern GTY(()) tree gfor_fndecl_iargc;
     2652+extern GTY(()) tree gfor_fndecl_clz128;
     2653+extern GTY(()) tree gfor_fndecl_ctz128;
     2654 
     2655 /* Implemented in Fortran.  */
     2656 extern GTY(()) tree gfor_fndecl_sc_kind;
    12712657diff -Naur gcc-4.4.0.orig/gcc/fortran/trans-intrinsic.c gcc-4.4.0/gcc/fortran/trans-intrinsic.c
    12722658--- gcc-4.4.0.orig/gcc/fortran/trans-intrinsic.c        2009-02-20 07:20:38.000000000 -0800
    1273 +++ gcc-4.4.0/gcc/fortran/trans-intrinsic.c     2009-04-22 04:37:04.000000000 -0700
    1274 @@ -3129,32 +3129,32 @@
     2659+++ gcc-4.4.0/gcc/fortran/trans-intrinsic.c     2009-06-03 12:39:09.000000000 -0700
     2660@@ -2707,53 +2707,51 @@
     2661   tree leadz;
     2662   tree bit_size;
     2663   tree tmp;
     2664-  int arg_kind;
     2665-  int i, n, s;
     2666+  tree func;
     2667+  int s, argsize;
     2668 
     2669   gfc_conv_intrinsic_function_args (se, expr, &arg, 1);
     2670+  argsize = TYPE_PRECISION (TREE_TYPE (arg));
     2671 
     2672   /* Which variant of __builtin_clz* should we call?  */
     2673-  arg_kind = expr->value.function.actual->expr->ts.kind;
     2674-  i = gfc_validate_kind (BT_INTEGER, arg_kind, false);
     2675-  switch (arg_kind)
     2676+  if (argsize <= INT_TYPE_SIZE)
     2677     {
     2678-      case 1:
     2679-      case 2:
     2680-      case 4:
     2681-        arg_type = unsigned_type_node;
     2682-       n = BUILT_IN_CLZ;
     2683-       break;
     2684-
     2685-      case 8:
     2686-        arg_type = long_unsigned_type_node;
     2687-       n = BUILT_IN_CLZL;
     2688-       break;
     2689-
     2690-      case 16:
     2691-        arg_type = long_long_unsigned_type_node;
     2692-       n = BUILT_IN_CLZLL;
     2693-       break;
     2694-
     2695-      default:
     2696-        gcc_unreachable ();
     2697+      arg_type = unsigned_type_node;
     2698+      func = built_in_decls[BUILT_IN_CLZ];
     2699+    }
     2700+  else if (argsize <= LONG_TYPE_SIZE)
     2701+    {
     2702+      arg_type = long_unsigned_type_node;
     2703+      func = built_in_decls[BUILT_IN_CLZL];
     2704+    }
     2705+  else if (argsize <= LONG_LONG_TYPE_SIZE)
     2706+    {
     2707+      arg_type = long_long_unsigned_type_node;
     2708+      func = built_in_decls[BUILT_IN_CLZLL];
     2709+    }
     2710+  else
     2711+    {
     2712+      gcc_assert (argsize == 128);
     2713+      arg_type = gfc_build_uint_type (argsize);
     2714+      func = gfor_fndecl_clz128;
     2715     }
     2716 
     2717-  /* Convert the actual argument to the proper argument type for the built-in
     2718+  /* Convert the actual argument twice: first, to the unsigned type of the
     2719+     same size; then, to the proper argument type for the built-in
     2720      function.  But the return type is of the default INTEGER kind.  */
     2721+  arg = fold_convert (gfc_build_uint_type (argsize), arg);
     2722   arg = fold_convert (arg_type, arg);
     2723   result_type = gfc_get_int_type (gfc_default_integer_kind);
     2724 
     2725   /* Compute LEADZ for the case i .ne. 0.  */
     2726-  s = TYPE_PRECISION (arg_type) - gfc_integer_kinds[i].bit_size;
     2727-  tmp = fold_convert (result_type, build_call_expr (built_in_decls[n], 1, arg));
     2728+  s = TYPE_PRECISION (arg_type) - argsize;
     2729+  tmp = fold_convert (result_type, build_call_expr (func, 1, arg));
     2730   leadz = fold_build2 (MINUS_EXPR, result_type,
     2731                       tmp, build_int_cst (result_type, s));
     2732 
     2733   /* Build BIT_SIZE.  */
     2734-  bit_size = build_int_cst (result_type, gfc_integer_kinds[i].bit_size);
     2735+  bit_size = build_int_cst (result_type, argsize);
     2736 
     2737-  /* ??? For some combinations of targets and integer kinds, the condition
     2738-        can be avoided if CLZ_DEFINED_VALUE_AT_ZERO is used.  Later.  */
     2739   cond = fold_build2 (EQ_EXPR, boolean_type_node,
     2740                      arg, build_int_cst (arg_type, 0));
     2741   se->expr = fold_build3 (COND_EXPR, result_type, cond, bit_size, leadz);
     2742@@ -2774,50 +2772,48 @@
     2743   tree result_type;
     2744   tree trailz;
     2745   tree bit_size;
     2746-  int arg_kind;
     2747-  int i, n;
     2748+  tree func;
     2749+  int argsize;
     2750 
     2751   gfc_conv_intrinsic_function_args (se, expr, &arg, 1);
     2752+  argsize = TYPE_PRECISION (TREE_TYPE (arg));
     2753 
     2754-  /* Which variant of __builtin_clz* should we call?  */
     2755-  arg_kind = expr->value.function.actual->expr->ts.kind;
     2756-  i = gfc_validate_kind (BT_INTEGER, arg_kind, false);
     2757-  switch (expr->ts.kind)
     2758+  /* Which variant of __builtin_ctz* should we call?  */
     2759+  if (argsize <= INT_TYPE_SIZE)
     2760     {
     2761-      case 1:
     2762-      case 2:
     2763-      case 4:
     2764-        arg_type = unsigned_type_node;
     2765-       n = BUILT_IN_CTZ;
     2766-       break;
     2767-
     2768-      case 8:
     2769-        arg_type = long_unsigned_type_node;
     2770-       n = BUILT_IN_CTZL;
     2771-       break;
     2772-
     2773-      case 16:
     2774-        arg_type = long_long_unsigned_type_node;
     2775-       n = BUILT_IN_CTZLL;
     2776-       break;
     2777-
     2778-      default:
     2779-        gcc_unreachable ();
     2780+      arg_type = unsigned_type_node;
     2781+      func = built_in_decls[BUILT_IN_CTZ];
     2782+    }
     2783+  else if (argsize <= LONG_TYPE_SIZE)
     2784+    {
     2785+      arg_type = long_unsigned_type_node;
     2786+      func = built_in_decls[BUILT_IN_CTZL];
     2787+    }
     2788+  else if (argsize <= LONG_LONG_TYPE_SIZE)
     2789+    {
     2790+      arg_type = long_long_unsigned_type_node;
     2791+      func = built_in_decls[BUILT_IN_CTZLL];
     2792+    }
     2793+  else
     2794+    {
     2795+      gcc_assert (argsize == 128);
     2796+      arg_type = gfc_build_uint_type (argsize);
     2797+      func = gfor_fndecl_ctz128;
     2798     }
     2799 
     2800-  /* Convert the actual argument to the proper argument type for the built-in
     2801+  /* Convert the actual argument twice: first, to the unsigned type of the
     2802+     same size; then, to the proper argument type for the built-in
     2803      function.  But the return type is of the default INTEGER kind.  */
     2804+  arg = fold_convert (gfc_build_uint_type (argsize), arg);
     2805   arg = fold_convert (arg_type, arg);
     2806   result_type = gfc_get_int_type (gfc_default_integer_kind);
     2807 
     2808   /* Compute TRAILZ for the case i .ne. 0.  */
     2809-  trailz = fold_convert (result_type, build_call_expr (built_in_decls[n], 1, arg));
     2810+  trailz = fold_convert (result_type, build_call_expr (func, 1, arg));
     2811 
     2812   /* Build BIT_SIZE.  */
     2813-  bit_size = build_int_cst (result_type, gfc_integer_kinds[i].bit_size);
     2814+  bit_size = build_int_cst (result_type, argsize);
     2815 
     2816-  /* ??? For some combinations of targets and integer kinds, the condition
     2817-        can be avoided if CTZ_DEFINED_VALUE_AT_ZERO is used.  Later.  */
     2818   cond = fold_build2 (EQ_EXPR, boolean_type_node,
     2819                      arg, build_int_cst (arg_type, 0));
     2820   se->expr = fold_build3 (COND_EXPR, result_type, cond, bit_size, trailz);
     2821@@ -3129,32 +3125,32 @@
    12752822 
    12762823 
     
    13102857       default:
    13112858        gcc_unreachable ();
    1312 @@ -3163,7 +3163,7 @@
     2859@@ -3163,7 +3159,7 @@
    13132860   type = gfc_typenode_for_spec (&expr->ts);
    13142861   gfc_conv_intrinsic_function_args (se, expr, args, 2);
     
    13192866   se->expr = build_call_expr (built_in_decls[nextafter], 2,
    13202867                              fold_convert (type, args[0]), tmp);
     2868diff -Naur gcc-4.4.0.orig/gcc/fortran/trans-stmt.c gcc-4.4.0/gcc/fortran/trans-stmt.c
     2869--- gcc-4.4.0.orig/gcc/fortran/trans-stmt.c     2009-01-27 10:07:54.000000000 -0800
     2870+++ gcc-4.4.0/gcc/fortran/trans-stmt.c  2009-05-10 08:34:55.000000000 -0700
     2871@@ -270,9 +270,11 @@
     2872          gfc_conv_expr_descriptor (&parmse, e, gfc_walk_expr (e));
     2873          gfc_add_block_to_block (&se->pre, &parmse.pre);
     2874 
     2875-         /* If we've got INTENT(INOUT), initialize the array temporary with
     2876-            a copy of the values.  */
     2877-         if (fsym->attr.intent == INTENT_INOUT)
     2878+         /* If we've got INTENT(INOUT) or a derived type with INTENT(OUT),
     2879+            initialize the array temporary with a copy of the values.  */
     2880+         if (fsym->attr.intent == INTENT_INOUT
     2881+               || (fsym->ts.type ==BT_DERIVED
     2882+                     && fsym->attr.intent == INTENT_OUT))
     2883            initial = parmse.expr;
     2884          else
     2885            initial = NULL_TREE;
     2886@@ -332,12 +334,16 @@
     2887 /* Translate the CALL statement.  Builds a call to an F95 subroutine.  */
     2888 
     2889 tree
     2890-gfc_trans_call (gfc_code * code, bool dependency_check)
     2891+gfc_trans_call (gfc_code * code, bool dependency_check,
     2892+               tree mask, tree count1, bool invert)
     2893 {
     2894   gfc_se se;
     2895   gfc_ss * ss;
     2896   int has_alternate_specifier;
     2897   gfc_dep_check check_variable;
     2898+  tree index = NULL_TREE;
     2899+  tree maskexpr = NULL_TREE;
     2900+  tree tmp;
     2901 
     2902   /* A CALL starts a new block because the actual arguments may have to
     2903      be evaluated first.  */
     2904@@ -429,10 +435,31 @@
     2905       gfc_start_scalarized_body (&loop, &body);
     2906       gfc_init_block (&block);
     2907 
     2908+      if (mask && count1)
     2909+       {
     2910+         /* Form the mask expression according to the mask.  */
     2911+         index = count1;
     2912+         maskexpr = gfc_build_array_ref (mask, index, NULL);
     2913+         if (invert)
     2914+           maskexpr = fold_build1 (TRUTH_NOT_EXPR, TREE_TYPE (maskexpr),
     2915+                                   maskexpr);
     2916+       }
     2917+
     2918       /* Add the subroutine call to the block.  */
     2919-      gfc_conv_function_call (&loopse, code->resolved_sym, code->ext.actual,
     2920-                             NULL_TREE);
     2921-      gfc_add_expr_to_block (&loopse.pre, loopse.expr);
     2922+      gfc_conv_function_call (&loopse, code->resolved_sym,
     2923+                             code->ext.actual, NULL_TREE);
     2924+
     2925+      if (mask && count1)
     2926+       {
     2927+         tmp = build3_v (COND_EXPR, maskexpr, loopse.expr,
     2928+                         build_empty_stmt ());
     2929+         gfc_add_expr_to_block (&loopse.pre, tmp);
     2930+         tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type,
     2931+                            count1, gfc_index_one_node);
     2932+         gfc_add_modify (&loopse.pre, count1, tmp);
     2933+       }
     2934+      else
     2935+       gfc_add_expr_to_block (&loopse.pre, loopse.expr);
     2936 
     2937       gfc_add_block_to_block (&block, &loopse.pre);
     2938       gfc_add_block_to_block (&block, &loopse.post);
     2939@@ -2981,7 +3008,7 @@
     2940        /* Explicit subroutine calls are prevented by the frontend but interface
     2941           assignments can legitimately produce them.  */
     2942        case EXEC_ASSIGN_CALL:
     2943-         assign = gfc_trans_call (c, true);
     2944+         assign = gfc_trans_call (c, true, NULL_TREE, NULL_TREE, false);
     2945           tmp = gfc_trans_nested_forall_loop (nested_forall_info, assign, 1);
     2946           gfc_add_expr_to_block (&block, tmp);
     2947           break;
     2948@@ -3176,7 +3203,7 @@
     2949 gfc_trans_where_assign (gfc_expr *expr1, gfc_expr *expr2,
     2950                        tree mask, bool invert,
     2951                         tree count1, tree count2,
     2952-                       gfc_symbol *sym)
     2953+                       gfc_code *cnext)
     2954 {
     2955   gfc_se lse;
     2956   gfc_se rse;
     2957@@ -3190,6 +3217,10 @@
     2958   stmtblock_t body;
     2959   tree index, maskexpr;
     2960 
     2961+  /* A defined assignment. */ 
     2962+  if (cnext && cnext->resolved_sym)
     2963+    return gfc_trans_call (cnext, true, mask, count1, invert);
     2964+
     2965 #if 0
     2966   /* TODO: handle this special case.
     2967      Special case a single function returning an array.  */
     2968@@ -3291,11 +3322,8 @@
     2969     maskexpr = fold_build1 (TRUTH_NOT_EXPR, TREE_TYPE (maskexpr), maskexpr);
     2970 
     2971   /* Use the scalar assignment as is.  */
     2972-  if (sym == NULL)
     2973-    tmp = gfc_trans_scalar_assign (&lse, &rse, expr1->ts,
     2974-                                  loop.temp_ss != NULL, false);
     2975-  else
     2976-    tmp = gfc_conv_operator_assign (&lse, &rse, sym);
     2977+  tmp = gfc_trans_scalar_assign (&lse, &rse, expr1->ts,
     2978+                                loop.temp_ss != NULL, false);
     2979 
     2980   tmp = build3_v (COND_EXPR, maskexpr, tmp, build_empty_stmt ());
     2981 
     2982@@ -3562,7 +3590,7 @@
     2983                       tmp = gfc_trans_where_assign (expr1, expr2,
     2984                                                    cmask, invert,
     2985                                                    count1, count2,
     2986-                                                   cnext->resolved_sym);
     2987+                                                   cnext);
     2988 
     2989                       tmp = gfc_trans_nested_forall_loop (nested_forall_info,
     2990                                                           tmp, 1);
     2991@@ -3580,7 +3608,7 @@
     2992                   tmp = gfc_trans_where_assign (expr1, expr2,
     2993                                                cmask, invert,
     2994                                                count1, count2,
     2995-                                               cnext->resolved_sym);
     2996+                                               cnext);
     2997                   gfc_add_expr_to_block (block, tmp);
     2998 
     2999                 }
     3000diff -Naur gcc-4.4.0.orig/gcc/fortran/trans-stmt.h gcc-4.4.0/gcc/fortran/trans-stmt.h
     3001--- gcc-4.4.0.orig/gcc/fortran/trans-stmt.h     2008-04-05 15:23:27.000000000 -0700
     3002+++ gcc-4.4.0/gcc/fortran/trans-stmt.h  2009-05-10 08:34:55.000000000 -0700
     3003@@ -39,7 +39,7 @@
     3004 tree gfc_trans_entry (gfc_code *);
     3005 tree gfc_trans_pause (gfc_code *);
     3006 tree gfc_trans_stop (gfc_code *);
     3007-tree gfc_trans_call (gfc_code *, bool);
     3008+tree gfc_trans_call (gfc_code *, bool, tree, tree, bool);
     3009 tree gfc_trans_return (gfc_code *);
     3010 tree gfc_trans_if (gfc_code *);
     3011 tree gfc_trans_arithmetic_if (gfc_code *);
     3012diff -Naur gcc-4.4.0.orig/gcc/fortran/trans-types.c gcc-4.4.0/gcc/fortran/trans-types.c
     3013--- gcc-4.4.0.orig/gcc/fortran/trans-types.c    2009-03-30 07:53:17.000000000 -0700
     3014+++ gcc-4.4.0/gcc/fortran/trans-types.c 2009-06-03 12:39:09.000000000 -0700
     3015@@ -595,7 +595,7 @@
     3016   return make_signed_type (mode_precision);
     3017 }
     3018 
     3019-static tree
     3020+tree
     3021 gfc_build_uint_type (int size)
     3022 {
     3023   if (size == CHAR_TYPE_SIZE)
     3024diff -Naur gcc-4.4.0.orig/gcc/fortran/trans-types.h gcc-4.4.0/gcc/fortran/trans-types.h
     3025--- gcc-4.4.0.orig/gcc/fortran/trans-types.h    2008-05-18 15:45:05.000000000 -0700
     3026+++ gcc-4.4.0/gcc/fortran/trans-types.h 2009-06-03 12:39:09.000000000 -0700
     3027@@ -68,6 +68,7 @@
     3028 
     3029 tree gfc_type_for_size (unsigned, int);
     3030 tree gfc_type_for_mode (enum machine_mode, int);
     3031+tree gfc_build_uint_type (int);
     3032 
     3033 tree gfc_get_element_type (tree);
     3034 tree gfc_get_array_type_bounds (tree, int, tree *, tree *, int,
    13213035diff -Naur gcc-4.4.0.orig/gcc/fwprop.c gcc-4.4.0/gcc/fwprop.c
    13223036--- gcc-4.4.0.orig/gcc/fwprop.c 2009-02-20 07:20:38.000000000 -0800
     
    14693183                        if (set_p)
    14703184                          SET_BIT (bmap[bb_index], indx);
     3185diff -Naur gcc-4.4.0.orig/gcc/gimple.h gcc-4.4.0/gcc/gimple.h
     3186--- gcc-4.4.0.orig/gcc/gimple.h 2009-02-20 07:20:38.000000000 -0800
     3187+++ gcc-4.4.0/gcc/gimple.h      2009-05-18 03:13:43.000000000 -0700
     3188@@ -1394,35 +1394,6 @@
     3189   return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
     3190 }
     3191 
     3192-/* Return the type of the main expression computed by STMT.  Return
     3193-   void_type_node if the statement computes nothing.  */
     3194-
     3195-static inline tree
     3196-gimple_expr_type (const_gimple stmt)
     3197-{
     3198-  enum gimple_code code = gimple_code (stmt);
     3199-
     3200-  if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
     3201-    {
     3202-      tree type = TREE_TYPE (gimple_get_lhs (stmt));
     3203-      /* Integral sub-types are never the type of the expression,
     3204-         but they still can be the type of the result as the base
     3205-        type (in which expressions are computed) is trivially
     3206-        convertible to one of its sub-types.  So always return
     3207-        the base type here.  */
     3208-      if (INTEGRAL_TYPE_P (type)
     3209-         && TREE_TYPE (type)
     3210-         /* But only if they are trivially convertible.  */
     3211-         && useless_type_conversion_p (type, TREE_TYPE (type)))
     3212-       type = TREE_TYPE (type);
     3213-      return type;
     3214-    }
     3215-  else if (code == GIMPLE_COND)
     3216-    return boolean_type_node;
     3217-  else
     3218-    return void_type_node;
     3219-}
     3220-
     3221 
     3222 /* Return the tree code for the expression computed by STMT.  This is
     3223    only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN.  For
     3224@@ -4285,6 +4256,55 @@
     3225 }
     3226 
     3227 
     3228+/* Return the type of the main expression computed by STMT.  Return
     3229+   void_type_node if the statement computes nothing.  */
     3230+
     3231+static inline tree
     3232+gimple_expr_type (const_gimple stmt)
     3233+{
     3234+  enum gimple_code code = gimple_code (stmt);
     3235+
     3236+  if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
     3237+    {
     3238+      tree type;
     3239+      /* In general we want to pass out a type that can be substituted
     3240+         for both the RHS and the LHS types if there is a possibly
     3241+        useless conversion involved.  That means returning the
     3242+        original RHS type as far as we can reconstruct it.  */
     3243+      if (code == GIMPLE_CALL)
     3244+       type = gimple_call_return_type (stmt);
     3245+      else
     3246+       switch (gimple_assign_rhs_code (stmt))
     3247+         {
     3248+         case POINTER_PLUS_EXPR:
     3249+           type = TREE_TYPE (gimple_assign_rhs1 (stmt));
     3250+           break;
     3251+
     3252+         default:
     3253+           /* As fallback use the type of the LHS.  */
     3254+           type = TREE_TYPE (gimple_get_lhs (stmt));
     3255+           break;
     3256+         }
     3257+
     3258+      /* Integral sub-types are never the type of the expression,
     3259+         but they still can be the type of the result as the base
     3260+        type (in which expressions are computed) is trivially
     3261+        convertible to one of its sub-types.  So always return
     3262+        the base type here.  */
     3263+      if (INTEGRAL_TYPE_P (type)
     3264+         && TREE_TYPE (type)
     3265+         /* But only if they are trivially convertible.  */
     3266+         && useless_type_conversion_p (type, TREE_TYPE (type)))
     3267+       type = TREE_TYPE (type);
     3268+      return type;
     3269+    }
     3270+  else if (code == GIMPLE_COND)
     3271+    return boolean_type_node;
     3272+  else
     3273+    return void_type_node;
     3274+}
     3275+
     3276+
     3277 /* Return a new iterator pointing to GIMPLE_SEQ's first statement.  */
     3278 
     3279 static inline gimple_stmt_iterator
     3280diff -Naur gcc-4.4.0.orig/gcc/gimplify.c gcc-4.4.0/gcc/gimplify.c
     3281--- gcc-4.4.0.orig/gcc/gimplify.c       2009-03-11 18:02:16.000000000 -0700
     3282+++ gcc-4.4.0/gcc/gimplify.c    2009-05-12 09:19:29.000000000 -0700
     3283@@ -1628,20 +1628,63 @@
     3284        }
     3285       len = i;
     3286 
     3287+      if (!VEC_empty (tree, labels))
     3288+       sort_case_labels (labels);
     3289+
     3290       if (!default_case)
     3291        {
     3292-         gimple new_default;
     3293+         tree type = TREE_TYPE (switch_expr);
     3294 
     3295          /* If the switch has no default label, add one, so that we jump
     3296-            around the switch body.  */
     3297-         default_case = build3 (CASE_LABEL_EXPR, void_type_node, NULL_TREE,
     3298-                                NULL_TREE, create_artificial_label ());
     3299-         new_default = gimple_build_label (CASE_LABEL (default_case));
     3300-         gimplify_seq_add_stmt (&switch_body_seq, new_default);
     3301-       }
     3302+            around the switch body.  If the labels already cover the whole
     3303+            range of type, add the default label pointing to one of the
     3304+            existing labels.  */
     3305+         if (type == void_type_node)
     3306+           type = TREE_TYPE (SWITCH_COND (switch_expr));
     3307+         if (len
     3308+             && INTEGRAL_TYPE_P (type)
     3309+             && TYPE_MIN_VALUE (type)
     3310+             && TYPE_MAX_VALUE (type)
     3311+             && tree_int_cst_equal (CASE_LOW (VEC_index (tree, labels, 0)),
     3312+                                    TYPE_MIN_VALUE (type)))
     3313+           {
     3314+             tree low, high = CASE_HIGH (VEC_index (tree, labels, len - 1));
     3315+             if (!high)
     3316+               high = CASE_LOW (VEC_index (tree, labels, len - 1));
     3317+             if (tree_int_cst_equal (high, TYPE_MAX_VALUE (type)))
     3318+               {
     3319+                 for (i = 1; i < len; i++)
     3320+                   {
     3321+                     high = CASE_LOW (VEC_index (tree, labels, i));
     3322+                     low = CASE_HIGH (VEC_index (tree, labels, i - 1));
     3323+                     if (!low)
     3324+                       low = CASE_LOW (VEC_index (tree, labels, i - 1));
     3325+                     if ((TREE_INT_CST_LOW (low) + 1
     3326+                          != TREE_INT_CST_LOW (high))
     3327+                         || (TREE_INT_CST_HIGH (low)
     3328+                             + (TREE_INT_CST_LOW (high) == 0)
     3329+                             != TREE_INT_CST_HIGH (high)))
     3330+                       break;
     3331+                   }
     3332+                 if (i == len)
     3333+                   default_case = build3 (CASE_LABEL_EXPR, void_type_node,
     3334+                                          NULL_TREE, NULL_TREE,
     3335+                                          CASE_LABEL (VEC_index (tree,
     3336+                                                                 labels, 0)));
     3337+               }
     3338+           }
     3339 
     3340-      if (!VEC_empty (tree, labels))
     3341-       sort_case_labels (labels);
     3342+         if (!default_case)
     3343+           {
     3344+             gimple new_default;
     3345+
     3346+             default_case = build3 (CASE_LABEL_EXPR, void_type_node,
     3347+                                    NULL_TREE, NULL_TREE,
     3348+                                    create_artificial_label ());
     3349+             new_default = gimple_build_label (CASE_LABEL (default_case));
     3350+             gimplify_seq_add_stmt (&switch_body_seq, new_default);
     3351+           }
     3352+       }
     3353 
     3354       gimple_switch = gimple_build_switch_vec (SWITCH_COND (switch_expr),
     3355                                                default_case, labels);
     3356diff -Naur gcc-4.4.0.orig/gcc/ipa-utils.h gcc-4.4.0/gcc/ipa-utils.h
     3357--- gcc-4.4.0.orig/gcc/ipa-utils.h      2007-07-26 01:37:01.000000000 -0700
     3358+++ gcc-4.4.0/gcc/ipa-utils.h   2009-05-14 08:52:58.000000000 -0700
     3359@@ -23,9 +23,6 @@
     3360 #include "tree.h"
     3361 #include "cgraph.h"
     3362 
     3363-/* Used for parsing attributes of asm code.  */
     3364-extern tree memory_identifier_string;
     3365-
     3366 struct ipa_dfs_info {
     3367   int dfn_number;
     3368   int low_link;
    14713369diff -Naur gcc-4.4.0.orig/gcc/ira-color.c gcc-4.4.0/gcc/ira-color.c
    14723370--- gcc-4.4.0.orig/gcc/ira-color.c      2009-02-20 07:20:38.000000000 -0800
     
    15323430diff -Naur gcc-4.4.0.orig/gcc/ira-conflicts.c gcc-4.4.0/gcc/ira-conflicts.c
    15333431--- gcc-4.4.0.orig/gcc/ira-conflicts.c  2009-03-12 07:39:55.000000000 -0700
    1534 +++ gcc-4.4.0/gcc/ira-conflicts.c       2009-04-22 13:16:13.000000000 -0700
     3432+++ gcc-4.4.0/gcc/ira-conflicts.c       2009-05-03 12:40:35.000000000 -0700
    15353433@@ -411,9 +411,9 @@
    15363434     /* Can not be tied.  It is not in the cover class.  */
     
    15453443     {
    15463444       ira_allocate_and_set_costs
     3445@@ -806,7 +806,7 @@
     3446       if ((! flag_caller_saves && ALLOCNO_CALLS_CROSSED_NUM (a) != 0)
     3447          /* For debugging purposes don't put user defined variables in
     3448             callee-clobbered registers.  */
     3449-         || (optimize <= 1
     3450+         || (optimize == 0
     3451              && (attrs = REG_ATTRS (regno_reg_rtx [ALLOCNO_REGNO (a)])) != NULL
     3452              && (decl = attrs->decl) != NULL
     3453              && VAR_OR_FUNCTION_DECL_P (decl)
    15473454diff -Naur gcc-4.4.0.orig/gcc/ira-costs.c gcc-4.4.0/gcc/ira-costs.c
    15483455--- gcc-4.4.0.orig/gcc/ira-costs.c      2008-12-18 05:49:47.000000000 -0800
     
    17873694                (&ALLOCNO_CONFLICT_HARD_REG_COSTS (operand_a), cover_class, 0);
    17883695              ALLOCNO_CONFLICT_HARD_REG_COSTS (operand_a)
    1789 diff -Naur gcc-4.4.0.orig/gcc/po/ChangeLog gcc-4.4.0/gcc/po/ChangeLog
    1790 --- gcc-4.4.0.orig/gcc/po/ChangeLog     2009-04-21 01:44:44.000000000 -0700
    1791 +++ gcc-4.4.0/gcc/po/ChangeLog  2009-04-22 09:34:22.000000000 -0700
    1792 @@ -1,3 +1,12 @@
    1793 +2009-04-22  Joseph Myers  <joseph@codesourcery.com>
    1794 +
    1795 +       * gcc.pot: Regenerate.
    1796 +
    1797 +2009-04-22  Joseph Myers  <joseph@codesourcery.com>
    1798 +
    1799 +       * exgettext: Also look for */*/config-lang.in to find language
    1800 +       subdirectories.
    1801 +
    1802  2009-04-21  Release Manager
    1803  
    1804         * GCC 4.4.0 released.
     3696diff -Naur gcc-4.4.0.orig/gcc/Makefile.in gcc-4.4.0/gcc/Makefile.in
     3697--- gcc-4.4.0.orig/gcc/Makefile.in      2009-03-25 05:00:32.000000000 -0700
     3698+++ gcc-4.4.0/gcc/Makefile.in   2009-05-21 16:17:37.000000000 -0700
     3699@@ -2785,7 +2785,8 @@
     3700    value-prof.h $(TREE_INLINE_H) $(TARGET_H)
     3701 cfgrtl.o : cfgrtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
     3702    $(FLAGS_H) insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h \
     3703-   output.h $(TOPLEV_H) $(FUNCTION_H) except.h $(TM_P_H) insn-config.h $(EXPR_H) \
     3704+   output.h $(TOPLEV_H) $(FUNCTION_H) except.h $(TM_P_H) $(INSN_ATTR_H) \
     3705+   insn-config.h $(EXPR_H) \
     3706    $(CFGLAYOUT_H) $(CFGLOOP_H) $(OBSTACK_H) $(TARGET_H) $(TREE_H) \
     3707    tree-pass.h $(DF_H) $(GGC_H)
     3708 cfganal.o : cfganal.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
    18053709diff -Naur gcc-4.4.0.orig/gcc/po/exgettext gcc-4.4.0/gcc/po/exgettext
    18063710--- gcc-4.4.0.orig/gcc/po/exgettext     2009-04-09 16:23:07.000000000 -0700
     
    1306014964+msgid "%<-gnat%> misspelled as %<-gant%>"
    1306114965+msgstr ""
     14966diff -Naur gcc-4.4.0.orig/gcc/reg-stack.c gcc-4.4.0/gcc/reg-stack.c
     14967--- gcc-4.4.0.orig/gcc/reg-stack.c      2009-02-20 07:20:38.000000000 -0800
     14968+++ gcc-4.4.0/gcc/reg-stack.c   2009-05-22 11:59:30.000000000 -0700
     14969@@ -1371,21 +1371,23 @@
     14970 
     14971            if (pat != PATTERN (insn))
     14972              {
     14973-               /* The fix_truncdi_1 pattern wants to be able to allocate
     14974-                  its own scratch register.  It does this by clobbering
     14975-                  an fp reg so that it is assured of an empty reg-stack
     14976-                  register.  If the register is live, kill it now.
     14977-                  Remove the DEAD/UNUSED note so we don't try to kill it
     14978-                  later too.  */
     14979+               /* The fix_truncdi_1 pattern wants to be able to
     14980+                  allocate its own scratch register.  It does this by
     14981+                  clobbering an fp reg so that it is assured of an
     14982+                  empty reg-stack register.  If the register is live,
     14983+                  kill it now.  Remove the DEAD/UNUSED note so we
     14984+                  don't try to kill it later too.
     14985+
     14986+                  In reality the UNUSED note can be absent in some
     14987+                  complicated cases when the register is reused for
     14988+                  partially set variable.  */
     14989 
     14990                if (note)
     14991                  emit_pop_insn (insn, regstack, *dest, EMIT_BEFORE);
     14992                else
     14993-                 {
     14994-                   note = find_reg_note (insn, REG_UNUSED, *dest);
     14995-                   gcc_assert (note);
     14996-                 }
     14997-               remove_note (insn, note);
     14998+                 note = find_reg_note (insn, REG_UNUSED, *dest);
     14999+               if (note)
     15000+                 remove_note (insn, note);
     15001                replace_reg (dest, FIRST_STACK_REG + 1);
     15002              }
     15003            else
     15004diff -Naur gcc-4.4.0.orig/gcc/resource.c gcc-4.4.0/gcc/resource.c
     15005--- gcc-4.4.0.orig/gcc/resource.c       2009-02-20 07:20:38.000000000 -0800
     15006+++ gcc-4.4.0/gcc/resource.c    2009-05-21 16:17:37.000000000 -0700
     15007@@ -135,8 +135,6 @@
     15008 static int
     15009 find_basic_block (rtx insn, int search_limit)
     15010 {
     15011-  basic_block bb;
     15012-
     15013   /* Scan backwards to the previous BARRIER.  Then see if we can find a
     15014      label that starts a basic block.  Return the basic block number.  */
     15015   for (insn = prev_nonnote_insn (insn);
     15016@@ -157,11 +155,8 @@
     15017   for (insn = next_nonnote_insn (insn);
     15018        insn && LABEL_P (insn);
     15019        insn = next_nonnote_insn (insn))
     15020-    {
     15021-      FOR_EACH_BB (bb)
     15022-       if (insn == BB_HEAD (bb))
     15023-         return bb->index;
     15024-    }
     15025+    if (BLOCK_FOR_INSN (insn))
     15026+      return BLOCK_FOR_INSN (insn)->index;
     15027 
     15028   return -1;
     15029 }
     15030@@ -848,13 +843,12 @@
     15031    (with no intervening active insns) to see if any of them start a basic
     15032    block.  If we hit the start of the function first, we use block 0.
     15033 
     15034-   Once we have found a basic block and a corresponding first insns, we can
     15035-   accurately compute the live status from basic_block_live_regs and
     15036-   reg_renumber.  (By starting at a label following a BARRIER, we are immune
     15037-   to actions taken by reload and jump.)  Then we scan all insns between
     15038-   that point and our target.  For each CLOBBER (or for call-clobbered regs
     15039-   when we pass a CALL_INSN), mark the appropriate registers are dead.  For
     15040-   a SET, mark them as live.
     15041+   Once we have found a basic block and a corresponding first insn, we can
     15042+   accurately compute the live status (by starting at a label following a
     15043+   BARRIER, we are immune to actions taken by reload and jump.)  Then we
     15044+   scan all insns between that point and our target.  For each CLOBBER (or
     15045+   for call-clobbered regs when we pass a CALL_INSN), mark the appropriate
     15046+   registers are dead.  For a SET, mark them as live.
     15047 
     15048    We have to be careful when using REG_DEAD notes because they are not
     15049    updated by such things as find_equiv_reg.  So keep track of registers
     15050@@ -954,13 +948,10 @@
     15051      TARGET.  Otherwise, we must assume everything is live.  */
     15052   if (b != -1)
     15053     {
     15054-      regset regs_live = DF_LR_IN (BASIC_BLOCK (b));
     15055+      regset regs_live = df_get_live_in (BASIC_BLOCK (b));
     15056       rtx start_insn, stop_insn;
     15057 
     15058-      /* Compute hard regs live at start of block -- this is the real hard regs
     15059-        marked live, plus live pseudo regs that have been renumbered to
     15060-        hard regs.  */
     15061-
     15062+      /* Compute hard regs live at start of block.  */
     15063       REG_SET_TO_HARD_REG_SET (current_live_regs, regs_live);
     15064 
     15065       /* Get starting and ending insn, handling the case where each might
     15066@@ -1046,10 +1037,24 @@
     15067 
     15068          else if (LABEL_P (real_insn))
     15069            {
     15070+             basic_block bb;
     15071+
     15072              /* A label clobbers the pending dead registers since neither
     15073                 reload nor jump will propagate a value across a label.  */
     15074              AND_COMPL_HARD_REG_SET (current_live_regs, pending_dead_regs);
     15075              CLEAR_HARD_REG_SET (pending_dead_regs);
     15076+
     15077+             /* We must conservatively assume that all registers that used
     15078+                to be live here still are.  The fallthrough edge may have
     15079+                left a live register uninitialized.  */
     15080+             bb = BLOCK_FOR_INSN (real_insn);
     15081+             if (bb)
     15082+               {
     15083+                 HARD_REG_SET extra_live;
     15084+
     15085+                 REG_SET_TO_HARD_REG_SET (extra_live, df_get_live_in (bb));
     15086+                 IOR_HARD_REG_SET (current_live_regs, extra_live);
     15087+               }
     15088            }
     15089 
     15090          /* The beginning of the epilogue corresponds to the end of the
     15091@@ -1121,6 +1126,7 @@
     15092 init_resource_info (rtx epilogue_insn)
     15093 {
     15094   int i;
     15095+  basic_block bb;
     15096 
     15097   /* Indicate what resources are required to be valid at the end of the current
     15098      function.  The condition code never is and memory always is.  If the
     15099@@ -1189,6 +1195,11 @@
     15100   /* Allocate and initialize the tables used by mark_target_live_regs.  */
     15101   target_hash_table = XCNEWVEC (struct target_info *, TARGET_HASH_PRIME);
     15102   bb_ticks = XCNEWVEC (int, last_basic_block);
     15103+
     15104+  /* Set the BLOCK_FOR_INSN of each label that starts a basic block.  */
     15105+  FOR_EACH_BB (bb)
     15106+    if (LABEL_P (BB_HEAD (bb)))
     15107+      BLOCK_FOR_INSN (BB_HEAD (bb)) = bb;
     15108 }
     15109 
     15110
     15111 /* Free up the resources allocated to mark_target_live_regs ().  This
     15112@@ -1197,6 +1208,8 @@
     15113 void
     15114 free_resource_info (void)
     15115 {
     15116+  basic_block bb;
     15117+
     15118   if (target_hash_table != NULL)
     15119     {
     15120       int i;
     15121@@ -1222,6 +1235,10 @@
     15122       free (bb_ticks);
     15123       bb_ticks = NULL;
     15124     }
     15125+
     15126+  FOR_EACH_BB (bb)
     15127+    if (LABEL_P (BB_HEAD (bb)))
     15128+      BLOCK_FOR_INSN (BB_HEAD (bb)) = NULL;
     15129 }
     15130 
     15131
     15132 /* Clear any hashed information that we have stored for INSN.  */
    1306215133diff -Naur gcc-4.4.0.orig/gcc/rtl.h gcc-4.4.0/gcc/rtl.h
    1306315134--- gcc-4.4.0.orig/gcc/rtl.h    2009-03-18 10:04:26.000000000 -0700
     
    1308315154       goto restart;
    1308415155 
    13085 diff -Naur gcc-4.4.0.orig/gcc/testsuite/ChangeLog gcc-4.4.0/gcc/testsuite/ChangeLog
    13086 --- gcc-4.4.0.orig/gcc/testsuite/ChangeLog      2009-04-21 01:44:06.000000000 -0700
    13087 +++ gcc-4.4.0/gcc/testsuite/ChangeLog   2009-04-29 08:54:18.000000000 -0700
    13088 @@ -1,3 +1,183 @@
    13089 +2009-04-29  H.J. Lu  <hongjiu.lu@intel.com>
    13090 +
    13091 +       Backport from mainline:
    13092 +       2009-04-29  Richard Guenther  <rguenther@suse.de>
    13093 +
    13094 +       PR middle-end/39937
    13095 +       * gcc.c-torture/compile/pr39937.c: New testcase.
    13096 +
    13097 +2009-04-29  H.J. Lu  <hongjiu.lu@intel.com>
    13098 +
    13099 +       Backport from mainline:
    13100 +       2009-04-29  Richard Guenther  <rguenther@suse.de>
    13101 +
    13102 +       PR tree-optimization/39941
    13103 +       * gcc.c-torture/compile/pr39941.c: New testcase.
    13104 +
    13105 +       2009-04-29  Anmol P. Paralkar  <anmol@freescale.com>
    13106 +
    13107 +       PR target/39565
    13108 +       * gcc.dg/pr39565.c: New testcase.
    13109 +
    13110 +       2009-04-28  Richard Guenther  <rguenther@suse.de>
    13111 +
    13112 +       PR middle-end/39937
    13113 +       * gfortran.fortran-torture/compile/pr39937.f: New testcase.
    13114 +
    13115 +2009-04-28  Jing Yu  <jingyu@google.com>
    13116 +
    13117 +       Backport from mainline:
    13118 +       2009-04-28  Jing Yu  <jingyu@google.com>
    13119 +
    13120 +       PR testsuite/39790
    13121 +       * lib/target-supports.exp (check_effective_target_tls): Remove
    13122 +       comment of caching.
    13123 +       (check_effective_target_tls_native): Likewise.
    13124 +       (check_effective_target_tls_runtime): Likewise.
    13125 +       * gcc.dg/tls/alias-1.c (dg-require-effective-target): Change target
    13126 +       tls to tls_runtime.
    13127 +       * gcc.dg/tls/opt-2.c: Add dg-require-effective-target tls_runtime.
    13128 +
    13129 +2009-04-28  Michael Meissner  <meissner@linux.vnet.ibm.com>
    13130 +
    13131 +       Backport from mainline:
    13132 +       PR testsuite/39769
    13133 +       * gcc.dg/vmx/3a-04.c (test): Don't rely on floating point equality
    13134 +       for testing the results of estimate instructions.
    13135 +       * gcc.dg/vmx/3a-04m.c (test): Ditto.
    13136 +       * gcc.dg/vmx/3a-05.c (test): Ditto.
    13137 +
    13138 +2009-04-28  H.J. Lu  <hongjiu.lu@intel.com>
    13139 +
    13140 +       Backport from mainline:
    13141 +       2009-04-27  H.J. Lu  <hongjiu.lu@intel.com>
    13142 +
    13143 +       PR target/39903
    13144 +       * gcc.dg/torture/pr39903-1.c: New.
    13145 +       * gcc.dg/torture/pr39903-2.c: Likewise.
    13146 +
    13147 +2009-04-27  Jakub Jelinek  <jakub@redhat.com>
    13148 +
    13149 +       PR rtl-optimization/39794
    13150 +       * gcc.dg/pr39794.c: New test.
    13151 +
    13152 +2009-04-26  Jakub Jelinek  <jakub@redhat.com>
    13153 +
    13154 +       PR inline-asm/39543
    13155 +       * gcc.target/i386/pr39543-1.c: New test.
    13156 +       * gcc.target/i386/pr39543-2.c: New test.
    13157 +       * gcc.target/i386/pr39543-3.c: New test.
    13158 +
    13159 +       PR c/39889
    13160 +       * gcc.dg/Wunused-value-3.c: New test.
    13161 +
    13162 +2009-04-24  Paolo Bonzini  <bonzini@gnu.org>
    13163 +
    13164 +       PR middle-end/39867
    13165 +       * gcc.dg/pr39867.c: New.
    13166 +
    13167 +2009-04-23  Dodji Seketeli  <dodji@redhat.com>
    13168 +
    13169 +       PR c++/38228
    13170 +       * g++.dg/expr/bound-mem-fun.C: New test.
    13171 +
    13172 +2009-04-22  Eric Botcazou  <ebotcazou@adacore.com>
    13173 +
    13174 +       * gnat.dg/enum2.adb: New test.
    13175 +       * gnat.dg/enum2_pkg.ads: New helper.
    13176 +
    13177 +2009-04-22  Jakub Jelinek  <jakub@redhat.com>
    13178 +
    13179 +       PR c/39855
    13180 +       * gcc.dg/torture/pr39855.c: New test.
    13181 +
    13182 +2009-04-22  Richard Guenther  <rguenther@suse.de>
    13183 +
    13184 +       PR tree-optimization/39824
    13185 +       * gcc.c-torture/compile/pr39824.c: New testcase.
    13186 +
    13187 +2009-04-22  Dodji Seketeli  <dodji@redhat.com>
    13188 +
    13189 +       PR c++/39639
    13190 +       * g++.dg/cpp0x/pr39639.C: New test.
    13191 +
    13192 +2009-04-22  H.J. Lu  <hongjiu.lu@intel.com>
    13193 +
    13194 +       Backport from mainline:
    13195 +       2009-04-22  Richard Guenther  <rguenther@suse.de>
    13196 +
    13197 +       PR tree-optimization/39845
    13198 +       * gcc.c-torture/compile/pr39845.c: New testcase.
    13199 +
    13200 +       2009-04-21  Richard Guenther  <rguenther@suse.de>
    13201 +
    13202 +       PR middle-end/39829
    13203 +       * gcc.dg/torture/pr39829.c: New testcase.
    13204 +
    13205 +2009-04-12  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
    13206 +
    13207 +       Backport from mainline:
    13208 +
    13209 +       2009-04-17  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
    13210 +
    13211 +       * gfortran.fortran-torture/execute/getarg_1.x: New file.
    13212 +
    13213 +       2009-04-17  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
    13214 +
    13215 +       * gfortran.dg/vect/pr39318.f90: Guard with "target fopenmp".
    13216 +
    13217 +       2009-04-17  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
    13218 +
    13219 +       * gfortran.dg/chmod_1.f90: Disable on spu-*-* targets.
    13220 +       * gfortran.dg/chmod_2.f90: Likewise.
    13221 +       * gfortran.dg/chmod_3.f90: Likewise.
    13222 +       * gfortran.dg/open_errors.f90: Likewise.
    13223 +       * gfortran.dg/stat_1.f90: Likewise.
    13224 +       * gfortran.dg/stat_2.f90: Likewise.
    13225 +
    13226 +       2009-04-17  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
    13227 +
    13228 +       * gfortran.fortran-torture/execute/nan_inf_fmt.x: Skip on spu-*-*.
    13229 +       * gfortran.fortran-torture/execute/intrinsic_nearest.x: Likewise.
    13230 +       * gfortran.fortran-torture/execute/intrinsic_set_exponent.x: Likewise.
    13231 +       * gfortran.dg/nearest_1.f90: Likewise.
    13232 +       * gfortran.dg/nearest_3.f90: Likewise.
    13233 +       * gfortran.dg/isnan_1.f90: Likewise.
    13234 +       * gfortran.dg/isnan_2.f90: Likewise.
    13235 +       * gfortran.dg/nan_1.f90: Likewise.
    13236 +       * gfortran.dg/nan_2.f90: Likewise.
    13237 +       * gfortran.dg/nan_3.f90: Likewise.
    13238 +       * gfortran.dg/nan_4.f90: Likewise.
    13239 +       * gfortran.dg/module_nan.f90: Likewise.
    13240 +       * gfortran.dg/int_conv_2.f90: Likewise.
    13241 +       * gfortran.dg/init_flag_3.f90: Likewise.
    13242 +       * gfortran.dg/namelist_42.f90: Likewise.
    13243 +       * gfortran.dg/namelist_43.f90: Likewise.
    13244 +       * gfortran.dg/real_const_3.f90: Likewise.
    13245 +       * gfortran.dg/transfer_simplify_1.f90: Likewise.
    13246 +
    13247 +       * gfortran.dg/default_format_1.f90: XFAIL on spu-*-*.
    13248 +       * gfortran.dg/default_format_denormal_1.f90: XFAIL on spu-*-*.
    13249 +       * gfortran.dg/scalar_mask_2.f90: XFAIL on spu-*-*.
    13250 +       * gfortran.dg/integer_exponentiation_3.F90: XFAIL on spu-*-*.
    13251 +       * gfortran.dg/integer_exponentiation_5.F90: XFAIL on spu-*-*.
    13252 +
    13253 +       * gfortran.dg/elemental_subroutine_1.f90: Relax "epsilon" check.
    13254 +       * gfortran.dg/gamma_5.f90: Likewise.
    13255 +
    13256 +       2009-04-17  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
    13257 +
    13258 +       * lib/gcc-dg.exp (gcc-dg-prune): Make linker message check
    13259 +       less strict so it also works with auto-overlay support.
    13260 +       * lib/gcc-defs.exp (${tool}_check_unsupported_p): Add check
    13261 +       for "exceeds local store" linker errors on the SPU.
    13262 +
    13263 +       * lib/gfortran.exp: Include target-supports.exp.
    13264 +       (gfortran_init): On SPU targets where automatic overlay support
    13265 +       is available, use it to build all Fortran test cases.
    13266 +
    13267 +       * gfortran.dg/pr20257.f90: Skip on spu-*-* targets.
    13268 +
    13269  2009-04-21  Release Manager
    13270  
    13271         * GCC 4.4.0 released.
     15156diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/20000211-1.c gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/20000211-1.c
     15157--- gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/20000211-1.c     2000-02-11 11:36:25.000000000 -0800
     15158+++ gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/20000211-1.c  2009-05-28 02:19:37.000000000 -0700
     15159@@ -1,4 +1,4 @@
     15160-typedef long unsigned int size_t;
     15161+typedef __SIZE_TYPE__ size_t;
     15162 typedef unsigned char Bufbyte;
     15163 typedef int Bytecount;
     15164 typedef int Charcount;
     15165diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/20010328-1.c gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/20010328-1.c
     15166--- gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/20010328-1.c     2001-03-28 09:46:52.000000000 -0800
     15167+++ gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/20010328-1.c  2009-05-28 02:19:37.000000000 -0700
     15168@@ -1,4 +1,4 @@
     15169-typedef unsigned int size_t;
     15170+typedef __SIZE_TYPE__ size_t;
     15171 typedef unsigned int __u_int;
     15172 typedef unsigned long __u_long;
     15173 
     15174diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/20030320-1.c gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/20030320-1.c
     15175--- gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/20030320-1.c     2003-03-20 16:13:41.000000000 -0800
     15176+++ gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/20030320-1.c  2009-05-28 02:19:37.000000000 -0700
     15177@@ -2,7 +2,7 @@
     15178    conditional returns without updating dominance info.
     15179    Extracted from glibc's dl-load.c.  */
     15180 
     15181-typedef unsigned long size_t;
     15182+typedef __SIZE_TYPE__ size_t;
     15183 
     15184 static size_t
     15185 is_dst (const char *start, const char *name, const char *str,
     15186diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/20030405-1.c gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/20030405-1.c
     15187--- gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/20030405-1.c     2004-05-12 23:41:07.000000000 -0700
     15188+++ gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/20030405-1.c  2009-05-28 02:19:37.000000000 -0700
     15189@@ -6,7 +6,7 @@
     15190    and when the PHI node at the end of the while() is visited the first
     15191    time, CCP will try to assign it a value of UNDEFINED, but the default
     15192    value for *str is a constant.  */
     15193-typedef        unsigned int size_t;
     15194+typedef        __SIZE_TYPE__ size_t;
     15195 size_t strlength (const char * const);
     15196 char foo();
     15197 
     15198diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/20030902-1.c gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/20030902-1.c
     15199--- gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/20030902-1.c     2004-05-12 23:41:07.000000000 -0700
     15200+++ gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/20030902-1.c  2009-05-28 02:19:37.000000000 -0700
     15201@@ -1,4 +1,4 @@
     15202-typedef unsigned int size_t;
     15203+typedef __SIZE_TYPE__ size_t;
     15204 typedef unsigned long int reg_syntax_t;
     15205 struct re_pattern_buffer
     15206 {
     15207diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/20060202-1.c gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/20060202-1.c
     15208--- gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/20060202-1.c     2006-02-02 16:24:50.000000000 -0800
     15209+++ gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/20060202-1.c  2009-05-28 02:19:37.000000000 -0700
     15210@@ -1,4 +1,4 @@
     15211-typedef unsigned int size_t;
     15212+typedef __SIZE_TYPE__ size_t;
     15213 typedef const struct objc_selector
     15214 {
     15215   void *sel_id;
     15216diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/20080613-1.c gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/20080613-1.c
     15217--- gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/20080613-1.c     2008-06-13 03:20:57.000000000 -0700
     15218+++ gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/20080613-1.c  2009-05-28 02:19:37.000000000 -0700
     15219@@ -1,7 +1,7 @@
     15220 /* PR middle-end/36520 */
     15221 /* Testcase by Richard Guenther <rguenth@gcc.gnu.org> */
     15222 
     15223-typedef long unsigned int size_t;
     15224+typedef __SIZE_TYPE__ size_t;
     15225 typedef unsigned short int sa_family_t;
     15226 struct cmsghdr   {
     15227     size_t cmsg_len;
     15228diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/20090519-1.c gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/20090519-1.c
     15229--- gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/20090519-1.c     1969-12-31 16:00:00.000000000 -0800
     15230+++ gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/20090519-1.c  2009-05-19 04:54:16.000000000 -0700
     15231@@ -0,0 +1,11 @@
     15232+typedef struct { int licensed;  } __pmPDUInfo;
     15233+void __pmDecodeXtendError (int *);
     15234+void do_handshake(void)
     15235+{
     15236+  __pmPDUInfo *pduinfo;
     15237+  int challenge;
     15238+  __pmDecodeXtendError(&challenge);
     15239+  pduinfo = (__pmPDUInfo *)&challenge;
     15240+  *pduinfo = *pduinfo;
     15241+}
     15242+
     15243diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/920428-2.c gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/920428-2.c
     15244--- gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/920428-2.c       1998-12-16 14:24:51.000000000 -0800
     15245+++ gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/920428-2.c    2009-05-28 02:19:37.000000000 -0700
     15246@@ -41,7 +41,7 @@
     15247  short _flag;
     15248  char _file;
     15249 } _iob[];
     15250-typedef unsigned long size_t;
     15251+typedef __SIZE_TYPE__ size_t;
     15252 typedef char *va_list;
     15253 struct _iobuf *fopen(const char *filename, const char *type);
     15254 struct _iobuf *freopen(const char *filename, const char *type, struct _iobuf *stream);
     15255diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/980329-1.c gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/980329-1.c
     15256--- gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/980329-1.c       1998-12-16 14:24:51.000000000 -0800
     15257+++ gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/980329-1.c    2009-05-28 02:19:37.000000000 -0700
     15258@@ -1,4 +1,4 @@
     15259-typedef unsigned long int size_t;
     15260+typedef __SIZE_TYPE__ size_t;
     15261 struct re_pattern_buffer
     15262   {
     15263     unsigned char *buffer;
     15264diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/980816-1.c gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/980816-1.c
     15265--- gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/980816-1.c       1998-12-16 14:24:51.000000000 -0800
     15266+++ gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/980816-1.c    2009-05-28 02:19:37.000000000 -0700
     15267@@ -1,4 +1,4 @@
     15268-typedef unsigned int size_t;
     15269+typedef __SIZE_TYPE__ size_t;
     15270 typedef void *XtPointer;
     15271 
     15272 typedef struct _WidgetRec *Widget;
     15273diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr32584.c gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr32584.c
     15274--- gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr32584.c        2007-07-02 11:27:46.000000000 -0700
     15275+++ gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr32584.c     2009-05-28 02:19:37.000000000 -0700
     15276@@ -1,5 +1,8 @@
     15277-typedef long unsigned int size_t;
     15278-typedef long int __ssize_t;
     15279+typedef __SIZE_TYPE__ size_t;
     15280+/* Kludge */
     15281+#define unsigned
     15282+typedef __SIZE_TYPE__ __ssize_t;
     15283+#undef unsigned
     15284 typedef struct
     15285 {
     15286 } __mbstate_t;
     15287diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr33173.c gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr33173.c
     15288--- gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr33173.c        2007-08-27 07:18:36.000000000 -0700
     15289+++ gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr33173.c     2009-05-28 02:19:37.000000000 -0700
     15290@@ -1,4 +1,4 @@
     15291-typedef long unsigned int size_t;
     15292+typedef __SIZE_TYPE__ size_t;
     15293 typedef struct
     15294 {
     15295 }
     15296diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr33382.c gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr33382.c
     15297--- gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr33382.c        2007-09-12 01:07:12.000000000 -0700
     15298+++ gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr33382.c     2009-05-28 02:19:37.000000000 -0700
     15299@@ -1,4 +1,4 @@
     15300-typedef unsigned int size_t;
     15301+typedef __SIZE_TYPE__ size_t;
     15302 typedef struct {
     15303     int disable;
     15304     char *searchconfig[];
     15305diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr34334.c gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr34334.c
     15306--- gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr34334.c        2007-12-04 09:20:34.000000000 -0800
     15307+++ gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr34334.c     2009-05-28 02:19:37.000000000 -0700
     15308@@ -1,4 +1,4 @@
     15309-typedef unsigned int size_t;
     15310+__extension__ typedef __SIZE_TYPE__ size_t;
     15311 __extension__ typedef long long int __quad_t;
     15312 __extension__ typedef unsigned int __mode_t;
     15313 __extension__ typedef __quad_t __off64_t;
     15314diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr34688.c gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr34688.c
     15315--- gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr34688.c        2008-01-26 15:08:54.000000000 -0800
     15316+++ gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr34688.c     2009-05-28 02:19:37.000000000 -0700
     15317@@ -1,4 +1,4 @@
     15318-typedef unsigned int size_t;
     15319+typedef __SIZE_TYPE__ size_t;
     15320          typedef struct {
     15321         }
     15322          HashTable;
     15323diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr35043.c gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr35043.c
     15324--- gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr35043.c        2008-02-04 05:30:00.000000000 -0800
     15325+++ gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr35043.c     2009-05-28 02:19:37.000000000 -0700
     15326@@ -1,4 +1,4 @@
     15327-typedef long unsigned int size_t;
     15328+typedef __SIZE_TYPE__ size_t;
     15329 typedef struct   {
     15330       long double dat[2];
     15331 } gsl_complex_long_double;
     15332diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr37669.c gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr37669.c
     15333--- gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr37669.c        2008-09-29 14:23:52.000000000 -0700
     15334+++ gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr37669.c     2009-05-28 02:19:37.000000000 -0700
     15335@@ -1,6 +1,6 @@
     15336 /* This testcase used to fail because a miscompiled execute_fold_all_builtins. */
     15337 
     15338-typedef long unsigned int size_t;
     15339+typedef __SIZE_TYPE__ size_t;
     15340 extern __inline __attribute__ ((__always_inline__)) int __attribute__
     15341 ((__nothrow__)) snprintf (char *__restrict __s, size_t __n, __const char
     15342 *__restrict __fmt, ...)  {
    1327215343diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr39824.c gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr39824.c
    1327315344--- gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr39824.c        1969-12-31 16:00:00.000000000 -0800
     
    1337915450+}
    1338015451+
     15452diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr39983.c gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr39983.c
     15453--- gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr39983.c        1969-12-31 16:00:00.000000000 -0800
     15454+++ gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr39983.c     2009-05-06 10:45:40.000000000 -0700
     15455@@ -0,0 +1,17 @@
     15456+typedef struct {
     15457+    int *p;
     15458+} *A;
     15459+
     15460+extern const int a[1];
     15461+extern const int b[1];
     15462+
     15463+void foo()
     15464+{
     15465+  A x;
     15466+  A y;
     15467+  static const int * const c[] = { b };
     15468+
     15469+  x->p = (int*)c[0];
     15470+  y->p = (int*)a;
     15471+}
     15472+
     15473diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr39999.c gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr39999.c
     15474--- gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr39999.c        1969-12-31 16:00:00.000000000 -0800
     15475+++ gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr39999.c     2009-05-18 03:13:43.000000000 -0700
     15476@@ -0,0 +1,18 @@
     15477+void foo(void *);
     15478+void
     15479+MMAPGCD (int *A1, int *A2)
     15480+{
     15481+  int *t;
     15482+
     15483+  do
     15484+    {
     15485+      t = A1;
     15486+      A1 = A2;
     15487+      A2 = t;
     15488+    }
     15489+  while (A2[-1]);
     15490+
     15491+  foo (A1-1);
     15492+  foo (A2-1);
     15493+}
     15494+
     15495diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr40023.c gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr40023.c
     15496--- gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr40023.c        1969-12-31 16:00:00.000000000 -0800
     15497+++ gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr40023.c     2009-05-06 10:45:40.000000000 -0700
     15498@@ -0,0 +1,11 @@
     15499+typedef __builtin_va_list va_list;
     15500+typedef struct {
     15501+    va_list ap;
     15502+} ScanfState;
     15503+void
     15504+GetInt(ScanfState *state, long llval)
     15505+{
     15506+  *__builtin_va_arg(state->ap,long *) = llval;
     15507+  __builtin_va_end(state->ap);
     15508+}
     15509+
     15510diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr40026.c gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr40026.c
     15511--- gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr40026.c        1969-12-31 16:00:00.000000000 -0800
     15512+++ gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr40026.c     2009-05-11 09:49:17.000000000 -0700
     15513@@ -0,0 +1,15 @@
     15514+typedef struct {
     15515+    unsigned long bits;
     15516+} S;
     15517+struct T {
     15518+    S span;
     15519+    int flags;
     15520+};
     15521+
     15522+struct T f(int x)
     15523+{
     15524+  return (struct T) {
     15525+      .span = (S) { 0UL },
     15526+      .flags = (x ? 256 : 0),
     15527+  };
     15528+}
     15529diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr40035.c gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr40035.c
     15530--- gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr40035.c        1969-12-31 16:00:00.000000000 -0800
     15531+++ gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr40035.c     2009-05-13 14:42:03.000000000 -0700
     15532@@ -0,0 +1,20 @@
     15533+typedef __SIZE_TYPE__ size_t;
     15534+void *memmove (void *dest, const void *src, size_t count);
     15535+size_t strlen (const char *s);
     15536+
     15537+int
     15538+foo (char *param, char *val)
     15539+{
     15540+  if (val)
     15541+    {
     15542+      if (val == param + strlen (param) + 1)
     15543+        val[-1] = '=';
     15544+      else if (val == param + strlen (param) + 2)
     15545+        {
     15546+          val[-2] = '=';
     15547+          memmove (val - 1, val, strlen (val) + 1);
     15548+          val--;
     15549+        }
     15550+    }
     15551+  return 0;
     15552+}
     15553diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr40080.c gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr40080.c
     15554--- gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr40080.c        1969-12-31 16:00:00.000000000 -0800
     15555+++ gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr40080.c     2009-05-11 09:49:17.000000000 -0700
     15556@@ -0,0 +1,44 @@
     15557+extern void *ff(void*,int);
     15558+
     15559+struct lpgl { struct lpgl *next; };
     15560+struct lpgd { struct lpgl *first; };
     15561+
     15562+typedef int (*xfn)( );
     15563+static void xDP_IF_EnumGroupsInGroup ( void *a, int b, xfn fn)
     15564+{
     15565+  struct lpgd *lpGData;
     15566+  struct lpgl *lpGList;
     15567+
     15568+  if( ( lpGData = ff( a, b ) ) == ((void *)0) )
     15569+    return;
     15570+
     15571+  if( lpGData->first  == ((void *)0) )
     15572+    return;
     15573+  lpGList = lpGData->first;
     15574+
     15575+  for( ;; ) {
     15576+    if( !(*fn)( ) )
     15577+      return;
     15578+    if( lpGList->next == ((void *)0) )
     15579+      break;
     15580+    lpGList = lpGList->next;
     15581+  }
     15582+  return;
     15583+}
     15584+
     15585+
     15586+static int
     15587+xcbDeletePlayerFromAllGroups() {
     15588+  xDP_IF_EnumGroupsInGroup(0, 0, 0);
     15589+  return 1;
     15590+}
     15591+
     15592+void xDP_IF_EnumGroups( xfn fn) {
     15593+  xDP_IF_EnumGroupsInGroup( 0, 0, fn);
     15594+}
     15595+
     15596+static void xDP_IF_DestroyPlayer () {
     15597+  xDP_IF_EnumGroups( xcbDeletePlayerFromAllGroups);
     15598+}
     15599+
     15600+void* foo=xDP_IF_DestroyPlayer;
     15601diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr40204.c gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr40204.c
     15602--- gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr40204.c        1969-12-31 16:00:00.000000000 -0800
     15603+++ gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr40204.c     2009-05-20 14:11:10.000000000 -0700
     15604@@ -0,0 +1,14 @@
     15605+/* PR middle-end/40204 */
     15606+
     15607+struct S
     15608+{
     15609+  unsigned int a : 4;
     15610+  unsigned int b : 28;
     15611+} s;
     15612+char c;
     15613+
     15614+void
     15615+f (void)
     15616+{
     15617+  s.a = (c >> 4) & ~(1 << 4);
     15618+}
     15619diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr40233.c gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr40233.c
     15620--- gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr40233.c        1969-12-31 16:00:00.000000000 -0800
     15621+++ gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr40233.c     2009-05-30 06:49:33.000000000 -0700
     15622@@ -0,0 +1,10 @@
     15623+typedef int aligned __attribute__((aligned(64)));
     15624+struct Frame {
     15625+  aligned i;
     15626+};
     15627+
     15628+void foo(struct Frame *p)
     15629+{
     15630+  aligned *q = &p->i;
     15631+  *q = 0;
     15632+}
     15633diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr40252.c gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr40252.c
     15634--- gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr40252.c        1969-12-31 16:00:00.000000000 -0800
     15635+++ gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr40252.c     2009-05-30 06:49:33.000000000 -0700
     15636@@ -0,0 +1,6 @@
     15637+typedef unsigned int uint32_t;
     15638+static void IP(uint32_t v[2])
     15639+{
     15640+    v[0] = ((v[0] << 1) | ((v[0] >> 31) & 1L)) & 0xffffffffL;
     15641+}
     15642+
     15643diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr40291.c gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr40291.c
     15644--- gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/compile/pr40291.c        1969-12-31 16:00:00.000000000 -0800
     15645+++ gcc-4.4.0/gcc/testsuite/gcc.c-torture/compile/pr40291.c     2009-05-29 08:47:31.000000000 -0700
     15646@@ -0,0 +1,7 @@
     15647+/* PR middle-end/40291 */
     15648+
     15649+int
     15650+foo (void *x, char *y, unsigned long long z)
     15651+{
     15652+  return memcmp (x, y, z);
     15653+}
     15654diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/execute/pr40022.c gcc-4.4.0/gcc/testsuite/gcc.c-torture/execute/pr40022.c
     15655--- gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/execute/pr40022.c        1969-12-31 16:00:00.000000000 -0800
     15656+++ gcc-4.4.0/gcc/testsuite/gcc.c-torture/execute/pr40022.c     2009-05-06 01:32:24.000000000 -0700
     15657@@ -0,0 +1,51 @@
     15658+extern void abort (void);
     15659+
     15660+struct A
     15661+{
     15662+  struct A *a;
     15663+};
     15664+
     15665+struct B
     15666+{
     15667+  struct A *b;
     15668+};
     15669+
     15670+__attribute__((noinline))
     15671+struct A *
     15672+foo (struct A *x)
     15673+{
     15674+  asm volatile ("" : : "g" (x) : "memory");
     15675+  return x;
     15676+}
     15677+
     15678+__attribute__((noinline))
     15679+void
     15680+bar (struct B *w, struct A *x, struct A *y, struct A *z)
     15681+{
     15682+  struct A **c;
     15683+  c = &w->b;
     15684+  *c = foo (x);
     15685+  while (*c)
     15686+    c = &(*c)->a;
     15687+  *c = foo (y);
     15688+  while (*c)
     15689+    c = &(*c)->a;
     15690+  *c = foo (z);
     15691+}
     15692+
     15693+struct B d;
     15694+struct A e, f, g;
     15695+
     15696+int
     15697+main (void)
     15698+{
     15699+  f.a = &g;
     15700+  bar (&d, &e, &f, 0);
     15701+  if (d.b == 0
     15702+      || d.b->a == 0
     15703+      || d.b->a->a == 0
     15704+      || d.b->a->a->a != 0)
     15705+    abort ();
     15706+  return 0;
     15707+}
     15708+
     15709diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/execute/pr40057.c gcc-4.4.0/gcc/testsuite/gcc.c-torture/execute/pr40057.c
     15710--- gcc-4.4.0.orig/gcc/testsuite/gcc.c-torture/execute/pr40057.c        1969-12-31 16:00:00.000000000 -0800
     15711+++ gcc-4.4.0/gcc/testsuite/gcc.c-torture/execute/pr40057.c     2009-05-07 08:36:23.000000000 -0700
     15712@@ -0,0 +1,37 @@
     15713+/* PR middle-end/40057 */
     15714+
     15715+extern void abort (void);
     15716+
     15717+__attribute__((noinline)) int
     15718+foo (unsigned long long x)
     15719+{
     15720+  unsigned long long y = (x >> 31ULL) & 1ULL;
     15721+  if (y == 0ULL)
     15722+    return 0;
     15723+  return -1;
     15724+}
     15725+
     15726+__attribute__((noinline)) int
     15727+bar (long long x)
     15728+{
     15729+  long long y = (x >> 31LL) & 1LL;
     15730+  if (y == 0LL)
     15731+    return 0;
     15732+  return -1;
     15733+}
     15734+
     15735+int
     15736+main (void)
     15737+{
     15738+  if (sizeof (long long) != 8)
     15739+    return 0;
     15740+  if (foo (0x1682a9aaaULL))
     15741+    abort ();
     15742+  if (!foo (0x1882a9aaaULL))
     15743+    abort ();
     15744+  if (bar (0x1682a9aaaLL))
     15745+    abort ();
     15746+  if (!bar (0x1882a9aaaLL))
     15747+    abort ();
     15748+  return 0;
     15749+}
     15750diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.dg/20050629-1.c gcc-4.4.0/gcc/testsuite/gcc.dg/20050629-1.c
     15751--- gcc-4.4.0.orig/gcc/testsuite/gcc.dg/20050629-1.c    2005-06-29 17:51:17.000000000 -0700
     15752+++ gcc-4.4.0/gcc/testsuite/gcc.dg/20050629-1.c 2009-05-28 02:19:37.000000000 -0700
     15753@@ -5,7 +5,7 @@
     15754    contains many warnings, but it exposes a copy propagation bug that
     15755    is somewhat difficult to reproduce otherwise.  */
     15756 
     15757-typedef long unsigned int size_t;
     15758+__extension__ typedef __SIZE_TYPE__ size_t;
     15759   extern void fancy_abort (const char *, int, const char *) __attribute__ ((__noreturn__));
     15760   typedef union tree_node *tree;
     15761   enum tree_code {
     15762diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.dg/dfp/pr39986.c gcc-4.4.0/gcc/testsuite/gcc.dg/dfp/pr39986.c
     15763--- gcc-4.4.0.orig/gcc/testsuite/gcc.dg/dfp/pr39986.c   1969-12-31 16:00:00.000000000 -0800
     15764+++ gcc-4.4.0/gcc/testsuite/gcc.dg/dfp/pr39986.c        2009-05-06 10:14:00.000000000 -0700
     15765@@ -0,0 +1,31 @@
     15766+/* { dg-do compile } */
     15767+/* { dg-options "-std=gnu99" } */
     15768+
     15769+/* Check that the compiler generates the correct decimal float constants.  */
     15770+
     15771+_Decimal32 a = 100.223df;
     15772+_Decimal32 b = -2.3df;
     15773+_Decimal64 c = 3.4e-4dd;
     15774+_Decimal64 d = -4.500dd;
     15775+_Decimal128 e = 5678901234567.89e+200dl;
     15776+_Decimal128 f = -678901.234e-6dl;
     15777+
     15778+/* The first value is DPD, the second is BID.  The order differs depending
     15779+   on whether the target is big-endian or little-endian.  */
     15780+
     15781+/* { dg-final { scan-assembler ".long\t(572653859|822183807)\n" } } */
     15782+
     15783+/* { dg-final { scan-assembler ".long\t(-1572863965|-1308622825)\n" } } */
     15784+
     15785+/* { dg-final { scan-assembler ".long\t(52|34)\n" } } */
     15786+/* { dg-final { scan-assembler ".long\t(572784640|824180736)\n" } } */
     15787+
     15788+/* { dg-final { scan-assembler ".long\t(4736|4500)\n" } } */
     15789+/* { dg-final { scan-assembler ".long\t(-1574174720|-1319108608)\n" } } */
     15790+
     15791+/* { dg-final { scan-assembler ".long\t(-1975952433|957645077)\n" } } */
     15792+/* { dg-final { scan-assembler ".long\t(190215|132222)\n" } } */
     15793+/* { dg-final { scan-assembler ".long\t(574193664|835452928)\n" } } */
     15794+
     15795+/* { dg-final { scan-assembler ".long\t(931280180|678901234)\n" } } */
     15796+/* { dg-final { scan-assembler ".long\t(-1576681472|-1339162624)\n" } } */
     15797diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.dg/pr33667.c gcc-4.4.0/gcc/testsuite/gcc.dg/pr33667.c
     15798--- gcc-4.4.0.orig/gcc/testsuite/gcc.dg/pr33667.c       2007-10-05 10:56:52.000000000 -0700
     15799+++ gcc-4.4.0/gcc/testsuite/gcc.dg/pr33667.c    2009-05-28 02:19:37.000000000 -0700
     15800@@ -1,7 +1,7 @@
     15801 /* { dg-do compile } */
     15802 /* { dg-options "-O2" } */
     15803 
     15804-typedef unsigned int size_t;
     15805+__extension__ typedef __SIZE_TYPE__ size_t;
     15806 typedef unsigned char uint8_t;
     15807 typedef unsigned short int uint16_t;
     15808 typedef unsigned long long int uint64_t;
    1338115809diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.dg/pr39565.c gcc-4.4.0/gcc/testsuite/gcc.dg/pr39565.c
    1338215810--- gcc-4.4.0.orig/gcc/testsuite/gcc.dg/pr39565.c       1969-12-31 16:00:00.000000000 -0800
     
    1343015858+    abort ();
    1343115859+  exit (0);
     15860+}
     15861diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.dg/pr39666-1.c gcc-4.4.0/gcc/testsuite/gcc.dg/pr39666-1.c
     15862--- gcc-4.4.0.orig/gcc/testsuite/gcc.dg/pr39666-1.c     1969-12-31 16:00:00.000000000 -0800
     15863+++ gcc-4.4.0/gcc/testsuite/gcc.dg/pr39666-1.c  2009-05-12 09:19:29.000000000 -0700
     15864@@ -0,0 +1,22 @@
     15865+/* PR middle-end/39666 */
     15866+/* { dg-do compile } */
     15867+/* { dg-options "-O2 -Wuninitialized" } */
     15868+
     15869+int
     15870+foo (int i)
     15871+{
     15872+  int j;
     15873+  switch (i)
     15874+    {
     15875+    case -__INT_MAX__ - 1 ... -1:
     15876+      j = 6;
     15877+      break;
     15878+    case 0:
     15879+      j = 5;
     15880+      break;
     15881+    case 1 ... __INT_MAX__:
     15882+      j = 4;
     15883+      break;
     15884+    }
     15885+  return j;
     15886+}
     15887diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.dg/pr39666-2.c gcc-4.4.0/gcc/testsuite/gcc.dg/pr39666-2.c
     15888--- gcc-4.4.0.orig/gcc/testsuite/gcc.dg/pr39666-2.c     1969-12-31 16:00:00.000000000 -0800
     15889+++ gcc-4.4.0/gcc/testsuite/gcc.dg/pr39666-2.c  2009-05-12 09:19:29.000000000 -0700
     15890@@ -0,0 +1,22 @@
     15891+/* PR middle-end/39666 */
     15892+/* { dg-do compile } */
     15893+/* { dg-options "-O2 -Wuninitialized" } */
     15894+
     15895+int
     15896+foo (int i)
     15897+{
     15898+  int j;       /* { dg-warning "may be used uninitialized" } */
     15899+  switch (i)
     15900+    {
     15901+    case -__INT_MAX__ - 1 ... -1:
     15902+      j = 6;
     15903+      break;
     15904+    case 0:
     15905+      j = 5;
     15906+      break;
     15907+    case 2 ... __INT_MAX__:
     15908+      j = 4;
     15909+      break;
     15910+    }
     15911+  return j;
    1343215912+}
    1343315913diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.dg/pr39794.c gcc-4.4.0/gcc/testsuite/gcc.dg/pr39794.c
     
    1348415964+}
    1348515965+
     15966diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.dg/pr40172-1.c gcc-4.4.0/gcc/testsuite/gcc.dg/pr40172-1.c
     15967--- gcc-4.4.0.orig/gcc/testsuite/gcc.dg/pr40172-1.c     1969-12-31 16:00:00.000000000 -0800
     15968+++ gcc-4.4.0/gcc/testsuite/gcc.dg/pr40172-1.c  2009-05-19 14:24:23.000000000 -0700
     15969@@ -0,0 +1,31 @@
     15970+/* PR middle-end/40172 */
     15971+/* { dg-do compile } */
     15972+/* { dg-options "-Wall -W -Werror -Wlogical-op" } */
     15973+
     15974+struct rtx_def;
     15975+typedef struct rtx_def *rtx;
     15976+
     15977+extern int foo;
     15978+extern int bar;
     15979+extern int xxx;
     15980+
     15981+int
     15982+test (void)
     15983+{
     15984+  if (((rtx) 0 != (rtx) 0) && xxx ? foo : bar)
     15985+    return 1;
     15986+  else if ((foo & 0) && xxx)
     15987+    return 2;
     15988+  else if (foo & 0)
     15989+    return 3;
     15990+  else if (0 && xxx)
     15991+    return 4;
     15992+  else if (0)
     15993+    return 5;
     15994+  if (((int) 0 != (int) 0) && bar ? foo : xxx)
     15995+    return 6;
     15996+  else if (0 != 0 && foo ? xxx : bar)
     15997+    return 7;
     15998+  else
     15999+    return 0;
     16000+}
     16001diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.dg/pr40172-2.c gcc-4.4.0/gcc/testsuite/gcc.dg/pr40172-2.c
     16002--- gcc-4.4.0.orig/gcc/testsuite/gcc.dg/pr40172-2.c     1969-12-31 16:00:00.000000000 -0800
     16003+++ gcc-4.4.0/gcc/testsuite/gcc.dg/pr40172-2.c  2009-05-19 14:24:23.000000000 -0700
     16004@@ -0,0 +1,16 @@
     16005+/* PR middle-end/40172 */
     16006+/* { dg-do compile } */
     16007+/* { dg-options "-Wall -W -Werror" } */
     16008+
     16009+extern int xxx;
     16010+
     16011+#define XXX xxx
     16012+
     16013+int
     16014+test (void)
     16015+{
     16016+  if (!XXX && xxx)
     16017+    return 4;
     16018+  else
     16019+    return 0;
     16020+}
     16021diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.dg/pr40172-3.c gcc-4.4.0/gcc/testsuite/gcc.dg/pr40172-3.c
     16022--- gcc-4.4.0.orig/gcc/testsuite/gcc.dg/pr40172-3.c     1969-12-31 16:00:00.000000000 -0800
     16023+++ gcc-4.4.0/gcc/testsuite/gcc.dg/pr40172-3.c  2009-05-19 14:24:23.000000000 -0700
     16024@@ -0,0 +1,16 @@
     16025+/* PR middle-end/40172 */
     16026+/* { dg-do compile */
     16027+/* { dg-options "-Wall -W -Werror -Wlogical-op" } */
     16028+
     16029+extern int xxx;
     16030+
     16031+#define XXX xxx
     16032+
     16033+int
     16034+test (void)
     16035+{
     16036+  if (!XXX && xxx)
     16037+    return 4;
     16038+  else
     16039+    return 0;
     16040+}
     16041diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.dg/prefetch-loop-arrays-1.c gcc-4.4.0/gcc/testsuite/gcc.dg/prefetch-loop-arrays-1.c
     16042--- gcc-4.4.0.orig/gcc/testsuite/gcc.dg/prefetch-loop-arrays-1.c        2006-09-17 18:54:33.000000000 -0700
     16043+++ gcc-4.4.0/gcc/testsuite/gcc.dg/prefetch-loop-arrays-1.c     2009-05-28 02:19:37.000000000 -0700
     16044@@ -3,7 +3,7 @@
     16045 /* { dg-options "-O2 -fprefetch-loop-arrays -w" } */
     16046 /* { dg-options "-O2 -fprefetch-loop-arrays -march=i686 -msse -w" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
     16047 
     16048-typedef unsigned long size_t;
     16049+__extension__ typedef __SIZE_TYPE__ size_t;
     16050 
     16051 struct re_pattern_buffer
     16052 {
    1348616053diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.dg/tls/alias-1.c gcc-4.4.0/gcc/testsuite/gcc.dg/tls/alias-1.c
    1348716054--- gcc-4.4.0.orig/gcc/testsuite/gcc.dg/tls/alias-1.c   2007-09-18 19:35:29.000000000 -0700
     
    1350716074 __thread int thr;
    1350816075 
     16076diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.dg/torture/pr39204.c gcc-4.4.0/gcc/testsuite/gcc.dg/torture/pr39204.c
     16077--- gcc-4.4.0.orig/gcc/testsuite/gcc.dg/torture/pr39204.c       2009-02-17 07:01:40.000000000 -0800
     16078+++ gcc-4.4.0/gcc/testsuite/gcc.dg/torture/pr39204.c    2009-05-28 02:19:37.000000000 -0700
     16079@@ -1,7 +1,7 @@
     16080 /* { dg-do compile } */
     16081 /* { dg-options "-w" } */
     16082 
     16083-typedef unsigned int size_t;
     16084+__extension__ typedef __SIZE_TYPE__ size_t;
     16085 typedef unsigned char __u_char;
     16086 typedef unsigned short int __u_short;
     16087 typedef unsigned int __u_int;
    1350916088diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.dg/torture/pr39829.c gcc-4.4.0/gcc/testsuite/gcc.dg/torture/pr39829.c
    1351016089--- gcc-4.4.0.orig/gcc/testsuite/gcc.dg/torture/pr39829.c       1969-12-31 16:00:00.000000000 -0800
     
    1362216201+  return 0;
    1362316202+}
     16203diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.dg/tree-ssa/20041122-1.c gcc-4.4.0/gcc/testsuite/gcc.dg/tree-ssa/20041122-1.c
     16204--- gcc-4.4.0.orig/gcc/testsuite/gcc.dg/tree-ssa/20041122-1.c   2008-08-20 05:59:10.000000000 -0700
     16205+++ gcc-4.4.0/gcc/testsuite/gcc.dg/tree-ssa/20041122-1.c        2009-05-28 02:19:37.000000000 -0700
     16206@@ -2,7 +2,7 @@
     16207 /* { dg-options "-O1 -fdump-tree-dom2" } */
     16208 
     16209 
     16210-typedef unsigned int size_t;
     16211+__extension__ typedef __SIZE_TYPE__ size_t;
     16212 extern void *xmalloc (size_t) __attribute__ ((__malloc__));
     16213 struct edge_def
     16214 {
     16215diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.dg/tree-ssa/pr36908.c gcc-4.4.0/gcc/testsuite/gcc.dg/tree-ssa/pr36908.c
     16216--- gcc-4.4.0.orig/gcc/testsuite/gcc.dg/tree-ssa/pr36908.c      2008-11-03 08:35:13.000000000 -0800
     16217+++ gcc-4.4.0/gcc/testsuite/gcc.dg/tree-ssa/pr36908.c   2009-05-28 02:19:37.000000000 -0700
     16218@@ -2,7 +2,7 @@
     16219 /* { dg-options "-O2 -ftree-loop-distribution" } */
     16220 #define NULL ((void *)0)
     16221 
     16222-typedef unsigned int size_t;
     16223+__extension__ typedef __SIZE_TYPE__ size_t;
     16224 extern void *foo(size_t nelem, size_t elsize);
     16225 extern void bar (char*, ...);
     16226 
     16227diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.dg/tree-ssa/pr38250.c gcc-4.4.0/gcc/testsuite/gcc.dg/tree-ssa/pr38250.c
     16228--- gcc-4.4.0.orig/gcc/testsuite/gcc.dg/tree-ssa/pr38250.c      2008-12-03 05:43:12.000000000 -0800
     16229+++ gcc-4.4.0/gcc/testsuite/gcc.dg/tree-ssa/pr38250.c   2009-05-28 02:19:37.000000000 -0700
     16230@@ -1,7 +1,7 @@
     16231 /* { dg-do compile } */
     16232 /* { dg-options "-O2 -ftree-loop-distribution" } */
     16233 
     16234-typedef long unsigned int size_t;
     16235+__extension__ typedef __SIZE_TYPE__ size_t;
     16236 typedef struct   {
     16237           long dat[2];
     16238 } gsl_complex_long_double;
     16239diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.dg/tree-ssa/pr40087.c gcc-4.4.0/gcc/testsuite/gcc.dg/tree-ssa/pr40087.c
     16240--- gcc-4.4.0.orig/gcc/testsuite/gcc.dg/tree-ssa/pr40087.c      1969-12-31 16:00:00.000000000 -0800
     16241+++ gcc-4.4.0/gcc/testsuite/gcc.dg/tree-ssa/pr40087.c   2009-05-22 13:43:39.000000000 -0700
     16242@@ -0,0 +1,30 @@
     16243+/* { dg-do run } */
     16244+/* { dg-options "-O1 " } */
     16245+
     16246+extern void abort (void);
     16247+
     16248+static void __attribute__((always_inline))
     16249+reverse(int *first, int *last)
     16250+{
     16251+  if (first == last--)
     16252+    return;
     16253+  while (first != last)
     16254+    {
     16255+      int t = *first;
     16256+      *first = *last;
     16257+      *last = t;
     16258+      if (++first == last--)
     16259+        break;
     16260+    }
     16261+}
     16262+
     16263+int main()
     16264+{
     16265+  int seq[] = { 1, 2, 3, 4, 5, 6, 7, 8 };
     16266+
     16267+  reverse(seq, seq + 8);
     16268+  if (seq[3] != 5 || seq[4] != 4)
     16269+    abort ();
     16270+
     16271+  return 0;
     16272+}
     16273diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-10.c gcc-4.4.0/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-10.c
     16274--- gcc-4.4.0.orig/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-10.c   2007-08-16 13:28:43.000000000 -0700
     16275+++ gcc-4.4.0/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-10.c        2009-05-28 02:19:37.000000000 -0700
     16276@@ -1,7 +1,7 @@
     16277 /* { dg-do compile } */
     16278 /* { dg-options "-O -w -fdump-tree-dse-vops" } */
     16279 
     16280-typedef unsigned int size_t;
     16281+__extension__ typedef __SIZE_TYPE__ size_t;
     16282 typedef struct _IO_FILE FILE;
     16283 typedef struct
     16284 {
     16285diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.dg/vect/pr40074.c gcc-4.4.0/gcc/testsuite/gcc.dg/vect/pr40074.c
     16286--- gcc-4.4.0.orig/gcc/testsuite/gcc.dg/vect/pr40074.c  1969-12-31 16:00:00.000000000 -0800
     16287+++ gcc-4.4.0/gcc/testsuite/gcc.dg/vect/pr40074.c       2009-05-11 04:54:02.000000000 -0700
     16288@@ -0,0 +1,54 @@
     16289+/* { dg-require-effective-target vect_int } */
     16290+
     16291+#include <stdarg.h>
     16292+#include "tree-vect.h"
     16293+
     16294+#define N 16
     16295+
     16296+typedef struct {
     16297+   int a;
     16298+   int b;
     16299+   int c;
     16300+   int d;
     16301+} s;
     16302+
     16303+
     16304+s arr[N] = {{7,0,1,5}, {7,2,3,5}, {7,4,5,5}, {7,6,7,5}, {7,8,9,5}, {7,10,11,5}, {7,12,13,5}, {7,14,15,5}, {7,16,17,5}, {7,18,19,5}, {7,20,21,5}, {7,22,23,5}, {7,24,25,5}, {7,26,27,5}, {7,28,29,5}, {7,30,31,5}};
     16305+
     16306+__attribute__ ((noinline)) int
     16307+main1 ()
     16308+{
     16309+  s *p = arr, *q = arr + 1;
     16310+  int res[N];
     16311+  int i;
     16312+
     16313+  for (i = 0; i < N-1; i++)
     16314+    {
     16315+      res[i] = p->b + p->d + q->b;
     16316+      p++;
     16317+      q++;
     16318+    }
     16319
     16320+  /* check results:  */
     16321+  for (i = 0; i < N-1; i++)
     16322+    {
     16323+      if (res[i] != arr[i].b + arr[i].d + arr[i+1].b)
     16324+       abort ();
     16325+    }
     16326+
     16327+  return 0;
     16328+}
     16329+
     16330+int main (void)
     16331+{
     16332+  int i;
     16333
     16334+  check_vect ();
     16335+
     16336+  main1 ();
     16337+
     16338+  return 0;
     16339+}
     16340+
     16341+/* { dg-final { cleanup-tree-dump "vect" } } */
     16342
     16343diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.dg/vect/pr40238.c gcc-4.4.0/gcc/testsuite/gcc.dg/vect/pr40238.c
     16344--- gcc-4.4.0.orig/gcc/testsuite/gcc.dg/vect/pr40238.c  1969-12-31 16:00:00.000000000 -0800
     16345+++ gcc-4.4.0/gcc/testsuite/gcc.dg/vect/pr40238.c       2009-05-30 06:49:33.000000000 -0700
     16346@@ -0,0 +1,35 @@
     16347+/* { dg-do compile } */
     16348+
     16349+extern int xdo_rb_ctr_row( int *pos_code);
     16350+
     16351+int xgp_ahd_interpolate (int tile)
     16352+{
     16353+ int p[4];
     16354+
     16355+ switch (tile) {
     16356+ default:
     16357+ case 0:
     16358+ case 1:
     16359+  p[0] = 0; p[1] = 1; p[2] = 2; p[3] = 3;
     16360+  break;
     16361+ case 2:
     16362+ case 3:
     16363+  p[0] = 1; p[1] = 0; p[2] = 3; p[3] = 2;
     16364+  break;
     16365+ case 4:
     16366+ case 5:
     16367+  p[0] = 3; p[1] = 2; p[2] = 1; p[3] = 0;
     16368+  break;
     16369+ case 6:
     16370+ case 7:
     16371+  p[0] = 2; p[1] = 3; p[2] = 0; p[3] = 1;
     16372+  break;
     16373+ }
     16374+
     16375+ xdo_rb_ctr_row(p);
     16376+ xdo_rb_ctr_row(p);
     16377+ return 0;
     16378+}
     16379+
     16380+/* { dg-final { cleanup-tree-dump "vect" } } */
     16381+
     16382diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.dg/vect/pr40254.c gcc-4.4.0/gcc/testsuite/gcc.dg/vect/pr40254.c
     16383--- gcc-4.4.0.orig/gcc/testsuite/gcc.dg/vect/pr40254.c  1969-12-31 16:00:00.000000000 -0800
     16384+++ gcc-4.4.0/gcc/testsuite/gcc.dg/vect/pr40254.c       2009-05-30 06:49:33.000000000 -0700
     16385@@ -0,0 +1,39 @@
     16386+#include <stdlib.h>
     16387+#include <stdarg.h>
     16388+#include "tree-vect.h"
     16389+
     16390+struct s
     16391+{
     16392+  int *x;
     16393+  int x1;
     16394+  int x2;
     16395+  int x3;
     16396+  int *y;
     16397+};
     16398+
     16399+struct s arr[64] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
     16400+
     16401+__attribute__ ((noinline)) void
     16402+foo (int i, int *in_x, int *in_y)
     16403+{
     16404+  arr[i].x = in_x;
     16405+  arr[i].y = in_y;
     16406+}
     16407+
     16408+int
     16409+main (void)
     16410+{
     16411+  int a, b;
     16412+
     16413+  check_vect ();
     16414+
     16415+  foo (5, &a, &b);
     16416+
     16417+  if (arr[5].x != &a || arr[5].y != &b)
     16418+    abort ();
     16419+
     16420+  return 0;
     16421+}
     16422+
     16423+/* { dg-final { cleanup-tree-dump "vect" } } */
     16424+
    1362416425diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.dg/vmx/3a-04.c gcc-4.4.0/gcc/testsuite/gcc.dg/vmx/3a-04.c
    1362516426--- gcc-4.4.0.orig/gcc/testsuite/gcc.dg/vmx/3a-04.c     2004-04-17 18:01:41.000000000 -0700
     
    1375116552diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.target/i386/pr39543-2.c gcc-4.4.0/gcc/testsuite/gcc.target/i386/pr39543-2.c
    1375216553--- gcc-4.4.0.orig/gcc/testsuite/gcc.target/i386/pr39543-2.c    1969-12-31 16:00:00.000000000 -0800
    13753 +++ gcc-4.4.0/gcc/testsuite/gcc.target/i386/pr39543-2.c 2009-04-26 11:58:04.000000000 -0700
    13754 @@ -0,0 +1,51 @@
     16554+++ gcc-4.4.0/gcc/testsuite/gcc.target/i386/pr39543-2.c 2009-05-13 13:24:52.000000000 -0700
     16555@@ -0,0 +1,52 @@
    1375516556+/* PR inline-asm/39543 */
    1375616557+/* { dg-do compile } */
    1375716558+/* { dg-options "-O3" } */
     16559+/* { dg-skip-if "" { ilp32 && { ! nonpic } } { "*" } { "" } } */
    1375816560+
    1375916561+float __attribute__ ((aligned (16))) s0[128];
     
    1385016652+                 "m" (p[30]), "m" (p[32]));
    1385116653+}
     16654diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.target/powerpc/altivec-30.c gcc-4.4.0/gcc/testsuite/gcc.target/powerpc/altivec-30.c
     16655--- gcc-4.4.0.orig/gcc/testsuite/gcc.target/powerpc/altivec-30.c        1969-12-31 16:00:00.000000000 -0800
     16656+++ gcc-4.4.0/gcc/testsuite/gcc.target/powerpc/altivec-30.c     2009-05-29 00:14:20.000000000 -0700
     16657@@ -0,0 +1,32 @@
     16658+/* { dg-do compile { target powerpc*-*-* } } */
     16659+/* { dg-require-effective-target powerpc_altivec_ok } */
     16660+/* { dg-options "-maltivec" } */
     16661+
     16662+#include <stdbool.h>
     16663+#include <altivec.h>
     16664+
     16665+#define f0(type) void x0##type (vector bool type x) { }
     16666+f0 (int)
     16667+
     16668+#define f1(v, type) void x1##type (v bool type x) { }
     16669+f1 (vector, int)
     16670+
     16671+#define f2(b, type) void x2##type (vector b type x) { }
     16672+f2 (bool, int)
     16673+
     16674+#define f3(v, b, type) void x3##type (v b type x) { }
     16675+f3 (vector, bool, int)
     16676+
     16677+#define f4(v, b, type) void x4##type (v type b x) { }
     16678+f4 (vector, bool, int)
     16679+
     16680+#define B bool
     16681+#define I int
     16682+#define BI bool int
     16683+#define VBI vector bool int
     16684+
     16685+vector bool int a;
     16686+vector B int b;
     16687+vector B I c;
     16688+vector BI d;
     16689+VBI e;
     16690diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.target/powerpc/altivec-31.c gcc-4.4.0/gcc/testsuite/gcc.target/powerpc/altivec-31.c
     16691--- gcc-4.4.0.orig/gcc/testsuite/gcc.target/powerpc/altivec-31.c        1969-12-31 16:00:00.000000000 -0800
     16692+++ gcc-4.4.0/gcc/testsuite/gcc.target/powerpc/altivec-31.c     2009-05-29 00:14:20.000000000 -0700
     16693@@ -0,0 +1,29 @@
     16694+/* { dg-do compile { target powerpc*-*-* } } */
     16695+/* { dg-require-effective-target powerpc_altivec_ok } */
     16696+/* { dg-options "-maltivec" } */
     16697+
     16698+#define f0(type) void x0##type (vector _Bool type x) { }
     16699+f0 (int)
     16700+
     16701+#define f1(v, type) void x1##type (v _Bool type x) { }
     16702+f1 (vector, int)
     16703+
     16704+#define f2(b, type) void x2##type (vector b type x) { }
     16705+f2 (_Bool, int)
     16706+
     16707+#define f3(v, b, type) void x3##type (v b type x) { }
     16708+f3 (vector, _Bool, int)
     16709+
     16710+#define f4(v, b, type) void x4##type (v type b x) { }
     16711+f4 (vector, _Bool, int)
     16712+
     16713+#define B _Bool
     16714+#define I int
     16715+#define BI _Bool int
     16716+#define VBI vector _Bool int
     16717+
     16718+vector _Bool int a;
     16719+vector B int b;
     16720+vector B I c;
     16721+vector BI d;
     16722+VBI e;
     16723diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.target/powerpc/altivec-types-1.c gcc-4.4.0/gcc/testsuite/gcc.target/powerpc/altivec-types-1.c
     16724--- gcc-4.4.0.orig/gcc/testsuite/gcc.target/powerpc/altivec-types-1.c   2008-08-26 14:39:49.000000000 -0700
     16725+++ gcc-4.4.0/gcc/testsuite/gcc.target/powerpc/altivec-types-1.c        2009-05-29 00:14:20.000000000 -0700
     16726@@ -24,6 +24,7 @@
     16727 __vector signed vsj;
     16728 __vector __bool vbj;
     16729 __vector float vf;
     16730+__vector _Bool vb;
     16731 
     16732 /* These should be rejected as invalid AltiVec types.  */
     16733 
     16734@@ -37,7 +38,6 @@
     16735 __vector __bool long long int vblli;   /* { dg-error "AltiVec types" "" } */
     16736 __vector double vd1;                   /* { dg-error "AltiVec types" "" } */
     16737 __vector long double vld;              /* { dg-error "AltiVec types" "" } */
     16738-__vector _Bool vb;                     /* { dg-error "AltiVec types" "" } */
     16739 __vector _Complex float vcf;           /* { dg-error "AltiVec types" "" } */
     16740 __vector _Complex double vcd;          /* { dg-error "AltiVec types" "" } */
     16741 __vector _Complex long double vcld;    /* { dg-error "AltiVec types" "" } */
     16742diff -Naur gcc-4.4.0.orig/gcc/testsuite/gcc.target/x86_64/abi/asm-support.S gcc-4.4.0/gcc/testsuite/gcc.target/x86_64/abi/asm-support.S
     16743--- gcc-4.4.0.orig/gcc/testsuite/gcc.target/x86_64/abi/asm-support.S    2008-08-28 12:36:58.000000000 -0700
     16744+++ gcc-4.4.0/gcc/testsuite/gcc.target/x86_64/abi/asm-support.S 2009-05-18 09:54:31.000000000 -0700
     16745@@ -49,7 +49,9 @@
     16746        .type   snapshot_ret, @function
     16747 snapshot_ret:
     16748        movq    %rdi, rdi(%rip)
     16749+       subq    $8, %rsp
     16750        call    *callthis(%rip)
     16751+       addq    $8, %rsp
     16752        movq    %rax, rax(%rip)
     16753        movq    %rdx, rdx(%rip)
     16754        movdqu  %xmm0, xmm_regs+0(%rip)
     16755diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/cpp0x/auto14.C gcc-4.4.0/gcc/testsuite/g++.dg/cpp0x/auto14.C
     16756--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/cpp0x/auto14.C  1969-12-31 16:00:00.000000000 -0800
     16757+++ gcc-4.4.0/gcc/testsuite/g++.dg/cpp0x/auto14.C       2009-06-03 11:11:53.000000000 -0700
     16758@@ -0,0 +1,29 @@
     16759+// PR c++/40306, c++/40307
     16760+// { dg-options "-std=c++0x" }
     16761+// { dg-do run }
     16762+
     16763+template< typename T >
     16764+struct test {
     16765+   test run() {
     16766+      auto tmp = *this;
     16767+      return tmp;
     16768+   }
     16769+   test run_pass() {
     16770+      test tmp( *this );
     16771+      return tmp;
     16772+   }
     16773+
     16774+   test run_fail() {
     16775+      auto tmp( *this );
     16776+      return tmp;
     16777+   }
     16778+};
     16779+
     16780+int main()
     16781+{
     16782+   test<int> x;
     16783+   x.run();
     16784+   x.run_pass();
     16785+   x.run_fail();
     16786+   return 0;
     16787+}
     16788diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/cpp0x/enum3.C gcc-4.4.0/gcc/testsuite/g++.dg/cpp0x/enum3.C
     16789--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/cpp0x/enum3.C   1969-12-31 16:00:00.000000000 -0800
     16790+++ gcc-4.4.0/gcc/testsuite/g++.dg/cpp0x/enum3.C        2009-05-25 16:07:05.000000000 -0700
     16791@@ -0,0 +1,17 @@
     16792+// PR c++/38064
     16793+// { dg-options "-std=c++0x" }
     16794+// { dg-do run }
     16795+
     16796+enum class E { elem };
     16797+
     16798+template <class T>
     16799+void f (T t);
     16800+
     16801+bool f (bool b) { return b; }
     16802+
     16803+int main()
     16804+{
     16805+  E e = E::elem;
     16806+  if (!f (e == E::elem))
     16807+    return 1;
     16808+}
     16809diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/cpp0x/initlist13.C gcc-4.4.0/gcc/testsuite/g++.dg/cpp0x/initlist13.C
     16810--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/cpp0x/initlist13.C      2009-02-03 09:23:11.000000000 -0800
     16811+++ gcc-4.4.0/gcc/testsuite/g++.dg/cpp0x/initlist13.C   2009-06-03 11:11:53.000000000 -0700
     16812@@ -2,4 +2,7 @@
     16813 // { dg-do compile }
     16814 // { dg-options "-std=gnu++0x" }
     16815 
     16816-__complex__ int i ({0});       // { dg-error "cannot convert" }
     16817+#include <complex>
     16818+
     16819+__complex__ int i ({0});
     16820+std::complex<int> i2 ({0});
     16821diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/cpp0x/initlist15.C gcc-4.4.0/gcc/testsuite/g++.dg/cpp0x/initlist15.C
     16822--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/cpp0x/initlist15.C      1969-12-31 16:00:00.000000000 -0800
     16823+++ gcc-4.4.0/gcc/testsuite/g++.dg/cpp0x/initlist15.C   2009-05-28 09:09:04.000000000 -0700
     16824@@ -0,0 +1,17 @@
     16825+// { dg-options "-std=c++0x" }
     16826+
     16827+#include <vector>
     16828+#include <typeinfo>
     16829+
     16830+using namespace std;
     16831+
     16832+template< typename ... ArgTypes >
     16833+void test( ArgTypes ... args ) {
     16834+   vector<type_info*> x = { &typeid(ArgTypes)... }; // { dg-error "" }
     16835+}
     16836+
     16837+int main()
     16838+{
     16839+    test( 1, 3.14f, 2.78 );
     16840+    return 0;
     16841+}
     16842diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/cpp0x/initlist16.C gcc-4.4.0/gcc/testsuite/g++.dg/cpp0x/initlist16.C
     16843--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/cpp0x/initlist16.C      1969-12-31 16:00:00.000000000 -0800
     16844+++ gcc-4.4.0/gcc/testsuite/g++.dg/cpp0x/initlist16.C   2009-06-03 11:11:53.000000000 -0700
     16845@@ -0,0 +1,12 @@
     16846+// { dg-options "-std=c++0x" }
     16847+// { dg-do run }
     16848+
     16849+extern "C" void abort();
     16850+
     16851+void f(int i) { if (i != 42) abort(); }
     16852+
     16853+int main()
     16854+{
     16855+  f({42});
     16856+  return {0};
     16857+}
     16858diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/cpp0x/initlist17.C gcc-4.4.0/gcc/testsuite/g++.dg/cpp0x/initlist17.C
     16859--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/cpp0x/initlist17.C      1969-12-31 16:00:00.000000000 -0800
     16860+++ gcc-4.4.0/gcc/testsuite/g++.dg/cpp0x/initlist17.C   2009-06-03 11:11:53.000000000 -0700
     16861@@ -0,0 +1,9 @@
     16862+// { dg-options "-std=c++0x" }
     16863+
     16864+void f(int i);
     16865+
     16866+int main()
     16867+{
     16868+  f({42.0});                   // { dg-error "narrowing" }
     16869+  return {1.0};                        // { dg-error "narrowing" }
     16870+}
     16871diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/cpp0x/initlist18.C gcc-4.4.0/gcc/testsuite/g++.dg/cpp0x/initlist18.C
     16872--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/cpp0x/initlist18.C      1969-12-31 16:00:00.000000000 -0800
     16873+++ gcc-4.4.0/gcc/testsuite/g++.dg/cpp0x/initlist18.C   2009-06-03 11:11:53.000000000 -0700
     16874@@ -0,0 +1,19 @@
     16875+// PR c++/40308, 40311
     16876+// { dg-do run }
     16877+// { dg-options "-std=c++0x" }
     16878+
     16879+template< typename T >
     16880+struct test {
     16881+   test() : data{} {}
     16882+
     16883+   T data;
     16884+};
     16885+
     16886+int main()
     16887+{
     16888+   test<int> x;
     16889+   test<int*> y;
     16890+   int * a = new int{};
     16891+   int * b = new int{5};
     16892+   return 0;
     16893+}
     16894diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/cpp0x/initlist19.C gcc-4.4.0/gcc/testsuite/g++.dg/cpp0x/initlist19.C
     16895--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/cpp0x/initlist19.C      1969-12-31 16:00:00.000000000 -0800
     16896+++ gcc-4.4.0/gcc/testsuite/g++.dg/cpp0x/initlist19.C   2009-06-03 11:11:53.000000000 -0700
     16897@@ -0,0 +1,8 @@
     16898+// { dg-options "-std=c++0x" }
     16899+
     16900+void f(double);
     16901+int main()
     16902+{
     16903+  f({{1}});                    // { dg-error "too many braces" }
     16904+  // { dg-error "" "" { target *-*-* } 6 } allow other errors, too
     16905+}
    1385216906diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/cpp0x/pr39639.C gcc-4.4.0/gcc/testsuite/g++.dg/cpp0x/pr39639.C
    1385316907--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/cpp0x/pr39639.C 1969-12-31 16:00:00.000000000 -0800
     
    1387416928+}
    1387516929+
     16930diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/debug/dwarf2/nested-1.C gcc-4.4.0/gcc/testsuite/g++.dg/debug/dwarf2/nested-1.C
     16931--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/debug/dwarf2/nested-1.C 1969-12-31 16:00:00.000000000 -0800
     16932+++ gcc-4.4.0/gcc/testsuite/g++.dg/debug/dwarf2/nested-1.C      2009-05-18 12:24:17.000000000 -0700
     16933@@ -0,0 +1,29 @@
     16934+// Contributed by Dodji Seketeli <dodji@redhat.com>
     16935+// Origin PR debug/40109
     16936+// { dg-do compile }
     16937+// { dg-options  "-g -dA -O0" }
     16938+
     16939+namespace A
     16940+{
     16941+
     16942+  class B
     16943+  {
     16944+  };
     16945+  typedef A::B AB;
     16946+};
     16947+
     16948+int
     16949+main()
     16950+{
     16951+  A::AB ab;
     16952+  return 0;
     16953+}
     16954+
     16955+// { dg-final { scan-assembler "DW_TAG_typedef" } }
     16956+//
     16957+// What we want to do here is to be sure that the DIE of A::AB is generated
     16958+// as a child of the DIE of the namespace A declaration.
     16959+// So this test won't catch a regression on this fix yet. To write a proper
     16960+// test for this fix, we would need a dwarf reader written in tcl,
     16961+// or something along those lines.
     16962+
     16963diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/eh/nested-try.C gcc-4.4.0/gcc/testsuite/g++.dg/eh/nested-try.C
     16964--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/eh/nested-try.C 1969-12-31 16:00:00.000000000 -0800
     16965+++ gcc-4.4.0/gcc/testsuite/g++.dg/eh/nested-try.C      2009-05-11 09:49:17.000000000 -0700
     16966@@ -0,0 +1,25 @@
     16967+// { dg-do compile }
     16968+// Nested try statements shadowing each other was crashing in EH edge redirection.
     16969+// PR middle-end/40043
     16970+struct A
     16971+{
     16972+  ~A();
     16973+  void foo();
     16974+};
     16975+
     16976+void bar()
     16977+{
     16978+  A a;
     16979+
     16980+  try
     16981+  {
     16982+    A b;
     16983+
     16984+    try
     16985+    {
     16986+      b.foo();
     16987+    }
     16988+    catch (int) {}
     16989+  }
     16990+  catch (int) {}
     16991+}
    1387616992diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/expr/bound-mem-fun.C gcc-4.4.0/gcc/testsuite/g++.dg/expr/bound-mem-fun.C
    1387716993--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/expr/bound-mem-fun.C    1969-12-31 16:00:00.000000000 -0800
     
    1389617012+
    1389717013+
     17014diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/ext/altivec-15.C gcc-4.4.0/gcc/testsuite/g++.dg/ext/altivec-15.C
     17015--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/ext/altivec-15.C        2008-03-25 20:32:13.000000000 -0700
     17016+++ gcc-4.4.0/gcc/testsuite/g++.dg/ext/altivec-15.C     2009-04-30 10:53:23.000000000 -0700
     17017@@ -2,12 +2,15 @@
     17018 /* { dg-require-effective-target powerpc_altivec_ok } */
     17019 /* { dg-options "-maltivec" } */
     17020 
     17021+/* This test was added for an internal compiler error.  The number and
     17022+   content of error messages is irrelevant.  */
     17023+
     17024 struct SubData
     17025 {
     17026     inline const Float Clamp(Float f, Float f0, Float f1) // { dg-error "" }
     17027     }
     17028     inline const void SinCos(Float angle, Float& sine, Float& cosine) // { dg-error "" }
     17029     {
     17030-        C0 = __builtin_vec_splat(_simdCosEstCoefficients, 0); // { dg-error "" }
     17031-        C1 = __builtin_vec_splat(_simdCosEstCoefficients, 1); // { dg-error "" }
     17032+        C0 = __builtin_vec_splat(_simdCosEstCoefficients, 0);
     17033+        C1 = __builtin_vec_splat(_simdCosEstCoefficients, 1);
     17034 
     17035diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/ext/packed6.C gcc-4.4.0/gcc/testsuite/g++.dg/ext/packed6.C
     17036--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/ext/packed6.C   2004-05-31 14:24:31.000000000 -0700
     17037+++ gcc-4.4.0/gcc/testsuite/g++.dg/ext/packed6.C        2009-05-28 02:37:31.000000000 -0700
     17038@@ -1,7 +1,7 @@
     17039 // PR c++/15209
     17040 // { dg-options "-w" }
     17041 
     17042-typedef unsigned int size_t;
     17043+__extension__ typedef __SIZE_TYPE__ size_t;
     17044 typedef unsigned char uint8_t;
     17045 typedef unsigned short int uint16_t;
     17046 
     17047diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/ext/vla7.C gcc-4.4.0/gcc/testsuite/g++.dg/ext/vla7.C
     17048--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/ext/vla7.C      1969-12-31 16:00:00.000000000 -0800
     17049+++ gcc-4.4.0/gcc/testsuite/g++.dg/ext/vla7.C   2009-05-04 23:41:33.000000000 -0700
     17050@@ -0,0 +1,30 @@
     17051+// PR c++/40013
     17052+// { dg-options "" }
     17053+
     17054+template <class T>
     17055+struct A
     17056+{
     17057+  struct B
     17058+  {
     17059+    struct
     17060+    {
     17061+      int fn () { return 0; }
     17062+    } b;
     17063+  };
     17064+  void test ();
     17065+};
     17066+
     17067+template <class T>
     17068+void
     17069+A <T>::test ()
     17070+{
     17071+  B a;
     17072+  int vla[a.b.fn ()];
     17073+}
     17074+
     17075+int
     17076+main ()
     17077+{
     17078+  A <char> a;
     17079+  a.test ();
     17080+}
     17081diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/opt/memcpy1.C gcc-4.4.0/gcc/testsuite/g++.dg/opt/memcpy1.C
     17082--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/opt/memcpy1.C   2007-12-10 14:30:02.000000000 -0800
     17083+++ gcc-4.4.0/gcc/testsuite/g++.dg/opt/memcpy1.C        2009-05-28 02:37:31.000000000 -0700
     17084@@ -6,7 +6,7 @@
     17085 
     17086 typedef unsigned char uint8_t;
     17087 typedef uint8_t uint8;
     17088-typedef long unsigned int size_t;
     17089+__extension__ typedef __SIZE_TYPE__ size_t;
     17090 class csVector2
     17091 {
     17092 public:float x;
     17093diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/pr37742.C gcc-4.4.0/gcc/testsuite/g++.dg/pr37742.C
     17094--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/pr37742.C       2008-11-05 04:17:10.000000000 -0800
     17095+++ gcc-4.4.0/gcc/testsuite/g++.dg/pr37742.C    2009-05-28 02:37:31.000000000 -0700
     17096@@ -1,6 +1,6 @@
     17097 /* { dg-do compile } */
     17098 
     17099-typedef long unsigned int size_t;
     17100+__extension__ typedef __SIZE_TYPE__ size_t;
     17101 void*   __valarray_get_memory(size_t __n);
     17102 int*__restrict__
     17103 __valarray_get_storage(size_t __n)
     17104diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/template/call7.C gcc-4.4.0/gcc/testsuite/g++.dg/template/call7.C
     17105--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/template/call7.C        1969-12-31 16:00:00.000000000 -0800
     17106+++ gcc-4.4.0/gcc/testsuite/g++.dg/template/call7.C     2009-05-06 13:43:41.000000000 -0700
     17107@@ -0,0 +1,19 @@
     17108+// Contributed by Dodji Seketeli <dodji@redhat.com>
     17109+// Origin: PR c++/17395
     17110+// { dg-do "compile" }
     17111+
     17112+template<int> struct X { };
     17113+
     17114+void fu(int a, X<sizeof(a)>) { }
     17115+
     17116+template<class T>
     17117+void bhar(T a, X<sizeof(a)>) { }
     17118+
     17119+int
     17120+main()
     17121+{
     17122+  int x;
     17123+  X<sizeof(int)> y;
     17124+  fu(x, y);
     17125+  bhar(x, y);
     17126+}
     17127diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/template/canon-type-1.C gcc-4.4.0/gcc/testsuite/g++.dg/template/canon-type-1.C
     17128--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/template/canon-type-1.C 1969-12-31 16:00:00.000000000 -0800
     17129+++ gcc-4.4.0/gcc/testsuite/g++.dg/template/canon-type-1.C      2009-05-30 06:49:33.000000000 -0700
     17130@@ -0,0 +1,18 @@
     17131+// Contributed by Dodji Seketeli <dodji@redhat.com>
     17132+// Origin PR c++/39754
     17133+// { dg-do "compile" }
     17134+
     17135+template < typename > struct A ;
     17136+template < typename T , typename = A < T > > struct B { } ;
     17137+template < class W , class > struct D
     17138+{
     17139+  typedef W X ;
     17140+  A<X*> a ;
     17141+};
     17142+
     17143+template < class Y > struct E
     17144+{
     17145+  B<Y*> b ;
     17146+} ;
     17147+E<int> e ;
     17148+
     17149diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/template/canon-type-2.C gcc-4.4.0/gcc/testsuite/g++.dg/template/canon-type-2.C
     17150--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/template/canon-type-2.C 1969-12-31 16:00:00.000000000 -0800
     17151+++ gcc-4.4.0/gcc/testsuite/g++.dg/template/canon-type-2.C      2009-05-30 06:49:33.000000000 -0700
     17152@@ -0,0 +1,18 @@
     17153+// Contributed by Dodji Seketeli <dodji@redhat.com>
     17154+// Origin PR c++/39754
     17155+// { dg-do "compile" }
     17156+
     17157+template < typename > struct A ;
     17158+template < typename T , typename = A < T > > struct B { } ;
     17159+template < class W , class > struct D
     17160+{
     17161+  typedef W X ;
     17162+  A< X()> a ;
     17163+};
     17164+
     17165+template < class Y > struct E
     17166+{
     17167+  B< Y()> b ;
     17168+};
     17169+E<int> e ;
     17170+
     17171diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/template/canon-type-3.C gcc-4.4.0/gcc/testsuite/g++.dg/template/canon-type-3.C
     17172--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/template/canon-type-3.C 1969-12-31 16:00:00.000000000 -0800
     17173+++ gcc-4.4.0/gcc/testsuite/g++.dg/template/canon-type-3.C      2009-05-30 06:49:33.000000000 -0700
     17174@@ -0,0 +1,20 @@
     17175+// Contributed by Dodji Seketeli <dodji@redhat.com>
     17176+// Origin PR c++/39754
     17177+// { dg-do "compile" }
     17178+
     17179+template<typename> struct A ;
     17180+template<typename T , typename = A<T> > struct B { } ;
     17181+template<class W , class > struct D
     17182+{
     17183+  typedef W X ;
     17184+  typedef X (FP) ();
     17185+  A<FP&> a ;
     17186+} ;
     17187+
     17188+template < class Y > struct E
     17189+{
     17190+  typedef Y (FP) ();
     17191+  B<FP&> b ;
     17192+} ;
     17193+E < int > e ;
     17194+
     17195diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/template/canon-type-4.C gcc-4.4.0/gcc/testsuite/g++.dg/template/canon-type-4.C
     17196--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/template/canon-type-4.C 1969-12-31 16:00:00.000000000 -0800
     17197+++ gcc-4.4.0/gcc/testsuite/g++.dg/template/canon-type-4.C      2009-05-30 06:49:33.000000000 -0700
     17198@@ -0,0 +1,22 @@
     17199+// Contributed by Dodji Seketeli <dodji@redhat.com>
     17200+// Origin PR c++/39754
     17201+// { dg-do "compile" }
     17202+
     17203+template<typename> struct A ;
     17204+template<typename T ,typename = A<T> > struct B { } ;
     17205+
     17206+template<class W, class>
     17207+struct D
     17208+{
     17209+  typedef W X;
     17210+  A<X[2]> a;
     17211+} ;
     17212+
     17213+template<class Y>
     17214+struct E
     17215+{
     17216+  B<Y[2]> b;
     17217+};
     17218+
     17219+E < int > e;
     17220+
     17221diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/template/canon-type-5.C gcc-4.4.0/gcc/testsuite/g++.dg/template/canon-type-5.C
     17222--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/template/canon-type-5.C 1969-12-31 16:00:00.000000000 -0800
     17223+++ gcc-4.4.0/gcc/testsuite/g++.dg/template/canon-type-5.C      2009-05-30 06:49:33.000000000 -0700
     17224@@ -0,0 +1,22 @@
     17225+// Contributed by Dodji Seketeli <dodji@redhat.com>
     17226+// Origin PR c++/39754
     17227+// { dg-do "compile" }
     17228+
     17229+struct Foo {};
     17230+template<typename> struct A ;
     17231+template<typename T ,typename = A<T> > struct B { } ;
     17232+
     17233+template<class W, class>
     17234+struct D
     17235+{
     17236+  typedef W X ;
     17237+  A<X Foo::*> a ;
     17238+} ;
     17239+
     17240+template<class Y>
     17241+struct E
     17242+{
     17243+  B<Y Foo::*> b ;
     17244+} ;
     17245+E < int > e ;
     17246+
     17247diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/template/canon-type-6.C gcc-4.4.0/gcc/testsuite/g++.dg/template/canon-type-6.C
     17248--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/template/canon-type-6.C 1969-12-31 16:00:00.000000000 -0800
     17249+++ gcc-4.4.0/gcc/testsuite/g++.dg/template/canon-type-6.C      2009-05-30 06:49:33.000000000 -0700
     17250@@ -0,0 +1,22 @@
     17251+// Contributed by Dodji Seketeli <dodji@redhat.com>
     17252+// Origin PR c++/39754
     17253+// { dg-do "compile" }
     17254+
     17255+struct Foo {};
     17256+template<typename> struct A ;
     17257+template<typename T ,typename = A<T> > struct B { } ;
     17258+
     17259+template<class W, class>
     17260+struct D
     17261+{
     17262+  typedef W X;
     17263+  A<void (Foo::*) (X)> a;
     17264+} ;
     17265+
     17266+template<class Y>
     17267+struct E
     17268+{
     17269+  B<void (Foo::*) (Y)> b;
     17270+};
     17271+E < int > e ;
     17272+
     17273diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/template/canon-type-7.C gcc-4.4.0/gcc/testsuite/g++.dg/template/canon-type-7.C
     17274--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/template/canon-type-7.C 1969-12-31 16:00:00.000000000 -0800
     17275+++ gcc-4.4.0/gcc/testsuite/g++.dg/template/canon-type-7.C      2009-05-30 06:49:33.000000000 -0700
     17276@@ -0,0 +1,21 @@
     17277+// Contributed by Dodji Seketeli <dodji@redhat.com>
     17278+// Origin PR c++/39754
     17279+// { dg-do "compile" }
     17280+
     17281+struct Foo {};
     17282+template<typename> struct A ;
     17283+template<typename T ,typename = A<T> > struct B { } ;
     17284+
     17285+template<class W, class>
     17286+struct D
     17287+{
     17288+  typedef W X;
     17289+  A<X (Foo::*) (X)> a ;
     17290+};
     17291+
     17292+template<class Y>
     17293+struct E
     17294+{
     17295+  B<Y (Foo::*) (Y)> b ;
     17296+};
     17297+E<int> e ;
     17298diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/template/dtor6.C gcc-4.4.0/gcc/testsuite/g++.dg/template/dtor6.C
     17299--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/template/dtor6.C        1969-12-31 16:00:00.000000000 -0800
     17300+++ gcc-4.4.0/gcc/testsuite/g++.dg/template/dtor6.C     2009-05-17 13:34:30.000000000 -0700
     17301@@ -0,0 +1,10 @@
     17302+// PR c++/40139
     17303+
     17304+template<int> struct A
     17305+{
     17306+  static int i;
     17307+};
     17308+
     17309+template<int N> int A<N>::i = { A::~A }; // { dg-error "" }
     17310+
     17311+template class A<0>;
     17312diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/template/typedef18.C gcc-4.4.0/gcc/testsuite/g++.dg/template/typedef18.C
     17313--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/template/typedef18.C    1969-12-31 16:00:00.000000000 -0800
     17314+++ gcc-4.4.0/gcc/testsuite/g++.dg/template/typedef18.C 2009-05-30 06:49:33.000000000 -0700
     17315@@ -0,0 +1,24 @@
     17316+// Contributed by Dodji Seketeli <dodji@redhat.com>
     17317+// Origin PR c++/40007
     17318+// { dg-do compile }
     17319+
     17320+template<typename T>
     17321+struct x
     17322+{
     17323+  protected:
     17324+  typedef int type;
     17325+};
     17326+
     17327+template<typename T>
     17328+struct y : public x<T>
     17329+{
     17330+  typename x<T>::type z;
     17331+};
     17332+
     17333+template<>
     17334+struct y<void> : public x<void>
     17335+{
     17336+  typedef x<void>::type z;
     17337+};
     17338+
     17339+template class y<int>;
     17340diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/template/typedef19.C gcc-4.4.0/gcc/testsuite/g++.dg/template/typedef19.C
     17341--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/template/typedef19.C    1969-12-31 16:00:00.000000000 -0800
     17342+++ gcc-4.4.0/gcc/testsuite/g++.dg/template/typedef19.C 2009-05-30 16:46:31.000000000 -0700
     17343@@ -0,0 +1,21 @@
     17344+// Contributed by Dodji Seketeli <dodji@redhat.com>
     17345+// Origin PR c++/40007
     17346+// { dg-do compile }
     17347+
     17348+class A
     17349+{
     17350+  typedef int mytype; // { dg-error "'typedef int A::mytype' is private" "" { xfail *-*-* } }
     17351+};
     17352+
     17353+template <class T>
     17354+class B : public A
     17355+{
     17356+};
     17357+
     17358+template<class T>
     17359+class B<T*> : public A
     17360+{ // { dg-error "within this context" "" { xfail *-*-* } }
     17361+  mytype mem;
     17362+};
     17363+
     17364+B<int*> b;
     17365diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/template/typedef20.C gcc-4.4.0/gcc/testsuite/g++.dg/template/typedef20.C
     17366--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/template/typedef20.C    1969-12-31 16:00:00.000000000 -0800
     17367+++ gcc-4.4.0/gcc/testsuite/g++.dg/template/typedef20.C 2009-05-30 16:46:31.000000000 -0700
     17368@@ -0,0 +1,27 @@
     17369+// Contributed by Dodji Seketeli <dodji@redhat.com>
     17370+// Origin PR c++/40007
     17371+// { dg-do compile }
     17372+
     17373+class x
     17374+{
     17375+  typedef int privtype; // { dg-error "is private" "" { xfail *-*-* } }
     17376+
     17377+protected:
     17378+  typedef int type;
     17379+};
     17380+
     17381+template<typename T>
     17382+struct y : public x
     17383+{
     17384+  typename x::type z;
     17385+};
     17386+
     17387+template<typename T>
     17388+struct y<T*> : public x
     17389+{ // { dg-error "within this context" "" { xfail *-*-* } }
     17390+  typedef x::type good;
     17391+  typedef x::privtype bad;
     17392+};
     17393+
     17394+template class y<int>;
     17395+template class y<int*>;
     17396diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/torture/20070621-1.C gcc-4.4.0/gcc/testsuite/g++.dg/torture/20070621-1.C
     17397--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/torture/20070621-1.C    2007-06-21 05:00:47.000000000 -0700
     17398+++ gcc-4.4.0/gcc/testsuite/g++.dg/torture/20070621-1.C 2009-05-28 02:37:31.000000000 -0700
     17399@@ -6,7 +6,7 @@
     17400 
     17401 */
     17402 
     17403-typedef long int ptrdiff_t;
     17404+__extension__ typedef __PTRDIFF_TYPE__ ptrdiff_t;
     17405 namespace std __attribute__ ((__visibility__ ("default"))) {
     17406     template<typename, typename>     struct __are_same     {
     17407         enum {
     17408diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/torture/pr34222.C gcc-4.4.0/gcc/testsuite/g++.dg/torture/pr34222.C
     17409--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/torture/pr34222.C       2007-12-04 09:20:34.000000000 -0800
     17410+++ gcc-4.4.0/gcc/testsuite/g++.dg/torture/pr34222.C    2009-05-28 02:37:31.000000000 -0700
     17411@@ -3,7 +3,7 @@
     17412 namespace std __attribute__ ((__visibility__ ("default"))) {
     17413     template<class _CharT>     struct char_traits;
     17414   }
     17415-typedef long int ptrdiff_t;
     17416+__extension__ typedef __PTRDIFF_TYPE__ ptrdiff_t;
     17417 namespace std __attribute__ ((__visibility__ ("default"))) {
     17418     typedef ptrdiff_t streamsize;
     17419     template<typename _CharT, typename _Traits = char_traits<_CharT> >     class basic_ifstream;
     17420diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/torture/pr34850.C gcc-4.4.0/gcc/testsuite/g++.dg/torture/pr34850.C
     17421--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/torture/pr34850.C       2008-01-21 01:34:19.000000000 -0800
     17422+++ gcc-4.4.0/gcc/testsuite/g++.dg/torture/pr34850.C    2009-05-28 02:37:31.000000000 -0700
     17423@@ -5,7 +5,7 @@
     17424 typedef unsigned int uint32_t;
     17425 typedef uint8_t byte;
     17426 typedef uint32_t u32bit;
     17427-typedef unsigned int size_t;
     17428+__extension__ typedef __SIZE_TYPE__ size_t;
     17429 extern "C" {
     17430     extern void __warn_memset_zero_len (void) __attribute__((__warning__ ("")));
     17431     extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__, __artificial__))
     17432diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/torture/pr40335.C gcc-4.4.0/gcc/testsuite/g++.dg/torture/pr40335.C
     17433--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/torture/pr40335.C       1969-12-31 16:00:00.000000000 -0800
     17434+++ gcc-4.4.0/gcc/testsuite/g++.dg/torture/pr40335.C    2009-06-04 05:37:48.000000000 -0700
     17435@@ -0,0 +1,16 @@
     17436+/* { dg-do run } */
     17437+
     17438+extern "C" void abort (void);
     17439+int
     17440+main (void)
     17441+{
     17442+  int i = -1;
     17443+  switch ((signed char) i)
     17444+    {
     17445+      case 255: /* { dg-bogus "exceeds maximum value" "" { xfail *-*-* } } */
     17446+       abort ();
     17447+      default:
     17448+       break;
     17449+    }
     17450+}
     17451+
     17452diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/tree-ssa/pr22444.C gcc-4.4.0/gcc/testsuite/g++.dg/tree-ssa/pr22444.C
     17453--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/tree-ssa/pr22444.C      2007-03-30 12:45:57.000000000 -0700
     17454+++ gcc-4.4.0/gcc/testsuite/g++.dg/tree-ssa/pr22444.C   2009-05-28 02:37:31.000000000 -0700
     17455@@ -4,8 +4,8 @@
     17456 // with the subvars leading to the subvars not being renamed when they should
     17457 // { dg-do compile }
     17458 // { dg-options "-O2" }
     17459-typedef int ptrdiff_t;
     17460-typedef unsigned int size_t;
     17461+__extension__ typedef __PTRDIFF_TYPE__ ptrdiff_t;
     17462+__extension__ typedef __SIZE_TYPE__ size_t;
     17463 namespace std
     17464 {
     17465   template<class _T1, class _T2> struct pair
     17466diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/warn/Wuninitialized-4.C gcc-4.4.0/gcc/testsuite/g++.dg/warn/Wuninitialized-4.C
     17467--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/warn/Wuninitialized-4.C 1969-12-31 16:00:00.000000000 -0800
     17468+++ gcc-4.4.0/gcc/testsuite/g++.dg/warn/Wuninitialized-4.C      2009-05-12 09:19:29.000000000 -0700
     17469@@ -0,0 +1,22 @@
     17470+// PR middle-end/39666
     17471+// { dg-do compile }
     17472+// { dg-options "-O2 -Wuninitialized" }
     17473+
     17474+int
     17475+foo (int i)
     17476+{
     17477+  int j;
     17478+  switch (i)
     17479+    {
     17480+    case -__INT_MAX__ - 1 ... -1:
     17481+      j = 6;
     17482+      break;
     17483+    case 0:
     17484+      j = 5;
     17485+      break;
     17486+    case 1 ... __INT_MAX__:
     17487+      j = 4;
     17488+      break;
     17489+    }
     17490+  return j;
     17491+}
     17492diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.dg/warn/Wuninitialized-5.C gcc-4.4.0/gcc/testsuite/g++.dg/warn/Wuninitialized-5.C
     17493--- gcc-4.4.0.orig/gcc/testsuite/g++.dg/warn/Wuninitialized-5.C 1969-12-31 16:00:00.000000000 -0800
     17494+++ gcc-4.4.0/gcc/testsuite/g++.dg/warn/Wuninitialized-5.C      2009-05-12 09:19:29.000000000 -0700
     17495@@ -0,0 +1,22 @@
     17496+// PR middle-end/39666
     17497+// { dg-do compile }
     17498+// { dg-options "-O2 -Wuninitialized" }
     17499+
     17500+int
     17501+foo (int i)
     17502+{
     17503+  int j;       // { dg-warning "may be used uninitialized" }
     17504+  switch (i)
     17505+    {
     17506+    case -__INT_MAX__ - 1 ... -1:
     17507+      j = 6;
     17508+      break;
     17509+    case 0:
     17510+      j = 5;
     17511+      break;
     17512+    case 2 ... __INT_MAX__:
     17513+      j = 4;
     17514+      break;
     17515+    }
     17516+  return j;
     17517+}
     17518diff -Naur gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/alloc_comp_assign_10.f90 gcc-4.4.0/gcc/testsuite/gfortran.dg/alloc_comp_assign_10.f90
     17519--- gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/alloc_comp_assign_10.f90   1969-12-31 16:00:00.000000000 -0800
     17520+++ gcc-4.4.0/gcc/testsuite/gfortran.dg/alloc_comp_assign_10.f90        2009-05-10 03:44:22.000000000 -0700
     17521@@ -0,0 +1,61 @@
     17522+! { dg-do run }
     17523+!
     17524+! Test the fix for PR39879, in which gfc gagged on the double
     17525+! defined assignment where the rhs had a default initialiser.
     17526+!
     17527+! Contributed by David Sagan <david.sagan@gmail.com>
     17528+!
     17529+module test_struct
     17530+  interface assignment (=)
     17531+    module procedure tao_lat_equal_tao_lat
     17532+  end interface
     17533+  type bunch_params_struct
     17534+    integer n_live_particle         
     17535+  end type
     17536+  type tao_lattice_struct
     17537+    type (bunch_params_struct), allocatable :: bunch_params(:)
     17538+    type (bunch_params_struct), allocatable :: bunch_params2(:)
     17539+  end type
     17540+  type tao_universe_struct
     17541+    type (tao_lattice_struct), pointer :: model, design
     17542+    character(200), pointer :: descrip => NULL()
     17543+  end type
     17544+  type tao_super_universe_struct
     17545+    type (tao_universe_struct), allocatable :: u(:)         
     17546+  end type
     17547+  type (tao_super_universe_struct), save, target :: s
     17548+  contains
     17549+    subroutine tao_lat_equal_tao_lat (lat1, lat2)
     17550+      implicit none
     17551+      type (tao_lattice_struct), intent(inout) :: lat1
     17552+      type (tao_lattice_struct), intent(in) :: lat2
     17553+      if (allocated(lat2%bunch_params)) then
     17554+        lat1%bunch_params = lat2%bunch_params
     17555+      end if
     17556+      if (allocated(lat2%bunch_params2)) then
     17557+        lat1%bunch_params2 = lat2%bunch_params2
     17558+      end if
     17559+    end subroutine
     17560+end module
     17561+
     17562+program tao_program
     17563+  use test_struct
     17564+  implicit none
     17565+  type (tao_universe_struct), pointer :: u
     17566+  integer n, i
     17567+  allocate (s%u(1))
     17568+  u => s%u(1)
     17569+  allocate (u%design, u%model)
     17570+  n = 112
     17571+  allocate (u%model%bunch_params(0:n), u%design%bunch_params(0:n))
     17572+  u%design%bunch_params%n_live_particle = [(i, i = 0, n)]
     17573+  u%model = u%design
     17574+  u%model = u%design ! The double assignment was the cause of the ICE
     17575+  if (.not. allocated (u%model%bunch_params)) call abort
     17576+  if (any (u%model%bunch_params%n_live_particle .ne. [(i, i = 0, n)])) call abort
     17577+  Deallocate (u%model%bunch_params, u%design%bunch_params)
     17578+  deallocate (u%design, u%model)
     17579+  deallocate (s%u)
     17580+end program
     17581+
     17582+! { dg-final { cleanup-modules "test_struct" } }
     17583diff -Naur gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/array_constructor_31.f90 gcc-4.4.0/gcc/testsuite/gfortran.dg/array_constructor_31.f90
     17584--- gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/array_constructor_31.f90   1969-12-31 16:00:00.000000000 -0800
     17585+++ gcc-4.4.0/gcc/testsuite/gfortran.dg/array_constructor_31.f90        2009-05-10 09:14:37.000000000 -0700
     17586@@ -0,0 +1,10 @@
     17587+! { dg-do compile }
     17588+! Test the fix for pr40018 in which the elements in the array
     17589+! constructor would be of default type and this would cause an
     17590+! ICE in the backend because of the type mistmatch with 'i'.
     17591+!
     17592+! Contributed by Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
     17593+!
     17594+  integer(kind=8) :: i
     17595+  write(*,*) [(i, i = 1, 10)]
     17596+  end
     17597diff -Naur gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/assumed_charlen_dummy.f90 gcc-4.4.0/gcc/testsuite/gfortran.dg/assumed_charlen_dummy.f90
     17598--- gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/assumed_charlen_dummy.f90  1969-12-31 16:00:00.000000000 -0800
     17599+++ gcc-4.4.0/gcc/testsuite/gfortran.dg/assumed_charlen_dummy.f90       2009-06-04 10:01:45.000000000 -0700
     17600@@ -0,0 +1,10 @@
     17601+! { dg-do compile }
     17602+! Test the fix for PR fortran/39893.
     17603+! Original testcase provided by Deji Akingunola.
     17604+! Reduced testcase provided by Dominique d'Humieres.
     17605+!
     17606+      SUBROUTINE XAUTOGET()
     17607+      CHARACTER*(*) DICBA    ! { dg-error "Entity with assumed character" }
     17608+      DATA DICBA /"CLIP" /
     17609+      RETURN
     17610+      END
    1389817611diff -Naur gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/chmod_1.f90 gcc-4.4.0/gcc/testsuite/gfortran.dg/chmod_1.f90
    1389917612--- gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/chmod_1.f90        2008-04-30 13:24:46.000000000 -0700
    13900 +++ gcc-4.4.0/gcc/testsuite/gfortran.dg/chmod_1.f90     2009-04-22 04:35:25.000000000 -0700
    13901 @@ -1,4 +1,4 @@
     17613+++ gcc-4.4.0/gcc/testsuite/gfortran.dg/chmod_1.f90     2009-05-09 20:35:53.000000000 -0700
     17614@@ -1,5 +1,6 @@
    1390217615-! { dg-do run { target { ! *-*-mingw* } } }
    13903 +! { dg-do run { target { ! { *-*-mingw* spu-*-* } } } }
     17616+! { dg-do run { target { ! { *-*-mingw* *-*-cygwin* spu-*-* } } } }
    1390417617 ! { dg-options "-std=gnu" }
     17618+! See PR38956.  Test fails on cygwin when user has Administrator rights
    1390517619   implicit none
    1390617620   character(len=*), parameter :: n = "foobar_file"
     17621   integer :: i
    1390717622diff -Naur gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/chmod_2.f90 gcc-4.4.0/gcc/testsuite/gfortran.dg/chmod_2.f90
    1390817623--- gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/chmod_2.f90        2008-04-30 13:24:46.000000000 -0700
    13909 +++ gcc-4.4.0/gcc/testsuite/gfortran.dg/chmod_2.f90     2009-04-22 04:35:25.000000000 -0700
    13910 @@ -1,4 +1,4 @@
     17624+++ gcc-4.4.0/gcc/testsuite/gfortran.dg/chmod_2.f90     2009-05-09 20:35:53.000000000 -0700
     17625@@ -1,5 +1,6 @@
    1391117626-! { dg-do run { target { ! *-*-mingw* } } }
    13912 +! { dg-do run { target { ! { *-*-mingw* spu-*-* } } } }
     17627+! { dg-do run { target { ! { *-*-mingw* *-*-cygwin* spu-*-* } } } }
    1391317628 ! { dg-options "-std=gnu" }
     17629+! See PR38956.  Test fails on cygwin when user has Administrator rights
    1391417630   implicit none
    1391517631   character(len=*), parameter :: n = "foobar_file"
     17632   integer :: i
    1391617633diff -Naur gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/chmod_3.f90 gcc-4.4.0/gcc/testsuite/gfortran.dg/chmod_3.f90
    1391717634--- gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/chmod_3.f90        2008-04-30 13:24:46.000000000 -0700
    13918 +++ gcc-4.4.0/gcc/testsuite/gfortran.dg/chmod_3.f90     2009-04-22 04:35:25.000000000 -0700
    13919 @@ -1,4 +1,4 @@
     17635+++ gcc-4.4.0/gcc/testsuite/gfortran.dg/chmod_3.f90     2009-05-09 20:35:53.000000000 -0700
     17636@@ -1,5 +1,6 @@
    1392017637-! { dg-do run { target { ! *-*-mingw* } } }
    13921 +! { dg-do run { target { ! { *-*-mingw* spu-*-* } } } }
     17638+! { dg-do run { target { ! { *-*-mingw* *-*-cygwin* spu-*-* } } } }
    1392217639 ! { dg-options "-std=gnu -fdefault-integer-8" }
     17640+! See PR38956.  Test fails on cygwin when user has Administrator rights
    1392317641   implicit none
    1392417642   character(len=*), parameter :: n = "foobar_file"
     17643   integer :: i
    1392517644diff -Naur gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/default_format_1.f90 gcc-4.4.0/gcc/testsuite/gfortran.dg/default_format_1.f90
    1392617645--- gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/default_format_1.f90       2008-05-11 02:55:34.000000000 -0700
    13927 +++ gcc-4.4.0/gcc/testsuite/gfortran.dg/default_format_1.f90    2009-04-22 04:35:25.000000000 -0700
     17646+++ gcc-4.4.0/gcc/testsuite/gfortran.dg/default_format_1.f90    2009-05-16 04:01:47.000000000 -0700
    1392817647@@ -1,4 +1,4 @@
    1392917648-! { dg-do run }
    13930 +! { dg-do run { xfail spu-*-* } }
     17649+! { dg-do run { xfail spu-*-*  } }
    1393117650 ! Test XFAILed on Darwin because the system's printf() lacks
    1393217651 ! proper support for denormals.
     
    1393417653diff -Naur gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/default_format_denormal_1.f90 gcc-4.4.0/gcc/testsuite/gfortran.dg/default_format_denormal_1.f90
    1393517654--- gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/default_format_denormal_1.f90      2008-12-09 23:49:40.000000000 -0800
    13936 +++ gcc-4.4.0/gcc/testsuite/gfortran.dg/default_format_denormal_1.f90   2009-04-22 04:35:25.000000000 -0700
     17655+++ gcc-4.4.0/gcc/testsuite/gfortran.dg/default_format_denormal_1.f90   2009-05-16 04:01:47.000000000 -0700
    1393717656@@ -1,4 +1,4 @@
    1393817657-! { dg-do run { xfail alpha*-*-* *-*-darwin[89]* *-*-freebsd* *-*-mingw* } }
    13939 +! { dg-do run { xfail alpha*-*-* *-*-darwin[89]* *-*-freebsd* *-*-mingw* spu-*-* } }
     17658+! { dg-do run { xfail alpha*-*-* *-*-darwin[89]* *-*-freebsd* *-*-mingw* *-*-cygwin* spu-*-* } }
    1394017659 ! Test XFAILed on these platforms because the system's printf() lacks
    1394117660 ! proper support for denormals.
    1394217661 !
     17662diff -Naur gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/dependency_24.f90 gcc-4.4.0/gcc/testsuite/gfortran.dg/dependency_24.f90
     17663--- gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/dependency_24.f90  1969-12-31 16:00:00.000000000 -0800
     17664+++ gcc-4.4.0/gcc/testsuite/gfortran.dg/dependency_24.f90       2009-05-10 08:34:55.000000000 -0700
     17665@@ -0,0 +1,82 @@
     17666+! { dg-do run }
     17667+! Check the fix for PR38863 comment #1, where defined assignment
     17668+! to derived types was not treating components correctly that were
     17669+! not set explicitly.
     17670+!
     17671+! Contributed by Mikael Morin  <mikael@gcc.gnu.org>
     17672+!
     17673+module m
     17674+  type t
     17675+    integer :: i,j
     17676+  end type t
     17677+  type ti
     17678+    integer :: i,j = 99
     17679+  end type ti
     17680+  interface assignment (=)
     17681+    module procedure i_to_t, i_to_ti
     17682+  end interface
     17683+contains
     17684+  elemental subroutine i_to_ti (p, q)
     17685+    type(ti), intent(out) :: p
     17686+    integer, intent(in)  :: q
     17687+    p%i = q
     17688+  end subroutine
     17689+  elemental subroutine i_to_t (p, q)
     17690+    type(t), intent(out) :: p
     17691+    integer, intent(in)  :: q
     17692+    p%i = q
     17693+  end subroutine
     17694+end module
     17695+
     17696+  use m
     17697+  call test_t  ! Check original problem
     17698+  call test_ti ! Default initializers were treated wrongly
     17699+contains
     17700+  subroutine test_t
     17701+    type(t), target :: a(3)
     17702+    type(t), target  :: b(3)
     17703+    type(t), dimension(:), pointer :: p
     17704+    logical :: l(3)
     17705+
     17706+    a%i = 1
     17707+    a%j = [101, 102, 103]
     17708+    b%i = 3
     17709+    b%j = 4
     17710+
     17711+    p => b
     17712+    l = .true.
     17713+
     17714+    where (l)
     17715+      a = p%i         ! Comment #1 of PR38863 concerned WHERE assignment
     17716+    end where
     17717+    if (any (a%j .ne. [101, 102, 103])) call abort
     17718+
     17719+    a = p%i           ! Ordinary assignment was wrong too.
     17720+    if (any (a%j .ne. [101, 102, 103])) call abort
     17721+  end subroutine
     17722+
     17723+  subroutine test_ti
     17724+    type(ti), target :: a(3)
     17725+    type(ti), target  :: b(3)
     17726+    type(ti), dimension(:), pointer :: p
     17727+    logical :: l(3)
     17728+
     17729+    a%i = 1
     17730+    a%j = [101, 102, 103]
     17731+    b%i = 3
     17732+    b%j = 4
     17733+
     17734+    p => b
     17735+    l = .true.
     17736+
     17737+    where (l)
     17738+      a = p%i
     17739+    end where
     17740+    if (any (a%j .ne. 99)) call abort
     17741+
     17742+    a = p%i
     17743+    if (any (a%j .ne. 99)) call abort
     17744+  end subroutine
     17745+end
     17746+! { dg-final { cleanup-modules "m" } }
     17747+
    1394317748diff -Naur gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/elemental_subroutine_1.f90 gcc-4.4.0/gcc/testsuite/gfortran.dg/elemental_subroutine_1.f90
    1394417749--- gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/elemental_subroutine_1.f90 2007-09-17 23:34:30.000000000 -0700
     
    1402717832   implicit none
    1402817833   character(len=1) :: s
     17834diff -Naur gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/leadz_trailz_1.f90 gcc-4.4.0/gcc/testsuite/gfortran.dg/leadz_trailz_1.f90
     17835--- gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/leadz_trailz_1.f90 1969-12-31 16:00:00.000000000 -0800
     17836+++ gcc-4.4.0/gcc/testsuite/gfortran.dg/leadz_trailz_1.f90      2009-06-03 12:39:09.000000000 -0700
     17837@@ -0,0 +1,133 @@
     17838+! { dg-do run }
     17839+
     17840+  integer(kind=1) :: i1
     17841+  integer(kind=2) :: i2
     17842+  integer(kind=4) :: i4
     17843+  integer(kind=8) :: i8
     17844+
     17845+  i1 = -1
     17846+  i2 = -1
     17847+  i4 = -1
     17848+  i8 = -1
     17849+
     17850+  if (leadz(i1) /= 0) call abort
     17851+  if (leadz(i2) /= 0) call abort
     17852+  if (leadz(i4) /= 0) call abort
     17853+  if (leadz(i8) /= 0) call abort
     17854+
     17855+  if (trailz(i1) /= 0) call abort
     17856+  if (trailz(i2) /= 0) call abort
     17857+  if (trailz(i4) /= 0) call abort
     17858+  if (trailz(i8) /= 0) call abort
     17859+
     17860+  if (leadz(-1_1) /= 0) call abort
     17861+  if (leadz(-1_2) /= 0) call abort
     17862+  if (leadz(-1_4) /= 0) call abort
     17863+  if (leadz(-1_8) /= 0) call abort
     17864+
     17865+  if (trailz(-1_1) /= 0) call abort
     17866+  if (trailz(-1_2) /= 0) call abort
     17867+  if (trailz(-1_4) /= 0) call abort
     17868+  if (trailz(-1_8) /= 0) call abort
     17869+
     17870+  i1 = -64
     17871+  i2 = -64
     17872+  i4 = -64
     17873+  i8 = -64
     17874+
     17875+  if (leadz(i1) /= 0) call abort
     17876+  if (leadz(i2) /= 0) call abort
     17877+  if (leadz(i4) /= 0) call abort
     17878+  if (leadz(i8) /= 0) call abort
     17879+
     17880+  if (trailz(i1) /= 6) call abort
     17881+  if (trailz(i2) /= 6) call abort
     17882+  if (trailz(i4) /= 6) call abort
     17883+  if (trailz(i8) /= 6) call abort
     17884+
     17885+  if (leadz(-64_1) /= 0) call abort
     17886+  if (leadz(-64_2) /= 0) call abort
     17887+  if (leadz(-64_4) /= 0) call abort
     17888+  if (leadz(-64_8) /= 0) call abort
     17889+
     17890+  if (trailz(-64_1) /= 6) call abort
     17891+  if (trailz(-64_2) /= 6) call abort
     17892+  if (trailz(-64_4) /= 6) call abort
     17893+  if (trailz(-64_8) /= 6) call abort
     17894+
     17895+  i1 = -108
     17896+  i2 = -108
     17897+  i4 = -108
     17898+  i8 = -108
     17899+
     17900+  if (leadz(i1) /= 0) call abort
     17901+  if (leadz(i2) /= 0) call abort
     17902+  if (leadz(i4) /= 0) call abort
     17903+  if (leadz(i8) /= 0) call abort
     17904+
     17905+  if (trailz(i1) /= 2) call abort
     17906+  if (trailz(i2) /= 2) call abort
     17907+  if (trailz(i4) /= 2) call abort
     17908+  if (trailz(i8) /= 2) call abort
     17909+
     17910+  if (leadz(-108_1) /= 0) call abort
     17911+  if (leadz(-108_2) /= 0) call abort
     17912+  if (leadz(-108_4) /= 0) call abort
     17913+  if (leadz(-108_8) /= 0) call abort
     17914+
     17915+  if (trailz(-108_1) /= 2) call abort
     17916+  if (trailz(-108_2) /= 2) call abort
     17917+  if (trailz(-108_4) /= 2) call abort
     17918+  if (trailz(-108_8) /= 2) call abort
     17919+
     17920+  i1 = 1
     17921+  i2 = 1
     17922+  i4 = 1
     17923+  i8 = 1
     17924+
     17925+  if (leadz(i1) /= bit_size(i1) - 1) call abort
     17926+  if (leadz(i2) /= bit_size(i2) - 1) call abort
     17927+  if (leadz(i4) /= bit_size(i4) - 1) call abort
     17928+  if (leadz(i8) /= bit_size(i8) - 1) call abort
     17929+
     17930+  if (trailz(i1) /= 0) call abort
     17931+  if (trailz(i2) /= 0) call abort
     17932+  if (trailz(i4) /= 0) call abort
     17933+  if (trailz(i8) /= 0) call abort
     17934+
     17935+  if (leadz(1_1) /= bit_size(1_1) - 1) call abort
     17936+  if (leadz(1_2) /= bit_size(1_2) - 1) call abort
     17937+  if (leadz(1_4) /= bit_size(1_4) - 1) call abort
     17938+  if (leadz(1_8) /= bit_size(1_8) - 1) call abort
     17939+
     17940+  if (trailz(1_1) /= 0) call abort
     17941+  if (trailz(1_2) /= 0) call abort
     17942+  if (trailz(1_4) /= 0) call abort
     17943+  if (trailz(1_8) /= 0) call abort
     17944+
     17945+  i1 = 64
     17946+  i2 = 64
     17947+  i4 = 64
     17948+  i8 = 64
     17949+
     17950+  if (leadz(i1) /= 1) call abort
     17951+  if (leadz(i2) /= 9) call abort
     17952+  if (leadz(i4) /= 25) call abort
     17953+  if (leadz(i8) /= 57) call abort
     17954+
     17955+  if (trailz(i1) /= 6) call abort
     17956+  if (trailz(i2) /= 6) call abort
     17957+  if (trailz(i4) /= 6) call abort
     17958+  if (trailz(i8) /= 6) call abort
     17959+
     17960+  if (leadz(64_1) /= 1) call abort
     17961+  if (leadz(64_2) /= 9) call abort
     17962+  if (leadz(64_4) /= 25) call abort
     17963+  if (leadz(64_8) /= 57) call abort
     17964+
     17965+  if (trailz(64_1) /= 6) call abort
     17966+  if (trailz(64_2) /= 6) call abort
     17967+  if (trailz(64_4) /= 6) call abort
     17968+  if (trailz(64_8) /= 6) call abort
     17969+
     17970+end
     17971diff -Naur gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/leadz_trailz_2.f90 gcc-4.4.0/gcc/testsuite/gfortran.dg/leadz_trailz_2.f90
     17972--- gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/leadz_trailz_2.f90 1969-12-31 16:00:00.000000000 -0800
     17973+++ gcc-4.4.0/gcc/testsuite/gfortran.dg/leadz_trailz_2.f90      2009-06-03 12:39:09.000000000 -0700
     17974@@ -0,0 +1,36 @@
     17975+! { dg-do run }
     17976+! { dg-require-effective-target fortran_large_int }
     17977+
     17978+  integer(kind=16) :: i16
     17979+
     17980+  i16 = -1
     17981+  if (leadz(i16) /= 0) call abort
     17982+  if (trailz(i16) /= 0) call abort
     17983+  if (leadz(-1_16) /= 0) call abort
     17984+  if (trailz(-1_16) /= 0) call abort
     17985+
     17986+  i16 = -64
     17987+  if (leadz(i16) /= 0) call abort
     17988+  if (trailz(i16) /= 6) call abort
     17989+  if (leadz(-64_16) /= 0) call abort
     17990+  if (trailz(-64_16) /= 6) call abort
     17991+
     17992+  i16 = -108
     17993+  if (leadz(i16) /= 0) call abort
     17994+  if (trailz(i16) /= 2) call abort
     17995+  if (leadz(-108_16) /= 0) call abort
     17996+  if (trailz(-108_16) /= 2) call abort
     17997+
     17998+  i16 = 1
     17999+  if (leadz(i16) /= bit_size(i16) - 1) call abort
     18000+  if (trailz(i16) /= 0) call abort
     18001+  if (leadz(1_16) /= bit_size(1_16) - 1) call abort
     18002+  if (trailz(1_16) /= 0) call abort
     18003+
     18004+  i16 = 64
     18005+  if (leadz(i16) /= 121) call abort
     18006+  if (trailz(i16) /= 6) call abort
     18007+  if (leadz(64_16) /= 121) call abort
     18008+  if (trailz(64_16) /= 6) call abort
     18009+
     18010+end
    1402918011diff -Naur gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/module_nan.f90 gcc-4.4.0/gcc/testsuite/gfortran.dg/module_nan.f90
    1403018012--- gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/module_nan.f90     2008-12-09 23:49:40.000000000 -0800
     
    1412518107diff -Naur gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/open_errors.f90 gcc-4.4.0/gcc/testsuite/gfortran.dg/open_errors.f90
    1412618108--- gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/open_errors.f90    2008-04-30 13:24:46.000000000 -0700
    14127 +++ gcc-4.4.0/gcc/testsuite/gfortran.dg/open_errors.f90 2009-04-22 04:35:25.000000000 -0700
    14128 @@ -1,4 +1,4 @@
     18109+++ gcc-4.4.0/gcc/testsuite/gfortran.dg/open_errors.f90 2009-05-09 20:35:53.000000000 -0700
     18110@@ -1,6 +1,7 @@
    1412918111-! { dg-do run { target { ! *-*-mingw* } } }
    14130 +! { dg-do run { target { ! { *-*-mingw* spu-*-* } } } }
     18112+! { dg-do run { target { ! { *-*-mingw* *-*-cygwin* spu-*-* } } } }
    1413118113 ! PR30005 Enhanced error messages for OPEN
    1413218114 ! Submitted by Jerry DeLisle  <jvdelisle@gcc.gnu.org>
     18115+! See PR38956.  Test fails on cygwin when user has Administrator rights
    1413318116 character(60) :: msg
     18117 character(25) :: n = "temptestfile"
     18118 logical :: there
    1413418119diff -Naur gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/pr20257.f90 gcc-4.4.0/gcc/testsuite/gfortran.dg/pr20257.f90
    1413518120--- gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/pr20257.f90        2008-03-04 16:59:34.000000000 -0800
     
    1414118126   real(8) array(10000)
    1414218127 
     18128diff -Naur gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/pr39666-1.f90 gcc-4.4.0/gcc/testsuite/gfortran.dg/pr39666-1.f90
     18129--- gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/pr39666-1.f90      1969-12-31 16:00:00.000000000 -0800
     18130+++ gcc-4.4.0/gcc/testsuite/gfortran.dg/pr39666-1.f90   2009-05-12 09:19:29.000000000 -0700
     18131@@ -0,0 +1,14 @@
     18132+! PR middle-end/39666
     18133+! { dg-do compile }
     18134+! { dg-options "-O2 -Wuninitialized" }
     18135+
     18136+FUNCTION f(n)
     18137+  INTEGER, INTENT(in) :: n
     18138+  REAL                :: f
     18139+
     18140+  SELECT CASE (n)
     18141+    CASE (:-1); f = -1.0
     18142+    CASE (0);   f =  0.0
     18143+    CASE (1:);  f =  1.0
     18144+  END SELECT
     18145+END FUNCTION
     18146diff -Naur gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/pr39666-2.f90 gcc-4.4.0/gcc/testsuite/gfortran.dg/pr39666-2.f90
     18147--- gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/pr39666-2.f90      1969-12-31 16:00:00.000000000 -0800
     18148+++ gcc-4.4.0/gcc/testsuite/gfortran.dg/pr39666-2.f90   2009-05-12 09:19:29.000000000 -0700
     18149@@ -0,0 +1,14 @@
     18150+! PR middle-end/39666
     18151+! { dg-do compile }
     18152+! { dg-options "-O2 -Wuninitialized" }
     18153+
     18154+FUNCTION f(n)  ! { dg-warning "may be used uninitialized" }
     18155+  INTEGER, INTENT(in) :: n
     18156+  REAL                :: f
     18157+
     18158+  SELECT CASE (n)
     18159+    CASE (:-1); f = -1.0
     18160+    CASE (0);   f =  0.0
     18161+    CASE (2:);  f =  1.0
     18162+  END SELECT
     18163+END FUNCTION
    1414318164diff -Naur gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/real_const_3.f90 gcc-4.4.0/gcc/testsuite/gfortran.dg/real_const_3.f90
    1414418165--- gcc-4.4.0.orig/gcc/testsuite/gfortran.dg/real_const_3.f90   2008-12-09 23:49:40.000000000 -0800
     
    1427218293 add-ieee-options
    1427318294 return 0
     18295diff -Naur gcc-4.4.0.orig/gcc/testsuite/gfortran.fortran-torture/execute/pr40021.f gcc-4.4.0/gcc/testsuite/gfortran.fortran-torture/execute/pr40021.f
     18296--- gcc-4.4.0.orig/gcc/testsuite/gfortran.fortran-torture/execute/pr40021.f     1969-12-31 16:00:00.000000000 -0800
     18297+++ gcc-4.4.0/gcc/testsuite/gfortran.fortran-torture/execute/pr40021.f  2009-05-06 10:45:40.000000000 -0700
     18298@@ -0,0 +1,40 @@
     18299+C Derived from lapack
     18300+        PROGRAM test
     18301+        DOUBLE PRECISION DA
     18302+        INTEGER I, N
     18303+        DOUBLE PRECISION DX(9),DY(9)
     18304+
     18305+        EXTERNAL DAXPY
     18306+        N=5
     18307+        DA=1.0
     18308+        DATA DX/-2, -1, -3, -4, 1, 2, 10, 15, 14/
     18309+        DATA DY/0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0/
     18310+        CALL DAXPY (N,DA,DX,DY)
     18311+        DO 10 I = 1, N
     18312+          if (DX(I).ne.DY(I)) call abort
     18313+10      CONTINUE
     18314+        STOP
     18315+        END
     18316+
     18317+      SUBROUTINE DAXPY(N,DA,DX,DY)
     18318+      DOUBLE PRECISION DA
     18319+      INTEGER N
     18320+      DOUBLE PRECISION DX(*),DY(*)
     18321+      INTEGER I,IX,IY,M,MP1
     18322+      INTRINSIC MOD
     18323+      IF (N.LE.0) RETURN
     18324+   20 M = MOD(N,4)
     18325+      IF (M.EQ.0) GO TO 40
     18326+      DO 30 I = 1,M
     18327+          DY(I) = DY(I) + DA*DX(I)
     18328+   30 CONTINUE
     18329+      IF (N.LT.4) RETURN
     18330+   40 MP1 = M + 1
     18331+      DO 50 I = MP1,N,4
     18332+          DY(I) = DY(I) + DA*DX(I)
     18333+          DY(I+1) = DY(I+1) + DA*DX(I+1)
     18334+          DY(I+2) = DY(I+2) + DA*DX(I+2)
     18335+          DY(I+3) = DY(I+3) + DA*DX(I+3)
     18336+   50 CONTINUE
     18337+      RETURN
     18338+      END
    1427418339diff -Naur gcc-4.4.0.orig/gcc/testsuite/gnat.dg/enum2.adb gcc-4.4.0/gcc/testsuite/gnat.dg/enum2.adb
    1427518340--- gcc-4.4.0.orig/gcc/testsuite/gnat.dg/enum2.adb      1969-12-31 16:00:00.000000000 -0800
     
    1429918364+  Null_String : constant F_String := (Controlled with Data => null);
    1430018365+end Enum2_Pkg;
     18366diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.old-deja/g++.brendan/array1.C gcc-4.4.0/gcc/testsuite/g++.old-deja/g++.brendan/array1.C
     18367--- gcc-4.4.0.orig/gcc/testsuite/g++.old-deja/g++.brendan/array1.C      2003-04-30 19:02:59.000000000 -0700
     18368+++ gcc-4.4.0/gcc/testsuite/g++.old-deja/g++.brendan/array1.C   2009-05-26 23:37:45.000000000 -0700
     18369@@ -3,5 +3,5 @@
     18370 // GROUPS passed array-bindings
     18371 
     18372 extern "C" int printf (const char *, ...);
     18373-char array[~(~0ul>>1)|~(0ul>>3)];  // { dg-error "" } overflow in array dimension.*
     18374+char array[~(~((__SIZE_TYPE__)0ul)>>1)|~(((__SIZE_TYPE__)0ul)>>3)];  // { dg-error "" } overflow in array dimension.*
     18375 int main () { printf ("PASS\n"); return 0; }
     18376diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.old-deja/g++.brendan/crash64.C gcc-4.4.0/gcc/testsuite/g++.old-deja/g++.brendan/crash64.C
     18377--- gcc-4.4.0.orig/gcc/testsuite/g++.old-deja/g++.brendan/crash64.C     2003-04-30 19:02:59.000000000 -0700
     18378+++ gcc-4.4.0/gcc/testsuite/g++.old-deja/g++.brendan/crash64.C  2009-05-26 23:37:45.000000000 -0700
     18379@@ -1,6 +1,6 @@
     18380 // { dg-do assemble  }
     18381 // GROUPS passed old-abort
     18382-typedef long unsigned int size_t;
     18383+typedef __SIZE_TYPE__ size_t;
     18384 typedef void (*RF_Ptr)(void *);
     18385 
     18386 struct _im_pers_mem_spec {
     18387@@ -9,7 +9,7 @@
     18388 };
     18389 
     18390 struct _type_desc {
     18391-  _type_desc(char *, int , RF_Ptr , int , int ,...);
     18392+  _type_desc(const char *, int , RF_Ptr , int , int ,...);
     18393 };
     18394 
     18395 struct metatype { int base_list; };
     18396diff -Naur gcc-4.4.0.orig/gcc/testsuite/g++.old-deja/g++.jason/new3.C gcc-4.4.0/gcc/testsuite/g++.old-deja/g++.jason/new3.C
     18397--- gcc-4.4.0.orig/gcc/testsuite/g++.old-deja/g++.jason/new3.C  2003-04-30 19:02:59.000000000 -0700
     18398+++ gcc-4.4.0/gcc/testsuite/g++.old-deja/g++.jason/new3.C       2009-05-26 23:37:45.000000000 -0700
     18399@@ -1,5 +1,5 @@
     18400 // { dg-do run  }
     18401-// { dg-options "-fcheck-new -pedantic" }
     18402+// { dg-options "-fcheck-new -pedantic -Wno-long-long" }
     18403 // PRMS Id: 6037
     18404 
     18405 extern "C" void * malloc (__SIZE_TYPE__);
    1430118406diff -Naur gcc-4.4.0.orig/gcc/testsuite/lib/gcc-defs.exp gcc-4.4.0/gcc/testsuite/lib/gcc-defs.exp
    1430218407--- gcc-4.4.0.orig/gcc/testsuite/lib/gcc-defs.exp       2009-03-19 15:10:22.000000000 -0700
     
    1435218457diff -Naur gcc-4.4.0.orig/gcc/testsuite/lib/target-supports.exp gcc-4.4.0/gcc/testsuite/lib/target-supports.exp
    1435318458--- gcc-4.4.0.orig/gcc/testsuite/lib/target-supports.exp        2009-03-16 14:11:57.000000000 -0700
    14354 +++ gcc-4.4.0/gcc/testsuite/lib/target-supports.exp     2009-04-28 13:57:42.000000000 -0700
    14355 @@ -544,8 +544,6 @@
     18459+++ gcc-4.4.0/gcc/testsuite/lib/target-supports.exp     2009-05-12 01:41:28.000000000 -0700
     18460@@ -466,6 +466,11 @@
     18461        return 0
     18462     }
     18463 
     18464+    # cygwin does not support -p.
     18465+    if { [istarget *-*-cygwin*] && [lindex $test_what 1] == "-p" } {
     18466+       return 0
     18467+    }
     18468+
     18469     # uClibc does not have gcrt1.o.
     18470     if { [check_effective_target_uclibc]
     18471         && ([lindex $test_what 1] == "-p"
     18472@@ -544,8 +549,6 @@
    1435618473 }
    1435718474 
     
    1436218479 proc check_effective_target_tls {} {
    1436318480     return [check_no_compiler_messages tls assembly {
    14364 @@ -556,8 +554,6 @@
     18481@@ -556,8 +559,6 @@
    1436518482 }
    1436618483 
     
    1437118488 proc check_effective_target_tls_native {} {
    1437218489     # VxWorks uses emulated TLS machinery, but with non-standard helper
    14373 @@ -575,8 +571,6 @@
     18490@@ -575,8 +576,6 @@
    1437418491 }
    1437518492 
     
    1440018517   GCC_GMP_STRINGIFY_VERSION2(__GNU_MP_VERSION_MINOR)
    1440118518 #else
     18519diff -Naur gcc-4.4.0.orig/gcc/tree.h gcc-4.4.0/gcc/tree.h
     18520--- gcc-4.4.0.orig/gcc/tree.h   2009-03-23 09:29:33.000000000 -0700
     18521+++ gcc-4.4.0/gcc/tree.h        2009-06-02 00:18:16.000000000 -0700
     18522@@ -5088,7 +5088,7 @@
     18523 
     18524 /* Generate a new label for the CFI info to refer to.  */
     18525 
     18526-extern char *dwarf2out_cfi_label (void);
     18527+extern char *dwarf2out_cfi_label (bool);
     18528 
     18529 /* Entry point to update the canonical frame address (CFA).  */
     18530 
     18531@@ -5256,6 +5256,9 @@
     18532 
     18533 void init_inline_once (void);
     18534 
     18535+/* In ipa-reference.c.  Used for parsing attributes of asm code.  */
     18536+extern GTY(()) tree memory_identifier_string;
     18537+
     18538 /* Compute the number of operands in an expression node NODE.  For
     18539    tcc_vl_exp nodes like CALL_EXPRs, this is stored in the node itself,
     18540    otherwise it is looked up from the node's code.  */
     18541diff -Naur gcc-4.4.0.orig/gcc/tree-inline.c gcc-4.4.0/gcc/tree-inline.c
     18542--- gcc-4.4.0.orig/gcc/tree-inline.c    2009-03-08 15:37:26.000000000 -0700
     18543+++ gcc-4.4.0/gcc/tree-inline.c 2009-05-27 23:52:15.000000000 -0700
     18544@@ -501,7 +501,7 @@
     18545              && (var_ann (old_var) || !gimple_in_ssa_p (cfun)))
     18546            cfun->local_decls = tree_cons (NULL_TREE, old_var,
     18547                                                   cfun->local_decls);
     18548-         if (debug_info_level > DINFO_LEVEL_TERSE
     18549+         if ((!optimize || debug_info_level > DINFO_LEVEL_TERSE)
     18550              && !DECL_IGNORED_P (old_var)
     18551              && nonlocalized_list)
     18552            VEC_safe_push (tree, gc, *nonlocalized_list, origin_var);
     18553@@ -519,7 +519,7 @@
     18554        ;
     18555       else if (!new_var)
     18556         {
     18557-         if (debug_info_level > DINFO_LEVEL_TERSE
     18558+         if ((!optimize || debug_info_level > DINFO_LEVEL_TERSE)
     18559              && !DECL_IGNORED_P (old_var)
     18560              && nonlocalized_list)
     18561            VEC_safe_push (tree, gc, *nonlocalized_list, origin_var);
     18562diff -Naur gcc-4.4.0.orig/gcc/tree-scalar-evolution.c gcc-4.4.0/gcc/tree-scalar-evolution.c
     18563--- gcc-4.4.0.orig/gcc/tree-scalar-evolution.c  2009-03-04 09:50:20.000000000 -0800
     18564+++ gcc-4.4.0/gcc/tree-scalar-evolution.c       2009-05-08 05:28:01.000000000 -0700
     18565@@ -1320,11 +1320,7 @@
     18566 
     18567   *evolution_of_loop = evolution_of_branch;
     18568 
     18569-  /* If the phi node is just a copy, do not increase the limit.  */
     18570   n = gimple_phi_num_args (condition_phi);
     18571-  if (n > 1)
     18572-    limit++;
     18573-
     18574   for (i = 1; i < n; i++)
     18575     {
     18576       /* Quickly give up when the evolution of one of the branches is
     18577@@ -1332,10 +1328,12 @@
     18578       if (*evolution_of_loop == chrec_dont_know)
     18579        return t_true;
     18580 
     18581+      /* Increase the limit by the PHI argument number to avoid exponential
     18582+        time and memory complexity.  */
     18583       res = follow_ssa_edge_in_condition_phi_branch (i, loop, condition_phi,
     18584                                                     halting_phi,
     18585                                                     &evolution_of_branch,
     18586-                                                    init, limit);
     18587+                                                    init, limit + i);
     18588       if (res == t_false || res == t_dont_know)
     18589        return res;
     18590 
    1440218591diff -Naur gcc-4.4.0.orig/gcc/tree-ssa-ccp.c gcc-4.4.0/gcc/tree-ssa-ccp.c
    1440318592--- gcc-4.4.0.orig/gcc/tree-ssa-ccp.c   2009-04-16 02:39:20.000000000 -0700
     
    1441418603        break;
    1441518604       }
     18605diff -Naur gcc-4.4.0.orig/gcc/tree-ssa-forwprop.c gcc-4.4.0/gcc/tree-ssa-forwprop.c
     18606--- gcc-4.4.0.orig/gcc/tree-ssa-forwprop.c      2009-02-20 07:20:38.000000000 -0800
     18607+++ gcc-4.4.0/gcc/tree-ssa-forwprop.c   2009-05-19 04:54:16.000000000 -0700
     18608@@ -683,6 +683,7 @@
     18609   tree *rhsp, *lhsp;
     18610   gimple use_stmt = gsi_stmt (*use_stmt_gsi);
     18611   enum tree_code rhs_code;
     18612+  bool res = true;
     18613 
     18614   gcc_assert (TREE_CODE (def_rhs) == ADDR_EXPR);
     18615 
     18616@@ -726,19 +727,26 @@
     18617   /* Now see if the LHS node is an INDIRECT_REF using NAME.  If so,
     18618      propagate the ADDR_EXPR into the use of NAME and fold the result.  */
     18619   if (TREE_CODE (lhs) == INDIRECT_REF
     18620-      && TREE_OPERAND (lhs, 0) == name
     18621-      && may_propagate_address_into_dereference (def_rhs, lhs)
     18622-      && (lhsp != gimple_assign_lhs_ptr (use_stmt)
     18623-         || useless_type_conversion_p (TREE_TYPE (TREE_OPERAND (def_rhs, 0)),
     18624-                                       TREE_TYPE (rhs))))
     18625+      && TREE_OPERAND (lhs, 0) == name)
     18626     {
     18627-      *lhsp = unshare_expr (TREE_OPERAND (def_rhs, 0));
     18628-      fold_stmt_inplace (use_stmt);
     18629-      tidy_after_forward_propagate_addr (use_stmt);
     18630+      if (may_propagate_address_into_dereference (def_rhs, lhs)
     18631+         && (lhsp != gimple_assign_lhs_ptr (use_stmt)
     18632+             || useless_type_conversion_p
     18633+                  (TREE_TYPE (TREE_OPERAND (def_rhs, 0)), TREE_TYPE (rhs))))
     18634+       {
     18635+         *lhsp = unshare_expr (TREE_OPERAND (def_rhs, 0));
     18636+         fold_stmt_inplace (use_stmt);
     18637+         tidy_after_forward_propagate_addr (use_stmt);
     18638 
     18639-      /* Continue propagating into the RHS if this was not the only use.  */
     18640-      if (single_use_p)
     18641-       return true;
     18642+         /* Continue propagating into the RHS if this was not the only use.  */
     18643+         if (single_use_p)
     18644+           return true;
     18645+       }
     18646+      else
     18647+       /* We can have a struct assignment dereferencing our name twice.
     18648+          Note that we didn't propagate into the lhs to not falsely
     18649+          claim we did when propagating into the rhs.  */
     18650+       res = false;
     18651     }
     18652 
     18653   /* Strip away any outer COMPONENT_REF, ARRAY_REF or ADDR_EXPR
     18654@@ -758,7 +766,7 @@
     18655       *rhsp = unshare_expr (TREE_OPERAND (def_rhs, 0));
     18656       fold_stmt_inplace (use_stmt);
     18657       tidy_after_forward_propagate_addr (use_stmt);
     18658-      return true;
     18659+      return res;
     18660     }
     18661 
     18662   /* Now see if the RHS node is an INDIRECT_REF using NAME.  If so,
     18663@@ -789,7 +797,7 @@
     18664                                             true, GSI_NEW_STMT);
     18665         gimple_assign_set_rhs1 (use_stmt, new_rhs);
     18666         tidy_after_forward_propagate_addr (use_stmt);
     18667-        return true;
     18668+        return res;
     18669        }
     18670      /* If the defining rhs comes from an indirect reference, then do not
     18671         convert into a VIEW_CONVERT_EXPR.  */
     18672@@ -803,7 +811,7 @@
     18673         *rhsp = new_rhs;
     18674         fold_stmt_inplace (use_stmt);
     18675         tidy_after_forward_propagate_addr (use_stmt);
     18676-        return true;
     18677+        return res;
     18678        }
     18679    }
     18680 
    1441618681diff -Naur gcc-4.4.0.orig/gcc/tree-ssa-live.c gcc-4.4.0/gcc/tree-ssa-live.c
    1441718682--- gcc-4.4.0.orig/gcc/tree-ssa-live.c  2009-03-17 10:53:01.000000000 -0700
    14418 +++ gcc-4.4.0/gcc/tree-ssa-live.c       2009-04-22 15:24:45.000000000 -0700
     18683+++ gcc-4.4.0/gcc/tree-ssa-live.c       2009-05-27 23:49:43.000000000 -0700
    1441918684@@ -595,6 +595,8 @@
    1442018685    /* Verfify that only blocks with source location set
     
    1442618691 }
    1442718692 
     18693@@ -678,6 +680,12 @@
     18694   var_ann_t ann;
     18695   bitmap global_unused_vars = NULL;
     18696 
     18697+  /* Removing declarations from lexical blocks when not optimizing is
     18698+     not only a waste of time, it actually causes differences in stack
     18699+     layout.  */
     18700+  if (!optimize)
     18701+    return;
     18702+
     18703   mark_scope_block_unused (DECL_INITIAL (current_function_decl));
     18704 
     18705   /* Assume all locals are unused.  */
     18706@@ -740,8 +748,7 @@
     18707 
     18708       if (TREE_CODE (var) != FUNCTION_DECL
     18709          && (!(ann = var_ann (var))
     18710-             || !ann->used)
     18711-         && (optimize || DECL_ARTIFICIAL (var)))
     18712+             || !ann->used))
     18713        {
     18714          if (is_global_var (var))
     18715            {
     18716@@ -802,8 +809,7 @@
     18717        && TREE_CODE (t) != RESULT_DECL
     18718        && !(ann = var_ann (t))->used
     18719        && !ann->symbol_mem_tag
     18720-       && !TREE_ADDRESSABLE (t)
     18721-       && (optimize || DECL_ARTIFICIAL (t)))
     18722+       && !TREE_ADDRESSABLE (t))
     18723       remove_referenced_var (t);
     18724   remove_unused_scope_block_p (DECL_INITIAL (current_function_decl));
     18725   if (dump_file && (dump_flags & TDF_DETAILS))
     18726diff -Naur gcc-4.4.0.orig/gcc/tree-ssa-loop-niter.c gcc-4.4.0/gcc/tree-ssa-loop-niter.c
     18727--- gcc-4.4.0.orig/gcc/tree-ssa-loop-niter.c    2009-03-16 09:07:07.000000000 -0700
     18728+++ gcc-4.4.0/gcc/tree-ssa-loop-niter.c 2009-05-22 13:43:39.000000000 -0700
     18729@@ -534,7 +534,7 @@
     18730 }
     18731 
     18732 /* Derives the upper bound BND on the number of executions of loop with exit
     18733-   condition S * i <> C, assuming that the loop is not infinite.  If
     18734+   condition S * i <> C, assuming that this exit is taken.  If
     18735    NO_OVERFLOW is true, then the control variable of the loop does not
     18736    overflow.  If NO_OVERFLOW is true or BNDS.below >= 0, then BNDS.up
     18737    contains the upper bound on the value of C.  */
     18738@@ -574,7 +574,7 @@
     18739 
     18740 /* Determines number of iterations of loop whose ending condition
     18741    is IV <> FINAL.  TYPE is the type of the iv.  The number of
     18742-   iterations is stored to NITER.  NEVER_INFINITE is true if
     18743+   iterations is stored to NITER.  EXIT_MUST_BE_TAKEN is true if
     18744    we know that the exit must be taken eventually, i.e., that the IV
     18745    ever reaches the value FINAL (we derived this earlier, and possibly set
     18746    NITER->assumptions to make sure this is the case).  BNDS contains the
     18747@@ -582,7 +582,7 @@
     18748 
     18749 static bool
     18750 number_of_iterations_ne (tree type, affine_iv *iv, tree final,
     18751-                        struct tree_niter_desc *niter, bool never_infinite,
     18752+                        struct tree_niter_desc *niter, bool exit_must_be_taken,
     18753                         bounds *bnds)
     18754 {
     18755   tree niter_type = unsigned_type_for (type);
     18756@@ -639,9 +639,9 @@
     18757                               build_int_cst (niter_type, 1), bits);
     18758   s = fold_binary_to_constant (RSHIFT_EXPR, niter_type, s, bits);
     18759 
     18760-  if (!never_infinite)
     18761+  if (!exit_must_be_taken)
     18762     {
     18763-      /* If we cannot assume that the loop is not infinite, record the
     18764+      /* If we cannot assume that the exit is taken eventually, record the
     18765         assumptions for divisibility of c.  */
     18766       assumption = fold_build2 (FLOOR_MOD_EXPR, niter_type, c, d);
     18767       assumption = fold_build2 (EQ_EXPR, boolean_type_node,
     18768@@ -664,20 +664,21 @@
     18769    of the final value does not overflow are recorded in NITER.  If we
     18770    find the final value, we adjust DELTA and return TRUE.  Otherwise
     18771    we return false.  BNDS bounds the value of IV1->base - IV0->base,
     18772-   and will be updated by the same amount as DELTA.  */
     18773+   and will be updated by the same amount as DELTA.  EXIT_MUST_BE_TAKEN is
     18774+   true if we know that the exit must be taken eventually.  */
     18775 
     18776 static bool
     18777 number_of_iterations_lt_to_ne (tree type, affine_iv *iv0, affine_iv *iv1,
     18778                               struct tree_niter_desc *niter,
     18779                               tree *delta, tree step,
     18780-                              bounds *bnds)
     18781+                              bool exit_must_be_taken, bounds *bnds)
     18782 {
     18783   tree niter_type = TREE_TYPE (step);
     18784   tree mod = fold_build2 (FLOOR_MOD_EXPR, niter_type, *delta, step);
     18785   tree tmod;
     18786   mpz_t mmod;
     18787   tree assumption = boolean_true_node, bound, noloop;
     18788-  bool ret = false;
     18789+  bool ret = false, fv_comp_no_overflow;
     18790   tree type1 = type;
     18791   if (POINTER_TYPE_P (type))
     18792     type1 = sizetype;
     18793@@ -692,17 +693,31 @@
     18794   mpz_set_double_int (mmod, tree_to_double_int (mod), true);
     18795   mpz_neg (mmod, mmod);
     18796 
     18797+  /* If the induction variable does not overflow and the exit is taken,
     18798+     then the computation of the final value does not overflow.  This is
     18799+     also obviously the case if the new final value is equal to the
     18800+     current one.  Finally, we postulate this for pointer type variables,
     18801+     as the code cannot rely on the object to that the pointer points being
     18802+     placed at the end of the address space (and more pragmatically,
     18803+     TYPE_{MIN,MAX}_VALUE is not defined for pointers).  */
     18804+  if (integer_zerop (mod) || POINTER_TYPE_P (type))
     18805+    fv_comp_no_overflow = true;
     18806+  else if (!exit_must_be_taken)
     18807+    fv_comp_no_overflow = false;
     18808+  else
     18809+    fv_comp_no_overflow =
     18810+           (iv0->no_overflow && integer_nonzerop (iv0->step))
     18811+           || (iv1->no_overflow && integer_nonzerop (iv1->step));
     18812+
     18813   if (integer_nonzerop (iv0->step))
     18814     {
     18815       /* The final value of the iv is iv1->base + MOD, assuming that this
     18816         computation does not overflow, and that
     18817         iv0->base <= iv1->base + MOD.  */
     18818-      if (!iv0->no_overflow && !integer_zerop (mod))
     18819+      if (!fv_comp_no_overflow)
     18820        {
     18821          bound = fold_build2 (MINUS_EXPR, type1,
     18822                               TYPE_MAX_VALUE (type1), tmod);
     18823-         if (POINTER_TYPE_P (type))
     18824-           bound = fold_convert (type, bound);
     18825          assumption = fold_build2 (LE_EXPR, boolean_type_node,
     18826                                    iv1->base, bound);
     18827          if (integer_zerop (assumption))
     18828@@ -726,12 +741,10 @@
     18829       /* The final value of the iv is iv0->base - MOD, assuming that this
     18830         computation does not overflow, and that
     18831         iv0->base - MOD <= iv1->base. */
     18832-      if (!iv1->no_overflow && !integer_zerop (mod))
     18833+      if (!fv_comp_no_overflow)
     18834        {
     18835          bound = fold_build2 (PLUS_EXPR, type1,
     18836                               TYPE_MIN_VALUE (type1), tmod);
     18837-         if (POINTER_TYPE_P (type))
     18838-           bound = fold_convert (type, bound);
     18839          assumption = fold_build2 (GE_EXPR, boolean_type_node,
     18840                                    iv0->base, bound);
     18841          if (integer_zerop (assumption))
     18842@@ -969,13 +982,13 @@
     18843 /* Determines number of iterations of loop whose ending condition
     18844    is IV0 < IV1.  TYPE is the type of the iv.  The number of
     18845    iterations is stored to NITER.  BNDS bounds the difference
     18846-   IV1->base - IV0->base.  */
     18847+   IV1->base - IV0->base.  EXIT_MUST_BE_TAKEN is true if we know
     18848+   that the exit must be taken eventually.  */
     18849 
     18850 static bool
     18851 number_of_iterations_lt (tree type, affine_iv *iv0, affine_iv *iv1,
     18852                         struct tree_niter_desc *niter,
     18853-                        bool never_infinite ATTRIBUTE_UNUSED,
     18854-                        bounds *bnds)
     18855+                        bool exit_must_be_taken, bounds *bnds)
     18856 {
     18857   tree niter_type = unsigned_type_for (type);
     18858   tree delta, step, s;
     18859@@ -1034,7 +1047,7 @@
     18860      transform the condition to != comparison.  In particular, this will be
     18861      the case if DELTA is constant.  */
     18862   if (number_of_iterations_lt_to_ne (type, iv0, iv1, niter, &delta, step,
     18863-                                    bnds))
     18864+                                    exit_must_be_taken, bnds))
     18865     {
     18866       affine_iv zps;
     18867 
     18868@@ -1076,14 +1089,14 @@
     18869 
     18870 /* Determines number of iterations of loop whose ending condition
     18871    is IV0 <= IV1.  TYPE is the type of the iv.  The number of
     18872-   iterations is stored to NITER.  NEVER_INFINITE is true if
     18873+   iterations is stored to NITER.  EXIT_MUST_BE_TAKEN is true if
     18874    we know that this condition must eventually become false (we derived this
     18875    earlier, and possibly set NITER->assumptions to make sure this
     18876    is the case).  BNDS bounds the difference IV1->base - IV0->base.  */
     18877 
     18878 static bool
     18879 number_of_iterations_le (tree type, affine_iv *iv0, affine_iv *iv1,
     18880-                        struct tree_niter_desc *niter, bool never_infinite,
     18881+                        struct tree_niter_desc *niter, bool exit_must_be_taken,
     18882                         bounds *bnds)
     18883 {
     18884   tree assumption;
     18885@@ -1094,9 +1107,13 @@
     18886   /* Say that IV0 is the control variable.  Then IV0 <= IV1 iff
     18887      IV0 < IV1 + 1, assuming that IV1 is not equal to the greatest
     18888      value of the type.  This we must know anyway, since if it is
     18889-     equal to this value, the loop rolls forever.  */
     18890+     equal to this value, the loop rolls forever.  We do not check
     18891+     this condition for pointer type ivs, as the code cannot rely on
     18892+     the object to that the pointer points being placed at the end of
     18893+     the address space (and more pragmatically, TYPE_{MIN,MAX}_VALUE is
     18894+     not defined for pointers).  */
     18895 
     18896-  if (!never_infinite)
     18897+  if (!exit_must_be_taken && !POINTER_TYPE_P (type))
     18898     {
     18899       if (integer_nonzerop (iv0->step))
     18900        assumption = fold_build2 (NE_EXPR, boolean_type_node,
     18901@@ -1131,7 +1148,8 @@
     18902 
     18903   bounds_add (bnds, double_int_one, type1);
     18904 
     18905-  return number_of_iterations_lt (type, iv0, iv1, niter, never_infinite, bnds);
     18906+  return number_of_iterations_lt (type, iv0, iv1, niter, exit_must_be_taken,
     18907+                                 bnds);
     18908 }
     18909 
     18910 /* Dumps description of affine induction variable IV to FILE.  */
     18911@@ -1177,7 +1195,7 @@
     18912                           affine_iv *iv1, struct tree_niter_desc *niter,
     18913                           bool only_exit)
     18914 {
     18915-  bool never_infinite, ret;
     18916+  bool exit_must_be_taken = false, ret;
     18917   bounds bnds;
     18918 
     18919   /* The meaning of these assumptions is this:
     18920@@ -1202,42 +1220,27 @@
     18921       code = swap_tree_comparison (code);
     18922     }
     18923 
     18924-  if (!only_exit)
     18925-    {
     18926-      /* If this is not the only possible exit from the loop, the information
     18927-        that the induction variables cannot overflow as derived from
     18928-        signedness analysis cannot be relied upon.  We use them e.g. in the
     18929-        following way:  given loop for (i = 0; i <= n; i++), if i is
     18930-        signed, it cannot overflow, thus this loop is equivalent to
     18931-        for (i = 0; i < n + 1; i++);  however, if n == MAX, but the loop
     18932-        is exited in some other way before i overflows, this transformation
     18933-        is incorrect (the new loop exits immediately).  */
     18934-      iv0->no_overflow = false;
     18935-      iv1->no_overflow = false;
     18936-    }
     18937-
     18938   if (POINTER_TYPE_P (type))
     18939     {
     18940       /* Comparison of pointers is undefined unless both iv0 and iv1 point
     18941         to the same object.  If they do, the control variable cannot wrap
     18942         (as wrap around the bounds of memory will never return a pointer
     18943         that would be guaranteed to point to the same object, even if we
     18944-        avoid undefined behavior by casting to size_t and back).  The
     18945-        restrictions on pointer arithmetics and comparisons of pointers
     18946-        ensure that using the no-overflow assumptions is correct in this
     18947-        case even if ONLY_EXIT is false.  */
     18948+        avoid undefined behavior by casting to size_t and back).  */
     18949       iv0->no_overflow = true;
     18950       iv1->no_overflow = true;
     18951     }
     18952 
     18953-  /* If the control induction variable does not overflow, the loop obviously
     18954-     cannot be infinite.  */
     18955-  if (!integer_zerop (iv0->step) && iv0->no_overflow)
     18956-    never_infinite = true;
     18957-  else if (!integer_zerop (iv1->step) && iv1->no_overflow)
     18958-    never_infinite = true;
     18959-  else
     18960-    never_infinite = false;
     18961+  /* If the control induction variable does not overflow and the only exit
     18962+     from the loop is the one that we analyze, we know it must be taken
     18963+     eventually.  */
     18964+  if (only_exit)
     18965+    {
     18966+      if (!integer_zerop (iv0->step) && iv0->no_overflow)
     18967+       exit_must_be_taken = true;
     18968+      else if (!integer_zerop (iv1->step) && iv1->no_overflow)
     18969+       exit_must_be_taken = true;
     18970+    }
     18971 
     18972   /* We can handle the case when neither of the sides of the comparison is
     18973      invariant, provided that the test is NE_EXPR.  This rarely occurs in
     18974@@ -1308,16 +1311,16 @@
     18975     case NE_EXPR:
     18976       gcc_assert (integer_zerop (iv1->step));
     18977       ret = number_of_iterations_ne (type, iv0, iv1->base, niter,
     18978-                                    never_infinite, &bnds);
     18979+                                    exit_must_be_taken, &bnds);
     18980       break;
     18981 
     18982     case LT_EXPR:
     18983-      ret = number_of_iterations_lt (type, iv0, iv1, niter, never_infinite,
     18984+      ret = number_of_iterations_lt (type, iv0, iv1, niter, exit_must_be_taken,
     18985                                     &bnds);
     18986       break;
     18987 
     18988     case LE_EXPR:
     18989-      ret = number_of_iterations_le (type, iv0, iv1, niter, never_infinite,
     18990+      ret = number_of_iterations_le (type, iv0, iv1, niter, exit_must_be_taken,
     18991                                     &bnds);
     18992       break;
     18993 
     18994diff -Naur gcc-4.4.0.orig/gcc/tree-ssa-phiprop.c gcc-4.4.0/gcc/tree-ssa-phiprop.c
     18995--- gcc-4.4.0.orig/gcc/tree-ssa-phiprop.c       2008-09-11 14:48:11.000000000 -0700
     18996+++ gcc-4.4.0/gcc/tree-ssa-phiprop.c    2009-05-06 01:32:24.000000000 -0700
     18997@@ -119,8 +119,7 @@
     18998       FOR_EACH_IMM_USE_STMT (use_stmt, ui2, vuse)
     18999        {
     19000          /* If BB does not dominate a VDEF, the value is invalid.  */
     19001-         if (((is_gimple_assign (use_stmt)
     19002-               && !ZERO_SSA_OPERANDS (use_stmt, SSA_OP_VDEF))
     19003+         if ((!ZERO_SSA_OPERANDS (use_stmt, SSA_OP_VDEF)
     19004               || gimple_code (use_stmt) == GIMPLE_PHI)
     19005              && !dominated_by_p (CDI_DOMINATORS, gimple_bb (use_stmt), bb))
     19006            {
     19007diff -Naur gcc-4.4.0.orig/gcc/tree-ssa-sccvn.c gcc-4.4.0/gcc/tree-ssa-sccvn.c
     19008--- gcc-4.4.0.orig/gcc/tree-ssa-sccvn.c 2009-04-11 00:42:52.000000000 -0700
     19009+++ gcc-4.4.0/gcc/tree-ssa-sccvn.c      2009-05-18 03:13:43.000000000 -0700
     19010@@ -1293,7 +1293,7 @@
     19011     *vnresult = NULL;
     19012   vno1.opcode = gimple_assign_rhs_code (stmt);
     19013   vno1.length = gimple_num_ops (stmt) - 1;
     19014-  vno1.type = TREE_TYPE (gimple_assign_lhs (stmt));
     19015+  vno1.type = gimple_expr_type (stmt);
     19016   for (i = 0; i < vno1.length; ++i)
     19017     vno1.op[i] = gimple_op (stmt, i + 1);
     19018   if (vno1.opcode == REALPART_EXPR
     19019@@ -1401,7 +1401,7 @@
     19020   vno1->value_id = VN_INFO (result)->value_id;
     19021   vno1->opcode = gimple_assign_rhs_code (stmt);
     19022   vno1->length = length;
     19023-  vno1->type = TREE_TYPE (gimple_assign_lhs (stmt));
     19024+  vno1->type = gimple_expr_type (stmt);
     19025   for (i = 0; i < vno1->length; ++i)
     19026     vno1->op[i] = gimple_op (stmt, i + 1);
     19027   if (vno1->opcode == REALPART_EXPR
     19028@@ -2142,7 +2142,7 @@
     19029   fold_defer_overflow_warnings ();
     19030 
     19031   result = fold_binary (gimple_assign_rhs_code (stmt),
     19032-                       TREE_TYPE (gimple_get_lhs (stmt)), op0, op1);
     19033+                       gimple_expr_type (stmt), op0, op1);
     19034   if (result)
     19035     STRIP_USELESS_TYPE_CONVERSION (result);
     19036 
     19037diff -Naur gcc-4.4.0.orig/gcc/tree-vect-analyze.c gcc-4.4.0/gcc/tree-vect-analyze.c
     19038--- gcc-4.4.0.orig/gcc/tree-vect-analyze.c      2009-04-02 11:08:10.000000000 -0700
     19039+++ gcc-4.4.0/gcc/tree-vect-analyze.c   2009-05-11 06:55:36.000000000 -0700
     19040@@ -2187,7 +2187,7 @@
     19041       tree next_step;
     19042       tree prev_init = DR_INIT (data_ref);
     19043       gimple prev = stmt;
     19044-      HOST_WIDE_INT diff, count_in_bytes;
     19045+      HOST_WIDE_INT diff, count_in_bytes, gaps = 0;
     19046 
     19047       while (next)
     19048         {
     19049@@ -2249,6 +2249,8 @@
     19050                    fprintf (vect_dump, "interleaved store with gaps");
     19051                  return false;
     19052                }
     19053+
     19054+              gaps += diff - 1;
     19055            }
     19056 
     19057           /* Store the gap from the previous member of the group. If there is no
     19058@@ -2265,8 +2267,9 @@
     19059          the type to get COUNT_IN_BYTES.  */
     19060       count_in_bytes = type_size * count;
     19061 
     19062-      /* Check that the size of the interleaving is not greater than STEP.  */
     19063-      if (dr_step < count_in_bytes)
     19064+      /* Check that the size of the interleaving (including gaps) is not greater
     19065+         than STEP.  */
     19066+      if (dr_step && dr_step < count_in_bytes + gaps * type_size)
     19067         {
     19068           if (vect_print_dump_info (REPORT_DETAILS))
     19069             {
    1442819070diff -Naur gcc-4.4.0.orig/gcc/version.c gcc-4.4.0/gcc/version.c
    1442919071--- gcc-4.4.0.orig/gcc/version.c        2007-08-21 08:35:30.000000000 -0700
    14430 +++ gcc-4.4.0/gcc/version.c     2009-04-29 14:17:15.000000000 -0700
     19072+++ gcc-4.4.0/gcc/version.c     2009-06-05 09:55:18.000000000 -0700
    1443119073@@ -14,4 +14,4 @@
    1443219074    Makefile.  */
     
    1443419076 const char version_string[] = BASEVER DATESTAMP DEVPHASE REVISION;
    1443519077-const char pkgversion_string[] = PKGVERSION;
    14436 +const char pkgversion_string[] = "(GCC for Cross-LFS 4.4.0.20090429) ";
    14437 diff -Naur gcc-4.4.0.orig/libcpp/po/ChangeLog gcc-4.4.0/libcpp/po/ChangeLog
    14438 --- gcc-4.4.0.orig/libcpp/po/ChangeLog  2009-04-21 01:47:21.000000000 -0700
    14439 +++ gcc-4.4.0/libcpp/po/ChangeLog       2009-04-22 09:35:05.000000000 -0700
    14440 @@ -1,3 +1,7 @@
    14441 +2009-04-22  Joseph Myers  <joseph@codesourcery.com>
    14442 +
    14443 +       * cpplib.pot: Regenerate.
    14444 +
    14445  2009-04-21  Release Manager
    14446  
    14447         * GCC 4.4.0 released.
     19078+const char pkgversion_string[] = "(GCC for Cross-LFS 4.4.0.20090605) ";
     19079diff -Naur gcc-4.4.0.orig/gnattools/Makefile.in gcc-4.4.0/gnattools/Makefile.in
     19080--- gcc-4.4.0.orig/gnattools/Makefile.in        2009-04-09 16:23:07.000000000 -0700
     19081+++ gcc-4.4.0/gnattools/Makefile.in     2009-05-18 00:41:14.000000000 -0700
     19082@@ -164,7 +164,7 @@
     19083        -(cd $(GCC_DIR)/ada/tools; $(LN_S) ../sdefault.adb .)
     19084        -$(foreach PAIR,$(TOOLS_TARGET_PAIRS), \
     19085                  rm -f $(GCC_DIR)/ada/tools/$(word 1,$(subst <, ,$(PAIR)));\
     19086-                 $(LN_S) $(fsrcdir)/$(word 2,$(subst <, ,$(PAIR))) \
     19087+                 $(LN_S) $(fsrcdir)/ada/$(word 2,$(subst <, ,$(PAIR))) \
     19088                        $(GCC_DIR)/ada/tools/$(word 1,$(subst <, ,$(PAIR)));)
     19089        touch $(GCC_DIR)/stamp-tools
     19090 
    1444819091diff -Naur gcc-4.4.0.orig/libcpp/po/cpplib.pot gcc-4.4.0/libcpp/po/cpplib.pot
    1444919092--- gcc-4.4.0.orig/libcpp/po/cpplib.pot 2009-03-28 00:26:17.000000000 -0700
     
    1497819621 msgid "syntax error in macro parameter list"
    1497919622 msgstr ""
    14980 diff -Naur gcc-4.4.0.orig/libjava/ChangeLog gcc-4.4.0/libjava/ChangeLog
    14981 --- gcc-4.4.0.orig/libjava/ChangeLog    2009-04-21 01:48:20.000000000 -0700
    14982 +++ gcc-4.4.0/libjava/ChangeLog 2009-04-28 05:51:10.000000000 -0700
    14983 @@ -1,3 +1,27 @@
    14984 +2009-04-28  Andrew Haley  <aph@redhat.com>
    14985 +
    14986 +       PR libgcj/39899
    14987 +       * Makefile.am (libgcj_tools_la_LDFLAGS): Add
    14988 +       -fno-bootstrap-classes to libgcj_tools_la_GCJFLAGS.
    14989 +       * Makefile.in: Regenerate.
    14990 +
    14991 +2009-04-26  Matthias Klose <doko@ubuntu.com>
    14992 +
    14993 +       * contrib/aot-compile.in: Print diagnostics for malformed or invalid
    14994 +       class files.
    14995 +       * contrib/generate-cacerts.pl.in: New.
    14996 +       * configure.ac (AC_CONFIG_FILES): Add generate-cacerts.pl.
    14997 +
    14998 +2009-04-24  Matthias Klose  <doko@ubuntu.com>
    14999 +
    15000 +       * configure.ac: Create missing directory gnu/java/security/jce/prng.
    15001 +       * configure: Regenerate.
    15002 +
    15003 +2009-04-23  Matthias Klose  <doko@ubuntu.com>
    15004 +
    15005 +       * Makefile.am (install-data-local): Fix symlinks to header files.
    15006 +       * Makefile.in: Regenerate.
    15007 +
    15008  2009-04-21  Release Manager
    15009  
    15010         * GCC 4.4.0 released.
     19623diff -Naur gcc-4.4.0.orig/libgfortran/gfortran.map gcc-4.4.0/libgfortran/gfortran.map
     19624--- gcc-4.4.0.orig/libgfortran/gfortran.map     2008-07-27 03:45:44.000000000 -0700
     19625+++ gcc-4.4.0/libgfortran/gfortran.map  2009-06-03 12:39:09.000000000 -0700
     19626@@ -1090,6 +1090,13 @@
     19627     _gfortran_unpack1_char4;
     19628 } GFORTRAN_1.0;
     19629 
     19630+
     19631+GFORTRAN_1.2 {
     19632+  global:
     19633+    _gfortran_clz128;
     19634+    _gfortran_ctz128;
     19635+} GFORTRAN_1.1;
     19636+
     19637 F2C_1.0 {
     19638   global:
     19639     _gfortran_f2c_specific__abs_c4;
     19640diff -Naur gcc-4.4.0.orig/libgfortran/intrinsics/bit_intrinsics.c gcc-4.4.0/libgfortran/intrinsics/bit_intrinsics.c
     19641--- gcc-4.4.0.orig/libgfortran/intrinsics/bit_intrinsics.c      1969-12-31 16:00:00.000000000 -0800
     19642+++ gcc-4.4.0/libgfortran/intrinsics/bit_intrinsics.c   2009-06-03 12:39:09.000000000 -0700
     19643@@ -0,0 +1,138 @@
     19644+/* Implementation of the bit intrinsics not implemented as GCC builtins.
     19645+   Copyright (C) 2009 Free Software Foundation, Inc.
     19646+
     19647+This file is part of the GNU Fortran runtime library (libgfortran).
     19648+
     19649+Libgfortran is free software; you can redistribute it and/or
     19650+modify it under the terms of the GNU General Public
     19651+License as published by the Free Software Foundation; either
     19652+version 3 of the License, or (at your option) any later version.
     19653+
     19654+Libgfortran is distributed in the hope that it will be useful,
     19655+but WITHOUT ANY WARRANTY; without even the implied warranty of
     19656+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     19657+GNU General Public License for more details.
     19658+
     19659+Under Section 7 of GPL version 3, you are granted additional
     19660+permissions described in the GCC Runtime Library Exception, version
     19661+3.1, as published by the Free Software Foundation.
     19662+
     19663+You should have received a copy of the GNU General Public License and
     19664+a copy of the GCC Runtime Library Exception along with this program;
     19665+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
     19666+<http://www.gnu.org/licenses/>.  */
     19667+
     19668+#include "libgfortran.h"
     19669+
     19670+
     19671+#ifdef HAVE_GFC_INTEGER_16
     19672+extern int clz128 (GFC_INTEGER_16);
     19673+export_proto(clz128);
     19674+
     19675+int
     19676+clz128 (GFC_INTEGER_16 x)
     19677+{
     19678+  int res = 127;
     19679+
     19680+  // We can't write 0xFFFFFFFFFFFFFFFF0000000000000000, so we work around it
     19681+  if (x & ((__uint128_t) 0xFFFFFFFFFFFFFFFF << 64))
     19682+    {
     19683+      res -= 64;
     19684+      x >>= 64;
     19685+    }
     19686+
     19687+  if (x & 0xFFFFFFFF00000000)
     19688+    {
     19689+      res -= 32;
     19690+      x >>= 32;
     19691+    }
     19692+
     19693+  if (x & 0xFFFF0000)
     19694+    {
     19695+      res -= 16;
     19696+      x >>= 16;
     19697+    }
     19698+
     19699+  if (x & 0xFF00)
     19700+    {
     19701+      res -= 8;
     19702+      x >>= 8;
     19703+    }
     19704+
     19705+  if (x & 0xF0)
     19706+    {
     19707+      res -= 4;
     19708+      x >>= 4;
     19709+    }
     19710+
     19711+  if (x & 0xC)
     19712+    {
     19713+      res -= 2;
     19714+      x >>= 2;
     19715+    }
     19716+
     19717+  if (x & 0x2)
     19718+    {
     19719+      res -= 1;
     19720+      x >>= 1;
     19721+    }
     19722+
     19723+  return res;
     19724+}
     19725+#endif
     19726+
     19727+
     19728+#ifdef HAVE_GFC_INTEGER_16
     19729+extern int ctz128 (GFC_INTEGER_16);
     19730+export_proto(ctz128);
     19731+
     19732+int
     19733+ctz128 (GFC_INTEGER_16 x)
     19734+{
     19735+  int res = 0;
     19736+
     19737+  if ((x & 0xFFFFFFFFFFFFFFFF) == 0)
     19738+    {
     19739+      res += 64;
     19740+      x >>= 64;
     19741+    }
     19742+
     19743+  if ((x & 0xFFFFFFFF) == 0)
     19744+    {
     19745+      res += 32;
     19746+      x >>= 32;
     19747+    }
     19748+
     19749+  if ((x & 0xFFFF) == 0)
     19750+    {
     19751+      res += 16;
     19752+      x >>= 16;
     19753+    }
     19754+
     19755+  if ((x & 0xFF) == 0)
     19756+    {
     19757+      res += 8;
     19758+      x >>= 8;
     19759+    }
     19760+
     19761+  if ((x & 0xF) == 0)
     19762+    {
     19763+      res += 4;
     19764+      x >>= 4;
     19765+    }
     19766+
     19767+  if ((x & 0x3) == 0)
     19768+    {
     19769+      res += 2;
     19770+      x >>= 2;
     19771+    }
     19772+
     19773+  if ((x & 0x1) == 0)
     19774+    {
     19775+      res += 1;
     19776+      x >>= 1;
     19777+    }
     19778+
     19779+  return res;
     19780+}
     19781+#endif
     19782diff -Naur gcc-4.4.0.orig/libgfortran/io/fbuf.c gcc-4.4.0/libgfortran/io/fbuf.c
     19783--- gcc-4.4.0.orig/libgfortran/io/fbuf.c        2009-04-09 16:23:07.000000000 -0700
     19784+++ gcc-4.4.0/libgfortran/io/fbuf.c     2009-05-26 18:21:22.000000000 -0700
     19785@@ -28,8 +28,11 @@
     19786 #include <stdlib.h>
     19787 
     19788 
     19789+//#define FBUF_DEBUG
     19790+
     19791+
     19792 void
     19793-fbuf_init (gfc_unit * u, size_t len)
     19794+fbuf_init (gfc_unit * u, int len)
     19795 {
     19796   if (len == 0)
     19797     len = 512;                 /* Default size.  */
     19798@@ -37,14 +40,7 @@
     19799   u->fbuf = get_mem (sizeof (fbuf));
     19800   u->fbuf->buf = get_mem (len);
     19801   u->fbuf->len = len;
     19802-  u->fbuf->act = u->fbuf->flushed = u->fbuf->pos = 0;
     19803-}
     19804-
     19805-
     19806-void
     19807-fbuf_reset (gfc_unit * u)
     19808-{
     19809-  u->fbuf->act = u->fbuf->flushed = u->fbuf->pos = 0;
     19810+  u->fbuf->act = u->fbuf->pos = 0;
     19811 }
     19812 
     19813 
     19814@@ -56,58 +52,79 @@
     19815   if (u->fbuf->buf)
     19816     free_mem (u->fbuf->buf);
     19817   free_mem (u->fbuf);
     19818+  u->fbuf = NULL;
     19819+}
     19820+
     19821+
     19822+static void
     19823+#ifdef FBUF_DEBUG
     19824+fbuf_debug (gfc_unit * u, const char * format, ...)
     19825+{
     19826+  va_list args;
     19827+  va_start(args, format);
     19828+  vfprintf(stderr, format, args);
     19829+  va_end(args);
     19830+  fprintf (stderr, "fbuf_debug pos: %d, act: %d, buf: ''",
     19831+           u->fbuf->pos, u->fbuf->act);
     19832+  for (int ii = 0; ii < u->fbuf->act; ii++)
     19833+    {
     19834+      putc (u->fbuf->buf[ii], stderr);
     19835+    }
     19836+  fprintf (stderr, "''\n");
     19837+}
     19838+#else
     19839+fbuf_debug (gfc_unit * u __attribute__ ((unused)),
     19840+            const char * format __attribute__ ((unused)),
     19841+            ...) {}
     19842+#endif
     19843+
     19844
     19845+
     19846+/* You should probably call this before doing a physical seek on the
     19847+   underlying device.  Returns how much the physical position was
     19848+   modified.  */
     19849+
     19850+int
     19851+fbuf_reset (gfc_unit * u)
     19852+{
     19853+  int seekval = 0;
     19854+
     19855+  if (!u->fbuf)
     19856+    return 0;
     19857+
     19858+  fbuf_debug (u, "fbuf_reset: ");
     19859+  fbuf_flush (u, u->mode);
     19860+  /* If we read past the current position, seek the underlying device
     19861+     back.  */
     19862+  if (u->mode == READING && u->fbuf->act > u->fbuf->pos)
     19863+    {
     19864+      seekval = - (u->fbuf->act - u->fbuf->pos);
     19865+      fbuf_debug (u, "fbuf_reset seekval %d, ", seekval);
     19866+    }
     19867+  u->fbuf->act = u->fbuf->pos = 0;
     19868+  return seekval;
     19869 }
     19870 
     19871 
     19872 /* Return a pointer to the current position in the buffer, and increase
     19873    the pointer by len. Makes sure that the buffer is big enough,
     19874-   reallocating if necessary. If the buffer is not big enough, there are
     19875-   three cases to consider:
     19876-   1. If we haven't flushed anything, realloc
     19877-   2. If we have flushed enough that by discarding the flushed bytes
     19878-      the request fits into the buffer, do that.
     19879-   3. Else allocate a new buffer, memcpy unflushed active bytes from old
     19880-      buffer. */
     19881+   reallocating if necessary.  */
     19882 
     19883 char *
     19884-fbuf_alloc (gfc_unit * u, size_t len)
     19885+fbuf_alloc (gfc_unit * u, int len)
     19886 {
     19887-  size_t newlen;
     19888+  int newlen;
     19889   char *dest;
     19890+  fbuf_debug (u, "fbuf_alloc len %d, ", len);
     19891   if (u->fbuf->pos + len > u->fbuf->len)
     19892     {
     19893-      if (u->fbuf->flushed == 0)
     19894-       {
     19895-         /* Round up to nearest multiple of the current buffer length.  */
     19896-         newlen = ((u->fbuf->pos + len) / u->fbuf->len + 1) * u->fbuf->len;
     19897-         dest = realloc (u->fbuf->buf, newlen);
     19898-         if (dest == NULL)
     19899-           return NULL;
     19900-         u->fbuf->buf = dest;
     19901-         u->fbuf->len = newlen;
     19902-       }
     19903-      else if (u->fbuf->act - u->fbuf->flushed + len < u->fbuf->len)
     19904-       {
     19905-         memmove (u->fbuf->buf, u->fbuf->buf + u->fbuf->flushed,
     19906-                  u->fbuf->act - u->fbuf->flushed);
     19907-         u->fbuf->act -= u->fbuf->flushed;
     19908-         u->fbuf->pos -= u->fbuf->flushed;
     19909-         u->fbuf->flushed = 0;
     19910-       }
     19911-      else
     19912-       {
     19913-         /* Most general case, flushed != 0, request doesn't fit.  */
     19914-         newlen = ((u->fbuf->pos - u->fbuf->flushed + len)
     19915-                   / u->fbuf->len + 1) * u->fbuf->len;
     19916-         dest = get_mem (newlen);
     19917-         memcpy (dest, u->fbuf->buf + u->fbuf->flushed,
     19918-                 u->fbuf->act - u->fbuf->flushed);
     19919-         u->fbuf->act -= u->fbuf->flushed;
     19920-         u->fbuf->pos -= u->fbuf->flushed;
     19921-         u->fbuf->flushed = 0;
     19922-         u->fbuf->buf = dest;
     19923-         u->fbuf->len = newlen;
     19924-       }
     19925+      /* Round up to nearest multiple of the current buffer length.  */
     19926+      newlen = ((u->fbuf->pos + len) / u->fbuf->len + 1) * u->fbuf->len;
     19927+      dest = realloc (u->fbuf->buf, newlen);
     19928+      if (dest == NULL)
     19929+       return NULL;
     19930+      u->fbuf->buf = dest;
     19931+      u->fbuf->len = newlen;
     19932     }
     19933 
     19934   dest = u->fbuf->buf + u->fbuf->pos;
     19935@@ -118,42 +135,134 @@
     19936 }
     19937 
     19938 
     19939-
     19940+/* mode argument is WRITING for write mode and READING for read
     19941+   mode. Return value is 0 for success, -1 on failure.  */
     19942 
     19943 int
     19944-fbuf_flush (gfc_unit * u, int record_done)
     19945+fbuf_flush (gfc_unit * u, unit_mode mode)
     19946 {
     19947-  int status;
     19948-  size_t nbytes;
     19949+  int nwritten;
     19950 
     19951   if (!u->fbuf)
     19952     return 0;
     19953-  if (u->fbuf->act - u->fbuf->flushed != 0)
     19954+
     19955+  fbuf_debug (u, "fbuf_flush with mode %d: ", mode);
     19956+
     19957+  if (mode == WRITING)
     19958     {
     19959-      if (record_done)
     19960-        nbytes = u->fbuf->act - u->fbuf->flushed;
     19961-      else     
     19962-        nbytes = u->fbuf->pos - u->fbuf->flushed;     
     19963-      status = swrite (u->s, u->fbuf->buf + u->fbuf->flushed, &nbytes);
     19964-      u->fbuf->flushed += nbytes;
     19965+      if (u->fbuf->pos > 0)
     19966+       {
     19967+         nwritten = swrite (u->s, u->fbuf->buf, u->fbuf->pos);
     19968+         if (nwritten < 0)
     19969+           return -1;
     19970+       }
     19971     }
     19972-  else
     19973-    status = 0;
     19974-  if (record_done)
     19975-    fbuf_reset (u);
     19976-  return status;
     19977+  /* Salvage remaining bytes for both reading and writing. This
     19978+     happens with the combination of advance='no' and T edit
     19979+     descriptors leaving the final position somewhere not at the end
     19980+     of the record. For reading, this also happens if we sread() past
     19981+     the record boundary.  */
     19982+  if (u->fbuf->act > u->fbuf->pos && u->fbuf->pos > 0)
     19983+    memmove (u->fbuf->buf, u->fbuf->buf + u->fbuf->pos,
     19984+             u->fbuf->act - u->fbuf->pos);
     19985+
     19986+  u->fbuf->act -= u->fbuf->pos;
     19987+  u->fbuf->pos = 0;
     19988+
     19989+  return 0;
     19990 }
     19991 
     19992 
     19993 int
     19994-fbuf_seek (gfc_unit * u, gfc_offset off)
     19995+fbuf_seek (gfc_unit * u, int off, int whence)
     19996 {
     19997-  gfc_offset pos = u->fbuf->pos + off;
     19998-  /* Moving to the left past the flushed marked would imply moving past
     19999-     the left tab limit, which is never allowed. So return error if
     20000-     that is attempted.  */
     20001-  if (pos < (gfc_offset) u->fbuf->flushed)
     20002+  if (!u->fbuf)
     20003     return -1;
     20004-  u->fbuf->pos = pos;
     20005-  return 0;
     20006+
     20007+  switch (whence)
     20008+    {
     20009+    case SEEK_SET:
     20010+      break;
     20011+    case SEEK_CUR:
     20012+      off += u->fbuf->pos;
     20013+      break;
     20014+    case SEEK_END:
     20015+      off += u->fbuf->act;
     20016+      break;
     20017+    default:
     20018+      return -1;
     20019+    }
     20020+
     20021+  fbuf_debug (u, "fbuf_seek, off %d ", off);
     20022+  /* The start of the buffer is always equal to the left tab
     20023+     limit. Moving to the left past the buffer is illegal in C and
     20024+     would also imply moving past the left tab limit, which is never
     20025+     allowed in Fortran. Similarly, seeking past the end of the buffer
     20026+     is not possible, in that case the user must make sure to allocate
     20027+     space with fbuf_alloc().  So return error if that is
     20028+     attempted.  */
     20029+  if (off < 0 || off > u->fbuf->act)
     20030+    return -1;
     20031+  u->fbuf->pos = off;
     20032+  return off;
     20033+}
     20034+
     20035+
     20036+/* Fill the buffer with bytes for reading.  Returns a pointer to start
     20037+   reading from. If we hit EOF, returns a short read count. If any
     20038+   other error occurs, return NULL.  After reading, the caller is
     20039+   expected to call fbuf_seek to update the position with the number
     20040+   of bytes actually processed. */
     20041+
     20042+char *
     20043+fbuf_read (gfc_unit * u, int * len)
     20044+{
     20045+  char *ptr;
     20046+  int oldact, oldpos;
     20047+  int readlen = 0;
     20048+
     20049+  fbuf_debug (u, "fbuf_read, len %d: ", *len);
     20050+  oldact = u->fbuf->act;
     20051+  oldpos = u->fbuf->pos;
     20052+  ptr = fbuf_alloc (u, *len);
     20053+  u->fbuf->pos = oldpos;
     20054+  if (oldpos + *len > oldact)
     20055+    {
     20056+      fbuf_debug (u, "reading %d bytes starting at %d ",
     20057+                  oldpos + *len - oldact, oldact);
     20058+      readlen = sread (u->s, u->fbuf->buf + oldact, oldpos + *len - oldact);
     20059+      if (readlen < 0)
     20060+       return NULL;
     20061+      *len = oldact - oldpos + readlen;
     20062+    }
     20063+  u->fbuf->act = oldact + readlen;
     20064+  fbuf_debug (u, "fbuf_read done: ");
     20065+  return ptr;
     20066+}
     20067+
     20068+
     20069+/* When the fbuf_getc() inline function runs out of buffer space, it
     20070+   calls this function to fill the buffer with bytes for
     20071+   reading. Never call this function directly.  */
     20072+
     20073+int
     20074+fbuf_getc_refill (gfc_unit * u)
     20075+{
     20076+  int nread;
     20077+  char *p;
     20078+
     20079+  fbuf_debug (u, "fbuf_getc_refill ");
     20080+
     20081+  /* Read 80 bytes (average line length?).  This is a compromise
     20082+     between not needing to call the read() syscall all the time and
     20083+     not having to memmove unnecessary stuff when switching to the
     20084+     next record.  */
     20085+  nread = 80;
     20086+
     20087+  p = fbuf_read (u, &nread);
     20088+
     20089+  if (p && nread > 0)
     20090+    return (unsigned char) u->fbuf->buf[u->fbuf->pos++];
     20091+  else
     20092+    return EOF;
     20093 }
     20094diff -Naur gcc-4.4.0.orig/libgfortran/io/file_pos.c gcc-4.4.0/libgfortran/io/file_pos.c
     20095--- gcc-4.4.0.orig/libgfortran/io/file_pos.c    2009-04-09 16:23:07.000000000 -0700
     20096+++ gcc-4.4.0/libgfortran/io/file_pos.c 2009-05-26 18:21:22.000000000 -0700
     20097@@ -41,17 +41,17 @@
     20098 {
     20099   gfc_offset base;
     20100   char p[READ_CHUNK];
     20101-  size_t n;
     20102+  ssize_t n;
     20103 
     20104-  base = file_position (u->s) - 1;
     20105+  base = stell (u->s) - 1;
     20106 
     20107   do
     20108     {
     20109       n = (base < READ_CHUNK) ? base : READ_CHUNK;
     20110       base -= n;
     20111-      if (sseek (u->s, base) == FAILURE)
     20112+      if (sseek (u->s, base, SEEK_SET) < 0)
     20113         goto io_error;
     20114-      if (sread (u->s, p, &n) != 0)
     20115+      if (sread (u->s, p, n) != n)
     20116        goto io_error;
     20117 
     20118       /* We have moved backwards from the current position, it should
     20119@@ -76,7 +76,7 @@
     20120 
     20121   /* base is the new pointer.  Seek to it exactly.  */
     20122  done:
     20123-  if (sseek (u->s, base) == FAILURE)
     20124+  if (sseek (u->s, base, SEEK_SET) < 0)
     20125     goto io_error;
     20126   u->last_record--;
     20127   u->endfile = NO_ENDFILE;
     20128@@ -95,10 +95,10 @@
     20129 static void
     20130 unformatted_backspace (st_parameter_filepos *fpp, gfc_unit *u)
     20131 {
     20132-  gfc_offset m, new;
     20133+  gfc_offset m, slen;
     20134   GFC_INTEGER_4 m4;
     20135   GFC_INTEGER_8 m8;
     20136-  size_t length;
     20137+  ssize_t length;
     20138   int continued;
     20139   char p[sizeof (GFC_INTEGER_8)];
     20140 
     20141@@ -109,9 +109,10 @@
     20142 
     20143   do
     20144     {
     20145-      if (sseek (u->s, file_position (u->s) - length) == FAILURE)
     20146+      slen = - (gfc_offset) length;
     20147+      if (sseek (u->s, slen, SEEK_CUR) < 0)
     20148         goto io_error;
     20149-      if (sread (u->s, p, &length) != 0)
     20150+      if (sread (u->s, p, length) != length)
     20151         goto io_error;
     20152 
     20153       /* Only GFC_CONVERT_NATIVE and GFC_CONVERT_SWAP are valid here.  */
     20154@@ -159,10 +160,7 @@
     20155       if (continued)
     20156        m = -m;
     20157 
     20158-      if ((new = file_position (u->s) - m - 2*length) < 0)
     20159-       new = 0;
     20160-
     20161-      if (sseek (u->s, new) == FAILURE)
     20162+      if (sseek (u->s, -m -2 * length, SEEK_CUR) < 0)
     20163        goto io_error;
     20164     } while (continued);
     20165 
     20166@@ -201,15 +199,21 @@
     20167       goto done;
     20168     }
     20169 
     20170-    if (u->flags.access == ACCESS_STREAM && u->flags.form == FORM_UNFORMATTED)
     20171-      {
     20172-       generate_error (&fpp->common, LIBERROR_OPTION_CONFLICT,
     20173-                       "Cannot BACKSPACE an unformatted stream file");
     20174-       goto done;
     20175-      }
     20176+  if (u->flags.access == ACCESS_STREAM && u->flags.form == FORM_UNFORMATTED)
     20177+    {
     20178+      generate_error (&fpp->common, LIBERROR_OPTION_CONFLICT,
     20179+                      "Cannot BACKSPACE an unformatted stream file");
     20180+      goto done;
     20181+    }
     20182+
     20183+  /* Make sure format buffer is flushed and reset.  */
     20184+  if (u->flags.form == FORM_FORMATTED)
     20185+    {
     20186+      int pos = fbuf_reset (u);
     20187+      if (pos != 0)
     20188+        sseek (u->s, pos, SEEK_CUR);
     20189+    }
     20190 
     20191-  /* Make sure format buffer is flushed.  */
     20192-  fbuf_flush (u, 1);
     20193   
     20194   /* Check for special cases involving the ENDFILE record first.  */
     20195 
     20196@@ -217,11 +221,11 @@
     20197     {
     20198       u->endfile = AT_ENDFILE;
     20199       u->flags.position = POSITION_APPEND;
     20200-      flush (u->s);
     20201+      sflush (u->s);
     20202     }
     20203   else
     20204     {
     20205-      if (file_position (u->s) == 0)
     20206+      if (stell (u->s) == 0)
     20207        {
     20208          u->flags.position = POSITION_REWIND;
     20209          goto done;            /* Common special case */
     20210@@ -238,8 +242,7 @@
     20211 
     20212          u->previous_nonadvancing_write = 0;
     20213 
     20214-         flush (u->s);
     20215-         struncate (u->s);
     20216+         unit_truncate (u, stell (u->s), &fpp->common);
     20217          u->mode = READING;
     20218         }
     20219 
     20220@@ -248,7 +251,7 @@
     20221       else
     20222        unformatted_backspace (fpp, u);
     20223 
     20224-      update_position (u);
     20225+      u->flags.position = POSITION_UNSPECIFIED;
     20226       u->endfile = NO_ENDFILE;
     20227       u->current_record = 0;
     20228       u->bytes_left = 0;
     20229@@ -300,10 +303,10 @@
     20230          next_record (&dtp, 1);
     20231        }
     20232 
     20233-      flush (u->s);
     20234-      struncate (u->s);
     20235+      unit_truncate (u, stell (u->s), &fpp->common);
     20236       u->endfile = AFTER_ENDFILE;
     20237-      update_position (u);
     20238+      if (0 == stell (u->s))
     20239+        u->flags.position = POSITION_REWIND;
     20240     done:
     20241       unlock_unit (u);
     20242     }
     20243@@ -338,18 +341,11 @@
     20244 
     20245          u->previous_nonadvancing_write = 0;
     20246 
     20247-         /* Flush the buffers.  If we have been writing to the file, the last
     20248-              written record is the last record in the file, so truncate the
     20249-              file now.  Reset to read mode so two consecutive rewind
     20250-              statements do not delete the file contents.  */
     20251-         flush (u->s);
     20252-         if (u->mode == WRITING && u->flags.access != ACCESS_STREAM)
     20253-           struncate (u->s);
     20254+         fbuf_reset (u);
     20255 
     20256-         u->mode = READING;
     20257          u->last_record = 0;
     20258 
     20259-         if (file_position (u->s) != 0 && sseek (u->s, 0) == FAILURE)
     20260+         if (sseek (u->s, 0, SEEK_SET) < 0)
     20261            generate_error (&fpp->common, LIBERROR_OS, NULL);
     20262 
     20263          /* Handle special files like /dev/null differently.  */
     20264@@ -361,7 +357,7 @@
     20265          else
     20266            {
     20267              /* Set this for compatibilty with g77 for /dev/null.  */
     20268-             if (file_length (u->s) == 0  && file_position (u->s) == 0)
     20269+             if (file_length (u->s) == 0  && stell (u->s) == 0)
     20270                u->endfile = AT_ENDFILE;
     20271              /* Future refinements on special files can go here.  */
     20272            }
     20273@@ -392,7 +388,11 @@
     20274   u = find_unit (fpp->common.unit);
     20275   if (u != NULL)
     20276     {
     20277-      flush (u->s);
     20278+      /* Make sure format buffer is flushed.  */
     20279+      if (u->flags.form == FORM_FORMATTED)
     20280+        fbuf_flush (u, u->mode);
     20281+
     20282+      sflush (u->s);
     20283       unlock_unit (u);
     20284     }
     20285   else
     20286diff -Naur gcc-4.4.0.orig/libgfortran/io/format.c gcc-4.4.0/libgfortran/io/format.c
     20287--- gcc-4.4.0.orig/libgfortran/io/format.c      2009-04-09 16:23:07.000000000 -0700
     20288+++ gcc-4.4.0/libgfortran/io/format.c   2009-05-26 18:21:22.000000000 -0700
     20289@@ -31,6 +31,7 @@
     20290 #include "io.h"
     20291 #include <ctype.h>
     20292 #include <string.h>
     20293+#include <stdbool.h>
     20294 
     20295 #define FARRAY_SIZE 64
     20296 
     20297@@ -58,7 +59,7 @@
     20298 static const fnode colon_node = { FMT_COLON, 0, NULL, NULL, {{ 0, 0, 0 }}, 0,
     20299                                  NULL };
     20300 
     20301-/* Error messages */
     20302+/* Error messages. */
     20303 
     20304 static const char posint_required[] = "Positive width required in format",
     20305   period_required[] = "Period required in format",
     20306@@ -70,6 +71,129 @@
     20307   reversion_error[] = "Exhausted data descriptors in format",
     20308   zero_width[] = "Zero width in format descriptor";
     20309 
     20310+/* The following routines support caching format data from parsed format strings
     20311+   into a hash table.  This avoids repeatedly parsing duplicate format strings
     20312+   or format strings in I/O statements that are repeated in loops.  */
     20313+
     20314+
     20315+/* Traverse the table and free all data.  */
     20316+
     20317+void
     20318+free_format_hash_table (gfc_unit *u)
     20319+{
     20320+  size_t i;
     20321+
     20322+  /* free_format_data handles any NULL pointers.  */
     20323+  for (i = 0; i < FORMAT_HASH_SIZE; i++)
     20324+    {
     20325+      if (u->format_hash_table[i].hashed_fmt != NULL)
     20326+       free_format_data (u->format_hash_table[i].hashed_fmt);
     20327+      u->format_hash_table[i].hashed_fmt = NULL;
     20328+    }
     20329+}
     20330+
     20331+/* Traverse the format_data structure and reset the fnode counters.  */
     20332+
     20333+static void
     20334+reset_node (fnode *fn)
     20335+{
     20336+  fnode *f;
     20337+
     20338+  fn->count = 0;
     20339+  fn->current = NULL;
     20340
     20341+  if (fn->format != FMT_LPAREN)
     20342+    return;
     20343+
     20344+  for (f = fn->u.child; f; f = f->next)
     20345+    {
     20346+      if (f->format == FMT_RPAREN)
     20347+       break;
     20348+      reset_node (f);
     20349+    }
     20350+}
     20351+
     20352+static void
     20353+reset_fnode_counters (st_parameter_dt *dtp)
     20354+{
     20355+  fnode *f;
     20356+  format_data *fmt;
     20357+
     20358+  fmt = dtp->u.p.fmt;
     20359+
     20360+  /* Clear this pointer at the head so things start at the right place.  */
     20361+  fmt->array.array[0].current = NULL;
     20362+
     20363+  for (f = fmt->last->array[0].u.child; f; f = f->next)
     20364+    reset_node (f);
     20365+}
     20366+
     20367+
     20368+/* A simple hashing function to generate an index into the hash table.  */
     20369+
     20370+static inline
     20371+uint32_t format_hash (st_parameter_dt *dtp)
     20372+{
     20373+  char *key;
     20374+  gfc_charlen_type key_len;
     20375+  uint32_t hash = 0;
     20376+  gfc_charlen_type i;
     20377+
     20378+  /* Hash the format string. Super simple, but what the heck!  */
     20379+  key = dtp->format;
     20380+  key_len = dtp->format_len;
     20381+  for (i = 0; i < key_len; i++)
     20382+    hash ^= key[i];
     20383+  hash &= (FORMAT_HASH_SIZE - 1);
     20384+  return hash;
     20385+}
     20386+
     20387+
     20388+static void
     20389+save_parsed_format (st_parameter_dt *dtp)
     20390+{
     20391+  uint32_t hash;
     20392+  gfc_unit *u;
     20393+
     20394+  hash = format_hash (dtp);
     20395+  u = dtp->u.p.current_unit;
     20396+
     20397+  /* Index into the hash table.  We are simply replacing whatever is there
     20398+     relying on probability.  */
     20399+  if (u->format_hash_table[hash].hashed_fmt != NULL)
     20400+    free_format_data (u->format_hash_table[hash].hashed_fmt);
     20401+  u->format_hash_table[hash].hashed_fmt = NULL;
     20402+
     20403+  u->format_hash_table[hash].key = dtp->format;
     20404+  u->format_hash_table[hash].key_len = dtp->format_len;
     20405+  u->format_hash_table[hash].hashed_fmt = dtp->u.p.fmt;
     20406+}
     20407+
     20408+
     20409+static format_data *
     20410+find_parsed_format (st_parameter_dt *dtp)
     20411+{
     20412+  uint32_t hash;
     20413+  gfc_unit *u;
     20414+
     20415+  hash = format_hash (dtp);
     20416+  u = dtp->u.p.current_unit;
     20417+
     20418+  if (u->format_hash_table[hash].key != NULL)
     20419+    {
     20420+      /* See if it matches.  */
     20421+      if (u->format_hash_table[hash].key_len == dtp->format_len)
     20422+       {
     20423+         /* So far so good.  */
     20424+         if (strncmp (u->format_hash_table[hash].key,
     20425+             dtp->format, dtp->format_len) == 0)
     20426+           return u->format_hash_table[hash].hashed_fmt;
     20427+       }
     20428+    }
     20429+  return NULL;
     20430+}
     20431+
     20432+
     20433 /* next_char()-- Return the next character in the format string.
     20434  * Returns -1 when the string is done.  If the literal flag is set,
     20435  * spaces are significant, otherwise they are not. */
     20436@@ -85,7 +209,8 @@
     20437        return -1;
     20438 
     20439       fmt->format_string_len--;
     20440-      fmt->error_element = c = toupper (*fmt->format_string++);
     20441+      c = toupper (*fmt->format_string++);
     20442+      fmt->error_element = c;
     20443     }
     20444   while ((c == ' ' || c == '\t') && !literal);
     20445 
     20446@@ -136,10 +261,10 @@
     20447 /* free_format_data()-- Free all allocated format data.  */
     20448 
     20449 void
     20450-free_format_data (st_parameter_dt *dtp)
     20451+free_format_data (format_data *fmt)
     20452 {
     20453   fnode_array *fa, *fa_next;
     20454-  format_data *fmt = dtp->u.p.fmt;
     20455+
     20456 
     20457   if (fmt == NULL)
     20458     return;
     20459@@ -151,7 +276,7 @@
     20460     }
     20461 
     20462   free_mem (fmt);
     20463-  dtp->u.p.fmt = NULL;
     20464+  fmt = NULL;
     20465 }
     20466 
     20467 
     20468@@ -179,6 +304,14 @@
     20469 
     20470   switch (c)
     20471     {
     20472+    case '(':
     20473+      token = FMT_LPAREN;
     20474+      break;
     20475+
     20476+    case ')':
     20477+      token = FMT_RPAREN;
     20478+      break;
     20479+
     20480     case '-':
     20481       negative_flag = 1;
     20482       /* Fall Through */
     20483@@ -271,14 +404,6 @@
     20484 
     20485       break;
     20486 
     20487-    case '(':
     20488-      token = FMT_LPAREN;
     20489-      break;
     20490-
     20491-    case ')':
     20492-      token = FMT_RPAREN;
     20493-      break;
     20494-
     20495     case 'X':
     20496       token = FMT_X;
     20497       break;
     20498@@ -450,8 +575,10 @@
     20499   format_token t, u, t2;
     20500   int repeat;
     20501   format_data *fmt = dtp->u.p.fmt;
     20502+  bool save_format;
     20503 
     20504   head = tail = NULL;
     20505+  save_format = !is_internal_unit (dtp);
     20506 
     20507   /* Get the next format item */
     20508  format_item:
     20509@@ -562,6 +689,7 @@
     20510     case FMT_DP:
     20511       notify_std (&dtp->common, GFC_STD_F2003, "Fortran 2003: DC or DP "
     20512                  "descriptor not allowed");
     20513+      save_format = true;
     20514     /* Fall through.  */
     20515     case FMT_S:
     20516     case FMT_SS:
     20517@@ -587,6 +715,7 @@
     20518       get_fnode (fmt, &head, &tail, FMT_DOLLAR);
     20519       tail->repeat = 1;
     20520       notify_std (&dtp->common, GFC_STD_GNU, "Extension: $ descriptor");
     20521+      save_format = false;
     20522       goto between_desc;
     20523 
     20524 
     20525@@ -684,6 +813,7 @@
     20526              fmt->saved_token = t;
     20527              fmt->value = 1;   /* Default width */
     20528              notify_std (&dtp->common, GFC_STD_GNU, posint_required);
     20529+             save_format = false;
     20530            }
     20531        }
     20532 
     20533@@ -994,6 +1124,33 @@
     20534 }
     20535 
     20536 
     20537+/* revert()-- Do reversion of the format.  Control reverts to the left
     20538+ * parenthesis that matches the rightmost right parenthesis.  From our
     20539+ * tree structure, we are looking for the rightmost parenthesis node
     20540+ * at the second level, the first level always being a single
     20541+ * parenthesis node.  If this node doesn't exit, we use the top
     20542+ * level. */
     20543+
     20544+static void
     20545+revert (st_parameter_dt *dtp)
     20546+{
     20547+  fnode *f, *r;
     20548+  format_data *fmt = dtp->u.p.fmt;
     20549+
     20550+  dtp->u.p.reversion_flag = 1;
     20551+
     20552+  r = NULL;
     20553+
     20554+  for (f = fmt->array.array[0].u.child; f; f = f->next)
     20555+    if (f->format == FMT_LPAREN)
     20556+      r = f;
     20557+
     20558+  /* If r is NULL because no node was found, the whole tree will be used */
     20559+
     20560+  fmt->array.array[0].current = r;
     20561+  fmt->array.array[0].count = 0;
     20562+}
     20563+
     20564 /* parse_format()-- Parse a format string.  */
     20565 
     20566 void
     20567@@ -1001,6 +1158,21 @@
     20568 {
     20569   format_data *fmt;
     20570 
     20571+  /* Lookup format string to see if it has already been parsed.  */
     20572+
     20573+  dtp->u.p.fmt = find_parsed_format (dtp);
     20574+
     20575+  if (dtp->u.p.fmt != NULL)
     20576+    {
     20577+      dtp->u.p.fmt->reversion_ok = 0;
     20578+      dtp->u.p.fmt->saved_token = FMT_NONE;
     20579+      dtp->u.p.fmt->saved_format = NULL;
     20580+      reset_fnode_counters (dtp);
     20581+      return;
     20582+    }
     20583+
     20584+  /* Not found so proceed as follows.  */
     20585+
     20586   dtp->u.p.fmt = fmt = get_mem (sizeof (format_data));
     20587   fmt->format_string = dtp->format;
     20588   fmt->format_string_len = dtp->format_len;
     20589@@ -1032,35 +1204,12 @@
     20590     fmt->error = "Missing initial left parenthesis in format";
     20591 
     20592   if (fmt->error)
     20593-    format_error (dtp, NULL, fmt->error);
     20594-}
     20595-
     20596-
     20597-/* revert()-- Do reversion of the format.  Control reverts to the left
     20598- * parenthesis that matches the rightmost right parenthesis.  From our
     20599- * tree structure, we are looking for the rightmost parenthesis node
     20600- * at the second level, the first level always being a single
     20601- * parenthesis node.  If this node doesn't exit, we use the top
     20602- * level. */
     20603-
     20604-static void
     20605-revert (st_parameter_dt *dtp)
     20606-{
     20607-  fnode *f, *r;
     20608-  format_data *fmt = dtp->u.p.fmt;
     20609-
     20610-  dtp->u.p.reversion_flag = 1;
     20611-
     20612-  r = NULL;
     20613-
     20614-  for (f = fmt->array.array[0].u.child; f; f = f->next)
     20615-    if (f->format == FMT_LPAREN)
     20616-      r = f;
     20617-
     20618-  /* If r is NULL because no node was found, the whole tree will be used */
     20619-
     20620-  fmt->array.array[0].current = r;
     20621-  fmt->array.array[0].count = 0;
     20622+    {
     20623+      format_error (dtp, NULL, fmt->error);
     20624+      free_format_hash_table (dtp->u.p.current_unit);
     20625+      return;
     20626+    }
     20627+  save_parsed_format (dtp);
     20628 }
     20629 
     20630 
     20631diff -Naur gcc-4.4.0.orig/libgfortran/io/intrinsics.c gcc-4.4.0/libgfortran/io/intrinsics.c
     20632--- gcc-4.4.0.orig/libgfortran/io/intrinsics.c  2009-04-09 16:23:07.000000000 -0700
     20633+++ gcc-4.4.0/libgfortran/io/intrinsics.c       2009-05-26 18:21:22.000000000 -0700
     20634@@ -41,21 +41,26 @@
     20635 PREFIX(fgetc) (const int * unit, char * c, gfc_charlen_type c_len)
     20636 {
     20637   int ret;
     20638-  size_t s;
     20639   gfc_unit * u = find_unit (*unit);
     20640 
     20641   if (u == NULL)
     20642     return -1;
     20643 
     20644-  s = 1;
     20645+  fbuf_reset (u);
     20646+  if (u->mode == WRITING)
     20647+    {
     20648+      sflush (u->s);
     20649+      u->mode = READING;
     20650+    }
     20651+
     20652   memset (c, ' ', c_len);
     20653-  ret = sread (u->s, c, &s);
     20654+  ret = sread (u->s, c, 1);
     20655   unlock_unit (u);
     20656 
     20657-  if (ret != 0)
     20658+  if (ret < 0)
     20659     return ret;
     20660 
     20661-  if (s != 1)
     20662+  if (ret != 1)
     20663     return -1;
     20664   else
     20665     return 0;
     20666@@ -114,17 +119,24 @@
     20667 PREFIX(fputc) (const int * unit, char * c,
     20668               gfc_charlen_type c_len __attribute__((unused)))
     20669 {
     20670-  size_t s;
     20671-  int ret;
     20672+  ssize_t s;
     20673   gfc_unit * u = find_unit (*unit);
     20674 
     20675   if (u == NULL)
     20676     return -1;
     20677 
     20678-  s = 1;
     20679-  ret = swrite (u->s, c, &s);
     20680+  fbuf_reset (u);
     20681+  if (u->mode == READING)
     20682+    {
     20683+      sflush (u->s);
     20684+      u->mode = WRITING;
     20685+    }
     20686+
     20687+  s = swrite (u->s, c, 1);
     20688   unlock_unit (u);
     20689-  return ret;
     20690+  if (s < 0)
     20691+    return -1;
     20692+  return 0;
     20693 }
     20694 
     20695 
     20696@@ -191,7 +203,7 @@
     20697       us = find_unit (*unit);
     20698       if (us != NULL)
     20699        {
     20700-         flush (us->s);
     20701+         sflush (us->s);
     20702          unlock_unit (us);
     20703        }
     20704     }
     20705@@ -214,7 +226,7 @@
     20706       us = find_unit (*unit);
     20707       if (us != NULL)
     20708        {
     20709-         flush (us->s);
     20710+         sflush (us->s);
     20711          unlock_unit (us);
     20712        }
     20713     }
     20714@@ -229,22 +241,17 @@
     20715 fseek_sub (int * unit, GFC_IO_INT * offset, int * whence, int * status)
     20716 {
     20717   gfc_unit * u = find_unit (*unit);
     20718-  try result = FAILURE;
     20719+  ssize_t result = -1;
     20720 
     20721   if (u != NULL && is_seekable(u->s))
     20722     {
     20723-      if (*whence == 0)
     20724-        result = sseek(u->s, *offset);                       /* SEEK_SET */
     20725-      else if (*whence == 1)
     20726-        result = sseek(u->s, file_position(u->s) + *offset); /* SEEK_CUR */
     20727-      else if (*whence == 2)
     20728-        result = sseek(u->s, file_length(u->s) + *offset);   /* SEEK_END */
     20729+      result = sseek(u->s, *offset, *whence);
     20730 
     20731       unlock_unit (u);
     20732     }
     20733 
     20734   if (status)
     20735-    *status = (result == FAILURE ? -1 : 0);
     20736+    *status = (result < 0 ? -1 : 0);
     20737 }
     20738 
     20739 
     20740@@ -261,7 +268,7 @@
     20741   size_t ret;
     20742   if (u == NULL)
     20743     return ((size_t) -1);
     20744-  ret = (size_t) stream_offset (u->s);
     20745+  ret = (size_t) stell (u->s);
     20746   unlock_unit (u);
     20747   return ret;
     20748 }
     20749@@ -277,7 +284,7 @@
     20750       *offset = -1; \
     20751     else \
     20752       { \
     20753-       *offset = stream_offset (u->s); \
     20754+       *offset = stell (u->s); \
     20755        unlock_unit (u); \
     20756       } \
     20757   }
     20758diff -Naur gcc-4.4.0.orig/libgfortran/io/io.h gcc-4.4.0/libgfortran/io/io.h
     20759--- gcc-4.4.0.orig/libgfortran/io/io.h  2009-04-09 16:23:07.000000000 -0700
     20760+++ gcc-4.4.0/libgfortran/io/io.h       2009-05-26 18:21:22.000000000 -0700
     20761@@ -46,34 +46,60 @@
     20762 
     20763 typedef struct stream
     20764 {
     20765-  char *(*alloc_w_at) (struct stream *, int *);
     20766-  try (*sfree) (struct stream *);
     20767-  try (*close) (struct stream *);
     20768-  try (*seek) (struct stream *, gfc_offset);
     20769-  try (*trunc) (struct stream *);
     20770-  int (*read) (struct stream *, void *, size_t *);
     20771-  int (*write) (struct stream *, const void *, size_t *);
     20772-  try (*set) (struct stream *, int, size_t);
     20773+  ssize_t (*read) (struct stream *, void *, ssize_t);
     20774+  ssize_t (*write) (struct stream *, const void *, ssize_t);
     20775+  off_t (*seek) (struct stream *, off_t, int);
     20776+  off_t (*tell) (struct stream *);
     20777+  /* Avoid keyword truncate due to AIX namespace collision.  */
     20778+  int (*trunc) (struct stream *, off_t);
     20779+  int (*flush) (struct stream *);
     20780+  int (*close) (struct stream *);
     20781 }
     20782 stream;
     20783 
     20784-typedef enum
     20785-{ SYNC_BUFFERED, SYNC_UNBUFFERED, ASYNC }
     20786-io_mode;
     20787+/* Inline functions for doing file I/O given a stream.  */
     20788+static inline ssize_t
     20789+sread (stream * s, void * buf, ssize_t nbyte)
     20790+{
     20791+  return s->read (s, buf, nbyte);
     20792+}
     20793+
     20794+static inline ssize_t
     20795+swrite (stream * s, const void * buf, ssize_t nbyte)
     20796+{
     20797+  return s->write (s, buf, nbyte);
     20798+}
     20799 
     20800-/* Macros for doing file I/O given a stream.  */
     20801+static inline off_t
     20802+sseek (stream * s, off_t offset, int whence)
     20803+{
     20804+  return s->seek (s, offset, whence);
     20805+}
     20806+
     20807+static inline off_t
     20808+stell (stream * s)
     20809+{
     20810+  return s->tell (s);
     20811+}
     20812 
     20813-#define sfree(s) ((s)->sfree)(s)
     20814-#define sclose(s) ((s)->close)(s)
     20815+static inline int
     20816+struncate (stream * s, off_t length)
     20817+{
     20818+  return s->trunc (s, length);
     20819+}
     20820 
     20821-#define salloc_w(s, len) ((s)->alloc_w_at)(s, len)
     20822+static inline int
     20823+sflush (stream * s)
     20824+{
     20825+  return s->flush (s);
     20826+}
     20827 
     20828-#define sseek(s, pos) ((s)->seek)(s, pos)
     20829-#define struncate(s) ((s)->trunc)(s)
     20830-#define sread(s, buf, nbytes) ((s)->read)(s, buf, nbytes)
     20831-#define swrite(s, buf, nbytes) ((s)->write)(s, buf, nbytes)
     20832+static inline int
     20833+sclose (stream * s)
     20834+{
     20835+  return s->close (s);
     20836+}
     20837 
     20838-#define sset(s, c, n) ((s)->set)(s, c, n)
     20839 
     20840 /* Macros for testing what kinds of I/O we are doing.  */
     20841 
     20842@@ -103,6 +129,18 @@
     20843 }
     20844 array_loop_spec;
     20845 
     20846+/* A stucture to build a hash table for format data.  */
     20847+
     20848+#define FORMAT_HASH_SIZE 16
     20849+
     20850+typedef struct format_hash_entry
     20851+{
     20852+  char *key;
     20853+  gfc_charlen_type key_len;
     20854+  struct format_data *hashed_fmt;
     20855+}
     20856+format_hash_entry;
     20857+
     20858 /* Representation of a namelist object in libgfortran
     20859 
     20860    Namelist Records
     20861@@ -124,7 +162,6 @@
     20862 
     20863 typedef struct namelist_type
     20864 {
     20865-
     20866   /* Object type, stored as GFC_DTYPE_xxxx.  */
     20867   bt type;
     20868 
     20869@@ -461,9 +498,9 @@
     20870          /* A flag used to identify when a non-standard expanded namelist read
     20871             has occurred.  */
     20872          int expanded_read;
     20873-         /* Storage area for values except for strings.  Must be large
     20874-            enough to hold a complex value (two reals) of the largest
     20875-            kind.  */
     20876+         /* Storage area for values except for strings.  Must be
     20877+            large enough to hold a complex value (two reals) of the
     20878+            largest kind.  */
     20879          char value[32];
     20880          GFC_IO_INT size_used;
     20881        } p;
     20882@@ -535,10 +572,9 @@
     20883 typedef struct fbuf
     20884 {
     20885   char *buf;                   /* Start of buffer.  */
     20886-  size_t len;                  /* Length of buffer.  */
     20887-  size_t act;                  /* Active bytes in buffer.  */
     20888-  size_t flushed;              /* Flushed bytes from beginning of buffer.  */
     20889-  size_t pos;                  /* Current position in buffer.  */
     20890+  int len;                     /* Length of buffer.  */
     20891+  int act;                     /* Active bytes in buffer.  */
     20892+  int pos;                     /* Current position in buffer.  */
     20893 }
     20894 fbuf;
     20895 
     20896@@ -596,6 +632,9 @@
     20897 
     20898   int file_len;
     20899   char *file;
     20900+
     20901+  /* The format hash table.  */
     20902+  struct format_hash_entry format_hash_table[FORMAT_HASH_SIZE];
     20903   
     20904   /* Formatting buffer.  */
     20905   struct fbuf *fbuf;
     20906@@ -668,9 +707,6 @@
     20907 
     20908 /* unix.c */
     20909 
     20910-extern int move_pos_offset (stream *, int);
     20911-internal_proto(move_pos_offset);
     20912-
     20913 extern int compare_files (stream *, stream *);
     20914 internal_proto(compare_files);
     20915 
     20916@@ -680,6 +716,12 @@
     20917 extern stream *open_internal (char *, int, gfc_offset);
     20918 internal_proto(open_internal);
     20919 
     20920+extern char * mem_alloc_w (stream *, int *);
     20921+internal_proto(mem_alloc_w);
     20922+
     20923+extern char * mem_alloc_r (stream *, int *);
     20924+internal_proto(mem_alloc_w);
     20925+
     20926 extern stream *input_stream (void);
     20927 internal_proto(input_stream);
     20928 
     20929@@ -695,12 +737,6 @@
     20930 extern gfc_unit *find_file (const char *file, gfc_charlen_type file_len);
     20931 internal_proto(find_file);
     20932 
     20933-extern int stream_at_bof (stream *);
     20934-internal_proto(stream_at_bof);
     20935-
     20936-extern int stream_at_eof (stream *);
     20937-internal_proto(stream_at_eof);
     20938-
     20939 extern int delete_file (gfc_unit *);
     20940 internal_proto(delete_file);
     20941 
     20942@@ -731,36 +767,24 @@
     20943 extern gfc_offset file_length (stream *);
     20944 internal_proto(file_length);
     20945 
     20946-extern gfc_offset file_position (stream *);
     20947-internal_proto(file_position);
     20948-
     20949 extern int is_seekable (stream *);
     20950 internal_proto(is_seekable);
     20951 
     20952 extern int is_special (stream *);
     20953 internal_proto(is_special);
     20954 
     20955-extern int is_preconnected (stream *);
     20956-internal_proto(is_preconnected);
     20957-
     20958 extern void flush_if_preconnected (stream *);
     20959 internal_proto(flush_if_preconnected);
     20960 
     20961 extern void empty_internal_buffer(stream *);
     20962 internal_proto(empty_internal_buffer);
     20963 
     20964-extern try flush (stream *);
     20965-internal_proto(flush);
     20966-
     20967 extern int stream_isatty (stream *);
     20968 internal_proto(stream_isatty);
     20969 
     20970 extern char * stream_ttyname (stream *);
     20971 internal_proto(stream_ttyname);
     20972 
     20973-extern gfc_offset stream_offset (stream *s);
     20974-internal_proto(stream_offset);
     20975-
     20976 extern int unpack_filename (char *, const char *, int);
     20977 internal_proto(unpack_filename);
     20978 
     20979@@ -804,6 +828,9 @@
     20980 extern void finish_last_advance_record (gfc_unit *u);
     20981 internal_proto (finish_last_advance_record);
     20982 
     20983+extern int unit_truncate (gfc_unit *, gfc_offset, st_parameter_common *);
     20984+internal_proto (unit_truncate);
     20985+
     20986 /* open.c */
     20987 
     20988 extern gfc_unit *new_unit (st_parameter_open *, gfc_unit *, unit_flags *);
     20989@@ -823,9 +850,18 @@
     20990 extern void format_error (st_parameter_dt *, const fnode *, const char *);
     20991 internal_proto(format_error);
     20992 
     20993-extern void free_format_data (st_parameter_dt *);
     20994+extern void free_format_data (struct format_data *);
     20995 internal_proto(free_format_data);
     20996 
     20997+extern void free_format_hash_table (gfc_unit *);
     20998+internal_proto(free_format_hash_table);
     20999+
     21000+extern void init_format_hash (st_parameter_dt *);
     21001+internal_proto(init_format_hash);
     21002+
     21003+extern void free_format_hash (st_parameter_dt *);
     21004+internal_proto(free_format_hash);
     21005+
     21006 /* transfer.c */
     21007 
     21008 #define SCRATCH_SIZE 300
     21009@@ -833,7 +869,7 @@
     21010 extern const char *type_name (bt);
     21011 internal_proto(type_name);
     21012 
     21013-extern try read_block_form (st_parameter_dt *, void *, size_t *);
     21014+extern void * read_block_form (st_parameter_dt *, int *);
     21015 internal_proto(read_block_form);
     21016 
     21017 extern char *read_sf (st_parameter_dt *, int *, int);
     21018@@ -859,6 +895,9 @@
     21019 extern void st_wait (st_parameter_wait *);
     21020 export_proto(st_wait);
     21021 
     21022+extern void hit_eof (st_parameter_dt *);
     21023+internal_proto(hit_eof);
     21024+
     21025 /* read.c */
     21026 
     21027 extern void set_integer (void *, GFC_INTEGER_LARGEST, int);
     21028@@ -965,24 +1004,39 @@
     21029 internal_proto(size_from_complex_kind);
     21030 
     21031 /* fbuf.c */
     21032-extern void fbuf_init (gfc_unit *, size_t);
     21033+extern void fbuf_init (gfc_unit *, int);
     21034 internal_proto(fbuf_init);
     21035 
     21036 extern void fbuf_destroy (gfc_unit *);
     21037 internal_proto(fbuf_destroy);
     21038 
     21039-extern void fbuf_reset (gfc_unit *);
     21040+extern int fbuf_reset (gfc_unit *);
     21041 internal_proto(fbuf_reset);
     21042 
     21043-extern char * fbuf_alloc (gfc_unit *, size_t);
     21044+extern char * fbuf_alloc (gfc_unit *, int);
     21045 internal_proto(fbuf_alloc);
     21046 
     21047-extern int fbuf_flush (gfc_unit *, int);
     21048+extern int fbuf_flush (gfc_unit *, unit_mode);
     21049 internal_proto(fbuf_flush);
     21050 
     21051-extern int fbuf_seek (gfc_unit *, gfc_offset);
     21052+extern int fbuf_seek (gfc_unit *, int, int);
     21053 internal_proto(fbuf_seek);
     21054 
     21055+extern char * fbuf_read (gfc_unit *, int *);
     21056+internal_proto(fbuf_read);
     21057+
     21058+/* Never call this function, only use fbuf_getc().  */
     21059+extern int fbuf_getc_refill (gfc_unit *);
     21060+internal_proto(fbuf_getc_refill);
     21061+
     21062+static inline int
     21063+fbuf_getc (gfc_unit * u)
     21064+{
     21065+  if (u->fbuf->pos < u->fbuf->act)
     21066+    return (unsigned char) u->fbuf->buf[u->fbuf->pos++];
     21067+  return fbuf_getc_refill (u);
     21068+}
     21069+
     21070 /* lock.c */
     21071 extern void free_ionml (st_parameter_dt *);
     21072 internal_proto(free_ionml);
     21073diff -Naur gcc-4.4.0.orig/libgfortran/io/list_read.c gcc-4.4.0/libgfortran/io/list_read.c
     21074--- gcc-4.4.0.orig/libgfortran/io/list_read.c   2009-04-09 16:23:07.000000000 -0700
     21075+++ gcc-4.4.0/libgfortran/io/list_read.c        2009-05-26 18:21:22.000000000 -0700
     21076@@ -28,6 +28,7 @@
     21077 
     21078 #include "io.h"
     21079 #include <string.h>
     21080+#include <stdlib.h>
     21081 #include <ctype.h>
     21082 
     21083 
     21084@@ -74,9 +75,8 @@
     21085 
     21086   if (dtp->u.p.saved_string == NULL)
     21087     {
     21088-      if (dtp->u.p.scratch == NULL)
     21089-       dtp->u.p.scratch = get_mem (SCRATCH_SIZE);
     21090-      dtp->u.p.saved_string = dtp->u.p.scratch;
     21091+      dtp->u.p.saved_string = get_mem (SCRATCH_SIZE);
     21092+      // memset below should be commented out.
     21093       memset (dtp->u.p.saved_string, 0, SCRATCH_SIZE);
     21094       dtp->u.p.saved_length = SCRATCH_SIZE;
     21095       dtp->u.p.saved_used = 0;
     21096@@ -85,15 +85,15 @@
     21097   if (dtp->u.p.saved_used >= dtp->u.p.saved_length)
     21098     {
     21099       dtp->u.p.saved_length = 2 * dtp->u.p.saved_length;
     21100-      new = get_mem (2 * dtp->u.p.saved_length);
     21101-
     21102-      memset (new, 0, 2 * dtp->u.p.saved_length);
     21103-
     21104-      memcpy (new, dtp->u.p.saved_string, dtp->u.p.saved_used);
     21105-      if (dtp->u.p.saved_string != dtp->u.p.scratch)
     21106-       free_mem (dtp->u.p.saved_string);
     21107-
     21108+      new = realloc (dtp->u.p.saved_string, dtp->u.p.saved_length);
     21109+      if (new == NULL)
     21110+       generate_error (&dtp->common, LIBERROR_OS, NULL);
     21111       dtp->u.p.saved_string = new;
     21112+     
     21113+      // Also this should not be necessary.
     21114+      memset (new + dtp->u.p.saved_used, 0,
     21115+             dtp->u.p.saved_length - dtp->u.p.saved_used);
     21116+
     21117     }
     21118 
     21119   dtp->u.p.saved_string[dtp->u.p.saved_used++] = c;
     21120@@ -108,8 +108,7 @@
     21121   if (dtp->u.p.saved_string == NULL)
     21122     return;
     21123 
     21124-  if (dtp->u.p.saved_string != dtp->u.p.scratch)
     21125-    free_mem (dtp->u.p.saved_string);
     21126+  free_mem (dtp->u.p.saved_string);
     21127 
     21128   dtp->u.p.saved_string = NULL;
     21129   dtp->u.p.saved_used = 0;
     21130@@ -135,9 +134,10 @@
     21131 static char
     21132 next_char (st_parameter_dt *dtp)
     21133 {
     21134-  size_t length;
     21135+  ssize_t length;
     21136   gfc_offset record;
     21137   char c;
     21138+  int cc;
     21139 
     21140   if (dtp->u.p.last_char != '\0')
     21141     {
     21142@@ -189,7 +189,7 @@
     21143            }
     21144 
     21145          record *= dtp->u.p.current_unit->recl;
     21146-         if (sseek (dtp->u.p.current_unit->s, record) == FAILURE)
     21147+         if (sseek (dtp->u.p.current_unit->s, record, SEEK_SET) < 0)
     21148            longjmp (*dtp->u.p.eof_jump, 1);
     21149 
     21150          dtp->u.p.current_unit->bytes_left = dtp->u.p.current_unit->recl;
     21151@@ -199,19 +199,15 @@
     21152 
     21153   /* Get the next character and handle end-of-record conditions.  */
     21154 
     21155-  length = 1;
     21156-
     21157-  if (sread (dtp->u.p.current_unit->s, &c, &length) != 0)
     21158-    {
     21159-       generate_error (&dtp->common, LIBERROR_OS, NULL);
     21160-       return '\0';
     21161-    }
     21162
     21163-  if (is_stream_io (dtp) && length == 1)
     21164-    dtp->u.p.current_unit->strm_pos++;
     21165-
     21166   if (is_internal_unit (dtp))
     21167     {
     21168+      length = sread (dtp->u.p.current_unit->s, &c, 1);
     21169+      if (length < 0)
     21170+       {
     21171+         generate_error (&dtp->common, LIBERROR_OS, NULL);
     21172+         return '\0';
     21173+       }
     21174
     21175       if (is_array_io (dtp))
     21176        {
     21177          /* Check whether we hit EOF.  */
     21178@@ -235,13 +231,20 @@
     21179     }
     21180   else
     21181     {
     21182-      if (length == 0)
     21183+      cc = fbuf_getc (dtp->u.p.current_unit);
     21184+
     21185+      if (cc == EOF)
     21186        {
     21187          if (dtp->u.p.current_unit->endfile == AT_ENDFILE)
     21188            longjmp (*dtp->u.p.eof_jump, 1);
     21189          dtp->u.p.current_unit->endfile = AT_ENDFILE;
     21190          c = '\n';
     21191        }
     21192+      else
     21193+       c = (char) cc;
     21194+      if (is_stream_io (dtp) && cc != EOF)
     21195+       dtp->u.p.current_unit->strm_pos++;
     21196+
     21197     }
     21198 done:
     21199   dtp->u.p.at_eol = (c == '\n' || c == '\r');
     21200@@ -1216,7 +1219,7 @@
     21201    what it is right away.  */
     21202 
     21203 static void
     21204-read_complex (st_parameter_dt *dtp, int kind, size_t size)
     21205+read_complex (st_parameter_dt *dtp, void * dest, int kind, size_t size)
     21206 {
     21207   char message[100];
     21208   char c;
     21209@@ -1240,7 +1243,7 @@
     21210     }
     21211 
     21212   eat_spaces (dtp);
     21213-  if (parse_real (dtp, dtp->u.p.value, kind))
     21214+  if (parse_real (dtp, dest, kind))
     21215     return;
     21216 
     21217 eol_1:
     21218@@ -1263,7 +1266,7 @@
     21219   else
     21220     unget_char (dtp, c);
     21221 
     21222-  if (parse_real (dtp, dtp->u.p.value + size / 2, kind))
     21223+  if (parse_real (dtp, dest + size / 2, kind))
     21224     return;
     21225 
     21226   eat_spaces (dtp);
     21227@@ -1297,7 +1300,7 @@
     21228 /* Parse a real number with a possible repeat count.  */
     21229 
     21230 static void
     21231-read_real (st_parameter_dt *dtp, int length)
     21232+read_real (st_parameter_dt *dtp, void * dest, int length)
     21233 {
     21234   char c, message[100];
     21235   int seen_dp;
     21236@@ -1510,7 +1513,7 @@
     21237   unget_char (dtp, c);
     21238   eat_separator (dtp);
     21239   push_char (dtp, '\0');
     21240-  if (convert_real (dtp, dtp->u.p.value, dtp->u.p.saved_string, length))
     21241+  if (convert_real (dtp, dest, dtp->u.p.saved_string, length))
     21242     return;
     21243 
     21244   free_saved (dtp);
     21245@@ -1693,7 +1696,7 @@
     21246       dtp->u.p.input_complete = 0;
     21247       dtp->u.p.repeat_count = 1;
     21248       dtp->u.p.at_eol = 0;
     21249-
     21250+     
     21251       c = eat_spaces (dtp);
     21252       if (is_separator (c))
     21253        {
     21254@@ -1721,6 +1724,9 @@
     21255            return;
     21256          goto set_value;
     21257        }
     21258+       
     21259+      if (dtp->u.p.input_complete)
     21260+       goto cleanup;
     21261 
     21262       if (dtp->u.p.input_complete)
     21263        goto cleanup;
     21264@@ -1751,10 +1757,16 @@
     21265       read_character (dtp, kind);
     21266       break;
     21267     case BT_REAL:
     21268-      read_real (dtp, kind);
     21269+      read_real (dtp, p, kind);
     21270+      /* Copy value back to temporary if needed.  */
     21271+      if (dtp->u.p.repeat_count > 0)
     21272+       memcpy (dtp->u.p.value, p, kind);
     21273       break;
     21274     case BT_COMPLEX:
     21275-      read_complex (dtp, kind, size);
     21276+      read_complex (dtp, p, kind, size);
     21277+      /* Copy value back to temporary if needed.  */
     21278+      if (dtp->u.p.repeat_count > 0)
     21279+       memcpy (dtp->u.p.value, p, size);
     21280       break;
     21281     default:
     21282       internal_error (&dtp->common, "Bad type for list read");
     21283@@ -1770,8 +1782,12 @@
     21284   switch (dtp->u.p.saved_type)
     21285     {
     21286     case BT_COMPLEX:
     21287-    case BT_INTEGER:
     21288     case BT_REAL:
     21289+      if (dtp->u.p.repeat_count > 0)
     21290+       memcpy (p, dtp->u.p.value, size);
     21291+      break;
     21292+
     21293+    case BT_INTEGER:
     21294     case BT_LOGICAL:
     21295       memcpy (p, dtp->u.p.value, size);
     21296       break;
     21297@@ -1848,6 +1864,8 @@
     21298 
     21299   free_saved (dtp);
     21300 
     21301+  fbuf_flush (dtp->u.p.current_unit, dtp->u.p.mode);
     21302+
     21303   if (dtp->u.p.at_eol)
     21304     {
     21305       dtp->u.p.at_eol = 0;
     21306@@ -2256,8 +2274,8 @@
     21307 
     21308       /* Flush the stream to force immediate output.  */
     21309 
     21310-      fbuf_flush (dtp->u.p.current_unit, 1);
     21311-      flush (dtp->u.p.current_unit->s);
     21312+      fbuf_flush (dtp->u.p.current_unit, WRITING);
     21313+      sflush (dtp->u.p.current_unit->s);
     21314       unlock_unit (dtp->u.p.current_unit);
     21315     }
     21316 
     21317@@ -2292,7 +2310,7 @@
     21318   int dim;
     21319   index_type dlen;
     21320   index_type m;
     21321-  index_type obj_name_len;
     21322+  size_t obj_name_len;
     21323   void * pdata;
     21324 
     21325   /* This object not touched in name parsing.  */
     21326@@ -2371,12 +2389,17 @@
     21327               break;
     21328 
     21329          case GFC_DTYPE_REAL:
     21330-             read_real (dtp, len);
     21331-              break;
     21332+           /* Need to copy data back from the real location to the temp in order
     21333+              to handle nml reads into arrays.  */
     21334+           read_real (dtp, pdata, len);
     21335+           memcpy (dtp->u.p.value, pdata, dlen);
     21336+           break;
     21337 
     21338          case GFC_DTYPE_COMPLEX:
     21339-              read_complex (dtp, len, dlen);
     21340-              break;
     21341+           /* Same as for REAL, copy back to temp.  */
     21342+           read_complex (dtp, pdata, len, dlen);
     21343+           memcpy (dtp->u.p.value, pdata, dlen);
     21344+           break;
     21345 
     21346          case GFC_DTYPE_DERIVED:
     21347            obj_name_len = strlen (nl->var_name) + 1;
     21348@@ -2898,7 +2921,7 @@
     21349          st_printf ("%s\n", nml_err_msg);
     21350          if (u != NULL)
     21351            {
     21352-             flush (u->s);
     21353+             sflush (u->s);
     21354              unlock_unit (u);
     21355            }
     21356         }
     21357diff -Naur gcc-4.4.0.orig/libgfortran/io/open.c gcc-4.4.0/libgfortran/io/open.c
     21358--- gcc-4.4.0.orig/libgfortran/io/open.c        2009-04-09 16:23:07.000000000 -0700
     21359+++ gcc-4.4.0/libgfortran/io/open.c     2009-05-26 18:21:22.000000000 -0700
     21360@@ -150,7 +150,7 @@
     21361 static void
     21362 test_endfile (gfc_unit * u)
     21363 {
     21364-  if (u->endfile == NO_ENDFILE && file_length (u->s) == file_position (u->s))
     21365+  if (u->endfile == NO_ENDFILE && file_length (u->s) == stell (u->s))
     21366     u->endfile = AT_ENDFILE;
     21367 }
     21368 
     21369@@ -266,7 +266,7 @@
     21370       break;
     21371 
     21372     case POSITION_REWIND:
     21373-      if (sseek (u->s, 0) == FAILURE)
     21374+      if (sseek (u->s, 0, SEEK_SET) != 0)
     21375        goto seek_error;
     21376 
     21377       u->current_record = 0;
     21378@@ -276,7 +276,7 @@
     21379       break;
     21380 
     21381     case POSITION_APPEND:
     21382-      if (sseek (u->s, file_length (u->s)) == FAILURE)
     21383+      if (sseek (u->s, 0, SEEK_END) < 0)
     21384        goto seek_error;
     21385 
     21386       if (flags->access != ACCESS_STREAM)
     21387@@ -552,7 +552,7 @@
     21388 
     21389   if (flags->position == POSITION_APPEND)
     21390     {
     21391-      if (sseek (u->s, file_length (u->s)) == FAILURE)
     21392+      if (sseek (u->s, 0, SEEK_END) < 0)
     21393        generate_error (&opp->common, LIBERROR_OS, NULL);
     21394       u->endfile = AT_ENDFILE;
     21395     }
     21396@@ -606,7 +606,8 @@
     21397     {
     21398       u->maxrec = max_offset;
     21399       u->recl = 1;
     21400-      u->strm_pos = file_position (u->s) + 1;
     21401+      u->bytes_left = 1;
     21402+      u->strm_pos = stell (u->s) + 1;
     21403     }
     21404 
     21405   memmove (u->file, opp->file, opp->file_len);
     21406@@ -622,7 +623,7 @@
     21407   if (flags->status == STATUS_SCRATCH && opp->file != NULL)
     21408     free_mem (opp->file);
     21409     
     21410-  if (flags->form == FORM_FORMATTED && (flags->action != ACTION_READ))
     21411+  if (flags->form == FORM_FORMATTED)
     21412     {
     21413       if ((opp->common.flags & IOPARM_OPEN_HAS_RECL_IN))
     21414         fbuf_init (u, u->recl);
     21415@@ -676,7 +677,7 @@
     21416        }
     21417 #endif
     21418 
     21419-      if (sclose (u->s) == FAILURE)
     21420+      if (sclose (u->s) == -1)
     21421        {
     21422          unlock_unit (u);
     21423          generate_error (&opp->common, LIBERROR_OS,
     21424diff -Naur gcc-4.4.0.orig/libgfortran/io/read.c gcc-4.4.0/libgfortran/io/read.c
     21425--- gcc-4.4.0.orig/libgfortran/io/read.c        2009-04-09 16:23:07.000000000 -0700
     21426+++ gcc-4.4.0/libgfortran/io/read.c     2009-05-26 18:21:22.000000000 -0700
     21427@@ -28,6 +28,7 @@
     21428 #include <errno.h>
     21429 #include <ctype.h>
     21430 #include <stdlib.h>
     21431+#include <assert.h>
     21432 
     21433 typedef unsigned char uchar;
     21434 
     21435@@ -125,8 +126,10 @@
     21436 
     21437 /* convert_real()-- Convert a character representation of a floating
     21438  * point number to the machine number.  Returns nonzero if there is a
     21439- * range problem during conversion.  TODO: handle not-a-numbers and
     21440- * infinities.  */
     21441+ * range problem during conversion.  Note: many architectures
     21442+ * (e.g. IA-64, HP-PA) require that the storage pointed to by the dest
     21443+ * argument is properly aligned for the type in question.  TODO:
     21444+ * handle not-a-numbers and infinities.  */
     21445 
     21446 int
     21447 convert_real (st_parameter_dt *dtp, void *dest, const char *buffer, int length)
     21448@@ -136,38 +139,30 @@
     21449   switch (length)
     21450     {
     21451     case 4:
     21452-      {
     21453-       GFC_REAL_4 tmp =
     21454+      *((GFC_REAL_4*) dest) =
     21455 #if defined(HAVE_STRTOF)
     21456-         strtof (buffer, NULL);
     21457+       strtof (buffer, NULL);
     21458 #else
     21459-         (GFC_REAL_4) strtod (buffer, NULL);
     21460+       (GFC_REAL_4) strtod (buffer, NULL);
     21461 #endif
     21462-       memcpy (dest, (void *) &tmp, length);
     21463-      }
     21464       break;
     21465+
     21466     case 8:
     21467-      {
     21468-       GFC_REAL_8 tmp = strtod (buffer, NULL);
     21469-       memcpy (dest, (void *) &tmp, length);
     21470-      }
     21471+      *((GFC_REAL_8*) dest) = strtod (buffer, NULL);
     21472       break;
     21473+
     21474 #if defined(HAVE_GFC_REAL_10) && defined (HAVE_STRTOLD)
     21475     case 10:
     21476-      {
     21477-       GFC_REAL_10 tmp = strtold (buffer, NULL);
     21478-       memcpy (dest, (void *) &tmp, length);
     21479-      }
     21480+      *((GFC_REAL_10*) dest) = strtold (buffer, NULL);
     21481       break;
     21482 #endif
     21483+
     21484 #if defined(HAVE_GFC_REAL_16) && defined (HAVE_STRTOLD)
     21485     case 16:
     21486-      {
     21487-       GFC_REAL_16 tmp = strtold (buffer, NULL);
     21488-       memcpy (dest, (void *) &tmp, length);
     21489-      }
     21490+      *((GFC_REAL_16*) dest) = strtold (buffer, NULL);
     21491       break;
     21492 #endif
     21493+
     21494     default:
     21495       internal_error (&dtp->common, "Unsupported real kind during IO");
     21496     }
     21497@@ -190,13 +185,13 @@
     21498 read_l (st_parameter_dt *dtp, const fnode *f, char *dest, int length)
     21499 {
     21500   char *p;
     21501-  size_t w;
     21502+  int w;
     21503 
     21504   w = f->u.w;
     21505 
     21506-  p = gfc_alloca (w);
     21507+  p = read_block_form (dtp, &w);
     21508 
     21509-  if (read_block_form (dtp, p, &w) == FAILURE)
     21510+  if (p == NULL)
     21511     return;
     21512 
     21513   while (*p == ' ')
     21514@@ -233,28 +228,26 @@
     21515 }
     21516 
     21517 
     21518-static inline gfc_char4_t
     21519-read_utf8 (st_parameter_dt *dtp, size_t *nbytes)
     21520+static gfc_char4_t
     21521+read_utf8 (st_parameter_dt *dtp, int *nbytes)
     21522 {
     21523   static const uchar masks[6] = { 0x7F, 0x1F, 0x0F, 0x07, 0x02, 0x01 };
     21524   static const uchar patns[6] = { 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
     21525-  static uchar buffer[6];
     21526-  size_t i, nb, nread;
     21527+  int i, nb, nread;
     21528   gfc_char4_t c;
     21529-  int status;
     21530   char *s;
     21531 
     21532   *nbytes = 1;
     21533-  s = (char *) &buffer[0];
     21534-  status = read_block_form (dtp, s, nbytes);
     21535-  if (status == FAILURE)
     21536+
     21537+  s = read_block_form (dtp, nbytes);
     21538+  if (s == NULL)
     21539     return 0;
     21540 
     21541   /* If this is a short read, just return.  */
     21542   if (*nbytes == 0)
     21543     return 0;
     21544 
     21545-  c = buffer[0];
     21546+  c = (uchar) s[0];
     21547   if (c < 0x80)
     21548     return c;
     21549 
     21550@@ -269,9 +262,8 @@
     21551   c = (c & masks[nb-1]);
     21552   nread = nb - 1;
     21553 
     21554-  s = (char *) &buffer[1];
     21555-  status = read_block_form (dtp, s, &nread);
     21556-  if (status == FAILURE)
     21557+  s = read_block_form (dtp, &nread);
     21558+  if (s == NULL)
     21559     return 0;
     21560   /* Decode the bytes read.  */
     21561   for (i = 1; i < nb; i++)
     21562@@ -304,14 +296,14 @@
     21563 
     21564 
     21565 static void
     21566-read_utf8_char1 (st_parameter_dt *dtp, char *p, int len, size_t width)
     21567+read_utf8_char1 (st_parameter_dt *dtp, char *p, int len, int width)
     21568 {
     21569   gfc_char4_t c;
     21570   char *dest;
     21571-  size_t nbytes;
     21572+  int nbytes;
     21573   int i, j;
     21574 
     21575-  len = ((int) width < len) ? len : (int) width;
     21576+  len = (width < len) ? len : width;
     21577 
     21578   dest = (char *) p;
     21579 
     21580@@ -334,21 +326,19 @@
     21581 }
     21582 
     21583 static void
     21584-read_default_char1 (st_parameter_dt *dtp, char *p, int len, size_t width)
     21585+read_default_char1 (st_parameter_dt *dtp, char *p, int len, int width)
     21586 {
     21587   char *s;
     21588-  int m, n, status;
     21589+  int m, n;
     21590 
     21591-  s = gfc_alloca (width);
     21592-
     21593-  status = read_block_form (dtp, s, &width);
     21594+  s = read_block_form (dtp, &width);
     21595   
     21596-  if (status == FAILURE)
     21597+  if (s == NULL)
     21598     return;
     21599-  if (width > (size_t) len)
     21600+  if (width > len)
     21601      s += (width - len);
     21602 
     21603-  m = ((int) width > len) ? len : (int) width;
     21604+  m = (width > len) ? len : width;
     21605   memcpy (p, s, m);
     21606 
     21607   n = len - width;
     21608@@ -358,13 +348,13 @@
     21609 
     21610 
     21611 static void
     21612-read_utf8_char4 (st_parameter_dt *dtp, void *p, int len, size_t width)
     21613+read_utf8_char4 (st_parameter_dt *dtp, void *p, int len, int width)
     21614 {
     21615   gfc_char4_t *dest;
     21616-  size_t nbytes;
     21617+  int nbytes;
     21618   int i, j;
     21619 
     21620-  len = ((int) width < len) ? len : (int) width;
     21621+  len = (width < len) ? len : width;
     21622 
     21623   dest = (gfc_char4_t *) p;
     21624 
     21625@@ -386,19 +376,17 @@
     21626 
     21627 
     21628 static void
     21629-read_default_char4 (st_parameter_dt *dtp, char *p, int len, size_t width)
     21630+read_default_char4 (st_parameter_dt *dtp, char *p, int len, int width)
     21631 {
     21632   char *s;
     21633   gfc_char4_t *dest;
     21634-  int m, n, status;
     21635-
     21636-  s = gfc_alloca (width);
     21637+  int m, n;
     21638 
     21639-  status = read_block_form (dtp, s, &width);
     21640+  s = read_block_form (dtp, &width);
     21641   
     21642-  if (status == FAILURE)
     21643+  if (s == NULL)
     21644     return;
     21645-  if (width > (size_t) len)
     21646+  if (width > len)
     21647      s += (width - len);
     21648 
     21649   m = ((int) width > len) ? len : (int) width;
     21650@@ -420,7 +408,7 @@
     21651 read_a (st_parameter_dt *dtp, const fnode *f, char *p, int length)
     21652 {
     21653   int wi;
     21654-  size_t w;
     21655+  int w;
     21656 
     21657   wi = f->u.w;
     21658   if (wi == -1) /* '(A)' edit descriptor  */
     21659@@ -446,13 +434,11 @@
     21660 void
     21661 read_a_char4 (st_parameter_dt *dtp, const fnode *f, char *p, int length)
     21662 {
     21663-  int wi;
     21664-  size_t w;
     21665+  int w;
     21666 
     21667-  wi = f->u.w;
     21668-  if (wi == -1) /* '(A)' edit descriptor  */
     21669-    wi = length;
     21670-  w = wi;
     21671+  w = f->u.w;
     21672+  if (w == -1) /* '(A)' edit descriptor  */
     21673+    w = length;
     21674 
     21675   /* Read in w characters, treating comma as not a separator.  */
     21676   dtp->u.p.sf_read_comma = 0;
     21677@@ -527,18 +513,15 @@
     21678   GFC_UINTEGER_LARGEST value, maxv, maxv_10;
     21679   GFC_INTEGER_LARGEST v;
     21680   int w, negative;
     21681-  size_t wu;
     21682   char c, *p;
     21683 
     21684-  wu = f->u.w;
     21685+  w = f->u.w;
     21686 
     21687-  p = gfc_alloca (wu);
     21688+  p = read_block_form (dtp, &w);
     21689 
     21690-  if (read_block_form (dtp, p, &wu) == FAILURE)
     21691+  if (p == NULL)
     21692     return;
     21693 
     21694-  w = wu;
     21695-
     21696   p = eat_leading_spaces (&w, p);
     21697   if (w == 0)
     21698     {
     21699@@ -631,17 +614,14 @@
     21700   GFC_INTEGER_LARGEST v;
     21701   int w, negative;
     21702   char c, *p;
     21703-  size_t wu;
     21704 
     21705-  wu = f->u.w;
     21706+  w = f->u.w;
     21707 
     21708-  p = gfc_alloca (wu);
     21709+  p = read_block_form (dtp, &w);
     21710 
     21711-  if (read_block_form (dtp, p, &wu) == FAILURE)
     21712+  if (p == NULL)
     21713     return;
     21714 
     21715-  w = wu;
     21716-
     21717   p = eat_leading_spaces (&w, p);
     21718   if (w == 0)
     21719     {
     21720@@ -778,75 +758,83 @@
     21721 void
     21722 read_f (st_parameter_dt *dtp, const fnode *f, char *dest, int length)
     21723 {
     21724-  size_t wu;
     21725   int w, seen_dp, exponent;
     21726-  int exponent_sign, val_sign;
     21727-  int ndigits;
     21728-  int edigits;
     21729-  int i;
     21730-  char *p, *buffer;
     21731-  char *digits;
     21732-  char scratch[SCRATCH_SIZE];
     21733+  int exponent_sign;
     21734+  const char *p;
     21735+  char *buffer;
     21736+  char *out;
     21737+  int seen_int_digit; /* Seen a digit before the decimal point?  */
     21738+  int seen_dec_digit; /* Seen a digit after the decimal point?  */
     21739 
     21740-  val_sign = 1;
     21741   seen_dp = 0;
     21742-  wu = f->u.w;
     21743-
     21744-  p = gfc_alloca (wu);
     21745+  seen_int_digit = 0;
     21746+  seen_dec_digit = 0;
     21747+  exponent_sign = 1;
     21748+  exponent = 0;
     21749+  w = f->u.w;
     21750 
     21751-  if (read_block_form (dtp, p, &wu) == FAILURE)
     21752+  /* Read in the next block.  */
     21753+  p = read_block_form (dtp, &w);
     21754+  if (p == NULL)
     21755     return;
     21756-
     21757-  w = wu;
     21758-
     21759-  p = eat_leading_spaces (&w, p);
     21760+  p = eat_leading_spaces (&w, (char*) p);
     21761   if (w == 0)
     21762     goto zero;
     21763 
     21764-  /* Optional sign */
     21765+  /* In this buffer we're going to re-format the number cleanly to be parsed
     21766+     by convert_real in the end; this assures we're using strtod from the
     21767+     C library for parsing and thus probably get the best accuracy possible.
     21768+     This process may add a '+0.0' in front of the number as well as change the
     21769+     exponent because of an implicit decimal point or the like.  Thus allocating
     21770+     strlen ("+0.0e-1000") == 10 characters plus one for NUL more than the
     21771+     original buffer had should be enough.  */
     21772+  buffer = gfc_alloca (w + 11);
     21773+  out = buffer;
     21774 
     21775+  /* Optional sign */
     21776   if (*p == '-' || *p == '+')
     21777     {
     21778       if (*p == '-')
     21779-        val_sign = -1;
     21780-      p++;
     21781-      w--;
     21782+       *(out++) = '-';
     21783+      ++p;
     21784+      --w;
     21785     }
     21786 
     21787-  exponent_sign = 1;
     21788-  p = eat_leading_spaces (&w, p);
     21789+  p = eat_leading_spaces (&w, (char*) p);
     21790   if (w == 0)
     21791     goto zero;
     21792 
     21793-  /* A digit, a '.' or a exponent character ('e', 'E', 'd' or 'D')
     21794-     is required at this point */
     21795-
     21796-  if (!isdigit (*p) && *p != '.' && *p != ',' && *p != 'd' && *p != 'D'
     21797-      && *p != 'e' && *p != 'E')
     21798-    goto bad_float;
     21799-
     21800-  /* Remember the position of the first digit.  */
     21801-  digits = p;
     21802-  ndigits = 0;
     21803-
     21804-  /* Scan through the string to find the exponent.  */
     21805+  /* Process the mantissa string.  */
     21806   while (w > 0)
     21807     {
     21808       switch (*p)
     21809        {
     21810        case ',':
     21811-         if (dtp->u.p.current_unit->decimal_status == DECIMAL_COMMA
     21812-               && *p == ',')
     21813-           *p = '.';
     21814-         else
     21815+         if (dtp->u.p.current_unit->decimal_status != DECIMAL_COMMA)
     21816            goto bad_float;
     21817-         /* Fall through */
     21818+         /* Fall through.  */
     21819        case '.':
     21820          if (seen_dp)
     21821            goto bad_float;
     21822+         if (!seen_int_digit)
     21823+           *(out++) = '0';
     21824+         *(out++) = '.';
     21825          seen_dp = 1;
     21826-         /* Fall through */
     21827+         break;
     21828 
     21829+       case ' ':
     21830+         if (dtp->u.p.blank_status == BLANK_ZERO)
     21831+           {
     21832+             *(out++) = '0';
     21833+             goto found_digit;
     21834+           }
     21835+         else if (dtp->u.p.blank_status == BLANK_NULL)
     21836+           break;
     21837+         else
     21838+           /* TODO: Should we check instead that there are only trailing
     21839+              blanks here, as is done below for exponents?  */
     21840+           goto done;
     21841+         /* Fall through.  */
     21842        case '0':
     21843        case '1':
     21844        case '2':
     21845@@ -857,207 +845,173 @@
     21846        case '7':
     21847        case '8':
     21848        case '9':
     21849-       case ' ':
     21850-         ndigits++;
     21851-         p++;
     21852-         w--;
     21853+         *(out++) = *p;
     21854+found_digit:
     21855+         if (!seen_dp)
     21856+           seen_int_digit = 1;
     21857+         else
     21858+           seen_dec_digit = 1;
     21859          break;
     21860 
     21861        case '-':
     21862-         exponent_sign = -1;
     21863-         /* Fall through */
     21864-
     21865        case '+':
     21866-         p++;
     21867-         w--;
     21868-         goto exp2;
     21869+         goto exponent;
     21870 
     21871-       case 'd':
     21872        case 'e':
     21873-       case 'D':
     21874        case 'E':
     21875-         p++;
     21876-         w--;
     21877-         goto exp1;
     21878+       case 'd':
     21879+       case 'D':
     21880+         ++p;
     21881+         --w;
     21882+         goto exponent;
     21883 
     21884        default:
     21885          goto bad_float;
     21886        }
     21887-    }
     21888 
     21889-  /* No exponent has been seen, so we use the current scale factor */
     21890-  exponent = -dtp->u.p.scale_factor;
     21891-  goto done;
     21892-
     21893- bad_float:
     21894-  generate_error (&dtp->common, LIBERROR_READ_VALUE,
     21895-                 "Bad value during floating point read");
     21896-  next_record (dtp, 1);
     21897-  return;
     21898-
     21899-  /* The value read is zero */
     21900- zero:
     21901-  switch (length)
     21902-    {
     21903-      case 4:
     21904-       *((GFC_REAL_4 *) dest) = 0;
     21905-       break;
     21906-
     21907-      case 8:
     21908-       *((GFC_REAL_8 *) dest) = 0;
     21909-       break;
     21910-
     21911-#ifdef HAVE_GFC_REAL_10
     21912-      case 10:
     21913-       *((GFC_REAL_10 *) dest) = 0;
     21914-       break;
     21915-#endif
     21916-
     21917-#ifdef HAVE_GFC_REAL_16
     21918-      case 16:
     21919-       *((GFC_REAL_16 *) dest) = 0;
     21920-       break;
     21921-#endif
     21922-
     21923-      default:
     21924-       internal_error (&dtp->common, "Unsupported real kind during IO");
     21925+      ++p;
     21926+      --w;
     21927     }
     21928-  return;
     21929
     21930+  /* No exponent has been seen, so we use the current scale factor.  */
     21931+  exponent = - dtp->u.p.scale_factor;
     21932+  goto done;
     21933 
     21934-  /* At this point the start of an exponent has been found */
     21935- exp1:
     21936-  while (w > 0 && *p == ' ')
     21937+  /* At this point the start of an exponent has been found.  */
     21938+exponent:
     21939+  p = eat_leading_spaces (&w, (char*) p);
     21940+  if (*p == '-' || *p == '+')
     21941     {
     21942-      w--;
     21943-      p++;
     21944+      if (*p == '-')
     21945+       exponent_sign = -1;
     21946+      ++p;
     21947+      --w;
     21948     }
     21949 
     21950-  switch (*p)
     21951-    {
     21952-    case '-':
     21953-      exponent_sign = -1;
     21954-      /* Fall through */
     21955-
     21956-    case '+':
     21957-      p++;
     21958-      w--;
     21959-      break;
     21960-    }
     21961+  /* At this point a digit string is required.  We calculate the value
     21962+     of the exponent in order to take account of the scale factor and
     21963+     the d parameter before explict conversion takes place.  */
     21964 
     21965   if (w == 0)
     21966     goto bad_float;
     21967 
     21968-  /* At this point a digit string is required.  We calculate the value
     21969-     of the exponent in order to take account of the scale factor and
     21970-     the d parameter before explict conversion takes place. */
     21971- exp2:
     21972-  /* Normal processing of exponent */
     21973-  exponent = 0;
     21974   if (dtp->u.p.blank_status == BLANK_UNSPECIFIED)
     21975     {
     21976       while (w > 0 && isdigit (*p))
     21977-        {
     21978-          exponent = 10 * exponent + *p - '0';
     21979-          p++;
     21980-          w--;
     21981-        }
     21982-       
     21983-      /* Only allow trailing blanks */
     21984-
     21985+       {
     21986+         exponent *= 10;
     21987+         exponent += *p - '0';
     21988+         ++p;
     21989+         --w;
     21990+       }
     21991+       
     21992+      /* Only allow trailing blanks.  */
     21993       while (w > 0)
     21994-        {
     21995-          if (*p != ' ')
     21996+       {
     21997+         if (*p != ' ')
     21998            goto bad_float;
     21999-          p++;
     22000-          w--;
     22001-        }
     22002+         ++p;
     22003+         --w;
     22004+       }
     22005     }   
     22006-  else  /* BZ or BN status is enabled */
     22007+  else  /* BZ or BN status is enabled.  */
     22008     {
     22009       while (w > 0)
     22010-        {
     22011-          if (*p == ' ')
     22012-            {
     22013-             if (dtp->u.p.blank_status == BLANK_ZERO) *p = '0';
     22014-             if (dtp->u.p.blank_status == BLANK_NULL)
     22015-                {
     22016-                  p++;
     22017-                  w--;
     22018-                  continue;
     22019-                }
     22020-            }
     22021-          else if (!isdigit (*p))
     22022-            goto bad_float;
     22023-
     22024-          exponent = 10 * exponent + *p - '0';
     22025-          p++;
     22026-          w--;
     22027-        }
     22028+       {
     22029+         if (*p == ' ')
     22030+           {
     22031+             if (dtp->u.p.blank_status == BLANK_ZERO)
     22032+               exponent *= 10;
     22033+             else
     22034+               assert (dtp->u.p.blank_status == BLANK_NULL);
     22035+           }
     22036+         else if (!isdigit (*p))
     22037+           goto bad_float;
     22038+         else
     22039+           {
     22040+             exponent *= 10;
     22041+             exponent += *p - '0';
     22042+           }
     22043+
     22044+         ++p;
     22045+         --w;
     22046+       }
     22047     }
     22048 
     22049-  exponent = exponent * exponent_sign;
     22050+  exponent *= exponent_sign;
     22051 
     22052- done:
     22053+done:
     22054   /* Use the precision specified in the format if no decimal point has been
     22055      seen.  */
     22056   if (!seen_dp)
     22057     exponent -= f->u.real.d;
     22058 
     22059-  if (exponent > 0)
     22060+  /* Output a trailing '0' after decimal point if not yet found.  */
     22061+  if (seen_dp && !seen_dec_digit)
     22062+    *(out++) = '0';
     22063+
     22064+  /* Print out the exponent to finish the reformatted number.  Maximum 4
     22065+     digits for the exponent.  */
     22066+  if (exponent != 0)
     22067     {
     22068-      edigits = 2;
     22069-      i = exponent;
     22070-    }
     22071-  else
     22072-    {
     22073-      edigits = 3;
     22074-      i = -exponent;
     22075-    }
     22076+      int dig;
     22077 
     22078-  while (i >= 10)
     22079-    {
     22080-      i /= 10;
     22081-      edigits++;
     22082+      *(out++) = 'e';
     22083+      if (exponent < 0)
     22084+       {
     22085+         *(out++) = '-';
     22086+         exponent = - exponent;
     22087+       }
     22088+
     22089+      assert (exponent < 10000);
     22090+      for (dig = 3; dig >= 0; --dig)
     22091+       {
     22092+         out[dig] = (char) ('0' + exponent % 10);
     22093+         exponent /= 10;
     22094+       }
     22095+      out += 4;
     22096     }
     22097+  *(out++) = '\0';
     22098 
     22099-  i = ndigits + edigits + 1;
     22100-  if (val_sign < 0)
     22101-    i++;
     22102+  /* Do the actual conversion.  */
     22103+  convert_real (dtp, dest, buffer, length);
     22104 
     22105-  if (i < SCRATCH_SIZE)
     22106-    buffer = scratch;
     22107-  else
     22108-    buffer = get_mem (i);
     22109+  return;
     22110 
     22111-  /* Reformat the string into a temporary buffer.  As we're using atof it's
     22112-     easiest to just leave the decimal point in place.  */
     22113-  p = buffer;
     22114-  if (val_sign < 0)
     22115-    *(p++) = '-';
     22116-  for (; ndigits > 0; ndigits--)
     22117+  /* The value read is zero.  */
     22118+zero:
     22119+  switch (length)
     22120     {
     22121-      if (*digits == ' ')
     22122-        {
     22123-         if (dtp->u.p.blank_status == BLANK_ZERO) *digits = '0';
     22124-         if (dtp->u.p.blank_status == BLANK_NULL)
     22125-            {
     22126-              digits++;
     22127-              continue;
     22128-            }
     22129-        }
     22130-      *p = *digits;
     22131-      p++;
     22132-      digits++;
     22133-    }
     22134-  *(p++) = 'e';
     22135-  sprintf (p, "%d", exponent);
     22136+      case 4:
     22137+       *((GFC_REAL_4 *) dest) = 0.0;
     22138+       break;
     22139 
     22140-  /* Do the actual conversion.  */
     22141-  convert_real (dtp, dest, buffer, length);
     22142+      case 8:
     22143+       *((GFC_REAL_8 *) dest) = 0.0;
     22144+       break;
     22145 
     22146-  if (buffer != scratch)
     22147-     free_mem (buffer);
     22148+#ifdef HAVE_GFC_REAL_10
     22149+      case 10:
     22150+       *((GFC_REAL_10 *) dest) = 0.0;
     22151+       break;
     22152+#endif
     22153 
     22154+#ifdef HAVE_GFC_REAL_16
     22155+      case 16:
     22156+       *((GFC_REAL_16 *) dest) = 0.0;
     22157+       break;
     22158+#endif
     22159+
     22160+      default:
     22161+       internal_error (&dtp->common, "Unsupported real kind during IO");
     22162+    }
     22163+  return;
     22164+
     22165+bad_float:
     22166+  generate_error (&dtp->common, LIBERROR_READ_VALUE,
     22167+                 "Bad value during floating point read");
     22168+  next_record (dtp, 1);
     22169+  return;
     22170 }
     22171 
     22172 
     22173diff -Naur gcc-4.4.0.orig/libgfortran/io/transfer.c gcc-4.4.0/libgfortran/io/transfer.c
     22174--- gcc-4.4.0.orig/libgfortran/io/transfer.c    2009-04-09 16:23:07.000000000 -0700
     22175+++ gcc-4.4.0/libgfortran/io/transfer.c 2009-05-26 18:21:22.000000000 -0700
     22176@@ -32,6 +32,7 @@
     22177 #include <string.h>
     22178 #include <assert.h>
     22179 #include <stdlib.h>
     22180+#include <errno.h>
     22181 
     22182 
     22183 /* Calling conventions:  Data transfer statements are unlike other
     22184@@ -178,60 +179,58 @@
     22185    heap.  Hopefully this won't happen very often.  */
     22186 
     22187 char *
     22188-read_sf (st_parameter_dt *dtp, int *length, int no_error)
     22189+read_sf (st_parameter_dt *dtp, int * length, int no_error)
     22190 {
     22191+  static char *empty_string[0];
     22192   char *base, *p, q;
     22193-  int n, crlf;
     22194-  gfc_offset pos;
     22195-  size_t readlen;
     22196-
     22197-  if (*length > SCRATCH_SIZE)
     22198-    dtp->u.p.line_buffer = get_mem (*length);
     22199-  p = base = dtp->u.p.line_buffer;
     22200+  int n, lorig, memread, seen_comma;
     22201+
     22202+  /* If we hit EOF previously with the no_error flag set (i.e. X, T,
     22203+     TR edit descriptors), and we now try to read again, this time
     22204+     without setting no_error.  */
     22205+  if (!no_error && dtp->u.p.at_eof)
     22206+    {
     22207+      *length = 0;
     22208+      hit_eof (dtp);
     22209+      return NULL;
     22210+    }
     22211 
     22212   /* If we have seen an eor previously, return a length of 0.  The
     22213      caller is responsible for correctly padding the input field.  */
     22214   if (dtp->u.p.sf_seen_eor)
     22215     {
     22216       *length = 0;
     22217-      return base;
     22218+      /* Just return something that isn't a NULL pointer, otherwise the
     22219+         caller thinks an error occured.  */
     22220+      return (char*) empty_string;
     22221     }
     22222 
     22223   if (is_internal_unit (dtp))
     22224     {
     22225-      readlen = *length;
     22226-      if (unlikely (sread (dtp->u.p.current_unit->s, p, &readlen) != 0
     22227-                   || readlen < (size_t) *length))
     22228+      memread = *length;
     22229+      base = mem_alloc_r (dtp->u.p.current_unit->s, length);
     22230+      if (unlikely (memread > *length))
     22231        {
     22232-         generate_error (&dtp->common, LIBERROR_END, NULL);
     22233+          hit_eof (dtp);
     22234          return NULL;
     22235        }
     22236-       
     22237+      n = *length;
     22238       goto done;
     22239     }
     22240 
     22241-  readlen = 1;
     22242-  n = 0;
     22243+  n = seen_comma = 0;
     22244 
     22245-  do
     22246-    {
     22247-      if (unlikely (sread (dtp->u.p.current_unit->s, &q, &readlen) != 0))
     22248-        {
     22249-         generate_error (&dtp->common, LIBERROR_END, NULL);
     22250-         return NULL;
     22251-       }
     22252+  /* Read data into format buffer and scan through it.  */
     22253+  lorig = *length;
     22254+  base = p = fbuf_read (dtp->u.p.current_unit, length);
     22255+  if (base == NULL)
     22256+    return NULL;
     22257 
     22258-      /* If we have a line without a terminating \n, drop through to
     22259-        EOR below.  */
     22260-      if (readlen < 1 && n == 0)
     22261-       {
     22262-         if (likely (no_error))
     22263-           break;
     22264-         generate_error (&dtp->common, LIBERROR_END, NULL);
     22265-         return NULL;
     22266-       }
     22267+  while (n < *length)
     22268+    {
     22269+      q = *p;
     22270 
     22271-      if (readlen < 1 || q == '\n' || q == '\r')
     22272+      if (q == '\n' || q == '\r')
     22273        {
     22274          /* Unexpected end of line.  */
     22275 
     22276@@ -240,23 +239,14 @@
     22277          if (dtp->u.p.advance_status == ADVANCE_NO || dtp->u.p.seen_dollar)
     22278            dtp->u.p.eor_condition = 1;
     22279 
     22280-         crlf = 0;
     22281          /* If we encounter a CR, it might be a CRLF.  */
     22282          if (q == '\r') /* Probably a CRLF */
     22283            {
     22284-             readlen = 1;
     22285-             pos = stream_offset (dtp->u.p.current_unit->s);
     22286-             if (unlikely (sread (dtp->u.p.current_unit->s, &q, &readlen)
     22287-                           != 0))
     22288-               {
     22289-                 generate_error (&dtp->common, LIBERROR_END, NULL);
     22290-                 return NULL;
     22291-               }
     22292-             if (q != '\n' && readlen == 1) /* Not a CRLF after all.  */
     22293-               sseek (dtp->u.p.current_unit->s, pos);
     22294-             else
     22295-               crlf = 1;
     22296+             if (n < *length && *(p + 1) == '\n')
     22297+               dtp->u.p.sf_seen_eor = 2;
     22298            }
     22299+          else
     22300+            dtp->u.p.sf_seen_eor = 1;
     22301 
     22302          /* Without padding, terminate the I/O statement without assigning
     22303             the value.  With padding, the value still needs to be assigned,
     22304@@ -270,7 +260,6 @@
     22305            }
     22306 
     22307          *length = n;
     22308-         dtp->u.p.sf_seen_eor = (crlf ? 2 : 1);
     22309          break;
     22310        }
     22311       /*  Short circuit the read if a comma is found during numeric input.
     22312@@ -279,6 +268,7 @@
     22313       if (q == ',')
     22314        if (dtp->u.p.sf_read_comma == 1)
     22315          {
     22316+            seen_comma = 1;
     22317            notify_std (&dtp->common, GFC_STD_GNU,
     22318                        "Comma in formatted numeric read.");
     22319            *length = n;
     22320@@ -286,16 +276,31 @@
     22321          }
     22322 
     22323       n++;
     22324-      *p++ = q;
     22325-      dtp->u.p.sf_seen_eor = 0;
     22326+      p++;
     22327+    }
     22328+
     22329+  fbuf_seek (dtp->u.p.current_unit, n + dtp->u.p.sf_seen_eor + seen_comma,
     22330+             SEEK_CUR);
     22331+
     22332+  /* A short read implies we hit EOF, unless we hit EOR, a comma, or
     22333+     some other stuff. Set the relevant flags.  */
     22334+  if (lorig > *length && !dtp->u.p.sf_seen_eor && !seen_comma)
     22335+    {
     22336+      if (no_error)
     22337+        dtp->u.p.at_eof = 1;
     22338+      else
     22339+        {
     22340+          hit_eof (dtp);
     22341+          return NULL;
     22342+        }
     22343     }
     22344-  while (n < *length);
     22345 
     22346  done:
     22347-  dtp->u.p.current_unit->bytes_left -= *length;
     22348+
     22349+  dtp->u.p.current_unit->bytes_left -= n;
     22350 
     22351   if ((dtp->common.flags & IOPARM_DT_HAS_SIZE) != 0)
     22352-    dtp->u.p.size_used += (GFC_IO_INT) *length;
     22353+    dtp->u.p.size_used += (GFC_IO_INT) n;
     22354 
     22355   return base;
     22356 }
     22357@@ -311,12 +316,11 @@
     22358    opened with PAD=YES.  The caller must assume tailing spaces for
     22359    short reads.  */
     22360 
     22361-try
     22362-read_block_form (st_parameter_dt *dtp, void *buf, size_t *nbytes)
     22363+void *
     22364+read_block_form (st_parameter_dt *dtp, int * nbytes)
     22365 {
     22366   char *source;
     22367-  size_t nread;
     22368-  int nb;
     22369+  int norig;
     22370 
     22371   if (!is_stream_io (dtp))
     22372     {
     22373@@ -333,15 +337,14 @@
     22374                {
     22375                  /* Not enough data left.  */
     22376                  generate_error (&dtp->common, LIBERROR_EOR, NULL);
     22377-                 return FAILURE;
     22378+                 return NULL;
     22379                }
     22380            }
     22381 
     22382          if (unlikely (dtp->u.p.current_unit->bytes_left == 0))
     22383            {
     22384-             dtp->u.p.current_unit->endfile = AT_ENDFILE;
     22385-             generate_error (&dtp->common, LIBERROR_END, NULL);
     22386-             return FAILURE;
     22387+              hit_eof (dtp);
     22388+             return NULL;
     22389            }
     22390 
     22391          *nbytes = dtp->u.p.current_unit->bytes_left;
     22392@@ -352,42 +355,36 @@
     22393       (dtp->u.p.current_unit->flags.access == ACCESS_SEQUENTIAL ||
     22394        dtp->u.p.current_unit->flags.access == ACCESS_STREAM))
     22395     {
     22396-      nb = *nbytes;
     22397-      source = read_sf (dtp, &nb, 0);
     22398-      *nbytes = nb;
     22399+      source = read_sf (dtp, nbytes, 0);
     22400       dtp->u.p.current_unit->strm_pos +=
     22401        (gfc_offset) (*nbytes + dtp->u.p.sf_seen_eor);
     22402-      if (source == NULL)
     22403-       return FAILURE;
     22404-      memcpy (buf, source, *nbytes);
     22405-      return SUCCESS;
     22406+      return source;
     22407     }
     22408+
     22409+  /* If we reach here, we can assume it's direct access.  */
     22410+
     22411   dtp->u.p.current_unit->bytes_left -= (gfc_offset) *nbytes;
     22412 
     22413-  nread = *nbytes;
     22414-  if (unlikely (sread (dtp->u.p.current_unit->s, buf, &nread) != 0))
     22415-    {
     22416-      generate_error (&dtp->common, LIBERROR_OS, NULL);
     22417-      return FAILURE;
     22418-    }
     22419+  norig = *nbytes;
     22420+  source = fbuf_read (dtp->u.p.current_unit, nbytes);
     22421+  fbuf_seek (dtp->u.p.current_unit, *nbytes, SEEK_CUR);
     22422 
     22423   if ((dtp->common.flags & IOPARM_DT_HAS_SIZE) != 0)
     22424-    dtp->u.p.size_used += (GFC_IO_INT) nread;
     22425+    dtp->u.p.size_used += (GFC_IO_INT) *nbytes;
     22426 
     22427-  if (nread != *nbytes)
     22428-    {                          /* Short read, this shouldn't happen.  */
     22429-      if (likely (dtp->u.p.current_unit->pad_status == PAD_YES))
     22430-       *nbytes = nread;
     22431-      else
     22432+  if (norig != *nbytes)
     22433+    {                         
     22434+      /* Short read, this shouldn't happen.  */
     22435+      if (!dtp->u.p.current_unit->pad_status == PAD_YES)
     22436        {
     22437          generate_error (&dtp->common, LIBERROR_EOR, NULL);
     22438          source = NULL;
     22439        }
     22440     }
     22441 
     22442-  dtp->u.p.current_unit->strm_pos += (gfc_offset) nread;
     22443+  dtp->u.p.current_unit->strm_pos += (gfc_offset) *nbytes;
     22444 
     22445-  return SUCCESS;
     22446+  return source;
     22447 }
     22448 
     22449 
     22450@@ -395,20 +392,19 @@
     22451    unformatted files.  */
     22452 
     22453 static void
     22454-read_block_direct (st_parameter_dt *dtp, void *buf, size_t *nbytes)
     22455+read_block_direct (st_parameter_dt *dtp, void *buf, size_t nbytes)
     22456 {
     22457-  size_t to_read_record;
     22458-  size_t have_read_record;
     22459-  size_t to_read_subrecord;
     22460-  size_t have_read_subrecord;
     22461+  ssize_t to_read_record;
     22462+  ssize_t have_read_record;
     22463+  ssize_t to_read_subrecord;
     22464+  ssize_t have_read_subrecord;
     22465   int short_record;
     22466 
     22467   if (is_stream_io (dtp))
     22468     {
     22469-      to_read_record = *nbytes;
     22470-      have_read_record = to_read_record;
     22471-      if (unlikely (sread (dtp->u.p.current_unit->s, buf, &have_read_record)
     22472-                   != 0))
     22473+      have_read_record = sread (dtp->u.p.current_unit->s, buf,
     22474+                               nbytes);
     22475+      if (unlikely (have_read_record < 0))
     22476        {
     22477          generate_error (&dtp->common, LIBERROR_OS, NULL);
     22478          return;
     22479@@ -416,52 +412,48 @@
     22480 
     22481       dtp->u.p.current_unit->strm_pos += (gfc_offset) have_read_record;
     22482 
     22483-      if (unlikely (to_read_record != have_read_record))
     22484+      if (unlikely ((ssize_t) nbytes != have_read_record))
     22485        {
     22486          /* Short read,  e.g. if we hit EOF.  For stream files,
     22487           we have to set the end-of-file condition.  */
     22488-         generate_error (&dtp->common, LIBERROR_END, NULL);
     22489-         return;
     22490+          hit_eof (dtp);
     22491        }
     22492       return;
     22493     }
     22494 
     22495   if (dtp->u.p.current_unit->flags.access == ACCESS_DIRECT)
     22496     {
     22497-      if (dtp->u.p.current_unit->bytes_left < (gfc_offset) *nbytes)
     22498+      if (dtp->u.p.current_unit->bytes_left < (gfc_offset) nbytes)
     22499        {
     22500          short_record = 1;
     22501-         to_read_record = (size_t) dtp->u.p.current_unit->bytes_left;
     22502-         *nbytes = to_read_record;
     22503+         to_read_record = dtp->u.p.current_unit->bytes_left;
     22504+         nbytes = to_read_record;
     22505        }
     22506-
     22507       else
     22508        {
     22509          short_record = 0;
     22510-         to_read_record = *nbytes;
     22511+         to_read_record = nbytes;
     22512        }
     22513 
     22514       dtp->u.p.current_unit->bytes_left -= to_read_record;
     22515 
     22516-      if (unlikely (sread (dtp->u.p.current_unit->s, buf, &to_read_record)
     22517-                   != 0))
     22518+      to_read_record = sread (dtp->u.p.current_unit->s, buf, to_read_record);
     22519+      if (unlikely (to_read_record < 0))
     22520        {
     22521          generate_error (&dtp->common, LIBERROR_OS, NULL);
     22522          return;
     22523        }
     22524 
     22525-      if (to_read_record != *nbytes) 
     22526+      if (to_read_record != (ssize_t) nbytes) 
     22527        {
     22528          /* Short read, e.g. if we hit EOF.  Apparently, we read
     22529           more than was written to the last record.  */
     22530-         *nbytes = to_read_record;
     22531          return;
     22532        }
     22533 
     22534       if (unlikely (short_record))
     22535        {
     22536          generate_error (&dtp->common, LIBERROR_SHORT_RECORD, NULL);
     22537-         return;
     22538        }
     22539       return;
     22540     }
     22541@@ -470,23 +462,17 @@
     22542      until the request has been fulfilled or the record has run out
     22543      of continuation subrecords.  */
     22544 
     22545-  if (unlikely (dtp->u.p.current_unit->endfile == AT_ENDFILE))
     22546-    {
     22547-      generate_error (&dtp->common, LIBERROR_END, NULL);
     22548-      return;
     22549-    }
     22550-
     22551   /* Check whether we exceed the total record length.  */
     22552 
     22553   if (dtp->u.p.current_unit->flags.has_recl
     22554-      && (*nbytes > (size_t) dtp->u.p.current_unit->bytes_left))
     22555+      && ((gfc_offset) nbytes > dtp->u.p.current_unit->bytes_left))
     22556     {
     22557-      to_read_record = (size_t) dtp->u.p.current_unit->bytes_left;
     22558+      to_read_record = dtp->u.p.current_unit->bytes_left;
     22559       short_record = 1;
     22560     }
     22561   else
     22562     {
     22563-      to_read_record = *nbytes;
     22564+      to_read_record = nbytes;
     22565       short_record = 0;
     22566     }
     22567   have_read_record = 0;
     22568@@ -496,7 +482,7 @@
     22569       if (dtp->u.p.current_unit->bytes_left_subrecord
     22570          < (gfc_offset) to_read_record)
     22571        {
     22572-         to_read_subrecord = (size_t) dtp->u.p.current_unit->bytes_left_subrecord;
     22573+         to_read_subrecord = dtp->u.p.current_unit->bytes_left_subrecord;
     22574          to_read_record -= to_read_subrecord;
     22575        }
     22576       else
     22577@@ -507,9 +493,9 @@
     22578 
     22579       dtp->u.p.current_unit->bytes_left_subrecord -= to_read_subrecord;
     22580 
     22581-      have_read_subrecord = to_read_subrecord;
     22582-      if (unlikely (sread (dtp->u.p.current_unit->s, buf + have_read_record,
     22583-                          &have_read_subrecord) != 0))
     22584+      have_read_subrecord = sread (dtp->u.p.current_unit->s,
     22585+                                  buf + have_read_record, to_read_subrecord);
     22586+      if (unlikely (have_read_subrecord) < 0)
     22587        {
     22588          generate_error (&dtp->common, LIBERROR_OS, NULL);
     22589          return;
     22590@@ -524,7 +510,6 @@
     22591             structure has been corrupted, or the trailing record
     22592             marker would still be present.  */
     22593 
     22594-         *nbytes = have_read_record;
     22595          generate_error (&dtp->common, LIBERROR_CORRUPT_FILE, NULL);
     22596          return;
     22597        }
     22598@@ -598,7 +583,7 @@
     22599 
     22600   if (is_internal_unit (dtp))
     22601     {
     22602-    dest = salloc_w (dtp->u.p.current_unit->s, &length);
     22603+    dest = mem_alloc_w (dtp->u.p.current_unit->s, &length);
     22604 
     22605     if (dest == NULL)
     22606       {
     22607@@ -636,20 +621,22 @@
     22608 write_buf (st_parameter_dt *dtp, void *buf, size_t nbytes)
     22609 {
     22610 
     22611-  size_t have_written, to_write_subrecord;
     22612+  ssize_t have_written;
     22613+  ssize_t to_write_subrecord;
     22614   int short_record;
     22615 
     22616   /* Stream I/O.  */
     22617 
     22618   if (is_stream_io (dtp))
     22619     {
     22620-      if (unlikely (swrite (dtp->u.p.current_unit->s, buf, &nbytes) != 0))
     22621+      have_written = swrite (dtp->u.p.current_unit->s, buf, nbytes);
     22622+      if (unlikely (have_written < 0))
     22623        {
     22624          generate_error (&dtp->common, LIBERROR_OS, NULL);
     22625          return FAILURE;
     22626        }
     22627 
     22628-      dtp->u.p.current_unit->strm_pos += (gfc_offset) nbytes;
     22629+      dtp->u.p.current_unit->strm_pos += (gfc_offset) have_written;
     22630 
     22631       return SUCCESS;
     22632     }
     22633@@ -667,14 +654,15 @@
     22634       if (buf == NULL && nbytes == 0)
     22635        return SUCCESS;
     22636 
     22637-      if (unlikely (swrite (dtp->u.p.current_unit->s, buf, &nbytes) != 0))
     22638+      have_written = swrite (dtp->u.p.current_unit->s, buf, nbytes);
     22639+      if (unlikely (have_written < 0))
     22640        {
     22641          generate_error (&dtp->common, LIBERROR_OS, NULL);
     22642          return FAILURE;
     22643        }
     22644 
     22645-      dtp->u.p.current_unit->strm_pos += (gfc_offset) nbytes;
     22646-      dtp->u.p.current_unit->bytes_left -= (gfc_offset) nbytes;
     22647+      dtp->u.p.current_unit->strm_pos += (gfc_offset) have_written;
     22648+      dtp->u.p.current_unit->bytes_left -= (gfc_offset) have_written;
     22649 
     22650       return SUCCESS;
     22651     }
     22652@@ -704,8 +692,9 @@
     22653       dtp->u.p.current_unit->bytes_left_subrecord -=
     22654        (gfc_offset) to_write_subrecord;
     22655 
     22656-      if (unlikely (swrite (dtp->u.p.current_unit->s, buf + have_written,
     22657-                           &to_write_subrecord) != 0))
     22658+      to_write_subrecord = swrite (dtp->u.p.current_unit->s,
     22659+                                  buf + have_written, to_write_subrecord);
     22660+      if (unlikely (to_write_subrecord < 0))
     22661        {
     22662          generate_error (&dtp->common, LIBERROR_OS, NULL);
     22663          return FAILURE;
     22664@@ -737,20 +726,18 @@
     22665 unformatted_read (st_parameter_dt *dtp, bt type,
     22666                  void *dest, int kind, size_t size, size_t nelems)
     22667 {
     22668-  size_t i, sz;
     22669-
     22670   if (likely (dtp->u.p.current_unit->flags.convert == GFC_CONVERT_NATIVE)
     22671       || kind == 1)
     22672     {
     22673-      sz = size * nelems;
     22674       if (type == BT_CHARACTER)
     22675-       sz *= GFC_SIZE_OF_CHAR_KIND(kind);
     22676-      read_block_direct (dtp, dest, &sz);
     22677+       size *= GFC_SIZE_OF_CHAR_KIND(kind);
     22678+      read_block_direct (dtp, dest, size * nelems);
     22679     }
     22680   else
     22681     {
     22682       char buffer[16];
     22683       char *p;
     22684+      size_t i;
     22685 
     22686       p = dest;
     22687 
     22688@@ -773,7 +760,7 @@
     22689       
     22690       for (i = 0; i < nelems; i++)
     22691        {
     22692-         read_block_direct (dtp, buffer, &size);
     22693+         read_block_direct (dtp, buffer, size);
     22694          reverse_memcpy (p, buffer, size);
     22695          p += size;
     22696        }
     22697@@ -915,19 +902,18 @@
     22698 }
     22699 
     22700 
     22701-/* This subroutine is the main loop for a formatted data transfer
     22702+/* This function is in the main loop for a formatted data transfer
     22703    statement.  It would be natural to implement this as a coroutine
     22704    with the user program, but C makes that awkward.  We loop,
     22705    processing format elements.  When we actually have to transfer
     22706    data instead of just setting flags, we return control to the user
     22707-   program which calls a subroutine that supplies the address and type
     22708+   program which calls a function that supplies the address and type
     22709    of the next element, then comes back here to process it.  */
     22710 
     22711 static void
     22712-formatted_transfer_scalar (st_parameter_dt *dtp, bt type, void *p, int kind,
     22713-                          size_t size)
     22714+formatted_transfer_scalar_read (st_parameter_dt *dtp, bt type, void *p, int kind,
     22715+                               size_t size)
     22716 {
     22717-  char scratch[SCRATCH_SIZE];
     22718   int pos, bytes_used;
     22719   const fnode *f;
     22720   format_token t;
     22721@@ -954,7 +940,347 @@
     22722   dtp->u.p.sf_read_comma =
     22723     dtp->u.p.current_unit->decimal_status == DECIMAL_COMMA ? 0 : 1;
     22724 
     22725-  dtp->u.p.line_buffer = scratch;
     22726+  for (;;)
     22727+    {
     22728+      /* If reversion has occurred and there is another real data item,
     22729+        then we have to move to the next record.  */
     22730+      if (dtp->u.p.reversion_flag && n > 0)
     22731+       {
     22732+         dtp->u.p.reversion_flag = 0;
     22733+         next_record (dtp, 0);
     22734+       }
     22735+
     22736+      consume_data_flag = 1;
     22737+      if ((dtp->common.flags & IOPARM_LIBRETURN_MASK) != IOPARM_LIBRETURN_OK)
     22738+       break;
     22739+
     22740+      f = next_format (dtp);
     22741+      if (f == NULL)
     22742+       {
     22743+         /* No data descriptors left.  */
     22744+         if (unlikely (n > 0))
     22745+           generate_error (&dtp->common, LIBERROR_FORMAT,
     22746+               "Insufficient data descriptors in format after reversion");
     22747+         return;
     22748+       }
     22749+
     22750+      t = f->format;
     22751+
     22752+      bytes_used = (int)(dtp->u.p.current_unit->recl
     22753+                  - dtp->u.p.current_unit->bytes_left);
     22754+
     22755+      if (is_stream_io(dtp))
     22756+       bytes_used = 0;
     22757+
     22758+      switch (t)
     22759+       {
     22760+       case FMT_I:
     22761+         if (n == 0)
     22762+           goto need_read_data;
     22763+         if (require_type (dtp, BT_INTEGER, type, f))
     22764+           return;
     22765+         read_decimal (dtp, f, p, kind);
     22766+         break;
     22767+
     22768+       case FMT_B:
     22769+         if (n == 0)
     22770+           goto need_read_data;
     22771+         if (compile_options.allow_std < GFC_STD_GNU
     22772+              && require_type (dtp, BT_INTEGER, type, f))
     22773+           return;
     22774+         read_radix (dtp, f, p, kind, 2);
     22775+         break;
     22776+
     22777+       case FMT_O:
     22778+         if (n == 0)
     22779+           goto need_read_data;
     22780+         if (compile_options.allow_std < GFC_STD_GNU
     22781+              && require_type (dtp, BT_INTEGER, type, f))
     22782+           return;
     22783+         read_radix (dtp, f, p, kind, 8);
     22784+         break;
     22785+
     22786+       case FMT_Z:
     22787+         if (n == 0)
     22788+           goto need_read_data;
     22789+         if (compile_options.allow_std < GFC_STD_GNU
     22790+              && require_type (dtp, BT_INTEGER, type, f))
     22791+           return;
     22792+         read_radix (dtp, f, p, kind, 16);
     22793+         break;
     22794+
     22795+       case FMT_A:
     22796+         if (n == 0)
     22797+           goto need_read_data;
     22798+
     22799+         /* It is possible to have FMT_A with something not BT_CHARACTER such
     22800+            as when writing out hollerith strings, so check both type
     22801+            and kind before calling wide character routines.  */
     22802+         if (type == BT_CHARACTER && kind == 4)
     22803+           read_a_char4 (dtp, f, p, size);
     22804+         else
     22805+           read_a (dtp, f, p, size);
     22806+         break;
     22807+
     22808+       case FMT_L:
     22809+         if (n == 0)
     22810+           goto need_read_data;
     22811+         read_l (dtp, f, p, kind);
     22812+         break;
     22813+
     22814+       case FMT_D:
     22815+         if (n == 0)
     22816+           goto need_read_data;
     22817+         if (require_type (dtp, BT_REAL, type, f))
     22818+           return;
     22819+         read_f (dtp, f, p, kind);
     22820+         break;
     22821+
     22822+       case FMT_E:
     22823+         if (n == 0)
     22824+           goto need_read_data;
     22825+         if (require_type (dtp, BT_REAL, type, f))
     22826+           return;
     22827+         read_f (dtp, f, p, kind);
     22828+         break;
     22829+
     22830+       case FMT_EN:
     22831+         if (n == 0)
     22832+           goto need_read_data;
     22833+         if (require_type (dtp, BT_REAL, type, f))
     22834+           return;
     22835+         read_f (dtp, f, p, kind);
     22836+         break;
     22837+
     22838+       case FMT_ES:
     22839+         if (n == 0)
     22840+           goto need_read_data;
     22841+         if (require_type (dtp, BT_REAL, type, f))
     22842+           return;
     22843+         read_f (dtp, f, p, kind);
     22844+         break;
     22845+
     22846+       case FMT_F:
     22847+         if (n == 0)
     22848+           goto need_read_data;
     22849+         if (require_type (dtp, BT_REAL, type, f))
     22850+           return;
     22851+         read_f (dtp, f, p, kind);
     22852+         break;
     22853+
     22854+       case FMT_G:
     22855+         if (n == 0)
     22856+           goto need_read_data;
     22857+         switch (type)
     22858+           {
     22859+             case BT_INTEGER:
     22860+               read_decimal (dtp, f, p, kind);
     22861+               break;
     22862+             case BT_LOGICAL:
     22863+               read_l (dtp, f, p, kind);
     22864+               break;
     22865+             case BT_CHARACTER:
     22866+               if (kind == 4)
     22867+                 read_a_char4 (dtp, f, p, size);
     22868+               else
     22869+                 read_a (dtp, f, p, size);
     22870+               break;
     22871+             case BT_REAL:
     22872+               read_f (dtp, f, p, kind);
     22873+               break;
     22874+             default:
     22875+               internal_error (&dtp->common, "formatted_transfer(): Bad type");
     22876+           }
     22877+         break;
     22878+
     22879+       case FMT_STRING:
     22880+         consume_data_flag = 0;
     22881+         format_error (dtp, f, "Constant string in input format");
     22882+         return;
     22883+
     22884+       /* Format codes that don't transfer data.  */
     22885+       case FMT_X:
     22886+       case FMT_TR:
     22887+         consume_data_flag = 0;
     22888+         dtp->u.p.skips += f->u.n;
     22889+         pos = bytes_used + dtp->u.p.skips - 1;
     22890+         dtp->u.p.pending_spaces = pos - dtp->u.p.max_pos + 1;
     22891+         read_x (dtp, f->u.n);
     22892+         break;
     22893+
     22894+       case FMT_TL:
     22895+       case FMT_T:
     22896+         consume_data_flag = 0;
     22897+
     22898+         if (f->format == FMT_TL)
     22899+           {
     22900+             /* Handle the special case when no bytes have been used yet.
     22901+                Cannot go below zero. */
     22902+             if (bytes_used == 0)
     22903+               {
     22904+                 dtp->u.p.pending_spaces -= f->u.n;
     22905+                 dtp->u.p.skips -= f->u.n;
     22906+                 dtp->u.p.skips = dtp->u.p.skips < 0 ? 0 : dtp->u.p.skips;
     22907+               }
     22908+
     22909+             pos = bytes_used - f->u.n;
     22910+           }
     22911+         else /* FMT_T */
     22912+           pos = f->u.n - 1;
     22913+
     22914+         /* Standard 10.6.1.1: excessive left tabbing is reset to the
     22915+            left tab limit.  We do not check if the position has gone
     22916+            beyond the end of record because a subsequent tab could
     22917+            bring us back again.  */
     22918+         pos = pos < 0 ? 0 : pos;
     22919+
     22920+         dtp->u.p.skips = dtp->u.p.skips + pos - bytes_used;
     22921+         dtp->u.p.pending_spaces = dtp->u.p.pending_spaces
     22922+                                   + pos - dtp->u.p.max_pos;
     22923+         dtp->u.p.pending_spaces = dtp->u.p.pending_spaces < 0
     22924+                                   ? 0 : dtp->u.p.pending_spaces;
     22925+         if (dtp->u.p.skips == 0)
     22926+           break;
     22927+
     22928+         /* Adjust everything for end-of-record condition */
     22929+         if (dtp->u.p.sf_seen_eor && !is_internal_unit (dtp))
     22930+           {
     22931+              dtp->u.p.current_unit->bytes_left -= dtp->u.p.sf_seen_eor;
     22932+              dtp->u.p.skips -= dtp->u.p.sf_seen_eor;
     22933+             bytes_used = pos;
     22934+             dtp->u.p.sf_seen_eor = 0;
     22935+           }
     22936+         if (dtp->u.p.skips < 0)
     22937+           {
     22938+              if (is_internal_unit (dtp)) 
     22939+                sseek (dtp->u.p.current_unit->s, dtp->u.p.skips, SEEK_CUR);
     22940+              else
     22941+                fbuf_seek (dtp->u.p.current_unit, dtp->u.p.skips, SEEK_CUR);
     22942+             dtp->u.p.current_unit->bytes_left -= (gfc_offset) dtp->u.p.skips;
     22943+             dtp->u.p.skips = dtp->u.p.pending_spaces = 0;
     22944+           }
     22945+         else
     22946+           read_x (dtp, dtp->u.p.skips);
     22947+         break;
     22948+
     22949+       case FMT_S:
     22950+         consume_data_flag = 0;
     22951+         dtp->u.p.sign_status = SIGN_S;
     22952+         break;
     22953+
     22954+       case FMT_SS:
     22955+         consume_data_flag = 0;
     22956+         dtp->u.p.sign_status = SIGN_SS;
     22957+         break;
     22958+
     22959+       case FMT_SP:
     22960+         consume_data_flag = 0;
     22961+         dtp->u.p.sign_status = SIGN_SP;
     22962+         break;
     22963+
     22964+       case FMT_BN:
     22965+         consume_data_flag = 0 ;
     22966+         dtp->u.p.blank_status = BLANK_NULL;
     22967+         break;
     22968+
     22969+       case FMT_BZ:
     22970+         consume_data_flag = 0;
     22971+         dtp->u.p.blank_status = BLANK_ZERO;
     22972+         break;
     22973+
     22974+       case FMT_DC:
     22975+         consume_data_flag = 0;
     22976+         dtp->u.p.current_unit->decimal_status = DECIMAL_COMMA;
     22977+         break;
     22978+
     22979+       case FMT_DP:
     22980+         consume_data_flag = 0;
     22981+         dtp->u.p.current_unit->decimal_status = DECIMAL_POINT;
     22982+         break;
     22983+
     22984+       case FMT_P:
     22985+         consume_data_flag = 0;
     22986+         dtp->u.p.scale_factor = f->u.k;
     22987+         break;
     22988+
     22989+       case FMT_DOLLAR:
     22990+         consume_data_flag = 0;
     22991+         dtp->u.p.seen_dollar = 1;
     22992+         break;
     22993+
     22994+       case FMT_SLASH:
     22995+         consume_data_flag = 0;
     22996+         dtp->u.p.skips = dtp->u.p.pending_spaces = 0;
     22997+         next_record (dtp, 0);
     22998+         break;
     22999+
     23000+       case FMT_COLON:
     23001+         /* A colon descriptor causes us to exit this loop (in
     23002+            particular preventing another / descriptor from being
     23003+            processed) unless there is another data item to be
     23004+            transferred.  */
     23005+         consume_data_flag = 0;
     23006+         if (n == 0)
     23007+           return;
     23008+         break;
     23009+
     23010+       default:
     23011+         internal_error (&dtp->common, "Bad format node");
     23012+       }
     23013+
     23014+      /* Adjust the item count and data pointer.  */
     23015+
     23016+      if ((consume_data_flag > 0) && (n > 0))
     23017+       {
     23018+         n--;
     23019+         p = ((char *) p) + size;
     23020+       }
     23021+
     23022+      dtp->u.p.skips = 0;
     23023+
     23024+      pos = (int)(dtp->u.p.current_unit->recl - dtp->u.p.current_unit->bytes_left);
     23025+      dtp->u.p.max_pos = (dtp->u.p.max_pos > pos) ? dtp->u.p.max_pos : pos;
     23026+    }
     23027+
     23028+  return;
     23029+
     23030+  /* Come here when we need a data descriptor but don't have one.  We
     23031+     push the current format node back onto the input, then return and
     23032+     let the user program call us back with the data.  */
     23033+ need_read_data:
     23034+  unget_format (dtp, f);
     23035+}
     23036+
     23037+
     23038+static void
     23039+formatted_transfer_scalar_write (st_parameter_dt *dtp, bt type, void *p, int kind,
     23040+                                size_t size)
     23041+{
     23042+  int pos, bytes_used;
     23043+  const fnode *f;
     23044+  format_token t;
     23045+  int n;
     23046+  int consume_data_flag;
     23047+
     23048+  /* Change a complex data item into a pair of reals.  */
     23049+
     23050+  n = (p == NULL) ? 0 : ((type != BT_COMPLEX) ? 1 : 2);
     23051+  if (type == BT_COMPLEX)
     23052+    {
     23053+      type = BT_REAL;
     23054+      size /= 2;
     23055+    }
     23056+
     23057+  /* If there's an EOR condition, we simulate finalizing the transfer
     23058+     by doing nothing.  */
     23059+  if (dtp->u.p.eor_condition)
     23060+    return;
     23061+
     23062+  /* Set this flag so that commas in reads cause the read to complete before
     23063+     the entire field has been read.  The next read field will start right after
     23064+     the comma in the stream.  (Set to 0 for character reads).  */
     23065+  dtp->u.p.sf_read_comma =
     23066+    dtp->u.p.current_unit->decimal_status == DECIMAL_COMMA ? 0 : 1;
     23067 
     23068   for (;;)
     23069     {
     23070@@ -1003,9 +1329,9 @@
     23071          if (dtp->u.p.skips < 0)
     23072            {
     23073               if (is_internal_unit (dtp)) 
     23074-               move_pos_offset (dtp->u.p.current_unit->s, dtp->u.p.skips);
     23075+               sseek (dtp->u.p.current_unit->s, dtp->u.p.skips, SEEK_CUR);
     23076               else
     23077-                fbuf_seek (dtp->u.p.current_unit, dtp->u.p.skips);
     23078+                fbuf_seek (dtp->u.p.current_unit, dtp->u.p.skips, SEEK_CUR);
     23079              dtp->u.p.current_unit->bytes_left -= (gfc_offset) dtp->u.p.skips;
     23080            }
     23081          dtp->u.p.skips = dtp->u.p.pending_spaces = 0;
     23082@@ -1024,57 +1350,34 @@
     23083            goto need_data;
     23084          if (require_type (dtp, BT_INTEGER, type, f))
     23085            return;
     23086-
     23087-         if (dtp->u.p.mode == READING)
     23088-           read_decimal (dtp, f, p, kind);
     23089-         else
     23090-           write_i (dtp, f, p, kind);
     23091-
     23092+         write_i (dtp, f, p, kind);
     23093          break;
     23094 
     23095        case FMT_B:
     23096          if (n == 0)
     23097            goto need_data;
     23098-
     23099          if (compile_options.allow_std < GFC_STD_GNU
     23100-              && require_type (dtp, BT_INTEGER, type, f))
     23101-           return;
     23102-
     23103-         if (dtp->u.p.mode == READING)
     23104-           read_radix (dtp, f, p, kind, 2);
     23105-         else
     23106-           write_b (dtp, f, p, kind);
     23107-
     23108+              && require_type (dtp, BT_INTEGER, type, f))
     23109+           return;
     23110+         write_b (dtp, f, p, kind);
     23111          break;
     23112 
     23113        case FMT_O:
     23114          if (n == 0)
     23115            goto need_data;
     23116-
     23117          if (compile_options.allow_std < GFC_STD_GNU
     23118               && require_type (dtp, BT_INTEGER, type, f))
     23119            return;
     23120-
     23121-         if (dtp->u.p.mode == READING)
     23122-           read_radix (dtp, f, p, kind, 8);
     23123-         else
     23124-           write_o (dtp, f, p, kind);
     23125-
     23126+         write_o (dtp, f, p, kind);
     23127          break;
     23128 
     23129        case FMT_Z:
     23130          if (n == 0)
     23131            goto need_data;
     23132-
     23133          if (compile_options.allow_std < GFC_STD_GNU
     23134               && require_type (dtp, BT_INTEGER, type, f))
     23135            return;
     23136-
     23137-         if (dtp->u.p.mode == READING)
     23138-           read_radix (dtp, f, p, kind, 16);
     23139-         else
     23140-           write_z (dtp, f, p, kind);
     23141-
     23142+         write_z (dtp, f, p, kind);
     23143          break;
     23144 
     23145        case FMT_A:
     23146@@ -1084,31 +1387,16 @@
     23147          /* It is possible to have FMT_A with something not BT_CHARACTER such
     23148             as when writing out hollerith strings, so check both type
     23149             and kind before calling wide character routines.  */
     23150-         if (dtp->u.p.mode == READING)
     23151-           {
     23152-             if (type == BT_CHARACTER && kind == 4)
     23153-               read_a_char4 (dtp, f, p, size);
     23154-             else
     23155-               read_a (dtp, f, p, size);
     23156-           }
     23157+         if (type == BT_CHARACTER && kind == 4)
     23158+           write_a_char4 (dtp, f, p, size);
     23159          else
     23160-           {
     23161-             if (type == BT_CHARACTER && kind == 4)
     23162-               write_a_char4 (dtp, f, p, size);
     23163-             else
     23164-               write_a (dtp, f, p, size);
     23165-           }
     23166+           write_a (dtp, f, p, size);
     23167          break;
     23168 
     23169        case FMT_L:
     23170          if (n == 0)
     23171            goto need_data;
     23172-
     23173-         if (dtp->u.p.mode == READING)
     23174-           read_l (dtp, f, p, kind);
     23175-         else
     23176-           write_l (dtp, f, p, kind);
     23177-
     23178+         write_l (dtp, f, p, kind);
     23179          break;
     23180 
     23181        case FMT_D:
     23182@@ -1116,12 +1404,7 @@
     23183            goto need_data;
     23184          if (require_type (dtp, BT_REAL, type, f))
     23185            return;
     23186-
     23187-         if (dtp->u.p.mode == READING)
     23188-           read_f (dtp, f, p, kind);
     23189-         else
     23190-           write_d (dtp, f, p, kind);
     23191-
     23192+         write_d (dtp, f, p, kind);
     23193          break;
     23194 
     23195        case FMT_E:
     23196@@ -1129,11 +1412,7 @@
     23197            goto need_data;
     23198          if (require_type (dtp, BT_REAL, type, f))
     23199            return;
     23200-
     23201-         if (dtp->u.p.mode == READING)
     23202-           read_f (dtp, f, p, kind);
     23203-         else
     23204-           write_e (dtp, f, p, kind);
     23205+         write_e (dtp, f, p, kind);
     23206          break;
     23207 
     23208        case FMT_EN:
     23209@@ -1141,12 +1420,7 @@
     23210            goto need_data;
     23211          if (require_type (dtp, BT_REAL, type, f))
     23212            return;
     23213-
     23214-         if (dtp->u.p.mode == READING)
     23215-           read_f (dtp, f, p, kind);
     23216-         else
     23217-           write_en (dtp, f, p, kind);
     23218-
     23219+         write_en (dtp, f, p, kind);
     23220          break;
     23221 
     23222        case FMT_ES:
     23223@@ -1154,12 +1428,7 @@
     23224            goto need_data;
     23225          if (require_type (dtp, BT_REAL, type, f))
     23226            return;
     23227-
     23228-         if (dtp->u.p.mode == READING)
     23229-           read_f (dtp, f, p, kind);
     23230-         else
     23231-           write_es (dtp, f, p, kind);
     23232-
     23233+         write_es (dtp, f, p, kind);
     23234          break;
     23235 
     23236        case FMT_F:
     23237@@ -1167,41 +1436,14 @@
     23238            goto need_data;
     23239          if (require_type (dtp, BT_REAL, type, f))
     23240            return;
     23241-
     23242-         if (dtp->u.p.mode == READING)
     23243-           read_f (dtp, f, p, kind);
     23244-         else
     23245-           write_f (dtp, f, p, kind);
     23246-
     23247+         write_f (dtp, f, p, kind);
     23248          break;
     23249 
     23250        case FMT_G:
     23251          if (n == 0)
     23252            goto need_data;
     23253-         if (dtp->u.p.mode == READING)
     23254-           switch (type)
     23255-             {
     23256-             case BT_INTEGER:
     23257-               read_decimal (dtp, f, p, kind);
     23258-               break;
     23259-             case BT_LOGICAL:
     23260-               read_l (dtp, f, p, kind);
     23261-               break;
     23262-             case BT_CHARACTER:
     23263-               if (kind == 4)
     23264-                 read_a_char4 (dtp, f, p, size);
     23265-               else
     23266-                 read_a (dtp, f, p, size);
     23267-               break;
     23268-             case BT_REAL:
     23269-               read_f (dtp, f, p, kind);
     23270-               break;
     23271-             default:
     23272-               goto bad_type;
     23273-             }
     23274-         else
     23275-           switch (type)
     23276-             {
     23277+         switch (type)
     23278+           {
     23279              case BT_INTEGER:
     23280                write_i (dtp, f, p, kind);
     23281                break;
     23282@@ -1216,25 +1458,18 @@
     23283                break;
     23284              case BT_REAL:
     23285                if (f->u.real.w == 0)
     23286-                 write_real_g0 (dtp, p, kind, f->u.real.d);
     23287+                  write_real_g0 (dtp, p, kind, f->u.real.d);
     23288                else
     23289                  write_d (dtp, f, p, kind);
     23290                break;
     23291              default:
     23292-             bad_type:
     23293                internal_error (&dtp->common,
     23294                                "formatted_transfer(): Bad type");
     23295-             }
     23296-
     23297+           }
     23298          break;
     23299 
     23300        case FMT_STRING:
     23301          consume_data_flag = 0;
     23302-         if (dtp->u.p.mode == READING)
     23303-           {
     23304-             format_error (dtp, f, "Constant string in input format");
     23305-             return;
     23306-           }
     23307          write_constant_string (dtp, f);
     23308          break;
     23309 
     23310@@ -1246,21 +1481,15 @@
     23311          dtp->u.p.skips += f->u.n;
     23312          pos = bytes_used + dtp->u.p.skips - 1;
     23313          dtp->u.p.pending_spaces = pos - dtp->u.p.max_pos + 1;
     23314-
     23315          /* Writes occur just before the switch on f->format, above, so
     23316             that trailing blanks are suppressed, unless we are doing a
     23317             non-advancing write in which case we want to output the blanks
     23318             now.  */
     23319-         if (dtp->u.p.mode == WRITING
     23320-             && dtp->u.p.advance_status == ADVANCE_NO)
     23321+         if (dtp->u.p.advance_status == ADVANCE_NO)
     23322            {
     23323              write_x (dtp, dtp->u.p.skips, dtp->u.p.pending_spaces);
     23324              dtp->u.p.skips = dtp->u.p.pending_spaces = 0;
     23325            }
     23326-
     23327-         if (dtp->u.p.mode == READING)
     23328-           read_x (dtp, f->u.n);
     23329-
     23330          break;
     23331 
     23332        case FMT_TL:
     23333@@ -1282,12 +1511,7 @@
     23334              pos = bytes_used - f->u.n;
     23335            }
     23336          else /* FMT_T */
     23337-           {
     23338-             if (dtp->u.p.mode == READING)
     23339-               pos = f->u.n - 1;
     23340-             else
     23341-               pos = f->u.n - dtp->u.p.pending_spaces - 1;
     23342-           }
     23343+           pos = f->u.n - dtp->u.p.pending_spaces - 1;
     23344 
     23345          /* Standard 10.6.1.1: excessive left tabbing is reset to the
     23346             left tab limit.  We do not check if the position has gone
     23347@@ -1300,43 +1524,6 @@
     23348                                    + pos - dtp->u.p.max_pos;
     23349          dtp->u.p.pending_spaces = dtp->u.p.pending_spaces < 0
     23350                                    ? 0 : dtp->u.p.pending_spaces;
     23351-
     23352-         if (dtp->u.p.skips == 0)
     23353-           break;
     23354-
     23355-         /* Writes occur just before the switch on f->format, above, so that
     23356-            trailing blanks are suppressed.  */
     23357-         if (dtp->u.p.mode == READING)
     23358-           {
     23359-             /* Adjust everything for end-of-record condition */
     23360-             if (dtp->u.p.sf_seen_eor && !is_internal_unit (dtp))
     23361-               {
     23362-                 if (dtp->u.p.sf_seen_eor == 2)
     23363-                   {
     23364-                     /* The EOR was a CRLF (two bytes wide).  */
     23365-                     dtp->u.p.current_unit->bytes_left -= 2;
     23366-                     dtp->u.p.skips -= 2;
     23367-                   }
     23368-                 else
     23369-                   {
     23370-                     /* The EOR marker was only one byte wide.  */
     23371-                     dtp->u.p.current_unit->bytes_left--;
     23372-                     dtp->u.p.skips--;
     23373-                   }
     23374-                 bytes_used = pos;
     23375-                 dtp->u.p.sf_seen_eor = 0;
     23376-               }
     23377-             if (dtp->u.p.skips < 0)
     23378-               {
     23379-                 move_pos_offset (dtp->u.p.current_unit->s, dtp->u.p.skips);
     23380-                 dtp->u.p.current_unit->bytes_left
     23381-                   -= (gfc_offset) dtp->u.p.skips;
     23382-                 dtp->u.p.skips = dtp->u.p.pending_spaces = 0;
     23383-               }
     23384-             else
     23385-               read_x (dtp, dtp->u.p.skips);
     23386-           }
     23387-
     23388          break;
     23389 
     23390        case FMT_S:
     23391@@ -1404,30 +1591,16 @@
     23392          internal_error (&dtp->common, "Bad format node");
     23393        }
     23394 
     23395-      /* Free a buffer that we had to allocate during a sequential
     23396-        formatted read of a block that was larger than the static
     23397-        buffer.  */
     23398-
     23399-      if (dtp->u.p.line_buffer != scratch)
     23400-       {
     23401-         free_mem (dtp->u.p.line_buffer);
     23402-         dtp->u.p.line_buffer = scratch;
     23403-       }
     23404-
     23405       /* Adjust the item count and data pointer.  */
     23406 
     23407       if ((consume_data_flag > 0) && (n > 0))
     23408-      {
     23409-       n--;
     23410-       p = ((char *) p) + size;
     23411-      }
     23412-
     23413-      if (dtp->u.p.mode == READING)
     23414-       dtp->u.p.skips = 0;
     23415+       {
     23416+         n--;
     23417+         p = ((char *) p) + size;
     23418+       }
     23419 
     23420       pos = (int)(dtp->u.p.current_unit->recl - dtp->u.p.current_unit->bytes_left);
     23421       dtp->u.p.max_pos = (dtp->u.p.max_pos > pos) ? dtp->u.p.max_pos : pos;
     23422-
     23423     }
     23424 
     23425   return;
     23426@@ -1439,6 +1612,7 @@
     23427   unget_format (dtp, f);
     23428 }
     23429 
     23430+
     23431 static void
     23432 formatted_transfer (st_parameter_dt *dtp, bt type, void *p, int kind,
     23433                    size_t size, size_t nelems)
     23434@@ -1449,16 +1623,27 @@
     23435   tmp = (char *) p;
     23436   size_t stride = type == BT_CHARACTER ?
     23437                  size * GFC_SIZE_OF_CHAR_KIND(kind) : size;
     23438-  /* Big loop over all the elements.  */
     23439-  for (elem = 0; elem < nelems; elem++)
     23440+  if (dtp->u.p.mode == READING)
     23441     {
     23442-      dtp->u.p.item_count++;
     23443-      formatted_transfer_scalar (dtp, type, tmp + stride*elem, kind, size);
     23444+      /* Big loop over all the elements.  */
     23445+      for (elem = 0; elem < nelems; elem++)
     23446+       {
     23447+         dtp->u.p.item_count++;
     23448+         formatted_transfer_scalar_read (dtp, type, tmp + stride*elem, kind, size);
     23449+       }
     23450+    }
     23451+  else
     23452+    {
     23453+      /* Big loop over all the elements.  */
     23454+      for (elem = 0; elem < nelems; elem++)
     23455+       {
     23456+         dtp->u.p.item_count++;
     23457+         formatted_transfer_scalar_write (dtp, type, tmp + stride*elem, kind, size);
     23458+       }
     23459     }
     23460 }
     23461 
     23462 
     23463-
     23464 /* Data transfer entry points.  The type of the data entity is
     23465    implicit in the subroutine call.  This prevents us from having to
     23466    share a common enum with the compiler.  */
     23467@@ -1652,34 +1837,28 @@
     23468 static void
     23469 us_read (st_parameter_dt *dtp, int continued)
     23470 {
     23471-  size_t n, nr;
     23472+  ssize_t n, nr;
     23473   GFC_INTEGER_4 i4;
     23474   GFC_INTEGER_8 i8;
     23475   gfc_offset i;
     23476 
     23477-  if (dtp->u.p.current_unit->endfile == AT_ENDFILE)
     23478-    return;
     23479-
     23480   if (compile_options.record_marker == 0)
     23481     n = sizeof (GFC_INTEGER_4);
     23482   else
     23483     n = compile_options.record_marker;
     23484 
     23485-  nr = n;
     23486-
     23487-  if (unlikely (sread (dtp->u.p.current_unit->s, &i, &n) != 0))
     23488+  nr = sread (dtp->u.p.current_unit->s, &i, n);
     23489+  if (unlikely (nr < 0))
     23490     {
     23491       generate_error (&dtp->common, LIBERROR_BAD_US, NULL);
     23492       return;
     23493     }
     23494-
     23495-  if (n == 0)
     23496+  else if (nr == 0)
     23497     {
     23498-      dtp->u.p.current_unit->endfile = AT_ENDFILE;
     23499+      hit_eof (dtp);
     23500       return;  /* end of file */
     23501     }
     23502-
     23503-  if (unlikely (n != nr))
     23504+  else if (unlikely (n != nr))
     23505     {
     23506       generate_error (&dtp->common, LIBERROR_BAD_US, NULL);
     23507       return;
     23508@@ -1745,7 +1924,7 @@
     23509 static void
     23510 us_write (st_parameter_dt *dtp, int continued)
     23511 {
     23512-  size_t nbytes;
     23513+  ssize_t nbytes;
     23514   gfc_offset dummy;
     23515 
     23516   dummy = 0;
     23517@@ -1755,7 +1934,7 @@
     23518   else
     23519     nbytes = compile_options.record_marker ;
     23520 
     23521-  if (swrite (dtp->u.p.current_unit->s, &dummy, &nbytes) != 0)
     23522+  if (swrite (dtp->u.p.current_unit->s, &dummy, nbytes) != nbytes)
     23523     generate_error (&dtp->common, LIBERROR_OS, NULL);
     23524 
     23525   /* For sequential unformatted, if RECL= was not specified in the OPEN
     23526@@ -1957,7 +2136,7 @@
     23527       return;
     23528     }
     23529 
     23530-  /* Check the record number.  */
     23531+  /* Check the record or position number.  */
     23532 
     23533   if (dtp->u.p.current_unit->flags.access == ACCESS_DIRECT
     23534       && (cf & IOPARM_DT_HAS_REC) == 0)
     23535@@ -2106,65 +2285,70 @@
     23536   
     23537   if (dtp->u.p.current_unit->pad_status == PAD_UNSPECIFIED)
     23538        dtp->u.p.current_unit->pad_status = dtp->u.p.current_unit->flags.pad;
     23539
     23540+
     23541+  /* Check to see if we might be reading what we wrote before  */
     23542+
     23543+  if (dtp->u.p.mode != dtp->u.p.current_unit->mode
     23544+      && !is_internal_unit (dtp))
     23545+    {
     23546+      int pos = fbuf_reset (dtp->u.p.current_unit);
     23547+      if (pos != 0)
     23548+        sseek (dtp->u.p.current_unit->s, pos, SEEK_CUR);
     23549+      sflush(dtp->u.p.current_unit->s);
     23550+    }
     23551+
     23552   /* Check the POS= specifier: that it is in range and that it is used with a
     23553      unit that has been connected for STREAM access. F2003 9.5.1.10.  */
     23554   
     23555   if (((cf & IOPARM_DT_HAS_POS) != 0))
     23556     {
     23557       if (is_stream_io (dtp))
     23558-       {
     23559-
     23560-         if (dtp->pos <= 0)
     23561-           {
     23562-             generate_error (&dtp->common, LIBERROR_BAD_OPTION,
     23563-                             "POS=specifier must be positive");
     23564-             return;
     23565-           }
     23566-
     23567-         if (dtp->pos >= dtp->u.p.current_unit->maxrec)
     23568-           {
     23569-             generate_error (&dtp->common, LIBERROR_BAD_OPTION,
     23570-                             "POS=specifier too large");
     23571-             return;
     23572-           }
     23573-
     23574-         dtp->rec = dtp->pos;
     23575-
     23576-         if (dtp->u.p.mode == READING)
     23577-           {
     23578-             /* Required for compatibility between 4.3 and 4.4 runtime. Check
     23579-             to see if we might be reading what we wrote before  */
     23580-             if (dtp->u.p.current_unit->mode == WRITING)
     23581-               {
     23582-                 fbuf_flush (dtp->u.p.current_unit, 1);     
     23583-                 flush(dtp->u.p.current_unit->s);
     23584-               }
     23585-
     23586-             if (dtp->pos < file_length (dtp->u.p.current_unit->s))
     23587-               dtp->u.p.current_unit->endfile = NO_ENDFILE;
     23588-           }
     23589-
     23590-         if (dtp->pos != dtp->u.p.current_unit->strm_pos)
     23591-           {
     23592-             fbuf_flush (dtp->u.p.current_unit, 1);
     23593-             flush (dtp->u.p.current_unit->s);
     23594-             if (sseek (dtp->u.p.current_unit->s, dtp->pos - 1) == FAILURE)
     23595-               {
     23596-                 generate_error (&dtp->common, LIBERROR_OS, NULL);
     23597-                 return;
     23598-               }
     23599-             dtp->u.p.current_unit->strm_pos = dtp->pos;
     23600-           }
     23601-       }
     23602+        {
     23603+         
     23604+          if (dtp->pos <= 0)
     23605+            {
     23606+              generate_error (&dtp->common, LIBERROR_BAD_OPTION,
     23607+                              "POS=specifier must be positive");
     23608+              return;
     23609+            }
     23610+         
     23611+          if (dtp->pos >= dtp->u.p.current_unit->maxrec)
     23612+            {
     23613+              generate_error (&dtp->common, LIBERROR_BAD_OPTION,
     23614+                              "POS=specifier too large");
     23615+              return;
     23616+            }
     23617+         
     23618+          dtp->rec = dtp->pos;
     23619+         
     23620+          if (dtp->u.p.mode == READING)
     23621+            {
     23622+              /* Reset the endfile flag; if we hit EOF during reading
     23623+                 we'll set the flag and generate an error at that point
     23624+                 rather than worrying about it here.  */
     23625+              dtp->u.p.current_unit->endfile = NO_ENDFILE;
     23626+            }
     23627+         
     23628+          if (dtp->pos != dtp->u.p.current_unit->strm_pos)
     23629+            {
     23630+              fbuf_flush (dtp->u.p.current_unit, dtp->u.p.mode);
     23631+              if (sseek (dtp->u.p.current_unit->s, dtp->pos - 1, SEEK_SET) < 0)
     23632+                {
     23633+                  generate_error (&dtp->common, LIBERROR_OS, NULL);
     23634+                  return;
     23635+                }
     23636+              dtp->u.p.current_unit->strm_pos = dtp->pos;
     23637+            }
     23638+        }
     23639       else
     23640-       {
     23641-         generate_error (&dtp->common, LIBERROR_BAD_OPTION,
     23642-                         "POS=specifier not allowed, "
     23643-                         "Try OPEN with ACCESS='stream'");
     23644-         return;
     23645-       }
     23646+        {
     23647+          generate_error (&dtp->common, LIBERROR_BAD_OPTION,
     23648+                          "POS=specifier not allowed, "
     23649+                          "Try OPEN with ACCESS='stream'");
     23650+          return;
     23651+        }
     23652     }
     23653
     23654 
     23655   /* Sanity checks on the record number.  */
     23656   if ((cf & IOPARM_DT_HAS_REC) != 0)
     23657@@ -2183,15 +2367,10 @@
     23658          return;
     23659        }
     23660 
     23661-      /* Check to see if we might be reading what we wrote before  */
     23662+      /* Make sure format buffer is reset.  */
     23663+      if (dtp->u.p.current_unit->flags.form == FORM_FORMATTED)
     23664+        fbuf_reset (dtp->u.p.current_unit);
     23665 
     23666-      if (dtp->u.p.mode == READING
     23667-         && dtp->u.p.current_unit->mode == WRITING
     23668-         && !is_internal_unit (dtp))
     23669-       {
     23670-         fbuf_flush (dtp->u.p.current_unit, 1);     
     23671-         flush(dtp->u.p.current_unit->s);
     23672-       }
     23673 
     23674       /* Check whether the record exists to be read.  Only
     23675         a partial record needs to exist.  */
     23676@@ -2206,37 +2385,28 @@
     23677 
     23678       /* Position the file.  */
     23679       if (sseek (dtp->u.p.current_unit->s, (gfc_offset) (dtp->rec - 1)
     23680-                * dtp->u.p.current_unit->recl) == FAILURE)
     23681-       {
     23682-         generate_error (&dtp->common, LIBERROR_OS, NULL);
     23683-         return;
     23684-       }
     23685+                 * dtp->u.p.current_unit->recl, SEEK_SET) < 0)
     23686+        {
     23687+          generate_error (&dtp->common, LIBERROR_OS, NULL);
     23688+          return;
     23689+        }
     23690 
     23691       /* TODO: This is required to maintain compatibility between
     23692-        4.3 and 4.4 runtime. Remove when ABI changes from 4.3 */
     23693+         4.3 and 4.4 runtime. Remove when ABI changes from 4.3 */
     23694 
     23695       if (is_stream_io (dtp))
     23696-       dtp->u.p.current_unit->strm_pos = dtp->rec;
     23697-     
     23698+        dtp->u.p.current_unit->strm_pos = dtp->rec;
     23699+
     23700       /* TODO: Un-comment this code when ABI changes from 4.3.
     23701       if (dtp->u.p.current_unit->flags.access == ACCESS_STREAM)
     23702-       {
     23703-         generate_error (&dtp->common, LIBERROR_OPTION_CONFLICT,
     23704-                     "Record number not allowed for stream access "
     23705-                     "data transfer");
     23706-         return;
     23707-       }  */
     23708-
     23709+       {
     23710+         generate_error (&dtp->common, LIBERROR_OPTION_CONFLICT,
     23711+                     "Record number not allowed for stream access "
     23712+                     "data transfer");
     23713+         return;
     23714+       }  */
     23715     }
     23716 
     23717-  /* Overwriting an existing sequential file ?
     23718-     it is always safe to truncate the file on the first write */
     23719-  if (dtp->u.p.mode == WRITING
     23720-      && dtp->u.p.current_unit->flags.access == ACCESS_SEQUENTIAL
     23721-      && dtp->u.p.current_unit->last_record == 0
     23722-      && !is_preconnected(dtp->u.p.current_unit->s))
     23723-       struncate(dtp->u.p.current_unit->s);
     23724-
     23725   /* Bugware for badly written mixed C-Fortran I/O.  */
     23726   flush_if_preconnected(dtp->u.p.current_unit->s);
     23727 
     23728@@ -2387,11 +2557,10 @@
     23729    position.  */
     23730 
     23731 static void
     23732-skip_record (st_parameter_dt *dtp, size_t bytes)
     23733+skip_record (st_parameter_dt *dtp, ssize_t bytes)
     23734 {
     23735-  gfc_offset new;
     23736-  size_t rlength;
     23737-  static const size_t MAX_READ = 4096;
     23738+  ssize_t rlength, readb;
     23739+  static const ssize_t MAX_READ = 4096;
     23740   char p[MAX_READ];
     23741 
     23742   dtp->u.p.current_unit->bytes_left_subrecord += bytes;
     23743@@ -2400,12 +2569,10 @@
     23744 
     23745   if (is_seekable (dtp->u.p.current_unit->s))
     23746     {
     23747-      new = file_position (dtp->u.p.current_unit->s)
     23748-       + dtp->u.p.current_unit->bytes_left_subrecord;
     23749-
     23750       /* Direct access files do not generate END conditions,
     23751         only I/O errors.  */
     23752-      if (sseek (dtp->u.p.current_unit->s, new) == FAILURE)
     23753+      if (sseek (dtp->u.p.current_unit->s,
     23754+                dtp->u.p.current_unit->bytes_left_subrecord, SEEK_CUR) < 0)
     23755        generate_error (&dtp->common, LIBERROR_OS, NULL);
     23756     }
     23757   else
     23758@@ -2413,16 +2580,17 @@
     23759       while (dtp->u.p.current_unit->bytes_left_subrecord > 0)
     23760        {
     23761          rlength =
     23762-           (MAX_READ > (size_t) dtp->u.p.current_unit->bytes_left_subrecord) ?
     23763-           MAX_READ : (size_t) dtp->u.p.current_unit->bytes_left_subrecord;
     23764+           (MAX_READ < dtp->u.p.current_unit->bytes_left_subrecord) ?
     23765+           MAX_READ : dtp->u.p.current_unit->bytes_left_subrecord;
     23766 
     23767-         if (sread (dtp->u.p.current_unit->s, p, &rlength) != 0)
     23768+         readb = sread (dtp->u.p.current_unit->s, p, rlength);
     23769+         if (readb < 0)
     23770            {
     23771              generate_error (&dtp->common, LIBERROR_OS, NULL);
     23772              return;
     23773            }
     23774 
     23775-         dtp->u.p.current_unit->bytes_left_subrecord -= rlength;
     23776+         dtp->u.p.current_unit->bytes_left_subrecord -= readb;
     23777        }
     23778     }
     23779 
     23780@@ -2470,8 +2638,8 @@
     23781 {
     23782   gfc_offset record;
     23783   int bytes_left;
     23784-  size_t length;
     23785   char p;
     23786+  int cc;
     23787 
     23788   switch (current_mode (dtp))
     23789     {
     23790@@ -2491,11 +2659,12 @@
     23791 
     23792     case FORMATTED_STREAM:
     23793     case FORMATTED_SEQUENTIAL:
     23794-      length = 1;
     23795-      /* sf_read has already terminated input because of an '\n'  */
     23796-      if (dtp->u.p.sf_seen_eor)
     23797+      /* read_sf has already terminated input because of an '\n', or
     23798+         we have hit EOF.  */
     23799+      if (dtp->u.p.sf_seen_eor || dtp->u.p.at_eof)
     23800        {
     23801          dtp->u.p.sf_seen_eor = 0;
     23802+          dtp->u.p.at_eof = 0;
     23803          break;
     23804        }
     23805 
     23806@@ -2510,7 +2679,7 @@
     23807 
     23808              /* Now seek to this record.  */
     23809              record = record * dtp->u.p.current_unit->recl;
     23810-             if (sseek (dtp->u.p.current_unit->s, record) == FAILURE)
     23811+             if (sseek (dtp->u.p.current_unit->s, record, SEEK_SET) < 0)
     23812                {
     23813                  generate_error (&dtp->common, LIBERROR_INTERNAL_UNIT, NULL);
     23814                  break;
     23815@@ -2522,10 +2691,9 @@
     23816              bytes_left = (int) dtp->u.p.current_unit->bytes_left;
     23817              bytes_left = min_off (bytes_left,
     23818                      file_length (dtp->u.p.current_unit->s)
     23819-                     - file_position (dtp->u.p.current_unit->s));
     23820+                     - stell (dtp->u.p.current_unit->s));
     23821              if (sseek (dtp->u.p.current_unit->s,
     23822-                         file_position (dtp->u.p.current_unit->s)
     23823-                         + bytes_left) == FAILURE)
     23824+                        bytes_left, SEEK_CUR) < 0)
     23825                {
     23826                  generate_error (&dtp->common, LIBERROR_INTERNAL_UNIT, NULL);
     23827                  break;
     23828@@ -2535,42 +2703,37 @@
     23829            }
     23830          break;
     23831        }
     23832-      else do
     23833+      else
     23834        {
     23835-         if (sread (dtp->u.p.current_unit->s, &p, &length) != 0)
     23836-           {
     23837-             generate_error (&dtp->common, LIBERROR_OS, NULL);
     23838-             break;
     23839-           }
     23840-
     23841-         if (length == 0)
     23842+         do
     23843            {
     23844-             dtp->u.p.current_unit->endfile = AT_ENDFILE;
     23845-             break;
     23846+              errno = 0;
     23847+              cc = fbuf_getc (dtp->u.p.current_unit);
     23848+             if (cc == EOF)
     23849+               {
     23850+                  if (errno != 0)
     23851+                    generate_error (&dtp->common, LIBERROR_OS, NULL);
     23852+                  else
     23853+                    hit_eof (dtp);
     23854+                 break;
     23855+                }
     23856+             
     23857+             if (is_stream_io (dtp))
     23858+               dtp->u.p.current_unit->strm_pos++;
     23859+             
     23860+              p = (char) cc;
     23861            }
     23862-
     23863-         if (is_stream_io (dtp))
     23864-           dtp->u.p.current_unit->strm_pos++;
     23865+         while (p != '\n');
     23866        }
     23867-      while (p != '\n');
     23868-
     23869       break;
     23870     }
     23871-
     23872-  if (dtp->u.p.current_unit->flags.access == ACCESS_SEQUENTIAL
     23873-      && !dtp->u.p.namelist_mode
     23874-      && dtp->u.p.current_unit->endfile == NO_ENDFILE
     23875-      && (file_length (dtp->u.p.current_unit->s) ==
     23876-        file_position (dtp->u.p.current_unit->s)))
     23877-    dtp->u.p.current_unit->endfile = AT_ENDFILE;
     23878-
     23879 }
     23880 
     23881 
     23882 /* Small utility function to write a record marker, taking care of
     23883    byte swapping and of choosing the correct size.  */
     23884 
     23885-inline static int
     23886+static int
     23887 write_us_marker (st_parameter_dt *dtp, const gfc_offset buf)
     23888 {
     23889   size_t len;
     23890@@ -2590,12 +2753,12 @@
     23891        {
     23892        case sizeof (GFC_INTEGER_4):
     23893          buf4 = buf;
     23894-         return swrite (dtp->u.p.current_unit->s, &buf4, &len);
     23895+         return swrite (dtp->u.p.current_unit->s, &buf4, len);
     23896          break;
     23897 
     23898        case sizeof (GFC_INTEGER_8):
     23899          buf8 = buf;
     23900-         return swrite (dtp->u.p.current_unit->s, &buf8, &len);
     23901+         return swrite (dtp->u.p.current_unit->s, &buf8, len);
     23902          break;
     23903 
     23904        default:
     23905@@ -2610,13 +2773,13 @@
     23906        case sizeof (GFC_INTEGER_4):
     23907          buf4 = buf;
     23908          reverse_memcpy (p, &buf4, sizeof (GFC_INTEGER_4));
     23909-         return swrite (dtp->u.p.current_unit->s, p, &len);
     23910+         return swrite (dtp->u.p.current_unit->s, p, len);
     23911          break;
     23912 
     23913        case sizeof (GFC_INTEGER_8):
     23914          buf8 = buf;
     23915          reverse_memcpy (p, &buf8, sizeof (GFC_INTEGER_8));
     23916-         return swrite (dtp->u.p.current_unit->s, p, &len);
     23917+         return swrite (dtp->u.p.current_unit->s, p, len);
     23918          break;
     23919 
     23920        default:
     23921@@ -2633,13 +2796,11 @@
     23922 static void
     23923 next_record_w_unf (st_parameter_dt *dtp, int next_subrecord)
     23924 {
     23925-  gfc_offset c, m, m_write;
     23926-  size_t record_marker;
     23927+  gfc_offset m, m_write, record_marker;
     23928 
     23929   /* Bytes written.  */
     23930   m = dtp->u.p.current_unit->recl_subrecord
     23931     - dtp->u.p.current_unit->bytes_left_subrecord;
     23932-  c = file_position (dtp->u.p.current_unit->s);
     23933 
     23934   /* Write the length tail.  If we finish a record containing
     23935      subrecords, we write out the negative length.  */
     23936@@ -2649,7 +2810,7 @@
     23937   else
     23938     m_write = m;
     23939 
     23940-  if (unlikely (write_us_marker (dtp, m_write) != 0))
     23941+  if (unlikely (write_us_marker (dtp, m_write) < 0))
     23942     goto io_error;
     23943 
     23944   if (compile_options.record_marker == 0)
     23945@@ -2660,8 +2821,8 @@
     23946   /* Seek to the head and overwrite the bogus length with the real
     23947      length.  */
     23948 
     23949-  if (unlikely (sseek (dtp->u.p.current_unit->s, c - m - record_marker)
     23950-               == FAILURE))
     23951+  if (unlikely (sseek (dtp->u.p.current_unit->s, - m - 2 * record_marker,
     23952+                      SEEK_CUR) < 0))
     23953     goto io_error;
     23954 
     23955   if (next_subrecord)
     23956@@ -2669,13 +2830,13 @@
     23957   else
     23958     m_write = m;
     23959 
     23960-  if (unlikely (write_us_marker (dtp, m_write) != 0))
     23961+  if (unlikely (write_us_marker (dtp, m_write) < 0))
     23962     goto io_error;
     23963 
     23964   /* Seek past the end of the current record.  */
     23965 
     23966-  if (unlikely (sseek (dtp->u.p.current_unit->s, c + record_marker)
     23967-               == FAILURE))
     23968+  if (unlikely (sseek (dtp->u.p.current_unit->s, m + record_marker,
     23969+                      SEEK_CUR) < 0))
     23970     goto io_error;
     23971 
     23972   return;
     23973@@ -2686,6 +2847,35 @@
     23974 
     23975 }
     23976 
     23977+
     23978+/* Utility function like memset() but operating on streams. Return
     23979+   value is same as for POSIX write().  */
     23980+
     23981+static ssize_t
     23982+sset (stream * s, int c, ssize_t nbyte)
     23983+{
     23984+  static const int WRITE_CHUNK = 256;
     23985+  char p[WRITE_CHUNK];
     23986+  ssize_t bytes_left, trans;
     23987+
     23988+  if (nbyte < WRITE_CHUNK)
     23989+    memset (p, c, nbyte);
     23990+  else
     23991+    memset (p, c, WRITE_CHUNK);
     23992+
     23993+  bytes_left = nbyte;
     23994+  while (bytes_left > 0)
     23995+    {
     23996+      trans = (bytes_left < WRITE_CHUNK) ? bytes_left : WRITE_CHUNK;
     23997+      trans = swrite (s, p, trans);
     23998+      if (trans < 0)
     23999+       return trans;
     24000+      bytes_left -= trans;
     24001+    }
     24002+             
     24003+  return nbyte - bytes_left;
     24004+}
     24005+
     24006 /* Position to the next record in write mode.  */
     24007 
     24008 static void
     24009@@ -2694,9 +2884,6 @@
     24010   gfc_offset m, record, max_pos;
     24011   int length;
     24012 
     24013-  /* Flush and reset the format buffer.  */
     24014-  fbuf_flush (dtp->u.p.current_unit, 1);
     24015
     24016   /* Zero counters for X- and T-editing.  */
     24017   max_pos = dtp->u.p.max_pos;
     24018   dtp->u.p.max_pos = dtp->u.p.skips = dtp->u.p.pending_spaces = 0;
     24019@@ -2711,8 +2898,11 @@
     24020       if (dtp->u.p.current_unit->bytes_left == 0)
     24021        break;
     24022 
     24023+      fbuf_seek (dtp->u.p.current_unit, 0, SEEK_END);
     24024+      fbuf_flush (dtp->u.p.current_unit, WRITING);
     24025       if (sset (dtp->u.p.current_unit->s, ' ',
     24026-               dtp->u.p.current_unit->bytes_left) == FAILURE)
     24027+               dtp->u.p.current_unit->bytes_left)
     24028+         != dtp->u.p.current_unit->bytes_left)
     24029        goto io_error;
     24030 
     24031       break;
     24032@@ -2721,7 +2911,7 @@
     24033       if (dtp->u.p.current_unit->bytes_left > 0)
     24034        {
     24035          length = (int) dtp->u.p.current_unit->bytes_left;
     24036-         if (sset (dtp->u.p.current_unit->s, 0, length) == FAILURE)
     24037+         if (sset (dtp->u.p.current_unit->s, 0, length) != length)
     24038            goto io_error;
     24039        }
     24040       break;
     24041@@ -2752,8 +2942,7 @@
     24042                {
     24043                  length = (int) (max_pos - m);
     24044                  if (sseek (dtp->u.p.current_unit->s,
     24045-                             file_position (dtp->u.p.current_unit->s)
     24046-                             + length) == FAILURE)
     24047+                            length, SEEK_CUR) < 0)
     24048                    {
     24049                      generate_error (&dtp->common, LIBERROR_INTERNAL_UNIT, NULL);
     24050                      return;
     24051@@ -2761,7 +2950,7 @@
     24052                  length = (int) (dtp->u.p.current_unit->recl - max_pos);
     24053                }
     24054 
     24055-             if (sset (dtp->u.p.current_unit->s, ' ', length) == FAILURE)
     24056+             if (sset (dtp->u.p.current_unit->s, ' ', length) != length)
     24057                {
     24058                  generate_error (&dtp->common, LIBERROR_END, NULL);
     24059                  return;
     24060@@ -2777,7 +2966,7 @@
     24061              /* Now seek to this record */
     24062              record = record * dtp->u.p.current_unit->recl;
     24063 
     24064-             if (sseek (dtp->u.p.current_unit->s, record) == FAILURE)
     24065+             if (sseek (dtp->u.p.current_unit->s, record, SEEK_SET) < 0)
     24066                {
     24067                  generate_error (&dtp->common, LIBERROR_INTERNAL_UNIT, NULL);
     24068                  return;
     24069@@ -2800,8 +2989,7 @@
     24070                    {
     24071                      length = (int) (max_pos - m);
     24072                      if (sseek (dtp->u.p.current_unit->s,
     24073-                                 file_position (dtp->u.p.current_unit->s)
     24074-                                 + length) == FAILURE)
     24075+                                length, SEEK_CUR) < 0)
     24076                        {
     24077                          generate_error (&dtp->common, LIBERROR_INTERNAL_UNIT, NULL);
     24078                          return;
     24079@@ -2812,7 +3000,7 @@
     24080                    length = (int) dtp->u.p.current_unit->bytes_left;
     24081                }
     24082 
     24083-             if (sset (dtp->u.p.current_unit->s, ' ', length) == FAILURE)
     24084+             if (sset (dtp->u.p.current_unit->s, ' ', length) != length)
     24085                {
     24086                  generate_error (&dtp->common, LIBERROR_END, NULL);
     24087                  return;
     24088@@ -2821,23 +3009,27 @@
     24089        }
     24090       else
     24091        {
     24092-         size_t len;
     24093-         const char crlf[] = "\r\n";
     24094-
     24095 #ifdef HAVE_CRLF
     24096-         len = 2;
     24097+         const int len = 2;
     24098 #else
     24099-         len = 1;
     24100+         const int len = 1;
     24101 #endif
     24102-         if (swrite (dtp->u.p.current_unit->s, &crlf[2-len], &len) != 0)
     24103-           goto io_error;
     24104-         
     24105+          fbuf_seek (dtp->u.p.current_unit, 0, SEEK_END);
     24106+          char * p = fbuf_alloc (dtp->u.p.current_unit, len);
     24107+          if (!p)
     24108+            goto io_error;
     24109+#ifdef HAVE_CRLF
     24110+          *(p++) = '\r';
     24111+#endif
     24112+          *p = '\n';
     24113          if (is_stream_io (dtp))
     24114            {
     24115              dtp->u.p.current_unit->strm_pos += len;
     24116              if (dtp->u.p.current_unit->strm_pos
     24117                  < file_length (dtp->u.p.current_unit->s))
     24118-               struncate (dtp->u.p.current_unit->s);
     24119+               unit_truncate (dtp->u.p.current_unit,
     24120+                               dtp->u.p.current_unit->strm_pos - 1,
     24121+                               &dtp->common);
     24122            }
     24123        }
     24124 
     24125@@ -2875,7 +3067,7 @@
     24126       dtp->u.p.current_unit->current_record = 0;
     24127       if (dtp->u.p.current_unit->flags.access == ACCESS_DIRECT)
     24128        {
     24129-         fp = file_position (dtp->u.p.current_unit->s);
     24130+         fp = stell (dtp->u.p.current_unit->s);
     24131          /* Calculate next record, rounding up partial records.  */
     24132          dtp->u.p.current_unit->last_record =
     24133            (fp + dtp->u.p.current_unit->recl - 1) /
     24134@@ -2887,6 +3079,8 @@
     24135 
     24136   if (!done)
     24137     pre_position (dtp);
     24138+
     24139+  fbuf_flush (dtp->u.p.current_unit, dtp->u.p.mode);
     24140 }
     24141 
     24142 
     24143@@ -2935,7 +3129,6 @@
     24144   if ((cf & IOPARM_DT_LIST_FORMAT) != 0 && dtp->u.p.mode == READING)
     24145     {
     24146       finish_list_read (dtp);
     24147-      sfree (dtp->u.p.current_unit->s);
     24148       return;
     24149     }
     24150 
     24151@@ -2949,12 +3142,6 @@
     24152          && dtp->u.p.advance_status != ADVANCE_NO)
     24153        next_record (dtp, 1);
     24154 
     24155-      if (dtp->u.p.current_unit->flags.form == FORM_UNFORMATTED
     24156-         && file_position (dtp->u.p.current_unit->s) >= dtp->rec)
     24157-       {
     24158-         flush (dtp->u.p.current_unit->s);
     24159-         sfree (dtp->u.p.current_unit->s);
     24160-       }
     24161       return;
     24162     }
     24163 
     24164@@ -2962,9 +3149,8 @@
     24165 
     24166   if (!is_internal_unit (dtp) && dtp->u.p.seen_dollar)
     24167     {
     24168+      fbuf_flush (dtp->u.p.current_unit, dtp->u.p.mode);
     24169       dtp->u.p.seen_dollar = 0;
     24170-      fbuf_flush (dtp->u.p.current_unit, 1);
     24171-      sfree (dtp->u.p.current_unit->s);
     24172       return;
     24173     }
     24174 
     24175@@ -2976,15 +3162,16 @@
     24176        - dtp->u.p.current_unit->bytes_left);
     24177       dtp->u.p.current_unit->saved_pos =
     24178        dtp->u.p.max_pos > 0 ? dtp->u.p.max_pos - bytes_written : 0;
     24179-      fbuf_flush (dtp->u.p.current_unit, 0);
     24180-      flush (dtp->u.p.current_unit->s);
     24181+      fbuf_flush (dtp->u.p.current_unit, dtp->u.p.mode);
     24182       return;
     24183     }
     24184+  else if (dtp->u.p.current_unit->flags.form == FORM_FORMATTED
     24185+           && dtp->u.p.mode == WRITING && !is_internal_unit (dtp))
     24186+      fbuf_seek (dtp->u.p.current_unit, 0, SEEK_END);   
     24187 
     24188   dtp->u.p.current_unit->saved_pos = 0;
     24189 
     24190   next_record (dtp, 1);
     24191-  sfree (dtp->u.p.current_unit->s);
     24192 }
     24193 
     24194 /* Transfer function for IOLENGTH. It doesn't actually do any
     24195@@ -2997,7 +3184,7 @@
     24196                   size_t size, size_t nelems)
     24197 {
     24198   if ((dtp->common.flags & IOPARM_DT_HAS_IOLENGTH) != 0)
     24199-    *dtp->iolength += (GFC_IO_INT) size * nelems;
     24200+    *dtp->iolength += (GFC_IO_INT) (size * nelems);
     24201 }
     24202 
     24203 
     24204@@ -3041,8 +3228,6 @@
     24205 st_iolength_done (st_parameter_dt *dtp __attribute__((unused)))
     24206 {
     24207   free_ionml (dtp);
     24208-  if (dtp->u.p.scratch != NULL)
     24209-    free_mem (dtp->u.p.scratch);
     24210   library_end ();
     24211 }
     24212 
     24213@@ -3058,29 +3243,6 @@
     24214   library_start (&dtp->common);
     24215 
     24216   data_transfer_init (dtp, 1);
     24217-
     24218-  /* Handle complications dealing with the endfile record.  */
     24219-
     24220-  if (dtp->u.p.current_unit->flags.access == ACCESS_SEQUENTIAL)
     24221-    switch (dtp->u.p.current_unit->endfile)
     24222-      {
     24223-      case NO_ENDFILE:
     24224-       break;
     24225-
     24226-      case AT_ENDFILE:
     24227-       if (!is_internal_unit (dtp))
     24228-         {
     24229-           generate_error (&dtp->common, LIBERROR_END, NULL);
     24230-           dtp->u.p.current_unit->endfile = AFTER_ENDFILE;
     24231-           dtp->u.p.current_unit->current_record = 0;
     24232-         }
     24233-       break;
     24234-
     24235-      case AFTER_ENDFILE:
     24236-       generate_error (&dtp->common, LIBERROR_ENDFILE, NULL);
     24237-       dtp->u.p.current_unit->current_record = 0;
     24238-       break;
     24239-      }
     24240 }
     24241 
     24242 extern void st_read_done (st_parameter_dt *);
     24243@@ -3090,10 +3252,9 @@
     24244 st_read_done (st_parameter_dt *dtp)
     24245 {
     24246   finalize_transfer (dtp);
     24247-  free_format_data (dtp);
     24248+  if (is_internal_unit (dtp))
     24249+    free_format_data (dtp->u.p.fmt);
     24250   free_ionml (dtp);
     24251-  if (dtp->u.p.scratch != NULL)
     24252-    free_mem (dtp->u.p.scratch);
     24253   if (dtp->u.p.current_unit != NULL)
     24254     unlock_unit (dtp->u.p.current_unit);
     24255 
     24256@@ -3136,19 +3297,16 @@
     24257       case NO_ENDFILE:
     24258        /* Get rid of whatever is after this record.  */
     24259         if (!is_internal_unit (dtp))
     24260-         {
     24261-           flush (dtp->u.p.current_unit->s);
     24262-           if (struncate (dtp->u.p.current_unit->s) == FAILURE)
     24263-             generate_error (&dtp->common, LIBERROR_OS, NULL);
     24264-         }
     24265+          unit_truncate (dtp->u.p.current_unit,
     24266+                         stell (dtp->u.p.current_unit->s),
     24267+                         &dtp->common);
     24268        dtp->u.p.current_unit->endfile = AT_ENDFILE;
     24269        break;
     24270       }
     24271 
     24272-  free_format_data (dtp);
     24273+  if (is_internal_unit (dtp))
     24274+    free_format_data (dtp->u.p.fmt);
     24275   free_ionml (dtp);
     24276-  if (dtp->u.p.scratch != NULL)
     24277-    free_mem (dtp->u.p.scratch);
     24278   if (dtp->u.p.current_unit != NULL)
     24279     unlock_unit (dtp->u.p.current_unit);
     24280   
     24281@@ -3262,3 +3420,46 @@
     24282   for (i=0; i<n; i++)
     24283       *(d++) = *(s--);
     24284 }
     24285+
     24286+
     24287+/* Once upon a time, a poor innocent Fortran program was reading a
     24288+   file, when suddenly it hit the end-of-file (EOF).  Unfortunately
     24289+   the OS doesn't tell whether we're at the EOF or whether we already
     24290+   went past it.  Luckily our hero, libgfortran, keeps track of this.
     24291+   Call this function when you detect an EOF condition.  See Section
     24292+   9.10.2 in F2003.  */
     24293+
     24294+void
     24295+hit_eof (st_parameter_dt * dtp)
     24296+{
     24297+  dtp->u.p.current_unit->flags.position = POSITION_APPEND;
     24298+
     24299+  if (dtp->u.p.current_unit->flags.access == ACCESS_SEQUENTIAL)
     24300+    switch (dtp->u.p.current_unit->endfile)
     24301+      {
     24302+      case NO_ENDFILE:
     24303+      case AT_ENDFILE:
     24304+        generate_error (&dtp->common, LIBERROR_END, NULL);
     24305+       if (!is_internal_unit (dtp))
     24306+         {
     24307+           dtp->u.p.current_unit->endfile = AFTER_ENDFILE;
     24308+           dtp->u.p.current_unit->current_record = 0;
     24309+         }
     24310+        else
     24311+          dtp->u.p.current_unit->endfile = AT_ENDFILE;
     24312+       break;
     24313+       
     24314+      case AFTER_ENDFILE:
     24315+       generate_error (&dtp->common, LIBERROR_ENDFILE, NULL);
     24316+       dtp->u.p.current_unit->current_record = 0;
     24317+       break;
     24318+      }
     24319+  else
     24320+    {
     24321+      /* Non-sequential files don't have an ENDFILE record, so we
     24322+         can't be at AFTER_ENDFILE.  */
     24323+      dtp->u.p.current_unit->endfile = AT_ENDFILE;
     24324+      generate_error (&dtp->common, LIBERROR_END, NULL);
     24325+      dtp->u.p.current_unit->current_record = 0;
     24326+    }
     24327+}
     24328diff -Naur gcc-4.4.0.orig/libgfortran/io/unit.c gcc-4.4.0/libgfortran/io/unit.c
     24329--- gcc-4.4.0.orig/libgfortran/io/unit.c        2009-04-09 16:23:07.000000000 -0700
     24330+++ gcc-4.4.0/libgfortran/io/unit.c     2009-05-26 18:21:22.000000000 -0700
     24331@@ -535,6 +535,8 @@
     24332       u->file_len = strlen (stdin_name);
     24333       u->file = get_mem (u->file_len);
     24334       memmove (u->file, stdin_name, u->file_len);
     24335+
     24336+      fbuf_init (u, 0);
     24337     
     24338       __gthread_mutex_unlock (&u->lock);
     24339     }
     24340@@ -619,7 +621,7 @@
     24341   if (u->previous_nonadvancing_write)
     24342     finish_last_advance_record (u);
     24343 
     24344-  rc = (u->s == NULL) ? 0 : sclose (u->s) == FAILURE;
     24345+  rc = (u->s == NULL) ? 0 : sclose (u->s) == -1;
     24346 
     24347   u->closed = 1;
     24348   if (!locked)
     24349@@ -635,7 +637,8 @@
     24350     free_mem (u->file);
     24351   u->file = NULL;
     24352   u->file_len = 0;
     24353
     24354+
     24355+  free_format_hash_table (u); 
     24356   fbuf_destroy (u);
     24357 
     24358   if (!locked)
     24359@@ -692,15 +695,62 @@
     24360 void
     24361 update_position (gfc_unit *u)
     24362 {
     24363-  if (file_position (u->s) == 0)
     24364+  if (stell (u->s) == 0)
     24365     u->flags.position = POSITION_REWIND;
     24366-  else if (file_length (u->s) == file_position (u->s))
     24367+  else if (file_length (u->s) == stell (u->s))
     24368     u->flags.position = POSITION_APPEND;
     24369   else
     24370     u->flags.position = POSITION_ASIS;
     24371 }
     24372 
     24373 
     24374+/* High level interface to truncate a file safely, i.e. flush format
     24375+   buffers, check that it's a regular file, and generate error if that
     24376+   occurs.  Just like POSIX ftruncate, returns 0 on success, -1 on
     24377+   failure.  */
     24378+
     24379+int
     24380+unit_truncate (gfc_unit * u, gfc_offset pos, st_parameter_common * common)
     24381+{
     24382+  int ret;
     24383+
     24384+  /* Make sure format buffer is flushed.  */
     24385+  if (u->flags.form == FORM_FORMATTED)
     24386+    {
     24387+      if (u->mode == READING)
     24388+       pos += fbuf_reset (u);
     24389+      else
     24390+       fbuf_flush (u, u->mode);
     24391+    }
     24392
     24393+  /* Don't try to truncate a special file, just pretend that it
     24394+     succeeds.  */
     24395+  if (is_special (u->s) || !is_seekable (u->s))
     24396+    {
     24397+      sflush (u->s);
     24398+      return 0;
     24399+    }
     24400+
     24401+  /* struncate() should flush the stream buffer if necessary, so don't
     24402+     bother calling sflush() here.  */
     24403+  ret = struncate (u->s, pos);
     24404+
     24405+  if (ret != 0)
     24406+    {
     24407+      generate_error (common, LIBERROR_OS, NULL);
     24408+      u->endfile = NO_ENDFILE;
     24409+      u->flags.position = POSITION_ASIS;
     24410+    }
     24411+  else
     24412+    {
     24413+      u->endfile = AT_ENDFILE;
     24414+      u->flags.position = POSITION_APPEND;
     24415+    }
     24416+
     24417+  return ret;
     24418+}
     24419+
     24420+
     24421 /* filename_from_unit()-- If the unit_number exists, return a pointer to the
     24422    name of the associated file, otherwise return the empty string.  The caller
     24423    must free memory allocated for the filename string.  */
     24424@@ -741,23 +791,25 @@
     24425 {
     24426   
     24427   if (u->saved_pos > 0)
     24428-    fbuf_seek (u, u->saved_pos);
     24429-   
     24430-  fbuf_flush (u, 1);
     24431+    fbuf_seek (u, u->saved_pos, SEEK_CUR);
     24432 
     24433   if (!(u->unit_number == options.stdout_unit
     24434        || u->unit_number == options.stderr_unit))
     24435     {
     24436-      size_t len;
     24437-
     24438-      const char crlf[] = "\r\n";
     24439 #ifdef HAVE_CRLF
     24440-      len = 2;
     24441+      const int len = 2;
     24442 #else
     24443-      len = 1;
     24444+      const int len = 1;
     24445 #endif
     24446-      if (swrite (u->s, &crlf[2-len], &len) != 0)
     24447+      char *p = fbuf_alloc (u, len);
     24448+      if (!p)
     24449        os_error ("Completing record after ADVANCE_NO failed");
     24450+#ifdef HAVE_CRLF
     24451+      *(p++) = '\r';
     24452+#endif
     24453+      *p = '\n';
     24454     }
     24455+
     24456+  fbuf_flush (u, u->mode);
     24457 }
     24458 
     24459diff -Naur gcc-4.4.0.orig/libgfortran/io/unix.c gcc-4.4.0/libgfortran/io/unix.c
     24460--- gcc-4.4.0.orig/libgfortran/io/unix.c        2009-04-09 16:23:07.000000000 -0700
     24461+++ gcc-4.4.0/libgfortran/io/unix.c     2009-05-26 18:21:22.000000000 -0700
     24462@@ -89,10 +89,6 @@
     24463 
     24464 #endif
     24465 
     24466-#ifndef SSIZE_MAX
     24467-#define SSIZE_MAX SHRT_MAX
     24468-#endif
     24469-
     24470 #ifndef PATH_MAX
     24471 #define PATH_MAX 1024
     24472 #endif
     24473@@ -124,128 +120,30 @@
     24474 #endif
     24475 
     24476 
     24477-/* Unix stream I/O module */
     24478+/* Unix and internal stream I/O module */
     24479 
     24480-#define BUFFER_SIZE 8192
     24481+static const int BUFFER_SIZE = 8192;
     24482 
     24483 typedef struct
     24484 {
     24485   stream st;
     24486 
     24487-  int fd;
     24488   gfc_offset buffer_offset;    /* File offset of the start of the buffer */
     24489   gfc_offset physical_offset;  /* Current physical file offset */
     24490   gfc_offset logical_offset;   /* Current logical file offset */
     24491-  gfc_offset dirty_offset;     /* Start of modified bytes in buffer */
     24492   gfc_offset file_length;      /* Length of the file, -1 if not seekable. */
     24493 
     24494-  int len;                     /* Physical length of the current buffer */
     24495-  int active;                  /* Length of valid bytes in the buffer */
     24496-
     24497-  int prot;
     24498-  int ndirty;                  /* Dirty bytes starting at dirty_offset */
     24499-
     24500-  int special_file;            /* =1 if the fd refers to a special file */
     24501-
     24502-  io_mode method;              /* Method of stream I/O being used */
     24503-
     24504-  char *buffer;
     24505-  char small_buffer[BUFFER_SIZE];
     24506-}
     24507-unix_stream;
     24508-
     24509-
     24510-/* Stream structure for internal files. Fields must be kept in sync
     24511-   with unix_stream above, except for the buffer. For internal files
     24512-   we point the buffer pointer directly at the destination memory.  */
     24513-
     24514-typedef struct
     24515-{
     24516-  stream st;
     24517-
     24518-  int fd;
     24519-  gfc_offset buffer_offset;    /* File offset of the start of the buffer */
     24520-  gfc_offset physical_offset;  /* Current physical file offset */
     24521-  gfc_offset logical_offset;   /* Current logical file offset */
     24522-  gfc_offset dirty_offset;     /* Start of modified bytes in buffer */
     24523-  gfc_offset file_length;      /* Length of the file, -1 if not seekable. */
     24524+  char *buffer;                 /* Pointer to the buffer.  */
     24525+  int fd;                       /* The POSIX file descriptor.  */
     24526 
     24527-  int len;                     /* Physical length of the current buffer */
     24528   int active;                  /* Length of valid bytes in the buffer */
     24529 
     24530   int prot;
     24531-  int ndirty;                  /* Dirty bytes starting at dirty_offset */
     24532+  int ndirty;                  /* Dirty bytes starting at buffer_offset */
     24533 
     24534   int special_file;            /* =1 if the fd refers to a special file */
     24535-
     24536-  io_mode method;              /* Method of stream I/O being used */
     24537-
     24538-  char *buffer;
     24539-}
     24540-int_stream;
     24541-
     24542-/* This implementation of stream I/O is based on the paper:
     24543- *
     24544- *  "Exploiting the advantages of mapped files for stream I/O",
     24545- *  O. Krieger, M. Stumm and R. Umrau, "Proceedings of the 1992 Winter
     24546- *  USENIX conference", p. 27-42.
     24547- *
     24548- * It differs in a number of ways from the version described in the
     24549- * paper.  First of all, threads are not an issue during I/O and we
     24550- * also don't have to worry about having multiple regions, since
     24551- * fortran's I/O model only allows you to be one place at a time.
     24552- *
     24553- * On the other hand, we have to be able to writing at the end of a
     24554- * stream, read from the start of a stream or read and write blocks of
     24555- * bytes from an arbitrary position.  After opening a file, a pointer
     24556- * to a stream structure is returned, which is used to handle file
     24557- * accesses until the file is closed.
     24558- *
     24559- * salloc_at_r(stream, len, where)-- Given a stream pointer, return a
     24560- * pointer to a block of memory that mirror the file at position
     24561- * 'where' that is 'len' bytes long.  The len integer is updated to
     24562- * reflect how many bytes were actually read.  The only reason for a
     24563- * short read is end of file.  The file pointer is updated.  The
     24564- * pointer is valid until the next call to salloc_*.
     24565- *
     24566- * salloc_at_w(stream, len, where)-- Given the stream pointer, returns
     24567- * a pointer to a block of memory that is updated to reflect the state
     24568- * of the file.  The length of the buffer is always equal to that
     24569- * requested.  The buffer must be completely set by the caller.  When
     24570- * data has been written, the sfree() function must be called to
     24571- * indicate that the caller is done writing data to the buffer.  This
     24572- * may or may not cause a physical write.
     24573- *
     24574- * Short forms of these are salloc_r() and salloc_w() which drop the
     24575- * 'where' parameter and use the current file pointer. */
     24576-
     24577-
     24578-/*move_pos_offset()--  Move the record pointer right or left
     24579- *relative to current position */
     24580-
     24581-int
     24582-move_pos_offset (stream* st, int pos_off)
     24583-{
     24584-  unix_stream * str = (unix_stream*)st;
     24585-  if (pos_off < 0)
     24586-    {
     24587-      str->logical_offset += pos_off;
     24588-
     24589-      if (str->dirty_offset + str->ndirty > str->logical_offset)
     24590-       {
     24591-         if (str->ndirty + pos_off > 0)
     24592-           str->ndirty += pos_off;
     24593-         else
     24594-           {
     24595-             str->dirty_offset +=  pos_off + pos_off;
     24596-             str->ndirty = 0;
     24597-           }
     24598-       }
     24599-
     24600-    return pos_off;
     24601-  }
     24602-  return 0;
     24603 }
     24604+unix_stream;
     24605 
     24606 
     24607 /* fix_fd()-- Given a file descriptor, make sure it is not one of the
     24608@@ -292,17 +190,6 @@
     24609   return fd;
     24610 }
     24611 
     24612-int
     24613-is_preconnected (stream * s)
     24614-{
     24615-  int fd;
     24616-
     24617-  fd = ((unix_stream *) s)->fd;
     24618-  if (fd == STDIN_FILENO || fd == STDOUT_FILENO || fd == STDERR_FILENO)
     24619-    return 1;
     24620-  else
     24621-    return 0;
     24622-}
     24623 
     24624 /* If the stream corresponds to a preconnected unit, we flush the
     24625    corresponding C stream.  This is bugware for mixed C-Fortran codes
     24626@@ -322,580 +209,335 @@
     24627 }
     24628 
     24629 
     24630-/* Reset a stream after reading/writing. Assumes that the buffers have
     24631-   been flushed.  */
     24632+/* get_oserror()-- Get the most recent operating system error.  For
     24633+ * unix, this is errno. */
     24634 
     24635-inline static void
     24636-reset_stream (unix_stream * s, size_t bytes_rw)
     24637+const char *
     24638+get_oserror (void)
     24639 {
     24640-  s->physical_offset += bytes_rw;
     24641-  s->logical_offset = s->physical_offset;
     24642-  if (s->file_length != -1 && s->physical_offset > s->file_length)
     24643-    s->file_length = s->physical_offset;
     24644+  return strerror (errno);
     24645 }
     24646 
     24647 
     24648-/* Read bytes into a buffer, allowing for short reads.  If the nbytes
     24649- * argument is less on return than on entry, it is because we've hit
     24650- * the end of file. */
     24651+/********************************************************************
     24652+Raw I/O functions (read, write, seek, tell, truncate, close).
     24653+
     24654+These functions wrap the basic POSIX I/O syscalls. Any deviation in
     24655+semantics is a bug, except the following: write restarts in case
     24656+of being interrupted by a signal, and as the first argument the
     24657+functions take the unix_stream struct rather than an integer file
     24658+descriptor. Also, for POSIX read() and write() a nbyte argument larger
     24659+than SSIZE_MAX is undefined; here the type of nbyte is ssize_t rather
     24660+than size_t as for POSIX read/write.
     24661+*********************************************************************/
     24662 
     24663 static int
     24664-do_read (unix_stream * s, void * buf, size_t * nbytes)
     24665+raw_flush (unix_stream * s  __attribute__ ((unused)))
     24666 {
     24667-  ssize_t trans;
     24668-  size_t bytes_left;
     24669-  char *buf_st;
     24670-  int status;
     24671-
     24672-  status = 0;
     24673-  bytes_left = *nbytes;
     24674-  buf_st = (char *) buf;
     24675-
     24676-  /* We must read in a loop since some systems don't restart system
     24677-     calls in case of a signal.  */
     24678-  while (bytes_left > 0)
     24679-    {
     24680-      /* Requests between SSIZE_MAX and SIZE_MAX are undefined by SUSv3,
     24681-        so we must read in chunks smaller than SSIZE_MAX.  */
     24682-      trans = (bytes_left < SSIZE_MAX) ? bytes_left : SSIZE_MAX;
     24683-      trans = read (s->fd, buf_st, trans);
     24684-      if (trans < 0)
     24685-       {
     24686-         if (errno == EINTR)
     24687-           continue;
     24688-         else
     24689-           {
     24690-             status = errno;
     24691-             break;
     24692-           }
     24693-       }
     24694-      else if (trans == 0) /* We hit EOF.  */
     24695-       break;
     24696-      buf_st += trans;
     24697-      bytes_left -= trans;
     24698-    }
     24699-
     24700-  *nbytes -= bytes_left;
     24701-  return status;
     24702+  return 0;
     24703 }
     24704 
     24705+static ssize_t
     24706+raw_read (unix_stream * s, void * buf, ssize_t nbyte)
     24707+{
     24708+  /* For read we can't do I/O in a loop like raw_write does, because
     24709+     that will break applications that wait for interactive I/O.  */
     24710+  return read (s->fd, buf, nbyte);
     24711+}
     24712 
     24713-/* Write a buffer to a stream, allowing for short writes.  */
     24714-
     24715-static int
     24716-do_write (unix_stream * s, const void * buf, size_t * nbytes)
     24717+static ssize_t
     24718+raw_write (unix_stream * s, const void * buf, ssize_t nbyte)
     24719 {
     24720-  ssize_t trans;
     24721-  size_t bytes_left;
     24722+  ssize_t trans, bytes_left;
     24723   char *buf_st;
     24724-  int status;
     24725 
     24726-  status = 0;
     24727-  bytes_left = *nbytes;
     24728+  bytes_left = nbyte;
     24729   buf_st = (char *) buf;
     24730 
     24731   /* We must write in a loop since some systems don't restart system
     24732      calls in case of a signal.  */
     24733   while (bytes_left > 0)
     24734     {
     24735-      /* Requests between SSIZE_MAX and SIZE_MAX are undefined by SUSv3,
     24736-        so we must write in chunks smaller than SSIZE_MAX.  */
     24737-      trans = (bytes_left < SSIZE_MAX) ? bytes_left : SSIZE_MAX;
     24738-      trans = write (s->fd, buf_st, trans);
     24739+      trans = write (s->fd, buf_st, bytes_left);
     24740       if (trans < 0)
     24741        {
     24742          if (errno == EINTR)
     24743            continue;
     24744          else
     24745-           {
     24746-             status = errno;
     24747-             break;
     24748-           }
     24749+           return trans;
     24750        }
     24751       buf_st += trans;
     24752       bytes_left -= trans;
     24753     }
     24754 
     24755-  *nbytes -= bytes_left;
     24756-  return status;
     24757+  return nbyte - bytes_left;
     24758 }
     24759 
     24760-
     24761-/* get_oserror()-- Get the most recent operating system error.  For
     24762- * unix, this is errno. */
     24763-
     24764-const char *
     24765-get_oserror (void)
     24766+static off_t
     24767+raw_seek (unix_stream * s, off_t offset, int whence)
     24768 {
     24769-  return strerror (errno);
     24770+  return lseek (s->fd, offset, whence);
     24771 }
     24772 
     24773-
     24774-/*********************************************************************
     24775-    File descriptor stream functions
     24776-*********************************************************************/
     24777-
     24778-
     24779-/* fd_flush()-- Write bytes that need to be written */
     24780-
     24781-static try
     24782-fd_flush (unix_stream * s)
     24783+static off_t
     24784+raw_tell (unix_stream * s)
     24785 {
     24786-  size_t writelen;
     24787-
     24788-  if (s->ndirty == 0)
     24789-    return SUCCESS;
     24790
     24791-  if (s->file_length != -1 && s->physical_offset != s->dirty_offset &&
     24792-      lseek (s->fd, s->dirty_offset, SEEK_SET) < 0)
     24793-    return FAILURE;
     24794-
     24795-  writelen = s->ndirty;
     24796-  if (do_write (s, s->buffer + (s->dirty_offset - s->buffer_offset),
     24797-               &writelen) != 0)
     24798-    return FAILURE;
     24799-
     24800-  s->physical_offset = s->dirty_offset + writelen;
     24801-
     24802-  /* don't increment file_length if the file is non-seekable */
     24803-  if (s->file_length != -1 && s->physical_offset > s->file_length)
     24804-      s->file_length = s->physical_offset;
     24805-
     24806-  s->ndirty -= writelen;
     24807-  if (s->ndirty != 0)
     24808-    return FAILURE;
     24809-
     24810-  return SUCCESS;
     24811+  return lseek (s->fd, 0, SEEK_CUR);
     24812 }
     24813 
     24814-
     24815-/* fd_alloc()-- Arrange a buffer such that the salloc() request can be
     24816- * satisfied.  This subroutine gets the buffer ready for whatever is
     24817- * to come next. */
     24818-
     24819-static void
     24820-fd_alloc (unix_stream * s, gfc_offset where,
     24821-         int *len __attribute__ ((unused)))
     24822+static int
     24823+raw_truncate (unix_stream * s, off_t length)
     24824 {
     24825-  char *new_buffer;
     24826-  int n, read_len;
     24827-
     24828-  if (*len <= BUFFER_SIZE)
     24829-    {
     24830-      new_buffer = s->small_buffer;
     24831-      read_len = BUFFER_SIZE;
     24832-    }
     24833-  else
     24834-    {
     24835-      new_buffer = get_mem (*len);
     24836-      read_len = *len;
     24837-    }
     24838-
     24839-  /* Salvage bytes currently within the buffer.  This is important for
     24840-   * devices that cannot seek. */
     24841-
     24842-  if (s->buffer != NULL && s->buffer_offset <= where &&
     24843-      where <= s->buffer_offset + s->active)
     24844-    {
     24845-
     24846-      n = s->active - (where - s->buffer_offset);
     24847-      memmove (new_buffer, s->buffer + (where - s->buffer_offset), n);
     24848+#ifdef HAVE_FTRUNCATE
     24849+  return ftruncate (s->fd, length);
     24850+#elif defined HAVE_CHSIZE
     24851+  return chsize (s->fd, length);
     24852+#else
     24853+  runtime_error ("required ftruncate or chsize support not present");
     24854+  return -1;
     24855+#endif
     24856+}
     24857 
     24858-      s->active = n;
     24859-    }
     24860+static int
     24861+raw_close (unix_stream * s)
     24862+{
     24863+  int retval;
     24864
     24865+  if (s->fd != STDOUT_FILENO
     24866+      && s->fd != STDERR_FILENO
     24867+      && s->fd != STDIN_FILENO)
     24868+    retval = close (s->fd);
     24869   else
     24870-    {                          /* new buffer starts off empty */
     24871-      s->active = 0;
     24872-    }
     24873-
     24874-  s->buffer_offset = where;
     24875-
     24876-  /* free the old buffer if necessary */
     24877+    retval = 0;
     24878+  free_mem (s);
     24879+  return retval;
     24880+}
     24881 
     24882-  if (s->buffer != NULL && s->buffer != s->small_buffer)
     24883-    free_mem (s->buffer);
     24884+static int
     24885+raw_init (unix_stream * s)
     24886+{
     24887+  s->st.read = (void *) raw_read;
     24888+  s->st.write = (void *) raw_write;
     24889+  s->st.seek = (void *) raw_seek;
     24890+  s->st.tell = (void *) raw_tell;
     24891+  s->st.trunc = (void *) raw_truncate;
     24892+  s->st.close = (void *) raw_close;
     24893+  s->st.flush = (void *) raw_flush;
     24894 
     24895-  s->buffer = new_buffer;
     24896-  s->len = read_len;
     24897+  s->buffer = NULL;
     24898+  return 0;
     24899 }
     24900 
     24901 
     24902-/* fd_alloc_r_at()-- Allocate a stream buffer for reading.  Either
     24903- * we've already buffered the data or we need to load it.  Returns
     24904- * NULL on I/O error. */
     24905+/*********************************************************************
     24906+Buffered I/O functions. These functions have the same semantics as the
     24907+raw I/O functions above, except that they are buffered in order to
     24908+improve performance. The buffer must be flushed when switching from
     24909+reading to writing and vice versa.
     24910+*********************************************************************/
     24911 
     24912-static char *
     24913-fd_alloc_r_at (unix_stream * s, int *len)
     24914+static int
     24915+buf_flush (unix_stream * s)
     24916 {
     24917-  gfc_offset m;
     24918-  gfc_offset where = s->logical_offset;
     24919+  int writelen;
     24920 
     24921-  if (s->buffer != NULL && s->buffer_offset <= where &&
     24922-      where + *len <= s->buffer_offset + s->active)
     24923-    {
     24924-
     24925-      /* Return a position within the current buffer */
     24926+  /* Flushing in read mode means discarding read bytes.  */
     24927+  s->active = 0;
     24928 
     24929-      s->logical_offset = where + *len;
     24930-      return s->buffer + where - s->buffer_offset;
     24931-    }
     24932+  if (s->ndirty == 0)
     24933+    return 0;
     24934
     24935+  if (s->file_length != -1 && s->physical_offset != s->buffer_offset
     24936+      && lseek (s->fd, s->buffer_offset, SEEK_SET) < 0)
     24937+    return -1;
     24938 
     24939-  fd_alloc (s, where, len);
     24940+  writelen = raw_write (s, s->buffer, s->ndirty);
     24941 
     24942-  m = where + s->active;
     24943+  s->physical_offset = s->buffer_offset + writelen;
     24944 
     24945-  if (s->physical_offset != m && lseek (s->fd, m, SEEK_SET) < 0)
     24946-    return NULL;
     24947+  /* Don't increment file_length if the file is non-seekable.  */
     24948+  if (s->file_length != -1 && s->physical_offset > s->file_length)
     24949+      s->file_length = s->physical_offset;
     24950 
     24951-  /* do_read() hangs on read from terminals for *BSD-systems.  Only
     24952-     use read() in that case.  */
     24953+  s->ndirty -= writelen;
     24954+  if (s->ndirty != 0)
     24955+    return -1;
     24956 
     24957-  if (s->special_file)
     24958-    {
     24959-      ssize_t n;
     24960+  return 0;
     24961+}
     24962 
     24963-      n = read (s->fd, s->buffer + s->active, s->len - s->active);
     24964-      if (n < 0)
     24965-       return NULL;
     24966+static ssize_t
     24967+buf_read (unix_stream * s, void * buf, ssize_t nbyte)
     24968+{
     24969+  if (s->active == 0)
     24970+    s->buffer_offset = s->logical_offset;
     24971 
     24972-      s->physical_offset = m + n;
     24973-      s->active += n;
     24974-    }
     24975+  /* Is the data we want in the buffer?  */
     24976+  if (s->logical_offset + nbyte <= s->buffer_offset + s->active
     24977+      && s->buffer_offset <= s->logical_offset)
     24978+    memcpy (buf, s->buffer + (s->logical_offset - s->buffer_offset), nbyte);
     24979   else
     24980     {
     24981-      size_t n;
     24982-
     24983-      n = s->len - s->active;
     24984-      if (do_read (s, s->buffer + s->active, &n) != 0)
     24985-       return NULL;
     24986-
     24987-      s->physical_offset = m + n;
     24988-      s->active += n;
     24989+      /* First copy the active bytes if applicable, then read the rest
     24990+         either directly or filling the buffer.  */
     24991+      char *p;
     24992+      int nread = 0;
     24993+      ssize_t to_read, did_read;
     24994+      gfc_offset new_logical;
     24995+     
     24996+      p = (char *) buf;
     24997+      if (s->logical_offset >= s->buffer_offset
     24998+          && s->buffer_offset + s->active >= s->logical_offset)
     24999+        {
     25000+          nread = s->active - (s->logical_offset - s->buffer_offset);
     25001+          memcpy (buf, s->buffer + (s->logical_offset - s->buffer_offset),
     25002+                  nread);
     25003+          p += nread;
     25004+        }
     25005+      /* At this point we consider all bytes in the buffer discarded.  */
     25006+      to_read = nbyte - nread;
     25007+      new_logical = s->logical_offset + nread;
     25008+      if (s->file_length != -1 && s->physical_offset != new_logical
     25009+          && lseek (s->fd, new_logical, SEEK_SET) < 0)
     25010+        return -1;
     25011+      s->buffer_offset = s->physical_offset = new_logical;
     25012+      if (to_read <= BUFFER_SIZE/2)
     25013+        {
     25014+          did_read = raw_read (s, s->buffer, BUFFER_SIZE);
     25015+          s->physical_offset += did_read;
     25016+          s->active = did_read;
     25017+          did_read = (did_read > to_read) ? to_read : did_read;
     25018+          memcpy (p, s->buffer, did_read);
     25019+        }
     25020+      else
     25021+        {
     25022+          did_read = raw_read (s, p, to_read);
     25023+          s->physical_offset += did_read;
     25024+          s->active = 0;
     25025+        }
     25026+      nbyte = did_read + nread;
     25027     }
     25028-
     25029-  if (s->active < *len)
     25030-    *len = s->active;          /* Bytes actually available */
     25031-
     25032-  s->logical_offset = where + *len;
     25033-
     25034-  return s->buffer;
     25035+  s->logical_offset += nbyte;
     25036+  return nbyte;
     25037 }
     25038 
     25039-
     25040-/* fd_alloc_w_at()-- Allocate a stream buffer for writing.  Either
     25041- * we've already buffered the data or we need to load it. */
     25042-
     25043-static char *
     25044-fd_alloc_w_at (unix_stream * s, int *len)
     25045+static ssize_t
     25046+buf_write (unix_stream * s, const void * buf, ssize_t nbyte)
     25047 {
     25048-  gfc_offset n;
     25049-  gfc_offset where = s->logical_offset;
     25050-
     25051-  if (s->buffer == NULL || s->buffer_offset > where ||
     25052-      where + *len > s->buffer_offset + s->len)
     25053-    {
     25054+  if (s->ndirty == 0)
     25055+    s->buffer_offset = s->logical_offset;
     25056 
     25057-      if (fd_flush (s) == FAILURE)
     25058-       return NULL;
     25059-      fd_alloc (s, where, len);
     25060-    }
     25061-
     25062-  /* Return a position within the current buffer */
     25063-  if (s->ndirty == 0
     25064-      || where > s->dirty_offset + s->ndirty   
     25065-      || s->dirty_offset > where + *len)
     25066-    {  /* Discontiguous blocks, start with a clean buffer.  */ 
     25067-       /* Flush the buffer.  */ 
     25068-      if (s->ndirty != 0)   
     25069-       fd_flush (s); 
     25070-      s->dirty_offset = where; 
     25071-      s->ndirty = *len;
     25072+  /* Does the data fit into the buffer?  As a special case, if the
     25073+     buffer is empty and the request is bigger than BUFFER_SIZE/2,
     25074+     write directly. This avoids the case where the buffer would have
     25075+     to be flushed at every write.  */
     25076+  if (!(s->ndirty == 0 && nbyte > BUFFER_SIZE/2)
     25077+      && s->logical_offset + nbyte <= s->buffer_offset + BUFFER_SIZE
     25078+      && s->buffer_offset <= s->logical_offset
     25079+      && s->buffer_offset + s->ndirty >= s->logical_offset)
     25080+    {
     25081+      memcpy (s->buffer + (s->logical_offset - s->buffer_offset), buf, nbyte);
     25082+      int nd = (s->logical_offset - s->buffer_offset) + nbyte;
     25083+      if (nd > s->ndirty)
     25084+        s->ndirty = nd;
     25085     }
     25086   else
     25087-    { 
     25088-      gfc_offset start;  /* Merge with the existing data.  */ 
     25089-      if (where < s->dirty_offset)   
     25090-       start = where; 
     25091-      else   
     25092-       start = s->dirty_offset; 
     25093-      if (where + *len > s->dirty_offset + s->ndirty)   
     25094-       s->ndirty = where + *len - start; 
     25095-      else   
     25096-       s->ndirty = s->dirty_offset + s->ndirty - start; 
     25097-      s->dirty_offset = start;
     25098+    {
     25099+      /* Flush, and either fill the buffer with the new data, or if
     25100+         the request is bigger than the buffer size, write directly
     25101+         bypassing the buffer.  */
     25102+      buf_flush (s);
     25103+      if (nbyte <= BUFFER_SIZE/2)
     25104+        {
     25105+          memcpy (s->buffer, buf, nbyte);
     25106+          s->buffer_offset = s->logical_offset;
     25107+          s->ndirty += nbyte;
     25108+        }
     25109+      else
     25110+        {
     25111+          if (s->file_length != -1 && s->physical_offset != s->logical_offset
     25112+              && lseek (s->fd, s->logical_offset, SEEK_SET) < 0)
     25113+            return -1;
     25114+          nbyte = raw_write (s, buf, nbyte);
     25115+          s->physical_offset += nbyte;
     25116+        }
     25117     }
     25118-
     25119-  s->logical_offset = where + *len;
     25120-
     25121+  s->logical_offset += nbyte;
     25122   /* Don't increment file_length if the file is non-seekable.  */
     25123-
     25124   if (s->file_length != -1 && s->logical_offset > s->file_length)
     25125-     s->file_length = s->logical_offset;
     25126-
     25127-  n = s->logical_offset - s->buffer_offset;
     25128-  if (n > s->active)
     25129-    s->active = n;
     25130-
     25131-  return s->buffer + where - s->buffer_offset;
     25132-}
     25133-
     25134-
     25135-static try
     25136-fd_sfree (unix_stream * s)
     25137-{
     25138-  if (s->ndirty != 0 &&
     25139-      (s->buffer != s->small_buffer || options.all_unbuffered ||
     25140-       s->method == SYNC_UNBUFFERED))
     25141-    return fd_flush (s);
     25142-
     25143-  return SUCCESS;
     25144+    s->file_length = s->logical_offset;
     25145+  return nbyte;
     25146 }
     25147 
     25148-
     25149-static try
     25150-fd_seek (unix_stream * s, gfc_offset offset)
     25151+static off_t
     25152+buf_seek (unix_stream * s, off_t offset, int whence)
     25153 {
     25154-
     25155-  if (s->file_length == -1)
     25156-    return SUCCESS;
     25157-
     25158-  if (s->physical_offset == offset) /* Are we lucky and avoid syscall?  */
     25159-    {
     25160-      s->logical_offset = offset;
     25161-      return SUCCESS;
     25162-    }
     25163-
     25164-  if (lseek (s->fd, offset, SEEK_SET) >= 0)
     25165+  switch (whence)
     25166     {
     25167-      s->physical_offset = s->logical_offset = offset;
     25168-      s->active = 0;
     25169-      return SUCCESS;
     25170+    case SEEK_SET:
     25171+      break;
     25172+    case SEEK_CUR:
     25173+      offset += s->logical_offset;
     25174+      break;
     25175+    case SEEK_END:
     25176+      offset += s->file_length;
     25177+      break;
     25178+    default:
     25179+      return -1;
     25180     }
     25181-
     25182-  return FAILURE;
     25183-}
     25184-
     25185-
     25186-/* truncate_file()-- Given a unit, truncate the file at the current
     25187- * position.  Sets the physical location to the new end of the file.
     25188- * Returns nonzero on error. */
     25189-
     25190-static try
     25191-fd_truncate (unix_stream * s)
     25192-{
     25193-  /* Non-seekable files, like terminals and fifo's fail the lseek so just
     25194-     return success, there is nothing to truncate.  If its not a pipe there
     25195-     is a real problem.  */
     25196-  if (lseek (s->fd, s->logical_offset, SEEK_SET) == -1)
     25197+  if (offset < 0)
     25198     {
     25199-      if (errno == ESPIPE)
     25200-       return SUCCESS;
     25201-      else
     25202-       return FAILURE;
     25203-    }
     25204-
     25205-  /* Using ftruncate on a seekable special file (like /dev/null)
     25206-     is undefined, so we treat it as if the ftruncate succeeded.  */
     25207-  if (!s->special_file
     25208-      && (
     25209-#ifdef HAVE_FTRUNCATE
     25210-         ftruncate (s->fd, s->logical_offset) != 0
     25211-#elif defined HAVE_CHSIZE
     25212-         chsize (s->fd, s->logical_offset) != 0
     25213-#else
     25214-         /* If we have neither, always fail and exit, noisily.  */
     25215-         runtime_error ("required ftruncate or chsize support not present"), 1
     25216-#endif
     25217-         ))
     25218-    {
     25219-      /* The truncation failed and we need to handle this gracefully.
     25220-        The file length remains the same, but the file-descriptor
     25221-        offset needs adjustment per the successful lseek above.
     25222-        (Similarly, the contents of the buffer isn't valid anymore.)
     25223-        A ftruncate call does not affect the physical (file-descriptor)
     25224-        offset, according to the ftruncate manual, so neither should a
     25225-        failed call.  */
     25226-      s->physical_offset = s->logical_offset;
     25227-      s->active = 0;
     25228-      return FAILURE;
     25229+      errno = EINVAL;
     25230+      return -1;
     25231     }
     25232-
     25233-  s->physical_offset = s->file_length = s->logical_offset;
     25234-  s->active = 0;
     25235-  return SUCCESS;
     25236+  s->logical_offset = offset;
     25237+  return offset;
     25238 }
     25239 
     25240-
     25241-/* Similar to memset(), but operating on a stream instead of a string.
     25242-   Takes care of not using too much memory.  */
     25243-
     25244-static try
     25245-fd_sset (unix_stream * s, int c, size_t n)
     25246+static off_t
     25247+buf_tell (unix_stream * s)
     25248 {
     25249-  size_t bytes_left;
     25250-  int trans;
     25251-  void *p;
     25252-
     25253-  bytes_left = n;
     25254-
     25255-  while (bytes_left > 0)
     25256-    {
     25257-      /* memset() in chunks of BUFFER_SIZE.  */
     25258-      trans = (bytes_left < BUFFER_SIZE) ? bytes_left : BUFFER_SIZE;
     25259-
     25260-      p = fd_alloc_w_at (s, &trans);
     25261-      if (p)
     25262-         memset (p, c, trans);
     25263-      else
     25264-       return FAILURE;
     25265-
     25266-      bytes_left -= trans;
     25267-    }
     25268-
     25269-  return SUCCESS;
     25270+  return s->logical_offset;
     25271 }
     25272 
     25273-
     25274-/* Stream read function. Avoids using a buffer for big reads. The
     25275-   interface is like POSIX read(), but the nbytes argument is a
     25276-   pointer; on return it contains the number of bytes written. The
     25277-   function return value is the status indicator (0 for success).  */
     25278-
     25279 static int
     25280-fd_read (unix_stream * s, void * buf, size_t * nbytes)
     25281+buf_truncate (unix_stream * s, off_t length)
     25282 {
     25283-  void *p;
     25284-  int tmp, status;
     25285+  int r;
     25286 
     25287-  if (*nbytes < BUFFER_SIZE && s->method == SYNC_BUFFERED)
     25288-    {
     25289-      tmp = *nbytes;
     25290-      p = fd_alloc_r_at (s, &tmp);
     25291-      if (p)
     25292-       {
     25293-         *nbytes = tmp;
     25294-         memcpy (buf, p, *nbytes);
     25295-         return 0;
     25296-       }
     25297-      else
     25298-       {
     25299-         *nbytes = 0;
     25300-         return errno;
     25301-       }
     25302-    }
     25303-
     25304-  /* If the request is bigger than BUFFER_SIZE we flush the buffers
     25305-     and read directly.  */
     25306-  if (fd_flush (s) == FAILURE)
     25307-    {
     25308-      *nbytes = 0;
     25309-      return errno;
     25310-    }
     25311-
     25312-  if (is_seekable ((stream *) s) && fd_seek (s, s->logical_offset) == FAILURE)
     25313-    {
     25314-      *nbytes = 0;
     25315-      return errno;
     25316-    }
     25317-
     25318-  status = do_read (s, buf, nbytes);
     25319-  reset_stream (s, *nbytes);
     25320-  return status;
     25321+  if (buf_flush (s) != 0)
     25322+    return -1;
     25323+  r = raw_truncate (s, length);
     25324+  if (r == 0)
     25325+    s->file_length = length;
     25326+  return r;
     25327 }
     25328 
     25329-
     25330-/* Stream write function. Avoids using a buffer for big writes. The
     25331-   interface is like POSIX write(), but the nbytes argument is a
     25332-   pointer; on return it contains the number of bytes written. The
     25333-   function return value is the status indicator (0 for success).  */
     25334-
     25335 static int
     25336-fd_write (unix_stream * s, const void * buf, size_t * nbytes)
     25337-{
     25338-  void *p;
     25339-  int tmp, status;
     25340-
     25341-  if (*nbytes < BUFFER_SIZE && s->method == SYNC_BUFFERED)
     25342-    {
     25343-      tmp = *nbytes;
     25344-      p = fd_alloc_w_at (s, &tmp);
     25345-      if (p)
     25346-       {
     25347-         *nbytes = tmp;
     25348-         memcpy (p, buf, *nbytes);
     25349-         return 0;
     25350-       }
     25351-      else
     25352-       {
     25353-         *nbytes = 0;
     25354-         return errno;
     25355-       }
     25356-    }
     25357-
     25358-  /* If the request is bigger than BUFFER_SIZE we flush the buffers
     25359-     and write directly.  */
     25360-  if (fd_flush (s) == FAILURE)
     25361-    {
     25362-      *nbytes = 0;
     25363-      return errno;
     25364-    }
     25365-
     25366-  if (is_seekable ((stream *) s) && fd_seek (s, s->logical_offset) == FAILURE)
     25367-    {
     25368-      *nbytes = 0;
     25369-      return errno;
     25370-    }
     25371-
     25372-  status =  do_write (s, buf, nbytes);
     25373-  reset_stream (s, *nbytes);
     25374-  return status;
     25375-}
     25376-
     25377-
     25378-static try
     25379-fd_close (unix_stream * s)
     25380+buf_close (unix_stream * s)
     25381 {
     25382-  if (fd_flush (s) == FAILURE)
     25383-    return FAILURE;
     25384-
     25385-  if (s->buffer != NULL && s->buffer != s->small_buffer)
     25386-    free_mem (s->buffer);
     25387-
     25388-  if (s->fd != STDOUT_FILENO && s->fd != STDERR_FILENO && s->fd != STDIN_FILENO)
     25389-    {
     25390-      if (close (s->fd) < 0)
     25391-       return FAILURE;
     25392-    }
     25393-
     25394-  free_mem (s);
     25395-
     25396-  return SUCCESS;
     25397+  if (buf_flush (s) != 0)
     25398+    return -1;
     25399+  free_mem (s->buffer);
     25400+  return raw_close (s);
     25401 }
     25402 
     25403-
     25404-static void
     25405-fd_open (unix_stream * s)
     25406+static int
     25407+buf_init (unix_stream * s)
     25408 {
     25409-  if (isatty (s->fd))
     25410-    s->method = SYNC_UNBUFFERED;
     25411-  else
     25412-    s->method = SYNC_BUFFERED;
     25413+  s->st.read = (void *) buf_read;
     25414+  s->st.write = (void *) buf_write;
     25415+  s->st.seek = (void *) buf_seek;
     25416+  s->st.tell = (void *) buf_tell;
     25417+  s->st.trunc = (void *) buf_truncate;
     25418+  s->st.close = (void *) buf_close;
     25419+  s->st.flush = (void *) buf_flush;
     25420 
     25421-  s->st.alloc_w_at = (void *) fd_alloc_w_at;
     25422-  s->st.sfree = (void *) fd_sfree;
     25423-  s->st.close = (void *) fd_close;
     25424-  s->st.seek = (void *) fd_seek;
     25425-  s->st.trunc = (void *) fd_truncate;
     25426-  s->st.read = (void *) fd_read;
     25427-  s->st.write = (void *) fd_write;
     25428-  s->st.set = (void *) fd_sset;
     25429-
     25430-  s->buffer = NULL;
     25431+  s->buffer = get_mem (BUFFER_SIZE);
     25432+  return 0;
     25433 }
     25434 
     25435 
     25436-
     25437-
     25438 /*********************************************************************
     25439   memory stream functions - These are used for internal files
     25440 
     25441@@ -907,33 +549,33 @@
     25442 *********************************************************************/
     25443 
     25444 
     25445-static char *
     25446-mem_alloc_r_at (int_stream * s, int *len)
     25447+char *
     25448+mem_alloc_r (stream * strm, int * len)
     25449 {
     25450+  unix_stream * s = (unix_stream *) strm;
     25451   gfc_offset n;
     25452   gfc_offset where = s->logical_offset;
     25453 
     25454   if (where < s->buffer_offset || where > s->buffer_offset + s->active)
     25455     return NULL;
     25456 
     25457-  s->logical_offset = where + *len;
     25458-
     25459   n = s->buffer_offset + s->active - where;
     25460   if (*len > n)
     25461     *len = n;
     25462 
     25463+  s->logical_offset = where + *len;
     25464+
     25465   return s->buffer + (where - s->buffer_offset);
     25466 }
     25467 
     25468 
     25469-static char *
     25470-mem_alloc_w_at (int_stream * s, int *len)
     25471+char *
     25472+mem_alloc_w (stream * strm, int * len)
     25473 {
     25474+  unix_stream * s = (unix_stream *) strm;
     25475   gfc_offset m;
     25476   gfc_offset where = s->logical_offset;
     25477 
     25478-  assert (*len >= 0);  /* Negative values not allowed. */
     25479
     25480   m = where + *len;
     25481 
     25482   if (where < s->buffer_offset)
     25483@@ -950,25 +592,20 @@
     25484 
     25485 /* Stream read function for internal units.  */
     25486 
     25487-static int
     25488-mem_read (int_stream * s, void * buf, size_t * nbytes)
     25489+static ssize_t
     25490+mem_read (stream * s, void * buf, ssize_t nbytes)
     25491 {
     25492   void *p;
     25493-  int tmp;
     25494+  int nb = nbytes;
     25495 
     25496-  tmp = *nbytes;
     25497-  p = mem_alloc_r_at (s, &tmp);
     25498+  p = mem_alloc_r (s, &nb);
     25499   if (p)
     25500     {
     25501-      *nbytes = tmp;
     25502-      memcpy (buf, p, *nbytes);
     25503-      return 0;
     25504+      memcpy (buf, p, nb);
     25505+      return (ssize_t) nb;
     25506     }
     25507   else
     25508-    {
     25509-      *nbytes = 0;
     25510-      return 0;
     25511-    }
     25512+    return 0;
     25513 }
     25514 
     25515 
     25516@@ -976,84 +613,90 @@
     25517    at the moment, as all internal IO is formatted and the formatted IO
     25518    routines use mem_alloc_w_at.  */
     25519 
     25520-static int
     25521-mem_write (int_stream * s, const void * buf, size_t * nbytes)
     25522+static ssize_t
     25523+mem_write (stream * s, const void * buf, ssize_t nbytes)
     25524 {
     25525   void *p;
     25526-  int tmp;
     25527+  int nb = nbytes;
     25528 
     25529-  tmp = *nbytes;
     25530-  p = mem_alloc_w_at (s, &tmp);
     25531+  p = mem_alloc_w (s, &nb);
     25532   if (p)
     25533     {
     25534-      *nbytes = tmp;
     25535-      memcpy (p, buf, *nbytes);
     25536-      return 0;
     25537+      memcpy (p, buf, nb);
     25538+      return (ssize_t) nb;
     25539     }
     25540   else
     25541-    {
     25542-      *nbytes = 0;
     25543-      return 0;
     25544-    }
     25545+    return 0;
     25546 }
     25547 
     25548 
     25549-static int
     25550-mem_seek (int_stream * s, gfc_offset offset)
     25551+static off_t
     25552+mem_seek (stream * strm, off_t offset, int whence)
     25553 {
     25554+  unix_stream * s = (unix_stream *) strm;
     25555+  switch (whence)
     25556+    {
     25557+    case SEEK_SET:
     25558+      break;
     25559+    case SEEK_CUR:
     25560+      offset += s->logical_offset;
     25561+      break;
     25562+    case SEEK_END:
     25563+      offset += s->file_length;
     25564+      break;
     25565+    default:
     25566+      return -1;
     25567+    }
     25568+
     25569+  /* Note that for internal array I/O it's actually possible to have a
     25570+     negative offset, so don't check for that.  */
     25571   if (offset > s->file_length)
     25572     {
     25573-      errno = ESPIPE;
     25574-      return FAILURE;
     25575+      errno = EINVAL;
     25576+      return -1;
     25577     }
     25578 
     25579   s->logical_offset = offset;
     25580-  return SUCCESS;
     25581+
     25582+  /* Returning < 0 is the error indicator for sseek(), so return 0 if
     25583+     offset is negative.  Thus if the return value is 0, the caller
     25584+     has to use stell() to get the real value of logical_offset.  */
     25585+  if (offset >= 0)
     25586+    return offset;
     25587+  return 0;
     25588 }
     25589 
     25590 
     25591-static try
     25592-mem_set (int_stream * s, int c, size_t n)
     25593+static off_t
     25594+mem_tell (stream * s)
     25595 {
     25596-  void *p;
     25597-  int len;
     25598-
     25599-  len = n;
     25600
     25601-  p = mem_alloc_w_at (s, &len);
     25602-  if (p)
     25603-    {
     25604-      memset (p, c, len);
     25605-      return SUCCESS;
     25606-    }
     25607-  else
     25608-    return FAILURE;
     25609+  return ((unix_stream *)s)->logical_offset;
     25610 }
     25611 
     25612 
     25613 static int
     25614-mem_truncate (int_stream * s __attribute__ ((unused)))
     25615+mem_truncate (unix_stream * s __attribute__ ((unused)),
     25616+             off_t length __attribute__ ((unused)))
     25617 {
     25618-  return SUCCESS;
     25619+  return 0;
     25620 }
     25621 
     25622 
     25623-static try
     25624-mem_close (int_stream * s)
     25625+static int
     25626+mem_flush (unix_stream * s __attribute__ ((unused)))
     25627 {
     25628-  if (s != NULL)
     25629-    free_mem (s);
     25630-
     25631-  return SUCCESS;
     25632+  return 0;
     25633 }
     25634 
     25635 
     25636-static try
     25637-mem_sfree (int_stream * s __attribute__ ((unused)))
     25638+static int
     25639+mem_close (unix_stream * s)
     25640 {
     25641-  return SUCCESS;
     25642-}
     25643+  if (s != NULL)
     25644+    free_mem (s);
     25645 
     25646+  return 0;
     25647+}
     25648 
     25649 
     25650 /*********************************************************************
     25651@@ -1066,7 +709,7 @@
     25652 void
     25653 empty_internal_buffer(stream *strm)
     25654 {
     25655-  int_stream * s = (int_stream *) strm;
     25656+  unix_stream * s = (unix_stream *) strm;
     25657   memset(s->buffer, ' ', s->file_length);
     25658 }
     25659 
     25660@@ -1075,10 +718,10 @@
     25661 stream *
     25662 open_internal (char *base, int length, gfc_offset offset)
     25663 {
     25664-  int_stream *s;
     25665+  unix_stream *s;
     25666 
     25667-  s = get_mem (sizeof (int_stream));
     25668-  memset (s, '\0', sizeof (int_stream));
     25669+  s = get_mem (sizeof (unix_stream));
     25670+  memset (s, '\0', sizeof (unix_stream));
     25671 
     25672   s->buffer = base;
     25673   s->buffer_offset = offset;
     25674@@ -1086,14 +729,13 @@
     25675   s->logical_offset = 0;
     25676   s->active = s->file_length = length;
     25677 
     25678-  s->st.alloc_w_at = (void *) mem_alloc_w_at;
     25679-  s->st.sfree = (void *) mem_sfree;
     25680   s->st.close = (void *) mem_close;
     25681   s->st.seek = (void *) mem_seek;
     25682+  s->st.tell = (void *) mem_tell;
     25683   s->st.trunc = (void *) mem_truncate;
     25684   s->st.read = (void *) mem_read;
     25685   s->st.write = (void *) mem_write;
     25686-  s->st.set = (void *) mem_set;
     25687+  s->st.flush = (void *) mem_flush;
     25688 
     25689   return (stream *) s;
     25690 }
     25691@@ -1128,7 +770,14 @@
     25692 
     25693   s->special_file = !S_ISREG (statbuf.st_mode);
     25694 
     25695-  fd_open (s);
     25696+  if (isatty (s->fd) || options.all_unbuffered
     25697+      ||(options.unbuffered_preconnected &&
     25698+         (s->fd == STDIN_FILENO
     25699+          || s->fd == STDOUT_FILENO
     25700+          || s->fd == STDERR_FILENO)))
     25701+    raw_init (s);
     25702+  else
     25703+    buf_init (s);
     25704 
     25705   return (stream *) s;
     25706 }
     25707@@ -1412,8 +1061,6 @@
     25708 #endif
     25709 
     25710   s = fd_to_stream (STDOUT_FILENO, PROT_WRITE);
     25711-  if (options.unbuffered_preconnected)
     25712-    ((unix_stream *) s)->method = SYNC_UNBUFFERED;
     25713   return s;
     25714 }
     25715 
     25716@@ -1431,8 +1078,6 @@
     25717 #endif
     25718 
     25719   s = fd_to_stream (STDERR_FILENO, PROT_WRITE);
     25720-  if (options.unbuffered_preconnected)
     25721-    ((unix_stream *) s)->method = SYNC_UNBUFFERED;
     25722   return s;
     25723 }
     25724 
     25725@@ -1663,7 +1308,7 @@
     25726          if (__gthread_mutex_trylock (&u->lock))
     25727            return u;
     25728          if (u->s)
     25729-           flush (u->s);
     25730+           sflush (u->s);
     25731          __gthread_mutex_unlock (&u->lock);
     25732        }
     25733       u = u->right;
     25734@@ -1693,7 +1338,7 @@
     25735 
     25736       if (u->closed == 0)
     25737        {
     25738-         flush (u->s);
     25739+         sflush (u->s);
     25740          __gthread_mutex_lock (&unit_lock);
     25741          __gthread_mutex_unlock (&u->lock);
     25742          (void) predec_waiting_locked (u);
     25743@@ -1710,40 +1355,6 @@
     25744 }
     25745 
     25746 
     25747-/* stream_at_bof()-- Returns nonzero if the stream is at the beginning
     25748- * of the file. */
     25749-
     25750-int
     25751-stream_at_bof (stream * s)
     25752-{
     25753-  unix_stream *us;
     25754-
     25755-  if (!is_seekable (s))
     25756-    return 0;
     25757-
     25758-  us = (unix_stream *) s;
     25759-
     25760-  return us->logical_offset == 0;
     25761-}
     25762-
     25763-
     25764-/* stream_at_eof()-- Returns nonzero if the stream is at the end
     25765- * of the file. */
     25766-
     25767-int
     25768-stream_at_eof (stream * s)
     25769-{
     25770-  unix_stream *us;
     25771-
     25772-  if (!is_seekable (s))
     25773-    return 0;
     25774-
     25775-  us = (unix_stream *) s;
     25776-
     25777-  return us->logical_offset == us->dirty_offset;
     25778-}
     25779-
     25780-
     25781 /* delete_file()-- Given a unit structure, delete the file associated
     25782  * with the unit.  Returns nonzero if something went wrong. */
     25783 
     25784@@ -1949,16 +1560,15 @@
     25785 gfc_offset
     25786 file_length (stream * s)
     25787 {
     25788-  return ((unix_stream *) s)->file_length;
     25789-}
     25790-
     25791-
     25792-/* file_position()-- Return the current position of the file */
     25793-
     25794-gfc_offset
     25795-file_position (stream *s)
     25796-{
     25797-  return ((unix_stream *) s)->logical_offset;
     25798+  off_t curr, end;
     25799+  if (!is_seekable (s))
     25800+    return -1;
     25801+  curr = stell (s);
     25802+  if (curr == -1)
     25803+    return curr;
     25804+  end = sseek (s, 0, SEEK_END);
     25805+  sseek (s, curr, SEEK_SET);
     25806+  return end;
     25807 }
     25808 
     25809 
     25810@@ -1983,12 +1593,6 @@
     25811 }
     25812 
     25813 
     25814-try
     25815-flush (stream *s)
     25816-{
     25817-  return fd_flush( (unix_stream *) s);
     25818-}
     25819-
     25820 int
     25821 stream_isatty (stream *s)
     25822 {
     25823@@ -2005,12 +1609,6 @@
     25824 #endif
     25825 }
     25826 
     25827-gfc_offset
     25828-stream_offset (stream *s)
     25829-{
     25830-  return (((unix_stream *) s)->logical_offset);
     25831-}
     25832-
     25833 
     25834 /* How files are stored:  This is an operating-system specific issue,
     25835    and therefore belongs here.  There are three cases to consider.
     25836diff -Naur gcc-4.4.0.orig/libgfortran/io/write.c gcc-4.4.0/libgfortran/io/write.c
     25837--- gcc-4.4.0.orig/libgfortran/io/write.c       2009-04-09 16:23:07.000000000 -0700
     25838+++ gcc-4.4.0/libgfortran/io/write.c    2009-05-26 18:21:22.000000000 -0700
     25839@@ -108,7 +108,7 @@
     25840   gfc_char4_t c;
     25841   static const uchar masks[6] =  { 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
     25842   static const uchar limits[6] = { 0x80, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE };
     25843-  size_t nbytes;
     25844+  int nbytes;
     25845   uchar buf[6], d, *q;
     25846 
     25847   /* Take care of preceding blanks.  */
     25848@@ -597,7 +597,7 @@
     25849     n = -n;
     25850   nsign = sign == S_NONE ? 0 : 1;
     25851   
     25852-  /* conv calls gfc_itoa which sets the negative sign needed
     25853+  /* conv calls itoa which sets the negative sign needed
     25854      by write_integer. The sign '+' or '-' is set below based on sign
     25855      calculated above, so we just point past the sign in the string
     25856      before proceeding to avoid double signs in corner cases.
     25857@@ -707,6 +707,48 @@
     25858 }
     25859 
     25860 
     25861+/* gfc_itoa()-- Integer to decimal conversion.
     25862+   The itoa function is a widespread non-standard extension to standard
     25863+   C, often declared in <stdlib.h>.  Even though the itoa defined here
     25864+   is a static function we take care not to conflict with any prior
     25865+   non-static declaration.  Hence the 'gfc_' prefix, which is normally
     25866+   reserved for functions with external linkage.  */
     25867+
     25868+static const char *
     25869+gfc_itoa (GFC_INTEGER_LARGEST n, char *buffer, size_t len)
     25870+{
     25871+  int negative;
     25872+  char *p;
     25873+  GFC_UINTEGER_LARGEST t;
     25874+
     25875+  assert (len >= GFC_ITOA_BUF_SIZE);
     25876+
     25877+  if (n == 0)
     25878+    return "0";
     25879+
     25880+  negative = 0;
     25881+  t = n;
     25882+  if (n < 0)
     25883+    {
     25884+      negative = 1;
     25885+      t = -n; /*must use unsigned to protect from overflow*/
     25886+    }
     25887+
     25888+  p = buffer + GFC_ITOA_BUF_SIZE - 1;
     25889+  *p = '\0';
     25890+
     25891+  while (t != 0)
     25892+    {
     25893+      *--p = '0' + (t % 10);
     25894+      t /= 10;
     25895+    }
     25896+
     25897+  if (negative)
     25898+    *--p = '-';
     25899+  return p;
     25900+}
     25901+
     25902+
     25903 void
     25904 write_i (st_parameter_dt *dtp, const fnode *f, const char *p, int len)
     25905 {
     25906@@ -730,7 +772,7 @@
     25907 void
     25908 write_z (st_parameter_dt *dtp, const fnode *f, const char *p, int len)
     25909 {
     25910-  write_int (dtp, f, p, len, xtoa);
     25911+  write_int (dtp, f, p, len, gfc_xtoa);
     25912 }
     25913 
     25914 
     25915@@ -779,8 +821,7 @@
     25916   p = write_block (dtp, len);
     25917   if (p == NULL)
     25918     return;
     25919-
     25920-  if (nspaces > 0)
     25921+  if (nspaces > 0 && len - nspaces >= 0)
     25922     memset (&p[len - nspaces], ' ', nspaces);
     25923 }
     25924 
     25925@@ -1168,7 +1209,7 @@
     25926          /* Now seek to this record */
     25927          record = record * dtp->u.p.current_unit->recl;
     25928 
     25929-         if (sseek (dtp->u.p.current_unit->s, record) == FAILURE)
     25930+         if (sseek (dtp->u.p.current_unit->s, record, SEEK_SET) < 0)
     25931            {
     25932              generate_error (&dtp->common, LIBERROR_INTERNAL_UNIT, NULL);
     25933              return;
     25934@@ -1189,13 +1230,13 @@
     25935   int rep_ctr;
     25936   int num;
     25937   int nml_carry;
     25938-  index_type len;
     25939+  int len;
     25940   index_type obj_size;
     25941   index_type nelem;
     25942-  index_type dim_i;
     25943-  index_type clen;
     25944+  size_t dim_i;
     25945+  size_t clen;
     25946   index_type elem_ctr;
     25947-  index_type obj_name_len;
     25948+  size_t obj_name_len;
     25949   void * p ;
     25950   char cup;
     25951   char * obj_name;
     25952@@ -1225,14 +1266,16 @@
     25953       len = 0;
     25954       if (base)
     25955        {
     25956-         len =strlen (base->var_name);
     25957-         for (dim_i = 0; dim_i < (index_type) strlen (base_name); dim_i++)
     25958+         len = strlen (base->var_name);
     25959+         base_name_len = strlen (base_name);
     25960+         for (dim_i = 0; dim_i < base_name_len; dim_i++)
     25961             {
     25962              cup = toupper (base_name[dim_i]);
     25963              write_character (dtp, &cup, 1, 1);
     25964             }
     25965        }
     25966-      for (dim_i =len; dim_i < (index_type) strlen (obj->var_name); dim_i++)
     25967+      clen = strlen (obj->var_name);
     25968+      for (dim_i = len; dim_i < clen; dim_i++)
     25969        {
     25970          cup = toupper (obj->var_name[dim_i]);
     25971          write_character (dtp, &cup, 1, 1);
     25972@@ -1271,7 +1314,7 @@
     25973   /* Set the index vector and count the number of elements.  */
     25974 
     25975   nelem = 1;
     25976-  for (dim_i=0; dim_i < obj->var_rank; dim_i++)
     25977+  for (dim_i = 0; dim_i < (size_t) obj->var_rank; dim_i++)
     25978     {
     25979       obj->ls[dim_i].idx = obj->dim[dim_i].lbound;
     25980       nelem = nelem * (obj->dim[dim_i].ubound + 1 - obj->dim[dim_i].lbound);
     25981@@ -1374,7 +1417,7 @@
     25982              /* Append the qualifier.  */
     25983 
     25984              tot_len = base_name_len + clen;
     25985-             for (dim_i = 0; dim_i < obj->var_rank; dim_i++)
     25986+             for (dim_i = 0; dim_i < (size_t) obj->var_rank; dim_i++)
     25987                {
     25988                  if (!dim_i)
     25989                    {
     25990@@ -1383,7 +1426,7 @@
     25991                    }
     25992                  sprintf (ext_name + tot_len, "%d", (int) obj->ls[dim_i].idx);
     25993                  tot_len += strlen (ext_name + tot_len);
     25994-                 ext_name[tot_len] = (dim_i == obj->var_rank - 1) ? ')' : ',';
     25995+                 ext_name[tot_len] = ((int) dim_i == obj->var_rank - 1) ? ')' : ',';
     25996                  tot_len++;
     25997                }
     25998 
     25999@@ -1437,11 +1480,11 @@
     26000 obj_loop:
     26001 
     26002     nml_carry = 1;
     26003-    for (dim_i = 0; nml_carry && (dim_i < obj->var_rank); dim_i++)
     26004+    for (dim_i = 0; nml_carry && (dim_i < (size_t) obj->var_rank); dim_i++)
     26005       {
     26006        obj->ls[dim_i].idx += nml_carry ;
     26007        nml_carry = 0;
     26008-       if (obj->ls[dim_i].idx  > (ssize_t)obj->dim[dim_i].ubound)
     26009+       if (obj->ls[dim_i].idx  > (index_type) obj->dim[dim_i].ubound)
     26010          {
     26011            obj->ls[dim_i].idx = obj->dim[dim_i].lbound;
     26012            nml_carry = 1;
     26013diff -Naur gcc-4.4.0.orig/libgfortran/io/write_float.def gcc-4.4.0/libgfortran/io/write_float.def
     26014--- gcc-4.4.0.orig/libgfortran/io/write_float.def       2009-04-09 16:23:07.000000000 -0700
     26015+++ gcc-4.4.0/libgfortran/io/write_float.def    2009-05-26 18:21:22.000000000 -0700
     26016@@ -603,7 +603,7 @@
     26017   int d = f->u.real.d;\
     26018   int w = f->u.real.w;\
     26019   fnode *newf;\
     26020-  GFC_REAL_ ## x exp_d;\
     26021+  GFC_REAL_ ## x rexp_d;\
     26022   int low, high, mid;\
     26023   int ubound, lbound;\
     26024   char *p;\
     26025@@ -612,8 +612,8 @@
     26026   save_scale_factor = dtp->u.p.scale_factor;\
     26027   newf = (fnode *) get_mem (sizeof (fnode));\
     26028 \
     26029-  exp_d = calculate_exp_ ## x (d);\
     26030-  if ((m > 0.0 && m < 0.1 - 0.05 / exp_d) || (m >= exp_d - 0.5 ) ||\
     26031+  rexp_d = calculate_exp_ ## x (-d);\
     26032+  if ((m > 0.0 && m < 0.1 - 0.05 * rexp_d) || (rexp_d * (m + 0.5) >= 1.0) ||\
     26033       ((m == 0.0) && !(compile_options.allow_std & GFC_STD_F2003)))\
     26034     { \
     26035       newf->format = FMT_E;\
     26036@@ -635,8 +635,7 @@
     26037       GFC_REAL_ ## x temp;\
     26038       mid = (low + high) / 2;\
     26039 \
     26040-      temp = (calculate_exp_ ## x (mid) - \
     26041-             5 * calculate_exp_ ## x (mid - d - 1)) / 10;\
     26042+      temp = (calculate_exp_ ## x (mid - 1) * (1 - 0.5 * rexp_d));\
     26043 \
     26044       if (m < temp)\
     26045         { \
     26046diff -Naur gcc-4.4.0.orig/libgfortran/libgfortran.h gcc-4.4.0/libgfortran/libgfortran.h
     26047--- gcc-4.4.0.orig/libgfortran/libgfortran.h    2009-04-09 16:23:07.000000000 -0700
     26048+++ gcc-4.4.0/libgfortran/libgfortran.h 2009-05-26 18:21:22.000000000 -0700
     26049@@ -631,11 +631,8 @@
     26050 extern void sys_exit (int) __attribute__ ((noreturn));
     26051 internal_proto(sys_exit);
     26052 
     26053-extern const char *gfc_itoa (GFC_INTEGER_LARGEST, char *, size_t);
     26054-internal_proto(gfc_itoa);
     26055-
     26056-extern const char *xtoa (GFC_UINTEGER_LARGEST, char *, size_t);
     26057-internal_proto(xtoa);
     26058+extern const char *gfc_xtoa (GFC_UINTEGER_LARGEST, char *, size_t);
     26059+internal_proto(gfc_xtoa);
     26060 
     26061 extern void os_error (const char *) __attribute__ ((noreturn));
     26062 iexport_proto(os_error);
     26063diff -Naur gcc-4.4.0.orig/libgfortran/Makefile.am gcc-4.4.0/libgfortran/Makefile.am
     26064--- gcc-4.4.0.orig/libgfortran/Makefile.am      2008-08-14 11:31:32.000000000 -0700
     26065+++ gcc-4.4.0/libgfortran/Makefile.am   2009-06-03 12:39:09.000000000 -0700
     26066@@ -58,6 +58,7 @@
     26067 intrinsics/abort.c \
     26068 intrinsics/access.c \
     26069 intrinsics/args.c \
     26070+intrinsics/bit_intrinsics.c \
     26071 intrinsics/c99_functions.c \
     26072 intrinsics/chdir.c \
     26073 intrinsics/chmod.c \
     26074diff -Naur gcc-4.4.0.orig/libgfortran/Makefile.in gcc-4.4.0/libgfortran/Makefile.in
     26075--- gcc-4.4.0.orig/libgfortran/Makefile.in      2009-04-21 02:08:08.000000000 -0700
     26076+++ gcc-4.4.0/libgfortran/Makefile.in   2009-06-03 12:39:09.000000000 -0700
     26077@@ -416,9 +416,9 @@
     26078        io/size_from_kind.c io/transfer.c io/unit.c io/unix.c \
     26079        io/write.c io/fbuf.c intrinsics/associated.c \
     26080        intrinsics/abort.c intrinsics/access.c intrinsics/args.c \
     26081-       intrinsics/c99_functions.c intrinsics/chdir.c \
     26082-       intrinsics/chmod.c intrinsics/clock.c intrinsics/cpu_time.c \
     26083-       intrinsics/cshift0.c intrinsics/ctime.c \
     26084+       intrinsics/bit_intrinsics.c intrinsics/c99_functions.c \
     26085+       intrinsics/chdir.c intrinsics/chmod.c intrinsics/clock.c \
     26086+       intrinsics/cpu_time.c intrinsics/cshift0.c intrinsics/ctime.c \
     26087        intrinsics/date_and_time.c intrinsics/dtime.c intrinsics/env.c \
     26088        intrinsics/eoshift0.c intrinsics/eoshift2.c \
     26089        intrinsics/erfc_scaled.c intrinsics/etime.c intrinsics/exit.c \
     26090@@ -711,9 +711,9 @@
     26091        intrinsics.lo list_read.lo lock.lo open.lo read.lo \
     26092        size_from_kind.lo transfer.lo unit.lo unix.lo write.lo fbuf.lo
     26093 am__objects_36 = associated.lo abort.lo access.lo args.lo \
     26094-       c99_functions.lo chdir.lo chmod.lo clock.lo cpu_time.lo \
     26095-       cshift0.lo ctime.lo date_and_time.lo dtime.lo env.lo \
     26096-       eoshift0.lo eoshift2.lo erfc_scaled.lo etime.lo exit.lo \
     26097+       bit_intrinsics.lo c99_functions.lo chdir.lo chmod.lo clock.lo \
     26098+       cpu_time.lo cshift0.lo ctime.lo date_and_time.lo dtime.lo \
     26099+       env.lo eoshift0.lo eoshift2.lo erfc_scaled.lo etime.lo exit.lo \
     26100        fnum.lo gerror.lo getcwd.lo getlog.lo getXid.lo hostnm.lo \
     26101        ierrno.lo ishftc.lo iso_c_generated_procs.lo iso_c_binding.lo \
     26102        kill.lo link.lo malloc.lo mvbits.lo move_alloc.lo \
     26103@@ -987,6 +987,7 @@
     26104 intrinsics/abort.c \
     26105 intrinsics/access.c \
     26106 intrinsics/args.c \
     26107+intrinsics/bit_intrinsics.c \
     26108 intrinsics/c99_functions.c \
     26109 intrinsics/chdir.c \
     26110 intrinsics/chmod.c \
     26111@@ -1801,6 +1802,7 @@
     26112 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/args.Plo@am__quote@
     26113 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/associated.Plo@am__quote@
     26114 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/backtrace.Plo@am__quote@
     26115+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bit_intrinsics.Plo@am__quote@
     26116 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c99_functions.Plo@am__quote@
     26117 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chdir.Plo@am__quote@
     26118 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chmod.Plo@am__quote@
     26119@@ -5319,6 +5321,13 @@
     26120 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     26121 @am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o args.lo `test -f 'intrinsics/args.c' || echo '$(srcdir)/'`intrinsics/args.c
     26122 
     26123+bit_intrinsics.lo: intrinsics/bit_intrinsics.c
     26124+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bit_intrinsics.lo -MD -MP -MF "$(DEPDIR)/bit_intrinsics.Tpo" -c -o bit_intrinsics.lo `test -f 'intrinsics/bit_intrinsics.c' || echo '$(srcdir)/'`intrinsics/bit_intrinsics.c; \
     26125+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/bit_intrinsics.Tpo" "$(DEPDIR)/bit_intrinsics.Plo"; else rm -f "$(DEPDIR)/bit_intrinsics.Tpo"; exit 1; fi
     26126+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='intrinsics/bit_intrinsics.c' object='bit_intrinsics.lo' libtool=yes @AMDEPBACKSLASH@
     26127+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     26128+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bit_intrinsics.lo `test -f 'intrinsics/bit_intrinsics.c' || echo '$(srcdir)/'`intrinsics/bit_intrinsics.c
     26129+
     26130 c99_functions.lo: intrinsics/c99_functions.c
     26131 @am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT c99_functions.lo -MD -MP -MF "$(DEPDIR)/c99_functions.Tpo" -c -o c99_functions.lo `test -f 'intrinsics/c99_functions.c' || echo '$(srcdir)/'`intrinsics/c99_functions.c; \
     26132 @am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/c99_functions.Tpo" "$(DEPDIR)/c99_functions.Plo"; else rm -f "$(DEPDIR)/c99_functions.Tpo"; exit 1; fi
     26133diff -Naur gcc-4.4.0.orig/libgfortran/runtime/backtrace.c gcc-4.4.0/libgfortran/runtime/backtrace.c
     26134--- gcc-4.4.0.orig/libgfortran/runtime/backtrace.c      2009-04-09 16:23:07.000000000 -0700
     26135+++ gcc-4.4.0/libgfortran/runtime/backtrace.c   2009-05-26 18:21:22.000000000 -0700
     26136@@ -147,7 +147,7 @@
     26137 
     26138     /* Write the list of addresses in hexadecimal format.  */
     26139     for (i = 0; i < depth; i++)
     26140-      addr[i] = xtoa ((GFC_UINTEGER_LARGEST) (intptr_t) trace[i], addr_buf[i],
     26141+      addr[i] = gfc_xtoa ((GFC_UINTEGER_LARGEST) (intptr_t) trace[i], addr_buf[i],
     26142                      sizeof (addr_buf[i]));
     26143 
     26144     /* Don't output an error message if something goes wrong, we'll simply
     26145diff -Naur gcc-4.4.0.orig/libgfortran/runtime/error.c gcc-4.4.0/libgfortran/runtime/error.c
     26146--- gcc-4.4.0.orig/libgfortran/runtime/error.c  2009-04-09 16:23:07.000000000 -0700
     26147+++ gcc-4.4.0/libgfortran/runtime/error.c       2009-05-26 18:21:22.000000000 -0700
     26148@@ -112,47 +112,10 @@
     26149  * Other error returns are reserved for the STOP statement with a numeric code.
     26150  */
     26151 
     26152-/* gfc_itoa()-- Integer to decimal conversion. */
     26153+/* gfc_xtoa()-- Integer to hexadecimal conversion.  */
     26154 
     26155 const char *
     26156-gfc_itoa (GFC_INTEGER_LARGEST n, char *buffer, size_t len)
     26157-{
     26158-  int negative;
     26159-  char *p;
     26160-  GFC_UINTEGER_LARGEST t;
     26161-
     26162-  assert (len >= GFC_ITOA_BUF_SIZE);
     26163-
     26164-  if (n == 0)
     26165-    return "0";
     26166-
     26167-  negative = 0;
     26168-  t = n;
     26169-  if (n < 0)
     26170-    {
     26171-      negative = 1;
     26172-      t = -n; /*must use unsigned to protect from overflow*/
     26173-    }
     26174-
     26175-  p = buffer + GFC_ITOA_BUF_SIZE - 1;
     26176-  *p = '\0';
     26177-
     26178-  while (t != 0)
     26179-    {
     26180-      *--p = '0' + (t % 10);
     26181-      t /= 10;
     26182-    }
     26183-
     26184-  if (negative)
     26185-    *--p = '-';
     26186-  return p;
     26187-}
     26188-
     26189-
     26190-/* xtoa()-- Integer to hexadecimal conversion.  */
     26191-
     26192-const char *
     26193-xtoa (GFC_UINTEGER_LARGEST n, char *buffer, size_t len)
     26194+gfc_xtoa (GFC_UINTEGER_LARGEST n, char *buffer, size_t len)
     26195 {
     26196   int digit;
     26197   char *p;
     26198diff -Naur gcc-4.4.0.orig/libgomp/team.c gcc-4.4.0/libgomp/team.c
     26199--- gcc-4.4.0.orig/libgomp/team.c       2009-04-09 16:23:07.000000000 -0700
     26200+++ gcc-4.4.0/libgomp/team.c    2009-05-20 13:55:25.000000000 -0700
     26201@@ -125,6 +125,7 @@
     26202       while (local_fn);
     26203     }
     26204 
     26205+  gomp_sem_destroy (&thr->release);
     26206   return NULL;
     26207 }
     26208 
     26209@@ -201,6 +202,7 @@
     26210   struct gomp_thread_pool *pool
     26211     = (struct gomp_thread_pool *) thread_pool;
     26212   gomp_barrier_wait_last (&pool->threads_dock);
     26213+  gomp_sem_destroy (&gomp_thread ()->release);
     26214   pthread_exit (NULL);
     26215 }
     26216 
    1501126217diff -Naur gcc-4.4.0.orig/libjava/configure gcc-4.4.0/libjava/configure
    1501226218--- gcc-4.4.0.orig/libjava/configure    2009-04-21 02:08:08.000000000 -0700
     
    1522226428diff -Naur gcc-4.4.0.orig/libjava/Makefile.am gcc-4.4.0/libjava/Makefile.am
    1522326429--- gcc-4.4.0.orig/libjava/Makefile.am  2009-03-03 09:03:51.000000000 -0800
    15224 +++ gcc-4.4.0/libjava/Makefile.am       2009-04-28 05:51:10.000000000 -0700
     26430+++ gcc-4.4.0/libjava/Makefile.am       2009-05-11 01:21:39.000000000 -0700
    1522526431@@ -305,8 +305,15 @@
    1522626432 ## compiled.
     
    1524026446  -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
    1524126447  $(LIBGCJ_LD_SYMBOLIC_FUNCTIONS)
    15242 @@ -578,6 +585,8 @@
    15243         RELATIVE=$$(relative $(DESTDIR)$(bindir) $(DESTDIR)$(SDK_BIN_DIR)); \
    15244         ln -sf $$RELATIVE/`echo gij | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
    15245           $(DESTDIR)$(SDK_BIN_DIR)/java; \
    15246 +       ln -sf $$RELATIVE/`echo gcj | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
    15247 +         $(DESTDIR)$(SDK_BIN_DIR)/javac; \
    15248         ln -sf $$RELATIVE/`echo gjar | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
    15249           $(DESTDIR)$(SDK_BIN_DIR)/jar; \
    15250         ln -sf $$RELATIVE/`echo gjdoc | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
     26448@@ -667,7 +674,7 @@
     26449        ln -sf $$RELATIVE/libgcj-tools-$(gcc_version).jar \
     26450          $(DESTDIR)$(SDK_LIB_DIR)/tools.jar; \
     26451        for headername in jawt jni; do \
     26452-         DIRECTORY=$$(dirname $$($(DESTDIR)$(bindir)/gcj \
     26453+         DIRECTORY=$$(dirname $$($(DESTDIR)$(bindir)/`echo gcj | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
     26454            -print-file-name=include/$$headername.h)); \
     26455          RELATIVE=$$(relative $$DIRECTORY \
     26456            $(DESTDIR)$(SDK_INCLUDE_DIR)); \
     26457@@ -675,7 +682,7 @@
     26458            $(DESTDIR)$(SDK_INCLUDE_DIR)/$$headername.h; \
     26459        done; \
     26460        for headername in jawt_md jni_md; do \
     26461-         DIRECTORY=$$(dirname $$($(DESTDIR)$(bindir)/gcj \
     26462+         DIRECTORY=$$(dirname $$($(DESTDIR)$(bindir)/`echo gcj | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
     26463            -print-file-name=include/$$headername.h)); \
     26464          RELATIVE=$$(relative $$DIRECTORY \
     26465            $(DESTDIR)$(SDK_INCLUDE_DIR)/linux); \
    1525126466diff -Naur gcc-4.4.0.orig/libjava/Makefile.in gcc-4.4.0/libjava/Makefile.in
    1525226467--- gcc-4.4.0.orig/libjava/Makefile.in  2009-04-21 02:08:08.000000000 -0700
    15253 +++ gcc-4.4.0/libjava/Makefile.in       2009-04-28 05:51:10.000000000 -0700
     26468+++ gcc-4.4.0/libjava/Makefile.in       2009-05-11 01:21:39.000000000 -0700
    1525426469@@ -72,6 +72,7 @@
    1525526470        $(top_srcdir)/contrib/aot-compile-rpm.in \
     
    1530226517        cd $(top_builddir) && $(SHELL) ./config.status $@
    1530326518 scripts/jar: $(top_builddir)/config.status $(top_srcdir)/scripts/jar.in
    15304 @@ -12425,6 +12438,8 @@
    15305  @CREATE_JAVA_HOME_TRUE@        RELATIVE=$$(relative $(DESTDIR)$(bindir) $(DESTDIR)$(SDK_BIN_DIR)); \
    15306  @CREATE_JAVA_HOME_TRUE@        ln -sf $$RELATIVE/`echo gij | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
    15307  @CREATE_JAVA_HOME_TRUE@          $(DESTDIR)$(SDK_BIN_DIR)/java; \
    15308 +@CREATE_JAVA_HOME_TRUE@        ln -sf $$RELATIVE/`echo gcj | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
    15309 +@CREATE_JAVA_HOME_TRUE@          $(DESTDIR)$(SDK_BIN_DIR)/javac; \
    15310  @CREATE_JAVA_HOME_TRUE@        ln -sf $$RELATIVE/`echo gjar | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
    15311  @CREATE_JAVA_HOME_TRUE@          $(DESTDIR)$(SDK_BIN_DIR)/jar; \
    15312  @CREATE_JAVA_HOME_TRUE@        ln -sf $$RELATIVE/`echo gjdoc | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
    15313 diff -Naur gcc-4.4.0.orig/libstdc++-v3/ChangeLog gcc-4.4.0/libstdc++-v3/ChangeLog
    15314 --- gcc-4.4.0.orig/libstdc++-v3/ChangeLog       2009-04-21 01:46:37.000000000 -0700
    15315 +++ gcc-4.4.0/libstdc++-v3/ChangeLog    2009-04-29 12:37:30.000000000 -0700
    15316 @@ -1,3 +1,71 @@
    15317 +2009-04-29  Benjamin Kosnik  <bkoz@redhat.com>
    15318 +
    15319 +        * xml/authors.xml: Add space.
    15320 +        * xml/faq.xml: Update links.
    15321 +        * xml/manual/intro.xml: Same.
    15322 +        * xml/manual/abi.xml: Update.
    15323 +        * xml/manual/appendix_contributing.xml: Fix typo.
    15324 +        * xml/manual/status_cxxtr1.xml: Update links.
    15325 +        * xml/manual/status_cxx1998.xml: Same.
    15326 +        * xml/manual/status_cxx200x.xml: Same.
    15327 +
    15328 +2009-04-28  Benjamin Kosnik  <bkoz@redhat.com>
    15329 +
    15330 +        PR libstdc++/39868
    15331 +        * scripts/run_doxygen: Uncomment removal of includes.
    15332 +        (problematic): Rewrite __cxxabiv1 namespace to abi.
    15333 +
    15334 +2009-04-28  Paolo Carlini  <paolo.carlini@oracle.com>
    15335 +
    15336 +       PR libstdc++/39880
    15337 +       PR libstdc++/39881
    15338 +       PR libstdc++/39882
    15339 +       * include/std/system_error (is_error_code_enum<errc>): Remove.
    15340 +       (error_condition<>::error_condition(_ErrorCodeEnum,)
    15341 +       error_condition<>::operator=(_ErrorCodeEnum)): Use make_error_condition.
    15342 +       (error_code<>::error_code(_ErrorCodeEnum,),
    15343 +       error_code<>::operator=(_ErrorCodeEnum)): Use make_error_code.
    15344 +       * testsuite/19_diagnostics/system_error/39880.cc: New.
    15345 +       * testsuite/19_diagnostics/error_condition/modifiers/39881.cc:
    15346 +       Likewise.
    15347 +       * testsuite/19_diagnostics/error_condition/cons/39881.cc: Likewise.
    15348 +       * testsuite/19_diagnostics/error_code/modifiers/39882.cc: Likewise.
    15349 +       * testsuite/19_diagnostics/error_code/cons/39882.cc: Likewise.
    15350 +       * testsuite/27_io/basic_ostream/inserters_other/char/error_code.cc:
    15351 +       Adjust.
    15352 +       * testsuite/27_io/basic_ostream/inserters_other/wchar_t/error_code.cc:
    15353 +       Likewise.
    15354 +       * testsuite/19_diagnostics/error_code/cons/1.cc: Likewise.
    15355 +       * testsuite/19_diagnostics/error_code/operators/bool.cc: Likewise.
    15356 +       * testsuite/19_diagnostics/error_code/operators/equal.cc: Likewise.
    15357 +       * testsuite/19_diagnostics/error_code/operators/not_equal.cc:
    15358 +       Likewise.
    15359 +       * testsuite/19_diagnostics/error_category/cons/copy_neg.cc: Likewise.
    15360 +       * testsuite/19_diagnostics/system_error/cons-1.cc: Likewise.
    15361 +       * testsuite/19_diagnostics/system_error/what-4.cc: Likewise.
    15362 +       * testsuite/30_threads/unique_lock/locking/2.cc: Likewise.
    15363 +
    15364 +2009-04-26  Paolo Carlini  <paolo.carlini@oracle.com>
    15365 +
    15366 +       Revert the last commit.
    15367 +
    15368 +2009-04-25  Jonathan Wakely  <jwakely.gcc@gmail.com>
    15369 +
    15370 +       * include/std/mutex (__get_once_functor_lock, __get_once_mutex):
    15371 +       Replace global lock object with local locks on global mutex.
    15372 +       * src/mutex.cc: Likewise.
    15373 +       * config/abi/pre/gnu.ver: Adjust.
    15374 +       * testsuite/30_threads/call_once/call_once2.cc: New.
    15375 +
    15376 +2009-04-21  Paolo Carlini  <paolo.carlini@oracle.com>
    15377 +
    15378 +       PR libstdc++/39802
    15379 +       * include/bits/locale_facets.tcc (num_get<>::_M_extract_int
    15380 +       (_InIter, _InIter, ios_base&, ios_base::iostate&, _ValueT&)):
    15381 +       Always accept negative values, for unsigned types too.
    15382 +       * testsuite/22_locale/num_get/get/char/39802.cc: New.
    15383 +       * testsuite/22_locale/num_get/get/wchar_t/39802.cc: Likewise.
    15384 +
    15385  2009-04-21  Release Manager
    15386  
    15387         * GCC 4.4.0 released.
     26519@@ -12514,7 +12527,7 @@
     26520 @CREATE_JAVA_HOME_TRUE@        ln -sf $$RELATIVE/libgcj-tools-$(gcc_version).jar \
     26521 @CREATE_JAVA_HOME_TRUE@          $(DESTDIR)$(SDK_LIB_DIR)/tools.jar; \
     26522 @CREATE_JAVA_HOME_TRUE@        for headername in jawt jni; do \
     26523-@CREATE_JAVA_HOME_TRUE@          DIRECTORY=$$(dirname $$($(DESTDIR)$(bindir)/gcj \
     26524+@CREATE_JAVA_HOME_TRUE@          DIRECTORY=$$(dirname $$($(DESTDIR)$(bindir)/`echo gcj | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
     26525 @CREATE_JAVA_HOME_TRUE@            -print-file-name=include/$$headername.h)); \
     26526 @CREATE_JAVA_HOME_TRUE@          RELATIVE=$$(relative $$DIRECTORY \
     26527 @CREATE_JAVA_HOME_TRUE@            $(DESTDIR)$(SDK_INCLUDE_DIR)); \
     26528@@ -12522,7 +12535,7 @@
     26529 @CREATE_JAVA_HOME_TRUE@            $(DESTDIR)$(SDK_INCLUDE_DIR)/$$headername.h; \
     26530 @CREATE_JAVA_HOME_TRUE@        done; \
     26531 @CREATE_JAVA_HOME_TRUE@        for headername in jawt_md jni_md; do \
     26532-@CREATE_JAVA_HOME_TRUE@          DIRECTORY=$$(dirname $$($(DESTDIR)$(bindir)/gcj \
     26533+@CREATE_JAVA_HOME_TRUE@          DIRECTORY=$$(dirname $$($(DESTDIR)$(bindir)/`echo gcj | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` \
     26534 @CREATE_JAVA_HOME_TRUE@            -print-file-name=include/$$headername.h)); \
     26535 @CREATE_JAVA_HOME_TRUE@          RELATIVE=$$(relative $$DIRECTORY \
     26536 @CREATE_JAVA_HOME_TRUE@            $(DESTDIR)$(SDK_INCLUDE_DIR)/linux); \
     26537diff -Naur gcc-4.4.0.orig/libstdc++-v3/config/abi/pre/gnu.ver gcc-4.4.0/libstdc++-v3/config/abi/pre/gnu.ver
     26538--- gcc-4.4.0.orig/libstdc++-v3/config/abi/pre/gnu.ver  2009-04-09 16:23:07.000000000 -0700
     26539+++ gcc-4.4.0/libstdc++-v3/config/abi/pre/gnu.ver       2009-05-05 14:44:27.000000000 -0700
     26540@@ -958,6 +958,14 @@
     26541 
     26542 } GLIBCXX_3.4.10;
     26543 
     26544+GLIBCXX_3.4.12 {
     26545+
     26546+    # mutex
     26547+    _ZSt27__set_once_functor_lock_ptrPSt11unique_lockISt5mutexE;
     26548+    _ZSt16__get_once_mutexv;
     26549+
     26550+} GLIBCXX_3.4.11;
     26551+
     26552 # Symbols in the support library (libsupc++) have their own tag.
     26553 CXXABI_1.3 {
     26554 
     26555diff -Naur gcc-4.4.0.orig/libstdc++-v3/configure gcc-4.4.0/libstdc++-v3/configure
     26556--- gcc-4.4.0.orig/libstdc++-v3/configure       2009-03-01 09:49:31.000000000 -0800
     26557+++ gcc-4.4.0/libstdc++-v3/configure    2009-05-07 03:23:06.000000000 -0700
     26558@@ -1567,7 +1567,7 @@
     26559 ### am handles this now?  ORIGINAL_LD_FOR_MULTILIBS=$LD
     26560 
     26561 # For libtool versioning info, format is CURRENT:REVISION:AGE
     26562-libtool_VERSION=6:11:0
     26563+libtool_VERSION=6:12:0
     26564 
     26565 
     26566 # Find the rest of the source tree framework.
     26567diff -Naur gcc-4.4.0.orig/libstdc++-v3/configure.ac gcc-4.4.0/libstdc++-v3/configure.ac
     26568--- gcc-4.4.0.orig/libstdc++-v3/configure.ac    2009-01-15 12:02:11.000000000 -0800
     26569+++ gcc-4.4.0/libstdc++-v3/configure.ac 2009-05-07 03:23:06.000000000 -0700
     26570@@ -12,7 +12,7 @@
     26571 ### am handles this now?  ORIGINAL_LD_FOR_MULTILIBS=$LD
     26572 
     26573 # For libtool versioning info, format is CURRENT:REVISION:AGE
     26574-libtool_VERSION=6:11:0
     26575+libtool_VERSION=6:12:0
     26576 AC_SUBST(libtool_VERSION)
     26577 
     26578 # Find the rest of the source tree framework.
    1538826579diff -Naur gcc-4.4.0.orig/libstdc++-v3/doc/xml/authors.xml gcc-4.4.0/libstdc++-v3/doc/xml/authors.xml
    1538926580--- gcc-4.4.0.orig/libstdc++-v3/doc/xml/authors.xml     2008-04-10 15:14:17.000000000 -0700
     
    1558026771            else
    1558126772              __v = __gnu_cxx::__numeric_traits<_ValueT>::__max;
     26773diff -Naur gcc-4.4.0.orig/libstdc++-v3/include/bits/stl_construct.h gcc-4.4.0/libstdc++-v3/include/bits/stl_construct.h
     26774--- gcc-4.4.0.orig/libstdc++-v3/include/bits/stl_construct.h    2009-04-09 16:23:07.000000000 -0700
     26775+++ gcc-4.4.0/libstdc++-v3/include/bits/stl_construct.h 2009-05-18 16:16:48.000000000 -0700
     26776@@ -82,6 +82,26 @@
     26777     _Destroy(_Tp* __pointer)
     26778     { __pointer->~_Tp(); }
     26779 
     26780+  template<bool>
     26781+    struct _Destroy_aux
     26782+    {
     26783+      template<typename _ForwardIterator>
     26784+        static void
     26785+        __destroy(_ForwardIterator __first, _ForwardIterator __last)
     26786+       {
     26787+         for (; __first != __last; ++__first)
     26788+           std::_Destroy(&*__first);
     26789+       }
     26790+    };
     26791+
     26792+  template<>
     26793+    struct _Destroy_aux<true>
     26794+    {
     26795+      template<typename _ForwardIterator>
     26796+        static void
     26797+        __destroy(_ForwardIterator, _ForwardIterator) { }
     26798+    };
     26799+
     26800   /**
     26801    * Destroy a range of objects.  If the value_type of the object has
     26802    * a trivial destructor, the compiler should optimize all of this
     26803@@ -93,9 +113,8 @@
     26804     {
     26805       typedef typename iterator_traits<_ForwardIterator>::value_type
     26806                        _Value_type;
     26807-      if (!__has_trivial_destructor(_Value_type))
     26808-       for (; __first != __last; ++__first)
     26809-         std::_Destroy(&*__first);
     26810+      std::_Destroy_aux<__has_trivial_destructor(_Value_type)>::
     26811+       __destroy(__first, __last);
     26812     }
     26813 
     26814   /**
     26815diff -Naur gcc-4.4.0.orig/libstdc++-v3/include/ext/memory gcc-4.4.0/libstdc++-v3/include/ext/memory
     26816--- gcc-4.4.0.orig/libstdc++-v3/include/ext/memory      2009-04-09 16:23:07.000000000 -0700
     26817+++ gcc-4.4.0/libstdc++-v3/include/ext/memory   2009-06-02 02:06:45.000000000 -0700
     26818@@ -102,9 +102,9 @@
     26819   template<typename _InputIter, typename _Size, typename _ForwardIter>
     26820     inline pair<_InputIter, _ForwardIter>
     26821     __uninitialized_copy_n(_InputIter __first, _Size __count,
     26822-                        _ForwardIter __result)
     26823-    { return __uninitialized_copy_n(__first, __count, __result,
     26824-                                   __iterator_category(__first)); }
     26825+                          _ForwardIter __result)
     26826+    { return __gnu_cxx::__uninitialized_copy_n(__first, __count, __result,
     26827+                                              __iterator_category(__first)); }
     26828 
     26829   /**
     26830    *  @brief Copies the range [first,last) into result.
     26831@@ -120,8 +120,8 @@
     26832     inline pair<_InputIter, _ForwardIter>
     26833     uninitialized_copy_n(_InputIter __first, _Size __count,
     26834                         _ForwardIter __result)
     26835-    { return __uninitialized_copy_n(__first, __count, __result,
     26836-                                   __iterator_category(__first)); }
     26837+    { return __gnu_cxx::__uninitialized_copy_n(__first, __count, __result,
     26838+                                              __iterator_category(__first)); }
     26839 
     26840 
     26841   // An alternative version of uninitialized_copy_n that constructs
     26842@@ -154,7 +154,7 @@
     26843                             _ForwardIter __result,
     26844                             std::allocator<_Tp>)
     26845     {
     26846-      return uninitialized_copy_n(__first, __count, __result);
     26847+      return __gnu_cxx::uninitialized_copy_n(__first, __count, __result);
     26848     }
     26849 
     26850   /**
     26851diff -Naur gcc-4.4.0.orig/libstdc++-v3/include/Makefile.am gcc-4.4.0/libstdc++-v3/include/Makefile.am
     26852--- gcc-4.4.0.orig/libstdc++-v3/include/Makefile.am     2009-04-09 16:23:07.000000000 -0700
     26853+++ gcc-4.4.0/libstdc++-v3/include/Makefile.am  2009-05-12 17:24:16.000000000 -0700
     26854@@ -850,7 +850,7 @@
     26855        ${pch1_output_builddir} ${pch2_output_builddir} ${pch3_output_builddir}
     26856 pch_output_anchors = \
     26857        ${pch1_output_anchor} ${pch2_output_anchor} ${pch3_output_anchor}
     26858-PCHFLAGS=-Winvalid-pch -x c++-header $(CXXFLAGS)
     26859+PCHFLAGS=-x c++-header $(CXXFLAGS)
     26860 if GLIBCXX_BUILD_PCH
     26861 pch_build = ${pch_output}
     26862 else
     26863diff -Naur gcc-4.4.0.orig/libstdc++-v3/include/Makefile.in gcc-4.4.0/libstdc++-v3/include/Makefile.in
     26864--- gcc-4.4.0.orig/libstdc++-v3/include/Makefile.in     2009-01-15 12:02:11.000000000 -0800
     26865+++ gcc-4.4.0/libstdc++-v3/include/Makefile.in  2009-05-12 17:24:16.000000000 -0700
     26866@@ -1096,7 +1096,7 @@
     26867 pch_output_anchors = \
     26868        ${pch1_output_anchor} ${pch2_output_anchor} ${pch3_output_anchor}
     26869 
     26870-PCHFLAGS = -Winvalid-pch -x c++-header $(CXXFLAGS)
     26871+PCHFLAGS = -x c++-header $(CXXFLAGS)
     26872 @GLIBCXX_BUILD_PCH_FALSE@pch_build =
     26873 @GLIBCXX_BUILD_PCH_TRUE@pch_build = ${pch_output}
     26874 
     26875diff -Naur gcc-4.4.0.orig/libstdc++-v3/include/parallel/algo.h gcc-4.4.0/libstdc++-v3/include/parallel/algo.h
     26876--- gcc-4.4.0.orig/libstdc++-v3/include/parallel/algo.h 2009-04-09 16:23:07.000000000 -0700
     26877+++ gcc-4.4.0/libstdc++-v3/include/parallel/algo.h      2009-05-12 07:57:35.000000000 -0700
     26878@@ -149,8 +149,8 @@
     26879 
     26880       if (_GLIBCXX_PARALLEL_CONDITION(true))
     26881         {
     26882-          binder2nd<__gnu_parallel::equal_to<value_type, T> >
     26883-            comp(__gnu_parallel::equal_to<value_type, T>(), val);
     26884+          binder2nd<__gnu_parallel::equal_to<value_type, const T&> >
     26885+            comp(__gnu_parallel::equal_to<value_type, const T&>(), val);
     26886           return __gnu_parallel::find_template(begin, end, begin, comp,
     26887                                                __gnu_parallel::
     26888                                                find_if_selector()).first;
     26889diff -Naur gcc-4.4.0.orig/libstdc++-v3/include/std/mutex gcc-4.4.0/libstdc++-v3/include/std/mutex
     26890--- gcc-4.4.0.orig/libstdc++-v3/include/std/mutex       2009-04-09 16:23:07.000000000 -0700
     26891+++ gcc-4.4.0/libstdc++-v3/include/std/mutex    2009-05-05 14:44:27.000000000 -0700
     26892@@ -729,8 +729,11 @@
     26893 #else
     26894   extern function<void()> __once_functor;
     26895 
     26896-  extern unique_lock<mutex>&
     26897-  __get_once_functor_lock();
     26898+  extern void
     26899+  __set_once_functor_lock_ptr(unique_lock<mutex>*);
     26900+
     26901+  extern mutex&
     26902+  __get_once_mutex();
     26903 #endif
     26904 
     26905   extern "C" void __once_proxy();
     26906@@ -745,16 +748,16 @@
     26907       __once_callable = &__bound_functor;
     26908       __once_call = &__once_call_impl<decltype(__bound_functor)>;
     26909 #else
     26910-      unique_lock<mutex>& __functor_lock = __get_once_functor_lock();
     26911-      __functor_lock.lock();
     26912+      unique_lock<mutex> __functor_lock(__get_once_mutex());
     26913       __once_functor = bind(__f, __args...);
     26914+      __set_once_functor_lock_ptr(&__functor_lock);
     26915 #endif
     26916 
     26917       int __e = __gthread_once(&(__once._M_once), &__once_proxy);
     26918 
     26919 #ifndef _GLIBCXX_HAVE_TLS
     26920       if (__functor_lock)
     26921-       __functor_lock.unlock();
     26922+        __set_once_functor_lock_ptr(0);
     26923 #endif
     26924 
     26925       if (__e)
    1558226926diff -Naur gcc-4.4.0.orig/libstdc++-v3/include/std/system_error gcc-4.4.0/libstdc++-v3/include/std/system_error
    1558326927--- gcc-4.4.0.orig/libstdc++-v3/include/std/system_error        2009-04-09 16:23:07.000000000 -0700
     
    1566927013     void
    1567027014     clear()
     27015diff -Naur gcc-4.4.0.orig/libstdc++-v3/libsupc++/eh_ptr.cc gcc-4.4.0/libstdc++-v3/libsupc++/eh_ptr.cc
     27016--- gcc-4.4.0.orig/libstdc++-v3/libsupc++/eh_ptr.cc     2009-04-09 16:23:07.000000000 -0700
     27017+++ gcc-4.4.0/libstdc++-v3/libsupc++/eh_ptr.cc  2009-06-03 03:37:32.000000000 -0700
     27018@@ -26,6 +26,8 @@
     27019 
     27020 #ifdef _GLIBCXX_ATOMIC_BUILTINS_4
     27021 
     27022+#define _GLIBCXX_EH_PTR_COMPAT
     27023+
     27024 #include <exception>
     27025 #include <exception_ptr.h>
     27026 #include "unwind-cxx.h"
     27027@@ -127,6 +129,7 @@
     27028 }
     27029 
     27030 
     27031+// Retained for compatibility with CXXABI_1.3.
     27032 bool
     27033 std::__exception_ptr::exception_ptr::operator!() const throw()
     27034 {
     27035@@ -134,6 +137,7 @@
     27036 }
     27037 
     27038 
     27039+// Retained for compatibility with CXXABI_1.3.
     27040 std::__exception_ptr::exception_ptr::operator __safe_bool() const throw()
     27041 {
     27042   return _M_exception_object ? &exception_ptr::_M_safe_bool_dummy : 0;
     27043@@ -235,4 +239,6 @@
     27044   std::terminate ();
     27045 }
     27046 
     27047+#undef _GLIBCXX_EH_PTR_COMPAT
     27048+
     27049 #endif
     27050diff -Naur gcc-4.4.0.orig/libstdc++-v3/libsupc++/exception_ptr.h gcc-4.4.0/libstdc++-v3/libsupc++/exception_ptr.h
     27051--- gcc-4.4.0.orig/libstdc++-v3/libsupc++/exception_ptr.h       2009-04-09 16:23:07.000000000 -0700
     27052+++ gcc-4.4.0/libstdc++-v3/libsupc++/exception_ptr.h    2009-06-03 03:37:32.000000000 -0700
     27053@@ -141,8 +141,11 @@
     27054       }
     27055 #endif
     27056 
     27057+#ifdef _GLIBCXX_EH_PTR_COMPAT
     27058+      // Retained for compatibility with CXXABI_1.3.
     27059       bool operator!() const throw();
     27060       operator __safe_bool() const throw();
     27061+#endif
     27062 
     27063       friend bool
     27064       operator==(const exception_ptr&, const exception_ptr&) throw();
     27065diff -Naur gcc-4.4.0.orig/libstdc++-v3/scripts/create_testsuite_files gcc-4.4.0/libstdc++-v3/scripts/create_testsuite_files
     27066--- gcc-4.4.0.orig/libstdc++-v3/scripts/create_testsuite_files  2006-10-09 16:53:35.000000000 -0700
     27067+++ gcc-4.4.0/libstdc++-v3/scripts/create_testsuite_files       2009-04-30 12:04:31.000000000 -0700
     27068@@ -32,7 +32,7 @@
     27069 # This is the ugly version of "everything but the current directory".  It's
     27070 # what has to happen when find(1) doesn't support -mindepth, or -xtype.
     27071 dlist=`echo [0-9][0-9]*`
     27072-dlist="$dlist abi backward ext performance thread tr1"
     27073+dlist="$dlist abi backward ext performance tr1"
     27074 find $dlist "(" -type f -o -type l ")" -name "*.cc" -print > $tmp.01
     27075 find $dlist "(" -type f -o -type l ")" -name "*.c" -print > $tmp.02
     27076 cat  $tmp.01 $tmp.02 | sort > $tmp.1
    1567127077diff -Naur gcc-4.4.0.orig/libstdc++-v3/scripts/run_doxygen gcc-4.4.0/libstdc++-v3/scripts/run_doxygen
    1567227078--- gcc-4.4.0.orig/libstdc++-v3/scripts/run_doxygen     2009-02-19 00:15:15.000000000 -0800
     
    1573827144 # Generic removal bits, where there are things in the generated man
    1573927145 # pages that need to be killed.
     27146diff -Naur gcc-4.4.0.orig/libstdc++-v3/src/math_stubs_long_double.cc gcc-4.4.0/libstdc++-v3/src/math_stubs_long_double.cc
     27147--- gcc-4.4.0.orig/libstdc++-v3/src/math_stubs_long_double.cc   2009-04-09 16:23:07.000000000 -0700
     27148+++ gcc-4.4.0/libstdc++-v3/src/math_stubs_long_double.cc        2009-05-07 00:03:17.000000000 -0700
     27149@@ -70,6 +70,14 @@
     27150   }
     27151 #endif
     27152 
     27153+#ifndef _GLIBCXX_HAVE_CEILL
     27154+  long double
     27155+  ceill(long double x)
     27156+  {
     27157+    return ceil((double) x);
     27158+  }
     27159+#endif
     27160+
     27161 #ifndef _GLIBCXX_HAVE_COSL
     27162   long double
     27163   cosl(long double x)
     27164diff -Naur gcc-4.4.0.orig/libstdc++-v3/src/mutex.cc gcc-4.4.0/libstdc++-v3/src/mutex.cc
     27165--- gcc-4.4.0.orig/libstdc++-v3/src/mutex.cc    2009-04-09 16:23:07.000000000 -0700
     27166+++ gcc-4.4.0/libstdc++-v3/src/mutex.cc 2009-05-05 14:44:27.000000000 -0700
     27167@@ -28,11 +28,11 @@
     27168 #ifndef _GLIBCXX_HAVE_TLS
     27169 namespace
     27170 {
     27171-  std::mutex&
     27172-  get_once_mutex()
     27173+  inline std::unique_lock<std::mutex>*&
     27174+  __get_once_functor_lock_ptr()
     27175   {
     27176-    static std::mutex once_mutex;
     27177-    return once_mutex;
     27178+    static std::unique_lock<std::mutex>* __once_functor_lock_ptr = 0;
     27179+    return __once_functor_lock_ptr;
     27180   }
     27181 }
     27182 #endif
     27183@@ -55,10 +55,25 @@
     27184   template class function<void()>;
     27185   function<void()> __once_functor;
     27186 
     27187+  mutex&
     27188+  __get_once_mutex()
     27189+  {
     27190+    static mutex once_mutex;
     27191+    return once_mutex;
     27192+  }
     27193+
     27194+  // code linked against ABI 3.4.12 and later uses this
     27195+  void
     27196+  __set_once_functor_lock_ptr(unique_lock<mutex>* __ptr)
     27197+  {
     27198+    __get_once_functor_lock_ptr() = __ptr;
     27199+  }
     27200+
     27201+  // unsafe - retained for compatibility with ABI 3.4.11
     27202   unique_lock<mutex>&
     27203   __get_once_functor_lock()
     27204   {
     27205-    static unique_lock<mutex> once_functor_lock(get_once_mutex(), defer_lock);
     27206+    static unique_lock<mutex> once_functor_lock(__get_once_mutex(), defer_lock);
     27207     return once_functor_lock;
     27208   }
     27209 #endif
     27210@@ -69,7 +84,14 @@
     27211     {
     27212 #ifndef _GLIBCXX_HAVE_TLS
     27213       function<void()> __once_call = std::move(__once_functor);
     27214-      __get_once_functor_lock().unlock();
     27215+      if (unique_lock<mutex>* __lock = __get_once_functor_lock_ptr())
     27216+      {
     27217+        // caller is using new ABI and provided lock ptr
     27218+        __get_once_functor_lock_ptr() = 0;
     27219+        __lock->unlock();
     27220+      }
     27221+      else
     27222+        __get_once_functor_lock().unlock();  // global lock
     27223 #endif
     27224       __once_call();
     27225     }
     27226diff -Naur gcc-4.4.0.orig/libstdc++-v3/testsuite/18_support/exception_ptr/40296.cc gcc-4.4.0/libstdc++-v3/testsuite/18_support/exception_ptr/40296.cc
     27227--- gcc-4.4.0.orig/libstdc++-v3/testsuite/18_support/exception_ptr/40296.cc     1969-12-31 16:00:00.000000000 -0800
     27228+++ gcc-4.4.0/libstdc++-v3/testsuite/18_support/exception_ptr/40296.cc  2009-06-03 03:37:32.000000000 -0700
     27229@@ -0,0 +1,30 @@
     27230+// { dg-do compile }
     27231+// { dg-options "-std=gnu++0x" }
     27232+// { dg-require-atomic-builtins "" }
     27233+
     27234+// Copyright (C) 2009 Free Software Foundation, Inc.
     27235+//
     27236+// This file is part of the GNU ISO C++ Library.  This library is free
     27237+// software; you can redistribute it and/or modify it under the
     27238+// terms of the GNU General Public License as published by the
     27239+// Free Software Foundation; either version 3, or (at your option)
     27240+// any later version.
     27241+
     27242+// This library is distributed in the hope that it will be useful,
     27243+// but WITHOUT ANY WARRANTY; without even the implied warranty of
     27244+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     27245+// GNU General Public License for more details.
     27246+
     27247+// You should have received a copy of the GNU General Public License along
     27248+// with this library; see the file COPYING3.  If not see
     27249+// <http://www.gnu.org/licenses/>.
     27250+
     27251+#include <exception>
     27252+
     27253+// libstdc++/40296
     27254+bool test01()
     27255+{
     27256+  std::exception_ptr p;
     27257+
     27258+  return (p == 0);
     27259+}
     27260diff -Naur gcc-4.4.0.orig/libstdc++-v3/testsuite/18_support/exception_ptr/current_exception.cc gcc-4.4.0/libstdc++-v3/testsuite/18_support/exception_ptr/current_exception.cc
     27261--- gcc-4.4.0.orig/libstdc++-v3/testsuite/18_support/exception_ptr/current_exception.cc 2009-04-09 16:23:07.000000000 -0700
     27262+++ gcc-4.4.0/libstdc++-v3/testsuite/18_support/exception_ptr/current_exception.cc      2009-06-03 03:37:32.000000000 -0700
     27263@@ -31,7 +31,7 @@
     27264   using namespace std;
     27265 
     27266   exception_ptr ep = current_exception();
     27267-  VERIFY( !ep );
     27268+  VERIFY( ep == 0 );
     27269 }
     27270 
     27271 void test02()
     27272@@ -43,7 +43,7 @@
     27273     throw 0;
     27274   } catch(...) {
     27275     exception_ptr ep = current_exception();
     27276-    VERIFY( ep );
     27277+    VERIFY( ep != 0 );
     27278   }
     27279 }
     27280 
     27281@@ -56,7 +56,7 @@
     27282     throw exception();
     27283   } catch(std::exception&) {
     27284     exception_ptr ep = current_exception();
     27285-    VERIFY( ep );
     27286+    VERIFY( ep != 0 );
     27287   }
     27288 }
     27289 
    1574027290diff -Naur gcc-4.4.0.orig/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/copy_neg.cc gcc-4.4.0/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/copy_neg.cc
    1574127291--- gcc-4.4.0.orig/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/copy_neg.cc        2009-04-09 16:23:07.000000000 -0700
     
    1627727827+  return 0;
    1627827828+}
     27829diff -Naur gcc-4.4.0.orig/libstdc++-v3/testsuite/23_containers/vector/40192.cc gcc-4.4.0/libstdc++-v3/testsuite/23_containers/vector/40192.cc
     27830--- gcc-4.4.0.orig/libstdc++-v3/testsuite/23_containers/vector/40192.cc 1969-12-31 16:00:00.000000000 -0800
     27831+++ gcc-4.4.0/libstdc++-v3/testsuite/23_containers/vector/40192.cc      2009-05-18 16:16:48.000000000 -0700
     27832@@ -0,0 +1,28 @@
     27833+// Copyright (C) 2009 Free Software Foundation, Inc.
     27834+//
     27835+// This file is part of the GNU ISO C++ Library.  This library is free
     27836+// software; you can redistribute it and/or modify it under the
     27837+// terms of the GNU General Public License as published by the
     27838+// Free Software Foundation; either version 3, or (at your option)
     27839+// any later version.
     27840+
     27841+// This library is distributed in the hope that it will be useful,
     27842+// but WITHOUT ANY WARRANTY; without even the implied warranty of
     27843+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     27844+// GNU General Public License for more details.
     27845+
     27846+// You should have received a copy of the GNU General Public License along
     27847+// with this library; see the file COPYING3.  If not see
     27848+// <http://www.gnu.org/licenses/>.
     27849+
     27850+// { dg-do compile }
     27851+
     27852+// libstdc++/40192
     27853+
     27854+#include <vector>
     27855+
     27856+void test01()
     27857+{
     27858+  typedef float float4[4];
     27859+  std::vector<float4> vals;
     27860+}
     27861diff -Naur gcc-4.4.0.orig/libstdc++-v3/testsuite/25_algorithms/find/39546.cc gcc-4.4.0/libstdc++-v3/testsuite/25_algorithms/find/39546.cc
     27862--- gcc-4.4.0.orig/libstdc++-v3/testsuite/25_algorithms/find/39546.cc   1969-12-31 16:00:00.000000000 -0800
     27863+++ gcc-4.4.0/libstdc++-v3/testsuite/25_algorithms/find/39546.cc        2009-05-12 07:57:35.000000000 -0700
     27864@@ -0,0 +1,43 @@
     27865+// Copyright (C) 2009 Free Software Foundation, Inc.
     27866+//
     27867+// This file is part of the GNU ISO C++ Library.  This library is free
     27868+// software; you can redistribute it and/or modify it under the
     27869+// terms of the GNU General Public License as published by the
     27870+// Free Software Foundation; either version 3, or (at your option)
     27871+// any later version.
     27872+
     27873+// This library is distributed in the hope that it will be useful,
     27874+// but WITHOUT ANY WARRANTY; without even the implied warranty of
     27875+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     27876+// GNU General Public License for more details.
     27877+
     27878+// You should have received a copy of the GNU General Public License along
     27879+// with this library; see the file COPYING3.  If not see
     27880+// <http://www.gnu.org/licenses/>.
     27881+
     27882+// 25.3.1 algorithms, find()
     27883+
     27884+#include <vector>
     27885+#include <string>
     27886+#include <algorithm>
     27887+#include <testsuite_hooks.h>
     27888+
     27889+// libstdc++/39546
     27890+void
     27891+test01()
     27892+{
     27893+  bool test __attribute__((unused)) = true;
     27894+
     27895+  std::vector<std::string> dict;
     27896+  dict.push_back("one");
     27897+  dict.push_back("two");
     27898+  dict.push_back("three");
     27899+
     27900+  VERIFY( std::find(dict.begin(), dict.end(), "two") == dict.begin() + 1 );
     27901+}
     27902+
     27903+int
     27904+main()
     27905+{
     27906+  test01();
     27907+}
    1627927908diff -Naur gcc-4.4.0.orig/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/error_code.cc gcc-4.4.0/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/error_code.cc
    1628027909--- gcc-4.4.0.orig/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/error_code.cc        2009-04-09 16:23:07.000000000 -0700
     
    1630927938 
    1631027939   {
     27940diff -Naur gcc-4.4.0.orig/libstdc++-v3/testsuite/30_threads/call_once/39909.cc gcc-4.4.0/libstdc++-v3/testsuite/30_threads/call_once/39909.cc
     27941--- gcc-4.4.0.orig/libstdc++-v3/testsuite/30_threads/call_once/39909.cc 1969-12-31 16:00:00.000000000 -0800
     27942+++ gcc-4.4.0/libstdc++-v3/testsuite/30_threads/call_once/39909.cc      2009-05-05 14:44:27.000000000 -0700
     27943@@ -0,0 +1,56 @@
     27944+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
     27945+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
     27946+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
     27947+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
     27948+// { dg-require-cstdint "" }
     27949+// { dg-require-gthreads "" }
     27950+
     27951+// Copyright (C) 2009 Free Software Foundation, Inc.
     27952+//
     27953+// This file is part of the GNU ISO C++ Library.  This library is free
     27954+// software; you can redistribute it and/or modify it under the
     27955+// terms of the GNU General Public License as published by the
     27956+// Free Software Foundation; either version 3, or (at your option)
     27957+// any later version.
     27958+
     27959+// This library is distributed in the hope that it will be useful,
     27960+// but WITHOUT ANY WARRANTY; without even the implied warranty of
     27961+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     27962+// GNU General Public License for more details.
     27963+
     27964+// You should have received a copy of the GNU General Public License along
     27965+// with this library; see the file COPYING3.  If not see
     27966+// <http://www.gnu.org/licenses/>.
     27967+
     27968+
     27969+#include <mutex>
     27970+#include <thread>
     27971+#include <testsuite_hooks.h>
     27972+
     27973+std::once_flag flag;
     27974+int value = 0;
     27975+
     27976+struct Inc { void operator()() const { ++value; } };
     27977+
     27978+struct Func
     27979+{
     27980+   void operator()() const
     27981+   {
     27982+       Inc inc;
     27983+       for (int i = 0; i < 10000;  ++i)
     27984+           std::call_once(flag, inc);
     27985+   }
     27986+};
     27987+
     27988+int main()
     27989+{
     27990+   Func f;
     27991+   std::thread t1(f);
     27992+   std::thread t2(f);
     27993+   std::thread t3(f);
     27994+   t1.join();
     27995+   t2.join();
     27996+   t3.join();
     27997+   VERIFY( value == 1 );
     27998+   return 0;
     27999+}
    1631128000diff -Naur gcc-4.4.0.orig/libstdc++-v3/testsuite/30_threads/unique_lock/locking/2.cc gcc-4.4.0/libstdc++-v3/testsuite/30_threads/unique_lock/locking/2.cc
    1631228001--- gcc-4.4.0.orig/libstdc++-v3/testsuite/30_threads/unique_lock/locking/2.cc   2009-04-09 16:23:07.000000000 -0700
     
    1633328022       catch (...)
    1633428023        {
     28024diff -Naur gcc-4.4.0.orig/libstdc++-v3/testsuite/ext/rope/40299.cc gcc-4.4.0/libstdc++-v3/testsuite/ext/rope/40299.cc
     28025--- gcc-4.4.0.orig/libstdc++-v3/testsuite/ext/rope/40299.cc     1969-12-31 16:00:00.000000000 -0800
     28026+++ gcc-4.4.0/libstdc++-v3/testsuite/ext/rope/40299.cc  2009-06-02 02:06:45.000000000 -0700
     28027@@ -0,0 +1,27 @@
     28028+// { dg-options "-std=gnu++0x" }
     28029+// { dg-do compile }
     28030+
     28031+// Copyright (C) 2009 Free Software Foundation, Inc.
     28032+//
     28033+// This file is part of the GNU ISO C++ Library.  This library is free
     28034+// software; you can redistribute it and/or modify it under the
     28035+// terms of the GNU General Public License as published by the
     28036+// Free Software Foundation; either version 3, or (at your option)
     28037+// any later version.
     28038+//
     28039+// This library is distributed in the hope that it will be useful,
     28040+// but WITHOUT ANY WARRANTY; without even the implied warranty of
     28041+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     28042+// GNU General Public License for more details.
     28043+//
     28044+// You should have received a copy of the GNU General Public License along
     28045+// with this library; see the file COPYING3.  If not see
     28046+// <http://www.gnu.org/licenses/>.
     28047+
     28048+#include <ext/rope>
     28049+
     28050+// libstdc++/40299
     28051+void test01()
     28052+{
     28053+  __gnu_cxx::crope asdf;
     28054+}
     28055diff -Naur gcc-4.4.0.orig/libstdc++-v3/testsuite/lib/libstdc++.exp gcc-4.4.0/libstdc++-v3/testsuite/lib/libstdc++.exp
     28056--- gcc-4.4.0.orig/libstdc++-v3/testsuite/lib/libstdc++.exp     2009-04-09 16:23:07.000000000 -0700
     28057+++ gcc-4.4.0/libstdc++-v3/testsuite/lib/libstdc++.exp  2009-05-21 04:30:55.000000000 -0700
     28058@@ -402,8 +402,7 @@
     28059     # Flag setting based on type argument.
     28060     if { $type == "executable" } {
     28061        # Link the support objects into executables.
     28062-        set cxx_final [concat $cxx_final $cxxldflags]
     28063-       lappend options "additional_flags=./libtestc++.a"
     28064+       lappend options "additional_flags=./libtestc++.a $cxxldflags"
     28065     } else {
     28066        if { $type == "sharedlib" } {
     28067            # Don't link in anything.
     28068diff -Naur gcc-4.4.0.orig/libstdc++-v3/testsuite/util/testsuite_abi.cc gcc-4.4.0/libstdc++-v3/testsuite/util/testsuite_abi.cc
     28069--- gcc-4.4.0.orig/libstdc++-v3/testsuite/util/testsuite_abi.cc 2009-04-09 16:23:07.000000000 -0700
     28070+++ gcc-4.4.0/libstdc++-v3/testsuite/util/testsuite_abi.cc      2009-05-05 14:44:27.000000000 -0700
     28071@@ -183,6 +183,7 @@
     28072       known_versions.push_back("GLIBCXX_3.4.9");
     28073       known_versions.push_back("GLIBCXX_3.4.10");
     28074       known_versions.push_back("GLIBCXX_3.4.11");
     28075+      known_versions.push_back("GLIBCXX_3.4.12");
     28076       known_versions.push_back("GLIBCXX_LDBL_3.4");
     28077       known_versions.push_back("GLIBCXX_LDBL_3.4.7");
     28078       known_versions.push_back("GLIBCXX_LDBL_3.4.10");
Note: See TracChangeset for help on using the changeset viewer.