From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 1AD833858C20 for ; Mon, 13 Nov 2023 14:38:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1AD833858C20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1AD833858C20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699886317; cv=none; b=XMuHFNGzajZ2RnNucBuzJyCyoZyYAHheOHjQ5BWYRBEJMEQTj/WHdSnlmSv0Y38xj1BadKeMDT7B5aq9LrwE2FCWlMEoQEtp1D+vQTOZiXfoTZDBehg3zInCz2oYdgG1cYEMWE6opUYkVNuSNm6YY4vPIv9fPtN39JpUxU9CgTw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699886317; c=relaxed/simple; bh=5ctRuvBPNdPEprW4+glcyCjBDkFHiXoLQrBZyDAZtzo=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=WRVokK23cNMVrz+oEXFwO7owOnW9+nLigvmqwHbS38GFRaye+td995zEmO9JhymA3HLIVDrenK5UNXQVbKOqkyl4HOYsMlwJ77rfOuvWEY0UxYHYGy0RlXcSFGr/GGFFiRY90Yozq3b6M73TRyxZWErEXPZgDKNrpr4K6hVVMMI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699886315; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=7WkpQHPo7ViP4nbyBJajQEOimGooVLtsP9QywrOluyQ=; b=Lvqd2ivarc1lH6teIimEKl2H9vFSnRpvfppUkFngATbiYLnOz7FU9s86f/TN3bvsitwysL 7CXmWM1Fspj+xDZXTpw0V0EhrQbbk7wlydzKS9ZD9i8jme4FUX9JaKScCuTx9htk2ZO4Q4 VO53YNos2t1XESqNinWJjzPbF0Wo3Dg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-15-5kBQaR1MM2CvVUs4KvMgog-1; Mon, 13 Nov 2023 09:38:34 -0500 X-MC-Unique: 5kBQaR1MM2CvVUs4KvMgog-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E48ED81DBF9; Mon, 13 Nov 2023 14:38:33 +0000 (UTC) Received: from calimero.vinschen.de (unknown [10.39.194.184]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C23C1502C; Mon, 13 Nov 2023 14:38:33 +0000 (UTC) Received: by calimero.vinschen.de (Postfix, from userid 500) id A00BAA80A3D; Mon, 13 Nov 2023 15:38:32 +0100 (CET) Date: Mon, 13 Nov 2023 15:38:32 +0100 From: Corinna Vinschen To: Bruno Haible Cc: newlib@sourceware.org, cygwin@cygwin.com Subject: Re: rand is not ISO C compliant in Cygwin Message-ID: Reply-To: newlib@sourceware.org Mail-Followup-To: Bruno Haible , newlib@sourceware.org, cygwin@cygwin.com References: <9938355.c9vzh5UkMf@nimes> <4746602.Hd9D3QOfv1@nimes> MIME-Version: 1.0 In-Reply-To: <4746602.Hd9D3QOfv1@nimes> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Nov 13 15:25, Bruno Haible wrote: > Corinna Vinschen wrote: > > The rand() function would still not use locking but AFAICS that's > > not actually required by POSIX or ISO C. > > Correct. Those who want an MT-safe rand-like function need to use random(), > not rand(). FTR, we have to differ here between plain newlib targets and Cygwin. While Cygwin comes with it's own, table-based random() implementation taken from BSD back in 2007, newlib's random is basically equivalent to rand() for the sake of bare-metal and other targets with high memory pressure. We shouldn't change the latter since multi-threading compliance is usually not much of a problem for that target audience. Corinna