From: kernel test robot <lkp@intel.com>
To: Liao Yuanhong <liaoyuanhong@vivo.com>,
Kees Cook <kees@kernel.org>,
"open list:GCC PLUGINS" <linux-hardening@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>
Cc: oe-kbuild-all@lists.linux.dev, liaoyuanhong@vivo.com
Subject: Re: [PATCH] gcc-plugins: Use swap() to simplify code
Date: Thu, 7 Aug 2025 12:45:25 +0800 [thread overview]
Message-ID: <202508071233.Bf6EgGd2-lkp@intel.com> (raw)
In-Reply-To: <20250806124341.382446-1-liaoyuanhong@vivo.com>
Hi Liao,
kernel test robot noticed the following build errors:
[auto build test ERROR on kees/for-next/hardening]
[also build test ERROR on kees/for-next/kspp kees/for-next/pstore linus/master v6.16 next-20250806]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Liao-Yuanhong/gcc-plugins-Use-swap-to-simplify-code/20250806-204609
base: https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
patch link: https://lore.kernel.org/r/20250806124341.382446-1-liaoyuanhong%40vivo.com
patch subject: [PATCH] gcc-plugins: Use swap() to simplify code
config: i386-randconfig-012-20250807 (https://download.01.org/0day-ci/archive/20250807/202508071233.Bf6EgGd2-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250807/202508071233.Bf6EgGd2-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202508071233.Bf6EgGd2-lkp@intel.com/
All errors (new ones prefixed by >>):
scripts/gcc-plugins/randomize_layout_plugin.c: In function 'void performance_shuffle(tree_node**, long unsigned int, ranctx*)':
>> scripts/gcc-plugins/randomize_layout_plugin.c:203:17: error: 'swap' was not declared in this scope
203 | swap(size_group[randnum], size_group[i]);
| ^~~~
scripts/gcc-plugins/randomize_layout_plugin.c:203:17: note: suggested alternatives:
In file included from /usr/include/c++/12/utility:69,
from /usr/lib/gcc/x86_64-linux-gnu/12/plugin/include/system.h:244,
from /usr/lib/gcc/x86_64-linux-gnu/12/plugin/include/gcc-plugin.h:28,
from scripts/gcc-plugins/gcc-common.h:6,
from scripts/gcc-plugins/randomize_layout_plugin.c:19:
/usr/include/c++/12/bits/stl_pair.h:715:5: note: 'std::swap'
715 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete;
| ^~~~
In file included from /usr/include/c++/12/bits/stl_pair.h:61:
/usr/include/c++/12/bits/move.h:196:5: note: 'std::swap'
196 | swap(_Tp& __a, _Tp& __b)
| ^~~~
/usr/include/c++/12/bits/move.h:196:5: note: 'std::swap'
scripts/gcc-plugins/randomize_layout_plugin.c:216:25: error: 'swap' was not declared in this scope
216 | swap(newtree[randnum], newtree[i]);
| ^~~~
scripts/gcc-plugins/randomize_layout_plugin.c:216:25: note: suggested alternatives:
/usr/include/c++/12/bits/stl_pair.h:715:5: note: 'std::swap'
715 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete;
| ^~~~
/usr/include/c++/12/bits/move.h:196:5: note: 'std::swap'
196 | swap(_Tp& __a, _Tp& __b)
| ^~~~
/usr/include/c++/12/bits/move.h:196:5: note: 'std::swap'
scripts/gcc-plugins/randomize_layout_plugin.c: In function 'void full_shuffle(tree_node**, long unsigned int, ranctx*)':
scripts/gcc-plugins/randomize_layout_plugin.c:227:17: error: 'swap' was not declared in this scope
227 | swap(newtree[randnum], newtree[i]);
| ^~~~
scripts/gcc-plugins/randomize_layout_plugin.c:227:17: note: suggested alternatives:
/usr/include/c++/12/bits/stl_pair.h:715:5: note: 'std::swap'
715 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete;
| ^~~~
/usr/include/c++/12/bits/move.h:196:5: note: 'std::swap'
196 | swap(_Tp& __a, _Tp& __b)
| ^~~~
/usr/include/c++/12/bits/move.h:196:5: note: 'std::swap'
make[4]: *** [scripts/gcc-plugins/Makefile:54: scripts/gcc-plugins/randomize_layout_plugin.so] Error 1 shuffle=2972943921
make[4]: Target 'scripts/gcc-plugins/' not remade because of errors.
make[3]: *** [scripts/Makefile.build:554: scripts/gcc-plugins] Error 2 shuffle=2972943921
make[3]: Target 'scripts/' not remade because of errors.
make[2]: *** [Makefile:1258: scripts] Error 2 shuffle=2972943921
make[2]: Target 'prepare' not remade because of errors.
make[1]: *** [Makefile:248: __sub-make] Error 2 shuffle=2972943921
make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:248: __sub-make] Error 2 shuffle=2972943921
make: Target 'prepare' not remade because of errors.
vim +/swap +203 scripts/gcc-plugins/randomize_layout_plugin.c
190
191 static void performance_shuffle(tree *newtree, unsigned long length, ranctx *prng_state)
192 {
193 unsigned long i, x, index;
194 struct partition_group size_group[length];
195 unsigned long num_groups = 0;
196 unsigned long randnum;
197
198 partition_struct(newtree, length, (struct partition_group *)&size_group, &num_groups);
199
200 /* FIXME: this group shuffle is currently a no-op. */
201 for (i = num_groups - 1; i > 0; i--) {
202 randnum = ranval(prng_state) % (i + 1);
> 203 swap(size_group[randnum], size_group[i]);
204 }
205
206 for (x = 0; x < num_groups; x++) {
207 for (index = size_group[x].length - 1; index > 0; index--) {
208 i = size_group[x].start + index;
209 if (DECL_BIT_FIELD_TYPE(newtree[i]))
210 continue;
211 randnum = ranval(prng_state) % (index + 1);
212 randnum += size_group[x].start;
213 // we could handle this case differently if desired
214 if (DECL_BIT_FIELD_TYPE(newtree[randnum]))
215 continue;
216 swap(newtree[randnum], newtree[i]);
217 }
218 }
219 }
220
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
prev parent reply other threads:[~2025-08-07 4:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-06 12:43 Liao Yuanhong
2025-08-07 4:45 ` kernel test robot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202508071233.Bf6EgGd2-lkp@intel.com \
--to=lkp@intel.com \
--cc=kees@kernel.org \
--cc=liaoyuanhong@vivo.com \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®