Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@sources.redhat.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@sources.redhat.com>
List-Help: <mailto:cygwin-help@sources.redhat.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@sources.redhat.com
Delivered-To: mailing list cygwin@sources.redhat.com
Message-ID: <3B891E23.9090407@ece.gatech.edu>
Date: Sun, 26 Aug 2001 12:04:51 -0400
From: Charles Wilson <cwilson@ece.gatech.edu>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2) Gecko/20010713
X-Accept-Language: en-us
MIME-Version: 1.0
To: DJ Delorie <dj@delorie.com>
CC: binutils@sources.redhat.com, cygwin@cygwin.com
Subject: Re: [aida_s@mx12.freecom.ne.jp: A serious bug of "ld --enable-auto-import"]
References: <3B8884F6.80708@ece.gatech.edu> <200108260530.BAA28221@envy.delorie.com> <3B888D76.6090102@ece.gatech.edu> <200108260613.CAA28557@envy.delorie.com> <3B891172.9000207@ece.gatech.edu> <200108261543.LAA06415@envy.delorie.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

DJ Delorie wrote:

>>Here's what hello.o looks like when hello.c uses
>>__declspec(dllimport) (and hwstr.c uses __declspec(dllexport)).
>>Recall that this configuration works as expected.
>>
> 
> Right, because we're effectively telling gcc that hwstr1 is a pointer,
> not an array.  That changes how gcc generates code.  Pointers must be
> indexed at runtime, arrays may be indexed at compile time.


Well, that's interesting.  Since arrays ARE pointers(*), then perhaps 
it's enough to change gcc's behavior from

"arrays may be indexed at compile time" -- and currently, ARE indexed at 
compile time

to

arrays indexed at runtime. (for pe-i386 targets)

That leaves two questions:
a) will it fix the observed problem
b) will gcc accept it

(Is there a gcc option to force runtime indexing of arrays?)

--Chuck

(*) okay, I'm C-biased.  I'm not sure how a change of the type proposed 
here would affect C++, Fortran, Ada, Java, .... but turning OFF this 
optimization shouldn't break anything, should it?


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

