From: Kees Cook <kees@kernel.org>
To: Ingo Saitz <ingo@hannover.ccc.de>
Cc: "Valdis Klētnieks" <valdis.kletnieks@vt.edu>,
linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: Build error in next-20260223 gcc-plugins/latent_entropy_plugin.so
Date: Fri, 20 Mar 2026 12:23:10 -0700 [thread overview]
Message-ID: <202603201220.8E538CC1@keescook> (raw)
In-Reply-To: <abV0OEcoN6H_QZEP@spatz.zoo>
On Sat, Mar 14, 2026 at 03:44:08PM +0100, Ingo Saitz wrote:
> On Sat, Mar 14, 2026 at 02:50:46PM +0100, Ingo Saitz wrote:
> > I attached [...]
>
> Grml, here you go
>
> Ingo
> --
> const_cast<long double>(Λ)
> From 552485b879d19780afd3614d69508c3ea7cb242f Mon Sep 17 00:00:00 2001
> From: Ingo Saitz <ingo@hannover.ccc.de>
> Date: Sat, 14 Mar 2026 14:24:56 +0100
> Subject: [PATCH] Replace CONST_CAST with const_cast<>.
>
> For gcc-16, this was removed in gcc trunk
>
> see commits
> c3d96ff9e916c02584aa081f03ab999292efbb50
> 458c7926d48959abcb2c1adaa22458e27459a551
> ---
> scripts/gcc-plugins/gcc-common.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/gcc-plugins/gcc-common.h b/scripts/gcc-plugins/gcc-common.h
> index 8f1b3500f8e2..7b3517b31e0a 100644
> --- a/scripts/gcc-plugins/gcc-common.h
> +++ b/scripts/gcc-plugins/gcc-common.h
> @@ -309,7 +309,7 @@ typedef const gimple *const_gimple_ptr;
> #define gimple gimple_ptr
> #define const_gimple const_gimple_ptr
> #undef CONST_CAST_GIMPLE
> -#define CONST_CAST_GIMPLE(X) CONST_CAST(gimple, (X))
> +#define CONST_CAST_GIMPLE(X) const_cast<gimple>((X))
>
> /* gimple related */
> static inline gimple gimple_build_assign_with_ops(enum tree_code subcode, tree lhs, tree op1, tree op2 MEM_STAT_DECL)
> @@ -414,7 +414,7 @@ static inline void ipa_remove_stmt_references(symtab_node *referring_node, gimpl
> #ifdef __cplusplus
> static inline void debug_tree(const_tree t)
> {
> - debug_tree(CONST_CAST_TREE(t));
> + debug_tree(const_cast<tree>(t));
> }
>
> static inline void debug_gimple_stmt(const_gimple s)
> @@ -422,7 +422,7 @@ static inline void debug_gimple_stmt(const_gimple s)
> debug_gimple_stmt(CONST_CAST_GIMPLE(s));
> }
> #else
> -#define debug_tree(t) debug_tree(CONST_CAST_TREE(t))
> +#define debug_tree(t) debug_tree(const_cast<tree>(t))
> #define debug_gimple_stmt(s) debug_gimple_stmt(CONST_CAST_GIMPLE(s))
> #endif
Thanks for this!
Should CONST_CAST_TREE be explicitly defined instead, to match
CONST_CAST_GIMPLE in the this header file? It seems weird to have one of
two done this way: we should either do both or neither (CONST_CAST_GIMPLE
is only used in the header file too).
Is const_cast<gimple> and const_cast<tree> valid back through GCC 8
(earliest Linux-supported GCC)?
-Kees
--
Kees Cook
next prev parent reply other threads:[~2026-03-20 19:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-25 5:20 Build error in next-20260223 gcc-plugins/latent_entropy_plugin.so Valdis Klētnieks
2026-02-25 7:33 ` Kees Cook
2026-02-25 15:14 ` Valdis Klētnieks
2026-03-14 13:50 ` Ingo Saitz
2026-03-14 14:44 ` Ingo Saitz
2026-03-20 19:23 ` Kees Cook [this message]
2026-03-21 12:25 ` Ingo Saitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202603201220.8E538CC1@keescook \
--to=kees@kernel.org \
--cc=ingo@hannover.ccc.de \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=valdis.kletnieks@vt.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.