[PATCH, middle-end, commited]: Fix PR21282

Uros Bizjak uros@kss-loka.si
Tue May 3 08:05:00 GMT 2005


Hello!

This patch fixes a thinko in (int)ceil(float) and (int)floor(float) 
conversion on !TARGET_C99_FUNCTIONS targets. As shown in PR report, this 
testcase can still produce a call to floorf():

extern double floor (double);

long foo (float f)
{
  return (long) floor (f);
}

The obvoius fix is to disable all (int)ceil(float) and (int)floor(float) conversions for !TARGET_C99_FUNCTIONS targets.

Patch was commited to mainline under obvious rule (as it is the same fix as for floorf and floorl) after it passed
bootstrap on i686-pc-linux-gnu. Patch was regtested on sparc-sun-solaris2.8 for c and on i686-pc-linux-gnu for c and c++.
A testcase from PR was added to the testsuite.

2005-05-03  Uros Bizjak  <uros@kss-loka.si>

	PR middle-end/21282
	* convert.c (convert_to_integer): Convert ceil and floor in
	c99 mode only.

testsuite:

	PR middle-end/21282
	* gcc.dg/pr21282.c: New.


Uros.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pr21282.diff
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050503/d06c1409/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pr21282.c
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050503/d06c1409/attachment.c>


More information about the Gcc-patches mailing list