annotate gcc/testsuite/gnat.dg/unchecked_convert6.adb @ 144:8f4e72ab4e11

fix segmentation fault caused by nothing next cur_op to end
author Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sun, 23 Dec 2018 21:23:56 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 -- { dg-do run { target hppa*-*-* sparc*-*-* powerpc*-*-* } }
kono
parents:
diff changeset
2
kono
parents:
diff changeset
3 with Unchecked_Conversion;
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 procedure Unchecked_Convert6 is
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 subtype c_5 is string(1..5);
kono
parents:
diff changeset
8
kono
parents:
diff changeset
9 function int2c5 is -- { dg-warning "different sizes" }
kono
parents:
diff changeset
10 new unchecked_conversion (source => integer, target => c_5);
kono
parents:
diff changeset
11
kono
parents:
diff changeset
12 c5 : c_5;
kono
parents:
diff changeset
13
kono
parents:
diff changeset
14 begin
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 c5 := int2c5(16#12#);
kono
parents:
diff changeset
17
kono
parents:
diff changeset
18 if c5 (4) /= ASCII.DC2 then
kono
parents:
diff changeset
19 raise Program_Error;
kono
parents:
diff changeset
20 end if;
kono
parents:
diff changeset
21
kono
parents:
diff changeset
22 end;