fold casted const variables

Joseph S. Myers jsm28@cam.ac.uk
Sun Feb 16 18:06:00 GMT 2003


On Sun, 16 Feb 2003, Jan Hubicka wrote:

> Hi,
> the following testcase does not get current simplified as it should.
> 
> Bootstrapped/regtested on i386.  OK?
> Honza
> void link_error (void);
> const double one=1.0;
> t()
> {
> 	if ((int)one != 1)
> 		link_error ();
> }
> Sun Feb 16 17:34:30 CET 2003  Jan Hubicka  <jh@suse.cz>
> 
> 	* c-typeck.c (build_c_cast):  Fold constant variables into
> 	initial values.

You have made sure that this doesn't cause anything to be counted as an
integer constant expression that shouldn't be and isn't currently?  (See
c9?-const-expr-3.c and add testcases (to both files) for casting a double
0.0 to int.  (int)0.0 is constant (pass), (int)(0.0+0.0), (int)+0.0,
(int)(double)0.0 aren't (probably fail), (int)zero where const double zero
= 0.0; shouldn't be constant either.)

-- 
Joseph S. Myers
jsm28@cam.ac.uk



More information about the Gcc-patches mailing list