Skip to contentSkip to conversation

compiler bug?

parisc-linux Bdale Garbee 2 participants 2 messages Nov 5, 2000

lore
Share & tools
lore
#0 lore raw

In the build of util-linux, compilation of fdisk/fdiskbsdlabel.c fails as shown below. I have placed "gcc -E" output on pehc in ~bdale/fdiskbsdlabel.E for reference.

Hacking the makefiles to remove "-O -O2" allows the compile to complete cleanly.

I assume this means something in the compiler is broken?

Bdale

bdale@j5k:/space/debian/util-linux-2.10o/fdisk $ cc -c -O -O2 -fomit-frame-pointer -I../lib -Wall -Wmissing-prototypes -Wstrict-prototypes -DNCH=1 -DSBINDIR=\"/sbin\" -DUSRSBINDIR=\"/usr/sbin\" -DLOGDIR=\"/var/log\" -DVARPATH=\"/var\" -DLOCALEDIR=\"/usr/share/locale\" fdiskbsdlabel.c -o fdiskbsdlabel.o /usr/include/linux/string.h:12: parse error before "__extension__"
/usr/include/linux/string.h:12: parse error before '&&' token
/usr/include/linux/string.h:14: parse error before "__extension__"
/usr/include/linux/string.h:14: parse error before '(' token
/usr/include/linux/string.h:15: parse error before "__extension__"
/usr/include/linux/string.h:15: parse error before '&&' token
/usr/include/linux/string.h:24: parse error before "__extension__"
/usr/include/linux/string.h:27: parse error before "__extension__"
/usr/include/linux/string.h:33: parse error before "__extension__"
/usr/include/linux/string.h:36: parse error before "__extension__"
/usr/include/linux/string.h:36: parse error before '&&' token
/usr/include/linux/string.h:36: parse error before '}' token
/usr/include/linux/string.h:36: conflicting declarations of `__result'
/usr/include/linux/string.h:36: `__result' previously declared here
/usr/include/linux/string.h:36: parse error before ')' token
/usr/include/linux/string.h:36: `__s2' undeclared here (not in a function)
/usr/include/linux/string.h:36: parse error before ';' token
/usr/include/linux/string.h:36: conflicting declarations of `__result'
/usr/include/linux/string.h:36: `__result' previously defined here
/usr/include/linux/string.h:36: parse error before '}' token
/usr/include/linux/string.h:36: parse error before '}' token
/usr/include/linux/string.h:36: redefinition of `__result'
/usr/include/linux/string.h:36: `__result' previously defined here
/usr/include/linux/string.h:36: `__s1' undeclared here (not in a function)
/usr/include/linux/string.h:36: parse error before ')' token
/usr/include/linux/string.h:36: parse error before ';' token
/usr/include/linux/string.h:36: conflicting declarations of `__result'
/usr/include/linux/string.h:36: `__result' previously defined here
/usr/include/linux/string.h:36: parse error before '}' token
/usr/include/linux/string.h:39: parse error before "__extension__"
/usr/include/linux/string.h:39: parse error before '&&' token
/usr/include/linux/string.h:39: parse error before '}' token
/usr/include/linux/string.h:39: redefinition of `__result'
/usr/include/linux/string.h:36: `__result' previously defined here
/usr/include/linux/string.h:39: parse error before ')' token
/usr/include/linux/string.h:39: `__s2' undeclared here (not in a function)
/usr/include/linux/string.h:39: parse error before ';' token
/usr/include/linux/string.h:39: conflicting declarations of `__result'
/usr/include/linux/string.h:39: `__result' previously defined here
/usr/include/linux/string.h:39: parse error before '}' token
/usr/include/linux/string.h:39: parse error before '}' token
/usr/include/linux/string.h:39: redefinition of `__result'
/usr/include/linux/string.h:39: `__result' previously defined here
/usr/include/linux/string.h:39: `__s1' undeclared here (not in a function)
/usr/include/linux/string.h:39: parse error before ')' token
/usr/include/linux/string.h:39: parse error before ';' token
/usr/include/linux/string.h:39: conflicting declarations of `__result'
/usr/include/linux/string.h:39: `__result' previously defined here
/usr/include/linux/string.h:39: parse error before '}' token
/usr/include/linux/string.h:45: parse error before "__extension__"
/usr/include/linux/string.h:51: parse error before "__extension__"
/usr/include/linux/string.h:61: parse error before "__extension__"
/usr/include/linux/string.h:61: parse error before '\x0'
/usr/include/linux/string.h:61: parse error before '}' token
fdiskbsdlabel.c: In function `xbsd_zaplabel':
fdiskbsdlabel.c:840: warning: `sector' might be used uninitialized in this function
bdale@j5k:/space/debian/util-linux-2.10o/fdisk $

#1 lore raw
Quoted 2 lines · Bdale Garbee

Hacking the makefiles to remove "-O -O2" allows the compile to complete cleanly.

glibc includes are "smart", and do things like `#if defined __OPTIMIZE__'

Quoted 1 line

I assume this means something in the compiler is broken?

No, I think it's a problem with glibc, or perhaps just your include files.

Quoted 2 lines

bdale@j5k:/space/debian/util-linux-2.10o/fdisk $ cc -c -O -O2 -fomit-frame-pointer -I../lib -Wall -Wmissing-prototypes -Wstrict-prototypes -DNCH=1 -DSBINDIR=\"/sbin\" -DUSRSBINDIR=\"/usr/sbin\" -DLOGDIR=\"/var/log\" -DVARPATH=\"/var\" -DLOCALEDIR=\"/usr/share/locale\" fdiskbsdlabel.c -o fdiskbsdlabel.o /usr/include/linux/string.h:12: parse error before "__extension__"

Your .i file had this in it:

extern char * ___strtok;
extern char * __extension__ ({ char __a0, __a1, __a2; [rest snipped]

which comes from linux/string.h

extern char * ___strtok;
extern char * strcpy(char *,const char *);

The problem being that strcpy is being replaced with an inline expansion. Dunno why this is happenning.

Alan Modra

Signature · 1 line
Linuxcare.  Support for the Revolution.