This is the mail archive of the gcc-bugs@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]

Serious Optimizer Bug, Sample Code Included


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);
}

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