public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c/9890: __builtin_apply generates incorrect reference to arguments
@ 2003-02-28 20:26 zandy
  0 siblings, 0 replies; only message in thread
From: zandy @ 2003-02-28 20:26 UTC (permalink / raw)
  To: gcc-gnats; +Cc: gquinn


>Number:         9890
>Category:       c
>Synopsis:       __builtin_apply generates incorrect reference to arguments
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 28 20:26:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     vic zandy
>Release:        gcc 3.2.2
>Organization:
>Environment:
linux 2.4.18 i686
intel pentium 4 2.0GHz
>Description:
_builtin_apply passes incorrect arguments
to the function it calls.
>How-To-Repeat:
gcc -o myfile myfile.c
./myfile
observe that output is NOT "foo(1,2)" as it
should be.
note that the right thing happens if
assert(0) in docall is removed.
i have a more complicated example that
exhibits the misbehavior but does not
contain code after the builtin_return,
available upon request
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="myfile.c"
Content-Disposition: inline; filename="myfile.c"

#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <dlfcn.h>

int
foo(int x, int y)
{
	fprintf(stderr, "foo(%d,%d)\n", x, y);
	return 0;
}

int
docall(int x, int y)
{
	void *args, *result;
	void *f;

	f = (void*)foo;
	args = __builtin_apply_args();
	result = __builtin_apply((void(*)()) f,
				 args, 6*sizeof(int));
	__builtin_return(result);
	assert(0);
}

int
main(int argc, char *argv[])
{
	int rv;
	rv = docall(1, 2);
	return 0;
}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-02-28 20:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-28 20:26 c/9890: __builtin_apply generates incorrect reference to arguments zandy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).