Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp5894426ybg; Tue, 22 Oct 2019 09:54:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqw8sbhTLMCsLfaJYI+dpqQVtSLxDPY5YV2YjQr1jI9Zw4mC+p5nont/OCXUyPWoaeyZUoif X-Received: by 2002:a17:906:351b:: with SMTP id r27mr7948192eja.83.1571763256574; Tue, 22 Oct 2019 09:54:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571763256; cv=none; d=google.com; s=arc-20160816; b=ByQItH33/9Utz6kHUkbDtB2j8/LpWwFRByFBLIrDiAQ/BFpGgmMuGj46l5PQZzvRnl YacnIx8LpU8P96A622naRvCx4H8ATMLLa6QSJNKmoApLxi81XTeFGpWRlqxfNAarsD6t B1yE3wFNuOr1o3DzAElHsNFMc0EerF18HqkadlgdaZaMknlC0Jeode4P9q5EPTIZN/s8 VNJslI5D2VdwhOL+DLxE82S7jiCRdEORGKuNzQzSd01ggplU2GdJrYHhzLa53Qx0rhqy BVIHu2AYygaO2iLcfRa3qXyxk1LI5PhUwAq+tvuiHxLx4p3/DCfH7RVc8qtfNFWj6WgB a1vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:to:from:cc:in-reply-to:subject:date; bh=VpPZchWxBalhXenlomTdpWCrOTqc954uAKLWrxBCzwg=; b=NHpbRufOruFclXmRndASAgKPGx0klByjC87jpUBs1S54W8NAmSZ6Z3vQxuN73EY5xL /Oh/slWFv6qmq5WM7kppBFNzf7NpCm6m4vaZY/0h+ir88gJxQiKMhRB5JuebDhCqawLF J1XWFXD7rixxFIeW2VeQ+ar4zl1yhjwXD0oGuS3T+icoLQe6TG54H8NwNsFJcgj+FIMw AUzQWPsruEcnN2U5USEATA6I7JH6Pd1HyxdrXpI7o00dnEyUHtmTJPeX1r9fL708Gldq NsIMyeFtJioOvHSfC1rTp7BDotJwLw3DNYhNUCXMkmjAbKtOAlx8jlOC0wS/IKWtSxnp 7A8A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v16si11064470ejx.96.2019.10.22.09.53.51; Tue, 22 Oct 2019 09:54:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732173AbfJVPKC (ORCPT + 99 others); Tue, 22 Oct 2019 11:10:02 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:34068 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731453AbfJVPKC (ORCPT ); Tue, 22 Oct 2019 11:10:02 -0400 Received: by mail-pg1-f195.google.com with SMTP id k20so10149117pgi.1 for ; Tue, 22 Oct 2019 08:10:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=VpPZchWxBalhXenlomTdpWCrOTqc954uAKLWrxBCzwg=; b=A8VfciBbjlAUruZntO/G+9d/IcpIACqLMvhg0OGNs/nWsPgs9ycS3nE4e6nZKD8mtn BusSN8mY6DW39BT4XmCcCUYoXKv0Qu/mIQnx1dOG/z9eMJe60W5iHde1K3/Bhh0erikN g1Cxu178vACb0XmYeBjVaWeyh67Le4CqYmN6gfxJSSMy3ii2ff03R9unRxOm9s6VdODE JJIFFcVcNvUnyYD4eKfX58MsLAI/f+A1d7l6IBRDLmKaAFrLkpwzIkJGtCDAaXdmX6Z9 kpIEnMNhL4oTaLQ3dX+bkzoXb2iRNNzbHQe2y2D6J1r1+FdzRBX2SCyvLSbd9LRSmQjS 2Dag== X-Gm-Message-State: APjAAAUjzAyOvmLCqUB74rFZH0wKp4lq9VhkyEUE51NBbtX30ZUWxLhz fJ9/0qRCQImr/KiAMrZf6/6Opw== X-Received: by 2002:a17:90a:a889:: with SMTP id h9mr5345232pjq.61.1571757000702; Tue, 22 Oct 2019 08:10:00 -0700 (PDT) Received: from localhost ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id m102sm16867880pje.5.2019.10.22.08.09.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2019 08:09:59 -0700 (PDT) Date: Tue, 22 Oct 2019 08:09:59 -0700 (PDT) X-Google-Original-Date: Tue, 22 Oct 2019 08:07:08 PDT (-0700) Subject: Re: [PATCH 4/8] riscv: ensure RISC-V C model definitions are passed to static analyzers In-Reply-To: CC: luc.vanoostenryck@gmail.com, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org From: Palmer Dabbelt To: Paul Walmsley Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 17 Oct 2019 21:39:29 PDT (-0700), Paul Walmsley wrote: > On Fri, 18 Oct 2019, Luc Van Oostenryck wrote: > >> On Thu, Oct 17, 2019 at 05:49:25PM -0700, Paul Walmsley wrote: >> > Static analysis tools such as sparse don't set the RISC-V C model >> > preprocessor directives such as "__riscv_cmodel_medany", set by the C >> > compilers. This causes the static analyzers to evaluate different >> > preprocessor paths than C compilers would. Fix this by defining the >> > appropriate C model macros in the static analyzer command lines. >> > >> > Signed-off-by: Paul Walmsley >> > --- >> > arch/riscv/Makefile | 2 ++ >> > 1 file changed, 2 insertions(+) >> > >> > diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile >> > index f5e914210245..0247a90bd4d8 100644 >> > --- a/arch/riscv/Makefile >> > +++ b/arch/riscv/Makefile >> > @@ -47,9 +47,11 @@ KBUILD_CFLAGS += -DCONFIG_PAGE_OFFSET=$(CONFIG_PAGE_OFFSET) >> > >> > ifeq ($(CONFIG_CMODEL_MEDLOW),y) >> > KBUILD_CFLAGS += -mcmodel=medlow >> > + CHECKFLAGS += -D__riscv_cmodel_medlow >> > endif >> > ifeq ($(CONFIG_CMODEL_MEDANY),y) >> > KBUILD_CFLAGS += -mcmodel=medany >> > + CHECKFLAGS += -D__riscv_cmodel_medany >> >> I can teach sparse about this in the following days. > > That would be great. Would you be willing to follow up with me via E-mail > or mailing list post when it's fixed? If so, then in the meantime, I'll > just drop this patch. It's probably worth going through all our argument-dependent builtin definitions at the same time. They're generated by riscv_cpu_cpp_builtins(): https://github.com/gcc-mirror/gcc/blob/master/gcc/config/riscv/riscv-c.c#L35 . > > > - Paul > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv