public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/47375] New: getlog causes warnings with static linking
@ 2011-01-20 12:02 Joost.VandeVondele at pci dot uzh.ch
  2011-01-20 13:30 ` [Bug libfortran/47375] " burnus at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Joost.VandeVondele at pci dot uzh.ch @ 2011-01-20 12:02 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47375

           Summary: getlog causes warnings with static linking
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: Joost.VandeVondele@pci.uzh.ch


The following testcase causes the following warning when linking. If the static
binary is afterwards used on 'the right system' it will also crash. It would be
nice if the getlog implementation avoids this problem, some HPC systems only
allow for static linking.

> cat test.f90
 character(LEN=80) :: name
 CALL getlog(name)
END

> gfortran -static test.f90
/usr/lib64/gcc/x86_64-suse-linux/4.5/libgfortran.a(getlog.o): In function
`_gfortran_getlog':
/usr/src/packages/BUILD/gcc-4.5.0-20100604/obj-x86_64-suse-linux/x86_64-suse-linux/libgfortran/../../../libgfortran/intrinsics/getlog.c:80:
warning: Using 'getpwuid' in statically linked applications requires at runtime
the shared libraries from the glibc version used for linking


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

* [Bug libfortran/47375] getlog causes warnings with static linking
  2011-01-20 12:02 [Bug libfortran/47375] New: getlog causes warnings with static linking Joost.VandeVondele at pci dot uzh.ch
@ 2011-01-20 13:30 ` burnus at gcc dot gnu.org
  2011-01-20 13:38 ` [Bug libfortran/47375] GETLOG not threadsafe, causes warnings/wrong-code " Joost.VandeVondele at pci dot uzh.ch
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-01-20 13:30 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47375

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-01-20 13:08:43 UTC ---
Maybe one should use getpwnam_r and  getpwuid_r instead of getpwnam and 
getpwuid (at least if the _r versions are available); the non-_r versions are
used according to http://gcc.gnu.org/onlinedocs/gfortran/GETLOG.html

>From POSIX/SUS 2003:
"
       #include <pwd.h>

       struct passwd *getpwuid(uid_t uid);

       int getpwuid_r(uid_t uid, struct passwd *pwd, char *buffer,
              size_t bufsize, struct passwd **result);

 [...]
 APPLICATION USAGE
 [...]
 The  getpwuid_r()  function is thread-safe and returns values in a
 user-supplied buffer instead of possibly using a static data area
 that may be overwritten by each call."


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

* [Bug libfortran/47375] GETLOG not threadsafe, causes warnings/wrong-code with static linking
  2011-01-20 12:02 [Bug libfortran/47375] New: getlog causes warnings with static linking Joost.VandeVondele at pci dot uzh.ch
  2011-01-20 13:30 ` [Bug libfortran/47375] " burnus at gcc dot gnu.org
@ 2011-01-20 13:38 ` Joost.VandeVondele at pci dot uzh.ch
  2011-01-20 13:40 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Joost.VandeVondele at pci dot uzh.ch @ 2011-01-20 13:38 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47375

--- Comment #2 from Joost VandeVondele <Joost.VandeVondele at pci dot uzh.ch> 2011-01-20 13:16:46 UTC ---
I quickly tried to link a C program statically that uses getpwuid_r. It has the
same problem. I guess it is unavoidable.


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

* [Bug libfortran/47375] GETLOG not threadsafe, causes warnings/wrong-code with static linking
  2011-01-20 12:02 [Bug libfortran/47375] New: getlog causes warnings with static linking Joost.VandeVondele at pci dot uzh.ch
  2011-01-20 13:30 ` [Bug libfortran/47375] " burnus at gcc dot gnu.org
  2011-01-20 13:38 ` [Bug libfortran/47375] GETLOG not threadsafe, causes warnings/wrong-code " Joost.VandeVondele at pci dot uzh.ch
@ 2011-01-20 13:40 ` jakub at gcc dot gnu.org
  2011-01-20 13:46 ` burnus at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-01-20 13:40 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47375

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-01-20 13:30:11 UTC ---
You should certainly avoid getpwuid etc. if getpwuid_r is available, otherwise
you can't call reliably getlog etc. from !$omp parallel.

That said, the warning is correct, if users have illusion that if they link
-static the C library no dynamic linking will be used, they need to be told
they are wrong.  The simple fix is don't use -static.


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

* [Bug libfortran/47375] GETLOG not threadsafe, causes warnings/wrong-code with static linking
  2011-01-20 12:02 [Bug libfortran/47375] New: getlog causes warnings with static linking Joost.VandeVondele at pci dot uzh.ch
                   ` (2 preceding siblings ...)
  2011-01-20 13:40 ` jakub at gcc dot gnu.org
@ 2011-01-20 13:46 ` burnus at gcc dot gnu.org
  2011-01-21 13:52 ` jb at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-01-20 13:46 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47375

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-01-20 13:38:44 UTC ---
Documentation for getpwuid_r from POSIX:
  http://pubs.opengroup.org/onlinepubs/009695399/functions/getpwuid.html
and for LINUX, which contains a getpwuid_r example:
  http://www.kernel.org/doc/man-pages/online/pages/man3/getpwnam.3.html

