This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

Fix libgfortran/intrinsics/system_clock.c


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;

Attachment: pgp00000.pgp
Description: PGP signature

-- 
 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

Attachment: pgp00001.pgp
Description: PGP signature


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