[Bug rust/113553] rust fails to build on sparc64-linux-gnu

2024-02-01 Thread doko at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113553

--- Comment #3 from Matthias Klose  ---
glibc 2.37 from the branch

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug rust/113553] rust fails to build on sparc64-linux-gnu

2024-02-01 Thread sjames at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113553

Sam James  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=112836

--- Comment #4 from Sam James  ---
Adding PR112836 to See Also because (part of this) involves posix_spawn on
sparc.

Wonder if Rainer's issue - which I've hit too - is the same as the one I'm
seeing on glibc too.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug rust/113553] rust fails to build on sparc64-linux-gnu

2024-02-01 Thread glaubitz at physik dot fu-berlin.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113553

--- Comment #5 from John Paul Adrian Glaubitz  ---
(In reply to Rainer Orth from comment #1)
> The build works for me just fine on sparc-sun-solaris2.11.
> 
> I've also fired one off on sparc64-unknown-linux-gnu which worked just as
> well.
> It was a rough ride, however, with the build aborting with
> 
> xgcc: fatal error: cannot execute
> '/var/gcc/regression/master/6.4.0-gcc-gas-gld/build/./gcc/cc1plus':
> posix_spawn: Bad address
> 
> several times.  When I ran make under strace -f, however, the build worked
> just
> fine.  Quite ugly, actually.

It seems that this can be avoided by building with one job, i.e. with "make
-j1".

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;

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug rust/113553] rust fails to build on sparc64-linux-gnu

2024-02-01 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113553

--- Comment #6 from Andrew Pinski  ---
(In reply to John Paul Adrian Glaubitz from comment #5)
> (In reply to Rainer Orth from comment #1)
> > The build works for me just fine on sparc-sun-solaris2.11.
> > 
> > I've also fired one off on sparc64-unknown-linux-gnu which worked just as
> > well.
> > It was a rough ride, however, with the build aborting with
> > 
> > xgcc: fatal error: cannot execute
> > '/var/gcc/regression/master/6.4.0-gcc-gas-gld/build/./gcc/cc1plus':
> > posix_spawn: Bad address
> > 
> > several times.  When I ran make under strace -f, however, the build worked
> > just
> > fine.  Quite ugly, actually.
> 
> It seems that this can be avoided by building with one job, i.e. with "make
> -j1".
> 
> 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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug rust/113553] rust fails to build on sparc64-linux-gnu

2024-02-01 Thread sjames at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113553

--- Comment #7 from Sam James  ---
(In reply to Sam James from comment #4)
(sorry, I misread Rainer's comment - he was talking about glibc too.)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug rust/113553] rust fails to build on sparc64-linux-gnu

2024-02-01 Thread glaubitz at physik dot fu-berlin.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113553

--- Comment #8 from John Paul Adrian Glaubitz  ---
(In reply to Andrew Pinski from comment #6)
> Let me look that seems like an unitialized variable. If it is obvious one, I
> will apply a patch.

Thanks. I was actually researching the above error message and one explanation
was that variables passed to the posix_spawn() API might uninitialized when
triggering this error message.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug rust/113553] rust fails to build on sparc64-linux-gnu

2024-02-01 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113553

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #9 from Andrew Pinski  ---
(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 .

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug rust/113553] rust fails to build on sparc64-linux-gnu

2024-02-01 Thread glaubitz at physik dot fu-berlin.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113553

--- Comment #10 from John Paul Adrian Glaubitz  ---
(In reply to Andrew Pinski from comment #9)
> oh look at this a memset issue on sparc glibc:
> https://sourceware.org/bugzilla/show_bug.cgi?id=31068 .

Hmm, but this would be sparc32. Are you sure that this applies here?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug rust/113553] rust fails to build on sparc64-linux-gnu

2024-02-01 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113553

--- Comment #11 from Andrew Pinski  ---
(In reply to John Paul Adrian Glaubitz from comment #10)
> (In reply to Andrew Pinski from comment #9)
> > oh look at this a memset issue on sparc glibc:
> > https://sourceware.org/bugzilla/show_bug.cgi?id=31068 .
> 
> Hmm, but this would be sparc32. Are you sure that this applies here?

Hmm, that is true. Still that does seem like memset is not working correctly.
Someone will need to debug memset because this code looks correct otherwise.

-- 
You are receiving this mail because:
You are on the CC list for the bug.