This is the mail archive of the libc-alpha@cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

glibc-19980524: invalid use of GCC's `transparent union'


Hi!

I reported this bug a couple of months ago, but it still hasn't been
fixed.  This bug prevents GNU libc from compiling correctly on the
Hurd.

The problem is that glibc uses the `transparent union' mechanism in an
undocumented way, which is not recognized by gcc-2.8.1.  *Note:
(gcc)Type Attributes:: for a description of valid use, and compare it
to the use in posix/sys/wait.h vs. the wait{,3,4}.c implementations.

Basically, what happens is a wait{,3,4} end up being defined with a
different signature than it was declared, which GCC calls a type
clash, and stops.  You'll see that it is not necessary to have
different signatures... this may have been supported by GCC at one
time, but it is better to make things more explicit.

1998-04-18  Gordon Matzigkeit  <gord@profitpress.com>

	* sysdeps/generic/wait.c (__wait): Use __WAIT_STATUS and
	__WAIT_PTR instead of __WAIT_STATUS_DEFN.
	* sysdeps/generic/wait3.c (__wait3): Likewise.
	* sysdeps/mach/hurd/wait4.c (__wait4): Likewise.
	* sysdeps/posix/wait.c (__libc_wait): Likewise.
	* sysdeps/posix/wait3.c (__wait3): Likewise.
	* sysdeps/unix/bsd/bsd4.4/wait.c (__libc_wait): Likewise.
	* sysdeps/unix/bsd/sun/sunos4/wait4.c (__wait4): Likewise.

	* posix/sys/wait.h (__WAIT_PTR): New macro to cast a __WAIT_STATUS
	to an int *.
	(__WAIT_STATUS_DEFN): Remove definition, since redeclaring a
	transparent union __WAIT_STATUS as an int * causes a type clash.

Even though my changes seem to be large, you will see that it is
actually just a minor change to the implementation, *not* the
interface.  I take the liberty of changing all of the affected
platforms, just because it is the Right Thing To Do.

If this patch seems incorrect to you, I would appreciate hearing about
it soon, so that we can come up with a different way to fix this issue
before glibc-2.1 is released.

Thanks,

-- 
Gordon Matzigkeit   \ Proudly running pieces of the GNU operating system.
gord@profitpress.com \ Jacques Cousteau loved programming in assembler.

libc-19980524-wait.diff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]