This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Strange RTL problem
- From: Chris Lattner <sabre at nondot dot org>
- To: <gcc at gcc dot gnu dot org>
- Date: Wed, 1 May 2002 14:47:54 -0500 (CDT)
- Subject: Strange RTL problem
I'm having a really wierd problem with a backend that I'm working on for
the following C code snippet:
int printf(const char *, ...);
int main() {
signed char c0 = -1;
unsigned char c1 = 255;
printf("bs0 = %d %d\n", c0, c1);
return 0;
}
I'd like to see output of -1, 255, but my target is generating "255 255".
Looking at the RTL, I see these two INSNs:
(insn 23 21 25 (set (mem/f:QI (plus:PDI (reg/f:PDI 14 %sp)
(const_int 8 [0x8])) 0)
(const_int -1 [0xffffffff])) 9 {*movqi} (nil)
(nil))
(insn 25 23 26 (set (mem/f:QI (plus:PDI (reg/f:PDI 14 %sp)
(const_int 12 [0xc])) 0)
(const_int 255 [0xff])) 9 {*movqi} (nil)
(nil))
which are immediately before the printf call. Since both arguments are 8
bit quantities, they are stored onto the stack as QI mode, but doing
so they lose the integral promotion that would make them signed or
unsigned (this only happens with vararg functions).
This is really strange... does anyone have any idea what could be going
wrong here? How are integral promotions different for vararg functions
than they are for other function calls?
Thanks,
-Chris
http://www.nondot.org/~sabre/os/
http://www.nondot.org/~sabre/Projects/