From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by sourceware.org (Postfix) with ESMTP id 147323858D35 for ; Mon, 27 Apr 2020 17:39:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 147323858D35 Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-181-vw6KcN7DPLiDg97jET8kaQ-1; Mon, 27 Apr 2020 13:39:52 -0400 X-MC-Unique: vw6KcN7DPLiDg97jET8kaQ-1 Received: by mail-pj1-f72.google.com with SMTP id b8so17259920pjp.9 for ; Mon, 27 Apr 2020 10:39:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pFkS/rf4EiPhO2lBh0Mt83Z2+lsRLxAolaxwNVbpWx4=; b=SWxl+sUQQL1B9q5bVN8+CODxedq/wPrlPycZ7bi2kAQtwrcfZEOkee8uU7KWtbF58G 9kMEav3YmMwcbbSe4Ggp6FkeVTuZayfpaDjY+JMaWi8+TeWzh8kYuPbOkBYLMOn3KaAL ZautSX5cXBC2SbIYcqSWZxZCZ9vGtmCuJK1tpVA38Y9UHzNaSTwC4lgiFgnaGPmGeTzK kGSqWsV1XIr5m1BnjCVAM85GhpqoaAdE42aRkgRneH79A24mE9T8TkvmncmYb3ZbVq44 P5YuERruXewojtRwqr1rmyvwyrj7tx35GpdIfmHVeUdK3JwzWdZgxiKEYEQmdbt4dr0k lg+Q== X-Gm-Message-State: AGi0PuZPC7SXlV31+fpP6Z8Do+U+cKowmrBpdvVaPrRkfo7umeooPFWB wXOHZImlx3Wl1/kTpMq6L5boW9orph3fw3Ps7vJW3MkJTi69CvyY6oMM1wPwzi2/msX6aPLvbwm bHTCemUcUq1Xjhtkkf2zN7GOoZsVxFiM= X-Received: by 2002:a62:81c1:: with SMTP id t184mr7540513pfd.236.1588009191584; Mon, 27 Apr 2020 10:39:51 -0700 (PDT) X-Google-Smtp-Source: APiQypJ9q3PTNKKKghkjVig/riPtSGbZrBMFbv++zyr1CoYTPs3W3aSUFttoaiYuxOY7HeK576FUBXJow9znp07dQsA= X-Received: by 2002:a62:81c1:: with SMTP id t184mr7540498pfd.236.1588009191348; Mon, 27 Apr 2020 10:39:51 -0700 (PDT) MIME-Version: 1.0 References: <989180140.2023825.1588003097077.ref@mail.yahoo.com> <989180140.2023825.1588003097077@mail.yahoo.com> In-Reply-To: <989180140.2023825.1588003097077@mail.yahoo.com> From: Jeff Johnston Date: Mon, 27 Apr 2020 13:39:40 -0400 Message-ID: Subject: Re: _REENT_CHECK_VERIFY calls __assert_func even if NDEBUG is defined To: "R. Diez" Cc: "newlib@sourceware.org" X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 17:40:00 -0000 The code does not disable via NDEBUG because it is a fix for a CVE. It is not (and should not be) tied to user control over usage of the assert macro= . If you do not want the verification check, you can use --disable-newlib-reent-check-verify when you configure. -- Jeff J. On Mon, Apr 27, 2020 at 11:58 AM R. Diez via Newlib wrote: > Hallo all: > > I have used Newlib 3.1.0 (and older versions) for quite some time. I am > trying to upgrade to the latest release/snapshot 3.3.0, but I hit a > compilation error in release builds (with NDEBUG defined): > > newlib-3.3.0/newlib/libc/stdlib/rand.c:78: undefined reference to > `__assert_func' > > I tracked it down to this definition: > > /* Specify how to handle reent_check malloc failures. */ > #ifdef _REENT_CHECK_VERIFY > #include > #define __reent_assert(x) ((x) ? (void)0 : __assert_func(__FILE__, > __LINE__, (char *)0, "REENT malloc succeeded")) > #else > #define __reent_assert(x) ((void)0) > #endif > > This is unfortunate. First of all, I wonder what happens if malloc fails > and there is no assert. Will there be a crash? > > Then, I would like to assert() in debug builds, and not in release builds= . > My code does not define __assert_func in release builds, because assertio= ns > are only supposed to work if NDEBUG is not defined. That has been working > fine for years, until this Newlib version. > > I am configuring Newlib with --disable-newlib-multithread , because my > embedded firmware has no threads. But I guess I still have to deal with > "struct _reent", don't I? I would have hoped that, in this single-thread > situation, any reentrancy structure could be allocated statically. Or is > there any way to avoid this malloc()? > > Thanks in advance, > rdiez > >