glibc 2.0.5 is miscompiled by egcs 970904
H.J. Lu
hjl@lucon.org
Sun Sep 7 10:54:00 GMT 1997
Hi,
There is the preprocessed sysdeps/alpha/__longjmp.c in glibc 2.0.5.
egcs 970904 for linux/alpha miscompiled it with -O2. -O is fine.
gcc 2.7.2.1 has no problems with -O2. I know nothing about the alpha
asm. With the incorrect __longjmp.o, setjmp/tst-setjmp gave:
Saved environment.
Shouldn't have Jumped to 19.
Test FAILED!
I think the wrong information is saved.
Thanks.
--
H.J. Lu (hjl@gnu.ai.mit.edu)
---
register long int
r9 asm ("$9"), r10 asm ("$10"), r11 asm ("$11"), r12 asm ("$12"),
r13 asm ("$13"), r14 asm ("$14");
register long int *fp asm ("$15"), *sp asm ("$30"), *retpc asm ("$26");
register double
f2 asm ("$f2"), f3 asm ("$f3"), f4 asm ("$f4"), f5 asm ("$f5"),
f6 asm ("$f6"), f7 asm ("$f7"), f8 asm ("$f8"), f9 asm ("$f9");
typedef struct
{
long int __9, __10, __11, __12, __13, __14;
long int *__pc, *__fp, *__sp;
double __f2, __f3, __f4, __f5, __f6, __f7, __f8, __f9;
} __jmp_buf[1];
typedef int __sig_atomic_t;
typedef struct
{
unsigned long int __val[(1024 / (8 * sizeof (unsigned long int))) ];
} __sigset_t;
typedef struct __jmp_buf_tag
{
__jmp_buf __jmpbuf;
int __mask_was_saved;
__sigset_t __saved_mask;
} jmp_buf[1];
extern int __sigsetjmp (jmp_buf __env, int __savemask) ;
extern void longjmp (jmp_buf __env, int __val)
__attribute__ ((__noreturn__));
extern void _longjmp (jmp_buf __env, int __val)
__attribute__ ((__noreturn__));
extern void __longjmp (__jmp_buf __env, int __val)
__attribute__ ((__noreturn__));
extern int __sigjmp_save (jmp_buf __env, int __savemask) ;
typedef jmp_buf sigjmp_buf;
extern void siglongjmp (sigjmp_buf __env, int __val)
__attribute__ ((__noreturn__));
void
__longjmp (__jmp_buf env, int val)
{
register long int retval asm ("$0");
r9 = env[0].__9;
r10 = env[0].__10;
r11 = env[0].__11;
r12 = env[0].__12;
r13 = env[0].__13;
r14 = env[0].__14;
f2 = env[0].__f2;
f3 = env[0].__f3;
f4 = env[0].__f4;
f5 = env[0].__f5;
f6 = env[0].__f6;
f7 = env[0].__f7;
f8 = env[0].__f8;
f9 = env[0].__f9;
retpc = env[0].__pc;
fp = env[0].__fp;
sp = env[0].__sp;
asm volatile
("cmoveq %1, 1, %0\n\t"
"ret $31, (%2), 1"
: "=r" (retval)
: "0" (val), "r" (retpc));
while (1)
{
asm volatile ("");
}
}
More information about the Gcc
mailing list