From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17338 invoked by alias); 8 Feb 2007 15:03:08 -0000 Received: (qmail 17328 invoked by uid 22791); 8 Feb 2007 15:03:07 -0000 X-Spam-Check-By: sourceware.org Received: from web86107.mail.ird.yahoo.com (HELO web86107.mail.ird.yahoo.com) (217.146.188.100) by sourceware.org (qpsmtpd/0.31) with SMTP; Thu, 08 Feb 2007 15:02:43 +0000 Received: (qmail 80443 invoked by uid 60001); 8 Feb 2007 15:02:35 -0000 Message-ID: <20070208150235.80441.qmail@web86107.mail.ird.yahoo.com> X-YMail-OSG: CVgOYZwVM1nerHOJSgTGJ0.EO0z9vfKyPxSzbQVT4OsXO0uh7a9FlzCZaWnKOLlCJCw7lc08TLvaKQ9SD7fnR5HZUVxccewoBhKV0swkBQLgIFDyzDaoyTlUGyTLDNoSfrccc56E.rc- Received: from [194.200.65.239] by web86107.mail.ird.yahoo.com via HTTP; Thu, 08 Feb 2007 15:02:35 GMT Date: Thu, 08 Feb 2007 15:03:00 -0000 From: Graham Stott Subject: Re: GCC has problems with 64-bit multiplication To: Hans Petter Selasky , gcc-bugs@gcc.gnu.org In-Reply-To: <200702081502.51044.hselasky@c2i.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-02/txt/msg00930.txt.bz2 All, Not a bug in GCC the result is correct as you've only asked for a 32-bit multiply. --- Hans Petter Selasky wrote: > Test program: > > #include > #include > > int main() { > > int32_t a = 0x40000000; > int16_t b = 0x4000; > int64_t c = a * b; ^^^^^ this is a 32-bit multiply with the result widened to 64-bit, > printf("0x%016llx\n", c); > > return 0; > } >