acpi module failing to load in 1.9.0 preview #4?

YONETANI Tomokazu qhwt+dfly at
Tue May 29 09:51:56 PDT 2007

On Tue, May 29, 2007 at 12:28:43PM +0200, Simon 'corecode' Schubert wrote:
> YONETANI Tomokazu wrote:
> >On Mon, May 28, 2007 at 11:56:27AM -0700, Matthew Dillon wrote:
> >>:Yup, adding back the static and removing the initialiser also fixed the 
> >>:problem.
> >>:
> >>:So my fault for building with GCC 4, contrary to the instructions.  :-)
> >>:
> >>:It's the only problem I've found so far, though (apart from a barrel 
> >>:load of warnings!).
> >But a question remains: why the asm code can't see a static variable
> >with initializer only when it's compiled with GCC4.1?
> I just tried with the initializer and gcc41 and I can not reproduce this 
> problem.  Can we get some more data points?

I think I managed to reproduce this with a smaller code, if OP
has -O2 in his CFLAG (this is with gcc 4.0.1 on Mac OS X, so you need
to remove the extra underscores before function and variable names
to try it on DragonFly).

$ cat a.c
#include <stdio.h>

static int foo = 1;
int get_foo(void);
	.text				\n\
	.p2align 2, 0x90		\n\
_get_foo:				\n\
	movl	_foo,%eax		\n\
	movl	$1,_foo			\n\
	ret				\n\

	printf("foo: %d\n", get_foo());
	return 0;
$ gcc -W -Wall a.c
a.c:3: warning: 'foo' defined but not used
$ gcc -O2 -W -Wall a.c
a.c:3: warning: 'foo' defined but not used
/usr/bin/ld: Undefined symbols:
collect2: ld returned 1 exit status

Apparently gcc-4 has no idea(or no longer cares?) that __asm__() code
does modify foo and it happily optimized the variable away to a constant.


More information about the Bugs mailing list