[gnu.gcc.bug] cross compilation and floating point bug

ham@Neon.Stanford.EDU (Peter R. Ham) (09/27/89)

version 1.35
This time some floating point related code was commented
out when !REAL_ARITHMETIC, but actually should remain.
(At least in the case that produced the bug.)

The code fragments (global variables) should produce
identical assembler:

float foo = 1.1f;

and 

float foo = 1.1;

When cross compiling, the second produces an error.
The reason is that the implicit cast from double
constant to single constant is not "constant folded"
by fold() when it should be. Here's the diffs:

*** fold-const.c	Wed Sep 27 08:38:52 1989
--- ../dist/fold-const.c	Mon Aug  7 17:07:18 1989
***************
*** 1087,1101 ****
  	  if (TREE_OPERAND (t, i) == 0)
  	    continue;		/* Valid for CALL_EXPR, at least.  */
  	  if (TREE_CODE (TREE_OPERAND (t, i)) != INTEGER_CST
- #ifdef WITH_PERPROCESS_VARIABLES
- #else WITH_PERPROCESS_VARIABLES
  #if ! defined (REAL_IS_NOT_DOUBLE) || defined (REAL_ARITHMETIC)
- #endif WITH_PERPROCESS_VARIABLES
  	      && TREE_CODE (TREE_OPERAND (t, i)) != REAL_CST
- #ifdef WITH_PERPROCESS_VARIABLES
- #else  WITH_PERPROCESS_VARIABLES
  #endif /* not REAL_IS_NOT_DOUBLE, or REAL_ARITHMETIC */
- #endif WITH_PERPROCESS_VARIABLES
  	      )
  	    /* Note that TREE_LITERAL isn't enough:
  	       static var addresses are constant but we can't
--- 1087,1095 ----
***************
*** 1177,1187 ****
  	    }
  	  else if (TREE_CODE (arg0) == REAL_CST)
  	    {
- #ifdef WITH_PERPROCESS_VARIABLES
- 	      if (REAL_VALUES_LESS(TREE_REAL_CST (arg0),REAL_VALUE_ATOF("0.0")))
- #else  WITH_PERPROCESS_VARIABLES
  	      if (TREE_REAL_CST (arg0) < 0)
- #endif  WITH_PERPROCESS_VARIABLES
  		t = build_real (type,
  				REAL_VALUE_NEGATE (TREE_REAL_CST (arg0)));
  	    }
--- 1171,1177 ----
--
Peter Ham			PO Box 3430	(h)(415) 324-9645
MS Computer Science Student	Stanford, CA	ham@polya.stanford.edu
Stanford University 		94309		(o)(415) 723-2067

ham@Neon.Stanford.EDU (Peter R. Ham) (09/27/89)

Oops, I guess the way I nested #ifdef's in the previous fix is
incorrect, but I think that it's obvious which code should be
removed.
--
Peter Ham			PO Box 3430	(h)(415) 324-9645
MS Computer Science Student	Stanford, CA	ham@polya.stanford.edu
Stanford University 		94309		(o)(415) 723-2067