From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19915 invoked by alias); 25 Jul 2006 08:46:38 -0000 Received: (qmail 19789 invoked by uid 48); 25 Jul 2006 08:46:28 -0000 Date: Tue, 25 Jul 2006 08:46:00 -0000 Message-ID: <20060725084628.19788.qmail@sourceware.org> X-Bugzilla-Reason: CC References: 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 In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rguenth at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-07/txt/msg01910.txt.bz2 List-Id: ------- 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