g++ 2.96 bug handling 'extern'.

Sergei Organov osv@javad.ru
Thu Jun 8 00:18:00 GMT 2000


Hello,

'cc1plus' version 2.96 20000530 (experimental) still doesn't permit matching
external declarations inside functions. Neither cc1-2.96 nor cc1plus-2.95.2
have the problem. The diagnostic is surprising:

extern.cc: In function `void foo ()':
extern.cc:7: declaration of `int j'
extern.cc:6: conflicts with previous declaration `int j'

How to reproduce:

osv@osv$ cat extern.cc
extern int i;
void foo(void)
{
  extern int i;
  extern int i;
  extern int j;
  extern int j;
}
osv@osv$ ~/try/bin/ppc-eabi-g++ -c -v extern.cc
Reading specs from /home/osv/try/lib/gcc-lib/ppc-eabi/2.96/specs
gcc version 2.96 20000530 (experimental)
 /home/osv/try/lib/gcc-lib/ppc-eabi/2.96/cpp -lang-c++ -v -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=96 -D__GNUC_PATCHLEVEL__=0 -D__cplusplus -DPPC -D__embedded__ -D__PPC__ -D__embedded__ -D__PPC -Asystem(embedded) -Acpu(powerpc) -Amachine(powerpc) -D__EXCEPTIONS -D__CHAR_UNSIGNED__ -D_CALL_SYSV -D_BIG_ENDIAN -D__BIG_ENDIAN__ -Amachine(bigendian) -D_ARCH_PPC extern.cc /tmp/cc837Djf.ii
GNU CPP version 2.96 20000530 (experimental) (cpplib)
 (PowerPC Embedded)
ignoring nonexistent directory `/home/osv/try/ppc-eabi/sys-include'
#include "..." search starts here:
#include <...> search starts here:
 /home/osv/try/include/g++-
 /home/osv/try/lib/gcc-lib/ppc-eabi/2.96/include
 /home/osv/try/ppc-eabi/include
End of search list.
 /home/osv/try/lib/gcc-lib/ppc-eabi/2.96/cc1plus /tmp/cc837Djf.ii -quiet -dumpbase extern.cc -version -o /tmp/ccy2KPrm.s
GNU C++ version 2.96 20000530 (experimental) (ppc-eabi) compiled by GNU C version 2.95.2 20000220 (Debian GNU/Linux).
extern.cc: In function `void foo ()':
extern.cc:7: declaration of `int j'
extern.cc:6: conflicts with previous declaration `int j'
osv@osv$

BR,
Sergei Organov.



More information about the Gcc-bugs mailing list