This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gfortran] committed: Fix PR 20059


I committed this fix for PR 20059 to the mailine and 4.0 under the obviously
correct rule.  We would segfault on some platforms if a common block needed
padding.

Bubblestrapped and tested.  Andrew Pinski verified that it indeed fixes the
problem on Darwin.

- Tobi

Index: fortran/ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/ChangeLog,v
retrieving revision 1.404
diff -u -p -r1.404 ChangeLog
--- fortran/ChangeLog   23 Apr 2005 21:28:58 -0000      1.404
+++ fortran/ChangeLog   24 Apr 2005 13:50:07 -0000
@@ -1,3 +1,9 @@
+2005-04-24  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>
+
+       PR fortran/20059
+       * trans-common.c (translate_common): Cast offset and
+       common_segment->offset to type int for warning message.
+
 2005-04-23  DJ Delorie  <dj@redhat.com>

        * trans-decl.c: Adjust warning() callers.
Index: fortran/trans-common.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/trans-common.c,v
retrieving revision 1.26
diff -u -p -r1.26 trans-common.c
--- fortran/trans-common.c      26 Mar 2005 05:34:58 -0000      1.26
+++ fortran/trans-common.c      24 Apr 2005 13:50:07 -0000
@@ -848,7 +848,7 @@ translate_common (gfc_common_head *commo
                 requirements.  Insert padding immediately before this
                 segment.  */
              gfc_warning ("Padding of %d bytes required before '%s' in "
-                          "COMMON '%s' at %L", offset, s->sym->name,
+                          "COMMON '%s' at %L", (int)offset, s->sym->name,
                           common->name, &common->where);
            }
          else
@@ -874,7 +874,7 @@ translate_common (gfc_common_head *commo
   if (common_segment->offset != 0)
     {
       gfc_warning ("COMMON '%s' at %L requires %d bytes of padding at start",
-                  common->name, &common->where, common_segment->offset);
+                  common->name, &common->where, (int)common_segment->offset);
     }

   create_common (common, common_segment, saw_equiv);
Index: testsuite/ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/ChangeLog,v
retrieving revision 1.5389
diff -u -p -r1.5389 ChangeLog
--- testsuite/ChangeLog 23 Apr 2005 21:34:37 -0000      1.5389
+++ testsuite/ChangeLog 24 Apr 2005 13:50:13 -0000
@@ -1,3 +1,8 @@
+2005-04-24  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>
+
+       PR fortran/20059
+       * gfortran.dg/common_5.f: New test.
+
 2005-04-23  Richard Guenther  <rguenth@gcc.gnu.org>

        PR middle-end/21082
Index: testsuite/gfortran.dg/common_5.f
===================================================================
RCS file: testsuite/gfortran.dg/common_5.f
diff -N testsuite/gfortran.dg/common_5.f
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ testsuite/gfortran.dg/common_5.f    24 Apr 2005 13:50:13 -0000
@@ -0,0 +1,10 @@
+C { dg-do compile }
+C PR 20059
+C Check that the warning for padding works correctly.
+      SUBROUTINE PLOTZ
+      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
+      COMMON /CCPOOL/ RMIN,RMAX,ZMIN,ZMAX,IMIN,JMIN,IMAX,JMAX,NFLOP, ! {
dg-warning "Padding" }
+     $ HTP
+C
+        RETURN
+      END


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]