Skip to contentSkip to conversation

linux-next-20251029 - build error in amdgpu

DISCUSSION Valdis Klētnieks 5 participants 14 messages Oct 30, 2025 – Nov 8, 2025

lore
Share & tools
lore
#0 lore raw

Hit this error while building next-20251029 with W=1 and gcc (GCC) 15.2.1 20251022 (Red Hat 15.2.1-3

CC [M] drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_stream_encoder.o
drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_stream_encoder.c:1571:69: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
1571 | static const struct stream_encoder_funcs dce110_an_str_enc_funcs = {0};
| ^
drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_stream_encoder.c:1571:69: note: (near initialization for 'dce110_an_str_enc_funcs')
cc1: some warnings being treated as errors

Caused by:
commit deb072d241c906ae378bc88ff91dfcdc34ebe71a

Author: Timur Krist?f <[email protected]>
Date:   Fri Sep 26 20:01:51 2025 +0200

drm/amd/display: Implement DCE analog stream encoders

#1 lore raw
Quoted 2 lines · Valdis Klētnieks

Hit this error while building next-20251029 with W=1 and gcc (GCC) 15.2.1 20251022 (Red Hat 15.2.1-3

Hi,

Can you say how to reproduce that?
I use the same version of GCC but it hasn't given me any warning or error for that patch.

Thanks & best regards,
Timur

Quoted 24 lines

  CC [M] drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_stream_encoder.o drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_stream_encoder.c:157 1:69: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init] 1571 | static const struct stream_encoder_funcs dce110_an_str_enc_funcs = {0};

|
^ drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_stream_encoder.c:157 1:69: note: (near initialization for 'dce110_an_str_enc_funcs')
cc1: some warnings being treated as errors

Caused by:
commit deb072d241c906ae378bc88ff91dfcdc34ebe71a
Author: Timur Krist?f <[email protected]>
Date:   Fri Sep 26 20:01:51 2025 +0200

    drm/amd/display: Implement DCE analog stream encoders

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
#2 lore raw
Quoted 3 lines · Timur Krist�f

Can you say how to reproduce that?
I use the same version of GCC but it hasn't given me any warning or error for that patch.

Upon further testing,

[/usr/src/linux-next] make

is sufficient on my system. Turns out that it errors out even without W=1. My next guess was that it had to do with -Werror, which would cause warnings to be treated as errors, but my .config has

# CONFIG_WERROR is not set
# CONFIG_DRM_WERROR is not set
# CONFIG_DRM_AMDGPU_WERROR is not set

Do you perhaps have patches in your tree that aren't in next-20251029?

I wonder if Fedora's build of gcc 15.2.1 is different somehow from the build you're using....

#3 lore raw

Hello Valdis,

I use Fedora and I developed that patch on Fedora, using the same GCC version. It did not give me an error or warning when I wrote the patch. It is still not giving me an error or warning about that code now.

I am working with the amd-staging-drm-next branch.

What do I need to do to trigger the warning?

Thanks & best regards,
Timur

Valdis Klētnieks <[email protected]> ezt írta (időpont: 2025. nov. 2., Vas 1:59):

Quoted 28 lines · Timur Kristóf
Quoted 4 lines

Can you say how to reproduce that?
I use the same version of GCC but it hasn't given me any warning or error for that patch.

Upon further testing,

[/usr/src/linux-next] make

is sufficient on my system. Turns out that it errors out even without W=1. My
next guess was that it had to do with -Werror, which would cause warnings to
be treated as errors, but my .config has

# CONFIG_WERROR is not set
# CONFIG_DRM_WERROR is not set
# CONFIG_DRM_AMDGPU_WERROR is not set

Do you perhaps have patches in your tree that aren't in next-20251029?

I wonder if Fedora's build of gcc 15.2.1 is different somehow from the build you're using....

#4 lore raw
Quoted 10 lines · Timur Kristóf

Hello Valdis,

I use Fedora and I developed that patch on Fedora, using the same GCC version. It did not give me an error or warning when I wrote the patch. It is still not giving me an error or warning about that code now.

I am working with the amd-staging-drm-next branch.

What do I need to do to trigger the warning?

I have the same problem.

linux-next on Arch Linux
GCC : 15.2.1 20250813

Steps to reproduce the error
- make mrproper
- make allmodconfig
- make drivers/gpu/drm/amd/amdgpu/

Turns out its due to randconfig, See [1]

Setting RANDSTRUCT_NONE=y seems to stop the error.

[1] https://lore.kernel.org/all/2025062439-tamer-diner-68e9@gregkh/

- Amit

Quoted 34 lines

Thanks & best regards,
Timur

Valdis Klētnieks <[email protected]> ezt írta (időpont: 2025. nov. 2., Vas 1:59):

Quoted 28 lines · Timur Kristóf
Quoted 4 lines

Can you say how to reproduce that?
I use the same version of GCC but it hasn't given me any warning or error for that patch.

Upon further testing,

[/usr/src/linux-next] make

is sufficient on my system. Turns out that it errors out even without W=1. My
next guess was that it had to do with -Werror, which would cause warnings to
be treated as errors, but my .config has

# CONFIG_WERROR is not set
# CONFIG_DRM_WERROR is not set
# CONFIG_DRM_AMDGPU_WERROR is not set

Do you perhaps have patches in your tree that aren't in next-20251029?

I wonder if Fedora's build of gcc 15.2.1 is different somehow from the build you're using....

#5 lore raw
Quoted 10 lines · Amit Dhingra
Quoted 4 lines

What do I need to do to trigger the warning?

I have the same problem.

linux-next on Arch Linux
GCC : 15.2.1 20250813

Quoted 8 lines

Steps to reproduce the error
- make mrproper
- make allmodconfig
- make drivers/gpu/drm/amd/amdgpu/

Turns out its due to randconfig, See [1]

Setting RANDSTRUCT_NONE=y seems to stop the error.

Can you please try and see if this fixes the warning?
https://pastebin.com/raw/b8j3UABj

Alternatively, if anyone has other recommendations on how to fix it, I'm also open to suggestions.

Thanks,
Timur

Quoted 38 lines
Quoted 38 lines

Valdis Klētnieks <[email protected]> ezt írta (időpont: 2025. nov.
2., Vas 1:59):

Quoted 33 lines · Timur Kristóf
Quoted 5 lines

Can you say how to reproduce that?
I use the same version of GCC but it hasn't given me any warning or
error for that patch.

Upon further testing,

[/usr/src/linux-next] make

is sufficient on my system. Turns out that it errors out even without W=1.
My
next guess was that it had to do with -Werror, which would cause warnings
to
be treated as errors, but my .config has

# CONFIG_WERROR is not set
# CONFIG_DRM_WERROR is not set
# CONFIG_DRM_AMDGPU_WERROR is not set

Do you perhaps have patches in your tree that aren't in next- 20251029?

I wonder if Fedora's build of gcc 15.2.1 is different somehow from the
build you're using....

#10 lore raw
In reply to Amit Dhingra
Quoted 6 lines · Amit Dhingra

I have the same problem.
...

Setting RANDSTRUCT_NONE=y seems to stop the error.

[1] https://lore.kernel.org/all/2025062439-tamer-diner-68e9@gregkh/

Wow. I wouldn't have guessed that RANDSTRUCT would be the cause... However, RANDSTRUCT_NONE=y does make dce_stream_encoder.c compile cleanly.

<insert Twilight Zone theme music here>

Adding Kees Cook and the linux-hardening list to the cc:, hope somebody has an idea what's going on.

#6 lore raw
In reply to Timur Kristóf
Quoted 16 lines · Timur Kristóf
Quoted 15 lines · Amit Dhingra
Quoted 4 lines

What do I need to do to trigger the warning?

I have the same problem.

linux-next on Arch Linux
GCC : 15.2.1 20250813

Steps to reproduce the error
- make mrproper
- make allmodconfig
- make drivers/gpu/drm/amd/amdgpu/

Quoted 6 lines
Quoted 3 lines

Turns out its due to randconfig, See [1]

Setting RANDSTRUCT_NONE=y seems to stop the error.

Can you please try and see if this fixes the warning?
https://pastebin.com/raw/b8j3UABj

The patch above defining all fields seems to fix the error.

Quoted 4 lines

Alternatively, if anyone has other recommendations on how to fix it, I'm also open to suggestions.

What seemed to also work for me is to defining the struct as below without an initialization.

static const struct stream_encoder_funcs dce110_an_str_enc_funcs;

Its static so should be initialized zeroed out. objdump shows correct size allocation.

objdump -x dce_stream_encoder.o

0000000000000b60 l O .rodata 0000000000000130 dce110_str_enc_funcs
0000000000000a00 l O .rodata 0000000000000130 dce110_an_str_enc_funcs

Quoted 42 lines

Thanks,
Timur

Quoted 38 lines
Quoted 38 lines

Valdis Klētnieks <[email protected]> ezt írta (időpont: 2025. nov.
2., Vas 1:59):

Quoted 33 lines · Timur Kristóf
Quoted 5 lines

Can you say how to reproduce that?
I use the same version of GCC but it hasn't given me any warning or
error for that patch.

Upon further testing,

[/usr/src/linux-next] make

is sufficient on my system. Turns out that it errors out even without W=1.
My
next guess was that it had to do with -Werror, which would cause warnings
to
be treated as errors, but my .config has

# CONFIG_WERROR is not set
# CONFIG_DRM_WERROR is not set
# CONFIG_DRM_AMDGPU_WERROR is not set

Do you perhaps have patches in your tree that aren't in next- 20251029?

I wonder if Fedora's build of gcc 15.2.1 is different somehow from the
build you're using....

#7 lore raw
Quoted 41 lines · Amit Dhingra
Quoted 16 lines · Timur Kristóf
Quoted 15 lines · Amit Dhingra
Quoted 4 lines

What do I need to do to trigger the warning?

I have the same problem.

linux-next on Arch Linux
GCC : 15.2.1 20250813

Steps to reproduce the error
- make mrproper
- make allmodconfig
- make drivers/gpu/drm/amd/amdgpu/

Quoted 6 lines
Quoted 3 lines

Turns out its due to randconfig, See [1]

Setting RANDSTRUCT_NONE=y seems to stop the error.

Can you please try and see if this fixes the warning?
https://pastebin.com/raw/b8j3UABj

The patch above defining all fields seems to fix the error.

Quoted 5 lines

Alternatively, if anyone has other recommendations on how to fix it,
I'm also open to suggestions.

What seemed to also work for me is to defining the struct as below without an initialization.

static const struct stream_encoder_funcs dce110_an_str_enc_funcs;

Its static so should be initialized zeroed out. objdump shows correct size
allocation.

Quoted 7 lines

objdump -x dce_stream_encoder.o

  0000000000000b60 l     O .rodata 0000000000000130
dce110_str_enc_funcs
  0000000000000a00 l     O .rodata 0000000000000130
dce110_an_str_enc_funcs

Thanks! This looks even cleaner.

I will submit a patch to fix the warning next week. Can I add your name and email to the Suggested-by tag?

Thanks,
Timur

Quoted 45 lines
Quoted 45 lines

Thanks,
Timur

Quoted 40 lines
Quoted 40 lines

Valdis Klētnieks <[email protected]> ezt írta (időpont:
2025.
nov.
2., Vas 1:59):

Quoted 34 lines · Timur Kristóf
Quoted 5 lines

Can you say how to reproduce that?
I use the same version of GCC but it hasn't given me any warning or
error for that patch.

Upon further testing,

[/usr/src/linux-next] make

is sufficient on my system. Turns out that it errors out even without W=1.
My
next guess was that it had to do with -Werror, which would cause
warnings
to
be treated as errors, but my .config has

# CONFIG_WERROR is not set
# CONFIG_DRM_WERROR is not set
# CONFIG_DRM_AMDGPU_WERROR is not set

Do you perhaps have patches in your tree that aren't in next- 20251029?

I wonder if Fedora's build of gcc 15.2.1 is different somehow from the
build you're using....

#9 lore raw
In reply to Amit Dhingra
Quoted 3 lines · Amit Dhingra

On Thu, Nov 06, 2025 at 03:40:52AM +0100, Timur Krist�f wrote:

The patch above defining all fields seems to fix the error.

The bigger question is whether that patch merely papers over a bug in the gcc plugin. Basically, why does the struct being one layout compile cleanly, but throws an error if the layout is randomized...

m>

#8 lore raw
In reply to Timur Kristóf
Quoted 50 lines · Timur Kristóf
Quoted 41 lines · Amit Dhingra
Quoted 16 lines · Timur Kristóf
Quoted 15 lines · Amit Dhingra
Quoted 4 lines

What do I need to do to trigger the warning?

I have the same problem.

linux-next on Arch Linux
GCC : 15.2.1 20250813

Steps to reproduce the error
- make mrproper
- make allmodconfig
- make drivers/gpu/drm/amd/amdgpu/

Quoted 6 lines
Quoted 3 lines

Turns out its due to randconfig, See [1]

Setting RANDSTRUCT_NONE=y seems to stop the error.

Can you please try and see if this fixes the warning?
https://pastebin.com/raw/b8j3UABj

The patch above defining all fields seems to fix the error.

Quoted 5 lines

Alternatively, if anyone has other recommendations on how to fix it,
I'm also open to suggestions.

What seemed to also work for me is to defining the struct as below without an initialization.

static const struct stream_encoder_funcs dce110_an_str_enc_funcs;

Its static so should be initialized zeroed out. objdump shows correct size
allocation.

Quoted 7 lines

objdump -x dce_stream_encoder.o

  0000000000000b60 l     O .rodata 0000000000000130
dce110_str_enc_funcs
  0000000000000a00 l     O .rodata 0000000000000130
dce110_an_str_enc_funcs

Quoted 4 lines

Thanks! This looks even cleaner.

I will submit a patch to fix the warning next week. Can I add your name and email to the Suggested-by tag?

Certainly. Thank you!!

Quoted 51 lines

Thanks,
Timur

Quoted 45 lines
Quoted 45 lines

Thanks,
Timur

Quoted 40 lines
Quoted 40 lines

Valdis Klētnieks <[email protected]> ezt írta (időpont:
2025.
nov.
2., Vas 1:59):

Quoted 34 lines · Timur Kristóf
Quoted 5 lines

Can you say how to reproduce that?
I use the same version of GCC but it hasn't given me any warning or
error for that patch.

Upon further testing,

[/usr/src/linux-next] make

is sufficient on my system. Turns out that it errors out even without W=1.
My
next guess was that it had to do with -Werror, which would cause
warnings
to
be treated as errors, but my .config has

# CONFIG_WERROR is not set
# CONFIG_DRM_WERROR is not set
# CONFIG_DRM_AMDGPU_WERROR is not set

Do you perhaps have patches in your tree that aren't in next- 20251029?

I wonder if Fedora's build of gcc 15.2.1 is different somehow from the
build you're using....

#11 lore raw
In reply to Valdis Kl=?utf-8?Q?=c4=93?=tnieks
Quoted 9 lines · Valdis Klētnieks
Quoted 6 lines · Amit Dhingra

I have the same problem.
...

Setting RANDSTRUCT_NONE=y seems to stop the error.

[1] https://lore.kernel.org/all/2025062439-tamer-diner-68e9@gregkh/

Quoted 7 lines

Wow. I wouldn't have guessed that RANDSTRUCT would be the cause... However, RANDSTRUCT_NONE=y does make dce_stream_encoder.c compile cleanly.

<insert Twilight Zone theme music here>

Adding Kees Cook and the linux-hardening list to the cc:, hope somebody has an idea what's going on.

I'm surprised the stable team didn't find the associated fix in your linked thread. It had the right Fixes tag:
https://lore.kernel.org/all/[email protected]/

Regardless, just remove the "0" from the dce110_an_str_enc_funcs initializer; that's an older code pattern that isn't needed any more.

Randstruct requires designated initializers, though I thought the macro turned that on universally, so the fact that the error is only present with randstruct seems like a separate bug.

-Kees

Signature · 1 line
Kees Cook
#12 lore raw
Quoted 13 lines · Kees Cook
Quoted 12 lines · Valdis Klētnieks
Quoted 6 lines · Amit Dhingra

I have the same problem.
...

Setting RANDSTRUCT_NONE=y seems to stop the error.

[1] https://lore.kernel.org/all/2025062439-tamer-diner-68e9@gregkh/

Wow. I wouldn't have guessed that RANDSTRUCT would be the cause... However, RANDSTRUCT_NONE=y does make dce_stream_encoder.c compile cleanly.

Quoted 8 lines
Quoted 4 lines

<insert Twilight Zone theme music here>

Adding Kees Cook and the linux-hardening list to the cc:, hope somebody has an idea what's going on.

I'm surprised the stable team didn't find the associated fix in your linked thread. It had the right Fixes tag:
https://lore.kernel.org/all/[email protected]/

FYI, their Fixes tag points to something that doesn't exist. I found it at SHA1 e136a4062174a9a8d1c1447ca040ea81accfa6a8 though.

Quoted 9 lines

Regardless, just remove the "0" from the dce110_an_str_enc_funcs initializer; that's an older code pattern that isn't needed any more.

Randstruct requires designated initializers, though I thought the macro turned that on universally, so the fact that the error is only present with randstruct seems like a separate bug.

-Kees

--
Kees Cook

#13 lore raw
In reply to Kees Cook
Quoted 3 lines · Kees Cook

Randstruct requires designated initializers, though I thought the macro turned that on universally, so the fact that the error is only present with randstruct seems like a separate bug.

Yeah, that's why I cc'ed you - looked to me like randstruct was doing something weird...

AA1@kern