https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50818
Steven Shi <steven.shi at intel dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |steven.shi at intel dot com
--- Comment #5 from Steven Shi <steven.shi at intel dot com> ---
Hi Bizjak,
Your Executable testcase cannot really work with -mabi=ms on the command line.
If add a printf() in the while loop to output the sum value as below example,
the testcase will fail again with Segmentation fault even building with with
-mabi=ms.
$ gcc -O2 -mabi=ms pr50818.c
$ ./a.out
Segmentation fault (core dumped)
#include <stdio.h>
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);
printf("sum = %d\n", sum);
}
__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;
}