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]

Fix to problem with CONST_DOUBLE


If an outer function puts a CONST_DOUBLE in its chain and in its constant
pool, a nested function can't use it.  This can occur with the saves
constants of zero and one, so we don't use them in a nested function.

Sat Apr 15 10:59:19 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

	* varasm.c (assemble_variable): Add cast to remove warning.
	(immed_real_const_1): Only use CONST[01]_RTX if not in nested function.

*** varasm.c	2000/03/25 18:34:05	1.110
--- varasm.c	2000/04/15 15:37:05
*************** assemble_variable (decl, top_level, at_e
*** 1508,1512 ****
        
  #if !defined(ASM_OUTPUT_ALIGNED_COMMON) && !defined(ASM_OUTPUT_ALIGNED_BSS)
!       if (DECL_ALIGN (decl) / BITS_PER_UNIT > rounded)
           warning_with_decl 
             (decl, "requested alignment for %s is greater than implemented alignment of %d.",rounded);
--- 1508,1512 ----
        
  #if !defined(ASM_OUTPUT_ALIGNED_COMMON) && !defined(ASM_OUTPUT_ALIGNED_BSS)
!       if ((unsigned HOST_WIDE_INT) DECL_ALIGN (decl) / BITS_PER_UNIT > rounded)
           warning_with_decl 
             (decl, "requested alignment for %s is greater than implemented alignment of %d.",rounded);
*************** immed_real_const_1 (d, mode)
*** 2163,2175 ****
    u.d = d;
  
!   /* Detect special cases.  */
! 
!   if (REAL_VALUES_IDENTICAL (dconst0, d))
      return CONST0_RTX (mode);
    /* Check for NaN first, because some ports (specifically the i386) do not
       emit correct ieee-fp code by default, and thus will generate a core
       dump here if we pass a NaN to REAL_VALUES_EQUAL and if REAL_VALUES_EQUAL
       does a floating point comparison.  */
!   else if (! REAL_VALUE_ISNAN (d) && REAL_VALUES_EQUAL (dconst1, d))
      return CONST1_RTX (mode);
  
--- 2163,2179 ----
    u.d = d;
  
!   /* Detect special cases.  But be careful we don't use a CONST_DOUBLE
!      that's from a parent function since it may be in its constant pool.  */
!   if (REAL_VALUES_IDENTICAL (dconst0, d)
!       && (cfun == 0 || decl_function_context (current_function_decl) == 0))
      return CONST0_RTX (mode);
+ 
    /* Check for NaN first, because some ports (specifically the i386) do not
       emit correct ieee-fp code by default, and thus will generate a core
       dump here if we pass a NaN to REAL_VALUES_EQUAL and if REAL_VALUES_EQUAL
       does a floating point comparison.  */
!   else if ((! REAL_VALUE_ISNAN (d) && REAL_VALUES_EQUAL (dconst1, d))
! 	   && (cfun == 0
! 	       || decl_function_context (current_function_decl) == 0))
      return CONST1_RTX (mode);
  
*************** find_pool_constant (f, addr)
*** 3678,3682 ****
    const char *label = XSTR (addr, 0);
  
!   for (sym = f->varasm->x_const_rtx_sym_hash_table[SYMHASH (label)]; sym; sym = sym->next)
      if (sym->label == label)
        return sym->pool;
--- 3682,3687 ----
    const char *label = XSTR (addr, 0);
  
!   for (sym = f->varasm->x_const_rtx_sym_hash_table[SYMHASH (label)]; sym;
!        sym = sym->next)
      if (sym->label == label)
        return sym->pool;

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