https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113553

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://sourceware.org/bugz
                   |                            |illa/show_bug.cgi?id=31068

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #6)
> > Some playing around showed that this fixes the problem for me:
> > 
> > diff --git a/libiberty/pex-unix.c b/libiberty/pex-unix.c
> > index af98062a94c..a1d35820181 100644
> > --- a/libiberty/pex-unix.c
> > +++ b/libiberty/pex-unix.c
> > @@ -574,8 +574,8 @@ pex_unix_exec_child (struct pex_obj *obj
> > ATTRIBUTE_UNUSED,
> >  {
> >    int ret;
> >    pid_t pid = -1;
> > -  posix_spawnattr_t attr;
> > -  posix_spawn_file_actions_t actions;
> > +  static posix_spawnattr_t attr;
> > +  static posix_spawn_file_actions_t actions;
> >    int attr_initialized = 0, actions_initialized = 0;
> >  
> >    *err = 0;
> 
> Let me look that seems like an unitialized variable. If it is obvious one, I
> will apply a patch.

So I looked into pex-unix.c and the code does the right thing:
  ret = posix_spawnattr_init (&attr);
...
  ret = posix_spawn_file_actions_init (&actions);


And looking into glibc we have just basically:
  memset (attr, '\0', sizeof (*attr)); //__posix_spawnattr_init 
  memset (file_actions, '\0', sizeof (*file_actions)); //
__posix_spawn_file_actions_init

And that code has not changed in glibc for years (over 10) either.
So maybe memset is not working correctly. 

oh look at this a memset issue on sparc glibc:
https://sourceware.org/bugzilla/show_bug.cgi?id=31068 .

Reply via email to