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]

Re: I think I found a bug in the optimizer...


Mark Grosberg <myg@tempest.din.net> said:

[...]

> Apparently, on gcc v2.95.2 (i386) and egcs v2.91.66 (PowerPC) when
> compiling the file sys_unix.c of my compiler the GCC compiler seemed to
> spin allocating memory. I noticed GCC using around 200MB and killed it. If I 
> compile without any optimizations, the file compiles fine. 

Here (i686, Red Hat 6.1, glibc-2.1.3, binutils-2.9.5.0.27) your snippet
(modified as below to get it to compile on its own) gives my compilers here
fits too. Tried egcs-1.1.2-24, gcc-2.95.2, egcs-20000221.

Please note that glibc does nasty things expanding str* functions inline,
so preprocessed source (as the bug reporting instructions demand) is really
necesary in cases like this one. But the preprocessed file is 12Mb in
size...
#include <sys/utsname.h>
#include <string.h>

typedef enum {
     FALSE = 0,
     TRUE  = 1
} BOOL;     

static struct utsname *get_unix_info(void)
{
  static BOOL              got_it = FALSE;
  static struct utsname    uinfo;

  if (got_it)
    return &uinfo;
  else
  {
    if (uname(&uinfo) >= 0)
      got_it = TRUE;
    else
      strcpy(uinfo.sysname,
        strcpy(uinfo.nodename,
        strcpy(uinfo.release,
        strcpy(uinfo.machine,  "*unknown*"))));

    return &uinfo;
  }
}
-- 
Horst von Brand                             vonbrand@sleipnir.valparaiso.cl
Casilla 9G, Viņa del Mar, Chile                               +56 32 672616


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