public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/63471] New: [5.0 Regression] unix.c:1906:10: error: implicit declaration of function 'ttyname_r'
@ 2014-10-07 16:41 danglin at gcc dot gnu.org
  2014-10-08 11:13 ` [Bug libfortran/63471] " rguenth at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: danglin at gcc dot gnu.org @ 2014-10-07 16:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63471

            Bug ID: 63471
           Summary: [5.0 Regression] unix.c:1906:10: error: implicit
                    declaration of function 'ttyname_r'
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: danglin at gcc dot gnu.org
              Host: hppa64-hp-hpux11.11
            Target: hppa64-hp-hpux11.11
             Build: hppa64-hp-hpux11.11

libtool: compile:  /test/gnu/gcc/objdir/./gcc/xgcc
-B/test/gnu/gcc/objdir/./gcc/
 -B/opt/gnu64/gcc/gcc-5.0/hppa64-hp-hpux11.11/bin/
-B/opt/gnu64/gcc/gcc-5.0/hppa
64-hp-hpux11.11/lib/ -isystem
/opt/gnu64/gcc/gcc-5.0/hppa64-hp-hpux11.11/include
 -isystem /opt/gnu64/gcc/gcc-5.0/hppa64-hp-hpux11.11/sys-include
-DHAVE_CONFIG_H
 -I. -I../../../gcc/libgfortran -iquote../../../gcc/libgfortran/io
-I../../../gc
c/libgfortran/../gcc -I../../../gcc/libgfortran/../gcc/config
-I../../../gcc/lib
gfortran/../libquadmath -I../.././gcc -I../../../gcc/libgfortran/../libgcc
-I../libgcc -std=gnu11 -Wall -Wstrict-prototypes -Wmissing-prototypes
-Wold-style-definition -Wextra -Wwrite-strings
-Werror=implicit-function-declaration -fcx-fortran-rules -ffunction-sections
-fdata-sections -g -O2 -MT unix.lo -MD -MP -MF .deps/unix.Tpo -c
../../../gcc/libgfortran/io/unix.c  -DPIC -o .libs/unix.o
../../../gcc/libgfortran/io/unix.c: In function 'stream_ttyname':
../../../gcc/libgfortran/io/unix.c:1906:10: error: implicit declaration of
function 'ttyname_r' [-Werror=implicit-function-declaration]
   return ttyname_r (((unix_stream *) s)->fd, buf, buflen);
          ^
cc1: some warnings being treated as errors
make[3]: *** [unix.lo] Error 1

Probably _REENTRANT is not defined.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libfortran/63471] [5.0 Regression] unix.c:1906:10: error: implicit declaration of function 'ttyname_r'
  2014-10-07 16:41 [Bug libfortran/63471] New: [5.0 Regression] unix.c:1906:10: error: implicit declaration of function 'ttyname_r' danglin at gcc dot gnu.org
@ 2014-10-08 11:13 ` rguenth at gcc dot gnu.org
  2014-10-08 13:31 ` jb at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-10-08 11:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63471

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |5.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libfortran/63471] [5.0 Regression] unix.c:1906:10: error: implicit declaration of function 'ttyname_r'
  2014-10-07 16:41 [Bug libfortran/63471] New: [5.0 Regression] unix.c:1906:10: error: implicit declaration of function 'ttyname_r' danglin at gcc dot gnu.org
  2014-10-08 11:13 ` [Bug libfortran/63471] " rguenth at gcc dot gnu.org
@ 2014-10-08 13:31 ` jb at gcc dot gnu.org
  2014-10-08 13:43 ` jb at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jb at gcc dot gnu.org @ 2014-10-08 13:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63471

--- Comment #1 from Janne Blomqvist <jb at gcc dot gnu.org> ---
Hmm, any idea how to fix it? Apparently just defining _REENTRANT globally might
not be a good idea, as some systems may require linking in some other C library
(libc_rt or such) then. We don't want to use the GCC -pthread flag (which
should take care of necessary linking magic) either, since on systems with
weakref support we want to avoid using mutexes etc. in single-threaded
programs.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libfortran/63471] [5.0 Regression] unix.c:1906:10: error: implicit declaration of function 'ttyname_r'
  2014-10-07 16:41 [Bug libfortran/63471] New: [5.0 Regression] unix.c:1906:10: error: implicit declaration of function 'ttyname_r' danglin at gcc dot gnu.org
  2014-10-08 11:13 ` [Bug libfortran/63471] " rguenth at gcc dot gnu.org
  2014-10-08 13:31 ` jb at gcc dot gnu.org
