Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Feb 2003 18:04:49 -0800
From:      Arun Sharma <arun.sharma@intel.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ia64/48024: function pointer has different values in libraries vs main program
Message-ID:  <20030206180449.A9223@unix-os.sc.intel.com>

next in thread | raw e-mail | index | archive | help

>Number:         48024
>Category:       ia64
>Synopsis:       function pointer has different values in libraries vs main program
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-ia64
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Feb 06 18:10:10 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Arun Sharma
>Release:        FreeBSD 5.0-CURRENT ia64
>Organization:
Myself
>Environment:

System: FreeBSD adsharma-ia64 5.0-CURRENT FreeBSD 5.0-CURRENT #3: Wed Jan 22 12:40:09 GMT 2003 adsharma@adsharma-ia64:/usr/src/sys/ia64/compile/bigsur ia64


>Description:
	The program below prints different values for the value of &foo1, when called from a
	shared lib vs main program.

>How-To-Repeat:
	unshar
	make
	./main
>Fix:

	Not known yet.


# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	test
#	test/foo.c
#	test/main.c
#	test/Makefile
#
echo c - test
mkdir -p test > /dev/null 2>&1
echo x - test/foo.c
sed 's/^X//' >test/foo.c << 'END-of-test/foo.c'
X#include <stdio.h>
X
Xint 
Xfoo1()
X{
X}
X
Xint
Xfoo()
X{
X	int (*fptr)();
X
X	fptr = &foo1;
X 
X	printf("foo1 is at %lx: \n", foo1);
X}
END-of-test/foo.c
echo x - test/main.c
sed 's/^X//' >test/main.c << 'END-of-test/main.c'
X#include <stdio.h>
X
X
Xextern int foo1();
X
Xmain()
X{
X	int (*fptr)();
X
X	foo();
X	fptr = &foo1;
X	printf("foo1 is at %lx: \n", foo1);
X}
END-of-test/main.c
echo x - test/Makefile
sed 's/^X//' >test/Makefile << 'END-of-test/Makefile'
Xall:
X	gcc -c -fPIC foo.c -o foo.o
X	gcc -shared foo.o -o libfoo.so
X	gcc main.c -L. -lfoo -o main
X
END-of-test/Makefile
exit


>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ia64" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030206180449.A9223>