Re: next: arm64: gcc-8-defconfig: ufshcd.c:10629:2: /builds/linux/include/linux/compiler_types.h:397:38: error: call to '__compiletime_assert_553' declared with attribute error: BUILD_BUG_ON failed:

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/1/23 07:56, Arnd Bergmann wrote:
On Tue, Aug 1, 2023, at 16:23, Naresh Kamboju wrote:
On Tue, 1 Aug 2023 at 18:53, Bart Van Assche <bvanassche@xxxxxxx> wrote:

   - https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20230801/testrun/18754886/suite/build/test/gcc-8-defconfig/log
   - https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20230801/testrun/18754886/suite/build/test/gcc-8-defconfig/details/
   - https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20230801/testrun/18754886/suite/build/test/gcc-8-defconfig/history/

I can't reproduce this build error with a gcc-12 arm64 cross-compiler. How
important is gcc-8 for the ARM community?

You are right,
gcc-12 build pass.
gcc-8 build failed.

I can also reproduce this with gcc-9.5.0 from
https://mirrors.edge.kernel.org/pub/tools/crosstool/ but
not with 10.5.0 or clang.

I get the same results for x86 with gcc-9.5.0.

See https://godbolt.org/z/GjGrW9znc for a partially reduced testcase.
Thanks Arnd, this is very helpful. The first error message reported for that
test case is as follows:

<source>:34:286: error: call to '__compiletime_assert_655' declared with attribute error: BUILD_BUG_ON failed: ((u8 *)&(struct request_desc_header){ .enable_crypto = 1})[2] != 0x80
   34 |  do { __attribute__((__noreturn__)) extern void __compiletime_assert_655(void) __attribute__((__error__("BUILD_BUG_ON failed: " "((u8 *)&(struct request_desc_header){ .enable_crypto = 1})[2] != 0x80")));
 if (!(!(((u8 *)&(struct request_desc_header){ .enable_crypto = 1})[2] != 0x80))) __compiletime_assert_655(); } while (0);
      |

If I change the return type of ufshcd_check_header_layout() from void
into unsigned int and insert the following at the start of that function:

return ((u8 *)&(struct request_desc_header){ .enable_crypto = 1})[2] != 0x80;

then the compiler shows the following in the output window:

xorl    %eax, %eax

In other words, the expression next to the return statement evaluates to zero
but the same expression does not evaluate to zero in the BUILD_BUG_ON()
statement. Does this perhaps indicate a compiler bug? And if so, what is the
appropriate way to fix the build error? Insert an #ifdef/#endif pair inside
ufshcd_check_header_layout() such that the compile-time checks do not happen
for gcc version 9 or older?

Thanks,

Bart.



[Index of Archives]     [Linux Kernel]     [Linux USB Development]     [Yosemite News]     [Linux SCSI]

  Powered by Linux