From owner-pro64-contrib@oss.sgi.com Mon Jan 22 14:47:17 2001 Received: by oss.sgi.com id ; Mon, 22 Jan 2001 14:46:59 -0800 Received: from [38.170.141.29] ([38.170.141.29]:54258 "EHLO mail-in.hq.tensilica.com") by oss.sgi.com with ESMTP id ; Mon, 22 Jan 2001 14:46:50 -0800 Received: from tensilica.com (IDENT:sterling@sys5.hq.tensilica.com [192.168.11.63]) by mail-in.hq.tensilica.com (8.9.3/8.9.3) with ESMTP id OAA04712 for ; Mon, 22 Jan 2001 14:46:49 -0800 Message-ID: <3A6CB860.8233E3A1@tensilica.com> Date: Mon, 22 Jan 2001 14:46:57 -0800 From: Sterling Augustine X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.2.16-3 i686) X-Accept-Language: en MIME-Version: 1.0 To: pro64-contrib@oss.sgi.com Subject: Fixes Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-pro64-contrib@oss.sgi.com Precedence: bulk Return-Path: X-Orcpt: rfc822;pro64-contrib-outgoing 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@tensilica.com 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.) From owner-pro64-contrib@oss.sgi.com Tue Jan 23 10:58:32 2001 Received: by oss.sgi.com id ; Tue, 23 Jan 2001 10:58:12 -0800 Received: from deliverator.sgi.com ([204.94.214.10]:21287 "EHLO deliverator.sgi.com") by oss.sgi.com with ESMTP id ; Tue, 23 Jan 2001 10:58:04 -0800 Received: from rohi.engr.sgi.com (rohi.engr.sgi.com [130.62.180.74]) by deliverator.sgi.com (980309.SGI.8.8.8-aspam-6.2/980310.SGI-aspam) via ESMTP id KAA06614 for ; Tue, 23 Jan 2001 10:57:06 -0800 (PST) mail_from (mpm@rohi.engr.sgi.com) Received: (from mpm@localhost) by rohi.engr.sgi.com (980427.SGI.8.8.8/970903.SGI.AUTOCF) id KAA16802; Tue, 23 Jan 2001 10:56:15 -0800 (PST) Date: Tue, 23 Jan 2001 10:56:15 -0800 (PST) From: mpm@rohi.engr.sgi.com (Michael Murphy) Message-Id: <200101231856.KAA16802@rohi.engr.sgi.com> To: pro64-contrib@oss.sgi.com, Sterling Augustine Subject: Re: Fixes Sender: owner-pro64-contrib@oss.sgi.com Precedence: bulk Return-Path: X-Orcpt: rfc822;pro64-contrib-outgoing Thank you for the fixes. Murthy will investigate the first fix, but I have looked at the others and they all seem good, so I am incorporating them into the source base. Thanks for improving the compiler! -- Mike Murphy -- mpm@sgi.com -- quote of the day: -- "Things are not always what they seem" (Phaedrus Active, A.D. 8) From owner-pro64-contrib@oss.sgi.com Tue Jan 23 11:39:01 2001 Received: by oss.sgi.com id ; Tue, 23 Jan 2001 11:38:51 -0800 Received: from deliverator.sgi.com ([204.94.214.10]:28468 "EHLO deliverator.sgi.com") by oss.sgi.com with ESMTP id ; Tue, 23 Jan 2001 11:38:29 -0800 Received: from gaea.engr.sgi.com (gaea.engr.sgi.com [130.62.180.97]) by deliverator.sgi.com (980309.SGI.8.8.8-aspam-6.2/980310.SGI-aspam) via ESMTP id LAA12810 for ; Tue, 23 Jan 2001 11:37:31 -0800 (PST) mail_from (murthy@sgi.com) Received: from sgi.com (localhost [127.0.0.1]) by gaea.engr.sgi.com (980427.SGI.8.8.8/970903.SGI.AUTOCF) via ESMTP id LAA34861; Tue, 23 Jan 2001 11:32:24 -0800 (PST) Message-ID: <3A6DDC48.F52420D3@sgi.com> Date: Tue, 23 Jan 2001 11:32:24 -0800 From: Chandrasekhar Murthy X-Mailer: Mozilla 4.51C-SGI [en] (X11; I; IRIX 6.5 IP32) X-Accept-Language: en MIME-Version: 1.0 To: Sterling Augustine CC: pro64-contrib@oss.sgi.com Subject: Re: Fixes References: <3A6CB860.8233E3A1@tensilica.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-pro64-contrib@oss.sgi.com Precedence: bulk Return-Path: X-Orcpt: rfc822;pro64-contrib-outgoing Hi Sterling, Although your patch to gccfe/wfe_misc.cxx will fix the problem you have uncovered, the problem is in wfe_decl.cxx which should not have invoked WFE_Stmt_Append (which in turn invokes WFE_Stmt_Top) in the first place. The reason is that the initialization should be done using INITO's and not by using STMT nodes as there is no function in which to place the STMT nodes. I will fix the problem in wfe_decl.cxx to not invoke WFE_Stmt_Append in this case, and add an assertion check to WFE_Stmt_Top to catch the illegal access. This might affect the C++ frontend too, but will not affect the f90 frontend. Thanks for finding and reporting the problem. Murthy