Gcc-2.95.1 problems with -traditional and initialization

Jeffrey A Law law@cygnus.com
Thu Sep 30 19:57:00 GMT 1999


  In message < 37D03C79.7152520F@cls.usask.ca >you write:
  > There seems to be a problem with initializing character arrays in
  > structures when string literals are writable.
  > 
  > Host: Redhat Linux 2.2.5-15
  > 
  > Compiler: gcc-2.95.1 as native compiler and as m68k cross-compiler.
  > 
  > Example program:
  > ===================================================
  > typedef struct fleeb {
  >     char msg[20];
  > } fleeb;
  > 
  > fleeb foo = {"bar"};
  > ===================================================
  > 
  > Example run:
  > + gcc --version
  > 2.95.1
  > 
  > + gcc -traditional -c a.c
  > a.c:5: initializer element is not constant
  > a.c:5: (near initialization for `foo.msg')
Thanks.  I believe this has been fixed in the development sources.  The
patch that fixed this bug is on the list of patches to consider for gcc-2.95.2.
jeff



More information about the Gcc-bugs mailing list