public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: FX <fxcoudert@gmail.com>
To: Fortran List <fortran@gcc.gnu.org>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: [libgfortran, committed] Include <strings.h> when using strncasecmp
Date: Wed, 21 Dec 2016 09:55:00 -0000	[thread overview]
Message-ID: <4D2670C4-32BE-4B72-B063-8E741D97B09F@gmail.com> (raw)

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

                 reply	other threads:[~2016-12-21  9:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D2670C4-32BE-4B72-B063-8E741D97B09F@gmail.com \
    --to=fxcoudert@gmail.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).