V3 PATCH: numeric_limits<> support, fix PR/3865

Zack Weinberg zack@codesourcery.com
Tue Sep 3 09:50:00 GMT 2002


On Tue, Sep 03, 2002 at 03:01:34PM +0200, Gabriel Dos Reis wrote:
> | 	z.cc:5: warning: division by zero in `
> | 	   0x00000000000000000080ff3f0000000000000000 / 0.'
> | 	z.cc:6: warning: division by zero in `
> | 	   0x0000000000000000000000000000000000000000 / 0.'
> 
> Yes, from time to time I find them very annoying, especially in the
> form they're printed.
> While back, I fixed the printing with
> 
>    2001-09-15  Gabriel Dos Reis  <gdr@merlin.codesourcery.com>
> 
> 	   * Make-lang.in (cp/error.o): Depend on real.h
> 	   * error.c: #include "real.h"
> 
> but a patch from Zack
> 
>    2002-03-22  Zack Weinberg  <zack@codesourcery.com>
> 
> 	   * error.c: Always use REAL_VALUE_TO_DECIMAL; don't test
> 	   REAL_IS_NOT_DOUBLE.
> 
> reverted the fix.  I don't know why he did that.  Zack?

We can't use sprintf("%g") with REAL_VALUE_TYPE quantities; they
aren't floating point numbers.

The code that generates these 0x... quantities was there before my
patch; I just deleted the #ifndef REAL_IS_NOT_DOUBLE block.  It would
probably be safe to change the existing code to something like

  case REAL_CST:
    REAL_VALUE_TO_DECIMAL (TREE_REAL_CST (t), "%g", digit_buffer);
    output_add_string (scratch_buffer, digit_buffer);
    break;

zw



More information about the Gcc-patches mailing list