public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH v4 1/2] RISC-V: Avoid calloc() poisoning on musl
@ 2023-03-14  0:23 Sam James
  2023-03-14  0:23 ` [PATCH v4 2/2] gcc: Drop obsolete INCLUDE_PTHREAD_H Sam James
  2023-03-14  9:06 ` [PATCH v4 1/2] RISC-V: Avoid calloc() poisoning on musl Richard Biener
  0 siblings, 2 replies; 16+ messages in thread
From: Sam James @ 2023-03-14  0:23 UTC (permalink / raw)
  To: gcc-patches
  Cc: Kito Cheng, Palmer Dabbelt, Andrew Waterman, Jim Wilson,
	Ju-Zhe Zhong, Sam James

This fixes errors like:
```
In file included from /usr/include/pthread.h:30,
                 from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/riscv64-gentoo-linux-musl/bits/gthr-default.h:35,
                 from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/riscv64-gentoo-linux-musl/bits/gthr.h:148,
                 from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/ext/atomicity.h:35,
                 from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/bits/ios_base.h:39,
                 from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/ios:42,
                 from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/istream:38,
                 from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/sstream:38,
                 from /var/tmp/portage/sys-devel/gcc-13.0.1_pre20230305/work/gcc-13-20230305/gcc/config/riscv/genrvv-type-indexer.cc:22:
/usr/include/sched.h:84:7: error: attempt to use poisoned "calloc"
   84 | void *calloc(size_t, size_t);
      |       ^
/usr/include/sched.h:124:36: error: attempt to use poisoned "calloc"
  124 | #define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n)))
      |                                    ^
make[3]: *** [Makefile:2855: build/genrvv-type-indexer.o] Error 1
```

See also 3b21c21f3f5726823e19728fdd1571a14aae0fb3 and 49d508065bdd36fb1a9b6aad9666b1edb5e06474,
which was fixed in PR106102.

gcc/ChangeLog:
	* config/riscv/genrvv-type-indexer.cc: Avoid calloc() poisoning on musl by
	including <sstream> earlier.
	* system.h: Add INCLUDE_SSTREAM.

Signed-off-by: Sam James <sam@gentoo.org>
---
 gcc/config/riscv/genrvv-type-indexer.cc | 2 +-
 gcc/system.h                            | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/config/riscv/genrvv-type-indexer.cc b/gcc/config/riscv/genrvv-type-indexer.cc
index 0ef1d766002..e677b55290c 100644
--- a/gcc/config/riscv/genrvv-type-indexer.cc
+++ b/gcc/config/riscv/genrvv-type-indexer.cc
@@ -14,12 +14,12 @@ along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 #include "bconfig.h"
+#define INCLUDE_SSTREAM
 #include "system.h"
 #include "errors.h"
 
 #include "coretypes.h"
 
-#include <sstream>
 #include <assert.h>
 #include <math.h>
 
diff --git a/gcc/system.h b/gcc/system.h
index 64cd5a49258..cf45db3f97e 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -751,6 +751,10 @@ extern int vsnprintf (char *, size_t, const char *, va_list);
 # include <mutex>
 #endif
 
+#ifdef INCLUDE_SSTREAM
+# include <sstream>
+#endif
+
 #ifdef INCLUDE_MALLOC_H
 #if defined(HAVE_MALLINFO) || defined(HAVE_MALLINFO2)
 #include <malloc.h>
-- 
2.40.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v4 2/2] gcc: Drop obsolete INCLUDE_PTHREAD_H
  2023-03-14  0:23 [PATCH v4 1/2] RISC-V: Avoid calloc() poisoning on musl Sam James
@ 2023-03-14  0:23 ` Sam James
  2023-03-14  0:27   ` juzhe.zhong
  2023-03-14  9:06 ` [PATCH v4 1/2] RISC-V: Avoid calloc() poisoning on musl Richard Biener
  1 sibling, 1 reply; 16+ messages in thread
From: Sam James @ 2023-03-14  0:23 UTC (permalink / raw)
  To: gcc-patches
  Cc: Kito Cheng, Palmer Dabbelt, Andrew Waterman, Jim Wilson,
	Ju-Zhe Zhong, Sam James

This is no longer used since 0a62889c7a155f8ed971860d68870dc9c46bb004, so
let's clean it up.

gcc/ChangeLog:
	* system.h: Drop unused INCLUDE_PTHREAD_H.

Signed-off-by: Sam James <sam@gentoo.org>
---
 gcc/system.h | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/gcc/system.h b/gcc/system.h
index cf45db3f97e..3fdad7abf1e 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -761,10 +761,6 @@ extern int vsnprintf (char *, size_t, const char *, va_list);
 #endif
 #endif
 
-#ifdef INCLUDE_PTHREAD_H
-#include <pthread.h>
-#endif
-
 #ifdef INCLUDE_ISL
 #ifdef HAVE_isl
 #include <isl/options.h>
-- 
2.40.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v4 2/2] gcc: Drop obsolete INCLUDE_PTHREAD_H
  2023-03-14  0:23 ` [PATCH v4 2/2] gcc: Drop obsolete INCLUDE_PTHREAD_H Sam James
@ 2023-03-14  0:27   ` juzhe.zhong
  2023-03-14 13:45     ` Kito Cheng
  0 siblings, 1 reply; 16+ messages in thread
From: juzhe.zhong @ 2023-03-14  0:27 UTC (permalink / raw)
  To: Sam James, gcc-patches; +Cc: kito.cheng, palmer, andrew, Jim Wilson, Sam James

