This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: purge_addressof not purging reg-notes
Richard Henderson writes:
> On Fri, Jun 22, 2001 at 04:20:30PM +0100, Andrew Haley wrote:
> > I've added a little code to fixup_var_refs_insn() so that it nukes any
> > notes that contain ADDRESSOFs. This is easier than trying to repair
> > them.
>
> I'm a bit concerned, because there's already code that's
> *supposed* to repair them. Thus I think simply removing
> them is papering over a problem elsewhere.
Okay. I found the code that repairs insn fields, but I couldn't find
it for notes.
> What's the test case?
Attached here. The compiler options are just "-O2" with any recent
ARM gcc.
The critical thing required to trigger the bug seems to be the two
largish arrays which force stack slot offsets to exceed the 12 bit
limit for indexed addressing from FP. Without those arrays, the
(addressof(mem)) note is still left after purge_addressof() but it
gets removed sometime during cse2 so you don't see the bug.
I get:
arm_reload_addressof_fail.c: In function `do_subst':
arm_reload_addressof_fail.c:86: warning: unused variable `bi'
arm_reload_addressof_fail.c:87: warning: unused variable `bo'
arm_reload_addressof_fail.c:120: Internal compiler error in elimination_effects, at reload1.c:2824
Andrew.
typedef unsigned int __u_int;
typedef unsigned long __u_long;
typedef __u_int __uid_t;
typedef __uid_t uid_t;
typedef __u_int __gid_t;
typedef __gid_t gid_t;
__extension__ typedef unsigned long long int __u_quad_t;
typedef __u_quad_t __dev_t;
typedef __u_long __ino_t;
typedef __u_int __mode_t;
typedef __u_int __nlink_t;
typedef long int __off_t;
typedef long int __blksize_t;
typedef long int __blkcnt_t;
typedef long int __time_t;
typedef unsigned int size_t;
typedef int __ssize_t;
typedef __ssize_t ssize_t;
typedef struct stralloc { char *s; unsigned int len; unsigned int a; } stralloc;
typedef struct buffer {
char *x;
unsigned int p;
unsigned int n;
int fd;
int (*op)(int, char *,unsigned int);
} buffer;
typedef int (*BUFFER_CAST) (int, char *,unsigned int);
struct stat
{
__dev_t st_dev;
unsigned short int __pad1;
__ino_t st_ino;
__mode_t st_mode;
__nlink_t st_nlink;
__uid_t st_uid;
__gid_t st_gid;
__dev_t st_rdev;
unsigned short int __pad2;
__off_t st_size;
__blksize_t st_blksize;
__blkcnt_t st_blocks;
__time_t st_atime;
unsigned long int __unused1;
__time_t st_mtime;
unsigned long int __unused2;
__time_t st_ctime;
unsigned long int __unused3;
unsigned long int __unused4;
unsigned long int __unused5;
};
char *env_get(const char *var);
void bailout(int erno, const char *s1, const char *s2, const char *s3,
const char *s4);
extern int buffer_put(buffer *,const char *,unsigned int);
extern int buffer_puts(buffer *,const char *);
extern int errno;
extern int error_exist;
extern int error_noent;
extern int getln(buffer *,stralloc *,int *,int);
static stralloc s_proto={0,0,0};
static void
do_subst(int replace)
{
static stralloc tmp={0,0,0};
buffer i,o;
char bi[4096];
char bo[4096];
while (1) {
char *q;
int gotat;
stralloc sa={0,0,0};
if (-1==getln(&i,&sa,&gotat,'@'))
bailout(errno,"read(",s_proto.s,")",0);
if (sa.len==0) break;
if (!gotat) {
if (-1==buffer_put(&o,sa.s,sa.len-1)) bailout(errno,"write",0,0,0);
break;
}
if (-1==buffer_put(&o,sa.s,sa.len))
bailout(errno,"write(",tmp.s,")",0);
if (-1==getln(&i,&sa,&gotat,'@'))
bailout(errno,"read(",s_proto.s,")",0);
if (sa.len==0) break;
if (!gotat) break;
if (sa.len==1) {
if (-1==buffer_put(&o,"@",1))
bailout(errno,"write(",tmp.s,")",0);
continue;
}
sa.s[sa.len-1]=0;
q=env_get(sa.s);
if (!q) q=sa.s;
if (-1==buffer_puts(&o,q))
bailout(errno,"write(",tmp.s,")",0);
}
}