This is the mail archive of the gcc-patches@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]

Minor fix to tree.c:int_fits_in_type_p


This fixes a bug that shows up in Ada with -gnato and many cases.  It is
not possible to make a test case in C since we don't have types with
variable bounds.

Tested on alphaev56-dec-osf4.0c.

Tue Jan 22 06:26:33 2002  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

	* tree.c (int_fits_type_p): If bounds of a subtype are variable, see
	if fits in bounds of base type.

*** tree.c	2002/01/10 20:12:56	1.230
--- tree.c	2002/01/22 11:21:28
*************** int_fits_type_p (c, type)
*** 4246,4250 ****
  {
    /* If the bounds of the type are integers, we can check ourselves.
!      Otherwise,. use force_fit_type, which checks against the precision.  */
    if (TYPE_MAX_VALUE (type) != NULL_TREE
        && TYPE_MIN_VALUE (type) != NULL_TREE
--- 4246,4251 ----
  {
    /* If the bounds of the type are integers, we can check ourselves.
!      If not, but this type is a subtype, try checking against that.
!      Otherwise, use force_fit_type, which checks against the precision.  */
    if (TYPE_MAX_VALUE (type) != NULL_TREE
        && TYPE_MIN_VALUE (type) != NULL_TREE
*************** int_fits_type_p (c, type)
*** 4265,4268 ****
--- 4266,4271 ----
  		      && TREE_UNSIGNED (TREE_TYPE (c))));
      }
+   else if (TREE_CODE (type) == INTEGER_TYPE && TREE_TYPE (type) != 0)
+     return int_fits_type_p (c, TREE_TYPE (type));
    else
      {


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