Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp13223292rwd; Fri, 23 Jun 2023 18:34:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7GFhw3L3+2/UYF4bOCOwSp2gVo6q6PVLhomPd9C4rxza8+x+dP/7yolgKuwTJL3GWnKNgc X-Received: by 2002:a17:902:b785:b0:1b1:9f7d:2aec with SMTP id e5-20020a170902b78500b001b19f7d2aecmr610390pls.68.1687570454468; Fri, 23 Jun 2023 18:34:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687570454; cv=none; d=google.com; s=arc-20160816; b=EGRSCnKhrL5Ms+2JfvA2GbjfAcjkyrc/4YrCeGRnVVZLKtH7sQC8bTCw2dhEZ3yAMJ Rh6311jsksMy85dG8t6qDwrJDP7dfFY+CFNyhmRfaH2VD+AMvIoBacqYtRylEqra88C0 cc5SDh9MifYTVzCPpnBJZFKaFv6LTPqgDDqa//tynQVhgAOS1pNQO1f+qyT3DLo+3p3r 6qV7hB3wdF2LCJXJB8CMJ7EDGHID80ZeKokeXBECGeQ4QUHzsj+k2cjeowXD9zjNVhDt 4SP0inU7Zv2y5NE1wQVpb8TsWXh+JM595iOu6z3NdB/Vl4GaOJD25rug/pEg404LzO8p rCpA== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=CZsvr5JwV+gVT9wANlk5FqC0I5kNocAXRzdPnCa/F3o=; fh=ovR5atLZ2gOWFCzsC6qbr24CvJOwLm9kNxp34xkszDs=; b=dJYq1tINbbP4lsSrRzb0qEXq1bDcVAb1AvpvMQvOLjjE3TonbfA5RjVIyB85QJUtCA 6JgGEtn+1+47jwshPEDFY7Iuu+d+yO4Iknq54gcoKlJfpzZUrVmtNEQDPrksicyEmlcm ay7CpT2sFBq9TVMT42mvGYKGoZMz0OR2G2IDObIzfJL8vGM8KSJquey1ZSWOxz7uiBJr 5J/DPB0iyd86EX7HyAMfclzYmXFYt+PqT1FcxTI1HJa6F0zkbJiDoj9jmLfK45PXPNAr Al6C02eBMXNod0KQLJlyPNGZB2ALgrwTJ/qQQ6IXWCP3s2s/ueUsVYJi9srJp25O9E1V sPFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=jEKBwT1w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o5-20020a170902e28500b001b3cf975c75si372999plc.222.2023.06.23.18.34.02; Fri, 23 Jun 2023 18:34:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=jEKBwT1w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230087AbjFXBXa (ORCPT + 99 others); Fri, 23 Jun 2023 21:23:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229487AbjFXBX2 (ORCPT ); Fri, 23 Jun 2023 21:23:28 -0400 Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E06ED272D for ; Fri, 23 Jun 2023 18:23:26 -0700 (PDT) Received: by mail-io1-xd2f.google.com with SMTP id ca18e2360f4ac-780bd47ef93so42240939f.2 for ; Fri, 23 Jun 2023 18:23:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687569806; x=1690161806; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=CZsvr5JwV+gVT9wANlk5FqC0I5kNocAXRzdPnCa/F3o=; b=jEKBwT1wRaTJs6VimsVN3vNnFfohxicSDRFnTcL7XxI92YzWiVYuVhaSZoHYAuXQ+n Xj6XtgbMsMPUGi7kBpbEEGaUbFOtdoPVwTTnbpdne67M0H86bt6eVSuaRUIkLL04fRoM PJXAUvMm25nc+IXBkQHaYGzBy5/1ULOsXZKa/kJKaVfeLoDM8SPjTM2qZx6yZ3A3/bXS ErtwXs31MtgJAN1naO052apryU87i10sQfjIXli90Y6Mkik9oLjbtMzTLP4z2PTuP8kC bTvMUZAFYGZFW8GZFmtnsMmdaJlmjkc7c4KchLDzLlYrfCxL4Ah96JAC8lacE6obZIwi ATIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687569806; x=1690161806; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CZsvr5JwV+gVT9wANlk5FqC0I5kNocAXRzdPnCa/F3o=; b=ZJjUID1z2GmKySr1q/E5Y2V//Rh8hTwcSNg9eVMKzQFgtjdRiLQT8LGnvm/HcULFeQ RpIk8YARaNFLJvozb9RsnXgHgoohaWNvrUvmwYhFJYYDW1pywHV8lkxLoqwcKDq7rIqG ujFxR3kad6HVBNQd1CSSQq0K66bu1NDTbCAGv3gDpCyBDXq0bPhsyuGg7tmWOvAuKYsG O1oGqKAK+uIBSJTD2NMbAzKGXmXClNkkU0kHqMQ70aEYbEQPzIh4YRAH8JvDNWsZobs3 YBZvX6dxchhI5AmZDZ78PoX80b0J2LshKz9u5Z0XTb85UY+8/WmgM3RTOTdKIO9GNGpw V/4g== X-Gm-Message-State: AC+VfDz+R2+0sR/VG5NVQU4OZJe2uD4lYSK8TSGfAhzU+84vDTD5QkR4 PyuXu+Hqljq5PXsWOtm6tIpZUTv//SEtbQ== X-Received: by 2002:a6b:6b0e:0:b0:76c:56fb:3c59 with SMTP id g14-20020a6b6b0e000000b0076c56fb3c59mr17390982ioc.10.1687569805933; Fri, 23 Jun 2023 18:23:25 -0700 (PDT) Received: from localhost (dhcp-72-235-13-41.hawaiiantel.net. [72.235.13.41]) by smtp.gmail.com with ESMTPSA id z22-20020a6be216000000b0076c5926b381sm201308ioc.31.2023.06.23.18.23.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 18:23:25 -0700 (PDT) Sender: Tejun Heo Date: Fri, 23 Jun 2023 15:23:22 -1000 From: Tejun Heo To: Linus Torvalds Cc: Dave Airlie , Arnd Bergmann , LKML Subject: Re: arm32 build warnings in workqueue.c Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,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 Hello, Linus. On Fri, Jun 23, 2023 at 03:15:51PM -0700, Linus Torvalds wrote: > On Fri, 23 Jun 2023 at 12:48, Tejun Heo wrote: > > The behavior change in gcc-13 is fine on its own but it's frustrating > > because there's no way to obtain previous behavior > > No, the previous gcc behavior was just buggy and wrong. > > I'm actually surprised at what gcc did. It means that each enum, has a > different type. That's just completely wrong, and means that there is > no such thing as a proper enum type. I agree that the previous behavior is out there. It's just that it's been like that forever and that's been the only way to make constants externally visible. > And the types are entirely random. They are *not* the types of the > initializers. Try this: > > enum { > A = (char) 1, > B = (unsigned long) 2, > C = (long long) 3, > D = (unsigned long) 0x123456789, > }; > > int tA(void) { return sizeof(A); } > int tB(void) { return sizeof(B); } > int tC(void) { return sizeof(C); } > int tD(void) { return sizeof(D); } > int T(void) { return sizeof(enum bad); } > int crazy(void) { return sizeof(typeof(A)); } > > and look at the insanity when you compile it with "gcc -S". Oh yeah, the sizes make no senes. > So no. There is NO WAY we want to ever "obtain previous behavior". > That is just garbage. Any code that depends on that behavior is just > actively wrong. Nothing is willingly depending on the crazy type behavior. However, enums are the only thing we've got if we want to make the constant values visible externally, so we have to make do with them somehow. It has always been iffy but also mostly bearable. Recent round of problems stem from the fact that gcc-13 changed the behavior and it sometimes gets nasty to satisfy both interpretations with the same code. Hypothetically, if we were to declare that we no longer supported old craziness, cleaning things up would be straight-forward. That day will come in the future but, in the meantime, we have to deal with enums whose sizes are going to be different depending on the complier version. It's pretty unpleasant but likely manageable in practice. The only way I can think of to keep the before and after behaviors the same is defining every enum in its own enum block. ie. Explicitly force each to be its own type. With a macro helper, code would probably look okay and we'd be explicitly telling the compiler to pick the type that can contain the value while maintaining signedness. That would give us consistent behaviors across the gcc-12/13 boundary. It sure doesn't feel great tho. Unless we declare that we don't care about external visibility and are done with enums, none of the available options aren't great, which isn't too surprising given the sad state enums have been in. Thanks. -- tejun