aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/avr/pr60040-1.c
blob: 4fe296b37df5ddd4950878d51c8fa75fc20ba6c5 (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
/* { dg-do compile } */
/* { dg-options "-Os" } */

float dhistory[10];
float test;

float getSlope(float history[]) {
  float sumx = 0;
  float sumy = 0;
  float sumxy = 0;
  float sumxsq = 0;
  float rate = 0;
  int n = 10;

  int i;
  for (i=1; i< 11; i++) {
    sumx = sumx + i;
    sumy = sumy + history[i-1];
    sumy = sumy + history[i-1];
    sumxsq = sumxsq + (i*i);
  }

  rate = sumy+sumx+sumxsq;
  return rate;
}

void loop() {
  test = getSlope(dhistory);
}