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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [c-c++-common/] [dfp/] [call-by-value.c] - Blame information for rev 705

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 686 jeremybenn
/* C99 6.9.1(9) Function definitions; parameter has automatic storage.
2
 
3
   Test that actual parameters are passed by value and that modifications
4
   made within functions are lost on function return.  */
5
 
6
#include "dfp-dbg.h"
7
 
8
int foo32 (_Decimal32 z)
9
{
10
  z = z + 1.0df;
11
}
12
 
13
int foo64 (_Decimal64 z)
14
{
15
  z = z + 1.0dd;
16
}
17
 
18
int foo128 (_Decimal128 z)
19
{
20
  z = z + 1.0dl;
21
}
22
 
23
int
24
main ()
25
{
26
  _Decimal32 d32 = 1.1df;
27
  _Decimal64 d64 = 1.2dd;
28
  _Decimal128 d128 = 1.3dl;
29
 
30
  foo32 (d32);
31
  if (d32 != 1.1df)
32
    FAILURE
33
 
34
  foo64 (d64);
35
  if (d64 != 1.2dd)
36
    FAILURE
37
 
38
  foo128 (d128);
39
  if (d128 != 1.3dl)
40
    FAILURE
41
 
42
  FINISH
43
}

powered by: WebSVN 2.1.0

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