[-- Attachment #1: Type: text/plain, Size: 1031 bytes --]

Thank you for fixing this. I am not familiar with this.
This generator code (genrvv-type-indexer.cc) is written by @kito. 

Kito ? Can you take a look at this?


juzhe.zhong@rivai.ai
 
From: Sam James
Date: 2023-03-14 08:23
To: gcc-patches
CC: Kito Cheng; Palmer Dabbelt; Andrew Waterman; Jim Wilson; Ju-Zhe Zhong; Sam James
Subject: [PATCH v4 2/2] gcc: Drop obsolete INCLUDE_PTHREAD_H
This is no longer used since 0a62889c7a155f8ed971860d68870dc9c46bb004, so
let's clean it up.
 
gcc/ChangeLog:
* system.h: Drop unused INCLUDE_PTHREAD_H.
 
Signed-off-by: Sam James <sam@gentoo.org>
---
gcc/system.h | 4 ----
1 file changed, 4 deletions(-)
 
diff --git a/gcc/system.h b/gcc/system.h
index cf45db3f97e..3fdad7abf1e 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -761,10 +761,6 @@ extern int vsnprintf (char *, size_t, const char *, va_list);
#endif
#endif
-#ifdef INCLUDE_PTHREAD_H
-#include <pthread.h>
-#endif
-
#ifdef INCLUDE_ISL
#ifdef HAVE_isl
#include <isl/options.h>
-- 
2.40.0
 
 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v4 1/2] RISC-V: Avoid calloc() poisoning on musl
  2023-03-14  0:23 [PATCH v4 1/2] RISC-V: Avoid calloc() poisoning on musl Sam James
  2023-03-14  0:23 ` [PATCH v4 2/2] gcc: Drop obsolete INCLUDE_PTHREAD_H Sam James
@ 2023-03-14  9:06 ` Richard Biener
  2023-03-14 13:44   ` Kito Cheng
  1 sibling, 1 reply; 16+ messages in thread
From: Richard Biener @ 2023-03-14  9:06 UTC (permalink / raw)
  To: Sam James
  Cc: gcc-patches, Kito Cheng, Palmer Dabbelt, Andrew Waterman,
	Jim Wilson, Ju-Zhe Zhong

On Tue, Mar 14, 2023 at 1:24 AM Sam James via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> This fixes errors like:
> ```
> In file included from /usr/include/pthread.h:30,
>                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/riscv64-gentoo-linux-musl/bits/gthr-default.h:35,
>                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/riscv64-gentoo-linux-musl/bits/gthr.h:148,
>                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/ext/atomicity.h:35,
>                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/bits/ios_base.h:39,
>                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/ios:42,
>                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/istream:38,
>                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/sstream:38,
>                  from /var/tmp/portage/sys-devel/gcc-13.0.1_pre20230305/work/gcc-13-20230305/gcc/config/riscv/genrvv-type-indexer.cc:22:
> /usr/include/sched.h:84:7: error: attempt to use poisoned "calloc"
>    84 | void *calloc(size_t, size_t);
>       |       ^
> /usr/include/sched.h:124:36: error: attempt to use poisoned "calloc"
>   124 | #define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n)))
>       |                                    ^
> make[3]: *** [Makefile:2855: build/genrvv-type-indexer.o] Error 1
> ```
>
> See also 3b21c21f3f5726823e19728fdd1571a14aae0fb3 and 49d508065bdd36fb1a9b6aad9666b1edb5e06474,
> which was fixed in PR106102.

The system.h change is OK

> gcc/ChangeLog:
>         * config/riscv/genrvv-type-indexer.cc: Avoid calloc() poisoning on musl by
>         including <sstream> earlier.
>         * system.h: Add INCLUDE_SSTREAM.
>
> Signed-off-by: Sam James <sam@gentoo.org>
> ---
>  gcc/config/riscv/genrvv-type-indexer.cc | 2 +-
>  gcc/system.h                            | 4 ++++
>  2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/config/riscv/genrvv-type-indexer.cc b/gcc/config/riscv/genrvv-type-indexer.cc
> index 0ef1d766002..e677b55290c 100644
> --- a/gcc/config/riscv/genrvv-type-indexer.cc
> +++ b/gcc/config/riscv/genrvv-type-indexer.cc
> @@ -14,12 +14,12 @@ along with GCC; see the file COPYING3.  If not see
>  <http://www.gnu.org/licenses/>.  */
>
>  #include "bconfig.h"
> +#define INCLUDE_SSTREAM
>  #include "system.h"
>  #include "errors.h"
>
>  #include "coretypes.h"
>
> -#include <sstream>
>  #include <assert.h>
>  #include <math.h>
>
> diff --git a/gcc/system.h b/gcc/system.h
> index 64cd5a49258..cf45db3f97e 100644
> --- a/gcc/system.h
> +++ b/gcc/system.h
> @@ -751,6 +751,10 @@ extern int vsnprintf (char *, size_t, const char *, va_list);
>  # include <mutex>
>  #endif
>
> +#ifdef INCLUDE_SSTREAM
> +# include <sstream>
> +#endif
> +
>  #ifdef INCLUDE_MALLOC_H
>  #if defined(HAVE_MALLINFO) || defined(HAVE_MALLINFO2)
>  #include <malloc.h>
> --
> 2.40.0
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v4 1/2] RISC-V: Avoid calloc() poisoning on musl
  2023-03-14  9:06 ` [PATCH v4 1/2] RISC-V: Avoid calloc() poisoning on musl Richard Biener
