Debian Codegraph @

gcc/testsuite/gm2/cse/pass/testcse49.mod

raw
1 (* Copyright (C) 2005 Free Software Foundation, Inc. *)
2 (* This file is part of GNU Modula-2.
3
4 GNU Modula-2 is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
7 version.
8
9 GNU Modula-2 is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 for more details.
13
14 You should have received a copy of the GNU General Public License along
15 with gm2; see the file COPYING. If not, write to the Free Software
16 Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *)
17
18 MODULE testcse49 ;
19
20 FROM StrIO IMPORT WriteLn ;
21 FROM SYSTEM IMPORT ADR, ADDRESS ;
22
23 TYPE
24 string = ARRAY [0..10] OF CHAR ;
25 STRING = RECORD
26 c: POINTER TO string ;
27 h: CARDINAL ;
28 END ;
29
30 PROCEDURE StrLen (a: STRING) : CARDINAL ;
31 BEGIN
32 a.c^[4] := 'a' ;
33 RETURN 5
34 END StrLen ;
35
36
37 PROCEDURE foo ;
38 VAR
39 t: STRING ;
40 b: string ;
41 BEGIN
42 b := 'hello' ;
43 t.c := ADR(b) ;
44 t.h := 5 ;
45 IF StrLen(t)=5
46 THEN
47 WriteLn
48 END
49 END foo ;
50
51 BEGIN
52 foo
53 END testcse49.