@ 2014-10-08 13:43 ` jb at gcc dot gnu.org
  2014-10-08 15:37 ` dave.anglin at bell dot net
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jb at gcc dot gnu.org @ 2014-10-08 13:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63471

--- Comment #2 from Janne Blomqvist <jb at gcc dot gnu.org> ---
Hmm, maybe add something like

AC_CHECK_DECLS_ONCE([ttyname_r])

to configure.ac and then in unix.c(stream_ttyname) check with

#ifdef HAVE_TTYNAME_R && HAVE_DECL_TTYNAME_R


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libfortran/63471] [5.0 Regression] unix.c:1906:10: error: implicit declaration of function 'ttyname_r'
  2014-10-07 16:41 [Bug libfortran/63471] New: [5.0 Regression] unix.c:1906:10: error: implicit declaration of function 'ttyname_r' danglin at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2014-10-08 13:43 ` jb at gcc dot gnu.org
@ 2014-10-08 15:37 ` dave.anglin at bell dot net
  2014-10-09  2:07 ` dave.anglin at bell dot net
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dave.anglin at bell dot net @ 2014-10-08 15:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63471

--- Comment #3 from dave.anglin at bell dot net ---
On 10/8/2014 9:43 AM, jb at gcc dot gnu.org wrote:
> Hmm, maybe add something like
>
> AC_CHECK_DECLS_ONCE([ttyname_r])
>
> to configure.ac and then in unix.c(stream_ttyname) check with
>
> #ifdef HAVE_TTYNAME_R && HAVE_DECL_TTYNAME_R
Don't we want to use ttyname_r in multithreaded applications?

It seems HP-UX is the only platform to hide the declaration of ttyname_r 
using _REENTRANT :-(
If configure finds ttyname_r, then presumably we don't need pthread 
linking for it.

On some platforms (MacOS 10.4 and Solaris 11), ttyname_r may return a 
'char *', not 'int'.

Dave


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libfortran/63471] [5.0 Regression] unix.c:1906:10: error: implicit declaration of function 'ttyname_r'
  2014-10-07 16:41 [Bug libfortran/63471] New: [5.0 Regression] unix.c:1906:10: error: implicit declaration of function 'ttyname_r' danglin at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2014-10-08 15:37 ` dave.anglin at bell dot net
@ 2014-10-09  2:07 ` dave.anglin at bell dot net
  2014-10-09  3:07 ` jb at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dave.anglin at bell dot net @ 2014-10-09  2:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63471

--- Comment #4 from dave.anglin at bell dot net ---
There are more functions with this problem.  The attached patch  
enables libgfortran to build on hpux11.11.

Dave
--
John David Anglin    dave.anglin@bell.net


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libfortran/63471] [5.0 Regression] unix.c:1906:10: error: implicit declaration of function 'ttyname_r'
  2014-10-07 16:41 [Bug libfortran/63471] New: [5.0 Regression] unix.c:1906:10: error: implicit declaration of function 'ttyname_r' danglin at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2014-10-09  2:07 ` dave.anglin at bell dot net
@ 2014-10-09  3:07 ` jb at gcc dot gnu.org
  2014-10-10  7:43 ` jb at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jb at gcc dot gnu.org @ 2014-10-09  3:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63471

--- Comment #5 from Janne Blomqvist <jb at gcc dot gnu.org> ---
Ah, I suspected that other functions might be affected as well. Thanks for
finding them.

That being said, googling this issue I stumbled upon
https://gcc.gnu.org/ml/gcc-patches/2011-03/msg00545.html where you fixed a
similar issue for hp-ux 10, seemingly by making the driver always set
_REENTRANT. Wouldn't a similar thing be the right thing to do for hp-ux 11 as
well? If there are no ill effects of always enabling _REENTRANT that would help
other software than just libgfortran, as well as eliminating the risk that
unconditionally enabling _REENTRANT in libgfortran might break on some other
target?


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libfortran/63471] [5.0 Regression] unix.c:1906:10: error: implicit declaration of function 'ttyname_r'
  2014-10-07 16:41 [Bug libfortran/63471] New: [5.0 Regression] unix.c:1906:10: error: implicit declaration of function 'ttyname_r' danglin at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2014-10-09  3:07 ` jb at gcc dot gnu.org