@ 2023-03-14 13:44   ` Kito Cheng
  2023-03-14 13:48     ` Kito Cheng
  2023-03-14 21:39     ` Sam James
  0 siblings, 2 replies; 16+ messages in thread
From: Kito Cheng @ 2023-03-14 13:44 UTC (permalink / raw)
  To: Richard Biener
  Cc: Sam James, gcc-patches, Palmer Dabbelt, Andrew Waterman,
	Jim Wilson, Ju-Zhe Zhong

RISC-V part is ok, and I assume you didn't have write access so I'm
gonna push that since the system.h change also got approved :)

On Tue, Mar 14, 2023 at 5:07 PM Richard Biener via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> On Tue, Mar 14, 2023 at 1:24 AM Sam James via Gcc-patches
> <gcc-patches@gcc.gnu.org> wrote:
> >
> > This fixes errors like:
> > ```
> > In file included from /usr/include/pthread.h:30,
> >                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/riscv64-gentoo-linux-musl/bits/gthr-default.h:35,
> >                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/riscv64-gentoo-linux-musl/bits/gthr.h:148,
> >                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/ext/atomicity.h:35,
> >                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/bits/ios_base.h:39,
> >                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/ios:42,
> >                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/istream:38,
> >                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/sstream:38,
> >                  from /var/tmp/portage/sys-devel/gcc-13.0.1_pre20230305/work/gcc-13-20230305/gcc/config/riscv/genrvv-type-indexer.cc:22:
> > /usr/include/sched.h:84:7: error: attempt to use poisoned "calloc"
> >    84 | void *calloc(size_t, size_t);
> >       |       ^
> > /usr/include/sched.h:124:36: error: attempt to use poisoned "calloc"
> >   124 | #define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n)))
> >       |                                    ^
> > make[3]: *** [Makefile:2855: build/genrvv-type-indexer.o] Error 1
> > ```
> >
> > See also 3b21c21f3f5726823e19728fdd1571a14aae0fb3 and 49d508065bdd36fb1a9b6aad9666b1edb5e06474,
> > which was fixed in PR106102.
>
> The system.h change is OK
>
> > gcc/ChangeLog:
> >         * config/riscv/genrvv-type-indexer.cc: Avoid calloc() poisoning on musl by
> >         including <sstream> earlier.
> >         * system.h: Add INCLUDE_SSTREAM.
> >
> > Signed-off-by: Sam James <sam@gentoo.org>
> > ---
> >  gcc/config/riscv/genrvv-type-indexer.cc | 2 +-
> >  gcc/system.h                            | 4 ++++
> >  2 files changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/gcc/config/riscv/genrvv-type-indexer.cc b/gcc/config/riscv/genrvv-type-indexer.cc
> > index 0ef1d766002..e677b55290c 100644
> > --- a/gcc/config/riscv/genrvv-type-indexer.cc
> > +++ b/gcc/config/riscv/genrvv-type-indexer.cc
> > @@ -14,12 +14,12 @@ along with GCC; see the file COPYING3.  If not see
> >  <http://www.gnu.org/licenses/>.  */
> >
> >  #include "bconfig.h"
> > +#define INCLUDE_SSTREAM
> >  #include "system.h"
> >  #include "errors.h"
> >
> >  #include "coretypes.h"
> >
> > -#include <sstream>
> >  #include <assert.h>
> >  #include <math.h>
> >
> > diff --git a/gcc/system.h b/gcc/system.h
> > index 64cd5a49258..cf45db3f97e 100644
> > --- a/gcc/system.h
> > +++ b/gcc/system.h
> > @@ -751,6 +751,10 @@ extern int vsnprintf (char *, size_t, const char *, va_list);
> >  # include <mutex>
> >  #endif
> >
> > +#ifdef INCLUDE_SSTREAM
> > +# include <sstream>
> > +#endif
> > +
> >  #ifdef INCLUDE_MALLOC_H
> >  #if defined(HAVE_MALLINFO) || defined(HAVE_MALLINFO2)
> >  #include <malloc.h>
> > --
> > 2.40.0
> >

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v4 2/2] gcc: Drop obsolete INCLUDE_PTHREAD_H
  2023-03-14  0:27   ` juzhe.zhong
@ 2023-03-14 13:45     ` Kito Cheng
  2023-03-14 14:44       ` Jeff Law
  2023-03-31 18:44       ` [PATCH v4 2/2] gcc: Drop obsolete INCLUDE_PTHREAD_H (ping) Sam James
  0 siblings, 2 replies; 16+ messages in thread
From: Kito Cheng @ 2023-03-14 13:45 UTC (permalink / raw)
  To: juzhe.zhong; +Cc: Sam James, gcc-patches, palmer, andrew, Jim Wilson

It's not the RISC-V part, so this requires a global maintainer there I think?

On Tue, Mar 14, 2023 at 8:28 AM juzhe.zhong@rivai.ai
<juzhe.zhong@rivai.ai> wrote:
>
> Thank you for fixing this. I am not familiar with this.
> This generator code (genrvv-type-indexer.cc) is written by @kito.
>
> Kito ? Can you take a look at this?
>
>
> juzhe.zhong@rivai.ai
>
> From: Sam James
> Date: 2023-03-14 08:23
> To: gcc-patches
> CC: Kito Cheng; Palmer Dabbelt; Andrew Waterman; Jim Wilson; Ju-Zhe Zhong; Sam James
> Subject: [PATCH v4 2/2] gcc: Drop obsolete INCLUDE_PTHREAD_H
> This is no longer used since 0a62889c7a155f8ed971860d68870dc9c46bb004, so
> let's clean it up.
>
> gcc/ChangeLog:
> * system.h: Drop unused INCLUDE_PTHREAD_H.
>
> Signed-off-by: Sam James <sam@gentoo.org>
> ---
> gcc/system.h | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/gcc/system.h b/gcc/system.h
> index cf45db3f97e..3fdad7abf1e 100644
> --- a/gcc/system.h
> +++ b/gcc/system.h
> @@ -761,10 +761,6 @@ extern int vsnprintf (char *, size_t, const char *, va_list);
> #endif
> #endif
> -#ifdef INCLUDE_PTHREAD_H
> -#include <pthread.h>
> -#endif
> -
> #ifdef INCLUDE_ISL
> #ifdef HAVE_isl
> #include <isl/options.h>
> --
> 2.40.0
>
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v4 1/2] RISC-V: Avoid calloc() poisoning on musl
  2023-03-14 13:44   ` Kito Cheng
