delorie.com/archives/browse.cgi | search |
X-pop3-spooler: | POP3MAIL 2.1.0 b 4 980420 -bs- |
Message-ID: | <35AFE2DA.D56DE175@uni-bremen.de> |
Date: | Sat, 18 Jul 1998 01:48:42 +0200 |
From: | Andreas Schuldei <schuldei AT uni-bremen DOT de> |
Organization: | education unlimited |
X-Mailer: | Mozilla 4.04 [en] (X11; I; Linux 2.1.103 i586) |
MIME-Version: | 1.0 |
To: | beastium-list AT Desk DOT nl |
Subject: | code optimized away?! |
Sender: | Marc Lehmann <pcg AT goof DOT com> |
Status: | RO |
X-Status: | A |
Lines: | 40 |
At work I run egcs-1.0; here at home egcs-1.3a with the pgcc-patch. the following pice of code ran well at work. here at home the if statement never seems to evaluate to 1. T[0][Y]=(-0.5*(-2.*t1*t3*t6+t5*t6+t6*t7-6.*t1*t8+6.*t3*t8-6.*cos(t1)+6.*cos(t3)))/t4; if ( fabs(T[i][Y]-f)<=(long double)DBL_EPSILON) { printf("Erfolg"); punkt_fertig=1; } If I enter some nonesense just before if(...) it works correctly again, T[0][Y]=(-0.5*(-2.*t1*t3*t6+t5*t6+t6*t7-6.*t1*t8+6.*t3*t8-6.*cos(t1)+6.*cos(t3)))/t4; printf("\r"); if ( fabs(T[i][Y]-f)<=(long double)DBL_EPSILON) { printf("Erfolg"); punkt_fertig=1; } return punkt_fertig; } I tried to declare punkt_fertig as volatile but that did not work. I am not aware that anything cold be legaly optimized away. Is it a bug or what? These are aout of my makefile CFLAGS = -O6 -mpentium -g -funroll-all-loops -marg-align-double -mstack-align-double -malign-double and yes, it works with -O0, but not otherwise (e.g. -O2 does not) I am not on the list. If you can help me please reply to schuldei AT andrive DOT de or schuldei AT uni-bremen DOT de
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |