This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR middle-end/26306


Eric Botcazou wrote:

You're reading too much into the comment.

Indeed, because it is *highly* misleading to have a comment which says that the only justification is the historical one and gets the history wrong.

I'm not defending the comment. I don't think I wrote it, but if I did, I apologize. :-)


Because the middle end defines the semantics.  There are two
possibilities: (a) the middle end conditionally creates the temporary,
depending on some property of the type that indicates whether or not the
type may be copied, or (b) the front ends promise only to produce
volatile lvalues as stand-alone expressions if the copy is in fact
possible.  Either (a) or (b) will work, but (b) seems marginally better
to me, since it reduces the amount of pointless IL we will feed to the
middle end.  I don't feel strongly about that, though.

If I were to design it from scratch, I would not feel strongly either. But we have a long-established semantics in GCC 2.x and 3.x and, barring any strong impetus, I think we should retain it in 4.x and later.

I'm OK with that general idea -- but I'm not sure how to achieve that. For example, the C++ front-end now gives the back end exactly the volatile lvalues that it thinks are interesting. So, if the back end turns BLKmode volatile lvalues into a no-op, then we are changing the C++ behavior back to the older behavior.


I'll not object to such a patch. In fact, I'll pre-approve it, on one condition: fill in the section in the manual about implementation of C with respect to "qualifiers implementation" to explain under what conditions we generate an access to a volatile lvalue whose value is not otherwise required. If we're going to restore this behavior, and you think it ought to be preserved in future, we ought to document it. I don't particularly relish documenting the BLKmode-ness check, since I don't know how users will be able to work out when an object has BLKmode, but if that's easier than changing the Ada front end, it's OK by me.

I'm not trying to be cute; I really do think those are the reasonable choices, if we want to preserve this behavior for the foreseeable future.

--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]