[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y1I1S86zbBmeJ+jq@localhost.localdomain>
Date: Fri, 21 Oct 2022 08:59:39 +0300
From: Alexey Dobriyan <adobriyan@...il.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: "Jason A. Donenfeld" <Jason@...c4.com>, akpm@...ux-foundation.org,
linux-kernel@...r.kernel.org, mm-commits@...r.kernel.org,
masahiroy@...nel.org, keescook@...omium.org,
gregkh@...uxfoundation.org, andriy.shevchenko@...ux.intel.com
Subject: Re: [PATCH -mm] -funsigned-char, x86: make struct
p4_event_bind::cntr signed array
On Thu, Oct 20, 2022 at 10:14:54AM -0700, Linus Torvalds wrote:
> On Thu, Oct 20, 2022 at 9:28 AM Jason A. Donenfeld <Jason@...c4.com> wrote:
> >
> > Nice catch.
> >
> > Reviewed-by: Jason A. Donenfeld <Jason@...c4.com>
>
> Can we please try to collect these all in one place?
>
> I see that Andrew picked up the original one for -mm, but I think it
> would be better if we had one specific place for all of this (one
> branch) to collect it all.
>
> I'm actually trying to do a "make allyesconfig" build on x86-64 with
> both signed and unsigned char, and trying to see if I can script
> something sane to show differences.
It is very entertaining, i've given up and started patching sparse
but it needs more because char constants are ints:
diff --git a/evaluate.c b/evaluate.c
index 61f59ee3..ab607581 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -321,6 +321,10 @@ static struct expression * cast_to(struct expression *old, struct symbol *type)
if (old->ctype != &null_ctype && is_same_type(old, type))
return old;
+ if (is_char_type(old->ctype)) {
+ sparse_error(old->pos, "XXX char");
+ }
+
expr = alloc_expression(old->pos, EXPR_IMPLIED_CAST);
expr->ctype = type;
expr->cast_type = type;
diff --git a/symbol.h b/symbol.h
index 5270fcd7..8e62aca2 100644
--- a/symbol.h
+++ b/symbol.h
@@ -455,6 +455,14 @@ static inline int is_byte_type(struct symbol *type)
return type->bit_size == bits_in_char && type->type != SYM_BITFIELD;
}
+static inline int is_char_type(const struct symbol *type)
+{
+ if (type->type == SYM_NODE) {
+ type = type->ctype.base_type;
+ }
+ return type == &char_ctype;
+}
+
static inline int is_wchar_type(struct symbol *type)
{
if (type->type == SYM_NODE)
Powered by blists - more mailing lists