summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/s390/pr42224.c
blob: c1ccf28d5a8e752fbbcf4ca4d4917e11a71871c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* { dg-do compile } */
/* { dg-options "-O0" } */

typedef char* __char_ptr32 __attribute__ (( mode (SI) ));
typedef __char_ptr32 *__char_ptr_char_ptr32 __attribute__ ((mode (SI)));

void to_ptr32 (int x)
{
  __char_ptr32 ptr = (__char_ptr32) x;
}

void to_int (__char_ptr32 ptr)
{
  int x = (int) ptr;
}

__char_ptr_char_ptr32
to_ptr32_ptr32 (char **ptr64)
{
  int argc;
  __char_ptr_char_ptr32 short_argv;

  for (argc=0; ptr64[argc]; argc++);

  short_argv = (__char_ptr_char_ptr32) malloc32
    (sizeof (__char_ptr32) * (argc + 1));

  for (argc=0; ptr64[argc]; argc++)
    short_argv[argc] = (__char_ptr32) strdup32 (ptr64[argc]);

  short_argv[argc] = (__char_ptr32) 0;
  return short_argv;

}