Subject: bin/2153: references wrong object
To: None <gnats-bugs@NetBSD.ORG>
From: None <>
List: netbsd-bugs
Date: 03/01/1996 15:25:00
>Number:         2153
>Category:       bin
>Synopsis: references wrong object
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar  1 09:35:01 1996
>Originator:     Matthias Pfaller
>Organization:			in real life: Matthias Pfaller
marco GmbH, 85221 Dachau, Germany	tel: +49 8131 516142
>Release:        960229
System: NetBSD tabatha 1.1_ALPHA NetBSD 1.1_ALPHA (ROBIN) #0: Mon Nov 6 16:27:59 MET 1995 leo@robin:/usr/src/sys/arch/i386/compile/ROBIN i386

	When one declares a global variable present in a lib, the library
	code seems to reference the wrong object.
	Feed the following into your shell:

cat >tst.c <<EOF
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int optind;
main(argc, argv)
	int argc;
	char **argv;
	int c;
	while ((c = getopt(argc, argv, "t")) != EOF)
	printf("optind = %d\n", optind);
cc -o tst.good -DDECLARE_EXTERN tst.c
cc -o tst.bad tst.c
./tst.good -t
./tst.bad -t

You will get different output for tst.good and tst.bad. I think this is

	I didn't have the time to look closer at this. So sorry, no fix