This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/22423] Warnings when building libgfortran
- From: "fxcoudert at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Oct 2007 13:22:40 -0000
- Subject: [Bug libfortran/22423] Warnings when building libgfortran
- References: <bug-22423-10258@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #14 from fxcoudert at gcc dot gnu dot org 2007-10-18 13:22 -------
(In reply to comment #13)
> ../../../libgfortran/runtime/environ.c:312: warning: 'init_choice' defined but
> not used
> ../../../libgfortran/runtime/environ.c:339: warning: 'show_choice' defined but
> not used
These two have been removed by Ben Elliston.
> ../../../libgfortran/runtime/backtrace.c:66: warning: 'local_strcasestr'
> defined but not used
Fixed by the following:
Index: runtime/backtrace.c
===================================================================
--- runtime/backtrace.c (revision 129403)
+++ runtime/backtrace.c (working copy)
@@ -60,7 +60,18 @@ Boston, MA 02110-1301, USA. */
#include <ctype.h>
+/* Macros for common sets of capabilities: can we fork and exec, can
+ we use glibc-style backtrace functions, and can we use pipes. */
+#define CAN_FORK (defined(HAVE_FORK) && defined(HAVE_EXECVP) \
+ && defined(HAVE_WAIT))
+#define GLIBC_BACKTRACE (defined(HAVE_BACKTRACE) \
+ && defined(HAVE_BACKTRACE_SYMBOLS))
+#define CAN_PIPE (CAN_FORK && defined(HAVE_PIPE) \
+ && defined(HAVE_DUP2) && defined(HAVE_FDOPEN) \
+ && defined(HAVE_CLOSE))
+
+#if GLIBC_BACKTRACE && CAN_PIPE
static char *
local_strcasestr (const char *s1, const char *s2)
{
@@ -85,14 +96,7 @@ local_strcasestr (const char *s1, const
}
#endif
}
-
-#define CAN_FORK (defined(HAVE_FORK) && defined(HAVE_EXECVP) \
- && defined(HAVE_WAIT))
-#define GLIBC_BACKTRACE (defined(HAVE_BACKTRACE) \
- && defined(HAVE_BACKTRACE_SYMBOLS))
-#define CAN_PIPE (CAN_FORK && defined(HAVE_PIPE) \
- && defined(HAVE_DUP2) && defined(HAVE_FDOPEN) \
- && defined(HAVE_CLOSE))
+#endif
#if GLIBC_BACKTRACE
> ../../../libgfortran/runtime/main.c:179: warning: passing argument 1 of 'free'
> discards qualifiers from pointer target type
Fixed by:
Index: runtime/main.c
===================================================================
--- runtime/main.c (revision 129403)
+++ runtime/main.c (working copy)
@@ -176,5 +176,5 @@ cleanup (void)
close_units ();
if (please_free_exe_path_when_done)
- free (exe_path);
+ free ((char *) exe_path);
}
> ../../../../libgfortran/intrinsics/signal.c:201: warning: cast to pointer from
> integer of different size
> ../../../../libgfortran/intrinsics/signal.c:208: warning: cast to pointer from
> integer of different size
> ../../../../libgfortran/intrinsics/signal.c:229: warning: cast to pointer from
> integer of different size
> ../../../../libgfortran/intrinsics/signal.c:236: warning: cast to pointer from
> integer of different size
This should be silenced by:
Index: intrinsics/signal.c
===================================================================
--- intrinsics/signal.c (revision 129403)
+++ intrinsics/signal.c (working copy)
@@ -198,14 +198,14 @@ alarm_sub_int_i4 (int *seconds, int *han
#if defined (SIGALRM) && defined (HAVE_ALARM) && defined (HAVE_SIGNAL)
if (status != NULL)
{
- if (signal (SIGALRM, (void (*)(int)) *handler) == SIG_ERR)
+ if (signal (SIGALRM, (void (*)(int)) (INTPTR_T) *handler) == SIG_ERR)
*status = -1;
else
*status = alarm (*seconds);
}
else
{
- signal (SIGALRM, (void (*)(int)) *handler);
+ signal (SIGALRM, (void (*)(int)) (INTPTR_T) *handler);
alarm (*seconds);
}
#else
@@ -226,14 +226,14 @@ alarm_sub_int_i8 (int *seconds, int *han
#if defined (SIGALRM) && defined (HAVE_ALARM) && defined (HAVE_SIGNAL)
if (status != NULL)
{
- if (signal (SIGALRM, (void (*)(int)) *handler) == SIG_ERR)
+ if (signal (SIGALRM, (void (*)(int)) (INTPTR_T) *handler) == SIG_ERR)
*status = -1;
else
*status = alarm (*seconds);
}
else
{
- signal (SIGALRM, (void (*)(int)) *handler);
+ signal (SIGALRM, (void (*)(int)) (INTPTR_T) *handler);
alarm (*seconds);
}
#else
> ../../../libgfortran/intrinsics/spread_generic.c:136: warning: format '%d'
> expects type 'int', but argument 2 has type 'long int'
> ../../../libgfortran/intrinsics/spread_generic.c:147: warning: format '%d'
> expects type 'int', but argument 2 has type 'long int'
Fixed by:
Index: intrinsics/spread_generic.c
===================================================================
--- intrinsics/spread_generic.c (revision 129403)
+++ intrinsics/spread_generic.c (working copy)
@@ -131,9 +131,9 @@ spread_internal (gfc_array_char *ret, co
if (ret_extent != ncopies)
runtime_error("Incorrect extent in return value of SPREAD"
- " intrinsic in dimension %d: is %ld,"
- " should be %ld", n+1, (long int) ret_extent,
- (long int) ncopies);
+ " intrinsic in dimension %ld: is %ld,"
+ " should be %ld", (long int) n+1,
+ (long int) ret_extent, (long int) ncopies);
}
else
{
@@ -142,8 +142,9 @@ spread_internal (gfc_array_char *ret, co
- source->dim[dim].lbound;
if (ret_extent != extent[dim])
runtime_error("Incorrect extent in return value of SPREAD"
- " intrinsic in dimension %d: is %ld,"
- " should be %ld", n+1, (long int) ret_extent,
+ " intrinsic in dimension %ld: is %ld,"
+ " should be %ld", (long int) n+1,
+ (long int) ret_extent,
(long int) extent[dim]);
if (extent[dim] <= 0)
> ../../../libgfortran/io/list_read.c:1518: warning: argument 'type' might be
> clobbered by 'longjmp' or 'vfork'
This one is longstanding. We need to audit and see if there is a potential
problem in making type volatile.
> ../../../libgfortran/intrinsics/pack_generic.c:316: warning: passing argument 3
> of 'pack_internal' from incompatible pointer type
> ../../../libgfortran/intrinsics/pack_generic.c:331: warning: passing argument 3
> of 'pack_internal' from incompatible pointer type
> ../../../libgfortran/intrinsics/unpack_generic.c:201: warning: passing argument
> 3 of 'unpack_internal' from incompatible pointer type
> ../../../libgfortran/intrinsics/unpack_generic.c:217: warning: passing argument
> 3 of 'unpack_internal' from incompatible pointer type
> ../../../libgfortran/intrinsics/unpack_generic.c:233: warning: passing argument
> 3 of 'unpack_internal' from incompatible pointer type
> ../../../libgfortran/intrinsics/unpack_generic.c:253: warning: passing argument
> 3 of 'unpack_internal' from incompatible pointer type
These ones are worrying me. I think they were introduced by Thomas Koenig.
Thomas, can you give it a look?
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tkoenig at gcc dot gnu dot
| |org
Last reconfirmed|2007-01-18 17:45:32 |2007-10-18 13:22:40
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22423