Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp776958imn; Tue, 26 Jul 2022 09:00:38 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uCB+/71cEM6KtC7TCPgPCzSuTqth1VfrJnngvCmejjaJSKUh3EXFNfTUj6cTROOZI7JOH8 X-Received: by 2002:a17:907:7394:b0:72b:44ff:5cec with SMTP id er20-20020a170907739400b0072b44ff5cecmr14900054ejc.670.1658851238671; Tue, 26 Jul 2022 09:00:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658851238; cv=none; d=google.com; s=arc-20160816; b=xDyU/W+EvmfCXHP6Tt1E1FWxWzSktDqxcd/OGJXjgM0mRpZXGQOzbXs8mO3XZKt0ys D9uPPcfx/KKxeIw5jk/kRnx0rScl+YYYIw0EqV3UtDQk5kHhxgIhuuXx/M7o69zeGYYp tDnDSgHkQ2RtZWnYrVftpkbxzTa+K+1R+TktABM51uwiIahx3U1EgsAm3SGCSrPBxjWe aSzegWcVGZ64LdaE3XCD90FwnzJtIKy0Q5oUgm0KPfBqgOAysvMgbsMA7koMSC9GEBcp c4w4VEeYQWIO/8biEpxSV04+DMSF0L8PZRRp1SOh7/p1n2iwOEYcjZAY18SVGHDm27Zx lRaA== 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:dkim-signature; bh=sx9UD68P/GpAexoNyCoLEacxPkVJ8yihgkOXq8TsG6A=; b=E1EzhZWqA08InYjuQWwT1BFeajPq9/a45t9k8pV0IIcuG2nANjP0d89fphob6BIRoo b/tIiizc8DjRrgE+EL1s9ye2uK5c8tIKSS4l1lE+XZND2wjpguLftj1cEZ+9PG4GbQn4 Savu8dN8y5Psh4LLNl1yo9pp8xrxwgIWkIZRV/EGs1+x5pdNMoei3xMMxC74HuumDX4u 6zP/+YirEulNs4m8HcFr3Wkyy72+8odsukAAl7tGZwmr6LV6cgj+h0GMzB0sSU0+uwxM iJPOd8+IvuNcHMYctLHag70naBaPD8TAdh+bKA9Gals0n8RQOn4k+k3LslxtUlenbhIC HUww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=E4VX6Ra0; 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 ds6-20020a170907724600b00726e777489csi16011278ejc.757.2022.07.26.09.00.13; Tue, 26 Jul 2022 09:00:38 -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=@kernel.org header.s=k20201202 header.b=E4VX6Ra0; 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 S234205AbiGZPRY (ORCPT + 99 others); Tue, 26 Jul 2022 11:17:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232071AbiGZPRX (ORCPT ); Tue, 26 Jul 2022 11:17:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D842C24F0C for ; Tue, 26 Jul 2022 08:17:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6A56AB80113 for ; Tue, 26 Jul 2022 15:17:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 747C0C433C1; Tue, 26 Jul 2022 15:17:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658848637; bh=5SRJ7lsxlITGrYKHbZ9YUt6+dWju5QmVs/XVvuktXxk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=E4VX6Ra0PR1scrB2m6YK8pRJJgnkNUBgbwi6MnzpVO0vc8QnrGnsbx57ZsFolXbsN ODfmSIkAzY9oZNT93iF33wBR4ynVNapMa/evuh+9eAIPdxyPSs/CvK6a6Etn2PlKeI wqoDeGVJGlDLG6y3tvRVeeSSCLqiuNLvXDDGhC56E8t5xI6yWQKxTL2Zv9uMx9f02i /MHaujuXgSyCsGdi/DKQp0CusbsEFB4VszgtdvCPjXNQudBKuU9N4i3oQb+PXIhJl1 hWYyBfu8v+0UE+C/19lW+p5wx4PS6uMChVyZmuwxOiXNSDRX2rIplqpZoNEWp4hOms sTowwG4I2Z9qQ== Date: Tue, 26 Jul 2022 08:17:15 -0700 From: Nathan Chancellor To: Andy Shevchenko Cc: kernel test robot , Nick Desaulniers , Oleksij Rempel , llvm@lists.linux.dev, kbuild-all@lists.01.org, Linux Kernel Mailing List , Jonathan Cameron Subject: Re: drivers/iio/adc/ti-tsc2046.c:242:62: warning: taking address of packed member 'data' of class or structure 'tsc2046_adc_atom' may result in an unaligned pointer value Message-ID: References: <202207251140.M7YAqoLC-lkp@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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, Jul 26, 2022 at 10:07:09AM +0200, Andy Shevchenko wrote: > Seems yet another false positive from Clang. This warning should not show up because it is disabled in the main Makefile. Unfortunately, a recent change in clang made '-mtune' warn when it is not supported in the backend, which is the case for ARM: https://github.com/ClangBuiltLinux/linux/issues/1674 As a result, all subsequent cc-option calls fail, which was the root cause of this warning last time, just with MIPS: https://lore.kernel.org/YenXz+RznXBuJMSR@dev-arch.archlinux-ax161/ Intel folks, could you update your version of clang or add this particular warning to your blocklist? It should be resolved with https://github.com/llvm/llvm-project/commit/1d23f6c5a4f6ebb101c282f8f506588fe4d9e92f. Cheers, Nathan > On Mon, Jul 25, 2022 at 5:55 AM kernel test robot wrote: > > > > Hi Oleksij, > > > > FYI, the error/warning still remains. > > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master > > head: e0dccc3b76fb35bb257b4118367a883073d7390e > > commit: 9374e8f5a38defe90bc65b2decf317c1c62d91dd iio: adc: add ADC driver for the TI TSC2046 controller > > date: 1 year, 2 months ago > > config: arm-randconfig-r025-20220724 (https://download.01.org/0day-ci/archive/20220725/202207251140.M7YAqoLC-lkp@intel.com/config) > > compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 9e88cbcc403bdf82f29259ad60ff60a8fc4434a1) > > reproduce (this is a W=1 build): > > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > > chmod +x ~/bin/make.cross > > # install arm cross compiling tool for clang build > > # apt-get install binutils-arm-linux-gnueabi > > # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9374e8f5a38defe90bc65b2decf317c1c62d91dd > > git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git > > git fetch --no-tags linus master > > git checkout 9374e8f5a38defe90bc65b2decf317c1c62d91dd > > # save the config file > > mkdir build_dir && cp config build_dir/.config > > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/iio/adc/ drivers/staging/ fs/ > > > > If you fix the issue, kindly add following tag where applicable > > Reported-by: kernel test robot > > > > All warnings (new ones prefixed by >>): > > > > >> drivers/iio/adc/ti-tsc2046.c:242:62: warning: taking address of packed member 'data' of class or structure 'tsc2046_adc_atom' may result in an unaligned pointer value [-Waddress-of-packed-member] > > What the heck? The get_unaligned_*() is exactly to get unaligned data. > > > return FIELD_GET(TI_TSC2046_DATA_12BIT, get_unaligned_be16(&buf->data)); > > ^~~~~~~~~ > > include/linux/bitfield.h:108:27: note: expanded from macro 'FIELD_GET' > > __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \ > > ^~~~ > > include/linux/bitfield.h:52:38: note: expanded from macro '__BF_FIELD_CHECK' > > BUILD_BUG_ON_MSG((_mask) > (typeof(_reg))~0ull, \ > > ^~~~ > > include/linux/build_bug.h:39:58: note: expanded from macro 'BUILD_BUG_ON_MSG' > > #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) > > ^~~~ > > note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) > > include/linux/compiler_types.h:308:9: note: expanded from macro '__compiletime_assert' > > if (!(condition)) \ > > ^~~~~~~~~ > > include/linux/compiler.h:56:47: note: expanded from macro 'if' > > #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) > > ^~~~ > > include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var' > > #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) > > ^~~~ > > >> drivers/iio/adc/ti-tsc2046.c:242:62: warning: taking address of packed member 'data' of class or structure 'tsc2046_adc_atom' may result in an unaligned pointer value [-Waddress-of-packed-member] > > return FIELD_GET(TI_TSC2046_DATA_12BIT, get_unaligned_be16(&buf->data)); > > ^~~~~~~~~ > > include/linux/bitfield.h:108:27: note: expanded from macro 'FIELD_GET' > > __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \ > > ^~~~ > > include/linux/bitfield.h:52:38: note: expanded from macro '__BF_FIELD_CHECK' > > BUILD_BUG_ON_MSG((_mask) > (typeof(_reg))~0ull, \ > > ^~~~ > > include/linux/build_bug.h:39:58: note: expanded from macro 'BUILD_BUG_ON_MSG' > > #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) > > ^~~~ > > note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) > > include/linux/compiler_types.h:308:9: note: expanded from macro '__compiletime_assert' > > if (!(condition)) \ > > ^~~~~~~~~ > > include/linux/compiler.h:56:47: note: expanded from macro 'if' > > #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) > > ^~~~ > > include/linux/compiler.h:58:61: note: expanded from macro '__trace_if_var' > > #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) > > ^~~~ > > >> drivers/iio/adc/ti-tsc2046.c:242:62: warning: taking address of packed member 'data' of class or structure 'tsc2046_adc_atom' may result in an unaligned pointer value [-Waddress-of-packed-member] > > return FIELD_GET(TI_TSC2046_DATA_12BIT, get_unaligned_be16(&buf->data)); > > ^~~~~~~~~ > > include/linux/bitfield.h:108:27: note: expanded from macro 'FIELD_GET' > > __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \ > > ^~~~ > > include/linux/bitfield.h:52:38: note: expanded from macro '__BF_FIELD_CHECK' > > BUILD_BUG_ON_MSG((_mask) > (typeof(_reg))~0ull, \ > > ^~~~ > > include/linux/build_bug.h:39:58: note: expanded from macro 'BUILD_BUG_ON_MSG' > > #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) > > ^~~~ > > note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) > > include/linux/compiler.h:56:47: note: expanded from macro 'if' > > #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) > > ^~~~ > > include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var' > > #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) > > ^~~~ > > include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value' > > (cond) ? \ > > ^~~~ > > 3 warnings generated. > > > > > > vim +242 drivers/iio/adc/ti-tsc2046.c > > > > 239 > > 240 static u16 tsc2046_adc_get_value(struct tsc2046_adc_atom *buf) > > 241 { > > > 242 return FIELD_GET(TI_TSC2046_DATA_12BIT, get_unaligned_be16(&buf->data)); > > 243 } > > > -- > With Best Regards, > Andy Shevchenko