[Bug c/94350] New: internal compiler error: in make_region_for_unexpected_tree_code, at analyzer/region-model.cc:4874

2020-03-26 Thread stephen at networkplumber dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94350

Bug ID: 94350
   Summary: internal compiler error: in
make_region_for_unexpected_tree_code, at
analyzer/region-model.cc:4874
   Product: gcc
   Version: 10.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: stephen at networkplumber dot org
  Target Milestone: ---

Compiling the DPDK project git://dpdk.org/dpdk
fails with internal compiler error with -fanalyzer

= Build lib/librte_eal/linux/eal
  CC eal.o
  CC eal_cpuflags.o
  CC eal_hugepage_info.o
  CC eal_memory.o
  CC eal_thread.o
  CC eal_log.o
  CC eal_vfio.o
  CC eal_vfio_mp_sync.o
  CC eal_memalloc.o
during IPA pass: analyzer
cc1: internal compiler error: in make_region_for_unexpected_tree_code, at
analyzer/region-model.cc:4874

[Bug analyzer/94350] internal compiler error: in make_region_for_unexpected_tree_code, at analyzer/region-model.cc:4874

2020-03-26 Thread stephen at networkplumber dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94350

--- Comment #4 from Stephen Hemminger  ---
X86

On Thu, Mar 26, 2020, 5:38 PM pinskia at gcc dot gnu.org <
gcc-bugzi...@gcc.gnu.org> wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94350
>
> --- Comment #2 from Andrew Pinski  ---
> Also which target is this on?  x86_64 or aarch64?
>
> --
> You are receiving this mail because:
> You reported the bug.

[Bug analyzer/94350] internal compiler error: in make_region_for_unexpected_tree_code, at analyzer/region-model.cc:4874

2020-03-27 Thread stephen at networkplumber dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94350

--- Comment #5 from Stephen Hemminger  ---
Created attachment 48132
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48132&action=edit
Preprocessed version of source code

[Bug analyzer/94350] internal compiler error: in make_region_for_unexpected_tree_code, at analyzer/region-model.cc:4874

2020-03-27 Thread stephen at networkplumber dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94350

--- Comment #6 from Stephen Hemminger  ---
$ gcc --version
gcc (GCC) 10.0.1 20200311 (Red Hat 10.0.1-0.9)

[Bug analyzer/94350] internal compiler error: in make_region_for_unexpected_tree_code, at analyzer/region-model.cc:4874

2020-03-27 Thread stephen at networkplumber dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94350

--- Comment #7 from Stephen Hemminger  ---
Verbose make output shows compiler flags

gcc -Wp,-MD,./.eal_memalloc.o.d.tmp  -m64 -pthread
-I/home/shemminger/DPDK/upstream/lib/librte_eal/linux/eal/include 
-march=native -DRTE_MACHINE_CPUFLAG_SSE -DRTE_MACHINE_CPUFLAG_SSE2
-DRTE_MACHINE_CPUFLAG_SSE3 -DRTE_MACHINE_CPUFLAG_SSSE3
-DRTE_MACHINE_CPUFLAG_SSE4_1 -DRTE_MACHINE_CPUFLAG_SSE4_2
-DRTE_MACHINE_CPUFLAG_AES -DRTE_MACHINE_CPUFLAG_PCLMULQDQ
-DRTE_MACHINE_CPUFLAG_AVX -DRTE_MACHINE_CPUFLAG_RDRAND
-DRTE_MACHINE_CPUFLAG_RDSEED -DRTE_MACHINE_CPUFLAG_FSGSBASE
-DRTE_MACHINE_CPUFLAG_F16C -DRTE_MACHINE_CPUFLAG_AVX2 
-I/home/shemminger/DPDK/upstream/build/include -DRTE_USE_FUNCTION_VERSIONING
-include /home/shemminger/DPDK/upstream/build/include/rte_config.h
-D_GNU_SOURCE -DALLOW_EXPERIMENTAL_API
-I/home/shemminger/DPDK/upstream/lib/librte_eal/linux/eal/include
-I/home/shemminger/DPDK/upstream/lib/librte_eal/common
-I/home/shemminger/DPDK/upstream/lib/librte_eal/common/include -W -Wall
-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
-Wold-style-definition -Wpointer-arith -Wcast-align -Wnested-externs
-Wcast-qual -Wformat-nonliteral -Wformat-security -Wundef -Wwrite-strings
-Wdeprecated -Werror -Wno-missing-field-initializers -Wimplicit-fallthrough=2
-Wno-format-truncation -Wno-address-of-packed-member -O3   -fanalyzer -o
eal_memalloc.o -c
/home/shemminger/DPDK/upstream/lib/librte_eal/linux/eal/eal_memalloc.c 
during IPA pass: analyzer
cc1: internal compiler error: in make_region_for_unexpected_tree_code, at
analyzer/region-model.cc:4874
Please submit a full bug report,
with preprocessed source if appropriate.

