[Bug target/50818] va_list is filled incorrectly in functions with ms_abi attribute on amd64
ubizjak at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Jul 23 19:08:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50818
--- Comment #4 from Uroš Bizjak <ubizjak at gmail dot com> ---
Executable testcase:
--cut here--
int
__attribute__((ms_abi))
foo (int n, ...)
{
__builtin_va_list ap;
int sum = 0;
__builtin_va_start (ap, n);
while (n--)
sum += __builtin_va_arg (ap, int);
__builtin_va_end (ap);
return sum;
}
int main ()
{
int res = foo (10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
if (res != 55)
__builtin_abort ();
return 0;
}
--cut here--
$ gcc -O2 pr50818.c
$ ./a.out
Segmentation fault (core dumped)
$ gcc -O2 -mabi=ms pr50818.c
$ ./a.out
$
More information about the Gcc-bugs
mailing list