This is a compile error when trying to compile the file kernel/audit.c from the Linux kernel 2.6.13-rc5-mm1 with a current CVS HEAD gcc. I've removed many of the compiler flags that were present at the original compilation. What triggers this problem is switching from -O0 (no problem) to -O1 (see below). <-- snip --> ... $ /TMP/test/gcc/install/bin/gcc -m32 -Wp,-MD,kernel/.audit.o.d -nostdinc -isystem /TMP/test/gcc/install/lib/gcc/i686-pc-linux-gnu/4.1.0/include -D__KERNEL__ -Iinclude -O1 -save-temps -Iinclude/asm-i386/mach-default -Wno-pointer-sign -DKBUILD_BASENAME=audit -DKBUILD_MODNAME=audit -c -o kernel/audit.o kernel/audit.c kernel/audit.c: In function 'audit_init': kernel/audit.c:518: error: statement makes a memory store, but has no V_MAY_DEFS nor V_MUST_DEFS # VUSE <D.23048_10>; audit_skb_queue.lock = D.23048; kernel/audit.c:518: internal compiler error: verify_ssa failed Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. <-- snip -->
Created attachment 9498 [details] preprocessed file
Reducing.
Confirmed, reduced testcase: typedef struct {} raw_spinlock_t; typedef struct { raw_spinlock_t raw_lock; } spinlock_t; struct sk_buff_head { int i; spinlock_t lock; }; struct sk_buff_head audit_skb_queue; void audit_init(void) { struct sk_buff_head *list = &audit_skb_queue; audit_skb_queue.lock = (spinlock_t) { .raw_lock = { } }; } Taking the address is required even though it is dead.
If I disable structural alias analysis (-fno-tree-salias) the testcase works.
Subject: Re: [4.1 Regression] error: statement makes a memory store, but has no V_MAY_DEFS nor V_MUST_DEFS On Mon, 2005-08-15 at 17:24 +0000, pinskia at gcc dot gnu dot org wrote: > ------- Additional Comments From pinskia at gcc dot gnu dot org > 2005-08-15 17:24 ------- > If I disable structural alias analysis (-fno-tree-salias) the testcase > works. > Ugh. We dealt with this once. After discussing with RTH or diego (i forget who) about what to do here, we decided the best solution is to not generate these stores into the IL in the first place, rather than hack up all the code around it to allow zero sized stores. After all, what is the store of the zero sized field supposed to represent?
This is related to PR 21839 which was fixed by not gimplifying the store but it looks like it did not fix fully not gimplifing the store.
Here is another testcase: typedef struct {} spinlock_t; struct sk_buff_head { int i; spinlock_t lock; }; struct sk_buff_head audit_skb_queue; void audit_init(void) { struct sk_buff_head *list = &audit_skb_queue; spinlock_t a = {}; audit_skb_queue.lock = a; } The gimplifier is emitting the "audit_skb_queue.lock = a;" which is what is causing the issue.
I have a fix which I am testing.
Patch posted here: <http://gcc.gnu.org/ml/gcc-patches/2005-08/msg00985.html>.
Subject: Bug 23402 CVSROOT: /cvs/gcc Module name: gcc Changes by: pinskia@gcc.gnu.org 2005-08-17 01:55:05 Modified files: gcc : ChangeLog gimplify.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/gcc.c-torture/compile: zero-strct-3.c zero-strct-4.c Log message: 2005-08-16 Andrew Pinski <pinskia@physics.uc.edu> PR tree-opt/23402 * gcc.c-torture/compile/zero-strct-3.c: New test. * gcc.c-torture/compile/zero-strct-4.c: New test. 2005-08-16 Andrew Pinski <pinskia@physics.uc.edu> PR tree-opt/23402 * gimplify.c (zero_sized_type): New function. (gimplify_modify_expr_rhs): If we have a zero sized type, replace the statement with an empty statement. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9753&r2=2.9754 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/gimplify.c.diff?cvsroot=gcc&r1=2.146&r2=2.147 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5932&r2=1.5933 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/compile/zero-strct-3.c.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/compile/zero-strct-4.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
Fixed.