[Bug c/118403] uninitialized warning with automatic union

2025-01-22 Thread stephen at networkplumber dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118403

--- Comment #14 from Stephen Hemminger  ---

(In reply to Sam James from comment #13)
> (In reply to Stephen Hemminger from comment #12)
> 
> What does `gcc --version` give?

 $ gcc-15 --version
gcc-15 (GCC) 15.0.0 2024 (experimental)

[Bug c/118403] uninitialized warning with automatic union

2025-01-23 Thread stephen at networkplumber dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118403

--- Comment #16 from Stephen Hemminger  ---
(In reply to Sam James from comment #15)
> (In reply to Stephen Hemminger from comment #14)
> > (In reply to Sam James from comment #13)
> > > (In reply to Stephen Hemminger from comment #12)
> > > 
> > > What does `gcc --version` give?
> > 
> >  $ gcc-15 --version
> > gcc-15 (GCC) 15.0.0 2024 (experimental)
> 
> You need >= r15-5746-g0547dbb725b6d8 which is from November 28th.

These tests are being run on Gcc being built from upstream git (ie. latest).
There was an install issue where an old version was left behind.
The lastest version fixes the zero-init-flag issue.

[Bug c/118403] uninitialized warning with automatic union

2025-01-21 Thread stephen at networkplumber dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118403

--- Comment #12 from Stephen Hemminger  ---
I tried to use the documented flag

$ gcc-15 -fzero-init-padding-bits=all
gcc-15: error: unrecognized command-line option ‘-fzero-init-padding-bits=all’
gcc-15: fatal error: no input files
compilation terminated.

It is in the man page and help string but parsing of the option appears to be
broken.

[Bug c/118403] uninitialized warning with automatic union

2025-01-13 Thread stephen at networkplumber dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118403

--- Comment #11 from Stephen Hemminger  ---
(In reply to Jakub Jelinek from comment #9)
> If this is in Linux kernel, I've told the kernel people they should use
> -fzero-init-padding-bits=unions because they rely on it for security reasons
> and don't want to change all the {0}s for union to {}s.
> See
> https://lore.kernel.org/linux-toolchains/CAHk-
> =wjkbodvjrnjpryg2b9pvppfzvirwokleudougp_djt...@mail.gmail.com/T/#t

No this is userspace project that runs on Linux, FreeBSD and Windows

[Bug c/118403] uninitialized warning with automatic union

2025-01-13 Thread stephen at networkplumber dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118403

--- Comment #8 from Stephen Hemminger  ---
Created attachment 60139
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60139&action=edit
pre-processed source

gcc-15 -Idrivers/net/thunderx/base -I../drivers/net/thunderx/base -Ilib/ethdev
-I../lib/ethdev -I. -I.. -Iconfig -I../config -Ilib/eal/include
-I../lib/eal/include -Ilib/eal/linux/include -I../lib/eal/linux/include
-Ilib/eal/x86/include -I../lib/eal/x86/include -I../kernel/linux
-Ilib/eal/common -I../lib/eal/common -Ilib/eal -I../lib/eal -Ilib/kvargs
-I../lib/kvargs -Ilib/log -I../lib/log -Ilib/metrics -I../lib/metrics
-Ilib/telemetry -I../lib/telemetry -Ilib/net -I../lib/net -Ilib/mbuf
-I../lib/mbuf -Ilib/mempool -I../lib/mempool -Ilib/ring -I../lib/ring
-Ilib/meter -I../lib/meter -I/usr/include/x86_64-linux-gnu
-fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra
-std=c11 -O3 -include rte_config.h -Wcast-qual -Wdeprecated -Wformat
-Wformat-nonliteral -Wformat-security -Wmissing-declarations
-Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith
-Wsign-compare -Wstrict-prototypes -Wundef -Wwrite-strings
-Wno-packed-not-aligned -Wno-missing-field-initializers -D_GNU_SOURCE -fPIC
-march=native -mrtm -DALLOW_EXPERIMENTAL_API -DALLOW_INTERNAL_API
-Wno-format-truncation -Wno-address-of-packed-member \
-E ../drivers/net/thunderx/base/nicvf_mbox.c

[Bug c/118403] uninitialized warning with automatic union

2025-01-10 Thread stephen at networkplumber dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118403

--- Comment #4 from Stephen Hemminger  ---
Agree that empty initializer is best for this driver.

But other information here.

The compile flags for this driver have disabled the warning.
cflags += '-Wno-maybe-uninitialized'

That might be related to the observed warnings.

[Bug c/118403] uninitialized warning with automatic union

2025-01-10 Thread stephen at networkplumber dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118403

--- Comment #5 from Stephen Hemminger  ---
(In reply to Andrew Pinski from comment #2)
> (In reply to Andrew Pinski from comment #1)
> > Using `{}` is the correct fix. The referenced part of the C standard here is
> > applying to struct and not unions.
> 
> Oh the big reason is GCC switched to defaulting to C23.
> 
> Can you attach the preprocessed source with the exact command line used?

A little difficult with meson build, let me see

[Bug c/118403] New: uninitialized warning with automatic union

2025-01-10 Thread stephen at networkplumber dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118403

Bug ID: 118403
   Summary: uninitialized warning with automatic union
   Product: gcc
   Version: 15.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: stephen at networkplumber dot org
  Target Milestone: ---

Building DPDK project with GCC 15 gets a new warning in one of the drivers.
Which does not occur with GCC 14.

In function ‘nicvf_mbox_send_msg_to_pf_raw’,
inlined from ‘nicvf_mbox_send_async_msg_to_pf’ at
../drivers/net/thunderx/base/nicvf_mbox.c:70:2,
inlined from ‘nicvf_mbox_link_change’ at
../drivers/net/thunderx/base/nicvf_mbox.c:477:2:
../drivers/net/thunderx/base/nicvf_mbox.c:59:17: warning: ‘mbx’ is used
uninitialized [-Wuninitialized]
   59 | nicvf_reg_write(nic, mbx_addr, *mbx_data);
  | ^
../drivers/net/thunderx/base/nicvf_mbox.c: In function
‘nicvf_mbox_link_change’:
../drivers/net/thunderx/base/nicvf_mbox.c:474:24: note: ‘mbx’ declared here
  474 | struct nic_mbx mbx = { .msg = { 0 } };
  |

If the initialization is replaced by an empty expression 
  struct nic_mbx mbx = { };
Then there is no warning.

The data structure in question looks like:

struct nic_mbx {
/* 128 bit shared memory between PF and each VF */  
union { 
struct { uint8_t msg; } msg;
struct nic_cfg_msg  nic_cfg;
struct qs_cfg_msg   qs; 
struct rq_cfg_msg   rq; 
struct sq_cfg_msg   sq; 
struct set_mac_msg  mac;
struct set_frs_msg  frs;
struct cpi_cfg_msg  cpi_cfg;
struct rss_sz_msg   rss_size;   
struct rss_cfg_msg  rss_cfg;
struct bgx_link_status  link_status;
struct sqs_allocsqs_alloc;  
struct set_loopback lbk;
struct reset_stat_cfg   reset_stat; 
struct set_link_state   set_link;   
struct change_link_mode_msg mode;   
struct xcast xcast; 
};  
};  

My understanding is that both should be equivalent.
  Reference C99 Standard 6.7.8.21:

If there are fewer initializers in a brace-enclosed list than there are
elements or members of an aggregate, or fewer characters in a string literal
used to initialize an array of known size than there are elements in the array,
the remainder of the aggregate shall be initialized implicitly the same as
objects that have static storage duration

Tried to make simple example, but it was hard to reproduce.