(In reply to comment #2)
> I quickly tried to link a C program statically that uses getpwuid_r. It has the
> same problem. I guess it is unavoidable.

Seems so - but fortunately, the exact version requirements do not seem to be
that strict: using a -static-ally linked test case (from kernel.org, cf. link),
linked on a GLIBC 2.11.3 system worked on a system with glibc-2.5-49.el5_5.2.


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

* [Bug libfortran/47375] GETLOG not threadsafe, causes warnings/wrong-code with static linking
  2011-01-20 12:02 [Bug libfortran/47375] New: getlog causes warnings with static linking Joost.VandeVondele at pci dot uzh.ch
                   ` (3 preceding siblings ...)
  2011-01-20 13:46 ` burnus at gcc dot gnu.org
@ 2011-01-21 13:52 ` jb at gcc dot gnu.org
  2011-01-25 16:55 ` jb at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jb at gcc dot gnu.org @ 2011-01-21 13:52 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47375

Janne Blomqvist <jb at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2011.01.21 13:44:37
                 CC|                            |jb at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #5 from Janne Blomqvist <jb at gcc dot gnu.org> 2011-01-21 13:44:37 UTC ---
Assigning to myself. The linking issues is probably not solvable, but at least
we should use the _r() functions if available.


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

* [Bug libfortran/47375] GETLOG not threadsafe, causes warnings/wrong-code with static linking
  2011-01-20 12:02 [Bug libfortran/47375] New: getlog causes warnings with static linking Joost.VandeVondele at pci dot uzh.ch
                   ` (4 preceding siblings ...)
  2011-01-21 13:52 ` jb at gcc dot gnu.org
@ 2011-01-25 16:55 ` jb at gcc dot gnu.org
  2011-01-27 15:06 ` burnus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jb at gcc dot gnu.org @ 2011-01-25 16:55 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47375

--- Comment #6 from Janne Blomqvist <jb at gcc dot gnu.org> 2011-01-25 16:46:07 UTC ---
Author: jb
Date: Tue Jan 25 16:46:00 2011
New Revision: 169243

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=169243
Log:
PR 47375 getlog thread safety

Modified:
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/config.h.in
    trunk/libgfortran/configure
    trunk/libgfortran/configure.ac
    trunk/libgfortran/intrinsics/getlog.c


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

* [Bug libfortran/47375] GETLOG not threadsafe, causes warnings/wrong-code with static linking
  2011-01-20 12:02 [Bug libfortran/47375] New: getlog causes warnings with static linking Joost.VandeVondele at pci dot uzh.ch
                   ` (5 preceding siblings ...)
  2011-01-25 16:55 ` jb at gcc dot gnu.org
@ 2011-01-27 15:06 ` burnus at gcc dot gnu.org
  2011-01-27 20:09 ` jb at gcc dot gnu.org
  2011-02-02 17:53 ` dnovillo at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-01-27 15:06 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47375

--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-01-27 14:48:27 UTC ---
The patch causes build failures on Solaris, cf. bug 47491


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

* [Bug libfortran/47375] GETLOG not threadsafe, causes warnings/wrong-code with static linking
  2011-01-20 12:02 [Bug libfortran/47375] New: getlog causes warnings with static linking Joost.VandeVondele at pci dot uzh.ch
                   ` (6 preceding siblings ...)
  2011-01-27 15:06 ` burnus at gcc dot gnu.org
@ 2011-01-27 20:09 ` jb at gcc dot gnu.org
  2011-02-02 17:53 ` dnovillo at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jb at gcc dot gnu.org @ 2011-01-27 20:09 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47375

Janne Blomqvist <jb at gcc dot gnu.org> changed:

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

--- Comment #8 from Janne Blomqvist <jb at gcc dot gnu.org> 2011-01-27 19:43:53 UTC ---
Fixed, closing.


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

* [Bug libfortran/47375] GETLOG not threadsafe, causes warnings/wrong-code with static linking
  2011-01-20 12:02 [Bug libfortran/47375] New: getlog causes warnings with static linking Joost.VandeVondele at pci dot uzh.ch
                   ` (7 preceding siblings ...)
  2011-01-27 20:09 ` jb at gcc dot gnu.org
@ 2011-02-02 17:53 ` dnovillo at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: dnovillo at gcc dot gnu.org @ 2011-02-02 17:53 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47375

--- Comment #9 from Diego Novillo <dnovillo at gcc dot gnu.org> 2011-02-02 17:47:18 UTC ---
Author: dnovillo
Date: Wed Feb  2 17:47:13 2011
New Revision: 169586

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=169586
Log:
PR 47375 getlog thread safety

Modified:
    branches/google/integration/libgfortran/ChangeLog
    branches/google/integration/libgfortran/config.h.in
    branches/google/integration/libgfortran/configure
    branches/google/integration/libgfortran/configure.ac
    branches/google/integration/libgfortran/intrinsics/getlog.c


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

end of thread, other threads:[~2011-02-02 17:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-20 12:02 [Bug libfortran/47375] New: getlog causes warnings with static linking Joost.VandeVondele at pci dot uzh.ch
2011-01-20 13:30 ` [Bug libfortran/47375] " burnus at gcc dot gnu.org
2011-01-20 13:38 ` [Bug libfortran/47375] GETLOG not threadsafe, causes warnings/wrong-code " Joost.VandeVondele at pci dot uzh.ch
2011-01-20 13:40 ` jakub at gcc dot gnu.org
2011-01-20 13:46 ` burnus at gcc dot gnu.org
2011-01-21 13:52 ` jb at gcc dot gnu.org
2011-01-25 16:55 ` jb at gcc dot gnu.org
2011-01-27 15:06 ` burnus at gcc dot gnu.org
2011-01-27 20:09 ` jb at gcc dot gnu.org
2011-02-02 17:53 ` dnovillo 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).