rpms/gcc/devel gcc4-pr18518.patch, NONE, 1.1 gcc4-pr23677.patch, NONE, 1.1 gcc4.spec, 1.75, 1.76

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Thu Sep 29 11:15:59 UTC 2005


Author: jakub

Update of /cvs/dist/rpms/gcc/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv8818

Modified Files:
	gcc4.spec 
Added Files:
	gcc4-pr18518.patch gcc4-pr23677.patch 
Log Message:
4.0.2-1


gcc4-pr18518.patch:
 fortran/trans-common.c                                |   12 +++++++--
 testsuite/gfortran.fortran-torture/execute/save_2.f90 |   23 ++++++++++++++++++
 2 files changed, 32 insertions(+), 3 deletions(-)

--- NEW FILE gcc4-pr18518.patch ---
2005-09-27  Jakub Jelinek  <jakub at redhat.com>

	PR fortran/18518
	* trans-common.c (build_equiv_decl): Add IS_SAVED argument.
	If it is true, set TREE_STATIC on the decl.
	(create_common): If any symbol in equivalence has SAVE attribute,
	pass true as last argument to build_equiv_decl.

	* gfortran.fortran-torture/execute/save_2.f90: New decl.

--- fortran/trans-common.c.jj	2005-09-09 09:49:39.000000000 +0200
+++ fortran/trans-common.c	2005-09-27 21:51:53.000000000 +0200
@@ -268,7 +268,7 @@ build_field (segment_info *h, tree union
 /* Get storage for local equivalence.  */
 
 static tree
-build_equiv_decl (tree union_type, bool is_init)
+build_equiv_decl (tree union_type, bool is_init, bool is_saved)
 {
   tree decl;
   char name[15];
@@ -286,7 +286,8 @@ build_equiv_decl (tree union_type, bool 
   DECL_ARTIFICIAL (decl) = 1;
   DECL_IGNORED_P (decl) = 1;
 
-  if (!gfc_can_put_var_on_stack (DECL_SIZE_UNIT (decl)))
+  if (!gfc_can_put_var_on_stack (DECL_SIZE_UNIT (decl))
+      || is_saved)
     TREE_STATIC (decl) = 1;
 
   TREE_ADDRESSABLE (decl) = 1;
@@ -385,6 +386,7 @@ create_common (gfc_common_head *com, seg
   record_layout_info rli;
   tree decl;
   bool is_init = false;
+  bool is_saved = false;
 
   /* Declare the variables inside the common block.
      If the current common block contains any equivalence object, then
@@ -410,13 +412,17 @@ create_common (gfc_common_head *com, seg
       /* Has initial value.  */
       if (s->sym->value)
         is_init = true;
+
+      /* Has SAVE attribute.  */
+      if (s->sym->attr.save)
+        is_saved = true;
     }
   finish_record_layout (rli, true);
 
   if (com)
     decl = build_common_decl (com, union_type, is_init);
   else
-    decl = build_equiv_decl (union_type, is_init);
+    decl = build_equiv_decl (union_type, is_init, is_saved);
 
   if (is_init)
     {
--- testsuite/gfortran.fortran-torture/execute/save_2.f90.jj	2005-09-27 22:02:03.000000000 +0200
+++ testsuite/gfortran.fortran-torture/execute/save_2.f90	2005-09-27 22:01:48.000000000 +0200
@@ -0,0 +1,23 @@
+! PR fortran/18518
+      program main
+	call foo
+	call bar
+	call foo
+      end program main
+
+      subroutine foo
+	integer i,g,h
+	data i/0/
+	equivalence (g,h)
+	save g
+	if (i == 0) then
+	   i = 1
+	   h = 12345
+	end if
+	if (h .ne. 12345) call abort
+      end subroutine foo
+
+      subroutine bar
+	integer a(10)
+	a = 34
+      end subroutine bar

gcc4-pr23677.patch:
 fortran/options.c                                     |    4 ++
 fortran/resolve.c                                     |    2 -
 fortran/symbol.c                                      |    2 -
 testsuite/gfortran.dg/save_1.f90                      |   30 ++++++++++++++++++
 testsuite/gfortran.fortran-torture/execute/save_1.f90 |   29 +++++++++++++++++
 5 files changed, 65 insertions(+), 2 deletions(-)

--- NEW FILE gcc4-pr23677.patch ---
2005-09-26  Jakub Jelinek  <jakub at redhat.com>

	PR fortran/23677
	* symbol.c (gfc_is_var_automatic): Return true if character length
	is non-constant rather than constant.
	* resolve.c (gfc_resolve): Don't handle !gfc_option.flag_automatic
	here.
	* options.c (gfc_post_options): Set gfc_option.flag_max_stack_var_size
	to 0 for -fno-automatic.

	* gfortran.fortran-torture/execute/save_1.f90: New test.
	* gfortran.dg/save_1.f90: New test.

--- gcc/fortran/options.c.jj	2005-09-13 11:08:40.000000000 +0200
+++ gcc/fortran/options.c	2005-09-26 16:25:02.000000000 +0200
@@ -223,6 +223,10 @@ gfc_post_options (const char **pfilename
   if (gfc_option.flag_second_underscore == -1)
     gfc_option.flag_second_underscore = gfc_option.flag_f2c;
 
+  /* Implement -fno-automatic as -fmax-stack-var-size=0.  */
+  if (!gfc_option.flag_automatic)
+    gfc_option.flag_max_stack_var_size = 0;
+
   return false;
 }
 
--- gcc/fortran/symbol.c.jj	2005-09-19 22:45:54.000000000 +0200
+++ gcc/fortran/symbol.c	2005-09-26 16:15:35.000000000 +0200
@@ -2345,7 +2345,7 @@ gfc_is_var_automatic (gfc_symbol * sym)
   /* Check for non-constant length character variables.  */
   if (sym->ts.type == BT_CHARACTER
       && sym->ts.cl
-      && gfc_is_constant_expr (sym->ts.cl->length))
+      && !gfc_is_constant_expr (sym->ts.cl->length))
     return true;
   return false;
 }
--- gcc/fortran/resolve.c.jj	2005-09-26 08:39:40.000000000 +0200
+++ gcc/fortran/resolve.c	2005-09-26 16:15:58.000000000 +0200
@@ -5107,7 +5107,7 @@ gfc_resolve (gfc_namespace * ns)
 
   gfc_traverse_ns (ns, resolve_values);
 
-  if (!gfc_option.flag_automatic || ns->save_all)
+  if (ns->save_all)
     gfc_save_all (ns);
 
   iter_stack = NULL;
--- gcc/testsuite/gfortran.dg/save_1.f90.jj	2005-09-26 09:20:34.000000000 +0200
+++ gcc/testsuite/gfortran.dg/save_1.f90	2005-09-26 09:22:23.000000000 +0200
@@ -0,0 +1,30 @@
+! { dg-options "-O2 -fno-automatic" }
+      subroutine foo (b)
+	logical b
+	integer i, j
+	character*24 s
+	save i
+	if (b) then
+	  i = 26
+	  j = 131
+	  s = 'This is a test string'
+	else
+	  if (i .ne. 26 .or. j .ne. 131) call abort
+	  if (s .ne. 'This is a test string') call abort
+	end if
+      end subroutine foo
+      subroutine bar (s)
+	character*42 s
+	if (s .ne. '0123456789012345678901234567890123456') call abort
+	call foo (.false.)
+      end subroutine bar
+      subroutine baz
+	character*42 s
+	! Just clobber stack a little bit.
+	s = '0123456789012345678901234567890123456'
+	call bar (s)
+      end subroutine baz
+      call foo (.true.)
+      call baz
+      call foo (.false.)
+      end
--- gcc/testsuite/gfortran.fortran-torture/execute/save_1.f90.jj	2005-09-26 09:19:56.000000000 +0200
+++ gcc/testsuite/gfortran.fortran-torture/execute/save_1.f90	2005-09-26 09:21:36.000000000 +0200
@@ -0,0 +1,29 @@
+      subroutine foo (b)
+	logical b
+	integer i, j
+	character*24 s
+	save
+	if (b) then
+	  i = 26
+	  j = 131
+	  s = 'This is a test string'
+	else
+	  if (i .ne. 26 .or. j .ne. 131) call abort
+	  if (s .ne. 'This is a test string') call abort
+	end if
+      end subroutine foo
+      subroutine bar (s)
+	character*42 s
+	if (s .ne. '0123456789012345678901234567890123456') call abort
+	call foo (.false.)
+      end subroutine bar
+      subroutine baz
+	character*42 s
+	! Just clobber stack a little bit.
+	s = '0123456789012345678901234567890123456'
+	call bar (s)
+      end subroutine baz
+      call foo (.true.)
+      call baz
+      call foo (.false.)
+      end


Index: gcc4.spec
===================================================================
RCS file: /cvs/dist/rpms/gcc/devel/gcc4.spec,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -r1.75 -r1.76
--- gcc4.spec	29 Sep 2005 10:58:53 -0000	1.75
+++ gcc4.spec	29 Sep 2005 11:15:56 -0000	1.76
@@ -112,6 +112,8 @@
 Patch30: gcc4-pr23818.patch
 Patch31: gcc4-pr23863.patch
 Patch32: gcc4-pr24109.patch
+Patch33: gcc4-pr18518.patch
+Patch34: gcc4-pr23677.patch
 
 %define _gnu %{nil}
 %ifarch sparc
@@ -453,6 +455,8 @@
 %patch30 -p0 -b .pr23818~
 %patch31 -p0 -b .pr23863~
 %patch32 -p0 -b .pr24109~
+%patch33 -p0 -b .pr18518~
+%patch34 -p0 -b .pr23677~
 
 perl -pi -e 's/4\.0\.3/4.0.2/' gcc/version.c
 perl -pi -e 's/"%{gcc_version}"/"%{gcc_version} \(release\)"/' gcc/version.c
@@ -1499,6 +1503,8 @@
 - fix a bug which caused undefined __compound_literal.* symbols
   on Linux kernel (PR middle-end/24109)
 - add LIBGCJ_LICENSE file to %%doc (#163922)
+- fix Fortran EQUIVALENCE interaction with SAVE (PR fortran/18518, #168252)
+- fix Fortran -fno-automatic (PR fortran/23677, #168355)
 - fix ppc64 libffi (Tom Tromey, #166657)
 
 * Mon Sep 19 2005 Jakub Jelinek  <jakub at redhat.com> 4.0.1-14




More information about the fedora-cvs-commits mailing list