aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture/pr116772-1.c
blob: eedd0398af16c1eb351735216ccde060986fda47 (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
/* { dg-do run } */
/* PR middle-end/116772  */
/* The division by `/b` should not
   be made uncondtional. */

int mult0(int a,int b) __attribute__((noipa));

int mult0(int a,int b){
  return (b!=0 ? (a/b)*b : 0);
}

int bit_and0(int a,int b) __attribute__((noipa));

int bit_and0(int a,int b){
  return (b!=0 ? (a/b)&b : 0);
}

int main() {
  if (mult0(3, 0) != 0)
    __builtin_abort();
  if (bit_and0(3, 0) != 0)
    __builtin_abort();
  return 0;
}