gcc 4.5.0 read call hangs program

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I've compiled gcc 4.5.0 to a custom prefix location on a 64bit CentOS 5 system

My issue started out with the mmap test run during configure for rrdtool. I've boiled my test down to this program which hangs on a call to read, regardless of the file I choose to read.

------------------------------------------
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>

int main (void)
{
  char  data[1024];
  int fd;

  fd = open ("/etc/passwd", O_RDONLY);
  if (fd < 0) return 1;

  printf("fd=%i\n", fd);
  read(fd, data, 1);

  /* Never get to this code */
  printf("Program hangs before this line\n");
  close (fd);
  return 0;
}
------------------------------------------

This makes the program hang on the read call:
/usr/local/toddr/bin/x86_64-redhat-linux-gnu-gcc-4.5.0 -o conftest -O2 -Wp,-D_FORTIFY_SOURCE=2 -std=c99  conftest.c -g;./conftest

Removing any of the options other than -g makes the program run normally.

Changing to -O1 causes the program to segfault in a very ugly way, which when I run gdb, and do bt full, gdb pegs the processor trying to figure out the backtrace

Changing to -O0 causes the program to run normally.

The program only links to libc and ld-linux. running /lib64/libc.so.6 shows:
GNU C Library stable release version 2.5, by Roland McGrath et al.
...
Compiled by GNU CC version 4.1.2

Can anyone suggest something I might be doing wrong? Should I open a bug on this?

Thanks,
Todd




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux