[PATCH] Fix PR32628, bogus overflow flag on sizetype consts

Richard Kenner kenner@vlsi1.ultra.nyu.edu
Wed Jan 16 19:47:00 GMT 2008


> It's the subtle overflow checking code in the E_Array_Subtype case of 
> gnat_to_gnu_entity, more specifically:
> 
> 	      /* See if the base array type is already flat.  If it is, we
> 		 are probably compiling an ACVC test, but it will cause the
> 		 code below to malfunction if we don't handle it specially.  */
> 	      if (TREE_CODE (gnu_base_min) == INTEGER_CST
> 		  && TREE_CODE (gnu_base_max) == INTEGER_CST
> 		  && !TREE_OVERFLOW (gnu_base_min)
> 		  && !TREE_OVERFLOW (gnu_base_max)
> 		  && tree_int_cst_lt (gnu_base_max, gnu_base_min))
> 		gnu_high = size_zero_node, gnu_min = size_one_node;
> 
> which now triggers on the attached testcase, whereas it used not to.

Ah, right.

I guess we do have to have TREE_OVERFLOW on sizetypes for that purpose.

I must say, then, that I missed the whole point of this change.  If
it's just for constants, why have special handling for TREE_OVEFLOW?
If we KNOW the constant overflows, why not say so?  What happens at run time
has nothing to do with this.



More information about the Gcc-patches mailing list