From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751261AbdAPLm7 (ORCPT ); Mon, 16 Jan 2017 06:42:59 -0500 Received: from hr2.samba.org ([144.76.82.148]:38951 "EHLO hr2.samba.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751170AbdAPLmx (ORCPT ); Mon, 16 Jan 2017 06:42:53 -0500 Date: Mon, 16 Jan 2017 22:42:29 +1100 From: Anton Blanchard To: Peter Zijlstra Cc: behanw@converseincode.com, ying.huang@intel.com, akpm@linux-foundation.org, oleg@redhat.com, Segher Boessenkool , mingo@elte.hu, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: llist code relies on undefined behaviour, upsets llvm/clang Message-ID: <20170116224229.17d1f6fc@kryten> In-Reply-To: <20170116090540.GE3159@twins.programming.kicks-ass.net> References: <20170116083600.47175073@kryten> <20170116090540.GE3159@twins.programming.kicks-ass.net> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Peter, > Last I checked I couldn't build a x86_64 kernel with llvm. So no, not > something I've ever ran into. > > Also, I would argue that this is broken in llvm, the kernel very much > relies on things like this all over the place. Sure, we're way outside > of what the C language spec says, but who bloody cares ;-) True, but is there anything preventing gcc from implementing this optimisation in the future? If we are relying on undefined behaviour we should have a -fno-strict-* option to cover it. > If llvm wants to compile the kernel, it needs to learn the C dialect > the kernel uses. LLVM has done that before (eg adding -fno-strict-overflow). I don't think that option covers this case however. Anton