public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [libgfortran, committed] Include <strings.h> when using strncasecmp
@ 2016-12-21  9:55 FX
  0 siblings, 0 replies; only message in thread
From: FX @ 2016-12-21  9:55 UTC (permalink / raw)
  To: Fortran List; +Cc: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 493 bytes --]

The POSIX function strncasecmp() is used in three libgfortran files. It is located in <strings.h>, but these files include <string.h> (singular vs. plural). Apparently most implementations (linux, darwin, …) are lenient and allow that, but not mingw32, causing PR 70311 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70311)

The attached patch, bootstrapped and regtested on x86_64-apple-darwin16.3.0, fixes the issue by including the proper header.
Committed as revision 243843.

FX


[-- Attachment #2: strings.diff --]
[-- Type: application/octet-stream, Size: 1672 bytes --]

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 243841)
+++ ChangeLog	(working copy)
@@ -1,5 +1,12 @@
 2016-12-21  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
 
+	PR libfortran/70311
+	* intrinsics/selected_char_kind.c: Include <strings.h> header.
+	* runtime/environ.c: Include <strings.h> header.
+	* runtime/string.c: Include <strings.h> header.
+
+2016-12-21  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
+
 	* gfortran.map: Remove _gfortran_ftell2.
 	* io/intrinsics.c (ftell): Remove.
 	(ftell2): Rename to ftell.
Index: intrinsics/selected_char_kind.c
===================================================================
--- intrinsics/selected_char_kind.c	(revision 243826)
+++ intrinsics/selected_char_kind.c	(working copy)
@@ -25,7 +25,7 @@ see the files COPYING3 and COPYING.RUNTI
 
 #include "libgfortran.h"
 
-#include <string.h>
+#include <strings.h>
 
 
 extern GFC_INTEGER_4 selected_char_kind (gfc_charlen_type, char *);
Index: runtime/environ.c
===================================================================
--- runtime/environ.c	(revision 243826)
+++ runtime/environ.c	(working copy)
@@ -25,6 +25,7 @@ see the files COPYING3 and COPYING.RUNTI
 #include "libgfortran.h"
 
 #include <string.h>
+#include <strings.h>
 #include <stdlib.h>
 #include <ctype.h>
 
Index: runtime/string.c
===================================================================
--- runtime/string.c	(revision 243826)
+++ runtime/string.c	(working copy)
@@ -24,6 +24,7 @@ see the files COPYING3 and COPYING.RUNTI
 
 #include "libgfortran.h"
 #include <string.h>
+#include <strings.h>
 #include <stdlib.h>
 
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-12-21  9:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-21  9:55 [libgfortran, committed] Include <strings.h> when using strncasecmp FX

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).