[net.unix-wizards] DBX bug in Ultrix 1.2

sefunix@NWC-143B.arpa (07/23/86)

We recently received Ultrix-32m (Release 1.2) for our MicroVAX II and 
began writing some code in C. In doing so, a problem appeared when
initializing a static structure. The program printed out the values 
correctly, but when dbx was invoked to examine the structure, it 
printed out something entirely different. The following is a test 
program and dbx output. Is this a known problem with Ultrix 1.2 that 
we happened to miss on the net, since we have not been on that long?

PROGRAM:

	struct symtab {
		char *name;
	};

	static struct symtab St[] = {
		"abc",
		"xyz",
	};
	
	main()
	{
		int i;
	
		for ( i = 0; i < 2; i++ )
			printf( "%s\n", St[i].name );
	}

DBX OUTPUT:

	dbx version 1.2 of 2/19/86 19:05.
	Type 'help' for help.
	reading symbolic information ...
	(dbx) print St
	(
	(name = "@(#)crt0.c^I4.6 (Berkeley) 3/30/83")
	(name = (nil))
	) 
	(dbx)

Any help/thoughts are appreciated.
				Gene Guglielmo
				SEFUNIX@NWC-143B.ARPA
------

dlu%tektools.tek.csnet@CSNET-RELAY.arpa (07/25/86)

Curiosity (or perversity) got me to try Gene's bug on a 780 running the
beta release of 4.3 and a 8650 running Ultrix 1.2, the results may shed
some light on the nature of the problem:

	On Ultrix I could reproduce Gene's results, however I don't
	think the problem is in dbx because an a.out produced on the
	4.3 system would produce the correct results with dbx.

	On 4.3 the program and dbx worked correctly but an a.out from
	the Ultrix system still showed the bug when run under the 4.3
	dbx.

Conculsion #1; dbx is not at fault.

By this point I was in pretty close to over my head, so I sought out the
advice of our (ex)compiler wizard, Carl Sutton, who suggested that we
compare the output of "cc -g -S".  We did and found them to be identical.

So Conclusion #2 is that the problem lies in the way that as or ld handles
the symbol table.

We didn't really have time to pursue this further, but I hope that this
information makes the problem easier to locate.

Doug Urner, dlu@tektronix