Debian Codegraph @

gcc/testsuite/gm2/switches/uninit-variable-checking/fail/testrecinit.mod

raw
1 MODULE testrecinit ;
2
3
4 TYPE
5 color = RECORD
6 r, g, b: CARDINAL ;
7 END ;
8
9 pixel = RECORD
10 fg, bg: color ;
11 END ;
12
13 PROCEDURE test ;
14 VAR
15 p: pixel ;
16 BEGIN
17 p.fg.r := 1 ;
18 p.fg.g := 2 ;
19 p.fg.b := 3 ;
20 p.bg.r := 4 ;
21 p.bg.g := 5 ;
22 (* p.bg.b := 6 ; *)
23 (* forget to initialize p.bg.b *)
24 IF p.bg.b = 6 (* should catch error. *)
25 THEN
26 END
27 END test ;
28
29 BEGIN
30 test
31 END testrecinit.