This is the mail archive of the gcc@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: Incompatible behavior -O0, -O3, std::cout


Andrew Pinski <pinskia@physics.uc.edu> writes:

>> 
>> Hello Everyone
>> 
>> I noticed some thing strange recently. This code (under g++ (GCC) 3.2.3 
>> 20030502 (Red Hat Linux 3.2.3-53)), provides this output with -O0 flag:
>> int main(int argc, char **argv) {
>>   std::cout << f1() << f2() << std::endl;
>> }
>> 
>> 
>> I'm pretty sure that I am depending on an undefined behavior here, but 
>> maybe you guys would want to have a deeper look at this.
>
>
> Yes are you dependening on undefined behavior. 

Actually, it is unspecified behavior.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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