* drm/radeon/r600_cs: Build failures with GCC 16
@ 2025-08-08 23:15 Brahmajit Das
2025-08-09 9:36 ` Brahmajit Das
0 siblings, 1 reply; 7+ messages in thread
From: Brahmajit Das @ 2025-08-08 23:15 UTC (permalink / raw)
To: linux-next, amd-gfx; +Cc: alexander.deucher, christian.koenig
Hello Developers,
Building linux-next with GCC 16 results in this following build error
$ make
CALL scripts/checksyscalls.sh
DESCEND objtool
INSTALL libsubcmd_headers
CC drivers/gpu/drm/radeon/r600_cs.o
drivers/gpu/drm/radeon/r600_cs.c: In function ‘r600_texture_size’:
drivers/gpu/drm/radeon/r600_cs.c:1411:29: error: variable ‘level’ set but not used [-Werror=unused-but-set-variable=]
1411 | unsigned offset, i, level;
| ^~~~~
cc1: all warnings being treated as errors
make[6]: *** [scripts/Makefile.build:287: drivers/gpu/drm/radeon/r600_cs.o] Error 1
make[5]: *** [scripts/Makefile.build:556: drivers/gpu/drm/radeon] Error 2
make[4]: *** [scripts/Makefile.build:556: drivers/gpu/drm] Error 2
make[3]: *** [scripts/Makefile.build:556: drivers/gpu] Error 2
make[2]: *** [scripts/Makefile.build:556: drivers] Error 2
make[1]: *** [/home/listout/linux/Makefile:2011: .] Error 2
make: *** [Makefile:248: __sub-make] Error 2
I'm not sure whether this is kernel bug or GCC bug at the moment. But
building with GCC 15 does not give this error, hence I'm more inclined
towards the latter.
Planning to also report this on GCC side, wanted to get some
opinion/feedback from kernel devs as well.
I'm on GCC 16.0.0_p2025080.
--
Regards,
listout
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: drm/radeon/r600_cs: Build failures with GCC 16
2025-08-08 23:15 drm/radeon/r600_cs: Build failures with GCC 16 Brahmajit Das
@ 2025-08-09 9:36 ` Brahmajit Das
2025-08-11 8:48 ` Christian König
0 siblings, 1 reply; 7+ messages in thread
From: Brahmajit Das @ 2025-08-09 9:36 UTC (permalink / raw)
To: linux-next, amd-gfx; +Cc: alexander.deucher, christian.koenig, airlied
On 09.08.2025 04:45, Brahmajit Das wrote:
> Hello Developers,
>
> Building linux-next with GCC 16 results in this following build error
>
> $ make
> CALL scripts/checksyscalls.sh
> DESCEND objtool
> INSTALL libsubcmd_headers
> CC drivers/gpu/drm/radeon/r600_cs.o
> drivers/gpu/drm/radeon/r600_cs.c: In function ‘r600_texture_size’:
> drivers/gpu/drm/radeon/r600_cs.c:1411:29: error: variable ‘level’ set but not used [-Werror=unused-but-set-variable=]
> 1411 | unsigned offset, i, level;
> | ^~~~~
> cc1: all warnings being treated as errors
> make[6]: *** [scripts/Makefile.build:287: drivers/gpu/drm/radeon/r600_cs.o] Error 1
> make[5]: *** [scripts/Makefile.build:556: drivers/gpu/drm/radeon] Error 2
> make[4]: *** [scripts/Makefile.build:556: drivers/gpu/drm] Error 2
> make[3]: *** [scripts/Makefile.build:556: drivers/gpu] Error 2
> make[2]: *** [scripts/Makefile.build:556: drivers] Error 2
> make[1]: *** [/home/listout/linux/Makefile:2011: .] Error 2
> make: *** [Makefile:248: __sub-make] Error 2
>
> I'm not sure whether this is kernel bug or GCC bug at the moment. But
> building with GCC 15 does not give this error, hence I'm more inclined
> towards the latter.
> Planning to also report this on GCC side, wanted to get some
> opinion/feedback from kernel devs as well.
> I'm on GCC 16.0.0_p2025080.
>
> --
> Regards,
> listout
After giving a more thorough look, the level usage seems like dead code?
It's just set (level = blevel) and incremented in the loop (level++). I
don't see any other usage of the level variable. So if we do something
like
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
index ac77d1246b94..953ce0c57dfb 100644
--- a/drivers/gpu/drm/radeon/r600_cs.c
+++ b/drivers/gpu/drm/radeon/r600_cs.c
@@ -1408,7 +1408,7 @@ static void r600_texture_size(unsigned nfaces, unsigned blevel, unsigned llevel,
unsigned block_align, unsigned height_align, unsigned base_align,
unsigned *l0_size, unsigned *mipmap_size)
{
- unsigned offset, i, level;
+ unsigned offset, i;
unsigned width, height, depth, size;
unsigned blocksize;
unsigned nbx, nby;
@@ -1420,7 +1420,7 @@ static void r600_texture_size(unsigned nfaces, unsigned blevel, unsigned llevel,
w0 = r600_mip_minify(w0, 0);
h0 = r600_mip_minify(h0, 0);
d0 = r600_mip_minify(d0, 0);
- for(i = 0, offset = 0, level = blevel; i < nlevels; i++, level++) {
+ for(i = 0, offset = 0; i < nlevels; i++) {
width = r600_mip_minify(w0, i);
nbx = r600_fmt_get_nblocksx(format, width);
I think it should be fine.
Would really appreciate some feedback.
(CC-ed Dave)
--
Regards,
listout
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: drm/radeon/r600_cs: Build failures with GCC 16
2025-08-09 9:36 ` Brahmajit Das
@ 2025-08-11 8:48 ` Christian König
2025-08-11 9:08 ` Brahmajit Das
2025-08-11 9:21 ` [PATCH] drm/radeon/r600_cs: clean up of dead code in r600_cs Brahmajit Das
0 siblings, 2 replies; 7+ messages in thread
From: Christian König @ 2025-08-11 8:48 UTC (permalink / raw)
To: Brahmajit Das, linux-next, amd-gfx; +Cc: alexander.deucher, airlied
On 09.08.25 11:36, Brahmajit Das wrote:
> On 09.08.2025 04:45, Brahmajit Das wrote:
>> Hello Developers,
>>
>> Building linux-next with GCC 16 results in this following build error
>>
>> $ make
>> CALL scripts/checksyscalls.sh
>> DESCEND objtool
>> INSTALL libsubcmd_headers
>> CC drivers/gpu/drm/radeon/r600_cs.o
>> drivers/gpu/drm/radeon/r600_cs.c: In function ‘r600_texture_size’:
>> drivers/gpu/drm/radeon/r600_cs.c:1411:29: error: variable ‘level’ set but not used [-Werror=unused-but-set-variable=]
>> 1411 | unsigned offset, i, level;
>> | ^~~~~
>> cc1: all warnings being treated as errors
>> make[6]: *** [scripts/Makefile.build:287: drivers/gpu/drm/radeon/r600_cs.o] Error 1
>> make[5]: *** [scripts/Makefile.build:556: drivers/gpu/drm/radeon] Error 2
>> make[4]: *** [scripts/Makefile.build:556: drivers/gpu/drm] Error 2
>> make[3]: *** [scripts/Makefile.build:556: drivers/gpu] Error 2
>> make[2]: *** [scripts/Makefile.build:556: drivers] Error 2
>> make[1]: *** [/home/listout/linux/Makefile:2011: .] Error 2
>> make: *** [Makefile:248: __sub-make] Error 2
>>
>> I'm not sure whether this is kernel bug or GCC bug at the moment. But
>> building with GCC 15 does not give this error, hence I'm more inclined
>> towards the latter.
>> Planning to also report this on GCC side, wanted to get some
>> opinion/feedback from kernel devs as well.
>> I'm on GCC 16.0.0_p2025080.
>>
>> --
>> Regards,
>> listout
>
> After giving a more thorough look, the level usage seems like dead code?
> It's just set (level = blevel) and incremented in the loop (level++). I
> don't see any other usage of the level variable. So if we do something
> like
>
> diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
> index ac77d1246b94..953ce0c57dfb 100644
> --- a/drivers/gpu/drm/radeon/r600_cs.c
> +++ b/drivers/gpu/drm/radeon/r600_cs.c
> @@ -1408,7 +1408,7 @@ static void r600_texture_size(unsigned nfaces, unsigned blevel, unsigned llevel,
> unsigned block_align, unsigned height_align, unsigned base_align,
> unsigned *l0_size, unsigned *mipmap_size)
> {
> - unsigned offset, i, level;
> + unsigned offset, i;
> unsigned width, height, depth, size;
> unsigned blocksize;
> unsigned nbx, nby;
> @@ -1420,7 +1420,7 @@ static void r600_texture_size(unsigned nfaces, unsigned blevel, unsigned llevel,
> w0 = r600_mip_minify(w0, 0);
> h0 = r600_mip_minify(h0, 0);
> d0 = r600_mip_minify(d0, 0);
> - for(i = 0, offset = 0, level = blevel; i < nlevels; i++, level++) {
> + for(i = 0, offset = 0; i < nlevels; i++) {
> width = r600_mip_minify(w0, i);
> nbx = r600_fmt_get_nblocksx(format, width);
>
> I think it should be fine.
Looks valid to me. Potentially just copy&pasted from some older HW generation and not correctly adjusted for r600.
But the HW handled here is >15 years and the code easily >10 years old. I'm really wondering why gcc only complains now?
Regards,
Christian.
>
> Would really appreciate some feedback.
> (CC-ed Dave)
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: drm/radeon/r600_cs: Build failures with GCC 16
2025-08-11 8:48 ` Christian König
@ 2025-08-11 9:08 ` Brahmajit Das
2025-08-11 9:21 ` [PATCH] drm/radeon/r600_cs: clean up of dead code in r600_cs Brahmajit Das
1 sibling, 0 replies; 7+ messages in thread
From: Brahmajit Das @ 2025-08-11 9:08 UTC (permalink / raw)
To: Christian König; +Cc: linux-next, amd-gfx, alexander.deucher, airlied
On 11.08.2025 10:48, Christian König wrote:
...snip...
>
> Looks valid to me. Potentially just copy&pasted from some older HW generation and not correctly adjusted for r600.
>
> But the HW handled here is >15 years and the code easily >10 years old. I'm really wondering why gcc only complains now?
>
> Regards,
> Christian.
>
> >
> > Would really appreciate some feedback.
> > (CC-ed Dave)
> >
>
That option -Werror=unused-but-set-variable= is new in GCC 16, maybe
that's why it was never caught before?
Would you like me to send a patch?
--
Regards,
listout
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] drm/radeon/r600_cs: clean up of dead code in r600_cs
2025-08-11 8:48 ` Christian König
2025-08-11 9:08 ` Brahmajit Das
@ 2025-08-11 9:21 ` Brahmajit Das
2025-08-11 12:17 ` Christian König
1 sibling, 1 reply; 7+ messages in thread
From: Brahmajit Das @ 2025-08-11 9:21 UTC (permalink / raw)
To: christian.koenig; +Cc: airlied, alexander.deucher, amd-gfx, linux-next, listout
GCC 16 enables -Werror=unused-but-set-variable= which results in build
error with the following message.
drivers/gpu/drm/radeon/r600_cs.c: In function ‘r600_texture_size’:
drivers/gpu/drm/radeon/r600_cs.c:1411:29: error: variable ‘level’ set but not used [-Werror=unused-but-set-variable=]
1411 | unsigned offset, i, level;
| ^~~~~
cc1: all warnings being treated as errors
make[6]: *** [scripts/Makefile.build:287: drivers/gpu/drm/radeon/r600_cs.o] Error 1
level although is set, but in never used in the function
r600_texture_size. Thus resulting in dead code and this error getting
triggered.
Fixes: 60b212f8ddcdb ("drm/radeon: overhaul texture checking. (v3)")
Signed-off-by: Brahmajit Das <listout@listout.xyz>
---
drivers/gpu/drm/radeon/r600_cs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
index ac77d1246b94..811265648a58 100644
--- a/drivers/gpu/drm/radeon/r600_cs.c
+++ b/drivers/gpu/drm/radeon/r600_cs.c
@@ -1408,7 +1408,7 @@ static void r600_texture_size(unsigned nfaces, unsigned blevel, unsigned llevel,
unsigned block_align, unsigned height_align, unsigned base_align,
unsigned *l0_size, unsigned *mipmap_size)
{
- unsigned offset, i, level;
+ unsigned offset, i;
unsigned width, height, depth, size;
unsigned blocksize;
unsigned nbx, nby;
@@ -1420,7 +1420,7 @@ static void r600_texture_size(unsigned nfaces, unsigned blevel, unsigned llevel,
w0 = r600_mip_minify(w0, 0);
h0 = r600_mip_minify(h0, 0);
d0 = r600_mip_minify(d0, 0);
- for(i = 0, offset = 0, level = blevel; i < nlevels; i++, level++) {
+ for (i = 0, offset = 0; i < nlevels; i++) {
width = r600_mip_minify(w0, i);
nbx = r600_fmt_get_nblocksx(format, width);
--
2.50.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] drm/radeon/r600_cs: clean up of dead code in r600_cs
2025-08-11 9:21 ` [PATCH] drm/radeon/r600_cs: clean up of dead code in r600_cs Brahmajit Das
@ 2025-08-11 12:17 ` Christian König
2025-08-11 13:35 ` Alex Deucher
0 siblings, 1 reply; 7+ messages in thread
From: Christian König @ 2025-08-11 12:17 UTC (permalink / raw)
To: Brahmajit Das; +Cc: airlied, alexander.deucher, amd-gfx, linux-next
On 11.08.25 11:21, Brahmajit Das wrote:
> GCC 16 enables -Werror=unused-but-set-variable= which results in build
> error with the following message.
>
> drivers/gpu/drm/radeon/r600_cs.c: In function ‘r600_texture_size’:
> drivers/gpu/drm/radeon/r600_cs.c:1411:29: error: variable ‘level’ set but not used [-Werror=unused-but-set-variable=]
> 1411 | unsigned offset, i, level;
> | ^~~~~
> cc1: all warnings being treated as errors
> make[6]: *** [scripts/Makefile.build:287: drivers/gpu/drm/radeon/r600_cs.o] Error 1
>
> level although is set, but in never used in the function
> r600_texture_size. Thus resulting in dead code and this error getting
> triggered.
>
> Fixes: 60b212f8ddcdb ("drm/radeon: overhaul texture checking. (v3)")
> Signed-off-by: Brahmajit Das <listout@listout.xyz>
Acked-by: Christian König <christian.koenig@amd.com>
> ---
> drivers/gpu/drm/radeon/r600_cs.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
> index ac77d1246b94..811265648a58 100644
> --- a/drivers/gpu/drm/radeon/r600_cs.c
> +++ b/drivers/gpu/drm/radeon/r600_cs.c
> @@ -1408,7 +1408,7 @@ static void r600_texture_size(unsigned nfaces, unsigned blevel, unsigned llevel,
> unsigned block_align, unsigned height_align, unsigned base_align,
> unsigned *l0_size, unsigned *mipmap_size)
> {
> - unsigned offset, i, level;
> + unsigned offset, i;
> unsigned width, height, depth, size;
> unsigned blocksize;
> unsigned nbx, nby;
> @@ -1420,7 +1420,7 @@ static void r600_texture_size(unsigned nfaces, unsigned blevel, unsigned llevel,
> w0 = r600_mip_minify(w0, 0);
> h0 = r600_mip_minify(h0, 0);
> d0 = r600_mip_minify(d0, 0);
> - for(i = 0, offset = 0, level = blevel; i < nlevels; i++, level++) {
> + for (i = 0, offset = 0; i < nlevels; i++) {
> width = r600_mip_minify(w0, i);
> nbx = r600_fmt_get_nblocksx(format, width);
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] drm/radeon/r600_cs: clean up of dead code in r600_cs
2025-08-11 12:17 ` Christian König
@ 2025-08-11 13:35 ` Alex Deucher
0 siblings, 0 replies; 7+ messages in thread
From: Alex Deucher @ 2025-08-11 13:35 UTC (permalink / raw)
To: Christian König
Cc: Brahmajit Das, airlied, alexander.deucher, amd-gfx, linux-next
Applied. Thanks!
Alex
On Mon, Aug 11, 2025 at 8:53 AM Christian König
<christian.koenig@amd.com> wrote:
>
> On 11.08.25 11:21, Brahmajit Das wrote:
> > GCC 16 enables -Werror=unused-but-set-variable= which results in build
> > error with the following message.
> >
> > drivers/gpu/drm/radeon/r600_cs.c: In function ‘r600_texture_size’:
> > drivers/gpu/drm/radeon/r600_cs.c:1411:29: error: variable ‘level’ set but not used [-Werror=unused-but-set-variable=]
> > 1411 | unsigned offset, i, level;
> > | ^~~~~
> > cc1: all warnings being treated as errors
> > make[6]: *** [scripts/Makefile.build:287: drivers/gpu/drm/radeon/r600_cs.o] Error 1
> >
> > level although is set, but in never used in the function
> > r600_texture_size. Thus resulting in dead code and this error getting
> > triggered.
> >
> > Fixes: 60b212f8ddcdb ("drm/radeon: overhaul texture checking. (v3)")
> > Signed-off-by: Brahmajit Das <listout@listout.xyz>
>
> Acked-by: Christian König <christian.koenig@amd.com>
>
> > ---
> > drivers/gpu/drm/radeon/r600_cs.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
> > index ac77d1246b94..811265648a58 100644
> > --- a/drivers/gpu/drm/radeon/r600_cs.c
> > +++ b/drivers/gpu/drm/radeon/r600_cs.c
> > @@ -1408,7 +1408,7 @@ static void r600_texture_size(unsigned nfaces, unsigned blevel, unsigned llevel,
> > unsigned block_align, unsigned height_align, unsigned base_align,
> > unsigned *l0_size, unsigned *mipmap_size)
> > {
> > - unsigned offset, i, level;
> > + unsigned offset, i;
> > unsigned width, height, depth, size;
> > unsigned blocksize;
> > unsigned nbx, nby;
> > @@ -1420,7 +1420,7 @@ static void r600_texture_size(unsigned nfaces, unsigned blevel, unsigned llevel,
> > w0 = r600_mip_minify(w0, 0);
> > h0 = r600_mip_minify(h0, 0);
> > d0 = r600_mip_minify(d0, 0);
> > - for(i = 0, offset = 0, level = blevel; i < nlevels; i++, level++) {
> > + for (i = 0, offset = 0; i < nlevels; i++) {
> > width = r600_mip_minify(w0, i);
> > nbx = r600_fmt_get_nblocksx(format, width);
> >
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-08-11 13:35 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-08 23:15 drm/radeon/r600_cs: Build failures with GCC 16 Brahmajit Das
2025-08-09 9:36 ` Brahmajit Das
2025-08-11 8:48 ` Christian König
2025-08-11 9:08 ` Brahmajit Das
2025-08-11 9:21 ` [PATCH] drm/radeon/r600_cs: clean up of dead code in r600_cs Brahmajit Das
2025-08-11 12:17 ` Christian König
2025-08-11 13:35 ` Alex Deucher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox