C/dbx problem under Ultrix 2.0

Marc Evans marc at ima.ISC.COM
Fri Feb 12 00:21:16 AEST 1988


While hacking with some source the other day, I discovered some strangeness
in dbx given a couple different variations of the following program:

main()
{
  static struct foo_t { char *a,*b; } foo[] = {
    "foo", "bar",
    "hello", "world",
    "what's", "up",
  };
  printf("%s %s\n",foo[1].a,foo[2].b);
}

This program compiles and runs fine on my Ultrix 2.0 system using /bin/cc.
The problem that exists is when using dbx. Try usign dbx and stoping at the
printf line, then do a 'print foo'. On my system, I get a dump of a bunch
of octal (-1)'s.

A subtle change of moving the structure outside of the function to the
module level, produces the same results. The interresting part is that
if after moving the structure to the module level, then removing the
'static' from the declaration, dbx does the *proper* thing when requesting
'print foo'.

Is this normal for dbx, or is it just an Ultrix problem.



More information about the Comp.lang.c mailing list