public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Charles Wilson <cwilson@ece.gatech.edu>
To: Charles Wilson <cwilson@ece.gatech.edu>
Cc: Paul Sokolovsky <Paul.Sokolovsky@technologist.com>,
	binutils@sources.redhat.com
Subject: Re: Serious bug in auto-import
Date: Mon, 10 Sep 2001 19:16:00 -0000	[thread overview]
Message-ID: <3B9D7406.2020309@ece.gatech.edu> (raw)
In-Reply-To: <3B9D3834.1060505@ece.gatech.edu>

Charles Wilson wrote:


> 
> Therefore, I *much* prefer recommending the second of your alternatives 
> -- I wasn't aware that volatile would "fix" it for us. 


To clarify, 'volatile' is not a magic bullet.  It just prevents gcc from 
optimizing our workaround out of existence.  In the absence of 
optimization, this works just as well:
   extern_array[1] --> { type *t=extern_array; t[1] }
   extern_struct.field --> { struct s *t=&extern_struct; t->field }

> (And you can use 
> volatile for ALL THREE cases on cygwin; static, DLL(build), and 
> DLL(linkto) -- I think. I will test this tonight.).  


Yep.  Works fine.  (I know, I know, should be obvious -- but at this 
point, I'm in the "trust nothing unless you've tested it" mode.)

> One question, 
> though:  you say:
> 
>  > /* This stupid workaround is for win32 - do not "optimize" */
>  > volatile int *parr = arr;
> 
> Does your comment mean
>   "Future programmer editing this client code, do not replace references 
> to 'parr' with 'arr'."


After testing with various optimization settings, it is obvious you mean 
this ^^^^

> or
>   "When compiling this source code, do not specify -O{n}"


and not this ^^^^^^^^^

> Therefore, ld's error message should at least HINT at the "use a local 
> variable" possibility.  Your original wording does that.  Then, more 
> detailed stuff would go in the .info file (I'll base my ld.texinfo patch 
> on your explanation below).


In the patch I will soon be posting, I've reversed the order of the two 
solutions, to present the 'auxilliary variable' first, the __declspec() 
second.

 
> 
> Actually, given the "volatile" fix, I like it.  This usage seems to be 
> pretty uncommon, so the bug (and error message) will rarely be hit. 
> Recommending "volatile" markers means when only need to #ifdef on 
> __CYGWIN__ , not a bunch of FOO_STATIC/FOO_DLL_BUILD/FOO_DLL_LINKTO 
> variables.
> 
> Getting rid of THAT garbage was my primary goal in advocating your 
> auto-import stuff in the first place!
> 
> So: we have a rarely triggered bug.  Your patch warns the user and 
> prevents buggy code from being generated. My forthcoming documentation 
> patch (based on your stuff, above) will explain how a user hit by this 
> bug can work around it.  And we still don't need 
> FOO_STATIC/FOO_DLL_BUILD/etc.
> 
> I'm happy.


Okay, combined patch (with ld.texinfo stuff) coming up...

--Chuck


  reply	other threads:[~2001-09-10 19:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3B8AFF9F.4020902@ece.gatech.edu>
2001-09-08 14:31 ` Paul Sokolovsky
2001-09-08 18:31   ` Charles Wilson
2001-09-08 23:04     ` Charles Wilson
2001-09-10  7:34       ` Re[2]: " Paul Sokolovsky
2001-09-10 15:01         ` Charles Wilson
2001-09-10 19:16           ` Charles Wilson [this message]
2001-09-09 11:30     ` Ralf Habacker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3B9D7406.2020309@ece.gatech.edu \
    --to=cwilson@ece.gatech.edu \
    --cc=Paul.Sokolovsky@technologist.com \
    --cc=binutils@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).