OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [va-arg-trap-1.c] - Blame information for rev 826

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 297 jeremybenn
/* Undefined behavior from a call to va_arg with a type other than
2
   that of the argument passed (in particular, with a type such as
3
   "float" that can never be the type of an argument passed through
4
   "...") does not appear until after the va_list expression is
5
   evaluated.  PR 38483.  */
6
/* Origin: Joseph Myers <joseph@codesourcery.com> */
7
 
8
#include <stdarg.h>
9
 
10
extern void exit (int);
11
extern void abort (void);
12
 
13
va_list ap;
14
float f;
15
 
16
va_list *
17
foo (void)
18
{
19
  exit (0);
20
  return &ap;
21
}
22
 
23
void
24
bar (int i, ...)
25
{
26
  va_start (ap, i);
27
  f = va_arg (*foo (), float);
28
  va_end (ap);
29
}
30
 
31
int
32
main (void)
33
{
34
  bar (1, 0);
35
  abort ();
36
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.