| [3ff27cf] | 1 | #ifdef _CIVL
|
|---|
| 2 | #include <civlc.cvh>
|
|---|
| 3 | #endif
|
|---|
| [a0f0868] | 4 | /* FEVS: A Functional Equivalence Verification Suite for High-Performance
|
|---|
| 5 | * Scientific Computing
|
|---|
| 6 | *
|
|---|
| 7 | * Copyright (C) 2010, Stephen F. Siegel, Timothy K. Zirkel,
|
|---|
| 8 | * University of Delaware
|
|---|
| 9 | *
|
|---|
| 10 | * This program is free software; you can redistribute it and/or
|
|---|
| 11 | * modify it under the terms of the GNU General Public License as
|
|---|
| 12 | * published by the Free Software Foundation; either version 3 of the
|
|---|
| 13 | * License, or (at your option) any later version.
|
|---|
| 14 | *
|
|---|
| 15 | * This program is distributed in the hope that it will be useful, but
|
|---|
| 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|---|
| 18 | * General Public License for more details.
|
|---|
| 19 | *
|
|---|
| 20 | * You should have received a copy of the GNU General Public License
|
|---|
| 21 | * along with this program; if not, write to the Free Software
|
|---|
| 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|---|
| 23 | * 02110-1301 USA.
|
|---|
| 24 | */
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 | #include<stdio.h>
|
|---|
| 28 | #include<stdlib.h>
|
|---|
| 29 |
|
|---|
| [6a436f4] | 30 | #pragma CIVL $input int NB;
|
|---|
| 31 | #pragma CIVL $output int __sum;
|
|---|
| 32 |
|
|---|
| [5be6a1d] | 33 | int main(int argc, char *argv[]) {
|
|---|
| 34 | double result = 0.0;
|
|---|
| [5ca4694] | 35 | #ifdef _CIVL
|
|---|
| 36 | $assume(1 < argc);
|
|---|
| 37 | #endif
|
|---|
| [5be6a1d] | 38 | int n = atoi(argv[1]);
|
|---|
| [3ff27cf] | 39 | #pragma CIVL $assume(0 < n && n <= NB);
|
|---|
| [5be6a1d] | 40 | int i;
|
|---|
| 41 | double a[n];
|
|---|
| 42 | FILE *fp = fopen("data","r");
|
|---|
| 43 |
|
|---|
| 44 | for (i=0; i<n; i++) fscanf(fp, "%lf", &a[i]);
|
|---|
| 45 | for (i=0; i<n; i++) result += a[i];
|
|---|
| 46 | printf("%lf",result);
|
|---|
| [6a436f4] | 47 | #pragma CIVL __sum = result;
|
|---|
| [a0f0868] | 48 | fclose(fp);
|
|---|
| 49 | return 0;
|
|---|
| 50 | }
|
|---|