Received: by 2002:a05:6a10:83d0:0:0:0:0 with SMTP id o16csp60152pxh; Thu, 7 Apr 2022 13:58:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmW/aN8MLT5C3fWm7HVSuSQFQjbIU0uHTDECFBdxsERVXH4pGzXdovowfjvddg8cZhaWC4 X-Received: by 2002:a17:903:246:b0:153:84fe:a9b0 with SMTP id j6-20020a170903024600b0015384fea9b0mr15851020plh.163.1649365136695; Thu, 07 Apr 2022 13:58:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649365136; cv=none; d=google.com; s=arc-20160816; b=xS4VVUV/xqTog5H56xv1a22rmO8meBbTsCvWJIHyhyh5z0TjtLKG+9ra8BjfQe6MX1 3Q/NqHS1tY5Vjm+4HAJgxpv4U0XHeXdNUYJQQ/qiHh5bR8mDmLd8XpUx+J6DDXwOIA5S 236YbgdgUy/4HKw76rC200CuQ34o+yFgetXnrwovVVv7zI8WGpWkq/QU0UAd/8ETNUpt MheslAME3s06fCkkj5J/ukCIw7vySO6IL9eAx1ktZz7wbsQIC13xEYtBev5YVT1fJ1f+ zsQF2a7TSS89DK16SXZEoqTEhtHkIGCi5aLI23Ea3IMgsyF95xnoP6HQzYiGnT0YFFXY NOJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=VwIpGAyzSx79SRpO72HEUFs9bV0pWCXTJl9t8xrA68E=; b=jMWAauucVQi29mfJbvlurusfiXEgQE3xEWxWYIJwBNDVzjh1s7ZIqMdC73R1h21g8n eQSXSs8R5GRo3YLAa1A+3BdtoY9ng9+OtOtrEzqWTXLApcluM1tHI/hIgvHt/sJ2vUuA KBMz/L/TH0NY2VbJsTi0YSTvp3GDVNzTSqD74b0YmP4jkv4b5de4Fvk1yuvlBdcmqi9i zXTHjlTovh7kFX51hbmu/BcQaxIsoZhNEHbiCmQ+8WVNGtPWBKSMTmiJy1jJ8fitBQxL Ws3yHk+jS83Sy1TQu/bqxCUU5TGWJYmhyeVXXe9UJyTwa0iTbFooft6+1RLEho+kXWoJ zpbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=po1XFKCC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id ba6-20020a170902720600b00153b2d164bcsi646779plb.196.2022.04.07.13.58.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 13:58:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=po1XFKCC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 411F141C88C; Thu, 7 Apr 2022 13:01:43 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344525AbiDGPSw (ORCPT + 99 others); Thu, 7 Apr 2022 11:18:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237839AbiDGPSt (ORCPT ); Thu, 7 Apr 2022 11:18:49 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A34F5677F; Thu, 7 Apr 2022 08:16:48 -0700 (PDT) Received: from zn.tnic (p2e55dff8.dip0.t-ipconnect.de [46.85.223.248]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 628981EC0295; Thu, 7 Apr 2022 17:16:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1649344602; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VwIpGAyzSx79SRpO72HEUFs9bV0pWCXTJl9t8xrA68E=; b=po1XFKCCvO06H8/5eOygISIGmVzRCgNayQw5EUOghRJQoG8Q6iFyYZ6N60hgo9znRL6zVN 5Jh+oRfW0zKR0ZjmnfcwePtTvYAcaJSQZ/CLXnrFOU4VZty7unTp33Lr6KaSopVKP2kgr+ Px83JV2Knk9AkAshz1nD3boVIefWfRU= Date: Thu, 7 Apr 2022 17:16:40 +0200 From: Borislav Petkov To: Richard Biener Cc: linux-toolchains@vger.kernel.org, Michael Matz , lkml Subject: Re: older gccs and case labels producing integer constants Message-ID: References: <7o5nn52-nqn1-oo13-s6o9-59r85r91o768@fhfr.qr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 05, 2022 at 01:41:09PM +0200, Richard Biener wrote: > As was noted in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66880 > this is invalid C99+ but compilers are not required to diagnose that > (you get it diagnosed with -pedantic). -fsanitize=shift exposes > it though since the non-integral-constant gets instrumented. Right, just to close this: I was still unsure which of the cmdline options would cause it and bisected the kernel (big fat box can build allmodconfigs in no time :)). The single change which fixes the whole build is --- diff --git a/Makefile b/Makefile index 8c7de9a72ea2..3582089cfeb6 100644 --- a/Makefile +++ b/Makefile @@ -523,7 +523,7 @@ KBUILD_CFLAGS := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \ -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE \ -Werror=implicit-function-declaration -Werror=implicit-int \ -Werror=return-type -Wno-format-security \ - -std=gnu11 + -std=gnu89 KBUILD_CPPFLAGS := -D__KERNEL__ KBUILD_AFLAGS_KERNEL := KBUILD_CFLAGS_KERNEL := with that gcc (SUSE Linux) 7.4.1 20190905 [gcc-7-branch revision 275407] but as we saw, only -std=gnu11 alone doesn't cause it: $ gcc -std=gnu11 -o switch.o switch.c $ And so we had the -fsanitize=shift already enabled since 2020 in the kernel build and the gnu11 change then triggered the undefined behavior due to the -fsanitize instrumentation as it was already explained: $ gcc -std=gnu11 -fsanitize=shift -o switch.o switch.c switch.c: In function ‘foo’: switch.c:10:7: error: case label does not reduce to an integer constant case (((0xfc08) << 16) | (0x0101)):; ^~~~ Ok, now I can sleep at night again. :-))) -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette