This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Incompatible behavior -O0, -O3, std::cout
- From: Andreas Schwab <schwab at suse dot de>
- To: Andrew Pinski <pinskia at physics dot uc dot edu>
- Cc: pankaj at tower-research dot com (Pankaj Gupta), gcc at gcc dot gnu dot org
- Date: Sat, 19 Nov 2005 00:33:52 +0100
- Subject: Re: Incompatible behavior -O0, -O3, std::cout
- References: <200511182153.jAILr7Md007524@earth.phy.uc.edu>
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."