Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp827176pxb; Wed, 6 Apr 2022 00:59:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqmI9ySAYIGinQc5pdaXIDPY1vIh4DGANF6HWGoHH9A7jveCxjztAXdh4cB8m9VCyxiNs2 X-Received: by 2002:a63:dd47:0:b0:381:2bb3:86ba with SMTP id g7-20020a63dd47000000b003812bb386bamr6135541pgj.381.1649231949951; Wed, 06 Apr 2022 00:59:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649231949; cv=none; d=google.com; s=arc-20160816; b=nYDdnzEXgX4k3lzv2PcIidoLntS5EUKoKJtg5I3YWO9txoUfe+wsX+adbrjTj5CPln h9JIYo/L3UFNsTXjc8z/X9c6FXH5rhI4qRgDQhYarmTOCzodHg26htyGfpUey3l2RQ4U qLoELjanrsIBTl0Afc5Ehf5YmYRhBBsUi3iFDlx8xiTkqbsgbUmvjrticRJTGok5vCvb O5/Q16gENl5FoMiSiAn6YiPCO6/JuQvqrapSvJQDFXAFyIg4Y1i4KBoVC4Ik+4kVrQ01 WMqgMgaKivJJkFU+sx8qluTq1j7IWu7sPxpGwyPjrdOlHgQLCyp9iMWcupnAxP9xf4Fg 4EIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature:dkim-signature; bh=vpObifm5DSctizJM8OeL9kpLlfhSCbsrcseeF2Q5+yo=; b=knz6n44tp7hGmJrLjDyP8dvxnXu37ewz2qKiKDMxEvzXw2UAcsqBrxZd69rLpBgtwC yenAwx9rpTNlK3z+sn+30H9xxXCAORUMnRprh/J29n2ALl43obu1jhejJj7vuv9d2SV+ uuMmLhJ0Knu5Nvhs9wpkHd5fwd31CxhSC1MFlic9hnHxEUVeROjB+ML8cr6WE3+aHPsO Hj1DnKAe5ygPNerdircjub/aSX04KBb9ffliNAIpbkAopvNnpLvkh6K2QFTyuNZuHoUU HSA12jZbkLqKdJ7bWCLHCx/HcbwRFCRqn/1eluBH5Oj98eNNcuCgwCLnPA3rkbl5Y+Bg nu+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=kxKF7Gr3; dkim=neutral (no key) header.i=@suse.de; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id i13-20020a170902eb4d00b001561b99e90asi15593983pli.235.2022.04.06.00.59.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 00:59:09 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=kxKF7Gr3; dkim=neutral (no key) header.i=@suse.de; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CD2F35332B7; Wed, 6 Apr 2022 00:34:59 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389383AbiDEV7f (ORCPT + 99 others); Tue, 5 Apr 2022 17:59:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356147AbiDEKW7 (ORCPT ); Tue, 5 Apr 2022 06:22:59 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2858B9183; Tue, 5 Apr 2022 03:06:46 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 9BD8E1F745; Tue, 5 Apr 2022 10:06:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649153205; h=from:from:reply-to: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=vpObifm5DSctizJM8OeL9kpLlfhSCbsrcseeF2Q5+yo=; b=kxKF7Gr3VkFfMDVJB2BQGNr0DUHm5fXW4A1EERNzAiyy+teXuTBVeHqLES70Y5Nbpba7fv Zv4hOY34D8sue7bBeBvFC6E3L7AG/u0w6WBIFFRucwLrNkmLCf5xamQqEMtOFvgm3jVOar Obxey7rfGRMs4QQODn7t/6GQ0Ad7Pso= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649153205; h=from:from:reply-to: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=vpObifm5DSctizJM8OeL9kpLlfhSCbsrcseeF2Q5+yo=; b=3Yvr8I4To6r6XUAepRGNceJ8d+HrlMBC3+wjMoiWayPb53Y1pfYVu1kxilyFSSI69FxHnN zsS2mVlHkCwtiPAQ== Received: from murzim.suse.de (murzim.suse.de [10.160.4.192]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 93470A3B88; Tue, 5 Apr 2022 10:06:45 +0000 (UTC) Date: Tue, 5 Apr 2022 12:06:45 +0200 (CEST) From: Richard Biener To: Borislav Petkov cc: linux-toolchains@vger.kernel.org, Michael Matz , lkml Subject: Re: older gccs and case labels producing integer constants In-Reply-To: <7o5nn52-nqn1-oo13-s6o9-59r85r91o768@fhfr.qr> Message-ID: References: <7o5nn52-nqn1-oo13-s6o9-59r85r91o768@fhfr.qr> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="-1609908220-486574334-1649153205=:27745" 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 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 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---1609908220-486574334-1649153205=:27745 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT On Tue, 5 Apr 2022, Richard Biener wrote: > On Tue, 5 Apr 2022, Borislav Petkov wrote: > > > Hi folks, > > > > I'm starting to see failures like this on allmodconfig builds: > > > > sound/usb/midi.c: In function ‘snd_usbmidi_out_endpoint_create’: > > sound/usb/midi.c:1389:2: error: case label does not reduce to an integer constant > > case (((0xfc08) << 16) | (0x0101)): > > ^~~~ > > > > (The case statement is a macro but it evaluates to what I have there) > > > > and that thing fails with > > > > $ gcc --version > > gcc (SUSE Linux) 7.5.0 > > > > although it doesn't have any problems building with newer compilers. > > > > I'm presuming older gccs consider those case statements signed ints and > > the following fixes it: > > > > case ((((unsigned int)0xfc08) << 16) | (0x0101)): > > > > and I guess we can whack the couple of occurrences but what I'm > > wondering is why does this work with newer gccs? > > I tried > > void foo (int i) > { > switch (i) > { > case (((0xfc08) << 16) | (0x0101)):; > } > } > > also with 'unsigned int i' but that's accepted with GCC 7. So > what do you switch on? Aha, also > gcc-7 -S t.c -std=c11 -pedantic -pedantic-errors t.c: In function 'foo': t.c:6:7: error: case label is not an integer constant expression [-Wpedantic] case USB_ID(0xfc08, 0x0101):; ^~~~ aber _nur_ mit -std=c11 (oder c99, aber nicht c89) und -pedantic -pedantic-errors. #define USB_ID(v,p) (((v)<<16)|(p)) void foo (unsigned int *i) { switch (*i) { case USB_ID(0xfc08, 0x0101):; } } Wird auch mit gcc 11 rejected. Kanns sein dass mit gcc 7 andere compiler flags genommen werden? -- Richard Biener SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany; GF: Ivo Totev; HRB 36809 (AG Nuernberg) ---1609908220-486574334-1649153205=:27745--