[Tomoyo-dev 853] Re: Avoiding gcc bug

Back to archive index

Tetsuo Handa from-****@I-lov*****
2008年 7月 20日 (日) 11:07:37 JST


 熊猫です。

> また、この問題は他の環境でも起こるのでしょうか? よろしければ追試をお願い
> します。
Lenny と Mandriva で試してみたところ、 Mandriva で再現できました。
ただし、 Mandriva もデフォルトでは 4.2.3 を使うので、 Makefile の CC で
gcc4.3 と明示しない限り、この問題に遭遇することは無いようです。


/***** Lenny using default gcc *****/
  CC      fs/tomoyo_network.o
fs/tomoyo_network.c: In function 'save_ipv6_address':
fs/tomoyo_network.c:79: warning: statement with no effect
fs/tomoyo_network.c:79: warning: statement with no effect
fs/tomoyo_network.c:79: warning: statement with no effect
fs/tomoyo_network.c:79: warning: statement with no effect
tomoyo:/usr/src/linux-source-2.6.25# gcc -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.1-2' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --enable-cld --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.3.1 (Debian 4.3.1-2)
tomoyo:/usr/src/linux-source-2.6.25#


/***** Mandriva 2008.1 using default gcc *****/
  CC      fs/tomoyo_network.o
fs/tomoyo_network.c: In function ‘save_ipv6_address’:
fs/tomoyo_network.c:79: warning: statement with no effect
fs/tomoyo_network.c:79: warning: statement with no effect
fs/tomoyo_network.c:79: warning: statement with no effect
fs/tomoyo_network.c:79: warning: statement with no effect
[root @ localhost linux-2.6.26]# gcc -v
Using built-in specs.
Target: i586-manbo-linux-gnu
Configured with: ../configure --prefix=/usr --libexecdir=/usr/lib --with-slibdir=/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-checking=release --enable-languages=c,c++,ada,fortran,objc,obj-c++,java --host=i586-manbo-linux-gnu --with-cpu=generic --with-system-zlib --enable-threads=posix --enable-shared --enable-long-long --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --enable-java-awt=gtk --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --enable-gtk-cairo --disable-libjava-multilib --enable-ssp --disable-libssp
Thread model: posix
gcc version 4.2.3 (4.2.3-6mnb1)


/***** Mandriva 2008.1 using gcc4.3 *****/
  CC      fs/tomoyo_network.o
fs/tomoyo_network.c: In function ‘save_ipv6_address’:
fs/tomoyo_network.c:79: warning: statement with no effect
fs/tomoyo_network.c:79: warning: statement with no effect
fs/tomoyo_network.c:79: warning: statement with no effect
fs/tomoyo_network.c:79: warning: statement with no effect
fs/tomoyo_network.c:65: internal compiler error: in referenced_var_lookup, at tree-dfa.c:648
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make[1]: *** [fs/tomoyo_network.o] Error 1
make: *** [fs/tomoyo_network.o] Error 2
[root @ localhost linux-2.6.26]# gcc4.3 -v
Using built-in specs.
Target: i586-mandriva-linux-gnu
Configured with: ../configure --prefix=/usr --libexecdir=/usr/lib --with-slibdir=/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-checking=release --enable-languages=c,c++,fortran,java --program-suffix=4.3 --build=i586-mandriva-linux-gnu --host=i586-mandriva-linux-gnu --with-cpu=generic --with-system-zlib --enable-threads=posix --enable-shared --enable-long-long --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --enable-java-awt=gtk --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-gtk-cairo --disable-libjava-multilib --enable-ssp --disable-libssp --disable-libmudflap --disable-werror --disable-libgomp
Thread model: posix
gcc version 4.3.0 (GCC)



> 警告が出ていても特に実害はなく、コンパイルできないのも gcc のせいなのです
> が、一応最新の gcc でコンパイルが通らないというのは落ち着かないので、とり
> あえず Gentoo 用に以下のようなパッチをあててもかまいませんか?
もちろん、構いません。全部のディストリに影響する修正は各ディストリでコンパイルできることを
確認する必要がありますが、特定のディストリだけに影響する修正はメンテナが独自に行っていただいて
構いません。
誰かが勝手に addr_list の中の 16 だけを書き換えることは無いとは思いますが、念のため
以下のように全部置換するか、 #define にするかのどちらかにした方が良いかもしれません、
関数内に閉じた定数なので #define を使うまでもないと思っていましたが、
コンパイルエラーや実行時エラーになる以上は、何かの対処が必要ですね。

Index: ccs-patch/fs/tomoyo_network.c
===================================================================
--- ccs-patch/fs/tomoyo_network.c	(リビジョン 1398)
+++ ccs-patch/fs/tomoyo_network.c	(作業コピー)
@@ -63,16 +63,15 @@
  */
 static const struct in6_addr *save_ipv6_address(const struct in6_addr *addr)
 {
-	static const u8 block_size = 16;
 	struct addr_list {
-		struct in6_addr addr[block_size];
+		struct in6_addr addr[16];
 		struct list1_head list;
 		u32 in_use_count;
 	};
 	static LIST1_HEAD(address_list);
 	struct addr_list *ptr;
 	static DEFINE_MUTEX(lock);
-	u8 i = block_size;
+	u8 i = 16;
 	if (!addr)
 		return NULL;
 	mutex_lock(&lock);
@@ -81,10 +80,10 @@
 			if (!memcmp(&ptr->addr[i], addr, sizeof(*addr)))
 				goto ok;
 		}
-		if (i < block_size)
+		if (i < 16)
 			break;
 	}
-	if (i == block_size) {
+	if (i == 16) {
 		ptr = ccs_alloc_element(sizeof(*ptr));
 		if (!ptr)
 			goto ok;




tomoyo-dev メーリングリストの案内
Back to archive index