A glibc or egcs bug?

Zack Weinberg zack@rabi.phys.columbia.edu
Sat Dec 6 20:23:00 GMT 1997


On Sat, 6 Dec 1997 19:21:28 -0800 (PST), H.J. Lu wrote:
>This is from glibc 2.1:
>
># gcc -v
>Reading specs from
>/usr/lib/gcc-lib/i586-unknown-linux-gnulibc1/egcs-2.90.20/specs
>gcc version egcs-2.90.20 971201 (gcc2-970802 experimental)
># gcc -S w.cc
>w.cc: In function `int foo()':
>w.cc:48: no matching function for call to `__WAIT_STATUS::._2 (int *)'
>w.cc:38: candidates are: __WAIT_STATUS::._2(const {anonymous union} &)
>w.cc:38:                 __WAIT_STATUS::._2()

Platform independent, C++ specific, egcs bug.  I append a transcript
and a simplified testcase.

If I cut out the __attribute__ cc1 gives me "incompatible type for
argument 1 of `wait'" and cc1plus gives the same "no matching
function" error.

Wild guessing based on the error message says look at the function
overload code.

zw

$ egcc -v
Reading specs from /opt/egcs-1.0/lib/gcc-lib/sparc-sun-solaris2.5.1/2.90.21/specs
gcc version egcs-2.90.21 971202 (egcs-1.00 release)
$ egcc -S test.c; echo $?
0
$ egcc -S -x c++ test.c; echo $?
test.c: In function `int foo()':
test.c:48: no matching function for call to `__WAIT_STATUS::._0 (int *)'
test.c:38: candidates are: __WAIT_STATUS::._0(const {anonymous union} &)
test.c:38:                 __WAIT_STATUS::._0()
1

-- test.c --
union wait;

typedef union
{
    union wait *__uptr;
    int *__iptr;
} __WAIT_STATUS __attribute__ ((__transparent_union__));

#ifdef __cplusplus
extern "C" int wait (__WAIT_STATUS __stat_loc);
#else
extern int wait (__WAIT_STATUS __stat_loc);
#endif

int
foo ()
{
  int status;

  wait (&status);

  return status;
}



More information about the Gcc-bugs mailing list