c/9762: Address of 'char' is incorrect.

stephen.kennedy@havok.com stephen.kennedy@havok.com
Wed Feb 19 19:56:00 GMT 2003


>Number:         9762
>Category:       c
>Synopsis:       Address of 'char' is incorrect.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 19 19:56:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Stephen Kennedy
>Release:        3.2.3 20030210 (Debian prerelease) (Debian testing/unstable)
>Organization:
Telekinesys Research
>Environment:
System: Linux stag 2.4.19-686 #1 Thu Aug 8 21:30:09 EST 2002 i686 unknown
Architecture: i686

	
host: i386-pc-linux-gnu
build: i386-pc-linux-gnu
target: i386-pc-linux-gnu
configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,pascal,objc,ada --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.2 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-java-gc=boehm --enable-objc-gc i386-linux
>Description:

	In the example below, '&a' is the address of a local copy of 'a' not of 'a'.
	if the type of 'a' is changed to int, it works as expected.

>How-To-Repeat:

#define TA char
#define TB int
#define TC int

void foobar(TA a, TB b, TC c);

int main()
{
	foobar(1,2,3);
	return 0;
}

void foobar(TA a, TB b, TC c)
{
	printf("a == %i  claims %x\n", a, &a);
	printf("a == %i  really %x\n", (&b)[-1], (&b)-1);
	printf("b == %i  %x\n", b, &b);
	printf("c == %i  %x\n", c, &c);
}

>Fix:

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



More information about the Gcc-bugs mailing list