Fix libgfortran/intrinsics/system_clock.c

Andreas Jaeger aj@suse.de
Sun May 15 12:33:00 GMT 2005


Looking at these two warnings:
/cvs/gcc/libgfortran/intrinsics/system_clock.c:70: warning: ‘cnt’ may be used uninitialized in this function
/cvs/gcc/libgfortran/intrinsics/system_clock.c:146: warning: ‘cnt’ may be used uninitialized in this function

I noticed that the warning is correct - we do miss a return statement!

Ok to commit?  Tested on Linux/x86-64,

Andreas

2005-05-15  Andreas Jaeger  <aj@suse.de>

	* intrinsics/system_clock.c (system_clock_4, system_clock_8): Add
	missing returns, reformat a bit.

============================================================
Index: libgfortran/intrinsics/system_clock.c
--- intrinsics/system_clock.c	12 Jan 2005 21:27:30 -0000	1.4
+++ intrinsics/system_clock.c	15 May 2005 12:32:38 -0000
@@ -1,5 +1,5 @@
 /* Implementation of the SYSTEM_CLOCK intrinsic.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 Free Software Foundation, Inc.
 
 This file is part of the GNU Fortran 95 runtime library (libgfortran).
 
@@ -104,9 +104,13 @@ system_clock_4(GFC_INTEGER_4 *count, GFC
     }
   else
     {
-      if (count != NULL) *count = - GFC_INTEGER_4_HUGE;
-      if (count_rate != NULL) *count_rate = 0;
-      if (count_max != NULL) *count_max = 0;
+      if (count != NULL)
+	*count = - GFC_INTEGER_4_HUGE;
+      if (count_rate != NULL)
+	*count_rate = 0;
+      if (count_max != NULL)
+	*count_max = 0;
+      return;
     }
 #elif defined(HAVE_TIME_H)
   time_t t, t1;
@@ -131,9 +135,12 @@ system_clock_4(GFC_INTEGER_4 *count, GFC
   cnt = - GFC_INTEGER_4_HUGE;
   mx = 0;
 #endif
-  if (count != NULL) *count = cnt;
-  if (count_rate != NULL) *count_rate = TCK;
-  if (count_max != NULL) *count_max = mx;
+  if (count != NULL)
+    *count = cnt;
+  if (count_rate != NULL)
+    *count_rate = TCK;
+  if (count_max != NULL)
+    *count_max = mx;
 }
 
 
@@ -180,9 +187,14 @@ system_clock_8 (GFC_INTEGER_8 *count, GF
     }
   else
     {
-      if (count != NULL) *count = - GFC_INTEGER_8_HUGE;
-      if (count_rate != NULL) *count_rate = 0;
-      if (count_max != NULL) *count_max = 0;
+      if (count != NULL)
+	*count = - GFC_INTEGER_8_HUGE;
+      if (count_rate != NULL)
+	*count_rate = 0;
+      if (count_max != NULL)
+	*count_max = 0;
+
+      return;
     }
 #elif defined(HAVE_TIME_H)
   time_t t, t1;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20050515/6a91c6c6/attachment.sig>
-------------- next part --------------

-- 
 Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
  SUSE Linux Products GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
   GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20050515/6a91c6c6/attachment-0001.sig>


More information about the Fortran mailing list