From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 119397 invoked by alias); 18 Sep 2018 13:17:19 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 119384 invoked by uid 89); 18 Sep 2018 13:17:19 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,KAM_SHORT,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=H*r:2001, H*M:wang X-HELO: mengyan1223.wang Received: from mengyan1223.wang (HELO mengyan1223.wang) (89.208.246.23) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 18 Sep 2018 13:17:17 +0000 Received: from [IPv6:ddf7:6a95:58c8::95e] (unknown [IPv6:2001:250:1006:dff0:c5c4:546e:2203:2b91]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: xry111@mengyan1223.wang) by mengyan1223.wang (Postfix) with ESMTPSA id A9467667CF; Tue, 18 Sep 2018 09:17:15 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mengyan1223.wang; s=mail; t=1537276636; bh=C/+yhtQ6KpikgmCAY8EtZ2EFYx/HL8NiIXu08Vd4rO4=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=UkIPyQAOwKeqwpOMVEmeqnw2KVKwJmrZCCxZ5rnjAZrUCUb2d1XldEvvZnW9zTn6y KaiTEPvbyyB7N00mrWvpX8vvgojoAK5WPGIQrXrKEMbRwgH1Ocb7+laIe57PiyFzxd 2ywFiKco1Dkw7mt0Jp8irY+sp8l6HXi6UQmh94Pahc2OCjU1FHrSrKnCDiYM0jzXa1 XRBILW6BTgSIJfm4ot/xReKxO5vlMean5PSXNiADvfoPagrSoy2UaaVKlbLPQoT8Bg ZCZLnPxnntsv3wGYBpSKvglnmSxzi28uhpLmwk+EFfNrGtlPrp8ZA9uquO83mAGGpt mhZfctwfOgCYQ== Message-ID: Subject: Re: Should rand() return a RAND_MAX value for 32 bit target? From: Xi Ruoyao To: Neha Gowda Cc: gcc-help@gcc.gnu.org Date: Tue, 18 Sep 2018 13:17:00 -0000 In-Reply-To: <4f0b1402f9c0dd7ecec3fc0b23ae46bc5387af2d.camel@mengyan1223.wang> References: <4f0b1402f9c0dd7ecec3fc0b23ae46bc5387af2d.camel@mengyan1223.wang> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2018-09/txt/msg00051.txt.bz2 On 2018-09-18 21:09 +0800, Xi Ruoyao wrote: > > Tried them on the latest source and observed that the RAND_MAX is generated > > when > > the optimization is not enabled. When optimization is enabled for 32 bit > > target RAND_MAX > > is not being generated. However, 64 bit generates RAND_MAX with or without > > optimization. And I must say, in your program RAND_MAX is NOT generated with Glibc 2.26 on Linux. You seen "True" because of floating point rounding error. > See https://gcc.gnu.org/wiki/FAQ#PR323. -- Xi Ruoyao School of Aerospace Science and Technology, Xidian University