Re: Calculating array sizes in C - was: Re: Build regressions/improvements in v6.2-rc1

From
Geert Uytterhoeven <geert@linux-m68k.org>
Date
2023-01-17 21:43:27
Also in
amd-gfx, linux-arm-kernel, linux-f2fs-devel, linux-media, linux-mips, linux-sh, linux-wireless, lkml
Reply to
John Paul Adrian Glaubitz, 2023-01-17
Hi Adrian,

On Tue, Jan 17, 2023 at 6:06 PM John Paul Adrian Glaubitz
[off-list ref] wrote:
On 1/17/23 18:01, Geert Uytterhoeven wrote:
quoted
The issue is that some of the parameters are not arrays, but
NULL. E.g.:

arch/sh/kernel/cpu/sh2/setup-sh7619.c:static
DECLARE_INTC_DESC(intc_desc, "sh7619", vectors, NULL,
arch/sh/kernel/cpu/sh2/setup-sh7619.c-                   NULL,
prio_registers, NULL);
Isn't this supposed to be caught by this check:

        a, __same_type(a, NULL)

?
Yeah, but gcc thinks it is smarter than us...
Probably it drops the test, assuming UB cannot happen.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Thread (18 messages) 18 messages, 8 authors, last reply 2023-01-21
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help