@ 2023-03-14 13:48     ` Kito Cheng
  2023-03-14 22:06       ` Sam James
  2023-03-14 21:39     ` Sam James
  1 sibling, 1 reply; 16+ messages in thread
From: Kito Cheng @ 2023-03-14 13:48 UTC (permalink / raw)
  To: Richard Biener
  Cc: Sam James, gcc-patches, Palmer Dabbelt, Andrew Waterman,
	Jim Wilson, Ju-Zhe Zhong

committed to trunk, thanks :)

On Tue, Mar 14, 2023 at 9:44 PM Kito Cheng <kito.cheng@gmail.com> wrote:
>
> RISC-V part is ok, and I assume you didn't have write access so I'm
> gonna push that since the system.h change also got approved :)
>
> On Tue, Mar 14, 2023 at 5:07 PM Richard Biener via Gcc-patches
> <gcc-patches@gcc.gnu.org> wrote:
> >
> > On Tue, Mar 14, 2023 at 1:24 AM Sam James via Gcc-patches
> > <gcc-patches@gcc.gnu.org> wrote:
> > >
> > > This fixes errors like:
> > > ```
> > > In file included from /usr/include/pthread.h:30,
> > >                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/riscv64-gentoo-linux-musl/bits/gthr-default.h:35,
> > >                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/riscv64-gentoo-linux-musl/bits/gthr.h:148,
> > >                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/ext/atomicity.h:35,
> > >                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/bits/ios_base.h:39,
> > >                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/ios:42,
> > >                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/istream:38,
> > >                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/sstream:38,
> > >                  from /var/tmp/portage/sys-devel/gcc-13.0.1_pre20230305/work/gcc-13-20230305/gcc/config/riscv/genrvv-type-indexer.cc:22:
> > > /usr/include/sched.h:84:7: error: attempt to use poisoned "calloc"
> > >    84 | void *calloc(size_t, size_t);
> > >       |       ^
> > > /usr/include/sched.h:124:36: error: attempt to use poisoned "calloc"
> > >   124 | #define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n)))
> > >       |                                    ^
> > > make[3]: *** [Makefile:2855: build/genrvv-type-indexer.o] Error 1
> > > ```
> > >
> > > See also 3b21c21f3f5726823e19728fdd1571a14aae0fb3 and 49d508065bdd36fb1a9b6aad9666b1edb5e06474,
> > > which was fixed in PR106102.
> >
> > The system.h change is OK
> >
> > > gcc/ChangeLog:
> > >         * config/riscv/genrvv-type-indexer.cc: Avoid calloc() poisoning on musl by
> > >         including <sstream> earlier.
> > >         * system.h: Add INCLUDE_SSTREAM.
> > >
> > > Signed-off-by: Sam James <sam@gentoo.org>
> > > ---
> > >  gcc/config/riscv/genrvv-type-indexer.cc | 2 +-
> > >  gcc/system.h                            | 4 ++++
> > >  2 files changed, 5 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/gcc/config/riscv/genrvv-type-indexer.cc b/gcc/config/riscv/genrvv-type-indexer.cc
> > > index 0ef1d766002..e677b55290c 100644
> > > --- a/gcc/config/riscv/genrvv-type-indexer.cc
> > > +++ b/gcc/config/riscv/genrvv-type-indexer.cc
> > > @@ -14,12 +14,12 @@ along with GCC; see the file COPYING3.  If not see
> > >  <http://www.gnu.org/licenses/>.  */
> > >
> > >  #include "bconfig.h"
> > > +#define INCLUDE_SSTREAM
> > >  #include "system.h"
> > >  #include "errors.h"
> > >
> > >  #include "coretypes.h"
> > >
> > > -#include <sstream>
> > >  #include <assert.h>
> > >  #include <math.h>
> > >
> > > diff --git a/gcc/system.h b/gcc/system.h
> > > index 64cd5a49258..cf45db3f97e 100644
> > > --- a/gcc/system.h
> > > +++ b/gcc/system.h
> > > @@ -751,6 +751,10 @@ extern int vsnprintf (char *, size_t, const char *, va_list);
> > >  # include <mutex>
> > >  #endif
> > >
> > > +#ifdef INCLUDE_SSTREAM
> > > +# include <sstream>
> > > +#endif
> > > +
> > >  #ifdef INCLUDE_MALLOC_H
> > >  #if defined(HAVE_MALLINFO) || defined(HAVE_MALLINFO2)
> > >  #include <malloc.h>
> > > --
> > > 2.40.0
> > >

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v4 2/2] gcc: Drop obsolete INCLUDE_PTHREAD_H
  2023-03-14 13:45     ` Kito Cheng
@ 2023-03-14 14:44       ` Jeff Law
  2023-03-31 18:44       ` [PATCH v4 2/2] gcc: Drop obsolete INCLUDE_PTHREAD_H (ping) Sam James
  1 sibling, 0 replies; 16+ messages in thread
From: Jeff Law @ 2023-03-14 14:44 UTC (permalink / raw)
  To: gcc-patches



On 3/14/23 07:45, Kito Cheng via Gcc-patches wrote:
> It's not the RISC-V part, so this requires a global maintainer there I think?
It does.  I hadn't had a chance to dig into the history of the pthread.h 
include to understand why it was originally included which would be the 
first step in determining if it's actually safe to remove.

Jeff

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v4 1/2] RISC-V: Avoid calloc() poisoning on musl
  2023-03-14 13:44   ` Kito Cheng
  2023-03-14 13:48     ` Kito Cheng
