Debian Codegraph @

gcc/testsuite/gm2.dg/doc/examples/plugin/fail/assignvalue.mod

raw
1 (* { dg-do compile } *)
2 (* { dg-options "-fsoft-check-all -fm2-plugin" } *)
3 (* { dg-skip-if "" { *-*-* } { "*" } { "-O2" } } *)
4
5 MODULE assignvalue ; (*!m2iso+gm2*)
6
7 PROCEDURE bad () : INTEGER ;
8 VAR
9 i: INTEGER ;
10 BEGIN
11 i := -1 ;
12 RETURN i
13 END bad ;
14
15 VAR
16 foo: CARDINAL ;
17 BEGIN
18 (* The m2rte plugin will detect this as an error, post
19 optimization. *)
20 foo := bad () (* { dg-error "error: In program module assignvalue" } *)
21 (* { dg-begin-multiline-output "" }
22 runtime error will occur, assignment will cause a range error, as the runtime instance value of 'CARDINAL' does not overlap with the type 'INTEGER'
23 { dg-end-multiline-output "" } *)
24
25 END assignvalue.