Skip to contentSkip to conversation

File bench/numa.c compiler error on s390

DISCUSSION Thomas Richter 2 participants 3 messages May 16, 2022 – May 17, 2022

lore
Share & tools
lore
#0 lore raw

Hi all,

I just upgraded to Fedora 36 and gcc version 12.0.1 20220308 (Red Hat 12.0.1-0) (GCC) and run into this compiler error:
CC bench/numa.o
bench/numa.c: In function ‘__bench_numa’:
bench/numa.c:1749:81: error: ‘%d’ directive output may be truncated writing between 1 and 11
bytes into a region of size between 10 and 20 [-Werror=format-truncation=]
1749 | snprintf(tname, sizeof(tname), "process%d:thread%d", p, t);
| ^~
bench/numa.c:1749:64: note: directive argument in the range [-2147483647, 2147483646]

 1749 |           snprintf(tname, sizeof(tname), "process%d:thread%d", p, t);
      |                                                   ^~~~~~~~~~~~~~~~~~~~
bench/numa.c:1749:33: note: ‘snprintf’ output between 17 and 37 bytes into a destination of size 35
 1749 |           snprintf(tname, sizeof(tname), "process%d:thread%d", p, t);
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

cc1: all warnings being treated as errors
make[3]: *** [/root/linux/tools/build/Makefile.build:97: bench/numa.o] Error 1

Does this also show up on other plattforms?

Looks like commit 3aff8ba0a4c9 ("perf bench numa: Avoid possible truncation when using snprintf()") has fixed this issue before and now it reappeared.

Signature · 5 lines
Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany
--
Vorsitzender des Aufsichtsrats: Gregor Pillen
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
#1 lore raw

Em Mon, May 16, 2022 at 09:24:52AM +0200, Thomas Richter escreveu:

Quoted 4 lines

Hi all,

I just upgraded to Fedora 36 and gcc version 12.0.1 20220308 (Red Hat 12.0.1-0) (GCC) and run into this compiler error:

Humm, I regularly build on fedora 36 and didn't catch this :-\

[perfbuilder@five ~]$ grep gcc dm.log/fedora\:36
perf-5.18.0-rc6/tools/include/asm-generic/atomic-gcc.h
perf-5.18.0-rc6/tools/include/linux/compiler-gcc.h
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/12/lto-wrapper
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --enable-libstdcxx-backtrace --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-12.0.1-20220413/obj-x86_64-redhat-linux/isl-install --enable-offload-targets=nvptx-none --without-cuda-driver --enable-offload-defaulted --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux --with-build-config=bootstrap-lto --enable-link-serialization=1 gcc version 12.0.1 20220413 (Red Hat 12.0.1-0) (GCC)
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/12
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/12
[perfbuilder@five ~]$

[perfbuilder@five ~]$ grep fedora:36 dm.log/summary
51 125.79 fedora:36 : Ok gcc (GCC) 12.0.1 20220413 (Red Hat 12.0.1-0) , clang version 14.0.0 (Fedora 14.0.0-1.fc36)
[perfbuilder@five ~]$

[perfbuilder@five ~]$ grep TARBALL_HEAD dm.log/fedora\:36 BUILD_TARBALL_HEAD=c46721e4604f260918e660550a16d1e28637d66c [perfbuilder@five ~]$

[acme@quaco perf-urgent]$ git log --oneline -5
c46721e4604f2609 (HEAD -> perf/urgent, tag: perf-tools-fixes-for-v5.18-2022-05-14, five/perf/urgent, acme.korg/tmp.perf/urgent, acme.korg/perf/urgent) MAINTAINERS: Add James and Mike as Arm64 performance events reviewers 474e76c4075c1046 tools headers UAPI: Sync linux/kvm.h with the kernel sources
45fa7c38696bae63 perf tests: Fix coresight perf test failure.
183d4f2d23acecb2 perf bench: Fix two numa NDEBUG warnings
c5eb0a61238dd6fa (tag: v5.18-rc6) Linux 5.18-rc6
[acme@quaco perf-urgent]$

[acme@quaco perf-urgent]$ git log --oneline -10 tools/perf/bench/numa.c
183d4f2d23acecb2 perf bench: Fix two numa NDEBUG warnings
f58faed7fb3f784e (tag: perf-tools-fixes-for-v5.18-2022-04-14) perf bench: Fix numa bench to fix usage of affinity for machines with #CPUs > 1K 8cb7a188ac33b71e perf bench: Fix numa testcase to check if CPU used to bind task is online
4d39c89f0b94bf4a perf tools: Fix various typos in comments
394e4306b093d037 perf bench numa: Fix the condition checks for max number of NUMA nodes
f92993851f01fa5d perf bench: Use condition variables in numa.
a508d061ef04b163 perf bench numa: Remove dead code in parse_nodes_opt()
2db13a9b30f7e438 perf bench numa: Use numa_node_to_cpus() to bind tasks to nodes
509f68e327d0c87e perf bench numa: Fix cpumask memory leak in node_has_cpus()
85372c6974aad0e4 perf bench numa: Fix benchmark names
[acme@quaco perf-urgent]$

Quoted 26 lines

CC bench/numa.o
bench/numa.c: In function ‘__bench_numa’:
bench/numa.c:1749:81: error: ‘%d’ directive output may be truncated writing between 1 and 11
bytes into a region of size between 10 and 20 [-Werror=format-truncation=]
1749 | snprintf(tname, sizeof(tname), "process%d:thread%d", p, t);
| ^~
bench/numa.c:1749:64: note: directive argument in the range [-2147483647, 2147483646]

 1749 |           snprintf(tname, sizeof(tname), "process%d:thread%d", p, t);
      |                                                   ^~~~~~~~~~~~~~~~~~~~
bench/numa.c:1749:33: note: ‘snprintf’ output between 17 and 37 bytes into a destination of size 35
 1749 |           snprintf(tname, sizeof(tname), "process%d:thread%d", p, t);
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

cc1: all warnings being treated as errors
make[3]: *** [/root/linux/tools/build/Makefile.build:97: bench/numa.o] Error 1

Does this also show up on other plattforms?

Looks like commit 3aff8ba0a4c9 ("perf bench numa: Avoid possible truncation when using snprintf()") has fixed this issue before and now it reappeared.

Signature · 5 lines
Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany
--
Vorsitzender des Aufsichtsrats: Gregor Pillen
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
Signature · 1 line
- Arnaldo
#2 lore raw
Quoted 8 lines · Arnaldo Carvalho de Melo

Em Mon, May 16, 2022 at 09:24:52AM +0200, Thomas Richter escreveu:

Quoted 4 lines

Hi all,

I just upgraded to Fedora 36 and gcc version 12.0.1 20220308 (Red Hat 12.0.1-0) (GCC) and run into this compiler error:

Humm, I regularly build on fedora 36 and didn't catch this :-\

Thanks for your feedback, Arnaldo.

I talk to our compiler guys about this.
Looks like this is a s390 thing.

Signature · 5 lines
Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany
--
Vorsitzender des Aufsichtsrats: Gregor Pillen
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294