@ 2023-03-14 21:39     ` Sam James
  1 sibling, 0 replies; 16+ messages in thread
From: Sam James @ 2023-03-14 21:39 UTC (permalink / raw)
  To: Kito Cheng
  Cc: Richard Biener, gcc-patches, Palmer Dabbelt, Andrew Waterman,
	Jim Wilson, Ju-Zhe Zhong

[-- Attachment #1: Type: text/plain, Size: 3636 bytes --]


Kito Cheng <kito.cheng@gmail.com> writes:

> RISC-V part is ok, and I assume you didn't have write access so I'm
> gonna push that since the system.h change also got approved :)
>
> On Tue, Mar 14, 2023 at 5:07 PM Richard Biener via Gcc-patches
> <gcc-patches@gcc.gnu.org> wrote:
>>
>> On Tue, Mar 14, 2023 at 1:24 AM Sam James via Gcc-patches
>> <gcc-patches@gcc.gnu.org> wrote:
>> >
>> > This fixes errors like:
>> > ```
>> > In file included from /usr/include/pthread.h:30,
>> >                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/riscv64-gentoo-linux-musl/bits/gthr-default.h:35,
>> >                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/riscv64-gentoo-linux-musl/bits/gthr.h:148,
>> >                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/ext/atomicity.h:35,
>> >                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/bits/ios_base.h:39,
>> >                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/ios:42,
>> >                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/istream:38,
>> >                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/sstream:38,
>> >                  from /var/tmp/portage/sys-devel/gcc-13.0.1_pre20230305/work/gcc-13-20230305/gcc/config/riscv/genrvv-type-indexer.cc:22:
>> > /usr/include/sched.h:84:7: error: attempt to use poisoned "calloc"
>> >    84 | void *calloc(size_t, size_t);
>> >       |       ^
>> > /usr/include/sched.h:124:36: error: attempt to use poisoned "calloc"
>> >   124 | #define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n)))
>> >       |                                    ^
>> > make[3]: *** [Makefile:2855: build/genrvv-type-indexer.o] Error 1
>> > ```
>> >
>> > See also 3b21c21f3f5726823e19728fdd1571a14aae0fb3 and 49d508065bdd36fb1a9b6aad9666b1edb5e06474,
>> > which was fixed in PR106102.
>>
>> The system.h change is OK

Thanks Richard. Are you able to commit this for me?

best,
sam

>>
>> > gcc/ChangeLog:
>> >         * config/riscv/genrvv-type-indexer.cc: Avoid calloc() poisoning on musl by
>> >         including <sstream> earlier.
>> >         * system.h: Add INCLUDE_SSTREAM.
>> >
>> > Signed-off-by: Sam James <sam@gentoo.org>
>> > ---
>> >  gcc/config/riscv/genrvv-type-indexer.cc | 2 +-
>> >  gcc/system.h                            | 4 ++++
>> >  2 files changed, 5 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/gcc/config/riscv/genrvv-type-indexer.cc b/gcc/config/riscv/genrvv-type-indexer.cc
>> > index 0ef1d766002..e677b55290c 100644
>> > --- a/gcc/config/riscv/genrvv-type-indexer.cc
>> > +++ b/gcc/config/riscv/genrvv-type-indexer.cc
>> > @@ -14,12 +14,12 @@ along with GCC; see the file COPYING3.  If not see
>> >  <http://www.gnu.org/licenses/>.  */
>> >
>> >  #include "bconfig.h"
>> > +#define INCLUDE_SSTREAM
>> >  #include "system.h"
>> >  #include "errors.h"
>> >
>> >  #include "coretypes.h"
>> >
>> > -#include <sstream>
>> >  #include <assert.h>
>> >  #include <math.h>
>> >
>> > diff --git a/gcc/system.h b/gcc/system.h
>> > index 64cd5a49258..cf45db3f97e 100644
>> > --- a/gcc/system.h
>> > +++ b/gcc/system.h
>> > @@ -751,6 +751,10 @@ extern int vsnprintf (char *, size_t, const char *, va_list);
>> >  # include <mutex>
>> >  #endif
>> >
>> > +#ifdef INCLUDE_SSTREAM
>> > +# include <sstream>
>> > +#endif
>> > +
>> >  #ifdef INCLUDE_MALLOC_H
>> >  #if defined(HAVE_MALLINFO) || defined(HAVE_MALLINFO2)
>> >  #include <malloc.h>
>> > --
>> > 2.40.0
>> >


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 377 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v4 1/2] RISC-V: Avoid calloc() poisoning on musl
  2023-03-14 13:48     ` Kito Cheng
