This is the mail archive of the gcc-help@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: C++ standards question


> so who knows if it will ever support C++11.
http://msdn.microsoft.com/en-us/library/vstudio/hh567368.aspx
There are few "Yes" in the second column (though very less).

Regards,
Kannan

-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On Behalf Of Ian Lance Taylor
Sent: Monday, February 04, 2013 10:36 AM
To: John Fine
Cc: gcc-help
Subject: Re: C++ standards question

On Sun, Feb 3, 2013 at 3:24 PM, John Fine <johnsfine@verizon.net> wrote:
> I have a construct that the optimizer in VS2010 64-bit changes to something
> that doesn't work.
>
> I want to know whether this is a bug in the compiler or in the code being
> compiled.
>
> I would have no idea where to look in the standards document for this
> answer.  I know it is off-topic (a C++ not gcc question) but this is where
> the experts are.
>
> My function takes a parameter char* p
> One of the things the function does is test and conditionally modifies a
> char pointed to through P.  Something like:
>
> if ( expression of *p ) *p = '-';
>
> The optimizer changes that to the equivalent of
>
> *p = (expression of *p ) ? '-' : *p;
>
> Is that a valid optimization?

Not these days, and current GCC should not do it.

This is called a speculative store.

Oh, wait, you were asking about Visual Studio (at least, I am guessing
that that is what you mean by VS2010).  Speculative stores are
disallowed by the C++11 memory model.  So when VS2010 supports C++11,
it will no longer perform this optimization.  That said, I am told
that Visual Studio still does not support C99 more than ten years
later, so who knows if it will ever support C++11.

Ian


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