This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
"Cannot generate reloads"
- From: Jack Dennon <jdennon at seasurf dot net>
- To: bug-gcc at gnu dot org
- Date: Fri, 21 Dec 2001 17:21:17 -0800
- Subject: "Cannot generate reloads"
- Organization: Micromethods
- Reply-to: jdennon at seasurf dot net
Attached text file is a gcc bug report.
Well, it could be a bug.
When compiled with the following script
#! /bin/bash
gcc -v -save-temps -g -O2 -c $1.c
this source file generates an error that can be eliminated
by removing the optimization (-O2):
/* code.c - actions for hoc7 */
/* #include "hoc.h"
#include "hoc.tab.h"
*/
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
/* #include "./drivers2_0/comdev2_0.h"
*/
typedef union Datum { /* interpreter stack type */
double val;
/* Symbol *sym; */
char *str;
} Datum;
extern Datum pop(void);
/*-------------------------------------------------------------*/
void leftstring(void) /* b$ = lftstr(a$,nchar) */
{
Datum d1, d2;
char *mem;
d2 = pop(); /* nchar */
d1 = pop(); /* a$ */
mem = (char *)malloc((int)d2.val+1);
if (mem == NULL) {
execerror("leftstring: malloc error",d1.str);
return;
}
strncpy(mem,d1.str,(int)d2.val);
d1.str = mem;
push(d1);
}
/*-------------------------------------------------------------*/
The following was written to stderr:
Reading specs from /usr/lib/gcc-lib/i386-slackware-linux/2.95.3/specs
gcc version 2.95.3 20010315 (release)
/usr/lib/gcc-lib/i386-slackware-linux/2.95.3/cpp0 -lang-c -v -D__GNUC__=2 -D__GNUC_MINOR__=95 -D__ELF__ -Dunix -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__OPTIMIZE__ -g -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ strcode.c strcode.i
GNU CPP version 2.95.3 20010315 (release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/lib/gcc-lib/i386-slackware-linux/2.95.3/include
/usr/include
End of search list.
The following default directories have been omitted from the search path:
/usr/lib/gcc-lib/i386-slackware-linux/2.95.3/../../../../include/g++-3
/usr/lib/gcc-lib/i386-slackware-linux/2.95.3/../../../../i386-slackware-linux/include
End of omitted list.
/usr/lib/gcc-lib/i386-slackware-linux/2.95.3/cc1 strcode.i -quiet -dumpbase strcode.c -g -O2 -version -o strcode.s
GNU C version 2.95.3 20010315 (release) (i386-slackware-linux) compiled by GNU C version 2.95.3 20010315 (release).
strcode.c: In function `leftstring':
strcode.c:39: Unable to generate reloads for:
(insn 29 27 31 (parallel[
(set (reg:SI 4 %esi)
(fix:SI (fix:DF (subreg:DF (reg/v:DI 3 %ebx) 0))))
(clobber (mem:HI (plus:SI (reg:SI 6 %ebp)
(const_int -2 [0xfffffffe])) 0))
(clobber (mem:HI (plus:SI (reg:SI 6 %ebp)
(const_int -4 [0xfffffffc])) 0))
(clobber (mem:SI (plus:SI (reg:SI 6 %ebp)
(const_int -8 [0xfffffff8])) 0))
(clobber (scratch:HI))
] ) 149 {fix_truncdfsi2+1} (insn_list 17 (nil))
(expr_list:REG_DEAD (reg/v:DI 3 %ebx)
(expr_list:REG_UNUSED (scratch:HI)
(nil))))
---------------------------------------------------------------
The error goes away if I remove the optimization option -O2.
It appears to have something to do with the pop() function,
and probably is something that I'm doing wrong. This is a portion
of my hoc7 version of Kernighan & Pike's hoc interpreter, being
built with Bison. Originally developed hoc7 on my GNU/linux 2.0,
then ported over to 2.2, then to 2.4. Problem turned up on the
last port. I can easily evade the problem by simply dropping
optimization, and it is doubtful that this is actually a bug.
Copy of my article on hoc7 and sources for the entire project
are in the file hoc7n.tgz that can be downloaded from
www.seasurf.com/~jdennon
Thank you.
jdennon@seasurf.com