@ 2023-03-14 22:06       ` Sam James
  0 siblings, 0 replies; 16+ messages in thread
From: Sam James @ 2023-03-14 22:06 UTC (permalink / raw)
  To: Kito Cheng
  Cc: Richard Biener, gcc-patches, Palmer Dabbelt, Andrew Waterman,
	Jim Wilson, Ju-Zhe Zhong

[-- Attachment #1: Type: text/plain, Size: 3864 bytes --]


Kito Cheng <kito.cheng@gmail.com> writes:

> committed to trunk, thanks :)
>
> On Tue, Mar 14, 2023 at 9:44 PM Kito Cheng <kito.cheng@gmail.com> wrote:
>>
>> RISC-V part is ok, and I assume you didn't have write access so I'm
>> gonna push that since the system.h change also got approved :)

Thanks a bunch! :)

>>
>> On Tue, Mar 14, 2023 at 5:07 PM Richard Biener via Gcc-patches
>> <gcc-patches@gcc.gnu.org> wrote:
>> >
>> > On Tue, Mar 14, 2023 at 1:24 AM Sam James via Gcc-patches
>> > <gcc-patches@gcc.gnu.org> wrote:
>> > >
>> > > This fixes errors like:
>> > > ```
>> > > In file included from /usr/include/pthread.h:30,
>> > >                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/riscv64-gentoo-linux-musl/bits/gthr-default.h:35,
>> > >                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/riscv64-gentoo-linux-musl/bits/gthr.h:148,
>> > >                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/ext/atomicity.h:35,
>> > >                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/bits/ios_base.h:39,
>> > >                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/ios:42,
>> > >                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/istream:38,
>> > >                  from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/sstream:38,
>> > >                  from /var/tmp/portage/sys-devel/gcc-13.0.1_pre20230305/work/gcc-13-20230305/gcc/config/riscv/genrvv-type-indexer.cc:22:
>> > > /usr/include/sched.h:84:7: error: attempt to use poisoned "calloc"
>> > >    84 | void *calloc(size_t, size_t);
>> > >       |       ^
>> > > /usr/include/sched.h:124:36: error: attempt to use poisoned "calloc"
>> > >   124 | #define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n)))
>> > >       |                                    ^
>> > > make[3]: *** [Makefile:2855: build/genrvv-type-indexer.o] Error 1
>> > > ```
>> > >
>> > > See also 3b21c21f3f5726823e19728fdd1571a14aae0fb3 and 49d508065bdd36fb1a9b6aad9666b1edb5e06474,
>> > > which was fixed in PR106102.
>> >
>> > The system.h change is OK
>> >
>> > > gcc/ChangeLog:
>> > >         * config/riscv/genrvv-type-indexer.cc: Avoid calloc() poisoning on musl by
>> > >         including <sstream> earlier.
>> > >         * system.h: Add INCLUDE_SSTREAM.
>> > >
>> > > Signed-off-by: Sam James <sam@gentoo.org>
>> > > ---
>> > >  gcc/config/riscv/genrvv-type-indexer.cc | 2 +-
>> > >  gcc/system.h                            | 4 ++++
>> > >  2 files changed, 5 insertions(+), 1 deletion(-)
>> > >
>> > > diff --git a/gcc/config/riscv/genrvv-type-indexer.cc b/gcc/config/riscv/genrvv-type-indexer.cc
>> > > index 0ef1d766002..e677b55290c 100644
>> > > --- a/gcc/config/riscv/genrvv-type-indexer.cc
>> > > +++ b/gcc/config/riscv/genrvv-type-indexer.cc
>> > > @@ -14,12 +14,12 @@ along with GCC; see the file COPYING3.  If not see
>> > >  <http://www.gnu.org/licenses/>.  */
>> > >
>> > >  #include "bconfig.h"
>> > > +#define INCLUDE_SSTREAM
>> > >  #include "system.h"
>> > >  #include "errors.h"
>> > >
>> > >  #include "coretypes.h"
>> > >
>> > > -#include <sstream>
>> > >  #include <assert.h>
>> > >  #include <math.h>
>> > >
>> > > diff --git a/gcc/system.h b/gcc/system.h
>> > > index 64cd5a49258..cf45db3f97e 100644
>> > > --- a/gcc/system.h
>> > > +++ b/gcc/system.h
>> > > @@ -751,6 +751,10 @@ extern int vsnprintf (char *, size_t, const char *, va_list);
>> > >  # include <mutex>
>> > >  #endif
>> > >
>> > > +#ifdef INCLUDE_SSTREAM
>> > > +# include <sstream>
>> > > +#endif
>> > > +
>> > >  #ifdef INCLUDE_MALLOC_H
>> > >  #if defined(HAVE_MALLINFO) || defined(HAVE_MALLINFO2)
>> > >  #include <malloc.h>
>> > > --
>> > > 2.40.0
>> > >


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 377 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v4 2/2] gcc: Drop obsolete INCLUDE_PTHREAD_H (ping)
  2023-03-14 13:45     ` Kito Cheng
  2023-03-14 14:44       ` Jeff Law
@ 2023-03-31 18:44       ` Sam James
  2023-04-02 19:54         ` Jeff Law
  1 sibling, 1 reply; 16+ messages in thread
From: Sam James @ 2023-03-31 18:44 UTC (permalink / raw)
  To: Kito Cheng; +Cc: juzhe.zhong, gcc-patches, palmer, andrew, Jim Wilson, Jeff Law

[-- Attachment #1: Type: text/plain, Size: 1538 bytes --]


Kito Cheng <kito.cheng@gmail.com> writes:

> It's not the RISC-V part, so this requires a global maintainer there I think?
>

Someone able to look at the system.h bit? It should be trivial, there's
no uses left and it was added purely for a bug like this in the past
(see commit message).

> On Tue, Mar 14, 2023 at 8:28 AM juzhe.zhong@rivai.ai
> <juzhe.zhong@rivai.ai> wrote:
>>
>> Thank you for fixing this. I am not familiar with this.
>> This generator code (genrvv-type-indexer.cc) is written by @kito.
>>
>> Kito ? Can you take a look at this?
>>
>>
>> juzhe.zhong@rivai.ai
>>
>> From: Sam James
>> Date: 2023-03-14 08:23
>> To: gcc-patches
>> CC: Kito Cheng; Palmer Dabbelt; Andrew Waterman; Jim Wilson; Ju-Zhe Zhong; Sam James
>> Subject: [PATCH v4 2/2] gcc: Drop obsolete INCLUDE_PTHREAD_H
>> This is no longer used since 0a62889c7a155f8ed971860d68870dc9c46bb004, so
>> let's clean it up.
>>
>> gcc/ChangeLog:
>> * system.h: Drop unused INCLUDE_PTHREAD_H.
>>
>> Signed-off-by: Sam James <sam@gentoo.org>
>> ---
>> gcc/system.h | 4 ----
>> 1 file changed, 4 deletions(-)
>>
>> diff --git a/gcc/system.h b/gcc/system.h
>> index cf45db3f97e..3fdad7abf1e 100644
>> --- a/gcc/system.h
>> +++ b/gcc/system.h
>> @@ -761,10 +761,6 @@ extern int vsnprintf (char *, size_t, const char *, va_list);
>> #endif
>> #endif
>> -#ifdef INCLUDE_PTHREAD_H
>> -#include <pthread.h>
>> -#endif
>> -
>> #ifdef INCLUDE_ISL
>> #ifdef HAVE_isl
>> #include <isl/options.h>
>> --
>> 2.40.0
>>
>>


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 377 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v4 2/2] gcc: Drop obsolete INCLUDE_PTHREAD_H (ping)
  2023-03-31 18:44       ` [PATCH v4 2/2] gcc: Drop obsolete INCLUDE_PTHREAD_H (ping) Sam James
