Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp969610pxb; Wed, 6 Apr 2022 05:38:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRerAlY9G1ga4sX4INXm/h5Ek1pjP5rSqwb3xZLRpQePsOfCBebtBiT2qTUqYiZ3djn5Gv X-Received: by 2002:a17:902:e803:b0:154:2699:7f39 with SMTP id u3-20020a170902e80300b0015426997f39mr8211793plg.172.1649248694992; Wed, 06 Apr 2022 05:38:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649248694; cv=none; d=google.com; s=arc-20160816; b=oUelqD7wqqbiaOXjj52Q3Nt2ZP9z6I6ptrSvNWPc2IEM1dvrlD/X4ZBCRDr0K7/CyB dqwGLvMvlRkZZ3dvso2owHAClYO8LJMP6hBIf+9E2is1IujPU+H8EiX1SVa9SB5D+eTn hcPp9bxJAPpYwKooTiUzD3+1I/7gENwu9rHWvLfJpwVfMJJml3FNGKbH98lvkbx10Pd3 jUTj9byEAd8S6TlUIyJEzFxPRI/qAlCaXo+YGS3L9pzZ4TigyGeUYmYKDrUWm/jdhJFS YWBj0TOIdsYO38P5qlUxRedU12iycL8GadbctdprOqjq9sipjAmmAtWH8gsSPGal/JZY asdA== 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=c+8JIbtU2VTfD3OB4UfbP2nnduY9ZA25ajUu+eR70tM=; b=Y2wkgyOQYedf609XfjqaMRrN5lGlP8X+QAVxz0l7A3TELKCs/YGiYqZ1/3FBvPdemQ 2DQc/n55bQKKbuQ3gGX4OqeoOECOXnyRM2NwCEAtSYybusjxExIEp0IF3FXFJcQAB1T8 FCtbsB1VT54ySYeWxifzmSAtwJFv0pbuJ7u9egKDkgtErkjs7QSOTq/SWT9fzOZhNc1e H1MlV7jCfuBpefbZLQSmlqAXqrxmC8ZspZwHSOqZRDmwWxnVBuZiHPKzzdAbotYBevUJ Q2IB+S0mtF4F/2wZx5YYYAhus/Xggl1VDRjazDL3hvN+8f3VjJKTmqEyMkDeuI9+ME0N M0cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=YTWrWfAc; 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 a11-20020a631a4b000000b003817672e7fasi15242638pgm.717.2022.04.06.05.38.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 05:38:14 -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=YTWrWfAc; 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 6FABA4B6290; Wed, 6 Apr 2022 02:11:58 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1457638AbiDEWrf (ORCPT + 99 others); Tue, 5 Apr 2022 18:47:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1392396AbiDENuA (ORCPT ); Tue, 5 Apr 2022 09:50:00 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 647D4111DE0; Tue, 5 Apr 2022 05:53:19 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 20B38210EA; Tue, 5 Apr 2022 12:53:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649163198; 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=c+8JIbtU2VTfD3OB4UfbP2nnduY9ZA25ajUu+eR70tM=; b=YTWrWfAcdU5QcjE6lulkWjCsTBTep/SuRYlr+tHQARg72bM+fmj48GXRX8RqPqQ0AH2Ex5 YAVK2HABdDNMB+iIz4izzLpDczxEpm3We98tOjDMbZwhfiXXoEIvUcL6VkdRWk/5/QXhmT KHItmkSzhkX5DcAO1h6pPVfm3Cuy+rk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649163198; 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=c+8JIbtU2VTfD3OB4UfbP2nnduY9ZA25ajUu+eR70tM=; b=6Wc5+MK80zA6TtAq26/8yfzUsCj8Zxzq51GCFD0OgFwuVLDgZ9mtvKIQ14eXRgnnG8FQu1 vxC3AaEdNQe276Dw== 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 17D7FA3BB0; Tue, 5 Apr 2022 12:53:18 +0000 (UTC) Date: Tue, 5 Apr 2022 14:53:18 +0200 (CEST) From: Richard Biener To: Michael Matz cc: Peter Zijlstra , Borislav Petkov , linux-toolchains@vger.kernel.org, lkml Subject: Re: older gccs and case labels producing integer constants In-Reply-To: Message-ID: <79p0n5po-1377-4q33-3599-6129o38p96p@fhfr.qr> References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="-1609908220-1478233879-1649163198=: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-1478233879-1649163198=:27745 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT On Tue, 5 Apr 2022, Michael Matz wrote: > Hey, > > On Tue, 5 Apr 2022, Peter Zijlstra wrote: > > > > 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)): > > > ^~~~ > > > > IIRC GCC-8 fixed a bunch of -wrapv issues. Could be this is one of them > > I suppose. > > Or better said, later GCCs returned back to the old behaviour of rejecting > this only with -pedantic even in the presence of -fsanitize. Only that it doesn't: #define USB_ID(v,p) (((v)<<16)|(p)) void foo (unsigned int *i) { switch (*i) { case USB_ID(0xfc08, 0x0101):; } } > gcc-11 -S t.c -std=c99 -fsanitize=shift t.c: In function 'foo': t.c:6:7: error: case label does not reduce to an integer constant 6 | case USB_ID(0xfc08, 0x0101):; | ^~~~ for some reason it might fail to sanitize the case label for the full testcase but clearly it doesn't so on purpose. > But > pedantically speaking (ahem!) it really isn't conforming c99 (which the > compilation flags claim) , and in this case it seems easy enough to make > the construct actually be conforming in the kernel sources, so that should > perhaps be done? Indeed. Simply cast vendor/product to (unsigned) in the USB_ID macro to avoid arithmetic shifts. Richard. ---1609908220-1478233879-1649163198=:27745--