Bug 485619

Summary: too few arguments to function 'int __gthrw_pthread_detach(pthread_t)
Product: [Fedora] Fedora Reporter: Ralf Corsepius <rc040203>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: high    
Version: rawhideCC: jakub
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-02-17 12:40:25 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 485633    

Description Ralf Corsepius 2009-02-15 12:49:08 UTC
Description of problem:

When trying to build a package in Fedora's koji, I am observing this:
...
libtool: compile:  g++ -DLOCALEDIR=\"/usr/share/locale\" -DTEST_PERFORMANCE -DPOKER_EXPORT= -DHAVE_CONFIG_H -I. -I../.. -I/usr/include/python2.6 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I../.. -I../../include -I../../examples/poker -I/usr/include/libxml2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DCAL3D_VERSION=11 -DOSGAL_VERSION=0X000600 -I/usr/include/poker-eval -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -MT libpoker_la-PokerCard.lo -MD -MP -MF .deps/libpoker_la-PokerCard.Tpo -c PokerCard.cpp  -fPIC -DPIC -o .libs/libpoker_la-PokerCard.o
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.0/../../../../include/c++/4.4.0/x86_64-redhat-linux/bits/gthr.h:165,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.4.0/../../../../include/c++/4.4.0/ext/atomicity.h:39,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.4.0/../../../../include/c++/4.4.0/bits/basic_string.h:46,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.4.0/../../../../include/c++/4.4.0/string:58,
                 from /usr/include/osg/Object:21,
                 from /usr/include/osg/BufferObject:18,
                 from /usr/include/osg/Array:33,
                 from ../../include/maf/utils.h:36,
                 from PokerCard.cpp:42:
/usr/lib/gcc/x86_64-redhat-linux/4.4.0/../../../../include/c++/4.4.0/x86_64-redhat-linux/bits/gthr-default.h: In function 'int __gthread_create(__gthread_t*, void* (*)(void*), void*)':
/usr/lib/gcc/x86_64-redhat-linux/4.4.0/../../../../include/c++/4.4.0/x86_64-redhat-linux/bits/gthr-default.h:681: error: expected primary-expression before ',' token
/usr/lib/gcc/x86_64-redhat-linux/4.4.0/../../../../include/c++/4.4.0/x86_64-redhat-linux/bits/gthr-default.h: In function 'int __gthread_join(__gthread_t, void**)':
/usr/lib/gcc/x86_64-redhat-linux/4.4.0/../../../../include/c++/4.4.0/x86_64-redhat-linux/bits/gthr-default.h:687: error: expected primary-expression before ',' token
/usr/lib/gcc/x86_64-redhat-linux/4.4.0/../../../../include/c++/4.4.0/x86_64-redhat-linux/bits/gthr-default.h: In function 'int __gthread_detach(__gthread_t)':
/usr/lib/gcc/x86_64-redhat-linux/4.4.0/../../../../include/c++/4.4.0/x86_64-redhat-linux/bits/gthr-default.h:129: error: too few arguments to function 'int __gthrw_pthread_detach(pthread_t)'
/usr/lib/gcc/x86_64-redhat-linux/4.4.0/../../../../include/c++/4.4.0/x86_64-redhat-linux/bits/gthr-default.h:693: error: at this point in file

For full logs, c.f.
(dist-f11-gcc44) http://koji.fedoraproject.org/koji/taskinfo?taskID=1128145
rsp.
(dist-f11) http://koji.fedoraproject.org/koji/taskinfo?taskID=1128060

As this error doesn't contain any referrence to the package's source code, but only references to libstdc++, I am inclined to think this to be a bug in libstdc++ (gthr-support?).

Version-Release number of selected component (if applicable):
gcc-4.4.0-0.16
rsp.
gcc-4.4.0-0.18

I don't have a current rawhide system, but if my assumption holds, this bug should be reproducable by compiling a c++-source file containing
#include <string>
alone.

Comment 1 Ralf Corsepius 2009-02-15 14:57:52 UTC
This bug is caused by gcc/g++ using unsafe symbols in its gthr-* headers.

In this particular case, an application's define overrides symbols from gthr*.

The bug can easily be reproduced by compiling this code fragment:

# cat foo.cc
#define thread
#include <string>

# g++ -Wall -o foo foo.cc
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.0/../../../../include/c++/4.4.0/x86_64-redhat-linux/bits/gthr.h:165,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.4.0/../../../../include/c++/4.4.0/ext/atomicity.h:39,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.4.0/../../../../include/c++/4.4.0/bits/basic_string.h:46,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.4.0/../../../../include/c++/4.4.0/string:58,
                 from foo.cc:2:
/usr/lib/gcc/x86_64-redhat-linux/4.4.0/../../../../include/c++/4.4.0/x86_64-redhat-linux/bits/gthr-default.h: In function ‘int __gthread_create(__gthread_t*, void* (*)(void*), void*)’:
/usr/lib/gcc/x86_64-redhat-linux/4.4.0/../../../../include/c++/4.4.0/x86_64-redhat-linux/bits/gthr-default.h:681: error: expected primary-expression before ‘,’ token
/usr/lib/gcc/x86_64-redhat-linux/4.4.0/../../../../include/c++/4.4.0/x86_64-redhat-linux/bits/gthr-default.h: In function ‘int __gthread_join(__gthread_t, void**)’:
/usr/lib/gcc/x86_64-redhat-linux/4.4.0/../../../../include/c++/4.4.0/x86_64-redhat-linux/bits/gthr-default.h:687: error: expected primary-expression before ‘,’ token
/usr/lib/gcc/x86_64-redhat-linux/4.4.0/../../../../include/c++/4.4.0/x86_64-redhat-linux/bits/gthr-default.h: In function ‘int __gthread_detach(__gthread_t)’:
/usr/lib/gcc/x86_64-redhat-linux/4.4.0/../../../../include/c++/4.4.0/x86_64-redhat-linux/bits/gthr-default.h:129: error: too few arguments to function ‘int __gthrw_pthread_detach(pthread_t)’
/usr/lib/gcc/x86_64-redhat-linux/4.4.0/../../../../include/c++/4.4.0/x86_64-redhat-linux/bits/gthr-default.h:693: error: at this point in file

Comment 2 Jakub Jelinek 2009-02-15 19:04:21 UTC
That testcase is invalid, see [lib.using.headers]/3:
"A translation unit shall include a header only outside of any external declaration or definition, and shall include the header lexically before the first reference to any of the entities it declares or first defines in that
translation unit."
That said, I'll uglify the function arguments in gthr*.h soon.

Comment 3 Ralf Corsepius 2009-02-16 02:56:43 UTC
(In reply to comment #2)
> That testcase is invalid, see [lib.using.headers]/3:
> "A translation unit shall include a header only outside of any external
> declaration or definition, and shall include the header lexically before the
> first reference to any of the entities it declares or first defines in that
> translation unit."

Errm, ... a card blanche to justify any symbol clash with libstdc++?
"In case of symbol clashes libstdc++ is always right"?

Pardon, but this looks like a serious defect of the standards to me.

Comment 4 Jakub Jelinek 2009-02-16 09:32:55 UTC
See http://gcc.gnu.org/ml/gcc-patches/2009-02/msg00716.html
Note also the list of other headers that have non-uglified function parameters or or inline fn local variables.