@ 2023-04-02 19:54         ` Jeff Law
  2023-04-02 20:06           ` Andrew Pinski
  0 siblings, 1 reply; 16+ messages in thread
From: Jeff Law @ 2023-04-02 19:54 UTC (permalink / raw)
  To: Sam James, Kito Cheng
  Cc: juzhe.zhong, gcc-patches, palmer, andrew, Jim Wilson



On 3/31/23 12:44, Sam James wrote:
> 
> Kito Cheng <kito.cheng@gmail.com> writes:
> 
>> It's not the RISC-V part, so this requires a global maintainer there I think?
>>
> 
> Someone able to look at the system.h bit? It should be trivial, there's
> no uses left and it was added purely for a bug like this in the past
> (see commit message).
You assert that pthread.h is no longer used...  But ISTM you really need 
to go back to when the include was added, understand why it was added 
and explain why it is no longer needed.

Additionally, we're in a "regression fixes only" stage in our 
development cycle.  As far as I can tell this does not fix a regression 
and is thus going to be deferred to gcc-14 unless you have a compelling 
reason why it needs to change now.

Jeff


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v4 2/2] gcc: Drop obsolete INCLUDE_PTHREAD_H (ping)
  2023-04-02 19:54         ` Jeff Law
@ 2023-04-02 20:06           ` Andrew Pinski
  2023-04-02 20:07             ` Jeff Law
  0 siblings, 1 reply; 16+ messages in thread
From: Andrew Pinski @ 2023-04-02 20:06 UTC (permalink / raw)
  To: Jeff Law
  Cc: Sam James, Kito Cheng, juzhe.zhong, gcc-patches, palmer, andrew,
	Jim Wilson

On Sun, Apr 2, 2023 at 12:55 PM Jeff Law via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
>
>
> On 3/31/23 12:44, Sam James wrote:
> >
> > Kito Cheng <kito.cheng@gmail.com> writes:
> >
> >> It's not the RISC-V part, so this requires a global maintainer there I think?
> >>
> >
> > Someone able to look at the system.h bit? It should be trivial, there's
> > no uses left and it was added purely for a bug like this in the past
> > (see commit message).
> You assert that pthread.h is no longer used...  But ISTM you really need
> to go back to when the include was added, understand why it was added
> and explain why it is no longer needed.

It was needed for the JIT front-end at the time used pthread_mutex_*
and pthread.h could use a poisoned identifier (I think it was calloc);
the INCLUDE_PTHREAD_H was added with r13-1350-g49d508065bdd36. The JIT
front-end moved to using C++11's mutex in r13-4164-g0a62889c7a155f and
moved away from using pthread.h but didn't remove INCLUDE_PTHREAD_H
support.

I hope that help explains why it is no longer needed and how it became
even unused.

Thanks,
Andrew Pinski

>
> Additionally, we're in a "regression fixes only" stage in our
> development cycle.  As far as I can tell this does not fix a regression
> and is thus going to be deferred to gcc-14 unless you have a compelling
> reason why it needs to change now.
>
> Jeff
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v4 2/2] gcc: Drop obsolete INCLUDE_PTHREAD_H (ping)
  2023-04-02 20:06           ` Andrew Pinski
@ 2023-04-02 20:07             ` Jeff Law
  2023-04-02 20:13               ` Andrew Pinski
  2023-04-02 20:16               ` Sam James
  0 siblings, 2 replies; 16+ messages in thread
From: Jeff Law @ 2023-04-02 20:07 UTC (permalink / raw)
  To: Andrew Pinski
  Cc: Sam James, Kito Cheng, juzhe.zhong, gcc-patches, palmer, andrew,
	Jim Wilson



On 4/2/23 14:06, Andrew Pinski wrote:
> On Sun, Apr 2, 2023 at 12:55 PM Jeff Law via Gcc-patches
> <gcc-patches@gcc.gnu.org> wrote:
>>
>>
>>
>> On 3/31/23 12:44, Sam James wrote:
>>>
>>> Kito Cheng <kito.cheng@gmail.com> writes:
>>>
>>>> It's not the RISC-V part, so this requires a global maintainer there I think?
>>>>
>>>
>>> Someone able to look at the system.h bit? It should be trivial, there's
>>> no uses left and it was added purely for a bug like this in the past
>>> (see commit message).
>> You assert that pthread.h is no longer used...  But ISTM you really need
>> to go back to when the include was added, understand why it was added
>> and explain why it is no longer needed.
> 
> It was needed for the JIT front-end at the time used pthread_mutex_*
> and pthread.h could use a poisoned identifier (I think it was calloc);
> the INCLUDE_PTHREAD_H was added with r13-1350-g49d508065bdd36. The JIT
> front-end moved to using C++11's mutex in r13-4164-g0a62889c7a155f and
> moved away from using pthread.h but didn't remove INCLUDE_PTHREAD_H
> support.
> 
> I hope that help explains why it is no longer needed and how it became
> even unused.
SO I'm confused, what does this have to do with RISC-V?

jeff

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v4 2/2] gcc: Drop obsolete INCLUDE_PTHREAD_H (ping)
  2023-04-02 20:07             ` Jeff Law
@ 2023-04-02 20:13               ` Andrew Pinski
  2023-04-02 20:16               ` Sam James
  1 sibling, 0 replies; 16+ messages in thread
From: Andrew Pinski @ 2023-04-02 20:13 UTC (permalink / raw)
  To: Jeff Law
  Cc: Sam James, Kito Cheng, juzhe.zhong, gcc-patches, palmer, andrew,
	Jim Wilson

