This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/28473] [4.0/4.1/4.2 Regression] with -O, casting result of round(x) to uint64_t produces wrong values for x > INT_MAX
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Jul 2006 08:46:28 -0000
- Subject: [Bug middle-end/28473] [4.0/4.1/4.2 Regression] with -O, casting result of round(x) to uint64_t produces wrong values for x > INT_MAX
- References: <bug-28473-13001@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from rguenth at gcc dot gnu dot org 2006-07-25 08:46 -------
Confirmed. Testcase:
typedef unsigned uint64_t __attribute__((mode(DI)));
uint64_t foo(void)
{
uint64_t x = 2147483648ULL; /* INT_MAX+1 */
uint64_t y = (uint64_t)__builtin_round(x);
return y;
}
where we fold it to
uint64_t y = (long long unsigned int) __builtin_lround ((double) x);
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Component|c |middle-end
Ever Confirmed|0 |1
Keywords| |wrong-code
Known to work| |3.4.6
Last reconfirmed|0000-00-00 00:00:00 |2006-07-25 08:46:28
date| |
Summary|with -O, casting result of |[4.0/4.1/4.2 Regression]
|round(x) to uint64_t |with -O, casting result of
|produces wrong values for x |round(x) to uint64_t
|> INT_MAX |produces wrong values for x
| |> INT_MAX
Target Milestone|--- |4.0.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28473