This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Strange "bug" (?) using egcs 1999 06 16
- To: egcs-bugs at egcs dot cygnus dot com
- Subject: Strange "bug" (?) using egcs 1999 06 16
- From: Arnaud Launay <zoro at multimania dot com>
- Date: Sat, 19 Jun 1999 19:06:34 +0200 (CET)
Hello,
I'm using the following software:
* egcs-19991606 (snapshot release)
* binutils 2.9.1.0.25
* glibc 2.0.7pre6
* Linux 2.2.10
When compiling the following program (I know it's incorrect, please don't
bug me with it):
#include <sys/stat.h>
int main(void)
{
int toto;
toto=stat(0, toto);
return 0;
}
I obtain the following results:
cassis:~$ gcc -o toto test.c
test.c: In function `main':
test.c:6: warning: passing arg 2 of `stat' makes pointer from integer without a cast
/tmp/ccukxaaa.o: In function `main':
/tmp/ccukxaaa.o(.text+0x10): undefined reference to `stat'
collect2: ld returned 1 exit status
cassis:~$
It doesn't compile, complaining about stat (2) function missing.
BUT if I compile it using optimisation flag:
cassis:~$ gcc -O -o toto test.c
test.c: In function `main':
test.c:6: warning: passing arg 2 of `stat' makes pointer from integer without a cast
cassis:~$
It compiles !! So what's wrong ? Is egcs having strange behaviour or.. ?
[I include test.s which is the only difference file between the 2
compilation, test.i is exactly the same]
Please CC: me as I'm not on the list(s).
--
Arnaud Launay <launay@ftp.esiea.fr>
.file "test.c"
.version "01.01"
gcc2_compiled.:
.text
.align 4
.globl main
.type main,@function
main:
pushl %ebp
movl %esp,%ebp
subl $8,%esp
addl $-4,%esp
pushl %eax
pushl $0
pushl $3
call __xstat
xorl %eax,%eax
movl %ebp,%esp
popl %ebp
ret
.Lfe1:
.size main,.Lfe1-main
.ident "GCC: (GNU) gcc-2.95 19990615 (prerelease)"
.file "test.c"
.version "01.01"
gcc2_compiled.:
.text
.align 4
.globl main
.type main,@function
main:
pushl %ebp
movl %esp,%ebp
subl $24,%esp
addl $-8,%esp
movl -4(%ebp),%eax
pushl %eax
pushl $0
call stat
addl $16,%esp
movl %eax,%eax
movl %eax,-4(%ebp)
xorl %eax,%eax
jmp .L10
.p2align 4,,7
.L10:
movl %ebp,%esp
popl %ebp
ret
.Lfe1:
.size main,.Lfe1-main
.ident "GCC: (GNU) gcc-2.95 19990615 (prerelease)"