This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


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

egcs 1.1a g++ bug with __typeof?


I just picked up egcs-1.1a to try to compile Octave and found the
following problem.

The following code compiles fine with the C compiler, but fails with
the C++ compiler.

  void
  foobar (void)
  {
    int foo = 0;
    foo = __extension__ ({
      union {
	__typeof (foo) __in;
      } __u;
      __u.__in = foo;
    });
  }

Here is the output from running g++ -v:

  Reading specs from /usr/local/egcs/1.1a/lib/gcc-lib/i686-pc-linux-gnulibc1/egcs-2.91.57/specs
  gcc version egcs-2.91.57 19980901 (egcs-1.1 release)
   /usr/local/egcs/1.1a/lib/gcc-lib/i686-pc-linux-gnulibc1/egcs-2.91.57/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=91 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -Asystem(unix) -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -Di686 -Dpentiumpro -D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__ foo.cc /tmp/ccLSx5ek.ii
  GNU CPP version egcs-2.91.57 19980901 (egcs-1.1 release) (i386 Linux/ELF)
  #include "..." search starts here:
  #include <...> search starts here:
   /usr/local/egcs/1.1a/include/g++
   /usr/local/include
   /usr/local/egcs/1.1a/i686-pc-linux-gnulibc1/include
   /usr/local/egcs/1.1a/lib/gcc-lib/i686-pc-linux-gnulibc1/egcs-2.91.57/include
   /usr/include
  End of search list.
   /usr/local/egcs/1.1a/lib/gcc-lib/i686-pc-linux-gnulibc1/egcs-2.91.57/cc1plus /tmp/ccLSx5ek.ii -quiet -dumpbase foo.cc -version -o /tmp/ccIAN1Ct.s
  GNU C++ version egcs-2.91.57 19980901 (egcs-1.1 release) (i686-pc-linux-gnulibc1) compiled by GNU C version egcs-2.91.57 19980901 (egcs-1.1 release).
  foo.cc: In function `void foobar()':
  foo.cc:7: `foo' undeclared (first use this function)
  foo.cc:7: (Each undeclared identifier is reported only once
  foo.cc:7: for each function it appears in.)
  foo.cc:7: warning: ANSI C++ forbids declaration `__in' with no type

The code fragment above is what I came up with after expanding macros
and simplifying code in Octave that looks like this:

  #include <sys/types.h>
  #include <sys/wait.h>

  ...

  int status = 0;

  ...

  if (WIFEXITED (status))
    status = WEXITSTATUS (status);

  ...

and produces the same errors.

I built egcs with

  configure --enable-shared --prefix=/usr/local/egcs/1.1a
  make bootstrap

on a Linux 2.0.30 system with libc 5.4.33.


jwe

-- 
In the beginning, Ken Thompson | Octave: http://www.che.wisc.edu/octave
wrote the searching tool grep. |     Me: http://www.che.wisc.edu/~jwe
       -- A. Hume, SP&E (1988) |


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