]> TLD Linux GIT Repositories - packages/gcc.git/blob - gcc-branch.diff
- updated branch.diff
[packages/gcc.git] / gcc-branch.diff
1 Index: libstdc++-v3/ChangeLog
2 ===================================================================
3 --- libstdc++-v3/ChangeLog      (.../tags/gcc_4_7_3_release)    (revision 198690)
4 +++ libstdc++-v3/ChangeLog      (.../branches/gcc-4_7-branch)   (revision 198690)
5 @@ -1,3 +1,20 @@
6 +2013-04-15  Jack Howarth  <howarth@bromo.med.uc.edu>
7 +
8 +       Backport from mainline
9 +
10 +       2012-10-10  Jack Howarth  <howarth@bromo.med.uc.edu>
11 +                   Jonathan Wakely  <jwakely.gcc@gmail.com>
12 +
13 +       PR libstdc++/54847
14 +       * config/os/bsd/darwin/os_defines.h: Define _GLIBCXX_USE_NANOSLEEP
15 +       and _GLIBCXX_USE_SCHED_YIELD.
16 +       * acinclude.m4 (GLIBCXX_ENABLE_LIBSTDCXX_TIME): Add comment.
17 +
18 +2013-04-15  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
19 +
20 +       * testsuite/30_threads/condition_variable/members/53841.cc: Add
21 +       -std=gnu++0x -pthread on alpha*-*-osf*, mips-sgi-irix6*.
22 +
23  2013-04-11  Release Manager
24  
25         * GCC 4.7.3 released.
26 Index: libstdc++-v3/testsuite/30_threads/condition_variable/members/53841.cc
27 ===================================================================
28 --- libstdc++-v3/testsuite/30_threads/condition_variable/members/53841.cc       (.../tags/gcc_4_7_3_release)    (revision 198690)
29 +++ libstdc++-v3/testsuite/30_threads/condition_variable/members/53841.cc       (.../branches/gcc-4_7-branch)   (revision 198690)
30 @@ -1,5 +1,5 @@
31  // { dg-do compile }
32 -// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* powerpc-ibm-aix* hppa*-hp-hpux11* } }
33 +// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* powerpc-ibm-aix* hppa*-hp-hpux11* } }
34  // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
35  // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
36  // { dg-require-cstdint "" }
37 Index: libstdc++-v3/config/os/bsd/darwin/os_defines.h
38 ===================================================================
39 --- libstdc++-v3/config/os/bsd/darwin/os_defines.h      (.../tags/gcc_4_7_3_release)    (revision 198690)
40 +++ libstdc++-v3/config/os/bsd/darwin/os_defines.h      (.../branches/gcc-4_7-branch)   (revision 198690)
41 @@ -42,4 +42,9 @@
42  // Static initializer macro is buggy in darwin, see libstdc++/51906
43  #define _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC
44  
45 +// Configure checks for nanosleep fail on Darwin, but nanosleep and
46 +// sched_yield are always available, so use them.
47 +#define _GLIBCXX_USE_NANOSLEEP 1
48 +#define _GLIBCXX_USE_SCHED_YIELD 1
49 +
50  #endif
51 Index: libstdc++-v3/acinclude.m4
52 ===================================================================
53 --- libstdc++-v3/acinclude.m4   (.../tags/gcc_4_7_3_release)    (revision 198690)
54 +++ libstdc++-v3/acinclude.m4   (.../branches/gcc-4_7-branch)   (revision 198690)
55 @@ -1132,6 +1132,11 @@
56  dnl --disable-libstdcxx-time
57  dnl        disables the checks completely
58  dnl
59 +dnl N.B. Darwin provides nanosleep but doesn't support the whole POSIX
60 +dnl Timers option, so doesn't define _POSIX_TIMERS. Because the test
61 +dnl below fails Darwin unconditionally defines _GLIBCXX_USE_NANOSLEEP in
62 +dnl os_defines.h and also defines _GLIBCXX_USE_SCHED_YIELD.
63 +dnl
64  AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [
65  
66    AC_MSG_CHECKING([for clock_gettime, nanosleep and sched_yield])
67 Index: libgcc/ChangeLog
68 ===================================================================
69 --- libgcc/ChangeLog    (.../tags/gcc_4_7_3_release)    (revision 198690)
70 +++ libgcc/ChangeLog    (.../branches/gcc-4_7-branch)   (revision 198690)
71 @@ -1,3 +1,10 @@
72 +2013-04-11  Julian Brown  <julian@codesourcery.com>
73 +
74 +       * config/arm/linux-atomic.c (SUBWORD_SYNC_OP, SUBWORD_VAL_CAS)
75 +       (SUBWORD_TEST_AND_SET): Use signed char/short types instead of
76 +       unsigned char/unsigned short.
77 +       (__sync_val_compare_and_swap_{1,2}): Handle signed argument.
78 +
79  2013-04-11  Release Manager
80  
81         * GCC 4.7.3 released.
82 Index: libgcc/config/arm/linux-atomic.c
83 ===================================================================
84 --- libgcc/config/arm/linux-atomic.c    (.../tags/gcc_4_7_3_release)    (revision 198690)
85 +++ libgcc/config/arm/linux-atomic.c    (.../branches/gcc-4_7-branch)   (revision 198690)
86 @@ -97,19 +97,19 @@
87      return (RETURN & mask) >> shift;                                   \
88    }
89  
90 -SUBWORD_SYNC_OP (add,   , +, unsigned short, 2, oldval)
91 -SUBWORD_SYNC_OP (sub,   , -, unsigned short, 2, oldval)
92 -SUBWORD_SYNC_OP (or,    , |, unsigned short, 2, oldval)
93 -SUBWORD_SYNC_OP (and,   , &, unsigned short, 2, oldval)
94 -SUBWORD_SYNC_OP (xor,   , ^, unsigned short, 2, oldval)
95 -SUBWORD_SYNC_OP (nand, ~, &, unsigned short, 2, oldval)
96 +SUBWORD_SYNC_OP (add,   , +, short, 2, oldval)
97 +SUBWORD_SYNC_OP (sub,   , -, short, 2, oldval)
98 +SUBWORD_SYNC_OP (or,    , |, short, 2, oldval)
99 +SUBWORD_SYNC_OP (and,   , &, short, 2, oldval)
100 +SUBWORD_SYNC_OP (xor,   , ^, short, 2, oldval)
101 +SUBWORD_SYNC_OP (nand, ~, &, short, 2, oldval)
102  
103 -SUBWORD_SYNC_OP (add,   , +, unsigned char, 1, oldval)
104 -SUBWORD_SYNC_OP (sub,   , -, unsigned char, 1, oldval)
105 -SUBWORD_SYNC_OP (or,    , |, unsigned char, 1, oldval)
106 -SUBWORD_SYNC_OP (and,   , &, unsigned char, 1, oldval)
107 -SUBWORD_SYNC_OP (xor,   , ^, unsigned char, 1, oldval)
108 -SUBWORD_SYNC_OP (nand, ~, &, unsigned char, 1, oldval)
109 +SUBWORD_SYNC_OP (add,   , +, signed char, 1, oldval)
110 +SUBWORD_SYNC_OP (sub,   , -, signed char, 1, oldval)
111 +SUBWORD_SYNC_OP (or,    , |, signed char, 1, oldval)
112 +SUBWORD_SYNC_OP (and,   , &, signed char, 1, oldval)
113 +SUBWORD_SYNC_OP (xor,   , ^, signed char, 1, oldval)
114 +SUBWORD_SYNC_OP (nand, ~, &, signed char, 1, oldval)
115  
116  #define OP_AND_FETCH_WORD(OP, PFX_OP, INF_OP)                          \
117    int HIDDEN                                                           \
118 @@ -132,19 +132,19 @@
119  OP_AND_FETCH_WORD (xor,   , ^)
120  OP_AND_FETCH_WORD (nand, ~, &)
121  
122 -SUBWORD_SYNC_OP (add,   , +, unsigned short, 2, newval)
123 -SUBWORD_SYNC_OP (sub,   , -, unsigned short, 2, newval)
124 -SUBWORD_SYNC_OP (or,    , |, unsigned short, 2, newval)
125 -SUBWORD_SYNC_OP (and,   , &, unsigned short, 2, newval)
126 -SUBWORD_SYNC_OP (xor,   , ^, unsigned short, 2, newval)
127 -SUBWORD_SYNC_OP (nand, ~, &, unsigned short, 2, newval)
128 +SUBWORD_SYNC_OP (add,   , +, short, 2, newval)
129 +SUBWORD_SYNC_OP (sub,   , -, short, 2, newval)
130 +SUBWORD_SYNC_OP (or,    , |, short, 2, newval)
131 +SUBWORD_SYNC_OP (and,   , &, short, 2, newval)
132 +SUBWORD_SYNC_OP (xor,   , ^, short, 2, newval)
133 +SUBWORD_SYNC_OP (nand, ~, &, short, 2, newval)
134  
135 -SUBWORD_SYNC_OP (add,   , +, unsigned char, 1, newval)
136 -SUBWORD_SYNC_OP (sub,   , -, unsigned char, 1, newval)
137 -SUBWORD_SYNC_OP (or,    , |, unsigned char, 1, newval)
138 -SUBWORD_SYNC_OP (and,   , &, unsigned char, 1, newval)
139 -SUBWORD_SYNC_OP (xor,   , ^, unsigned char, 1, newval)
140 -SUBWORD_SYNC_OP (nand, ~, &, unsigned char, 1, newval)
141 +SUBWORD_SYNC_OP (add,   , +, signed char, 1, newval)
142 +SUBWORD_SYNC_OP (sub,   , -, signed char, 1, newval)
143 +SUBWORD_SYNC_OP (or,    , |, signed char, 1, newval)
144 +SUBWORD_SYNC_OP (and,   , &, signed char, 1, newval)
145 +SUBWORD_SYNC_OP (xor,   , ^, signed char, 1, newval)
146 +SUBWORD_SYNC_OP (nand, ~, &, signed char, 1, newval)
147  
148  int HIDDEN
149  __sync_val_compare_and_swap_4 (int *ptr, int oldval, int newval)
150 @@ -181,7 +181,7 @@
151         actual_oldval = *wordptr;                                       \
152                                                                         \
153         if (__builtin_expect (((actual_oldval & mask) >> shift) !=      \
154 -                              (unsigned int) oldval, 0))                \
155 +                              ((unsigned int) oldval & MASK_##WIDTH), 0)) \
156            return (actual_oldval & mask) >> shift;                      \
157                                                                         \
158         actual_newval = (actual_oldval & ~mask)                         \
159 @@ -195,8 +195,8 @@
160        }                                                                        \
161    }
162  
163 -SUBWORD_VAL_CAS (unsigned short, 2)
164 -SUBWORD_VAL_CAS (unsigned char,  1)
165 +SUBWORD_VAL_CAS (short,       2)
166 +SUBWORD_VAL_CAS (signed char, 1)
167  
168  typedef unsigned char bool;
169  
170 @@ -217,8 +217,8 @@
171      return (oldval == actual_oldval);                                  \
172    }
173  
174 -SUBWORD_BOOL_CAS (unsigned short, 2)
175 -SUBWORD_BOOL_CAS (unsigned char,  1)
176 +SUBWORD_BOOL_CAS (short,       2)
177 +SUBWORD_BOOL_CAS (signed char, 1)
178  
179  void HIDDEN
180  __sync_synchronize (void)
181 @@ -260,8 +260,8 @@
182      return (oldval & mask) >> shift;                                   \
183    }
184  
185 -SUBWORD_TEST_AND_SET (unsigned short, 2)
186 -SUBWORD_TEST_AND_SET (unsigned char,  1)
187 +SUBWORD_TEST_AND_SET (short,       2)
188 +SUBWORD_TEST_AND_SET (signed char, 1)
189  
190  #define SYNC_LOCK_RELEASE(TYPE, WIDTH)                                 \
191    void HIDDEN                                                          \
192 Index: gcc/doc/tm.texi
193 ===================================================================
194 --- gcc/doc/tm.texi     (.../tags/gcc_4_7_3_release)    (revision 198690)
195 +++ gcc/doc/tm.texi     (.../branches/gcc-4_7-branch)   (revision 198690)
196 @@ -9495,6 +9495,10 @@
197  True if the @code{.debug_pubtypes} and @code{.debug_pubnames} sections should be emitted.  These sections are not used on most platforms, and in particular GDB does not use them.
198  @end deftypevr
199  
200 +@deftypevr {Target Hook} bool TARGET_FORCE_AT_COMP_DIR
201 +True if the @code{DW_AT_comp_dir} attribute should be emitted for each  compilation unit.  This attribute is required for the darwin linker  to emit debug information.
202 +@end deftypevr
203 +
204  @deftypevr {Target Hook} bool TARGET_DELAY_SCHED2
205  True if sched2 is not to be run at its normal place.  This usually means it will be run as part of machine-specific reorg.
206  @end deftypevr
207 Index: gcc/doc/tm.texi.in
208 ===================================================================
209 --- gcc/doc/tm.texi.in  (.../tags/gcc_4_7_3_release)    (revision 198690)
210 +++ gcc/doc/tm.texi.in  (.../branches/gcc-4_7-branch)   (revision 198690)
211 @@ -9388,6 +9388,8 @@
212  
213  @hook TARGET_WANT_DEBUG_PUB_SECTIONS
214  
215 +@hook TARGET_FORCE_AT_COMP_DIR
216 +
217  @hook TARGET_DELAY_SCHED2
218  
219  @hook TARGET_DELAY_VARTRACK
220 Index: gcc/target.def
221 ===================================================================
222 --- gcc/target.def      (.../tags/gcc_4_7_3_release)    (revision 198690)
223 +++ gcc/target.def      (.../branches/gcc-4_7-branch)   (revision 198690)
224 @@ -2758,6 +2758,13 @@
225   bool, false)
226  
227  DEFHOOKPOD
228 +(force_at_comp_dir,
229 + "True if the @code{DW_AT_comp_dir} attribute should be emitted for each \
230 + compilation unit.  This attribute is required for the darwin linker \
231 + to emit debug information.",
232 + bool, false)
233 +
234 +DEFHOOKPOD
235  (delay_sched2, "True if sched2 is not to be run at its normal place.  \
236  This usually means it will be run as part of machine-specific reorg.",
237  bool, false)
238 Index: gcc/DATESTAMP
239 ===================================================================
240 --- gcc/DATESTAMP       (.../tags/gcc_4_7_3_release)    (revision 198690)
241 +++ gcc/DATESTAMP       (.../branches/gcc-4_7-branch)   (revision 198690)
242 @@ -1 +1 @@
243 -20130411
244 +20130507
245 Index: gcc/builtins.c
246 ===================================================================
247 --- gcc/builtins.c      (.../tags/gcc_4_7_3_release)    (revision 198690)
248 +++ gcc/builtins.c      (.../branches/gcc-4_7-branch)   (revision 198690)
249 @@ -9692,7 +9692,16 @@
250        case rvc_inf:
251         /* If arg is Inf or NaN and we're logb, return it.  */
252         if (TREE_CODE (rettype) == REAL_TYPE)
253 -         return fold_convert_loc (loc, rettype, arg);
254 +         {
255 +           /* For logb(-Inf) we have to return +Inf.  */
256 +           if (real_isinf (value) && real_isneg (value))
257 +             {
258 +               REAL_VALUE_TYPE tem;
259 +               real_inf (&tem);
260 +               return build_real (rettype, tem);
261 +             }
262 +           return fold_convert_loc (loc, rettype, arg);
263 +         }
264         /* Fall through... */
265        case rvc_zero:
266         /* Zero may set errno and/or raise an exception for logb, also
267 Index: gcc/ChangeLog
268 ===================================================================
269 --- gcc/ChangeLog       (.../tags/gcc_4_7_3_release)    (revision 198690)
270 +++ gcc/ChangeLog       (.../branches/gcc-4_7-branch)   (revision 198690)
271 @@ -1,3 +1,115 @@
272 +2013-05-03  Marek Polacek  <polacek@redhat.com>
273 +
274 +       Backport from mainline
275 +       2013-04-25  Marek Polacek  <polacek@redhat.com>
276 +
277 +       PR tree-optimization/57066
278 +        * builtins.c (fold_builtin_logb): Return +Inf for -Inf.
279 +
280 +2013-04-30  Uros Bizjak  <ubizjak@gmail.com>
281 +
282 +       Backport from mainline
283 +       2013-04-29  Uros Bizjak  <ubizjak@gmail.com>
284 +
285 +       PR target/44578
286 +       * config/i386/i386.md (*zero_extendsidi2_rex64): Add "!" to m->?*y
287 +       alternative.
288 +       (*zero_extendsidi2): Ditto.
289 +
290 +       Backport from mainline
291 +       2013-04-29  Uros Bizjak  <ubizjak@gmail.com>
292 +
293 +       PR target/57098
294 +       * config/i386/i386.c (ix86_expand_vec_perm): Validize constant memory.
295 +
296 +2013-04-29  Christian Bruel  <christian.bruel@st.com>
297 +
298 +       PR target/57108
299 +       * sh.md (tstsi_t_zero_extract_eq): Set mode for operand 0.
300 +
301 +2013-04-27  Jakub Jelinek  <jakub@redhat.com>
302 +
303 +       PR target/56866
304 +       * config/i386/sse.md (xop_rotr<mode>3): Fix up computation of
305 +       the immediate rotate count.
306 +
307 +2013-04-21  Eric Botcazou  <ebotcazou@adacore.com>
308 +
309 +       * cfgexpand.c (avoid_complex_debug_insns): Fix C++ism.
310 +
311 +2013-04-19  Matthias Klose  <doko@ubuntu.com>
312 +
313 +       PR middle-end/56848
314 +       Re-apply
315 +       2013-04-01  Andrey Belevantsev  <abel@ispras.ru>
316 +
317 +       Backport from mainline
318 +       2013-02-25  Andrey Belevantsev  <abel@ispras.ru>
319 +       Alexander Monakov  <amonakov@ispras.ru>
320 +
321 +       PR middle-end/56077
322 +       * sched-deps.c (sched_analyze_insn): When reg_pending_barrier,
323 +       flush pending lists also on non-jumps.  Adjust comment.
324 +
325 +       Backport from 4.8:
326 +       2012-08-27  Maxim Kuvyrkov  <maxim@codesourcery.com>
327 +
328 +       * sched-deps.c (add_dependence_list_and_free): Simplify.
329 +       (flush_pending_list_and_free): Fix a hack that was fixing a hack.  Free
330 +       lists when add_dependence_list_and_free doesn't free them.
331 +
332 +2013-04-19  Marek Polacek  <polacek@redhat.com>
333 +
334 +       Backport from mainline
335 +       2013-01-08  Steven Bosscher  <steven@gcc.gnu.org>
336 +                   Jakub Jelinek  <jakub@redhat.com>
337 +
338 +       PR tree-optimization/48189
339 +       * predict.c (predict_loops): If max is 0, don't call compare_tree_int.
340 +       If nitercst is 0, don't predict the exit edge.
341 +
342 +2013-04-16  Jack Howarth  <howarth@bromo.med.uc.edu>
343 +
344 +       Backport from mainline
345 +       2012-05-29  Jack Howarth  <howarth@bromo.med.uc.edu>
346 +       * config/darwin.h (STARTFILE_SPEC): Use -no_new_main with -lgcrt1.o
347 +       on Darwin >= 12.
348 +       (DARWIN_CRT1_SPEC): Use -lcrt1.10.6.o when Darwin >= 10 and < 12.
349 +
350 +
351 +       2012-05-29  Jack Howarth  <howarth@bromo.med.uc.edu>
352 +       PR debug/53453
353 +       * doc/tm.texi: Update.
354 +       * doc/tm.texi.in (SDB and DWARF) <TARGET_FORCE_AT_COMP_DIR>: Add @hook.
355 +       * target.def (force_at_comp_dir): New hook.
356 +       * config/darwin.h (TARGET_FORCE_AT_COMP_DIR): Define.
357 +       * dwarf2out.c (dwarf2out_finish): Check targetm.force_at_comp_dir.
358 +
359 +2013-04-15  Eric Botcazou  <ebotcazou@adacore.com>
360 +
361 +       PR target/56890
362 +       * config/sparc/sparc.c (enum sparc_mode_class): Add H_MODE value.
363 +       (S_MODES): Set H_MODE bit.
364 +       (SF_MODES): Set only S_MODE and SF_MODE bits.
365 +       (DF_MODES): Set SF_MODES and only D_MODE and DF_MODE bits.
366 +       (sparc_init_modes) <MODE_INT>: Set H_MODE bit for sub-word modes.
367 +       <MODE_VECTOR_INT>: Do not set SF_MODE for sub-word modes.
368 +       <MODE_FLOAT>: Likewise.
369 +
370 +2013-04-13  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
371 +
372 +       Backport from mainline:
373 +       2013-04-06  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
374 +
375 +       PR target/55487
376 +       * config/pa/pa.c (legitimize_pic_address): Before incrementing label
377 +       nuses, make sure we have a label.
378 +
379 +2013-04-11  Richard Biener  <rguenther@suse.de>
380 +
381 +       * BASE-VER: Set to 4.7.4.
382 +       * DEV-PHASE: Set to prerelease.
383 +
384  2013-04-11  Release Manager
385  
386         * GCC 4.7.3 released.
387 Index: gcc/testsuite/gcc.target/i386/pr44578.c
388 ===================================================================
389 --- gcc/testsuite/gcc.target/i386/pr44578.c     (.../tags/gcc_4_7_3_release)    (revision 0)
390 +++ gcc/testsuite/gcc.target/i386/pr44578.c     (.../branches/gcc-4_7-branch)   (revision 198690)
391 @@ -0,0 +1,31 @@
392 +/* { dg-do run } */
393 +/* { dg-options "-O2 -mtune=athlon64" } */
394 +
395 +extern void abort (void);
396 +
397 +long double
398 +__attribute__((noinline, noclone))
399 +test (float num)
400 +{
401 +  unsigned int i;
402 +
403 +  if (num < 0.0)
404 +    num = 0.0;
405 +
406 +  __builtin_memcpy (&i, &num, sizeof(unsigned int));
407 +
408 +  return (long double)(unsigned long long) i;
409 +}
410 +
411 +int
412 +main ()
413 +{
414 +  long double x;
415 +
416 +  x = test (0.0);
417 +
418 +  if (x != 0.0)
419 +    abort ();
420 +
421 +  return 0;
422 +}
423 Index: gcc/testsuite/gcc.target/i386/pr56866.c
424 ===================================================================
425 --- gcc/testsuite/gcc.target/i386/pr56866.c     (.../tags/gcc_4_7_3_release)    (revision 0)
426 +++ gcc/testsuite/gcc.target/i386/pr56866.c     (.../branches/gcc-4_7-branch)   (revision 198690)
427 @@ -0,0 +1,16 @@
428 +/* PR target/56866 */
429 +/* { dg-do run } */
430 +/* { dg-require-effective-target xop } */
431 +/* { dg-options "-O3 -mxop" } */
432 +
433 +#define main xop_test_main
434 +#include "../../gcc.c-torture/execute/pr56866.c"
435 +#undef main
436 +
437 +#include "xop-check.h"
438 +
439 +static void
440 +xop_test (void)
441 +{
442 +  xop_test_main ();
443 +}
444 Index: gcc/testsuite/gcc.target/i386/pr57098.c
445 ===================================================================
446 --- gcc/testsuite/gcc.target/i386/pr57098.c     (.../tags/gcc_4_7_3_release)    (revision 0)
447 +++ gcc/testsuite/gcc.target/i386/pr57098.c     (.../branches/gcc-4_7-branch)   (revision 198690)
448 @@ -0,0 +1,10 @@
449 +/* { dg-do compile } */
450 +/* { dg-require-effective-target lp64 } */
451 +/* { dg-options "-msse4 -mcmodel=large" } */
452 +
453 +typedef int V __attribute__((vector_size(16)));
454 +
455 +void foo (V *p, V *mask)
456 +{
457 +  *p = __builtin_shuffle (*p, *mask);
458 +}
459 Index: gcc/testsuite/gcc.target/sh/pr57108.c
460 ===================================================================
461 --- gcc/testsuite/gcc.target/sh/pr57108.c       (.../tags/gcc_4_7_3_release)    (revision 0)
462 +++ gcc/testsuite/gcc.target/sh/pr57108.c       (.../branches/gcc-4_7-branch)   (revision 198690)
463 @@ -0,0 +1,19 @@
464 +/* { dg-do compile { target "sh*-*-*" } } */
465 +/* { dg-options "-O1" } */
466 +
467 +void __assert_func (void) __attribute__ ((__noreturn__)) ;
468 +
469 +void ATATransfer (int num, int buffer)
470 +{
471 + int wordCount;
472 +
473 + while (num > 0)
474 +  {
475 +    wordCount = num * 512 / sizeof (int);
476 +
477 +    ((0 == (buffer & 63)) ? (void)0 : __assert_func () );
478 +    ((0 == (wordCount & 31)) ? (void)0 : __assert_func ());
479 +  }
480 +
481 +
482 + }
483 Index: gcc/testsuite/gfortran.dg/size_kind_3.f90
484 ===================================================================
485 --- gcc/testsuite/gfortran.dg/size_kind_3.f90   (.../tags/gcc_4_7_3_release)    (revision 0)
486 +++ gcc/testsuite/gfortran.dg/size_kind_3.f90   (.../branches/gcc-4_7-branch)   (revision 198690)
487 @@ -0,0 +1,11 @@
488 +! { dg-do compile }
489 +!
490 +! PR fortran/57142
491 +!
492 +integer :: B(huge(1)+3_8,2_8)
493 +integer(8) :: var1(2), var2, var3
494 +
495 +var1 = shape(B) ! { dg-error "SHAPE overflows its kind" }
496 +var2 = size(B) ! { dg-error "SIZE overflows its kind" }
497 +var3 = size(B,dim=1) ! { dg-error "SIZE overflows its kind" }
498 +end
499 Index: gcc/testsuite/gfortran.dg/transfer_check_4.f90
500 ===================================================================
501 --- gcc/testsuite/gfortran.dg/transfer_check_4.f90      (.../tags/gcc_4_7_3_release)    (revision 0)
502 +++ gcc/testsuite/gfortran.dg/transfer_check_4.f90      (.../branches/gcc-4_7-branch)   (revision 198690)
503 @@ -0,0 +1,44 @@
504 +! { dg-do compile }
505 +! { dg-options "-Wall" }
506 +
507 +! PR 57022: [4.7/4.8/4.9 Regression] Inappropriate warning for use of TRANSFER with arrays
508 +! Contributed by William Clodius <wclodius@los-alamos.net>
509 +
510 +subroutine transfers (test)
511 +
512 +  use, intrinsic :: iso_fortran_env
513 +  
514 +  integer, intent(in) :: test
515 +
516 +  integer(int8)  :: test8(8)  = 0
517 +  integer(int16) :: test16(4) = 0
518 +  integer(int32) :: test32(2) = 0
519 +  integer(int64) :: test64    = 0
520 +
521 +  select case(test)
522 +  case(0)
523 +    test64 = transfer(test8, test64)
524 +  case(1)
525 +    test64 = transfer(test16, test64)
526 +  case(2)
527 +    test64 = transfer(test32, test64)
528 +  case(3)
529 +    test8  = transfer(test64, test8, 8)
530 +  case(4)
531 +    test16 = transfer(test64, test16, 4)
532 +  case(5)
533 +    test32 = transfer(test64, test32, 2)
534 +  end select
535 +
536 +end subroutine
537 +
538 +
539 +! PR 53685: surprising warns about transfer with explicit character range
540 +! Contributed by Jos de Kloe <kloedej@knmi.nl>
541 +
542 +subroutine mytest(byte_array,val)
543 +  integer, parameter :: r8_ = Selected_Real_Kind(15,307)  ! = real*8
544 +  character(len=1), dimension(16), intent(in) :: byte_array
545 +  real(r8_),intent(out) :: val
546 +  val = transfer(byte_array(1:8),val)    
547 +end subroutine
548 Index: gcc/testsuite/gfortran.dg/namelist_77.f90
549 ===================================================================
550 --- gcc/testsuite/gfortran.dg/namelist_77.f90   (.../tags/gcc_4_7_3_release)    (revision 0)
551 +++ gcc/testsuite/gfortran.dg/namelist_77.f90   (.../branches/gcc-4_7-branch)   (revision 198690)
552 @@ -0,0 +1,49 @@
553 +! { dg-do run }
554 +!
555 +! PR libfortran/51825 - Fortran runtime error: Cannot match namelist object name
556 +! Test case derived from PR.
557 +
558 +module local_mod
559 +
560 +    type mytype1
561 +        integer :: int1
562 +    end type
563 +
564 +    type mytype2
565 +        integer :: n_x       
566 +        integer :: n_px        
567 +    end type
568 +
569 +    type beam_init_struct
570 +        character(16) :: chars(1) = ''                                  
571 +        type (mytype1) dummy
572 +        type (mytype2) grid(1)      
573 +    end type
574 +
575 +end module
576 +
577 +program error_namelist
578 +
579 +    use local_mod
580 +
581 +    implicit none
582 +
583 +    type (beam_init_struct) beam_init
584 +
585 +    namelist / error_params / beam_init
586 +
587 +    open (10, status='scratch')
588 +    write (10, '(a)') "&error_params"
589 +    write (10, '(a)') "  beam_init%chars(1)='JUNK'"
590 +    write (10, '(a)') "  beam_init%grid(1)%n_x=3"
591 +    write (10, '(a)') "  beam_init%grid(1)%n_px=2"
592 +    write (10, '(a)') "/"
593 +    rewind(10)
594 +    read(10, nml=error_params)
595 +    close (10)
596 +
597 +    if (beam_init%chars(1) /= 'JUNK') call abort
598 +    if (beam_init%grid(1)%n_x /= 3) call abort
599 +    if (beam_init%grid(1)%n_px /= 2) call abort
600 +
601 +end program
602 Index: gcc/testsuite/gfortran.dg/namelist_79.f90
603 ===================================================================
604 --- gcc/testsuite/gfortran.dg/namelist_79.f90   (.../tags/gcc_4_7_3_release)    (revision 0)
605 +++ gcc/testsuite/gfortran.dg/namelist_79.f90   (.../branches/gcc-4_7-branch)   (revision 198690)
606 @@ -0,0 +1,43 @@
607 +! { dg-do run }
608 +! PR libfortran/52512 - Cannot match namelist object name
609 +! Test case derived from PR.
610 +
611 +program testje
612 +
613 +    implicit none
614 +
615 +    integer :: getal, jn
616 +    type ptracer
617 +        character(len = 8)  :: sname  !: short name
618 +        logical             :: lini   !: read in a file or not
619 +    end type ptracer
620 +    type(ptracer) , dimension(3) :: tracer
621 +    namelist/namtoptrc/  getal,tracer
622 +
623 +    ! standard values
624 +    getal = 9999
625 +    do jn = 1, 3
626 +        tracer(jn)%sname = 'default_name'
627 +        tracer(jn)%lini = .false.
628 +    end do
629 +
630 +    open (10, status='scratch')
631 +    write (10, '(a)') "&namtoptrc"
632 +    write (10, '(a)') "   getal = 7"
633 +    write (10, '(a)') "   tracer(1) = 'DIC     ', .true."
634 +    write (10, '(a)') "   tracer(2) = 'Alkalini', .true."
635 +    write (10, '(a)') "   tracer(3) = 'O2      ', .true."
636 +    write (10, '(a)') "/"
637 +    rewind(10)
638 +    read(10, nml=namtoptrc)
639 +    close (10)
640 +
641 +    if (getal /= 7) call abort
642 +    if (tracer(1)%sname /= 'DIC     ') call abort
643 +    if (tracer(2)%sname /= 'Alkalini') call abort
644 +    if (tracer(3)%sname /= 'O2      ') call abort
645 +    if (.not. tracer(1)%lini) call abort
646 +    if (.not. tracer(2)%lini) call abort
647 +    if (.not. tracer(3)%lini) call abort
648 +
649 +end program testje
650 Index: gcc/testsuite/gfortran.dg/size_kind_2.f90
651 ===================================================================
652 --- gcc/testsuite/gfortran.dg/size_kind_2.f90   (.../tags/gcc_4_7_3_release)    (revision 0)
653 +++ gcc/testsuite/gfortran.dg/size_kind_2.f90   (.../branches/gcc-4_7-branch)   (revision 198690)
654 @@ -0,0 +1,17 @@
655 +! { dg-do compile }
656 +! { dg-options "-fdump-tree-original" }
657 +!
658 +! PR fortran/57142
659 +!
660 +integer :: B(huge(1)+3_8,2_8)
661 +integer(8) :: var1(2), var2, var3
662 +
663 +var1 = shape(B,kind=8)
664 +var2 = size(B,kind=8)
665 +var3 = size(B,dim=1,kind=8)
666 +end
667 +
668 +! { dg-final { scan-tree-dump "static integer.kind=8. A..\\\[2\\\] = \\\{2147483650, 2\\\};" "original" } }
669 +! { dg-final { scan-tree-dump "var2 = 4294967300;" "original" } }
670 +! { dg-final { scan-tree-dump "var3 = 2147483650;" "original" } }
671 +! { dg-final { cleanup-tree-dump "original" } }
672 Index: gcc/testsuite/gfortran.dg/proc_ptr_41.f90
673 ===================================================================
674 --- gcc/testsuite/gfortran.dg/proc_ptr_41.f90   (.../tags/gcc_4_7_3_release)    (revision 0)
675 +++ gcc/testsuite/gfortran.dg/proc_ptr_41.f90   (.../branches/gcc-4_7-branch)   (revision 198690)
676 @@ -0,0 +1,37 @@
677 +! { dg-do compile }
678 +!
679 +! PR 56968: [4.7/4.8/4.9 Regression] [F03] Issue with a procedure defined with a generic name returning procedure pointer
680 +!
681 +! Contributed by Samuel Debionne <samuel.debionne@ujf-grenoble.fr>
682 +
683 +module test
684 +
685 +  interface generic_name_get_proc_ptr
686 +    module procedure specific_name_get_proc_ptr
687 +  end interface
688 +
689 +  abstract interface
690 +    double precision function foo(arg1)
691 +      real, intent(in) :: arg1
692 +    end function
693 +  end interface
694 +
695 +contains
696 +
697 +  function specific_name_get_proc_ptr() result(res)
698 +    procedure(foo), pointer :: res
699 +  end function
700 +
701 +end module test
702 +
703 +program crash_test
704 +    use :: test
705 +
706 +    procedure(foo), pointer :: ptr
707 +
708 +    ptr => specific_name_get_proc_ptr()
709 +    ptr => generic_name_get_proc_ptr()
710 +
711 +end program
712 +
713 +! { dg-final { cleanup-modules "test" } }
714 Index: gcc/testsuite/gfortran.dg/namelist_81.f90
715 ===================================================================
716 --- gcc/testsuite/gfortran.dg/namelist_81.f90   (.../tags/gcc_4_7_3_release)    (revision 0)
717 +++ gcc/testsuite/gfortran.dg/namelist_81.f90   (.../branches/gcc-4_7-branch)   (revision 198690)
718 @@ -0,0 +1,43 @@
719 +! { dg-do run }
720 +! PR56786 Error on embedded spaces
721 +integer :: i(3)
722 +namelist /nml/ i
723 +
724 +i = -42
725 +open(99,status='scratch')
726 +write(99,'(a)') '&nml i(3 ) = 5 /'
727 +rewind(99)
728 +read(99,nml=nml)
729 +close(99)
730 +if (i(1)/=-42 .or. i(2)/=-42 .or. i(3)/=5) call abort()
731 +
732 +! Shorten the file so the read hits EOF
733 +
734 +open(99,status='scratch')
735 +write(99,'(a)') '&nml i(3 ) = 5 '
736 +rewind(99)
737 +read(99,nml=nml, end=30)
738 +call abort()
739 +! Shorten some more
740 + 30 close(99)
741 +open(99,status='scratch')
742 +write(99,'(a)') '&nml i(3 ) ='
743 +rewind(99)
744 +read(99,nml=nml, end=40)
745 +call abort()
746 +! Shorten some more
747 + 40 close(99)
748 +open(99,status='scratch')
749 +write(99,'(a)') '&nml i(3 )'
750 +rewind(99)
751 +read(99,nml=nml, end=50)
752 +call abort()
753 +! Shorten some more
754 + 50 close(99)
755 +open(99,status='scratch')
756 +write(99,'(a)') '&nml i(3 '
757 +rewind(99)
758 +read(99,nml=nml, end=60)
759 +call abort()
760 + 60 close(99)
761 +end
762 Index: gcc/testsuite/gfortran.dg/namelist_78.f90
763 ===================================================================
764 --- gcc/testsuite/gfortran.dg/namelist_78.f90   (.../tags/gcc_4_7_3_release)    (revision 0)
765 +++ gcc/testsuite/gfortran.dg/namelist_78.f90   (.../branches/gcc-4_7-branch)   (revision 198690)
766 @@ -0,0 +1,34 @@
767 +! { dg-do run }
768 +!
769 +! PR libfortran/51825
770 +! Test case regarding namelist problems with derived types
771 +
772 +program namelist
773 +
774 +    type d1
775 +        integer :: j = 0
776 +    end type d1
777 +
778 +    type d2
779 +        type(d1) k
780 +    end type d2
781 +
782 +    type d3
783 +        type(d2) d(2)
784 +    end type d3
785 +
786 +    type(d3) der
787 +    namelist /nmlst/ der
788 +
789 +    open (10, status='scratch')
790 +    write (10, '(a)') "&NMLST"
791 +    write (10, '(a)') " DER%D(1)%K%J = 1,"
792 +    write (10, '(a)') " DER%D(2)%K%J = 2,"
793 +    write (10, '(a)') "/"
794 +    rewind(10)
795 +    read(10, nml=nmlst)
796 +    close (10)
797 +
798 +    if (der%d(1)%k%j /= 1) call abort
799 +    if (der%d(2)%k%j /= 2) call abort
800 +end program namelist
801 Index: gcc/testsuite/gcc.c-torture/execute/pr56866.c
802 ===================================================================
803 --- gcc/testsuite/gcc.c-torture/execute/pr56866.c       (.../tags/gcc_4_7_3_release)    (revision 0)
804 +++ gcc/testsuite/gcc.c-torture/execute/pr56866.c       (.../branches/gcc-4_7-branch)   (revision 198690)
805 @@ -0,0 +1,45 @@
806 +/* PR target/56866 */
807 +
808 +int
809 +main ()
810 +{
811 +#if __CHAR_BIT__ == 8 && __SIZEOF_LONG_LONG__ == 8 && __SIZEOF_INT__ == 4 && __SIZEOF_SHORT__ == 2
812 +  unsigned long long wq[256], rq[256];
813 +  unsigned int wi[256], ri[256];
814 +  unsigned short ws[256], rs[256];
815 +  unsigned char wc[256], rc[256];
816 +  int t;
817 +
818 +  __builtin_memset (wq, 0, sizeof wq);
819 +  __builtin_memset (wi, 0, sizeof wi);
820 +  __builtin_memset (ws, 0, sizeof ws);
821 +  __builtin_memset (wc, 0, sizeof wc);
822 +  wq[0] = 0x0123456789abcdefULL;
823 +  wi[0] = 0x01234567;
824 +  ws[0] = 0x4567;
825 +  wc[0] = 0x73;
826 +
827 +  asm volatile ("" : : "g" (wq), "g" (wi), "g" (ws), "g" (wc) : "memory");
828 +
829 +  for (t = 0; t < 256; ++t)
830 +    rq[t] = (wq[t] >> 8) | (wq[t] << (sizeof (wq[0]) * __CHAR_BIT__ - 8));
831 +  for (t = 0; t < 256; ++t)
832 +    ri[t] = (wi[t] >> 8) | (wi[t] << (sizeof (wi[0]) * __CHAR_BIT__ - 8));
833 +  for (t = 0; t < 256; ++t)
834 +    rs[t] = (ws[t] >> 9) | (ws[t] << (sizeof (ws[0]) * __CHAR_BIT__ - 9));
835 +  for (t = 0; t < 256; ++t)
836 +    rc[t] = (wc[t] >> 5) | (wc[t] << (sizeof (wc[0]) * __CHAR_BIT__ - 5));
837 +
838 +  asm volatile ("" : : "g" (rq), "g" (ri), "g" (rs), "g" (rc) : "memory");
839 +
840 +  if (rq[0] != 0xef0123456789abcdULL || rq[1])
841 +    __builtin_abort ();
842 +  if (ri[0] != 0x67012345 || ri[1])
843 +    __builtin_abort ();
844 +  if (rs[0] != 0xb3a2 || rs[1])
845 +    __builtin_abort ();
846 +  if (rc[0] != 0x9b || rc[1])
847 +    __builtin_abort ();
848 +#endif
849 +  return 0;
850 +}
851 Index: gcc/testsuite/gcc.dg/pr56890-2.c
852 ===================================================================
853 --- gcc/testsuite/gcc.dg/pr56890-2.c    (.../tags/gcc_4_7_3_release)    (revision 0)
854 +++ gcc/testsuite/gcc.dg/pr56890-2.c    (.../branches/gcc-4_7-branch)   (revision 198690)
855 @@ -0,0 +1,19 @@
856 +/* PR target/56890 */
857 +/* Reported by Rainer Jung <rainer.jung@kippdata.de> */
858 +
859 +/* { dg-do assemble } */
860 +/* { dg-options "-O" } */
861 +
862 +unsigned int buggy(unsigned int min, unsigned int max)
863 +{
864 +    unsigned int number;
865 +    if (max < 16384) {
866 +        unsigned short num16;
867 +        num16 = min + (long) ((double) (max - min + 1.0) * (num16 / (65535 + 1.0)));
868 +        return num16;
869 +    }
870 +    else {
871 +        (number) = min + (long) ((double) (max - min + 1.0) * (number / (4294967295U + 1.0)));
872 +    }
873 +    return number;
874 +}
875 Index: gcc/testsuite/gcc.dg/pr48189.c
876 ===================================================================
877 --- gcc/testsuite/gcc.dg/pr48189.c      (.../tags/gcc_4_7_3_release)    (revision 0)
878 +++ gcc/testsuite/gcc.dg/pr48189.c      (.../branches/gcc-4_7-branch)   (revision 198690)
879 @@ -0,0 +1,13 @@
880 +/* PR tree-optimization/48189 */
881 +/* { dg-do compile } */
882 +/* { dg-options "-O --param max-predicted-iterations=0" } */
883 +
884 +struct S { int s[8]; };
885 +  
886 +void
887 +foo (int *x, struct S *y)
888 +{
889 +  int i;
890 +  for (i = 0; y[i].s[i]; i++)
891 +    *x++ = y[i].s[i];
892 +}
893 Index: gcc/testsuite/gcc.dg/torture/builtin-logb-1.c
894 ===================================================================
895 --- gcc/testsuite/gcc.dg/torture/builtin-logb-1.c       (.../tags/gcc_4_7_3_release)    (revision 198690)
896 +++ gcc/testsuite/gcc.dg/torture/builtin-logb-1.c       (.../branches/gcc-4_7-branch)   (revision 198690)
897 @@ -48,25 +48,25 @@
898  /* Test if FUNCRES(FUNC(NEG FUNCARG(ARGARG))) is false.  Check the
899     sign as well.  */
900  #ifndef __SPU__
901 -#define TESTIT3(FUNC,NEG,FUNCARG,ARGARG,FUNCRES) do { \
902 +#define TESTIT3(FUNC,NEG,FUNCARG,ARGARG,FUNCRES,NEG2) do { \
903    if (!__builtin_##FUNCRES##f(__builtin_##FUNC(NEG __builtin_##FUNCARG##f(ARGARG))) \
904 -      || CKSGN_F(__builtin_##FUNC##f(NEG __builtin_##FUNCARG##f(ARGARG)), NEG __builtin_##FUNCARG##f(ARGARG))) \
905 +      || CKSGN_F(__builtin_##FUNC##f(NEG __builtin_##FUNCARG##f(ARGARG)), NEG2 __builtin_##FUNCARG##f(ARGARG))) \
906      link_error(__LINE__); \
907    if (!__builtin_##FUNCRES(__builtin_##FUNC(NEG __builtin_##FUNCARG(ARGARG))) \
908 -      || CKSGN(__builtin_##FUNC(NEG __builtin_##FUNCARG(ARGARG)), NEG __builtin_##FUNCARG(ARGARG))) \
909 +      || CKSGN(__builtin_##FUNC(NEG __builtin_##FUNCARG(ARGARG)), NEG2 __builtin_##FUNCARG(ARGARG))) \
910      link_error(__LINE__); \
911    if (!__builtin_##FUNCRES##l(__builtin_##FUNC##l(NEG __builtin_##FUNCARG##l(ARGARG))) \
912 -      || CKSGN_L(__builtin_##FUNC##l(NEG __builtin_##FUNCARG##l(ARGARG)), NEG __builtin_##FUNCARG##l(ARGARG))) \
913 +      || CKSGN_L(__builtin_##FUNC##l(NEG __builtin_##FUNCARG##l(ARGARG)), NEG2 __builtin_##FUNCARG##l(ARGARG))) \
914      link_error(__LINE__); \
915    } while (0)
916  #else
917 -#define TESTIT3(FUNC,NEG,FUNCARG,ARGARG,FUNCRES) do { \
918 +#define TESTIT3(FUNC,NEG,FUNCARG,ARGARG,FUNCRES,NEG2) do { \
919    /* SPU single-precision floating point format does not support Inf or Nan.  */ \
920    if (!__builtin_##FUNCRES(__builtin_##FUNC(NEG __builtin_##FUNCARG(ARGARG))) \
921 -      || CKSGN(__builtin_##FUNC(NEG __builtin_##FUNCARG(ARGARG)), NEG __builtin_##FUNCARG(ARGARG))) \
922 +      || CKSGN(__builtin_##FUNC(NEG __builtin_##FUNCARG(ARGARG)), NEG2 __builtin_##FUNCARG(ARGARG))) \
923      link_error(__LINE__); \
924    if (!__builtin_##FUNCRES##l(__builtin_##FUNC##l(NEG __builtin_##FUNCARG##l(ARGARG))) \
925 -      || CKSGN_L(__builtin_##FUNC##l(NEG __builtin_##FUNCARG##l(ARGARG)), NEG __builtin_##FUNCARG##l(ARGARG))) \
926 +      || CKSGN_L(__builtin_##FUNC##l(NEG __builtin_##FUNCARG##l(ARGARG)), NEG2 __builtin_##FUNCARG##l(ARGARG))) \
927      link_error(__LINE__); \
928    } while (0)
929  #endif
930 @@ -173,15 +173,15 @@
931  
932    /* Test for f(+-Inf) -> +-Inf and f(+-NaN) -> +-NaN, regardless of
933       the radix.  */
934 -  TESTIT3 (logb, ,inf, , isinf);
935 -  TESTIT3 (logb, - ,inf, , isinf);
936 -  TESTIT3 (logb,  ,nan, "", isnan);
937 -  TESTIT3 (logb, - ,nan, "", isnan);
938 +  TESTIT3 (logb, ,inf, , isinf, );
939 +  TESTIT3 (logb, - ,inf, , isinf, );
940 +  TESTIT3 (logb,  ,nan, "", isnan, );
941 +  TESTIT3 (logb, - ,nan, "", isnan, -);
942  
943 -  TESTIT3 (significand, ,inf, , isinf);
944 -  TESTIT3 (significand, - ,inf, , isinf);
945 -  TESTIT3 (significand,  ,nan, "", isnan);
946 -  TESTIT3 (significand, - ,nan, "", isnan);
947 +  TESTIT3 (significand, ,inf, , isinf, );
948 +  TESTIT3 (significand, - ,inf, , isinf, -);
949 +  TESTIT3 (significand,  ,nan, "", isnan, );
950 +  TESTIT3 (significand, - ,nan, "", isnan, -);
951  }
952  
953  int main()
954 Index: gcc/testsuite/gcc.dg/torture/pr53922.c
955 ===================================================================
956 --- gcc/testsuite/gcc.dg/torture/pr53922.c      (.../tags/gcc_4_7_3_release)    (revision 198690)
957 +++ gcc/testsuite/gcc.dg/torture/pr53922.c      (.../branches/gcc-4_7-branch)   (revision 198690)
958 @@ -1,6 +1,7 @@
959  /* { dg-do run } */
960  /* { dg-require-weak "" } */
961 -/* { dg-skip-if "No undefined weak" { hppa*-*-hpux* && { ! lp64 } } { "*" } { "" } } */
962 +/* { dg-skip-if "No undefined weak" { alpha*-*-osf* } } */
963 +/* { dg-skip-if "No undefined weak" { hppa*-*-hpux* && { ! lp64 } } } */
964  
965  int x(int a)
966  {
967 Index: gcc/testsuite/gcc.dg/pr56890-1.c
968 ===================================================================
969 --- gcc/testsuite/gcc.dg/pr56890-1.c    (.../tags/gcc_4_7_3_release)    (revision 0)
970 +++ gcc/testsuite/gcc.dg/pr56890-1.c    (.../branches/gcc-4_7-branch)   (revision 198690)
971 @@ -0,0 +1,15 @@
972 +/* PR target/56890 */
973 +/* Reported by Rainer Jung <rainer.jung@kippdata.de> */
974 +
975 +/* { dg-do assemble } */
976 +/* { dg-options "-O2" } */
977 +
978 +unsigned int buggy(unsigned int min, unsigned int max)
979 +{
980 +    if (max < 16384) {
981 +        unsigned short num16 = 0;
982 +        num16 = min + (long) ((double) (max - min + 1.0) * (num16 / (65535 + 1.0)));
983 +        return num16;
984 +    }
985 +    return 0;
986 +}
987 Index: gcc/testsuite/ChangeLog
988 ===================================================================
989 --- gcc/testsuite/ChangeLog     (.../tags/gcc_4_7_3_release)    (revision 198690)
990 +++ gcc/testsuite/ChangeLog     (.../branches/gcc-4_7-branch)   (revision 198690)
991 @@ -1,3 +1,97 @@
992 +2013-05-07  Tobias Burnus  <burnus@net-b.de>
993 +
994 +       Backport from mainline
995 +       2013-05-02  Tobias Burnus  <burnus@net-b.de>
996 +
997 +       PR fortran/57142
998 +       * gfortran.dg/size_kind_2.f90: New.
999 +       * gfortran.dg/size_kind_3.f90: New.
1000 +
1001 +2013-05-03  Marek Polacek  <polacek@redhat.com>
1002 +
1003 +       Backport from mainline
1004 +       2013-04-25  Marek Polacek  <polacek@redhat.com>
1005 +
1006 +       PR tree-optimization/57066
1007 +       * gcc.dg/torture/builtin-logb-1.c: Adjust testcase.
1008 +
1009 +2013-04-30  Uros Bizjak  <ubizjak@gmail.com>
1010 +
1011 +       Backport from mainline
1012 +       2013-04-29  Uros Bizjak  <ubizjak@gmail.com>
1013 +
1014 +       PR target/44578
1015 +       * gcc.target/i386/pr44578.c: New test.
1016 +
1017 +       Backport from mainline
1018 +       2013-04-29  Uros Bizjak  <ubizjak@gmail.com>
1019 +
1020 +       PR target/57098
1021 +       * gcc.target/i386/pr57098.c: New test.
1022 +
1023 +2013-04-29  Christian Bruel  <christian.bruel@st.com>
1024 +
1025 +       PR target/57108
1026 +       * gcc.target/sh/pr57108.c: New test.
1027 +
1028 +2013-04-28  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
1029 +
1030 +       Backport from trunk:
1031 +
1032 +       PR fortran/51825
1033 +       * gfortran.dg/namelist_77.f90: New test.
1034 +       * gfortran.dg/namelist_78.f90: New test.
1035 +
1036 +2013-04-28  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
1037 +
1038 +       Backport from trunk:
1039 +
1040 +       PR fortran/56786
1041 +       * gfortran.dg/namelist_81.f90:  New test.
1042 +
1043 +2013-04-28  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
1044 +
1045 +       Backport from trunk:
1046 +
1047 +       PR fortran/52512
1048 +       * gfortran.dg/namelist_79.f90: New test.
1049 +
1050 +2013-04-27  Jakub Jelinek  <jakub@redhat.com>
1051 +
1052 +       PR target/56866
1053 +       * gcc.c-torture/execute/pr56866.c: New test.
1054 +       * gcc.target/i386/pr56866.c: New test.
1055 +
1056 +2013-04-26  Janus Weil  <janus@gcc.gnu.org>
1057 +
1058 +       Backports from trunk:
1059 +
1060 +       PR fortran/56968
1061 +       * gfortran.dg/proc_ptr_41.f90: New.
1062 +
1063 +       PR fortran/53685
1064 +       PR fortran/57022
1065 +       * gfortran.dg/transfer_check_4.f90: New.
1066 +
1067 +2013-04-19  Marek Polacek  <polacek@redhat.com>
1068 +
1069 +       Backport from mainline
1070 +       2013-01-08  Steven Bosscher  <steven@gcc.gnu.org>
1071 +                   Jakub Jelinek  <jakub@redhat.com>
1072 +
1073 +       PR tree-optimization/48189
1074 +       * gcc.dg/pr48189.c: New test.
1075 +
1076 +2013-04-15  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
1077 +
1078 +       * gcc.dg/torture/pr53922.c: Skip on alpha*-*-osf*.
1079 +       Remove dg-skip-if default args.
1080 +
1081 +2013-04-15  Eric Botcazou  <ebotcazou@adacore.com>
1082 +
1083 +       * gcc.dg/pr56890-1.c: New test.
1084 +       * gcc.dg/pr56890-2.c: Likewise.
1085 +
1086  2013-04-11  Release Manager
1087  
1088         * GCC 4.7.3 released.
1089 Index: gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh3.C
1090 ===================================================================
1091 --- gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh3.C      (.../tags/gcc_4_7_3_release)    (revision 0)
1092 +++ gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh3.C      (.../branches/gcc-4_7-branch)   (revision 198690)
1093 @@ -0,0 +1,14 @@
1094 +// PR c++/56388
1095 +// { dg-require-effective-target c++11 }
1096 +
1097 +int main()
1098 +{
1099 +    bool /*const*/ condition = false;
1100 +
1101 +    [&]{
1102 +        try{}
1103 +        catch(...){
1104 +            if(condition){}
1105 +        }
1106 +    }();
1107 +}
1108 Index: gcc/cp/ChangeLog
1109 ===================================================================
1110 --- gcc/cp/ChangeLog    (.../tags/gcc_4_7_3_release)    (revision 198690)
1111 +++ gcc/cp/ChangeLog    (.../branches/gcc-4_7-branch)   (revision 198690)
1112 @@ -1,3 +1,13 @@
1113 +2013-04-21  Eric Botcazou  <ebotcazou@adacore.com>
1114 +
1115 +       * parser.c (cp_parser_late_return_type_opt): Fix C++ism.
1116 +
1117 +2013-04-15  Jason Merrill  <jason@redhat.com>
1118 +
1119 +       PR c++/56388
1120 +       * semantics.c (insert_capture_proxy): Just use index 1 in the
1121 +       stmt_list_stack.
1122 +
1123  2013-04-11  Release Manager
1124  
1125         * GCC 4.7.3 released.
1126 Index: gcc/cp/semantics.c
1127 ===================================================================
1128 --- gcc/cp/semantics.c  (.../tags/gcc_4_7_3_release)    (revision 198690)
1129 +++ gcc/cp/semantics.c  (.../branches/gcc-4_7-branch)   (revision 198690)
1130 @@ -8959,13 +8959,12 @@
1131  insert_capture_proxy (tree var)
1132  {
1133    cp_binding_level *b;
1134 -  int skip;
1135    tree stmt_list;
1136  
1137    /* Put the capture proxy in the extra body block so that it won't clash
1138       with a later local variable.  */
1139    b = current_binding_level;
1140 -  for (skip = 0; ; ++skip)
1141 +  for (;;)
1142      {
1143        cp_binding_level *n = b->level_chain;
1144        if (n->kind == sk_function_parms)
1145 @@ -8976,8 +8975,7 @@
1146  
1147    /* And put a DECL_EXPR in the STATEMENT_LIST for the same block.  */
1148    var = build_stmt (DECL_SOURCE_LOCATION (var), DECL_EXPR, var);
1149 -  stmt_list = VEC_index (tree, stmt_list_stack,
1150 -                        VEC_length (tree, stmt_list_stack) - 1 - skip);
1151 +  stmt_list = VEC_index (tree, stmt_list_stack, 1);
1152    gcc_assert (stmt_list);
1153    append_to_statement_list_force (var, &stmt_list);
1154  }
1155 Index: gcc/cp/parser.c
1156 ===================================================================
1157 --- gcc/cp/parser.c     (.../tags/gcc_4_7_3_release)    (revision 198690)
1158 +++ gcc/cp/parser.c     (.../branches/gcc-4_7-branch)   (revision 198690)
1159 @@ -16691,7 +16691,7 @@
1160  cp_parser_late_return_type_opt (cp_parser* parser, cp_cv_quals quals)
1161  {
1162    cp_token *token;
1163 -  tree type;
1164 +  tree type, save_ccp, save_ccr;
1165  
1166    /* Peek at the next token.  */
1167    token = cp_lexer_peek_token (parser->lexer);
1168 @@ -16702,8 +16702,8 @@
1169    /* Consume the ->.  */
1170    cp_lexer_consume_token (parser->lexer);
1171  
1172 -  tree save_ccp = current_class_ptr;
1173 -  tree save_ccr = current_class_ref;
1174 +  save_ccp = current_class_ptr;
1175 +  save_ccr = current_class_ref;
1176    if (quals >= 0)
1177      {
1178        /* DR 1207: 'this' is in scope in the trailing return type.  */
1179 Index: gcc/dwarf2out.c
1180 ===================================================================
1181 --- gcc/dwarf2out.c     (.../tags/gcc_4_7_3_release)    (revision 198690)
1182 +++ gcc/dwarf2out.c     (.../branches/gcc-4_7-branch)   (revision 198690)
1183 @@ -22538,7 +22538,7 @@
1184    /* Add the name for the main input file now.  We delayed this from
1185       dwarf2out_init to avoid complications with PCH.  */
1186    add_name_attribute (comp_unit_die (), remap_debug_filename (filename));
1187 -  if (!IS_ABSOLUTE_PATH (filename))
1188 +  if (!IS_ABSOLUTE_PATH (filename) || targetm.force_at_comp_dir)
1189      add_comp_dir_attribute (comp_unit_die ());
1190    else if (get_AT (comp_unit_die (), DW_AT_comp_dir) == NULL)
1191      {
1192 Index: gcc/predict.c
1193 ===================================================================
1194 --- gcc/predict.c       (.../tags/gcc_4_7_3_release)    (revision 198690)
1195 +++ gcc/predict.c       (.../branches/gcc-4_7-branch)   (revision 198690)
1196 @@ -983,7 +983,8 @@
1197           if (TREE_CODE (niter) == INTEGER_CST)
1198             {
1199               if (host_integerp (niter, 1)
1200 -                 && compare_tree_int (niter, max-1) == -1)
1201 +                 && max
1202 +                 && compare_tree_int (niter, max - 1) == -1)
1203                 nitercst = tree_low_cst (niter, 1) + 1;
1204               else
1205                 nitercst = max;
1206 @@ -1005,6 +1006,11 @@
1207           else
1208             continue;
1209  
1210 +         /* If the prediction for number of iterations is zero, do not
1211 +            predict the exit edges.  */
1212 +         if (nitercst == 0)
1213 +           continue;
1214 +
1215           probability = ((REG_BR_PROB_BASE + nitercst / 2) / nitercst);
1216           predict_edge (ex, predictor, probability);
1217         }
1218 Index: gcc/fortran/ChangeLog
1219 ===================================================================
1220 --- gcc/fortran/ChangeLog       (.../tags/gcc_4_7_3_release)    (revision 198690)
1221 +++ gcc/fortran/ChangeLog       (.../branches/gcc-4_7-branch)   (revision 198690)
1222 @@ -1,3 +1,39 @@
1223 +2013-05-07  Tobias Burnus  <burnus@net-b.de>
1224 +
1225 +       Backport from mainline
1226 +       2013-05-02  Tobias Burnus  <burnus@net-b.de>
1227 +
1228 +       PR fortran/57142
1229 +       * simplify.c (gfc_simplify_size): Renamed from
1230 +       simplify_size; fix kind=8 handling.
1231 +       (gfc_simplify_size): New function.
1232 +       (gfc_simplify_shape): Add range check.
1233 +       * resolve.c (resolve_function): Fix handling
1234 +       for ISYM_SIZE.
1235 +
1236 +2013-04-26  Janus Weil  <janus@gcc.gnu.org>
1237 +
1238 +       Backports from trunk:
1239 +
1240 +       PR fortran/56968
1241 +       * expr.c (gfc_check_pointer_assign): Handle generic functions returning
1242 +       procedure pointers.
1243 +
1244 +       PR fortran/53685
1245 +       PR fortran/57022
1246 +       * check.c (gfc_calculate_transfer_sizes): Fix for array-valued SOURCE
1247 +       expressions.
1248 +       * target-memory.h (gfc_element_size): New prototype.
1249 +       * target-memory.c (size_array): Remove.
1250 +       (gfc_element_size): New function.
1251 +       (gfc_target_expr_size): Modified to always return the full size of the
1252 +       expression.
1253 +
1254 +2013-04-18  Tobias Burnus  <burnus@net-b.de>
1255 +
1256 +       PR fortran/56994
1257 +       * invoke.texi (NEAREST): S argument is not optional.
1258 +
1259  2013-04-11  Release Manager
1260  
1261         * GCC 4.7.3 released.
1262 Index: gcc/fortran/expr.c
1263 ===================================================================
1264 --- gcc/fortran/expr.c  (.../tags/gcc_4_7_3_release)    (revision 198690)
1265 +++ gcc/fortran/expr.c  (.../branches/gcc-4_7-branch)   (revision 198690)
1266 @@ -3493,8 +3493,12 @@
1267         }
1268        else if (rvalue->expr_type == EXPR_FUNCTION)
1269         {
1270 -         s2 = rvalue->symtree->n.sym->result;
1271 -         name = rvalue->symtree->n.sym->result->name;
1272 +         if (rvalue->value.function.esym)
1273 +           s2 = rvalue->value.function.esym->result;
1274 +         else
1275 +           s2 = rvalue->symtree->n.sym->result;
1276 +
1277 +         name = s2->name;
1278         }
1279        else
1280         {
1281 Index: gcc/fortran/resolve.c
1282 ===================================================================
1283 --- gcc/fortran/resolve.c       (.../tags/gcc_4_7_3_release)    (revision 198690)
1284 +++ gcc/fortran/resolve.c       (.../branches/gcc-4_7-branch)   (revision 198690)
1285 @@ -3155,6 +3155,7 @@
1286        for (arg = expr->value.function.actual; arg; arg = arg->next)
1287         {
1288           if ((GENERIC_ID == GFC_ISYM_UBOUND || GENERIC_ID == GFC_ISYM_SIZE)
1289 +             && arg == expr->value.function.actual
1290               && arg->next != NULL && arg->next->expr)
1291             {
1292               if (arg->next->expr->expr_type != EXPR_CONSTANT)
1293 Index: gcc/fortran/target-memory.c
1294 ===================================================================
1295 --- gcc/fortran/target-memory.c (.../tags/gcc_4_7_3_release)    (revision 198690)
1296 +++ gcc/fortran/target-memory.c (.../branches/gcc-4_7-branch)   (revision 198690)
1297 @@ -35,17 +35,7 @@
1298  /* --------------------------------------------------------------- */ 
1299  /* Calculate the size of an expression.  */
1300  
1301 -static size_t
1302 -size_array (gfc_expr *e)
1303 -{
1304 -  mpz_t array_size;
1305 -  gfc_constructor *c = gfc_constructor_first (e->value.constructor);
1306 -  size_t elt_size = gfc_target_expr_size (c->expr);
1307  
1308 -  gfc_array_size (e, &array_size);
1309 -  return (size_t)mpz_get_ui (array_size) * elt_size;
1310 -}
1311 -
1312  static size_t
1313  size_integer (int kind)
1314  {
1315 @@ -82,16 +72,14 @@
1316  }
1317  
1318  
1319 +/* Return the size of a single element of the given expression.
1320 +   Identical to gfc_target_expr_size for scalars.  */
1321 +
1322  size_t
1323 -gfc_target_expr_size (gfc_expr *e)
1324 +gfc_element_size (gfc_expr *e)
1325  {
1326    tree type;
1327  
1328 -  gcc_assert (e != NULL);
1329 -
1330 -  if (e->expr_type == EXPR_ARRAY)
1331 -    return size_array (e);
1332 -
1333    switch (e->ts.type)
1334      {
1335      case BT_INTEGER:
1336 @@ -130,12 +118,36 @@
1337         return int_size_in_bytes (type);
1338        }
1339      default:
1340 -      gfc_internal_error ("Invalid expression in gfc_target_expr_size.");
1341 +      gfc_internal_error ("Invalid expression in gfc_element_size.");
1342        return 0;
1343      }
1344  }
1345  
1346  
1347 +/* Return the size of an expression in its target representation.  */
1348 +
1349 +size_t
1350 +gfc_target_expr_size (gfc_expr *e)
1351 +{
1352 +  mpz_t tmp;
1353 +  size_t asz;
1354 +
1355 +  gcc_assert (e != NULL);
1356 +
1357 +  if (e->rank)
1358 +    {
1359 +      if (gfc_array_size (e, &tmp))
1360 +       asz = mpz_get_ui (tmp);
1361 +      else
1362 +       asz = 0;
1363 +    }
1364 +  else
1365 +    asz = 1;
1366 +
1367 +  return asz * gfc_element_size (e);
1368 +}
1369 +
1370 +
1371  /* The encode_* functions export a value into a buffer, and 
1372     return the number of bytes of the buffer that have been
1373     used.  */
1374 Index: gcc/fortran/target-memory.h
1375 ===================================================================
1376 --- gcc/fortran/target-memory.h (.../tags/gcc_4_7_3_release)    (revision 198690)
1377 +++ gcc/fortran/target-memory.h (.../branches/gcc-4_7-branch)   (revision 198690)
1378 @@ -25,7 +25,7 @@
1379  /* Convert a BOZ to REAL or COMPLEX.  */
1380  bool gfc_convert_boz (gfc_expr *, gfc_typespec *);
1381  
1382 -/* Return the size of an expression in its target representation.  */
1383 +size_t gfc_element_size (gfc_expr *);
1384  size_t gfc_target_expr_size (gfc_expr *);
1385  
1386  /* Write a constant expression in binary form to a target buffer.  */
1387 Index: gcc/fortran/check.c
1388 ===================================================================
1389 --- gcc/fortran/check.c (.../tags/gcc_4_7_3_release)    (revision 198690)
1390 +++ gcc/fortran/check.c (.../branches/gcc-4_7-branch)   (revision 198690)
1391 @@ -3988,8 +3988,6 @@
1392                               size_t *result_length_p)
1393  {
1394    size_t result_elt_size;
1395 -  mpz_t tmp;
1396 -  gfc_expr *mold_element;
1397  
1398    if (source->expr_type == EXPR_FUNCTION)
1399      return FAILURE;
1400 @@ -3998,20 +3996,12 @@
1401      return FAILURE;
1402  
1403    /* Calculate the size of the source.  */
1404 -  if (source->expr_type == EXPR_ARRAY
1405 -      && gfc_array_size (source, &tmp) == FAILURE)
1406 -    return FAILURE;
1407 -
1408    *source_size = gfc_target_expr_size (source);
1409    if (*source_size == 0)
1410      return FAILURE;
1411  
1412 -  mold_element = mold->expr_type == EXPR_ARRAY
1413 -                ? gfc_constructor_first (mold->value.constructor)->expr
1414 -                : mold;
1415 -
1416    /* Determine the size of the element.  */
1417 -  result_elt_size = gfc_target_expr_size (mold_element);
1418 +  result_elt_size = gfc_element_size (mold);
1419    if (result_elt_size == 0)
1420      return FAILURE;
1421  
1422 Index: gcc/fortran/intrinsic.texi
1423 ===================================================================
1424 --- gcc/fortran/intrinsic.texi  (.../tags/gcc_4_7_3_release)    (revision 198690)
1425 +++ gcc/fortran/intrinsic.texi  (.../branches/gcc-4_7-branch)   (revision 198690)
1426 @@ -9209,7 +9209,7 @@
1427  @item @emph{Arguments}:
1428  @multitable @columnfractions .15 .70
1429  @item @var{X} @tab Shall be of type @code{REAL}.
1430 -@item @var{S} @tab (Optional) shall be of type @code{REAL} and
1431 +@item @var{S} @tab Shall be of type @code{REAL} and
1432  not equal to zero.
1433  @end multitable
1434  
1435 Index: gcc/fortran/simplify.c
1436 ===================================================================
1437 --- gcc/fortran/simplify.c      (.../tags/gcc_4_7_3_release)    (revision 198690)
1438 +++ gcc/fortran/simplify.c      (.../branches/gcc-4_7-branch)   (revision 198690)
1439 @@ -32,7 +32,9 @@
1440  
1441  gfc_expr gfc_bad_expr;
1442  
1443 +static gfc_expr *simplify_size (gfc_expr *, gfc_expr *, int);
1444  
1445 +
1446  /* Note that 'simplification' is not just transforming expressions.
1447     For functions that are not simplified at compile time, range
1448     checking is done if possible.
1449 @@ -3240,7 +3242,7 @@
1450           gfc_expr* dim = result;
1451           mpz_set_si (dim->value.integer, d);
1452  
1453 -         result = gfc_simplify_size (array, dim, kind);
1454 +         result = simplify_size (array, dim, k);
1455           gfc_free_expr (dim);
1456           if (!result)
1457             goto returnNull;
1458 @@ -5493,15 +5495,12 @@
1459        e = gfc_get_constant_expr (BT_INTEGER, k, &source->where);
1460  
1461        if (t == SUCCESS)
1462 -       {
1463 -         mpz_set (e->value.integer, shape[n]);
1464 -         mpz_clear (shape[n]);
1465 -       }
1466 +       mpz_set (e->value.integer, shape[n]);
1467        else
1468         {
1469           mpz_set_ui (e->value.integer, n + 1);
1470  
1471 -         f = gfc_simplify_size (source, e, NULL);
1472 +         f = simplify_size (source, e, k);
1473           gfc_free_expr (e);
1474           if (f == NULL)
1475             {
1476 @@ -5512,24 +5511,31 @@
1477             e = f;
1478         }
1479  
1480 +      if (e == &gfc_bad_expr || range_check (e, "SHAPE") == &gfc_bad_expr)
1481 +       {
1482 +         gfc_free_expr (result);
1483 +         if (t)
1484 +           gfc_clear_shape (shape, source->rank);
1485 +         return &gfc_bad_expr;
1486 +       }
1487 +
1488        gfc_constructor_append_expr (&result->value.constructor, e, NULL);
1489      }
1490  
1491 +  if (t)
1492 +    gfc_clear_shape (shape, source->rank);
1493 +
1494    return result;
1495  }
1496  
1497  
1498 -gfc_expr *
1499 -gfc_simplify_size (gfc_expr *array, gfc_expr *dim, gfc_expr *kind)
1500 +static gfc_expr *
1501 +simplify_size (gfc_expr *array, gfc_expr *dim, int k)
1502  {
1503    mpz_t size;
1504    gfc_expr *return_value;
1505    int d;
1506 -  int k = get_kind (BT_INTEGER, kind, "SIZE", gfc_default_integer_kind);
1507  
1508 -  if (k == -1)
1509 -    return &gfc_bad_expr;
1510 -
1511    /* For unary operations, the size of the result is given by the size
1512       of the operand.  For binary ones, it's the size of the first operand
1513       unless it is scalar, then it is the size of the second.  */
1514 @@ -5558,7 +5564,7 @@
1515               replacement = array->value.op.op1;
1516             else
1517               {
1518 -               simplified = gfc_simplify_size (array->value.op.op1, dim, kind);
1519 +               simplified = simplify_size (array->value.op.op1, dim, k);
1520                 if (simplified)
1521                   return simplified;
1522  
1523 @@ -5568,18 +5574,20 @@
1524         }
1525  
1526        /* Try to reduce it directly if possible.  */
1527 -      simplified = gfc_simplify_size (replacement, dim, kind);
1528 +      simplified = simplify_size (replacement, dim, k);
1529  
1530        /* Otherwise, we build a new SIZE call.  This is hopefully at least
1531          simpler than the original one.  */
1532        if (!simplified)
1533 -       simplified = gfc_build_intrinsic_call (gfc_current_ns,
1534 -                                              GFC_ISYM_SIZE, "size",
1535 -                                              array->where, 3,
1536 -                                              gfc_copy_expr (replacement),
1537 -                                              gfc_copy_expr (dim),
1538 -                                              gfc_copy_expr (kind));
1539 -
1540 +       {
1541 +         gfc_expr *kind = gfc_get_int_expr (gfc_default_integer_kind, NULL, k);
1542 +         simplified = gfc_build_intrinsic_call (gfc_current_ns,
1543 +                                                GFC_ISYM_SIZE, "size",
1544 +                                                array->where, 3,
1545 +                                                gfc_copy_expr (replacement),
1546 +                                                gfc_copy_expr (dim),
1547 +                                                kind);
1548 +       }
1549        return simplified;
1550      }
1551  
1552 @@ -5598,13 +5606,32 @@
1553         return NULL;
1554      }
1555  
1556 -  return_value = gfc_get_int_expr (k, &array->where, mpz_get_si (size));
1557 +  return_value = gfc_get_constant_expr (BT_INTEGER, k, &array->where);
1558 +  mpz_set (return_value->value.integer, size);
1559    mpz_clear (size);
1560 +
1561    return return_value;
1562  }
1563  
1564  
1565  gfc_expr *
1566 +gfc_simplify_size (gfc_expr *array, gfc_expr *dim, gfc_expr *kind)
1567 +{
1568 +  gfc_expr *result;
1569 +  int k = get_kind (BT_INTEGER, kind, "SIZE", gfc_default_integer_kind);
1570 +
1571 +  if (k == -1)
1572 +    return &gfc_bad_expr;
1573 +
1574 +  result = simplify_size (array, dim, k);
1575 +  if (result == NULL || result == &gfc_bad_expr)
1576 +    return result;
1577 +
1578 +  return range_check (result, "SIZE");
1579 +}
1580 +
1581 +
1582 +gfc_expr *
1583  gfc_simplify_sign (gfc_expr *x, gfc_expr *y)
1584  {
1585    gfc_expr *result;
1586 Index: gcc/cfgexpand.c
1587 ===================================================================
1588 --- gcc/cfgexpand.c     (.../tags/gcc_4_7_3_release)    (revision 198690)
1589 +++ gcc/cfgexpand.c     (.../branches/gcc-4_7-branch)   (revision 198690)
1590 @@ -3646,6 +3646,8 @@
1591  avoid_complex_debug_insns (rtx insn, rtx *exp_p, int depth)
1592  {
1593    rtx exp = *exp_p;
1594 +  const char *format_ptr;
1595 +  int i, j;
1596  
1597    if (exp == NULL_RTX)
1598      return;
1599 @@ -3668,8 +3670,7 @@
1600        return;
1601      }
1602  
1603 -  const char *format_ptr = GET_RTX_FORMAT (GET_CODE (exp));
1604 -  int i, j;
1605 +  format_ptr = GET_RTX_FORMAT (GET_CODE (exp));
1606    for (i = 0; i < GET_RTX_LENGTH (GET_CODE (exp)); i++)
1607      switch (*format_ptr++)
1608        {
1609 Index: gcc/sched-deps.c
1610 ===================================================================
1611 --- gcc/sched-deps.c    (.../tags/gcc_4_7_3_release)    (revision 198690)
1612 +++ gcc/sched-deps.c    (.../branches/gcc-4_7-branch)   (revision 198690)
1613 @@ -1563,24 +1563,15 @@
1614  add_dependence_list_and_free (struct deps_desc *deps, rtx insn, rtx *listp,
1615                                int uncond, enum reg_note dep_type)
1616  {
1617 -  rtx list, next;
1618 +  add_dependence_list (insn, *listp, uncond, dep_type);
1619  
1620    /* We don't want to short-circuit dependencies involving debug
1621       insns, because they may cause actual dependencies to be
1622       disregarded.  */
1623    if (deps->readonly || DEBUG_INSN_P (insn))
1624 -    {
1625 -      add_dependence_list (insn, *listp, uncond, dep_type);
1626 -      return;
1627 -    }
1628 +    return;
1629  
1630 -  for (list = *listp, *listp = NULL; list ; list = next)
1631 -    {
1632 -      next = XEXP (list, 1);
1633 -      if (uncond || ! sched_insns_conditions_mutex_p (insn, XEXP (list, 0)))
1634 -       add_dependence (insn, XEXP (list, 0), dep_type);
1635 -      free_INSN_LIST_node (list);
1636 -    }
1637 +  free_INSN_LIST_list (listp);
1638  }
1639  
1640  /* Remove all occurences of INSN from LIST.  Return the number of
1641 @@ -1764,6 +1755,15 @@
1642    add_dependence_list_and_free (deps, insn, &deps->pending_jump_insns, 1,
1643                                 REG_DEP_ANTI);
1644  
1645 +  if (DEBUG_INSN_P (insn))
1646 +    {
1647 +      if (for_write)
1648 +       free_INSN_LIST_list (&deps->pending_read_insns);
1649 +      free_INSN_LIST_list (&deps->pending_write_insns);
1650 +      free_INSN_LIST_list (&deps->last_pending_memory_flush);
1651 +      free_INSN_LIST_list (&deps->pending_jump_insns);
1652 +    }
1653 +
1654    if (!deps->readonly)
1655      {
1656        free_EXPR_LIST_list (&deps->pending_write_mems);
1657 @@ -3262,9 +3262,9 @@
1658              SET_REGNO_REG_SET (&deps->reg_last_in_use, i);
1659            }
1660  
1661 -      /* Flush pending lists on jumps, but not on speculative checks.  */
1662 -      if (JUMP_P (insn) && !(sel_sched_p ()
1663 -                             && sel_insn_is_speculation_check (insn)))
1664 +      /* Don't flush pending lists on speculative checks for
1665 +        selective scheduling.  */
1666 +      if (!sel_sched_p () || !sel_insn_is_speculation_check (insn))
1667         flush_pending_lists (deps, insn, true, true);
1668  
1669        reg_pending_barrier = NOT_A_BARRIER;
1670 Index: gcc/config/sparc/sparc.c
1671 ===================================================================
1672 --- gcc/config/sparc/sparc.c    (.../tags/gcc_4_7_3_release)    (revision 198690)
1673 +++ gcc/config/sparc/sparc.c    (.../branches/gcc-4_7-branch)   (revision 198690)
1674 @@ -4207,13 +4207,14 @@
1675     mapped into one sparc_mode_class mode.  */
1676  
1677  enum sparc_mode_class {
1678 -  S_MODE, D_MODE, T_MODE, O_MODE,
1679 +  H_MODE, S_MODE, D_MODE, T_MODE, O_MODE,
1680    SF_MODE, DF_MODE, TF_MODE, OF_MODE,
1681    CC_MODE, CCFP_MODE
1682  };
1683  
1684  /* Modes for single-word and smaller quantities.  */
1685 -#define S_MODES ((1 << (int) S_MODE) | (1 << (int) SF_MODE))
1686 +#define S_MODES \
1687 +  ((1 << (int) H_MODE) | (1 << (int) S_MODE) | (1 << (int) SF_MODE))
1688  
1689  /* Modes for double-word and smaller quantities.  */
1690  #define D_MODES (S_MODES | (1 << (int) D_MODE) | (1 << DF_MODE))
1691 @@ -4224,13 +4225,11 @@
1692  /* Modes for 8-word and smaller quantities.  */
1693  #define O_MODES (T_MODES | (1 << (int) O_MODE) | (1 << (int) OF_MODE))
1694  
1695 -/* Modes for single-float quantities.  We must allow any single word or
1696 -   smaller quantity.  This is because the fix/float conversion instructions
1697 -   take integer inputs/outputs from the float registers.  */
1698 -#define SF_MODES (S_MODES)
1699 +/* Modes for single-float quantities.  */
1700 +#define SF_MODES ((1 << (int) S_MODE) | (1 << (int) SF_MODE))
1701  
1702  /* Modes for double-float and smaller quantities.  */
1703 -#define DF_MODES (D_MODES)
1704 +#define DF_MODES (SF_MODES | (1 << (int) D_MODE) | (1 << DF_MODE))
1705  
1706  /* Modes for quad-float and smaller quantities.  */
1707  #define TF_MODES (DF_MODES | (1 << (int) TF_MODE))
1708 @@ -4326,7 +4325,9 @@
1709         case MODE_INT:
1710         case MODE_PARTIAL_INT:
1711         case MODE_COMPLEX_INT:
1712 -         if (GET_MODE_SIZE (i) <= 4)
1713 +         if (GET_MODE_SIZE (i) < 4)
1714 +           sparc_mode_class[i] = 1 << (int) H_MODE;
1715 +         else if (GET_MODE_SIZE (i) == 4)
1716             sparc_mode_class[i] = 1 << (int) S_MODE;
1717           else if (GET_MODE_SIZE (i) == 8)
1718             sparc_mode_class[i] = 1 << (int) D_MODE;
1719 @@ -4338,14 +4339,16 @@
1720             sparc_mode_class[i] = 0;
1721           break;
1722         case MODE_VECTOR_INT:
1723 -         if (GET_MODE_SIZE (i) <= 4)
1724 -           sparc_mode_class[i] = 1 << (int)SF_MODE;
1725 +         if (GET_MODE_SIZE (i) == 4)
1726 +           sparc_mode_class[i] = 1 << (int) SF_MODE;
1727           else if (GET_MODE_SIZE (i) == 8)
1728 -           sparc_mode_class[i] = 1 << (int)DF_MODE;
1729 +           sparc_mode_class[i] = 1 << (int) DF_MODE;
1730 +         else
1731 +           sparc_mode_class[i] = 0;
1732           break;
1733         case MODE_FLOAT:
1734         case MODE_COMPLEX_FLOAT:
1735 -         if (GET_MODE_SIZE (i) <= 4)
1736 +         if (GET_MODE_SIZE (i) == 4)
1737             sparc_mode_class[i] = 1 << (int) SF_MODE;
1738           else if (GET_MODE_SIZE (i) == 8)
1739             sparc_mode_class[i] = 1 << (int) DF_MODE;
1740 Index: gcc/config/i386/i386.md
1741 ===================================================================
1742 --- gcc/config/i386/i386.md     (.../tags/gcc_4_7_3_release)    (revision 198690)
1743 +++ gcc/config/i386/i386.md     (.../branches/gcc-4_7-branch)   (revision 198690)
1744 @@ -3444,9 +3444,9 @@
1745  })
1746  
1747  (define_insn "*zero_extendsidi2_rex64"
1748 -  [(set (match_operand:DI 0 "nonimmediate_operand"  "=r,o,?*Ym,?*y,?*Yi,*x")
1749 +  [(set (match_operand:DI 0 "nonimmediate_operand"  "=r,o,?*Ym,?!*y,?*Yi,*x")
1750         (zero_extend:DI
1751 -        (match_operand:SI 1 "nonimmediate_operand" "rm,0,r   ,m  ,r   ,m")))]
1752 +        (match_operand:SI 1 "nonimmediate_operand" "rm,0,r   ,m   ,r   ,m")))]
1753    "TARGET_64BIT"
1754    "@
1755     mov{l}\t{%1, %k0|%k0, %1}
1756 @@ -3469,9 +3469,9 @@
1757  
1758  ;; %%% Kill me once multi-word ops are sane.
1759  (define_insn "zero_extendsidi2_1"
1760 -  [(set (match_operand:DI 0 "nonimmediate_operand" "=r,?r,?o,?*Ym,?*y,?*Yi,*x")
1761 +  [(set (match_operand:DI 0 "nonimmediate_operand" "=r,?r,?o,?*Ym,?!*y,?*Yi,*x")
1762         (zero_extend:DI
1763 -        (match_operand:SI 1 "nonimmediate_operand" "0,rm,r ,r   ,m  ,r   ,m")))
1764 +        (match_operand:SI 1 "nonimmediate_operand" "0,rm,r ,r   ,m   ,r   ,m")))
1765     (clobber (reg:CC FLAGS_REG))]
1766    "!TARGET_64BIT"
1767    "@
1768 Index: gcc/config/i386/sse.md
1769 ===================================================================
1770 --- gcc/config/i386/sse.md      (.../tags/gcc_4_7_3_release)    (revision 198690)
1771 +++ gcc/config/i386/sse.md      (.../branches/gcc-4_7-branch)   (revision 198690)
1772 @@ -11167,7 +11167,8 @@
1773          (match_operand:SI 2 "const_0_to_<sserotatemax>_operand" "n")))]
1774    "TARGET_XOP"
1775  {
1776 -  operands[3] = GEN_INT ((<ssescalarnum> * 8) - INTVAL (operands[2]));
1777 +  operands[3]
1778 +    = GEN_INT (GET_MODE_BITSIZE (<ssescalarmode>mode) - INTVAL (operands[2]));
1779    return \"vprot<ssemodesuffix>\t{%3, %1, %0|%0, %1, %3}\";
1780  }
1781    [(set_attr "type" "sseishft")
1782 Index: gcc/config/i386/i386.c
1783 ===================================================================
1784 --- gcc/config/i386/i386.c      (.../tags/gcc_4_7_3_release)    (revision 198690)
1785 +++ gcc/config/i386/i386.c      (.../branches/gcc-4_7-branch)   (revision 198690)
1786 @@ -20026,7 +20026,7 @@
1787               vec[i * 2 + 1] = const1_rtx;
1788             }
1789           vt = gen_rtx_CONST_VECTOR (maskmode, gen_rtvec_v (w, vec));
1790 -         vt = force_const_mem (maskmode, vt);
1791 +         vt = validize_mem (force_const_mem (maskmode, vt));
1792           t1 = expand_simple_binop (maskmode, PLUS, t1, vt, t1, 1,
1793                                     OPTAB_DIRECT);
1794  
1795 @@ -20223,7 +20223,7 @@
1796        for (i = 0; i < 16; ++i)
1797         vec[i] = GEN_INT (i/e * e);
1798        vt = gen_rtx_CONST_VECTOR (V16QImode, gen_rtvec_v (16, vec));
1799 -      vt = force_const_mem (V16QImode, vt);
1800 +      vt = validize_mem (force_const_mem (V16QImode, vt));
1801        if (TARGET_XOP)
1802         emit_insn (gen_xop_pperm (mask, mask, mask, vt));
1803        else
1804 @@ -20234,7 +20234,7 @@
1805        for (i = 0; i < 16; ++i)
1806         vec[i] = GEN_INT (i % e);
1807        vt = gen_rtx_CONST_VECTOR (V16QImode, gen_rtvec_v (16, vec));
1808 -      vt = force_const_mem (V16QImode, vt);
1809 +      vt = validize_mem (force_const_mem (V16QImode, vt));
1810        emit_insn (gen_addv16qi3 (mask, mask, vt));
1811      }
1812  
1813 Index: gcc/config/sh/sh.md
1814 ===================================================================
1815 --- gcc/config/sh/sh.md (.../tags/gcc_4_7_3_release)    (revision 198690)
1816 +++ gcc/config/sh/sh.md (.../branches/gcc-4_7-branch)   (revision 198690)
1817 @@ -654,7 +654,7 @@
1818  
1819  (define_insn "tstsi_t_zero_extract_eq"
1820    [(set (reg:SI T_REG)
1821 -       (eq:SI (zero_extract:SI (match_operand 0 "logical_operand" "z")
1822 +       (eq:SI (zero_extract:SI (match_operand:SI 0 "logical_operand" "z")
1823                 (match_operand:SI 1 "const_int_operand")
1824                 (match_operand:SI 2 "const_int_operand"))
1825           (const_int 0)))]
1826 Index: gcc/config/darwin.h
1827 ===================================================================
1828 --- gcc/config/darwin.h (.../tags/gcc_4_7_3_release)    (revision 198690)
1829 +++ gcc/config/darwin.h (.../branches/gcc-4_7-branch)   (revision 198690)
1830 @@ -356,7 +356,9 @@
1831       %{!Zbundle:%{pg:%{static:-lgcrt0.o}                                   \
1832                       %{!static:%{object:-lgcrt0.o}                         \
1833                                 %{!object:%{preload:-lgcrt0.o}              \
1834 -                                 %{!preload:-lgcrt1.o %(darwin_crt2)}}}}    \
1835 +                                 %{!preload:-lgcrt1.o                       \
1836 +                                 %:version-compare(>= 10.8 mmacosx-version-min= -no_new_main) \
1837 +                                 %(darwin_crt2)}}}}    \
1838                  %{!pg:%{static:-lcrt0.o}                                   \
1839                        %{!static:%{object:-lcrt0.o}                         \
1840                                  %{!object:%{preload:-lcrt0.o}              \
1841 @@ -379,7 +381,7 @@
1842  #define DARWIN_CRT1_SPEC                                               \
1843    "%:version-compare(!> 10.5 mmacosx-version-min= -lcrt1.o)            \
1844     %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lcrt1.10.5.o)  \
1845 -   %:version-compare(>= 10.6 mmacosx-version-min= -lcrt1.10.6.o)       \
1846 +   %:version-compare(>< 10.6 10.8 mmacosx-version-min= -lcrt1.10.6.o)  \
1847     %{fgnu-tm: -lcrttms.o}"
1848  
1849  /* Default Darwin ASM_SPEC, very simple.  */
1850 @@ -414,6 +416,8 @@
1851  
1852  #define TARGET_WANT_DEBUG_PUB_SECTIONS true
1853  
1854 +#define TARGET_FORCE_AT_COMP_DIR true
1855 +
1856  /* When generating stabs debugging, use N_BINCL entries.  */
1857  
1858  #define DBX_USE_BINCL
1859 Index: gcc/config/pa/pa.c
1860 ===================================================================
1861 --- gcc/config/pa/pa.c  (.../tags/gcc_4_7_3_release)    (revision 198690)
1862 +++ gcc/config/pa/pa.c  (.../branches/gcc-4_7-branch)   (revision 198690)
1863 @@ -790,7 +790,9 @@
1864           /* Extract CODE_LABEL.  */
1865           orig = XEXP (orig, 0);
1866           add_reg_note (insn, REG_LABEL_OPERAND, orig);
1867 -         LABEL_NUSES (orig)++;
1868 +         /* Make sure we have label and not a note.  */
1869 +         if (LABEL_P (orig))
1870 +           LABEL_NUSES (orig)++;
1871         }
1872        crtl->uses_pic_offset_table = 1;
1873        return reg;
1874 Index: libgfortran/ChangeLog
1875 ===================================================================
1876 --- libgfortran/ChangeLog       (.../tags/gcc_4_7_3_release)    (revision 198690)
1877 +++ libgfortran/ChangeLog       (.../branches/gcc-4_7-branch)   (revision 198690)
1878 @@ -1,3 +1,38 @@
1879 +2013-04-28  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
1880 +
1881 +       Backport from mainline:
1882 +       2013-03-20  Tilo Schwarz  <tilo@tilo-schwarz.de>
1883 +
1884 +       PR libfortran/51825
1885 +       * io/list_read.c (nml_read_obj): Don't end the component loop on a
1886 +       nested derived type, but continue with the next loop iteration.
1887 +       (nml_get_obj_data): Don't move the first_nl pointer further in the
1888 +       list if a qualifier was found.
1889 +
1890 +2013-04-28  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
1891 +
1892 +       Backport from mainline:
1893 +
1894 +       PR libfortran/56786
1895 +       * io/list_read.c (nml_parse_qualifier): Remove spurious next_char call
1896 +       when checking for EOF. Use error return mechanism when EOF detected.
1897 +       Do not return FAILURE unless parse_err_msg and parse_err_msg_size have
1898 +       been set. Use hit_eof.
1899 +       (nml_get_obj_data): Likewise use the correct error mechanism.
1900 +       * io/transfer.c (hit_eof): Do not set AFTER_ENDFILE if in namelist
1901 +       mode.
1902 +
1903 +2013-04-28  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
1904 +
1905 +       Backport from mainline:
1906 +       2013-03-25  Tilo Schwarz  <tilo@tilo-schwarz.de>
1907 +
1908 +       PR libfortran/52512
1909 +       * io/list_read.c (nml_parse_qualifier): To check for a derived type
1910 +       don't use the namelist head element type but the current element type.
1911 +       (nml_get_obj_data): Add current namelist element type to
1912 +       nml_parse_qualifier call.
1913 +
1914  2013-04-11  Release Manager
1915  
1916         * GCC 4.7.3 released.
1917 Index: libgfortran/io/list_read.c
1918 ===================================================================
1919 --- libgfortran/io/list_read.c  (.../tags/gcc_4_7_3_release)    (revision 198690)
1920 +++ libgfortran/io/list_read.c  (.../branches/gcc-4_7-branch)   (revision 198690)
1921 @@ -2028,8 +2028,8 @@
1922  
1923  static try
1924  nml_parse_qualifier (st_parameter_dt *dtp, descriptor_dimension *ad,
1925 -                    array_loop_spec *ls, int rank, char *parse_err_msg,
1926 -                    size_t parse_err_msg_size,
1927 +                    array_loop_spec *ls, int rank, bt nml_elem_type,
1928 +                    char *parse_err_msg, size_t parse_err_msg_size,
1929                      int *parsed_rank)
1930  {
1931    int dim;
1932 @@ -2053,7 +2053,7 @@
1933    /* The next character in the stream should be the '('.  */
1934  
1935    if ((c = next_char (dtp)) == EOF)
1936 -    return FAILURE;
1937 +    goto err_ret;
1938  
1939    /* Process the qualifier, by dimension and triplet.  */
1940  
1941 @@ -2067,7 +2067,7 @@
1942  
1943           /* Process a potential sign.  */
1944           if ((c = next_char (dtp)) == EOF)
1945 -           return FAILURE;
1946 +           goto err_ret;
1947           switch (c)
1948             {
1949             case '-':
1950 @@ -2085,11 +2085,12 @@
1951           /* Process characters up to the next ':' , ',' or ')'.  */
1952           for (;;)
1953             {
1954 -             if ((c = next_char (dtp)) == EOF)
1955 -               return FAILURE;
1956 -
1957 +             c = next_char (dtp);
1958               switch (c)
1959                 {
1960 +               case EOF:
1961 +                 goto err_ret;
1962 +
1963                 case ':':
1964                    is_array_section = 1;
1965                   break;
1966 @@ -2112,10 +2113,8 @@
1967                   push_char (dtp, c);
1968                   continue;
1969  
1970 -               case ' ': case '\t':
1971 +               case ' ': case '\t': case '\r': case '\n':
1972                   eat_spaces (dtp);
1973 -                 if ((c = next_char (dtp) == EOF))
1974 -                   return FAILURE;
1975                   break;
1976  
1977                 default:
1978 @@ -2204,7 +2203,7 @@
1979                       do not allow excess data to be processed.  */
1980                   if (is_array_section == 1
1981                       || !(compile_options.allow_std & GFC_STD_GNU)
1982 -                     || dtp->u.p.ionml->type == BT_DERIVED)
1983 +                     || nml_elem_type == BT_DERIVED)
1984                     ls[dim].end = ls[dim].start;
1985                   else
1986                     dtp->u.p.expanded_read = 1;
1987 @@ -2257,6 +2256,15 @@
1988  
1989  err_ret:
1990  
1991 +  /* The EOF error message is issued by hit_eof. Return true so that the
1992 +     caller does not use parse_err_msg and parse_err_msg_size to generate
1993 +     an unrelated error message.  */
1994 +  if (c == EOF)
1995 +    {
1996 +      hit_eof (dtp);
1997 +      dtp->u.p.input_complete = 1;
1998 +      return SUCCESS;
1999 +    }
2000    return FAILURE;
2001  }
2002  
2003 @@ -2553,17 +2561,17 @@
2004                since a single object can have multiple reads.  */
2005             dtp->u.p.expanded_read = 0;
2006  
2007 -           /* Now loop over the components. Update the component pointer
2008 -              with the return value from nml_write_obj.  This loop jumps
2009 -              past nested derived types by testing if the potential
2010 -              component name contains '%'.  */
2011 +           /* Now loop over the components.  */
2012  
2013             for (cmp = nl->next;
2014                  cmp &&
2015 -                  !strncmp (cmp->var_name, obj_name, obj_name_len) &&
2016 -                  !strchr (cmp->var_name + obj_name_len, '%');
2017 +                  !strncmp (cmp->var_name, obj_name, obj_name_len);
2018                  cmp = cmp->next)
2019               {
2020 +               /* Jump over nested derived type by testing if the potential
2021 +                  component name contains '%'.  */
2022 +               if (strchr (cmp->var_name + obj_name_len, '%'))
2023 +                   continue;
2024  
2025                 if (nml_read_obj (dtp, cmp, (index_type)(pdata - nl->mem_pos),
2026                                   pprev_nl, nml_err_msg, nml_err_msg_size,
2027 @@ -2726,12 +2734,12 @@
2028      return SUCCESS;
2029  
2030    if ((c = next_char (dtp)) == EOF)
2031 -    return FAILURE;
2032 +    goto nml_err_ret;
2033    switch (c)
2034      {
2035      case '=':
2036        if ((c = next_char (dtp)) == EOF)
2037 -       return FAILURE;
2038 +       goto nml_err_ret;
2039        if (c != '?')
2040         {
2041           snprintf (nml_err_msg, nml_err_msg_size, 
2042 @@ -2781,8 +2789,9 @@
2043        if (!is_separator (c))
2044         push_char (dtp, tolower(c));
2045        if ((c = next_char (dtp)) == EOF)
2046 -       return FAILURE;
2047 -    } while (!( c=='=' || c==' ' || c=='\t' || c =='(' || c =='%' ));
2048 +       goto nml_err_ret;
2049 +    }
2050 +  while (!( c=='=' || c==' ' || c=='\t' || c =='(' || c =='%' ));
2051  
2052    unget_char (dtp, c);
2053  
2054 @@ -2842,7 +2851,7 @@
2055      {
2056        parsed_rank = 0;
2057        if (nml_parse_qualifier (dtp, nl->dim, nl->ls, nl->var_rank,
2058 -                              nml_err_msg, nml_err_msg_size, 
2059 +                              nl->type, nml_err_msg, nml_err_msg_size,
2060                                &parsed_rank) == FAILURE)
2061         {
2062           char *nml_err_msg_end = strchr (nml_err_msg, '\0');
2063 @@ -2857,7 +2866,7 @@
2064        qualifier_flag = 1;
2065  
2066        if ((c = next_char (dtp)) == EOF)
2067 -       return FAILURE;
2068 +       goto nml_err_ret;
2069        unget_char (dtp, c);
2070      }
2071    else if (nl->var_rank > 0)
2072 @@ -2876,14 +2885,15 @@
2073           goto nml_err_ret;
2074         }
2075  
2076 -      if (*pprev_nl == NULL || !component_flag)
2077 +      /* Don't move first_nl further in the list if a qualifier was found.  */
2078 +      if ((*pprev_nl == NULL && !qualifier_flag) || !component_flag)
2079         first_nl = nl;
2080  
2081        root_nl = nl;
2082  
2083        component_flag = 1;
2084        if ((c = next_char (dtp)) == EOF)
2085 -       return FAILURE;
2086 +       goto nml_err_ret;
2087        goto get_name;
2088      }
2089  
2090 @@ -2898,8 +2908,8 @@
2091        descriptor_dimension chd[1] = { {1, clow, nl->string_length} };
2092        array_loop_spec ind[1] = { {1, clow, nl->string_length, 1} };
2093  
2094 -      if (nml_parse_qualifier (dtp, chd, ind, -1, nml_err_msg, 
2095 -                              nml_err_msg_size, &parsed_rank)
2096 +      if (nml_parse_qualifier (dtp, chd, ind, -1, nl->type,
2097 +                              nml_err_msg, nml_err_msg_size, &parsed_rank)
2098           == FAILURE)
2099         {
2100           char *nml_err_msg_end = strchr (nml_err_msg, '\0');
2101 @@ -2921,7 +2931,7 @@
2102         }
2103  
2104        if ((c = next_char (dtp)) == EOF)
2105 -       return FAILURE;
2106 +       goto nml_err_ret;
2107        unget_char (dtp, c);
2108      }
2109  
2110 @@ -2961,7 +2971,7 @@
2111      return SUCCESS;
2112  
2113    if ((c = next_char (dtp)) == EOF)
2114 -    return FAILURE;
2115 +    goto nml_err_ret;
2116  
2117    if (c != '=')
2118      {
2119 @@ -2996,6 +3006,17 @@
2120  
2121  nml_err_ret:
2122  
2123 +  /* The EOF error message is issued by hit_eof. Return true so that the
2124 +     caller does not use nml_err_msg and nml_err_msg_size to generate
2125 +     an unrelated error message.  */
2126 +  if (c == EOF)
2127 +    {
2128 +      dtp->u.p.input_complete = 1;
2129 +      unget_char (dtp, c);
2130 +      hit_eof (dtp);
2131 +      return SUCCESS;
2132 +    }
2133 +
2134    return FAILURE;
2135  }
2136  
2137 Index: libgfortran/io/transfer.c
2138 ===================================================================
2139 --- libgfortran/io/transfer.c   (.../tags/gcc_4_7_3_release)    (revision 198690)
2140 +++ libgfortran/io/transfer.c   (.../branches/gcc-4_7-branch)   (revision 198690)
2141 @@ -3748,7 +3748,7 @@
2142        case NO_ENDFILE:
2143        case AT_ENDFILE:
2144          generate_error (&dtp->common, LIBERROR_END, NULL);
2145 -       if (!is_internal_unit (dtp))
2146 +       if (!is_internal_unit (dtp) && !dtp->u.p.namelist_mode)
2147           {
2148             dtp->u.p.current_unit->endfile = AFTER_ENDFILE;
2149             dtp->u.p.current_unit->current_record = 0;