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]

Undetected error in array declarations...


Hello all,

  If a function call is given as a array size, the compiler uses a size of 8.
Even when "-Wall -W" is used, there are no messages about a function call in 
array definitions being illegal.  
  I think the compiler should flag this as an error... or if for some reason
that may be valid syntax, at the very least issue a warning when -Wall is on.

    Thanks,
      Mike Simons

compiler used:
  msimons@gabriel:~> egcc -v
  Reading specs from /usr/lib/gcc-lib/i486-linux/egcs-2.91.58/specs
  gcc version egcs-2.91.58 19981101 (egcs-1.1.1 pre-release 2, Debian 2.1)

  ...but I have tried this with various versions of gcc 2.7.* through the
  egcs version given above.

here is an example:
===========
#include <string.h>

int main(void)
{
  int foo[strlen("something really long")];
  int bar[strlen("")][10];
  int baz[10][strlen("")];

  return 0;
}


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