This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
GNU compiler bug?
- To: gnu-gcc-bug at moderators dot isc dot org
- Subject: GNU compiler bug?
- From: akarpov at my-deja dot com
- Date: Wed, 01 Sep 1999 14:25:20 GMT
- Newsgroups: comp.os.vxworks,gnu.gcc.bug,gnu.gcc.help
- Organization: Deja.com - Share what you know. Learn what you don't.
Hello VxWorkers!
I’m extremely puzzled by a bug I've discovered in the GNU compiler. It
can be reproduced by this simple example of code:
/** begin of the example (gnu_bug.c) **/
#include <stdlib.h>
#include <string.h>
void myfunc(char*s, int *x)
{ char *loc;
loc=malloc(246);
strcpy(loc,"11111");
free(s); /* pushl %ebx */
/* call 0x11bf70 <free> */
s= loc; /**** NO CODE GENERATED ! ***/
*x= 246; /* movl $0xf6, (%esi) */
}
void main(void)
{
char *str; int y;
str=malloc(246);
strcpy(str,"sdfsd");
myfunc(str,&y);
}
/** end of the example (gnu_bug.c) **/
The problem is that no code is generated for the source line “s=loc;”
in the myfunc() !
This is also what I saw in the disassembled code.
Here I brought the compilation options on my x86 BSP:
cc386 -O -fvolatile -nostdlib -fno-builtin -fno-defer-pop -m486 -Wall -
I/h -I. -IC:\Tornado\target\config\all -IC:\Tornado\target/h -
IC:\Tornado\target/src/config -IC:\Tornado\target/src/drv -ansi -
nostdinc -DCPU=I80486 -Wp,-lang-c++ -o gnu_bug.o -g -Winline -c gnu_
bug.c
Any thoughts guys?
Thanks,
Alex
- VxWorks -
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.