Subject: fsck build failure with COPTS=-O3
To: None <>
From: Tobias Nygren <>
List: current-users
Date: 12/13/2006 11:56:45

Compiling current userland with -O3 triggers an ancient clobbering issue
in fsck.

src/sbin/fsck$ COPTS=-O3 USETOOLS=never make
#   compile  fsck/fsck.o
cc -O2 -O3  -Wall -Wstrict-prototypes -Wmissing-prototypes 
-Wpointer-arith -Wno-sign-compare -Wno-traditional -Wreturn-type 
-Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wextra 
-Wno-unused-parameter  -Werror      -c    fsck.c
cc1: warnings being treated as errors
fsck.c: In function 'checkfs':
fsck.c:254: warning: variable 'optbuf' might be clobbered by 'longjmp' 
or 'vfork'
*** Error code 1

This patch takes care of it. There's probably some better way to enforce 
of variables though.. (?)

Index: fsck.c
RCS file: /cvsroot/src/sbin/fsck/fsck.c,v
retrieving revision 1.44
diff -u -r1.44 fsck.c
--- fsck.c    16 Oct 2006 02:44:46 -0000    1.44
+++ fsck.c    13 Dec 2006 10:54:41 -0000
@@ -256,7 +256,7 @@
 #ifdef __GNUC__
     /* Avoid vfork clobbering */
-    (void) &optbuf;
+    asm(""::"m"(optbuf));
     (void) &vfstype;