aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/ftrapv-1.c
blob: 86bd802cf13eb30477b32e16eb06b52a08766ed2 (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
/* Copyright (C) 2004 Free Software Foundation.

   PR other/15526
   Verify correct overflow checking with -ftrapv.

   Written by Falk Hueffner, 20th May 2004.  */

/* { dg-do run } */
/* { dg-options "-ftrapv" } */
/* { dg-require-effective-target trapping } */

__attribute__((noinline)) int
mulv(int a, int b)
{
  return a * b;
}

int
main()
{
  mulv( 0,  0);
  mulv( 0, -1);
  mulv(-1,  0);
  mulv(-1, -1);
  return 0;
}