On Sun, Apr 2, 2023 at 1:07 PM Jeff Law <jeffreyalaw@gmail.com> wrote:
>
>
>
> On 4/2/23 14:06, Andrew Pinski wrote:
> > On Sun, Apr 2, 2023 at 12:55 PM Jeff Law via Gcc-patches
> > <gcc-patches@gcc.gnu.org> wrote:
> >>
> >>
> >>
> >> On 3/31/23 12:44, Sam James wrote:
> >>>
> >>> Kito Cheng <kito.cheng@gmail.com> writes:
> >>>
> >>>> It's not the RISC-V part, so this requires a global maintainer there I think?
> >>>>
> >>>
> >>> Someone able to look at the system.h bit? It should be trivial, there's
> >>> no uses left and it was added purely for a bug like this in the past
> >>> (see commit message).
> >> You assert that pthread.h is no longer used...  But ISTM you really need
> >> to go back to when the include was added, understand why it was added
> >> and explain why it is no longer needed.
> >
> > It was needed for the JIT front-end at the time used pthread_mutex_*
> > and pthread.h could use a poisoned identifier (I think it was calloc);
> > the INCLUDE_PTHREAD_H was added with r13-1350-g49d508065bdd36. The JIT
> > front-end moved to using C++11's mutex in r13-4164-g0a62889c7a155f and
> > moved away from using pthread.h but didn't remove INCLUDE_PTHREAD_H
> > support.
> >
> > I hope that help explains why it is no longer needed and how it became
> > even unused.
> SO I'm confused, what does this have to do with RISC-V?

So this was originally submitted with a patch against
gcc/config/riscv/genrvv-type-indexer.cc as it was noticed that during
the development of r13-6662-g0e6f87835ccabf, that INCLUDE_PTHREAD_H
became unused. The original patch against genrvv-type-indexer.cc was
to use INCLUDE_PTHREAD_H which was obviously wrong and then I helped
sam come up with the correct fix and we found that INCLUDE_PTHREAD_H
was not being used any more so Sam submitted a patch to remove it so
it would not be used accidently by anyone again.

Thanks,
Andrew

>
> jeff

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v4 2/2] gcc: Drop obsolete INCLUDE_PTHREAD_H (ping)
  2023-04-02 20:07             ` Jeff Law
  2023-04-02 20:13               ` Andrew Pinski
@ 2023-04-02 20:16               ` Sam James
  1 sibling, 0 replies; 16+ messages in thread
From: Sam James @ 2023-04-02 20:16 UTC (permalink / raw)
  To: Jeff Law
  Cc: Andrew Pinski, Kito Cheng, juzhe.zhong, gcc-patches, palmer,
	andrew, Jim Wilson

[-- Attachment #1: Type: text/plain, Size: 1959 bytes --]


Jeff Law <jeffreyalaw@gmail.com> writes:

> On 4/2/23 14:06, Andrew Pinski wrote:
>> On Sun, Apr 2, 2023 at 12:55 PM Jeff Law via Gcc-patches
>> <gcc-patches@gcc.gnu.org> wrote:
>>>
>>>
>>>
>>> On 3/31/23 12:44, Sam James wrote:
>>>>
>>>> Kito Cheng <kito.cheng@gmail.com> writes:
>>>>
>>>>> It's not the RISC-V part, so this requires a global maintainer there I think?
>>>>>
>>>>
>>>> Someone able to look at the system.h bit? It should be trivial, there's
>>>> no uses left and it was added purely for a bug like this in the past
>>>> (see commit message).
>>> You assert that pthread.h is no longer used...  But ISTM you really need
>>> to go back to when the include was added, understand why it was added
>>> and explain why it is no longer needed.
>> It was needed for the JIT front-end at the time used pthread_mutex_*
>> and pthread.h could use a poisoned identifier (I think it was calloc);
>> the INCLUDE_PTHREAD_H was added with r13-1350-g49d508065bdd36. The JIT
>> front-end moved to using C++11's mutex in r13-4164-g0a62889c7a155f and
>> moved away from using pthread.h but didn't remove INCLUDE_PTHREAD_H
>> support.
>> I hope that help explains why it is no longer needed and how it
>> became
>> even unused.
> SO I'm confused, what does this have to do with RISC-V?

Thanks Andrew for explaining. I took some of it as obvious given
the context in the series but I should've explained this more in the
commit message.

It's related to RISC-V in that I sent it at the same time while fixing
a musl poisoning issue in RISC-V, then cleaned up something while
working on it, and the thing I cleaned up was added for a similar issue
to the thing I fixed in RISC-V.

I don't mind if we defer it to GCC 14, but it seems overkill given it's
trivial and the include was only added in the course of GCC 13's
development.

But happy to resend with an improved commit message either way.

thanks,
sam


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 377 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-04-02 20:18 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-14  0:23 [PATCH v4 1/2] RISC-V: Avoid calloc() poisoning on musl Sam James
2023-03-14  0:23 ` [PATCH v4 2/2] gcc: Drop obsolete INCLUDE_PTHREAD_H Sam James
2023-03-14  0:27   ` juzhe.zhong
2023-03-14 13:45     ` Kito Cheng
2023-03-14 14:44       ` Jeff Law
2023-03-31 18:44       ` [PATCH v4 2/2] gcc: Drop obsolete INCLUDE_PTHREAD_H (ping) Sam James
2023-04-02 19:54         ` Jeff Law
2023-04-02 20:06           ` Andrew Pinski
2023-04-02 20:07             ` Jeff Law
2023-04-02 20:13               ` Andrew Pinski
2023-04-02 20:16               ` Sam James
2023-03-14  9:06 ` [PATCH v4 1/2] RISC-V: Avoid calloc() poisoning on musl Richard Biener
2023-03-14 13:44   ` Kito Cheng
2023-03-14 13:48     ` Kito Cheng
2023-03-14 22:06       ` Sam James
2023-03-14 21:39     ` Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).