aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/builtin-arith-overflow-5.c
blob: b43fd1859d43b743adc56c81d1bb1646963d36de (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/* PR rtl-optimization/95862 */
/* { dg-do compile } */
/* { dg-options "-O2" } */

int
f1 (int a, int b)
{
  unsigned long long c;
  return __builtin_mul_overflow (a, b, &c);
}

int
f2 (int a, unsigned b)
{
  unsigned long long c;
  return __builtin_mul_overflow (a, b, &c);
}

int
f3 (unsigned a, unsigned b)
{
  long long c;
  return __builtin_mul_overflow (a, b, &c);
}

int
f4 (int a, unsigned b)
{
  long long c;
  return __builtin_mul_overflow (a, b, &c);
}

short
f5 (short a, short b)
{
  unsigned c;
  return __builtin_mul_overflow (a, b, &c);
}

short
f6 (short a, unsigned short b)
{
  unsigned c;
  return __builtin_mul_overflow (a, b, &c);
}

short
f7 (unsigned short a, unsigned short b)
{
  int c;
  return __builtin_mul_overflow (a, b, &c);
}

short
f8 (short a, unsigned short b)
{
  int c;
  return __builtin_mul_overflow (a, b, &c);
}

signed char
f9 (signed char a, signed char b)
{
  unsigned short c;
  return __builtin_mul_overflow (a, b, &c);
}

signed char
f10 (signed char a, unsigned char b)
{
  unsigned short c;
  return __builtin_mul_overflow (a, b, &c);
}

signed char
f11 (unsigned char a, unsigned char b)
{
  short c;
  return __builtin_mul_overflow (a, b, &c);
}

signed char
f12 (signed char a, unsigned char b)
{
  short c;
  return __builtin_mul_overflow (a, b, &c);
}