Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 84589 - gcc3 -pthread does not define -D_REENTRANT
Summary: gcc3 -pthread does not define -D_REENTRANT
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Red Hat Enterprise Linux 2.1
Classification: Red Hat
Component: gcc3
Version: 2.1
Hardware: ia64
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-02-19 10:26 UTC by Francois-Xavier 'FiX' KOWALSKI
Modified: 2007-11-30 22:06 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-10-03 12:13:01 UTC


Attachments (Terms of Use)
C-code to reproduce the bug (deleted)
2003-02-19 10:27 UTC, Francois-Xavier 'FiX' KOWALSKI
no flags Details

Description Francois-Xavier 'FiX' KOWALSKI 2003-02-19 10:27:00 UTC
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 10:27:50 UTC
Created attachment 90180 [details]
C-code to reproduce the bug

Comment 2 Richard Henderson 2004-10-03 12:13:01 UTC
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.