This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/12210] Bug in `expand_builtin_apply'(possibly in `allocate_dynamic_stack_space')
- From: "waspcoder at mail dot ru" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Sep 2003 15:03:16 -0000
- Subject: [Bug middle-end/12210] Bug in `expand_builtin_apply'(possibly in `allocate_dynamic_stack_space')
- References: <20030908150117.12210.waspcoder@mail.ru>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12210
------- Additional Comments From waspcoder at mail dot ru 2003-09-08 15:03 -------
BUGREPORT
Ossadchy Yury A., waspcoder@mail.ru
GCC 3.3.1 fails on test
--- CODE ---
#include <stdio.h>
__attribute__ ((regparm (0))) int fn1 (int arg1, int arg2)
{
printf ("fn1 (%i, %i)\n", arg1, arg2);
return -20;
}
__attribute__ ((regparm (0))) int caller (int arg1, int arg2)
{
void * args = __builtin_apply_args ();
printf ("caller (%i, %i)\n", arg1, arg2);
__builtin_return (__builtin_apply ((void (*)())&fn1, args, sizeof (int)*2));
// ^^^^^^^^^^^^^^
// it's bad, but it must work!
// regparm (0)!
}
int main ()
{
printf ("result == %i\n", caller (10, 34));
}
--- /CODE ---
gcc-2.96:
>caller (10, 34)
>fn1 (10, 34)
>result == -20
gcc-3.3.1:
>caller (10, 34)
>fn1 (1074217344, 1075033152)
>result == -20
gcc -v:
>Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/specs
>Configured with: ../gcc-3.3.1/configure --enable-languages=c objc++
>Thread model: posix
>gcc version 3.3.1
NOTE: include somewhat like my test into `testsuite'!
Problem is in `builtins.c::expand_builtin_apply', when pushing parameters.
Simplest `bugfix':
/* WASP: dest = allocate_dynamic_stack_space (argsize, 0, BITS_PER_UNIT);
does NOT works, use this: */
dest = push_block (argsize, 0, 1);