Bug 84589 - gcc3 -pthread does not define -D_REENTRANT
gcc3 -pthread does not define -D_REENTRANT
Status: CLOSED UPSTREAM
Product: Red Hat Enterprise Linux 2.1
Classification: Red Hat
Component: gcc3 (Show other bugs)
2.1
ia64 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-02-19 05:26 EST by Francois-Xavier 'FiX' KOWALSKI
Modified: 2007-11-30 17:06 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-10-03 08:13:01 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
C-code to reproduce the bug (282 bytes, text/plain)
2003-02-19 05:27 EST, Francois-Xavier 'FiX' KOWALSKI
no flags Details

  None (edit)
Description Francois-Xavier 'FiX' KOWALSKI 2003-02-19 05:27:00 EST
Description of problem:

gcc3's "-pthread" option does not set the -D_REENTRANT compilation flag.

the link flag -lpthread is correctly set.


Version-Release number of selected component (if applicable):

gcc3 -v
Reading specs from /usr/lib/gcc-lib/ia64-redhat-linux/3.0.4/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --host=ia64-redhat-linux --with-system-zlib
Thread model: posix
gcc version 3.0.4 (Red Hat Linux 7.2 3.0.4-1)

How reproducible:


Steps to Reproduce:
1. get the attached program pthbug.c
2. compile it with gcc3 -v -pthread -Wall -Wstrict-prototypes pthbug.c
3. note that -D_REENTRANT is not defined

Actual results:

 gcc3 -v -pthread -Wall -Wstrict-prototypes pthbug.c
Reading specs from /usr/lib/gcc-lib/ia64-redhat-linux/3.0.4/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --host=ia64-redhat-linux --with-system-zlib
Thread model: posix
gcc version 3.0.4 (Red Hat Linux 7.2 3.0.4-1)
 /usr/lib/gcc-lib/ia64-redhat-linux/3.0.4/cc1 -lang-c -v -D__GNUC__=3
-D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=4 -D__ia64 -D__ia64__ -D__linux
-D__linux__ -D_LONGLONG -Dlinux -Dunix -D__LP64__ -D__ELF__ -D__ia64 -D__ia64__
-D__linux -D__linux__ -D_LONGLONG -D__linux__ -D__unix__ -D__LP64__ -D__ELF__
-D__linux -D__unix -Asystem=linux -Acpu=ia64 -Amachine=ia64 -D__NO_INLINE__
-D__STDC_HOSTED__=1 -Wall -Wstrict-prototypes
-D__LONG_MAX__=9223372036854775807L pthbug.c -quiet -dumpbase pthbug.c -Wall
-Wstrict-prototypes -version -o /var/tmp/fxk/ccOy4gQr.s
GNU CPP version 3.0.4 (Red Hat Linux 7.2 3.0.4-1) (cpplib) (IA-64) Linux
GNU C version 3.0.4 (Red Hat Linux 7.2 3.0.4-1) (ia64-redhat-linux)
	compiled by GNU C version 3.0.4 (Red Hat Linux 7.2 3.0.4-1).
ignoring nonexistent directory "/usr/ia64-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc-lib/ia64-redhat-linux/3.0.4/include
 /usr/include
End of search list.
pthbug.c:9:2: #error "_REENTRANT undefined"

Expected results:

gcc3 -v -pthread -Wall -Wstrict-prototypes pthbug.c
Reading specs from /usr/lib/gcc-lib/ia64-redhat-linux/3.0.4/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --host=ia64-redhat-linux --with-system-zlib
Thread model: posix
gcc version 3.0.4 (Red Hat Linux 7.2 3.0.4-1)
 /usr/lib/gcc-lib/ia64-redhat-linux/3.0.4/cc1 -lang-c -v -D__GNUC__=3
-D_REENTRANT -D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=4 -D__ia64 -D__ia64__
-D__linux -D__linux__ -D_LONGLONG -Dlinux -Dunix -D__LP64__ -D__ELF__ -D__ia64
-D__ia64__ -D__linux -D__linux__ -D_LONGLONG -D__linux__ -D__unix__ -D__LP64__
-D__ELF__ -D__linux -D__unix -Asystem=linux -Acpu=ia64 -Amachine=ia64
-D__NO_INLINE__ -D__STDC_HOSTED__=1 -Wall -Wstrict-prototypes
-D__LONG_MAX__=9223372036854775807L pthbug.c -quiet -dumpbase pthbug.c -Wall
-Wstrict-prototypes -version -o /var/tmp/fxk/ccOy4gQr.s
GNU CPP version 3.0.4 (Red Hat Linux 7.2 3.0.4-1) (cpplib) (IA-64) Linux
GNU C version 3.0.4 (Red Hat Linux 7.2 3.0.4-1) (ia64-redhat-linux)
	compiled by GNU C version 3.0.4 (Red Hat Linux 7.2 3.0.4-1).
ignoring nonexistent directory "/usr/ia64-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc-lib/ia64-redhat-linux/3.0.4/include
 /usr/include
End of search list.

Additional info:

1) The following distributions+compilers are not affected by this problem.

- ia32 + RedHat 2.1AS + gcc-2.96
- ia64 + RedHat 2.1AS + gcc-2.96
- ia32 + RedHat 7.3 + gcc-2.96
- ia32 + RedHat 7.2 + gcc-2.96
- ia64 + RedHat 7.2 + gcc-2.96
    
2) An application core-dump occurs when a C++ library is unloaded (call _fini),
because the libpthread destruction invokes application destructors that are not
compiled to support multi-thread.
Comment 1 Francois-Xavier 'FiX' KOWALSKI 2003-02-19 05:27:50 EST
Created attachment 90180 [details]
C-code to reproduce the bug
Comment 2 Richard Henderson 2004-10-03 08:13:01 EDT
Still not fixed in gcc 4.0.  Upstream PR already exists:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10865

Note You need to log in before you can comment on or make changes to this bug.