Debian Codegraph @

gcc/testsuite/gm2/pim/run/pass/convert1.mod

raw
1 MODULE convert1 ;
2
3 FROM libc IMPORT printf, exit ;
4 FROM Builtins IMPORT log10l ;
5
6
7 PROCEDURE assert (a, b: INTEGER) ;
8 BEGIN
9 IF a # b
10 THEN
11 printf ("failure: %d # %d\n", a, b) ;
12 code := 1
13 END
14 END assert ;
15
16
17 PROCEDURE identityl (l: LONGREAL) : LONGREAL ;
18 BEGIN
19 RETURN l
20 END identityl ;
21
22
23 PROCEDURE foo (l: LONGREAL) : INTEGER ;
24 BEGIN
25 RETURN VAL (INTEGER, identityl (l))
26 END foo ;
27
28
29 PROCEDURE fooi (l: LONGREAL) : INTEGER ;
30 BEGIN
31 RETURN VAL (INTEGER, log10l (l))
32 END fooi ;
33
34
35 PROCEDURE test ;
36 BEGIN
37 assert (foo (1.0), 1) ;
38 assert (fooi (100.0), 2) ;
39 assert (fooi (1.23456789), 0)
40 END test ;
41
42
43 VAR
44 code: INTEGER ;
45 BEGIN
46 code := 0 ;
47 test ;
48 exit (code)
49 END convert1.