[Xorp-hackers] compiler brokes at EtherMac::valid
Pavlin Radoslavov
pavlin@icir.org
Tue, 02 Dec 2003 00:13:27 -0800
> When porting mac.cc, my compiler broken at EtherMac::valid.
> Is "buf[s.size() + 1]" definition valid ? Instead, when replace it with fixed size definition the
> compiler doesn't complains.
> Is it someting to do with my compiler? My compiler is g++ppc (gcc driver version
> cygnus-2.7.2-960126 egcs-971225), below is the output of the compiler :
The variable-length automatic arrays are GCC-ism.
They are used in few places, because they help to make the code a
bit simpler.
It looks like your compiler is from the gcc family so I guess it
should be able to compile it, but from the compilation error below
the reason it fails is obvious: "Internal compiler error" (i.e., a
compiler bug).
Nevertheless, variable-length arrays make the code more difficult to
port (as you have noticed already), hence I think we should try to
get rid of them (especially given that I am probably the most
frequent user of variable-length arrays :)
In other words, your solution of using fixed-size definition is the
right one.
Thanks,
Pavlin
P.S. BTW, what OS are you trying to port XORP to? Please don't tell
me it is Windows :)
>
> /*
> * ccppc -g -mcpu=860 -ansi -nostdinc -DRW_MULTI_THREAD -D_REENTRANT -fvolatile -fno-builtin
> * -fno-for-scope -I. -IC:\Tornado\target\h -DCPU=PPC860 -c E:\NIP\source\libxorp\mac.cc
> * E:\NIP\source\libxorp\mac.cc: In function `static bool EtherMac::valid(const class basic_s
> * tring<char,string_char_traits<char>,__default_alloc_template<true,0> > &)':
> * E:\NIP\source\libxorp\mac.cc:113: Internal compiler error.
> * E:\NIP\source\libxorp\mac.cc:113: Please submit a full bug report to `egcs-bugs@cygnus.com
> * '.
> * make: *** [mac.o] Error 0x1
> */
>
>
> Edrt