This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Serious Optimizer Bug, Sample Code Included
- To: egcs-bugs at cygnus dot com
- Subject: Serious Optimizer Bug, Sample Code Included
- From: Ingo Schneider <schneidi at informatik dot tu-muenchen dot de>
- Date: Tue, 14 Jul 1998 22:07:35 +0200
- Organization: Munich University of Technology
Hello !
I really found an optimizer bug in egcc, and I know what I'm saying.
egcc Version:
gcc version egcs-2.90.29 980515 (egcs-1.0.3 release), Debian 2.0 (glibc).
Description:
egcc removes the initialization of the struct timeval tv in the following code,
when optimizing with -O and -O2.
The small program generated waits 100 Seconds when compiled without -O, and
exits immediatly when compiled with -O.
Please tell me, whether this bug is known, otherwise I will have to
continue trying to reach someone with this bug report, because I consider
this to be a serious bug.
Ingo
--
QOTD: "Windows users are generally regarded as either thieves, people who
lost their keys, or just complete morons too stupid to use doors."
Email: Ingo.Schneider@informatik.tu-muenchen.de
URL: http://www.informatik.tu-muenchen.de/~schneidi/
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
void wait_stdin(int timeout)
{
struct timeval tv = { timeout, 0 };
fd_set rfds;
FD_ZERO(&rfds);
FD_SET(0, &rfds);
select(1, &rfds, NULL, NULL, timeout ? &tv : 0);
}
int main(int argc, char *argv)
{
wait_stdin(100);
}