pro64-contrib
[Top] [All Lists]

Fixes

To: pro64-contrib@xxxxxxxxxxx
Subject: Fixes
From: Sterling Augustine <Sterling@xxxxxxxxxxxxx>
Date: Mon, 22 Jan 2001 14:46:57 -0800
Sender: owner-pro64-contrib@xxxxxxxxxxx
I have ported the pro64 compiler to solaris and am in process of porting
it to WINNT. Here are a couple of things I have found that probably
(IMHO) should be rolled into the sgi source base. I hope these are
helpful.

Sterling
sterling@xxxxxxxxxxxxx
Member of Technical Staff
Tensilica, Inc

===============================
The following test case generates an access to unallocated memory just
below
the statement stack:

>>>>>>>>>>
struct oper {
  int imm:4;
  int  symbol:4;
};

static struct oper operands = { 0 };
<<<<<<<<<

This can be fixed by adding the following code to gccfe/wfe_misc.cxx
line 569

  if (wn_stmt_sp < wn_stmt_stack)
    return NULL;

However, it probably actually reflects an error in logic somewhere (the
test case results in an attempt to append something to the top of the
stack before anything is pushed on). I haven't been able to track it
down though. On linux this unallocated memory is always 0, so the
function ends up returning NULL and the calling code just ignores it.
But on other platforms, there is garbage there and an invalid pointer is
returned. This fix makes the linux behavior explicit.

===============================

the qsort comparison functions in be/cg/gcm.cxx are incomplete, and will

cause certain implementations of qsort to fail. They seem to match
C++ operator::< conventions rather than the qsort conventions.

They should all be changed from the form

return left < right;

to the form

if (left < right)
 return -1;
else if (left == right)
 return 0;
else
 return 1;

(Don't forget to change the protype to return an int rather than a
bool.)

=============================

common/com/targ_const.h uses

#ifdef linux

to check for host endianess, but not all linux hosts are little endian,
and not all little-endian hosts are linux. A better way would be to use
LITTLE_ENDIAN host or something similar.

===============================

in driver/file_names.c

Certain implementations of tempnam return strings with periods in them,
which confuses the duplicate file checking mechanism in
driver/file_names.c:create_temp_file_name. It can be fixed by replacing
the call to get_suffix with the code below:


          /* can't use get_suffix here because we don't actually
             want the suffix. tempnam may return a value with a period
             in it. This will confuse our duplicates check below.

             we can't change get_suffix, because in other cases we
             actually want the right-most period. foo.bar.c

             we are guaranteed here that the first period after the last

             directory divider is the position we want because we chose
             its contents above.
          */
          string file_name = strrchr(p->name, '/');
          if (file_name == NULL)
            file_name = p->name;
          s = strchr(file_name, '.');
          /* we know that s won't be null because we created a string
             with a period in it. */
          s++;

===============================

 libunwind/utils/process.c line 54 has a slightly incorrect declaration:
the function pointer it takes should be declared as returning an
__unw_error_t, rather than an int. So replace:

__unw_error_t unwind_process(int (*func)(char *, __uint64_t, char *,
__uint64_t, void *)

with:

__unw_error_t unwind_process( __unw_error_t(*func)(char *, __uint64_t,
char *, __uint64_t, void *)


There is a corresponding prototype in include/sys/ia64/unwind_ia64.h
that should be changed to map.

==========================

(No, these aren't the only changes I needed to get it building on
solaris, but these are those that I think are relevant no matter what
the host.)


<Prev in Thread] Current Thread [Next in Thread>