This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bootstrap failure on trunk: x86_64-linux-gnu


Here's the next segment in the ongoing saga of VRP vs Ada...
Not surprisingly we have another case where an object gets a
value outside of its TYPE_MIN_VALUE/TYPE_MAX_VALUE defined range.

Investigating the c460008 testsuite failure we have the following
code for Fixed_To_Short before VRP runs:




  # BLOCK 4
  # PRED: 3 (fallthru,exec)
  D.1294_13 = D.1294_12;
  D.1309_32 = for_the_value_31 /[rd] 1000000000;
  D.1310_33 = (UNSIGNED_64) D.1309_32;
  if (D.1310_33 > 255) goto <L0>; else goto <L1>;
  # SUCC: 5 (true,exec) 6 (false,exec)

  # BLOCK 5 
  # PRED: 4 (true,exec)
<L0>:;
  __gnat_rcheck_10 ("c460008.adb", 162);
  # SUCC: 13 (ab,eh,exec) 18 (ab,eh,exec) 29 (ab,eh,exec)
  
  # BLOCK 6
  # PRED: 4 (false,exec)
<L1>:;
  iftmp.78_63 = D.1309_32;
  iftmp.78_64 = D.1309_32;
  D.1316_65 = (c460008__unsigned_edge_8) D.1309_32;
  if (D.1316_65 == 255) goto <L3>; else goto <L4>;
  # SUCC: 7 (true,exec) 8 (false,exec)

D.1309_32's type has the range [0x8000000000000000,0x7fffffffffffffff]
with 64bit precision.

In block #6 we cast the value of D.1309_32 into a smaller type,
specifically c460008__unsigned_edge_8 and store the result into
D.1316_64 which has type c460008__unsigned_edge_8.

c460008__unsigned_edge_8's range is [ ,254] with 8 bit precision.

Note carefully that with the range [ ,254] (according to
TYPE_MIN_VALUE/TYPE_MAX_VALUE) that the test

if (D.1316_65 == 255)

Must always be false.  So VRP, as expected, wipes out test
completely.

The problem (of course) is D.1316_65 can and does actually hold
values outside the range [ ,254] at runtime.  For example, it could
hold the value 255 if D.1309_32 had the value 255, which would occur
if for_the_value_31 held the value 255000000000.

Someone with a better knowledge of Ada is going to need to step
in here, but based on the type information provided by the Ada
front-end, VRP is doing the right thing here.


Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]