From: Marcin Krol Date: Tue, 7 May 2013 18:07:56 +0000 (+0000) Subject: - updated branch.diff X-Git-Url: https://git.tld-linux.org/?a=commitdiff_plain;h=e64e20ed3d69b53dffda5dfc97eaaa3f9de78dde;p=packages%2Fgcc.git - updated branch.diff --- diff --git a/gcc-branch.diff b/gcc-branch.diff index b4a3e1f..6dc898c 100644 --- a/gcc-branch.diff +++ b/gcc-branch.diff @@ -1,7 +1,73 @@ +Index: libstdc++-v3/ChangeLog +=================================================================== +--- libstdc++-v3/ChangeLog (.../tags/gcc_4_7_3_release) (revision 198690) ++++ libstdc++-v3/ChangeLog (.../branches/gcc-4_7-branch) (revision 198690) +@@ -1,3 +1,20 @@ ++2013-04-15 Jack Howarth ++ ++ Backport from mainline ++ ++ 2012-10-10 Jack Howarth ++ Jonathan Wakely ++ ++ PR libstdc++/54847 ++ * config/os/bsd/darwin/os_defines.h: Define _GLIBCXX_USE_NANOSLEEP ++ and _GLIBCXX_USE_SCHED_YIELD. ++ * acinclude.m4 (GLIBCXX_ENABLE_LIBSTDCXX_TIME): Add comment. ++ ++2013-04-15 Rainer Orth ++ ++ * testsuite/30_threads/condition_variable/members/53841.cc: Add ++ -std=gnu++0x -pthread on alpha*-*-osf*, mips-sgi-irix6*. ++ + 2013-04-11 Release Manager + + * GCC 4.7.3 released. +Index: libstdc++-v3/testsuite/30_threads/condition_variable/members/53841.cc +=================================================================== +--- libstdc++-v3/testsuite/30_threads/condition_variable/members/53841.cc (.../tags/gcc_4_7_3_release) (revision 198690) ++++ libstdc++-v3/testsuite/30_threads/condition_variable/members/53841.cc (.../branches/gcc-4_7-branch) (revision 198690) +@@ -1,5 +1,5 @@ + // { dg-do compile } +-// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* powerpc-ibm-aix* hppa*-hp-hpux11* } } ++// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* powerpc-ibm-aix* hppa*-hp-hpux11* } } + // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } + // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } + // { dg-require-cstdint "" } +Index: libstdc++-v3/config/os/bsd/darwin/os_defines.h +=================================================================== +--- libstdc++-v3/config/os/bsd/darwin/os_defines.h (.../tags/gcc_4_7_3_release) (revision 198690) ++++ libstdc++-v3/config/os/bsd/darwin/os_defines.h (.../branches/gcc-4_7-branch) (revision 198690) +@@ -42,4 +42,9 @@ + // Static initializer macro is buggy in darwin, see libstdc++/51906 + #define _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC + ++// Configure checks for nanosleep fail on Darwin, but nanosleep and ++// sched_yield are always available, so use them. ++#define _GLIBCXX_USE_NANOSLEEP 1 ++#define _GLIBCXX_USE_SCHED_YIELD 1 ++ + #endif +Index: libstdc++-v3/acinclude.m4 +=================================================================== +--- libstdc++-v3/acinclude.m4 (.../tags/gcc_4_7_3_release) (revision 198690) ++++ libstdc++-v3/acinclude.m4 (.../branches/gcc-4_7-branch) (revision 198690) +@@ -1132,6 +1132,11 @@ + dnl --disable-libstdcxx-time + dnl disables the checks completely + dnl ++dnl N.B. Darwin provides nanosleep but doesn't support the whole POSIX ++dnl Timers option, so doesn't define _POSIX_TIMERS. Because the test ++dnl below fails Darwin unconditionally defines _GLIBCXX_USE_NANOSLEEP in ++dnl os_defines.h and also defines _GLIBCXX_USE_SCHED_YIELD. ++dnl + AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [ + + AC_MSG_CHECKING([for clock_gettime, nanosleep and sched_yield]) Index: libgcc/ChangeLog =================================================================== ---- libgcc/ChangeLog (.../tags/gcc_4_7_3_release) (revision 197943) -+++ libgcc/ChangeLog (.../branches/gcc-4_7-branch) (revision 197943) +--- libgcc/ChangeLog (.../tags/gcc_4_7_3_release) (revision 198690) ++++ libgcc/ChangeLog (.../branches/gcc-4_7-branch) (revision 198690) @@ -1,3 +1,10 @@ +2013-04-11 Julian Brown + @@ -15,8 +81,8 @@ Index: libgcc/ChangeLog * GCC 4.7.3 released. Index: libgcc/config/arm/linux-atomic.c =================================================================== ---- libgcc/config/arm/linux-atomic.c (.../tags/gcc_4_7_3_release) (revision 197943) -+++ libgcc/config/arm/linux-atomic.c (.../branches/gcc-4_7-branch) (revision 197943) +--- libgcc/config/arm/linux-atomic.c (.../tags/gcc_4_7_3_release) (revision 198690) ++++ libgcc/config/arm/linux-atomic.c (.../branches/gcc-4_7-branch) (revision 198690) @@ -97,19 +97,19 @@ return (RETURN & mask) >> shift; \ } @@ -123,10 +189,1961 @@ Index: libgcc/config/arm/linux-atomic.c #define SYNC_LOCK_RELEASE(TYPE, WIDTH) \ void HIDDEN \ +Index: gcc/doc/tm.texi +=================================================================== +--- gcc/doc/tm.texi (.../tags/gcc_4_7_3_release) (revision 198690) ++++ gcc/doc/tm.texi (.../branches/gcc-4_7-branch) (revision 198690) +@@ -9495,6 +9495,10 @@ + 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. + @end deftypevr + ++@deftypevr {Target Hook} bool TARGET_FORCE_AT_COMP_DIR ++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. ++@end deftypevr ++ + @deftypevr {Target Hook} bool TARGET_DELAY_SCHED2 + 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. + @end deftypevr +Index: gcc/doc/tm.texi.in +=================================================================== +--- gcc/doc/tm.texi.in (.../tags/gcc_4_7_3_release) (revision 198690) ++++ gcc/doc/tm.texi.in (.../branches/gcc-4_7-branch) (revision 198690) +@@ -9388,6 +9388,8 @@ + + @hook TARGET_WANT_DEBUG_PUB_SECTIONS + ++@hook TARGET_FORCE_AT_COMP_DIR ++ + @hook TARGET_DELAY_SCHED2 + + @hook TARGET_DELAY_VARTRACK +Index: gcc/target.def +=================================================================== +--- gcc/target.def (.../tags/gcc_4_7_3_release) (revision 198690) ++++ gcc/target.def (.../branches/gcc-4_7-branch) (revision 198690) +@@ -2758,6 +2758,13 @@ + bool, false) + + DEFHOOKPOD ++(force_at_comp_dir, ++ "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.", ++ bool, false) ++ ++DEFHOOKPOD + (delay_sched2, "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.", + bool, false) Index: gcc/DATESTAMP =================================================================== ---- gcc/DATESTAMP (.../tags/gcc_4_7_3_release) (revision 197943) -+++ gcc/DATESTAMP (.../branches/gcc-4_7-branch) (revision 197943) +--- gcc/DATESTAMP (.../tags/gcc_4_7_3_release) (revision 198690) ++++ gcc/DATESTAMP (.../branches/gcc-4_7-branch) (revision 198690) @@ -1 +1 @@ -20130411 -+20130413 ++20130507 +Index: gcc/builtins.c +=================================================================== +--- gcc/builtins.c (.../tags/gcc_4_7_3_release) (revision 198690) ++++ gcc/builtins.c (.../branches/gcc-4_7-branch) (revision 198690) +@@ -9692,7 +9692,16 @@ + case rvc_inf: + /* If arg is Inf or NaN and we're logb, return it. */ + if (TREE_CODE (rettype) == REAL_TYPE) +- return fold_convert_loc (loc, rettype, arg); ++ { ++ /* For logb(-Inf) we have to return +Inf. */ ++ if (real_isinf (value) && real_isneg (value)) ++ { ++ REAL_VALUE_TYPE tem; ++ real_inf (&tem); ++ return build_real (rettype, tem); ++ } ++ return fold_convert_loc (loc, rettype, arg); ++ } + /* Fall through... */ + case rvc_zero: + /* Zero may set errno and/or raise an exception for logb, also +Index: gcc/ChangeLog +=================================================================== +--- gcc/ChangeLog (.../tags/gcc_4_7_3_release) (revision 198690) ++++ gcc/ChangeLog (.../branches/gcc-4_7-branch) (revision 198690) +@@ -1,3 +1,115 @@ ++2013-05-03 Marek Polacek ++ ++ Backport from mainline ++ 2013-04-25 Marek Polacek ++ ++ PR tree-optimization/57066 ++ * builtins.c (fold_builtin_logb): Return +Inf for -Inf. ++ ++2013-04-30 Uros Bizjak ++ ++ Backport from mainline ++ 2013-04-29 Uros Bizjak ++ ++ PR target/44578 ++ * config/i386/i386.md (*zero_extendsidi2_rex64): Add "!" to m->?*y ++ alternative. ++ (*zero_extendsidi2): Ditto. ++ ++ Backport from mainline ++ 2013-04-29 Uros Bizjak ++ ++ PR target/57098 ++ * config/i386/i386.c (ix86_expand_vec_perm): Validize constant memory. ++ ++2013-04-29 Christian Bruel ++ ++ PR target/57108 ++ * sh.md (tstsi_t_zero_extract_eq): Set mode for operand 0. ++ ++2013-04-27 Jakub Jelinek ++ ++ PR target/56866 ++ * config/i386/sse.md (xop_rotr3): Fix up computation of ++ the immediate rotate count. ++ ++2013-04-21 Eric Botcazou ++ ++ * cfgexpand.c (avoid_complex_debug_insns): Fix C++ism. ++ ++2013-04-19 Matthias Klose ++ ++ PR middle-end/56848 ++ Re-apply ++ 2013-04-01 Andrey Belevantsev ++ ++ Backport from mainline ++ 2013-02-25 Andrey Belevantsev ++ Alexander Monakov ++ ++ PR middle-end/56077 ++ * sched-deps.c (sched_analyze_insn): When reg_pending_barrier, ++ flush pending lists also on non-jumps. Adjust comment. ++ ++ Backport from 4.8: ++ 2012-08-27 Maxim Kuvyrkov ++ ++ * sched-deps.c (add_dependence_list_and_free): Simplify. ++ (flush_pending_list_and_free): Fix a hack that was fixing a hack. Free ++ lists when add_dependence_list_and_free doesn't free them. ++ ++2013-04-19 Marek Polacek ++ ++ Backport from mainline ++ 2013-01-08 Steven Bosscher ++ Jakub Jelinek ++ ++ PR tree-optimization/48189 ++ * predict.c (predict_loops): If max is 0, don't call compare_tree_int. ++ If nitercst is 0, don't predict the exit edge. ++ ++2013-04-16 Jack Howarth ++ ++ Backport from mainline ++ 2012-05-29 Jack Howarth ++ * config/darwin.h (STARTFILE_SPEC): Use -no_new_main with -lgcrt1.o ++ on Darwin >= 12. ++ (DARWIN_CRT1_SPEC): Use -lcrt1.10.6.o when Darwin >= 10 and < 12. ++ ++ ++ 2012-05-29 Jack Howarth ++ PR debug/53453 ++ * doc/tm.texi: Update. ++ * doc/tm.texi.in (SDB and DWARF) : Add @hook. ++ * target.def (force_at_comp_dir): New hook. ++ * config/darwin.h (TARGET_FORCE_AT_COMP_DIR): Define. ++ * dwarf2out.c (dwarf2out_finish): Check targetm.force_at_comp_dir. ++ ++2013-04-15 Eric Botcazou ++ ++ PR target/56890 ++ * config/sparc/sparc.c (enum sparc_mode_class): Add H_MODE value. ++ (S_MODES): Set H_MODE bit. ++ (SF_MODES): Set only S_MODE and SF_MODE bits. ++ (DF_MODES): Set SF_MODES and only D_MODE and DF_MODE bits. ++ (sparc_init_modes) : Set H_MODE bit for sub-word modes. ++ : Do not set SF_MODE for sub-word modes. ++ : Likewise. ++ ++2013-04-13 John David Anglin ++ ++ Backport from mainline: ++ 2013-04-06 John David Anglin ++ ++ PR target/55487 ++ * config/pa/pa.c (legitimize_pic_address): Before incrementing label ++ nuses, make sure we have a label. ++ ++2013-04-11 Richard Biener ++ ++ * BASE-VER: Set to 4.7.4. ++ * DEV-PHASE: Set to prerelease. ++ + 2013-04-11 Release Manager + + * GCC 4.7.3 released. +Index: gcc/testsuite/gcc.target/i386/pr44578.c +=================================================================== +--- gcc/testsuite/gcc.target/i386/pr44578.c (.../tags/gcc_4_7_3_release) (revision 0) ++++ gcc/testsuite/gcc.target/i386/pr44578.c (.../branches/gcc-4_7-branch) (revision 198690) +@@ -0,0 +1,31 @@ ++/* { dg-do run } */ ++/* { dg-options "-O2 -mtune=athlon64" } */ ++ ++extern void abort (void); ++ ++long double ++__attribute__((noinline, noclone)) ++test (float num) ++{ ++ unsigned int i; ++ ++ if (num < 0.0) ++ num = 0.0; ++ ++ __builtin_memcpy (&i, &num, sizeof(unsigned int)); ++ ++ return (long double)(unsigned long long) i; ++} ++ ++int ++main () ++{ ++ long double x; ++ ++ x = test (0.0); ++ ++ if (x != 0.0) ++ abort (); ++ ++ return 0; ++} +Index: gcc/testsuite/gcc.target/i386/pr56866.c +=================================================================== +--- gcc/testsuite/gcc.target/i386/pr56866.c (.../tags/gcc_4_7_3_release) (revision 0) ++++ gcc/testsuite/gcc.target/i386/pr56866.c (.../branches/gcc-4_7-branch) (revision 198690) +@@ -0,0 +1,16 @@ ++/* PR target/56866 */ ++/* { dg-do run } */ ++/* { dg-require-effective-target xop } */ ++/* { dg-options "-O3 -mxop" } */ ++ ++#define main xop_test_main ++#include "../../gcc.c-torture/execute/pr56866.c" ++#undef main ++ ++#include "xop-check.h" ++ ++static void ++xop_test (void) ++{ ++ xop_test_main (); ++} +Index: gcc/testsuite/gcc.target/i386/pr57098.c +=================================================================== +--- gcc/testsuite/gcc.target/i386/pr57098.c (.../tags/gcc_4_7_3_release) (revision 0) ++++ gcc/testsuite/gcc.target/i386/pr57098.c (.../branches/gcc-4_7-branch) (revision 198690) +@@ -0,0 +1,10 @@ ++/* { dg-do compile } */ ++/* { dg-require-effective-target lp64 } */ ++/* { dg-options "-msse4 -mcmodel=large" } */ ++ ++typedef int V __attribute__((vector_size(16))); ++ ++void foo (V *p, V *mask) ++{ ++ *p = __builtin_shuffle (*p, *mask); ++} +Index: gcc/testsuite/gcc.target/sh/pr57108.c +=================================================================== +--- gcc/testsuite/gcc.target/sh/pr57108.c (.../tags/gcc_4_7_3_release) (revision 0) ++++ gcc/testsuite/gcc.target/sh/pr57108.c (.../branches/gcc-4_7-branch) (revision 198690) +@@ -0,0 +1,19 @@ ++/* { dg-do compile { target "sh*-*-*" } } */ ++/* { dg-options "-O1" } */ ++ ++void __assert_func (void) __attribute__ ((__noreturn__)) ; ++ ++void ATATransfer (int num, int buffer) ++{ ++ int wordCount; ++ ++ while (num > 0) ++ { ++ wordCount = num * 512 / sizeof (int); ++ ++ ((0 == (buffer & 63)) ? (void)0 : __assert_func () ); ++ ((0 == (wordCount & 31)) ? (void)0 : __assert_func ()); ++ } ++ ++ ++ } +Index: gcc/testsuite/gfortran.dg/size_kind_3.f90 +=================================================================== +--- gcc/testsuite/gfortran.dg/size_kind_3.f90 (.../tags/gcc_4_7_3_release) (revision 0) ++++ gcc/testsuite/gfortran.dg/size_kind_3.f90 (.../branches/gcc-4_7-branch) (revision 198690) +@@ -0,0 +1,11 @@ ++! { dg-do compile } ++! ++! PR fortran/57142 ++! ++integer :: B(huge(1)+3_8,2_8) ++integer(8) :: var1(2), var2, var3 ++ ++var1 = shape(B) ! { dg-error "SHAPE overflows its kind" } ++var2 = size(B) ! { dg-error "SIZE overflows its kind" } ++var3 = size(B,dim=1) ! { dg-error "SIZE overflows its kind" } ++end +Index: gcc/testsuite/gfortran.dg/transfer_check_4.f90 +=================================================================== +--- gcc/testsuite/gfortran.dg/transfer_check_4.f90 (.../tags/gcc_4_7_3_release) (revision 0) ++++ gcc/testsuite/gfortran.dg/transfer_check_4.f90 (.../branches/gcc-4_7-branch) (revision 198690) +@@ -0,0 +1,44 @@ ++! { dg-do compile } ++! { dg-options "-Wall" } ++ ++! PR 57022: [4.7/4.8/4.9 Regression] Inappropriate warning for use of TRANSFER with arrays ++! Contributed by William Clodius ++ ++subroutine transfers (test) ++ ++ use, intrinsic :: iso_fortran_env ++ ++ integer, intent(in) :: test ++ ++ integer(int8) :: test8(8) = 0 ++ integer(int16) :: test16(4) = 0 ++ integer(int32) :: test32(2) = 0 ++ integer(int64) :: test64 = 0 ++ ++ select case(test) ++ case(0) ++ test64 = transfer(test8, test64) ++ case(1) ++ test64 = transfer(test16, test64) ++ case(2) ++ test64 = transfer(test32, test64) ++ case(3) ++ test8 = transfer(test64, test8, 8) ++ case(4) ++ test16 = transfer(test64, test16, 4) ++ case(5) ++ test32 = transfer(test64, test32, 2) ++ end select ++ ++end subroutine ++ ++ ++! PR 53685: surprising warns about transfer with explicit character range ++! Contributed by Jos de Kloe ++ ++subroutine mytest(byte_array,val) ++ integer, parameter :: r8_ = Selected_Real_Kind(15,307) ! = real*8 ++ character(len=1), dimension(16), intent(in) :: byte_array ++ real(r8_),intent(out) :: val ++ val = transfer(byte_array(1:8),val) ++end subroutine +Index: gcc/testsuite/gfortran.dg/namelist_77.f90 +=================================================================== +--- gcc/testsuite/gfortran.dg/namelist_77.f90 (.../tags/gcc_4_7_3_release) (revision 0) ++++ gcc/testsuite/gfortran.dg/namelist_77.f90 (.../branches/gcc-4_7-branch) (revision 198690) +@@ -0,0 +1,49 @@ ++! { dg-do run } ++! ++! PR libfortran/51825 - Fortran runtime error: Cannot match namelist object name ++! Test case derived from PR. ++ ++module local_mod ++ ++ type mytype1 ++ integer :: int1 ++ end type ++ ++ type mytype2 ++ integer :: n_x ++ integer :: n_px ++ end type ++ ++ type beam_init_struct ++ character(16) :: chars(1) = '' ++ type (mytype1) dummy ++ type (mytype2) grid(1) ++ end type ++ ++end module ++ ++program error_namelist ++ ++ use local_mod ++ ++ implicit none ++ ++ type (beam_init_struct) beam_init ++ ++ namelist / error_params / beam_init ++ ++ open (10, status='scratch') ++ write (10, '(a)') "&error_params" ++ write (10, '(a)') " beam_init%chars(1)='JUNK'" ++ write (10, '(a)') " beam_init%grid(1)%n_x=3" ++ write (10, '(a)') " beam_init%grid(1)%n_px=2" ++ write (10, '(a)') "/" ++ rewind(10) ++ read(10, nml=error_params) ++ close (10) ++ ++ if (beam_init%chars(1) /= 'JUNK') call abort ++ if (beam_init%grid(1)%n_x /= 3) call abort ++ if (beam_init%grid(1)%n_px /= 2) call abort ++ ++end program +Index: gcc/testsuite/gfortran.dg/namelist_79.f90 +=================================================================== +--- gcc/testsuite/gfortran.dg/namelist_79.f90 (.../tags/gcc_4_7_3_release) (revision 0) ++++ gcc/testsuite/gfortran.dg/namelist_79.f90 (.../branches/gcc-4_7-branch) (revision 198690) +@@ -0,0 +1,43 @@ ++! { dg-do run } ++! PR libfortran/52512 - Cannot match namelist object name ++! Test case derived from PR. ++ ++program testje ++ ++ implicit none ++ ++ integer :: getal, jn ++ type ptracer ++ character(len = 8) :: sname !: short name ++ logical :: lini !: read in a file or not ++ end type ptracer ++ type(ptracer) , dimension(3) :: tracer ++ namelist/namtoptrc/ getal,tracer ++ ++ ! standard values ++ getal = 9999 ++ do jn = 1, 3 ++ tracer(jn)%sname = 'default_name' ++ tracer(jn)%lini = .false. ++ end do ++ ++ open (10, status='scratch') ++ write (10, '(a)') "&namtoptrc" ++ write (10, '(a)') " getal = 7" ++ write (10, '(a)') " tracer(1) = 'DIC ', .true." ++ write (10, '(a)') " tracer(2) = 'Alkalini', .true." ++ write (10, '(a)') " tracer(3) = 'O2 ', .true." ++ write (10, '(a)') "/" ++ rewind(10) ++ read(10, nml=namtoptrc) ++ close (10) ++ ++ if (getal /= 7) call abort ++ if (tracer(1)%sname /= 'DIC ') call abort ++ if (tracer(2)%sname /= 'Alkalini') call abort ++ if (tracer(3)%sname /= 'O2 ') call abort ++ if (.not. tracer(1)%lini) call abort ++ if (.not. tracer(2)%lini) call abort ++ if (.not. tracer(3)%lini) call abort ++ ++end program testje +Index: gcc/testsuite/gfortran.dg/size_kind_2.f90 +=================================================================== +--- gcc/testsuite/gfortran.dg/size_kind_2.f90 (.../tags/gcc_4_7_3_release) (revision 0) ++++ gcc/testsuite/gfortran.dg/size_kind_2.f90 (.../branches/gcc-4_7-branch) (revision 198690) +@@ -0,0 +1,17 @@ ++! { dg-do compile } ++! { dg-options "-fdump-tree-original" } ++! ++! PR fortran/57142 ++! ++integer :: B(huge(1)+3_8,2_8) ++integer(8) :: var1(2), var2, var3 ++ ++var1 = shape(B,kind=8) ++var2 = size(B,kind=8) ++var3 = size(B,dim=1,kind=8) ++end ++ ++! { dg-final { scan-tree-dump "static integer.kind=8. A..\\\[2\\\] = \\\{2147483650, 2\\\};" "original" } } ++! { dg-final { scan-tree-dump "var2 = 4294967300;" "original" } } ++! { dg-final { scan-tree-dump "var3 = 2147483650;" "original" } } ++! { dg-final { cleanup-tree-dump "original" } } +Index: gcc/testsuite/gfortran.dg/proc_ptr_41.f90 +=================================================================== +--- gcc/testsuite/gfortran.dg/proc_ptr_41.f90 (.../tags/gcc_4_7_3_release) (revision 0) ++++ gcc/testsuite/gfortran.dg/proc_ptr_41.f90 (.../branches/gcc-4_7-branch) (revision 198690) +@@ -0,0 +1,37 @@ ++! { dg-do compile } ++! ++! PR 56968: [4.7/4.8/4.9 Regression] [F03] Issue with a procedure defined with a generic name returning procedure pointer ++! ++! Contributed by Samuel Debionne ++ ++module test ++ ++ interface generic_name_get_proc_ptr ++ module procedure specific_name_get_proc_ptr ++ end interface ++ ++ abstract interface ++ double precision function foo(arg1) ++ real, intent(in) :: arg1 ++ end function ++ end interface ++ ++contains ++ ++ function specific_name_get_proc_ptr() result(res) ++ procedure(foo), pointer :: res ++ end function ++ ++end module test ++ ++program crash_test ++ use :: test ++ ++ procedure(foo), pointer :: ptr ++ ++ ptr => specific_name_get_proc_ptr() ++ ptr => generic_name_get_proc_ptr() ++ ++end program ++ ++! { dg-final { cleanup-modules "test" } } +Index: gcc/testsuite/gfortran.dg/namelist_81.f90 +=================================================================== +--- gcc/testsuite/gfortran.dg/namelist_81.f90 (.../tags/gcc_4_7_3_release) (revision 0) ++++ gcc/testsuite/gfortran.dg/namelist_81.f90 (.../branches/gcc-4_7-branch) (revision 198690) +@@ -0,0 +1,43 @@ ++! { dg-do run } ++! PR56786 Error on embedded spaces ++integer :: i(3) ++namelist /nml/ i ++ ++i = -42 ++open(99,status='scratch') ++write(99,'(a)') '&nml i(3 ) = 5 /' ++rewind(99) ++read(99,nml=nml) ++close(99) ++if (i(1)/=-42 .or. i(2)/=-42 .or. i(3)/=5) call abort() ++ ++! Shorten the file so the read hits EOF ++ ++open(99,status='scratch') ++write(99,'(a)') '&nml i(3 ) = 5 ' ++rewind(99) ++read(99,nml=nml, end=30) ++call abort() ++! Shorten some more ++ 30 close(99) ++open(99,status='scratch') ++write(99,'(a)') '&nml i(3 ) =' ++rewind(99) ++read(99,nml=nml, end=40) ++call abort() ++! Shorten some more ++ 40 close(99) ++open(99,status='scratch') ++write(99,'(a)') '&nml i(3 )' ++rewind(99) ++read(99,nml=nml, end=50) ++call abort() ++! Shorten some more ++ 50 close(99) ++open(99,status='scratch') ++write(99,'(a)') '&nml i(3 ' ++rewind(99) ++read(99,nml=nml, end=60) ++call abort() ++ 60 close(99) ++end +Index: gcc/testsuite/gfortran.dg/namelist_78.f90 +=================================================================== +--- gcc/testsuite/gfortran.dg/namelist_78.f90 (.../tags/gcc_4_7_3_release) (revision 0) ++++ gcc/testsuite/gfortran.dg/namelist_78.f90 (.../branches/gcc-4_7-branch) (revision 198690) +@@ -0,0 +1,34 @@ ++! { dg-do run } ++! ++! PR libfortran/51825 ++! Test case regarding namelist problems with derived types ++ ++program namelist ++ ++ type d1 ++ integer :: j = 0 ++ end type d1 ++ ++ type d2 ++ type(d1) k ++ end type d2 ++ ++ type d3 ++ type(d2) d(2) ++ end type d3 ++ ++ type(d3) der ++ namelist /nmlst/ der ++ ++ open (10, status='scratch') ++ write (10, '(a)') "&NMLST" ++ write (10, '(a)') " DER%D(1)%K%J = 1," ++ write (10, '(a)') " DER%D(2)%K%J = 2," ++ write (10, '(a)') "/" ++ rewind(10) ++ read(10, nml=nmlst) ++ close (10) ++ ++ if (der%d(1)%k%j /= 1) call abort ++ if (der%d(2)%k%j /= 2) call abort ++end program namelist +Index: gcc/testsuite/gcc.c-torture/execute/pr56866.c +=================================================================== +--- gcc/testsuite/gcc.c-torture/execute/pr56866.c (.../tags/gcc_4_7_3_release) (revision 0) ++++ gcc/testsuite/gcc.c-torture/execute/pr56866.c (.../branches/gcc-4_7-branch) (revision 198690) +@@ -0,0 +1,45 @@ ++/* PR target/56866 */ ++ ++int ++main () ++{ ++#if __CHAR_BIT__ == 8 && __SIZEOF_LONG_LONG__ == 8 && __SIZEOF_INT__ == 4 && __SIZEOF_SHORT__ == 2 ++ unsigned long long wq[256], rq[256]; ++ unsigned int wi[256], ri[256]; ++ unsigned short ws[256], rs[256]; ++ unsigned char wc[256], rc[256]; ++ int t; ++ ++ __builtin_memset (wq, 0, sizeof wq); ++ __builtin_memset (wi, 0, sizeof wi); ++ __builtin_memset (ws, 0, sizeof ws); ++ __builtin_memset (wc, 0, sizeof wc); ++ wq[0] = 0x0123456789abcdefULL; ++ wi[0] = 0x01234567; ++ ws[0] = 0x4567; ++ wc[0] = 0x73; ++ ++ asm volatile ("" : : "g" (wq), "g" (wi), "g" (ws), "g" (wc) : "memory"); ++ ++ for (t = 0; t < 256; ++t) ++ rq[t] = (wq[t] >> 8) | (wq[t] << (sizeof (wq[0]) * __CHAR_BIT__ - 8)); ++ for (t = 0; t < 256; ++t) ++ ri[t] = (wi[t] >> 8) | (wi[t] << (sizeof (wi[0]) * __CHAR_BIT__ - 8)); ++ for (t = 0; t < 256; ++t) ++ rs[t] = (ws[t] >> 9) | (ws[t] << (sizeof (ws[0]) * __CHAR_BIT__ - 9)); ++ for (t = 0; t < 256; ++t) ++ rc[t] = (wc[t] >> 5) | (wc[t] << (sizeof (wc[0]) * __CHAR_BIT__ - 5)); ++ ++ asm volatile ("" : : "g" (rq), "g" (ri), "g" (rs), "g" (rc) : "memory"); ++ ++ if (rq[0] != 0xef0123456789abcdULL || rq[1]) ++ __builtin_abort (); ++ if (ri[0] != 0x67012345 || ri[1]) ++ __builtin_abort (); ++ if (rs[0] != 0xb3a2 || rs[1]) ++ __builtin_abort (); ++ if (rc[0] != 0x9b || rc[1]) ++ __builtin_abort (); ++#endif ++ return 0; ++} +Index: gcc/testsuite/gcc.dg/pr56890-2.c +=================================================================== +--- gcc/testsuite/gcc.dg/pr56890-2.c (.../tags/gcc_4_7_3_release) (revision 0) ++++ gcc/testsuite/gcc.dg/pr56890-2.c (.../branches/gcc-4_7-branch) (revision 198690) +@@ -0,0 +1,19 @@ ++/* PR target/56890 */ ++/* Reported by Rainer Jung */ ++ ++/* { dg-do assemble } */ ++/* { dg-options "-O" } */ ++ ++unsigned int buggy(unsigned int min, unsigned int max) ++{ ++ unsigned int number; ++ if (max < 16384) { ++ unsigned short num16; ++ num16 = min + (long) ((double) (max - min + 1.0) * (num16 / (65535 + 1.0))); ++ return num16; ++ } ++ else { ++ (number) = min + (long) ((double) (max - min + 1.0) * (number / (4294967295U + 1.0))); ++ } ++ return number; ++} +Index: gcc/testsuite/gcc.dg/pr48189.c +=================================================================== +--- gcc/testsuite/gcc.dg/pr48189.c (.../tags/gcc_4_7_3_release) (revision 0) ++++ gcc/testsuite/gcc.dg/pr48189.c (.../branches/gcc-4_7-branch) (revision 198690) +@@ -0,0 +1,13 @@ ++/* PR tree-optimization/48189 */ ++/* { dg-do compile } */ ++/* { dg-options "-O --param max-predicted-iterations=0" } */ ++ ++struct S { int s[8]; }; ++ ++void ++foo (int *x, struct S *y) ++{ ++ int i; ++ for (i = 0; y[i].s[i]; i++) ++ *x++ = y[i].s[i]; ++} +Index: gcc/testsuite/gcc.dg/torture/builtin-logb-1.c +=================================================================== +--- gcc/testsuite/gcc.dg/torture/builtin-logb-1.c (.../tags/gcc_4_7_3_release) (revision 198690) ++++ gcc/testsuite/gcc.dg/torture/builtin-logb-1.c (.../branches/gcc-4_7-branch) (revision 198690) +@@ -48,25 +48,25 @@ + /* Test if FUNCRES(FUNC(NEG FUNCARG(ARGARG))) is false. Check the + sign as well. */ + #ifndef __SPU__ +-#define TESTIT3(FUNC,NEG,FUNCARG,ARGARG,FUNCRES) do { \ ++#define TESTIT3(FUNC,NEG,FUNCARG,ARGARG,FUNCRES,NEG2) do { \ + if (!__builtin_##FUNCRES##f(__builtin_##FUNC(NEG __builtin_##FUNCARG##f(ARGARG))) \ +- || CKSGN_F(__builtin_##FUNC##f(NEG __builtin_##FUNCARG##f(ARGARG)), NEG __builtin_##FUNCARG##f(ARGARG))) \ ++ || CKSGN_F(__builtin_##FUNC##f(NEG __builtin_##FUNCARG##f(ARGARG)), NEG2 __builtin_##FUNCARG##f(ARGARG))) \ + link_error(__LINE__); \ + if (!__builtin_##FUNCRES(__builtin_##FUNC(NEG __builtin_##FUNCARG(ARGARG))) \ +- || CKSGN(__builtin_##FUNC(NEG __builtin_##FUNCARG(ARGARG)), NEG __builtin_##FUNCARG(ARGARG))) \ ++ || CKSGN(__builtin_##FUNC(NEG __builtin_##FUNCARG(ARGARG)), NEG2 __builtin_##FUNCARG(ARGARG))) \ + link_error(__LINE__); \ + if (!__builtin_##FUNCRES##l(__builtin_##FUNC##l(NEG __builtin_##FUNCARG##l(ARGARG))) \ +- || CKSGN_L(__builtin_##FUNC##l(NEG __builtin_##FUNCARG##l(ARGARG)), NEG __builtin_##FUNCARG##l(ARGARG))) \ ++ || CKSGN_L(__builtin_##FUNC##l(NEG __builtin_##FUNCARG##l(ARGARG)), NEG2 __builtin_##FUNCARG##l(ARGARG))) \ + link_error(__LINE__); \ + } while (0) + #else +-#define TESTIT3(FUNC,NEG,FUNCARG,ARGARG,FUNCRES) do { \ ++#define TESTIT3(FUNC,NEG,FUNCARG,ARGARG,FUNCRES,NEG2) do { \ + /* SPU single-precision floating point format does not support Inf or Nan. */ \ + if (!__builtin_##FUNCRES(__builtin_##FUNC(NEG __builtin_##FUNCARG(ARGARG))) \ +- || CKSGN(__builtin_##FUNC(NEG __builtin_##FUNCARG(ARGARG)), NEG __builtin_##FUNCARG(ARGARG))) \ ++ || CKSGN(__builtin_##FUNC(NEG __builtin_##FUNCARG(ARGARG)), NEG2 __builtin_##FUNCARG(ARGARG))) \ + link_error(__LINE__); \ + if (!__builtin_##FUNCRES##l(__builtin_##FUNC##l(NEG __builtin_##FUNCARG##l(ARGARG))) \ +- || CKSGN_L(__builtin_##FUNC##l(NEG __builtin_##FUNCARG##l(ARGARG)), NEG __builtin_##FUNCARG##l(ARGARG))) \ ++ || CKSGN_L(__builtin_##FUNC##l(NEG __builtin_##FUNCARG##l(ARGARG)), NEG2 __builtin_##FUNCARG##l(ARGARG))) \ + link_error(__LINE__); \ + } while (0) + #endif +@@ -173,15 +173,15 @@ + + /* Test for f(+-Inf) -> +-Inf and f(+-NaN) -> +-NaN, regardless of + the radix. */ +- TESTIT3 (logb, ,inf, , isinf); +- TESTIT3 (logb, - ,inf, , isinf); +- TESTIT3 (logb, ,nan, "", isnan); +- TESTIT3 (logb, - ,nan, "", isnan); ++ TESTIT3 (logb, ,inf, , isinf, ); ++ TESTIT3 (logb, - ,inf, , isinf, ); ++ TESTIT3 (logb, ,nan, "", isnan, ); ++ TESTIT3 (logb, - ,nan, "", isnan, -); + +- TESTIT3 (significand, ,inf, , isinf); +- TESTIT3 (significand, - ,inf, , isinf); +- TESTIT3 (significand, ,nan, "", isnan); +- TESTIT3 (significand, - ,nan, "", isnan); ++ TESTIT3 (significand, ,inf, , isinf, ); ++ TESTIT3 (significand, - ,inf, , isinf, -); ++ TESTIT3 (significand, ,nan, "", isnan, ); ++ TESTIT3 (significand, - ,nan, "", isnan, -); + } + + int main() +Index: gcc/testsuite/gcc.dg/torture/pr53922.c +=================================================================== +--- gcc/testsuite/gcc.dg/torture/pr53922.c (.../tags/gcc_4_7_3_release) (revision 198690) ++++ gcc/testsuite/gcc.dg/torture/pr53922.c (.../branches/gcc-4_7-branch) (revision 198690) +@@ -1,6 +1,7 @@ + /* { dg-do run } */ + /* { dg-require-weak "" } */ +-/* { dg-skip-if "No undefined weak" { hppa*-*-hpux* && { ! lp64 } } { "*" } { "" } } */ ++/* { dg-skip-if "No undefined weak" { alpha*-*-osf* } } */ ++/* { dg-skip-if "No undefined weak" { hppa*-*-hpux* && { ! lp64 } } } */ + + int x(int a) + { +Index: gcc/testsuite/gcc.dg/pr56890-1.c +=================================================================== +--- gcc/testsuite/gcc.dg/pr56890-1.c (.../tags/gcc_4_7_3_release) (revision 0) ++++ gcc/testsuite/gcc.dg/pr56890-1.c (.../branches/gcc-4_7-branch) (revision 198690) +@@ -0,0 +1,15 @@ ++/* PR target/56890 */ ++/* Reported by Rainer Jung */ ++ ++/* { dg-do assemble } */ ++/* { dg-options "-O2" } */ ++ ++unsigned int buggy(unsigned int min, unsigned int max) ++{ ++ if (max < 16384) { ++ unsigned short num16 = 0; ++ num16 = min + (long) ((double) (max - min + 1.0) * (num16 / (65535 + 1.0))); ++ return num16; ++ } ++ return 0; ++} +Index: gcc/testsuite/ChangeLog +=================================================================== +--- gcc/testsuite/ChangeLog (.../tags/gcc_4_7_3_release) (revision 198690) ++++ gcc/testsuite/ChangeLog (.../branches/gcc-4_7-branch) (revision 198690) +@@ -1,3 +1,97 @@ ++2013-05-07 Tobias Burnus ++ ++ Backport from mainline ++ 2013-05-02 Tobias Burnus ++ ++ PR fortran/57142 ++ * gfortran.dg/size_kind_2.f90: New. ++ * gfortran.dg/size_kind_3.f90: New. ++ ++2013-05-03 Marek Polacek ++ ++ Backport from mainline ++ 2013-04-25 Marek Polacek ++ ++ PR tree-optimization/57066 ++ * gcc.dg/torture/builtin-logb-1.c: Adjust testcase. ++ ++2013-04-30 Uros Bizjak ++ ++ Backport from mainline ++ 2013-04-29 Uros Bizjak ++ ++ PR target/44578 ++ * gcc.target/i386/pr44578.c: New test. ++ ++ Backport from mainline ++ 2013-04-29 Uros Bizjak ++ ++ PR target/57098 ++ * gcc.target/i386/pr57098.c: New test. ++ ++2013-04-29 Christian Bruel ++ ++ PR target/57108 ++ * gcc.target/sh/pr57108.c: New test. ++ ++2013-04-28 Jerry DeLisle ++ ++ Backport from trunk: ++ ++ PR fortran/51825 ++ * gfortran.dg/namelist_77.f90: New test. ++ * gfortran.dg/namelist_78.f90: New test. ++ ++2013-04-28 Jerry DeLisle ++ ++ Backport from trunk: ++ ++ PR fortran/56786 ++ * gfortran.dg/namelist_81.f90: New test. ++ ++2013-04-28 Jerry DeLisle ++ ++ Backport from trunk: ++ ++ PR fortran/52512 ++ * gfortran.dg/namelist_79.f90: New test. ++ ++2013-04-27 Jakub Jelinek ++ ++ PR target/56866 ++ * gcc.c-torture/execute/pr56866.c: New test. ++ * gcc.target/i386/pr56866.c: New test. ++ ++2013-04-26 Janus Weil ++ ++ Backports from trunk: ++ ++ PR fortran/56968 ++ * gfortran.dg/proc_ptr_41.f90: New. ++ ++ PR fortran/53685 ++ PR fortran/57022 ++ * gfortran.dg/transfer_check_4.f90: New. ++ ++2013-04-19 Marek Polacek ++ ++ Backport from mainline ++ 2013-01-08 Steven Bosscher ++ Jakub Jelinek ++ ++ PR tree-optimization/48189 ++ * gcc.dg/pr48189.c: New test. ++ ++2013-04-15 Rainer Orth ++ ++ * gcc.dg/torture/pr53922.c: Skip on alpha*-*-osf*. ++ Remove dg-skip-if default args. ++ ++2013-04-15 Eric Botcazou ++ ++ * gcc.dg/pr56890-1.c: New test. ++ * gcc.dg/pr56890-2.c: Likewise. ++ + 2013-04-11 Release Manager + + * GCC 4.7.3 released. +Index: gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh3.C +=================================================================== +--- gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh3.C (.../tags/gcc_4_7_3_release) (revision 0) ++++ gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh3.C (.../branches/gcc-4_7-branch) (revision 198690) +@@ -0,0 +1,14 @@ ++// PR c++/56388 ++// { dg-require-effective-target c++11 } ++ ++int main() ++{ ++ bool /*const*/ condition = false; ++ ++ [&]{ ++ try{} ++ catch(...){ ++ if(condition){} ++ } ++ }(); ++} +Index: gcc/cp/ChangeLog +=================================================================== +--- gcc/cp/ChangeLog (.../tags/gcc_4_7_3_release) (revision 198690) ++++ gcc/cp/ChangeLog (.../branches/gcc-4_7-branch) (revision 198690) +@@ -1,3 +1,13 @@ ++2013-04-21 Eric Botcazou ++ ++ * parser.c (cp_parser_late_return_type_opt): Fix C++ism. ++ ++2013-04-15 Jason Merrill ++ ++ PR c++/56388 ++ * semantics.c (insert_capture_proxy): Just use index 1 in the ++ stmt_list_stack. ++ + 2013-04-11 Release Manager + + * GCC 4.7.3 released. +Index: gcc/cp/semantics.c +=================================================================== +--- gcc/cp/semantics.c (.../tags/gcc_4_7_3_release) (revision 198690) ++++ gcc/cp/semantics.c (.../branches/gcc-4_7-branch) (revision 198690) +@@ -8959,13 +8959,12 @@ + insert_capture_proxy (tree var) + { + cp_binding_level *b; +- int skip; + tree stmt_list; + + /* Put the capture proxy in the extra body block so that it won't clash + with a later local variable. */ + b = current_binding_level; +- for (skip = 0; ; ++skip) ++ for (;;) + { + cp_binding_level *n = b->level_chain; + if (n->kind == sk_function_parms) +@@ -8976,8 +8975,7 @@ + + /* And put a DECL_EXPR in the STATEMENT_LIST for the same block. */ + var = build_stmt (DECL_SOURCE_LOCATION (var), DECL_EXPR, var); +- stmt_list = VEC_index (tree, stmt_list_stack, +- VEC_length (tree, stmt_list_stack) - 1 - skip); ++ stmt_list = VEC_index (tree, stmt_list_stack, 1); + gcc_assert (stmt_list); + append_to_statement_list_force (var, &stmt_list); + } +Index: gcc/cp/parser.c +=================================================================== +--- gcc/cp/parser.c (.../tags/gcc_4_7_3_release) (revision 198690) ++++ gcc/cp/parser.c (.../branches/gcc-4_7-branch) (revision 198690) +@@ -16691,7 +16691,7 @@ + cp_parser_late_return_type_opt (cp_parser* parser, cp_cv_quals quals) + { + cp_token *token; +- tree type; ++ tree type, save_ccp, save_ccr; + + /* Peek at the next token. */ + token = cp_lexer_peek_token (parser->lexer); +@@ -16702,8 +16702,8 @@ + /* Consume the ->. */ + cp_lexer_consume_token (parser->lexer); + +- tree save_ccp = current_class_ptr; +- tree save_ccr = current_class_ref; ++ save_ccp = current_class_ptr; ++ save_ccr = current_class_ref; + if (quals >= 0) + { + /* DR 1207: 'this' is in scope in the trailing return type. */ +Index: gcc/dwarf2out.c +=================================================================== +--- gcc/dwarf2out.c (.../tags/gcc_4_7_3_release) (revision 198690) ++++ gcc/dwarf2out.c (.../branches/gcc-4_7-branch) (revision 198690) +@@ -22538,7 +22538,7 @@ + /* Add the name for the main input file now. We delayed this from + dwarf2out_init to avoid complications with PCH. */ + add_name_attribute (comp_unit_die (), remap_debug_filename (filename)); +- if (!IS_ABSOLUTE_PATH (filename)) ++ if (!IS_ABSOLUTE_PATH (filename) || targetm.force_at_comp_dir) + add_comp_dir_attribute (comp_unit_die ()); + else if (get_AT (comp_unit_die (), DW_AT_comp_dir) == NULL) + { +Index: gcc/predict.c +=================================================================== +--- gcc/predict.c (.../tags/gcc_4_7_3_release) (revision 198690) ++++ gcc/predict.c (.../branches/gcc-4_7-branch) (revision 198690) +@@ -983,7 +983,8 @@ + if (TREE_CODE (niter) == INTEGER_CST) + { + if (host_integerp (niter, 1) +- && compare_tree_int (niter, max-1) == -1) ++ && max ++ && compare_tree_int (niter, max - 1) == -1) + nitercst = tree_low_cst (niter, 1) + 1; + else + nitercst = max; +@@ -1005,6 +1006,11 @@ + else + continue; + ++ /* If the prediction for number of iterations is zero, do not ++ predict the exit edges. */ ++ if (nitercst == 0) ++ continue; ++ + probability = ((REG_BR_PROB_BASE + nitercst / 2) / nitercst); + predict_edge (ex, predictor, probability); + } +Index: gcc/fortran/ChangeLog +=================================================================== +--- gcc/fortran/ChangeLog (.../tags/gcc_4_7_3_release) (revision 198690) ++++ gcc/fortran/ChangeLog (.../branches/gcc-4_7-branch) (revision 198690) +@@ -1,3 +1,39 @@ ++2013-05-07 Tobias Burnus ++ ++ Backport from mainline ++ 2013-05-02 Tobias Burnus ++ ++ PR fortran/57142 ++ * simplify.c (gfc_simplify_size): Renamed from ++ simplify_size; fix kind=8 handling. ++ (gfc_simplify_size): New function. ++ (gfc_simplify_shape): Add range check. ++ * resolve.c (resolve_function): Fix handling ++ for ISYM_SIZE. ++ ++2013-04-26 Janus Weil ++ ++ Backports from trunk: ++ ++ PR fortran/56968 ++ * expr.c (gfc_check_pointer_assign): Handle generic functions returning ++ procedure pointers. ++ ++ PR fortran/53685 ++ PR fortran/57022 ++ * check.c (gfc_calculate_transfer_sizes): Fix for array-valued SOURCE ++ expressions. ++ * target-memory.h (gfc_element_size): New prototype. ++ * target-memory.c (size_array): Remove. ++ (gfc_element_size): New function. ++ (gfc_target_expr_size): Modified to always return the full size of the ++ expression. ++ ++2013-04-18 Tobias Burnus ++ ++ PR fortran/56994 ++ * invoke.texi (NEAREST): S argument is not optional. ++ + 2013-04-11 Release Manager + + * GCC 4.7.3 released. +Index: gcc/fortran/expr.c +=================================================================== +--- gcc/fortran/expr.c (.../tags/gcc_4_7_3_release) (revision 198690) ++++ gcc/fortran/expr.c (.../branches/gcc-4_7-branch) (revision 198690) +@@ -3493,8 +3493,12 @@ + } + else if (rvalue->expr_type == EXPR_FUNCTION) + { +- s2 = rvalue->symtree->n.sym->result; +- name = rvalue->symtree->n.sym->result->name; ++ if (rvalue->value.function.esym) ++ s2 = rvalue->value.function.esym->result; ++ else ++ s2 = rvalue->symtree->n.sym->result; ++ ++ name = s2->name; + } + else + { +Index: gcc/fortran/resolve.c +=================================================================== +--- gcc/fortran/resolve.c (.../tags/gcc_4_7_3_release) (revision 198690) ++++ gcc/fortran/resolve.c (.../branches/gcc-4_7-branch) (revision 198690) +@@ -3155,6 +3155,7 @@ + for (arg = expr->value.function.actual; arg; arg = arg->next) + { + if ((GENERIC_ID == GFC_ISYM_UBOUND || GENERIC_ID == GFC_ISYM_SIZE) ++ && arg == expr->value.function.actual + && arg->next != NULL && arg->next->expr) + { + if (arg->next->expr->expr_type != EXPR_CONSTANT) +Index: gcc/fortran/target-memory.c +=================================================================== +--- gcc/fortran/target-memory.c (.../tags/gcc_4_7_3_release) (revision 198690) ++++ gcc/fortran/target-memory.c (.../branches/gcc-4_7-branch) (revision 198690) +@@ -35,17 +35,7 @@ + /* --------------------------------------------------------------- */ + /* Calculate the size of an expression. */ + +-static size_t +-size_array (gfc_expr *e) +-{ +- mpz_t array_size; +- gfc_constructor *c = gfc_constructor_first (e->value.constructor); +- size_t elt_size = gfc_target_expr_size (c->expr); + +- gfc_array_size (e, &array_size); +- return (size_t)mpz_get_ui (array_size) * elt_size; +-} +- + static size_t + size_integer (int kind) + { +@@ -82,16 +72,14 @@ + } + + ++/* Return the size of a single element of the given expression. ++ Identical to gfc_target_expr_size for scalars. */ ++ + size_t +-gfc_target_expr_size (gfc_expr *e) ++gfc_element_size (gfc_expr *e) + { + tree type; + +- gcc_assert (e != NULL); +- +- if (e->expr_type == EXPR_ARRAY) +- return size_array (e); +- + switch (e->ts.type) + { + case BT_INTEGER: +@@ -130,12 +118,36 @@ + return int_size_in_bytes (type); + } + default: +- gfc_internal_error ("Invalid expression in gfc_target_expr_size."); ++ gfc_internal_error ("Invalid expression in gfc_element_size."); + return 0; + } + } + + ++/* Return the size of an expression in its target representation. */ ++ ++size_t ++gfc_target_expr_size (gfc_expr *e) ++{ ++ mpz_t tmp; ++ size_t asz; ++ ++ gcc_assert (e != NULL); ++ ++ if (e->rank) ++ { ++ if (gfc_array_size (e, &tmp)) ++ asz = mpz_get_ui (tmp); ++ else ++ asz = 0; ++ } ++ else ++ asz = 1; ++ ++ return asz * gfc_element_size (e); ++} ++ ++ + /* The encode_* functions export a value into a buffer, and + return the number of bytes of the buffer that have been + used. */ +Index: gcc/fortran/target-memory.h +=================================================================== +--- gcc/fortran/target-memory.h (.../tags/gcc_4_7_3_release) (revision 198690) ++++ gcc/fortran/target-memory.h (.../branches/gcc-4_7-branch) (revision 198690) +@@ -25,7 +25,7 @@ + /* Convert a BOZ to REAL or COMPLEX. */ + bool gfc_convert_boz (gfc_expr *, gfc_typespec *); + +-/* Return the size of an expression in its target representation. */ ++size_t gfc_element_size (gfc_expr *); + size_t gfc_target_expr_size (gfc_expr *); + + /* Write a constant expression in binary form to a target buffer. */ +Index: gcc/fortran/check.c +=================================================================== +--- gcc/fortran/check.c (.../tags/gcc_4_7_3_release) (revision 198690) ++++ gcc/fortran/check.c (.../branches/gcc-4_7-branch) (revision 198690) +@@ -3988,8 +3988,6 @@ + size_t *result_length_p) + { + size_t result_elt_size; +- mpz_t tmp; +- gfc_expr *mold_element; + + if (source->expr_type == EXPR_FUNCTION) + return FAILURE; +@@ -3998,20 +3996,12 @@ + return FAILURE; + + /* Calculate the size of the source. */ +- if (source->expr_type == EXPR_ARRAY +- && gfc_array_size (source, &tmp) == FAILURE) +- return FAILURE; +- + *source_size = gfc_target_expr_size (source); + if (*source_size == 0) + return FAILURE; + +- mold_element = mold->expr_type == EXPR_ARRAY +- ? gfc_constructor_first (mold->value.constructor)->expr +- : mold; +- + /* Determine the size of the element. */ +- result_elt_size = gfc_target_expr_size (mold_element); ++ result_elt_size = gfc_element_size (mold); + if (result_elt_size == 0) + return FAILURE; + +Index: gcc/fortran/intrinsic.texi +=================================================================== +--- gcc/fortran/intrinsic.texi (.../tags/gcc_4_7_3_release) (revision 198690) ++++ gcc/fortran/intrinsic.texi (.../branches/gcc-4_7-branch) (revision 198690) +@@ -9209,7 +9209,7 @@ + @item @emph{Arguments}: + @multitable @columnfractions .15 .70 + @item @var{X} @tab Shall be of type @code{REAL}. +-@item @var{S} @tab (Optional) shall be of type @code{REAL} and ++@item @var{S} @tab Shall be of type @code{REAL} and + not equal to zero. + @end multitable + +Index: gcc/fortran/simplify.c +=================================================================== +--- gcc/fortran/simplify.c (.../tags/gcc_4_7_3_release) (revision 198690) ++++ gcc/fortran/simplify.c (.../branches/gcc-4_7-branch) (revision 198690) +@@ -32,7 +32,9 @@ + + gfc_expr gfc_bad_expr; + ++static gfc_expr *simplify_size (gfc_expr *, gfc_expr *, int); + ++ + /* Note that 'simplification' is not just transforming expressions. + For functions that are not simplified at compile time, range + checking is done if possible. +@@ -3240,7 +3242,7 @@ + gfc_expr* dim = result; + mpz_set_si (dim->value.integer, d); + +- result = gfc_simplify_size (array, dim, kind); ++ result = simplify_size (array, dim, k); + gfc_free_expr (dim); + if (!result) + goto returnNull; +@@ -5493,15 +5495,12 @@ + e = gfc_get_constant_expr (BT_INTEGER, k, &source->where); + + if (t == SUCCESS) +- { +- mpz_set (e->value.integer, shape[n]); +- mpz_clear (shape[n]); +- } ++ mpz_set (e->value.integer, shape[n]); + else + { + mpz_set_ui (e->value.integer, n + 1); + +- f = gfc_simplify_size (source, e, NULL); ++ f = simplify_size (source, e, k); + gfc_free_expr (e); + if (f == NULL) + { +@@ -5512,24 +5511,31 @@ + e = f; + } + ++ if (e == &gfc_bad_expr || range_check (e, "SHAPE") == &gfc_bad_expr) ++ { ++ gfc_free_expr (result); ++ if (t) ++ gfc_clear_shape (shape, source->rank); ++ return &gfc_bad_expr; ++ } ++ + gfc_constructor_append_expr (&result->value.constructor, e, NULL); + } + ++ if (t) ++ gfc_clear_shape (shape, source->rank); ++ + return result; + } + + +-gfc_expr * +-gfc_simplify_size (gfc_expr *array, gfc_expr *dim, gfc_expr *kind) ++static gfc_expr * ++simplify_size (gfc_expr *array, gfc_expr *dim, int k) + { + mpz_t size; + gfc_expr *return_value; + int d; +- int k = get_kind (BT_INTEGER, kind, "SIZE", gfc_default_integer_kind); + +- if (k == -1) +- return &gfc_bad_expr; +- + /* For unary operations, the size of the result is given by the size + of the operand. For binary ones, it's the size of the first operand + unless it is scalar, then it is the size of the second. */ +@@ -5558,7 +5564,7 @@ + replacement = array->value.op.op1; + else + { +- simplified = gfc_simplify_size (array->value.op.op1, dim, kind); ++ simplified = simplify_size (array->value.op.op1, dim, k); + if (simplified) + return simplified; + +@@ -5568,18 +5574,20 @@ + } + + /* Try to reduce it directly if possible. */ +- simplified = gfc_simplify_size (replacement, dim, kind); ++ simplified = simplify_size (replacement, dim, k); + + /* Otherwise, we build a new SIZE call. This is hopefully at least + simpler than the original one. */ + if (!simplified) +- simplified = gfc_build_intrinsic_call (gfc_current_ns, +- GFC_ISYM_SIZE, "size", +- array->where, 3, +- gfc_copy_expr (replacement), +- gfc_copy_expr (dim), +- gfc_copy_expr (kind)); +- ++ { ++ gfc_expr *kind = gfc_get_int_expr (gfc_default_integer_kind, NULL, k); ++ simplified = gfc_build_intrinsic_call (gfc_current_ns, ++ GFC_ISYM_SIZE, "size", ++ array->where, 3, ++ gfc_copy_expr (replacement), ++ gfc_copy_expr (dim), ++ kind); ++ } + return simplified; + } + +@@ -5598,13 +5606,32 @@ + return NULL; + } + +- return_value = gfc_get_int_expr (k, &array->where, mpz_get_si (size)); ++ return_value = gfc_get_constant_expr (BT_INTEGER, k, &array->where); ++ mpz_set (return_value->value.integer, size); + mpz_clear (size); ++ + return return_value; + } + + + gfc_expr * ++gfc_simplify_size (gfc_expr *array, gfc_expr *dim, gfc_expr *kind) ++{ ++ gfc_expr *result; ++ int k = get_kind (BT_INTEGER, kind, "SIZE", gfc_default_integer_kind); ++ ++ if (k == -1) ++ return &gfc_bad_expr; ++ ++ result = simplify_size (array, dim, k); ++ if (result == NULL || result == &gfc_bad_expr) ++ return result; ++ ++ return range_check (result, "SIZE"); ++} ++ ++ ++gfc_expr * + gfc_simplify_sign (gfc_expr *x, gfc_expr *y) + { + gfc_expr *result; +Index: gcc/cfgexpand.c +=================================================================== +--- gcc/cfgexpand.c (.../tags/gcc_4_7_3_release) (revision 198690) ++++ gcc/cfgexpand.c (.../branches/gcc-4_7-branch) (revision 198690) +@@ -3646,6 +3646,8 @@ + avoid_complex_debug_insns (rtx insn, rtx *exp_p, int depth) + { + rtx exp = *exp_p; ++ const char *format_ptr; ++ int i, j; + + if (exp == NULL_RTX) + return; +@@ -3668,8 +3670,7 @@ + return; + } + +- const char *format_ptr = GET_RTX_FORMAT (GET_CODE (exp)); +- int i, j; ++ format_ptr = GET_RTX_FORMAT (GET_CODE (exp)); + for (i = 0; i < GET_RTX_LENGTH (GET_CODE (exp)); i++) + switch (*format_ptr++) + { +Index: gcc/sched-deps.c +=================================================================== +--- gcc/sched-deps.c (.../tags/gcc_4_7_3_release) (revision 198690) ++++ gcc/sched-deps.c (.../branches/gcc-4_7-branch) (revision 198690) +@@ -1563,24 +1563,15 @@ + add_dependence_list_and_free (struct deps_desc *deps, rtx insn, rtx *listp, + int uncond, enum reg_note dep_type) + { +- rtx list, next; ++ add_dependence_list (insn, *listp, uncond, dep_type); + + /* We don't want to short-circuit dependencies involving debug + insns, because they may cause actual dependencies to be + disregarded. */ + if (deps->readonly || DEBUG_INSN_P (insn)) +- { +- add_dependence_list (insn, *listp, uncond, dep_type); +- return; +- } ++ return; + +- for (list = *listp, *listp = NULL; list ; list = next) +- { +- next = XEXP (list, 1); +- if (uncond || ! sched_insns_conditions_mutex_p (insn, XEXP (list, 0))) +- add_dependence (insn, XEXP (list, 0), dep_type); +- free_INSN_LIST_node (list); +- } ++ free_INSN_LIST_list (listp); + } + + /* Remove all occurences of INSN from LIST. Return the number of +@@ -1764,6 +1755,15 @@ + add_dependence_list_and_free (deps, insn, &deps->pending_jump_insns, 1, + REG_DEP_ANTI); + ++ if (DEBUG_INSN_P (insn)) ++ { ++ if (for_write) ++ free_INSN_LIST_list (&deps->pending_read_insns); ++ free_INSN_LIST_list (&deps->pending_write_insns); ++ free_INSN_LIST_list (&deps->last_pending_memory_flush); ++ free_INSN_LIST_list (&deps->pending_jump_insns); ++ } ++ + if (!deps->readonly) + { + free_EXPR_LIST_list (&deps->pending_write_mems); +@@ -3262,9 +3262,9 @@ + SET_REGNO_REG_SET (&deps->reg_last_in_use, i); + } + +- /* Flush pending lists on jumps, but not on speculative checks. */ +- if (JUMP_P (insn) && !(sel_sched_p () +- && sel_insn_is_speculation_check (insn))) ++ /* Don't flush pending lists on speculative checks for ++ selective scheduling. */ ++ if (!sel_sched_p () || !sel_insn_is_speculation_check (insn)) + flush_pending_lists (deps, insn, true, true); + + reg_pending_barrier = NOT_A_BARRIER; +Index: gcc/config/sparc/sparc.c +=================================================================== +--- gcc/config/sparc/sparc.c (.../tags/gcc_4_7_3_release) (revision 198690) ++++ gcc/config/sparc/sparc.c (.../branches/gcc-4_7-branch) (revision 198690) +@@ -4207,13 +4207,14 @@ + mapped into one sparc_mode_class mode. */ + + enum sparc_mode_class { +- S_MODE, D_MODE, T_MODE, O_MODE, ++ H_MODE, S_MODE, D_MODE, T_MODE, O_MODE, + SF_MODE, DF_MODE, TF_MODE, OF_MODE, + CC_MODE, CCFP_MODE + }; + + /* Modes for single-word and smaller quantities. */ +-#define S_MODES ((1 << (int) S_MODE) | (1 << (int) SF_MODE)) ++#define S_MODES \ ++ ((1 << (int) H_MODE) | (1 << (int) S_MODE) | (1 << (int) SF_MODE)) + + /* Modes for double-word and smaller quantities. */ + #define D_MODES (S_MODES | (1 << (int) D_MODE) | (1 << DF_MODE)) +@@ -4224,13 +4225,11 @@ + /* Modes for 8-word and smaller quantities. */ + #define O_MODES (T_MODES | (1 << (int) O_MODE) | (1 << (int) OF_MODE)) + +-/* Modes for single-float quantities. We must allow any single word or +- smaller quantity. This is because the fix/float conversion instructions +- take integer inputs/outputs from the float registers. */ +-#define SF_MODES (S_MODES) ++/* Modes for single-float quantities. */ ++#define SF_MODES ((1 << (int) S_MODE) | (1 << (int) SF_MODE)) + + /* Modes for double-float and smaller quantities. */ +-#define DF_MODES (D_MODES) ++#define DF_MODES (SF_MODES | (1 << (int) D_MODE) | (1 << DF_MODE)) + + /* Modes for quad-float and smaller quantities. */ + #define TF_MODES (DF_MODES | (1 << (int) TF_MODE)) +@@ -4326,7 +4325,9 @@ + case MODE_INT: + case MODE_PARTIAL_INT: + case MODE_COMPLEX_INT: +- if (GET_MODE_SIZE (i) <= 4) ++ if (GET_MODE_SIZE (i) < 4) ++ sparc_mode_class[i] = 1 << (int) H_MODE; ++ else if (GET_MODE_SIZE (i) == 4) + sparc_mode_class[i] = 1 << (int) S_MODE; + else if (GET_MODE_SIZE (i) == 8) + sparc_mode_class[i] = 1 << (int) D_MODE; +@@ -4338,14 +4339,16 @@ + sparc_mode_class[i] = 0; + break; + case MODE_VECTOR_INT: +- if (GET_MODE_SIZE (i) <= 4) +- sparc_mode_class[i] = 1 << (int)SF_MODE; ++ if (GET_MODE_SIZE (i) == 4) ++ sparc_mode_class[i] = 1 << (int) SF_MODE; + else if (GET_MODE_SIZE (i) == 8) +- sparc_mode_class[i] = 1 << (int)DF_MODE; ++ sparc_mode_class[i] = 1 << (int) DF_MODE; ++ else ++ sparc_mode_class[i] = 0; + break; + case MODE_FLOAT: + case MODE_COMPLEX_FLOAT: +- if (GET_MODE_SIZE (i) <= 4) ++ if (GET_MODE_SIZE (i) == 4) + sparc_mode_class[i] = 1 << (int) SF_MODE; + else if (GET_MODE_SIZE (i) == 8) + sparc_mode_class[i] = 1 << (int) DF_MODE; +Index: gcc/config/i386/i386.md +=================================================================== +--- gcc/config/i386/i386.md (.../tags/gcc_4_7_3_release) (revision 198690) ++++ gcc/config/i386/i386.md (.../branches/gcc-4_7-branch) (revision 198690) +@@ -3444,9 +3444,9 @@ + }) + + (define_insn "*zero_extendsidi2_rex64" +- [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o,?*Ym,?*y,?*Yi,*x") ++ [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o,?*Ym,?!*y,?*Yi,*x") + (zero_extend:DI +- (match_operand:SI 1 "nonimmediate_operand" "rm,0,r ,m ,r ,m")))] ++ (match_operand:SI 1 "nonimmediate_operand" "rm,0,r ,m ,r ,m")))] + "TARGET_64BIT" + "@ + mov{l}\t{%1, %k0|%k0, %1} +@@ -3469,9 +3469,9 @@ + + ;; %%% Kill me once multi-word ops are sane. + (define_insn "zero_extendsidi2_1" +- [(set (match_operand:DI 0 "nonimmediate_operand" "=r,?r,?o,?*Ym,?*y,?*Yi,*x") ++ [(set (match_operand:DI 0 "nonimmediate_operand" "=r,?r,?o,?*Ym,?!*y,?*Yi,*x") + (zero_extend:DI +- (match_operand:SI 1 "nonimmediate_operand" "0,rm,r ,r ,m ,r ,m"))) ++ (match_operand:SI 1 "nonimmediate_operand" "0,rm,r ,r ,m ,r ,m"))) + (clobber (reg:CC FLAGS_REG))] + "!TARGET_64BIT" + "@ +Index: gcc/config/i386/sse.md +=================================================================== +--- gcc/config/i386/sse.md (.../tags/gcc_4_7_3_release) (revision 198690) ++++ gcc/config/i386/sse.md (.../branches/gcc-4_7-branch) (revision 198690) +@@ -11167,7 +11167,8 @@ + (match_operand:SI 2 "const_0_to__operand" "n")))] + "TARGET_XOP" + { +- operands[3] = GEN_INT (( * 8) - INTVAL (operands[2])); ++ operands[3] ++ = GEN_INT (GET_MODE_BITSIZE (mode) - INTVAL (operands[2])); + return \"vprot\t{%3, %1, %0|%0, %1, %3}\"; + } + [(set_attr "type" "sseishft") +Index: gcc/config/i386/i386.c +=================================================================== +--- gcc/config/i386/i386.c (.../tags/gcc_4_7_3_release) (revision 198690) ++++ gcc/config/i386/i386.c (.../branches/gcc-4_7-branch) (revision 198690) +@@ -20026,7 +20026,7 @@ + vec[i * 2 + 1] = const1_rtx; + } + vt = gen_rtx_CONST_VECTOR (maskmode, gen_rtvec_v (w, vec)); +- vt = force_const_mem (maskmode, vt); ++ vt = validize_mem (force_const_mem (maskmode, vt)); + t1 = expand_simple_binop (maskmode, PLUS, t1, vt, t1, 1, + OPTAB_DIRECT); + +@@ -20223,7 +20223,7 @@ + for (i = 0; i < 16; ++i) + vec[i] = GEN_INT (i/e * e); + vt = gen_rtx_CONST_VECTOR (V16QImode, gen_rtvec_v (16, vec)); +- vt = force_const_mem (V16QImode, vt); ++ vt = validize_mem (force_const_mem (V16QImode, vt)); + if (TARGET_XOP) + emit_insn (gen_xop_pperm (mask, mask, mask, vt)); + else +@@ -20234,7 +20234,7 @@ + for (i = 0; i < 16; ++i) + vec[i] = GEN_INT (i % e); + vt = gen_rtx_CONST_VECTOR (V16QImode, gen_rtvec_v (16, vec)); +- vt = force_const_mem (V16QImode, vt); ++ vt = validize_mem (force_const_mem (V16QImode, vt)); + emit_insn (gen_addv16qi3 (mask, mask, vt)); + } + +Index: gcc/config/sh/sh.md +=================================================================== +--- gcc/config/sh/sh.md (.../tags/gcc_4_7_3_release) (revision 198690) ++++ gcc/config/sh/sh.md (.../branches/gcc-4_7-branch) (revision 198690) +@@ -654,7 +654,7 @@ + + (define_insn "tstsi_t_zero_extract_eq" + [(set (reg:SI T_REG) +- (eq:SI (zero_extract:SI (match_operand 0 "logical_operand" "z") ++ (eq:SI (zero_extract:SI (match_operand:SI 0 "logical_operand" "z") + (match_operand:SI 1 "const_int_operand") + (match_operand:SI 2 "const_int_operand")) + (const_int 0)))] +Index: gcc/config/darwin.h +=================================================================== +--- gcc/config/darwin.h (.../tags/gcc_4_7_3_release) (revision 198690) ++++ gcc/config/darwin.h (.../branches/gcc-4_7-branch) (revision 198690) +@@ -356,7 +356,9 @@ + %{!Zbundle:%{pg:%{static:-lgcrt0.o} \ + %{!static:%{object:-lgcrt0.o} \ + %{!object:%{preload:-lgcrt0.o} \ +- %{!preload:-lgcrt1.o %(darwin_crt2)}}}} \ ++ %{!preload:-lgcrt1.o \ ++ %:version-compare(>= 10.8 mmacosx-version-min= -no_new_main) \ ++ %(darwin_crt2)}}}} \ + %{!pg:%{static:-lcrt0.o} \ + %{!static:%{object:-lcrt0.o} \ + %{!object:%{preload:-lcrt0.o} \ +@@ -379,7 +381,7 @@ + #define DARWIN_CRT1_SPEC \ + "%:version-compare(!> 10.5 mmacosx-version-min= -lcrt1.o) \ + %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lcrt1.10.5.o) \ +- %:version-compare(>= 10.6 mmacosx-version-min= -lcrt1.10.6.o) \ ++ %:version-compare(>< 10.6 10.8 mmacosx-version-min= -lcrt1.10.6.o) \ + %{fgnu-tm: -lcrttms.o}" + + /* Default Darwin ASM_SPEC, very simple. */ +@@ -414,6 +416,8 @@ + + #define TARGET_WANT_DEBUG_PUB_SECTIONS true + ++#define TARGET_FORCE_AT_COMP_DIR true ++ + /* When generating stabs debugging, use N_BINCL entries. */ + + #define DBX_USE_BINCL +Index: gcc/config/pa/pa.c +=================================================================== +--- gcc/config/pa/pa.c (.../tags/gcc_4_7_3_release) (revision 198690) ++++ gcc/config/pa/pa.c (.../branches/gcc-4_7-branch) (revision 198690) +@@ -790,7 +790,9 @@ + /* Extract CODE_LABEL. */ + orig = XEXP (orig, 0); + add_reg_note (insn, REG_LABEL_OPERAND, orig); +- LABEL_NUSES (orig)++; ++ /* Make sure we have label and not a note. */ ++ if (LABEL_P (orig)) ++ LABEL_NUSES (orig)++; + } + crtl->uses_pic_offset_table = 1; + return reg; +Index: libgfortran/ChangeLog +=================================================================== +--- libgfortran/ChangeLog (.../tags/gcc_4_7_3_release) (revision 198690) ++++ libgfortran/ChangeLog (.../branches/gcc-4_7-branch) (revision 198690) +@@ -1,3 +1,38 @@ ++2013-04-28 Jerry DeLisle ++ ++ Backport from mainline: ++ 2013-03-20 Tilo Schwarz ++ ++ PR libfortran/51825 ++ * io/list_read.c (nml_read_obj): Don't end the component loop on a ++ nested derived type, but continue with the next loop iteration. ++ (nml_get_obj_data): Don't move the first_nl pointer further in the ++ list if a qualifier was found. ++ ++2013-04-28 Jerry DeLisle ++ ++ Backport from mainline: ++ ++ PR libfortran/56786 ++ * io/list_read.c (nml_parse_qualifier): Remove spurious next_char call ++ when checking for EOF. Use error return mechanism when EOF detected. ++ Do not return FAILURE unless parse_err_msg and parse_err_msg_size have ++ been set. Use hit_eof. ++ (nml_get_obj_data): Likewise use the correct error mechanism. ++ * io/transfer.c (hit_eof): Do not set AFTER_ENDFILE if in namelist ++ mode. ++ ++2013-04-28 Jerry DeLisle ++ ++ Backport from mainline: ++ 2013-03-25 Tilo Schwarz ++ ++ PR libfortran/52512 ++ * io/list_read.c (nml_parse_qualifier): To check for a derived type ++ don't use the namelist head element type but the current element type. ++ (nml_get_obj_data): Add current namelist element type to ++ nml_parse_qualifier call. ++ + 2013-04-11 Release Manager + + * GCC 4.7.3 released. +Index: libgfortran/io/list_read.c +=================================================================== +--- libgfortran/io/list_read.c (.../tags/gcc_4_7_3_release) (revision 198690) ++++ libgfortran/io/list_read.c (.../branches/gcc-4_7-branch) (revision 198690) +@@ -2028,8 +2028,8 @@ + + static try + nml_parse_qualifier (st_parameter_dt *dtp, descriptor_dimension *ad, +- array_loop_spec *ls, int rank, char *parse_err_msg, +- size_t parse_err_msg_size, ++ array_loop_spec *ls, int rank, bt nml_elem_type, ++ char *parse_err_msg, size_t parse_err_msg_size, + int *parsed_rank) + { + int dim; +@@ -2053,7 +2053,7 @@ + /* The next character in the stream should be the '('. */ + + if ((c = next_char (dtp)) == EOF) +- return FAILURE; ++ goto err_ret; + + /* Process the qualifier, by dimension and triplet. */ + +@@ -2067,7 +2067,7 @@ + + /* Process a potential sign. */ + if ((c = next_char (dtp)) == EOF) +- return FAILURE; ++ goto err_ret; + switch (c) + { + case '-': +@@ -2085,11 +2085,12 @@ + /* Process characters up to the next ':' , ',' or ')'. */ + for (;;) + { +- if ((c = next_char (dtp)) == EOF) +- return FAILURE; +- ++ c = next_char (dtp); + switch (c) + { ++ case EOF: ++ goto err_ret; ++ + case ':': + is_array_section = 1; + break; +@@ -2112,10 +2113,8 @@ + push_char (dtp, c); + continue; + +- case ' ': case '\t': ++ case ' ': case '\t': case '\r': case '\n': + eat_spaces (dtp); +- if ((c = next_char (dtp) == EOF)) +- return FAILURE; + break; + + default: +@@ -2204,7 +2203,7 @@ + do not allow excess data to be processed. */ + if (is_array_section == 1 + || !(compile_options.allow_std & GFC_STD_GNU) +- || dtp->u.p.ionml->type == BT_DERIVED) ++ || nml_elem_type == BT_DERIVED) + ls[dim].end = ls[dim].start; + else + dtp->u.p.expanded_read = 1; +@@ -2257,6 +2256,15 @@ + + err_ret: + ++ /* The EOF error message is issued by hit_eof. Return true so that the ++ caller does not use parse_err_msg and parse_err_msg_size to generate ++ an unrelated error message. */ ++ if (c == EOF) ++ { ++ hit_eof (dtp); ++ dtp->u.p.input_complete = 1; ++ return SUCCESS; ++ } + return FAILURE; + } + +@@ -2553,17 +2561,17 @@ + since a single object can have multiple reads. */ + dtp->u.p.expanded_read = 0; + +- /* Now loop over the components. Update the component pointer +- with the return value from nml_write_obj. This loop jumps +- past nested derived types by testing if the potential +- component name contains '%'. */ ++ /* Now loop over the components. */ + + for (cmp = nl->next; + cmp && +- !strncmp (cmp->var_name, obj_name, obj_name_len) && +- !strchr (cmp->var_name + obj_name_len, '%'); ++ !strncmp (cmp->var_name, obj_name, obj_name_len); + cmp = cmp->next) + { ++ /* Jump over nested derived type by testing if the potential ++ component name contains '%'. */ ++ if (strchr (cmp->var_name + obj_name_len, '%')) ++ continue; + + if (nml_read_obj (dtp, cmp, (index_type)(pdata - nl->mem_pos), + pprev_nl, nml_err_msg, nml_err_msg_size, +@@ -2726,12 +2734,12 @@ + return SUCCESS; + + if ((c = next_char (dtp)) == EOF) +- return FAILURE; ++ goto nml_err_ret; + switch (c) + { + case '=': + if ((c = next_char (dtp)) == EOF) +- return FAILURE; ++ goto nml_err_ret; + if (c != '?') + { + snprintf (nml_err_msg, nml_err_msg_size, +@@ -2781,8 +2789,9 @@ + if (!is_separator (c)) + push_char (dtp, tolower(c)); + if ((c = next_char (dtp)) == EOF) +- return FAILURE; +- } while (!( c=='=' || c==' ' || c=='\t' || c =='(' || c =='%' )); ++ goto nml_err_ret; ++ } ++ while (!( c=='=' || c==' ' || c=='\t' || c =='(' || c =='%' )); + + unget_char (dtp, c); + +@@ -2842,7 +2851,7 @@ + { + parsed_rank = 0; + if (nml_parse_qualifier (dtp, nl->dim, nl->ls, nl->var_rank, +- nml_err_msg, nml_err_msg_size, ++ nl->type, nml_err_msg, nml_err_msg_size, + &parsed_rank) == FAILURE) + { + char *nml_err_msg_end = strchr (nml_err_msg, '\0'); +@@ -2857,7 +2866,7 @@ + qualifier_flag = 1; + + if ((c = next_char (dtp)) == EOF) +- return FAILURE; ++ goto nml_err_ret; + unget_char (dtp, c); + } + else if (nl->var_rank > 0) +@@ -2876,14 +2885,15 @@ + goto nml_err_ret; + } + +- if (*pprev_nl == NULL || !component_flag) ++ /* Don't move first_nl further in the list if a qualifier was found. */ ++ if ((*pprev_nl == NULL && !qualifier_flag) || !component_flag) + first_nl = nl; + + root_nl = nl; + + component_flag = 1; + if ((c = next_char (dtp)) == EOF) +- return FAILURE; ++ goto nml_err_ret; + goto get_name; + } + +@@ -2898,8 +2908,8 @@ + descriptor_dimension chd[1] = { {1, clow, nl->string_length} }; + array_loop_spec ind[1] = { {1, clow, nl->string_length, 1} }; + +- if (nml_parse_qualifier (dtp, chd, ind, -1, nml_err_msg, +- nml_err_msg_size, &parsed_rank) ++ if (nml_parse_qualifier (dtp, chd, ind, -1, nl->type, ++ nml_err_msg, nml_err_msg_size, &parsed_rank) + == FAILURE) + { + char *nml_err_msg_end = strchr (nml_err_msg, '\0'); +@@ -2921,7 +2931,7 @@ + } + + if ((c = next_char (dtp)) == EOF) +- return FAILURE; ++ goto nml_err_ret; + unget_char (dtp, c); + } + +@@ -2961,7 +2971,7 @@ + return SUCCESS; + + if ((c = next_char (dtp)) == EOF) +- return FAILURE; ++ goto nml_err_ret; + + if (c != '=') + { +@@ -2996,6 +3006,17 @@ + + nml_err_ret: + ++ /* The EOF error message is issued by hit_eof. Return true so that the ++ caller does not use nml_err_msg and nml_err_msg_size to generate ++ an unrelated error message. */ ++ if (c == EOF) ++ { ++ dtp->u.p.input_complete = 1; ++ unget_char (dtp, c); ++ hit_eof (dtp); ++ return SUCCESS; ++ } ++ + return FAILURE; + } + +Index: libgfortran/io/transfer.c +=================================================================== +--- libgfortran/io/transfer.c (.../tags/gcc_4_7_3_release) (revision 198690) ++++ libgfortran/io/transfer.c (.../branches/gcc-4_7-branch) (revision 198690) +@@ -3748,7 +3748,7 @@ + case NO_ENDFILE: + case AT_ENDFILE: + generate_error (&dtp->common, LIBERROR_END, NULL); +- if (!is_internal_unit (dtp)) ++ if (!is_internal_unit (dtp) && !dtp->u.p.namelist_mode) + { + dtp->u.p.current_unit->endfile = AFTER_ENDFILE; + dtp->u.p.current_unit->current_record = 0;