@ 2014-10-10  7:43 ` jb at gcc dot gnu.org
  2014-10-10 13:31 ` dave.anglin at bell dot net
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jb at gcc dot gnu.org @ 2014-10-10  7:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63471

--- Comment #7 from Janne Blomqvist <jb at gcc dot gnu.org> ---
(In reply to dave.anglin from comment #3)
> On some platforms (MacOS 10.4 and Solaris 11), ttyname_r may return a 
> 'char *', not 'int'.

FWIW, libgfortran uses the AC_USE_SYSTEM_EXTENSIONS macro, which on Solaris
defines _POSIX_PTHREAD_SEMANTICS making it prefer the POSIX _r functions
instead of the POSIX draft _r versions.

I'm not sure we care about OS X 10.4 anymore? Newer versions apparently provide
the POSIX ttyname_r.

So, are you planning on enabling _REENTRANT in the HP-UX 11 driver like you did
for 10, or do you want to solve this in some other way?


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libfortran/63471] [5.0 Regression] unix.c:1906:10: error: implicit declaration of function 'ttyname_r'
  2014-10-07 16:41 [Bug libfortran/63471] New: [5.0 Regression] unix.c:1906:10: error: implicit declaration of function 'ttyname_r' danglin at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2014-10-10  7:43 ` jb at gcc dot gnu.org
@ 2014-10-10 13:31 ` dave.anglin at bell dot net
  2014-10-10 20:16 ` fxcoudert at gcc dot gnu.org
  2014-10-13 17:15 ` danglin at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: dave.anglin at bell dot net @ 2014-10-10 13:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63471

--- Comment #8 from dave.anglin at bell dot net ---
On 10/10/2014 3:42 AM, jb at gcc dot gnu.org wrote:
> So, are you planning on enabling _REENTRANT in the HP-UX 11 driver like you did
> for 10, or do you want to solve this in some other way?
I have it installed for testing and will commit it if I don't see
any problems.

Dave


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libfortran/63471] [5.0 Regression] unix.c:1906:10: error: implicit declaration of function 'ttyname_r'
  2014-10-07 16:41 [Bug libfortran/63471] New: [5.0 Regression] unix.c:1906:10: error: implicit declaration of function 'ttyname_r' danglin at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2014-10-10 13:31 ` dave.anglin at bell dot net
@ 2014-10-10 20:16 ` fxcoudert at gcc dot gnu.org
  2014-10-13 17:15 ` danglin at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2014-10-10 20:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63471

Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxcoudert at gcc dot gnu.org

--- Comment #9 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
(In reply to Janne Blomqvist from comment #7)
> I'm not sure we care about OS X 10.4 anymore? Newer versions apparently
> provide the POSIX ttyname_r.

I confirm that 10.5 and later Mac OS versions provide ttyname_r with the
correct signature, and we don't care about 10.4 anymore.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libfortran/63471] [5.0 Regression] unix.c:1906:10: error: implicit declaration of function 'ttyname_r'
  2014-10-07 16:41 [Bug libfortran/63471] New: [5.0 Regression] unix.c:1906:10: error: implicit declaration of function 'ttyname_r' danglin at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2014-10-10 20:16 ` fxcoudert at gcc dot gnu.org
@ 2014-10-13 17:15 ` danglin at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: danglin at gcc dot gnu.org @ 2014-10-13 17:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63471

John David Anglin <danglin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #11 from John David Anglin <danglin at gcc dot gnu.org> ---
Fixed.


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-10-13 17:15 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-07 16:41 [Bug libfortran/63471] New: [5.0 Regression] unix.c:1906:10: error: implicit declaration of function 'ttyname_r' danglin at gcc dot gnu.org
2014-10-08 11:13 ` [Bug libfortran/63471] " rguenth at gcc dot gnu.org
2014-10-08 13:31 ` jb at gcc dot gnu.org
2014-10-08 13:43 ` jb at gcc dot gnu.org
2014-10-08 15:37 ` dave.anglin at bell dot net
2014-10-09  2:07 ` dave.anglin at bell dot net
2014-10-09  3:07 ` jb at gcc dot gnu.org
2014-10-10  7:43 ` jb at gcc dot gnu.org
2014-10-10 13:31 ` dave.anglin at bell dot net
2014-10-10 20:16 ` fxcoudert at gcc dot gnu.org
2014-10-13 17:15 ` danglin at gcc dot gnu.org

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