linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Arnd Bergmann <arnd@arndb.de>,
	Naresh Kamboju <naresh.kamboju@linaro.org>
Cc: open list <linux-kernel@vger.kernel.org>,
	linux-scsi@vger.kernel.org,
	linux-next <linux-next@vger.kernel.org>,
	Avri Altman <avri.altman@wdc.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Anders Roxell <anders.roxell@linaro.org>
Subject: 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: Tue, 1 Aug 2023 10:51:03 -0700	[thread overview]
Message-ID: <67f2a68f-8462-e1de-c016-b84d7c6e3222@acm.org> (raw)
In-Reply-To: <227327a3-399a-4a9f-a775-e9627656b5a1@app.fastmail.com>

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@acm.org> 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.

  reply	other threads:[~2023-08-01 17:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-01 12:16 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: Naresh Kamboju
2023-08-01 13:23 ` Bart Van Assche
2023-08-01 14:23   ` Naresh Kamboju
2023-08-01 14:56     ` Arnd Bergmann
2023-08-01 17:51       ` Bart Van Assche [this message]
2023-08-01 19:54         ` Arnd Bergmann
2023-08-01 20:15           ` Bart Van Assche

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=67f2a68f-8462-e1de-c016-b84d7c6e3222@acm.org \
    --to=bvanassche@acm.org \
    --cc=anders.roxell@linaro.org \
    --cc=arnd@arndb.de \
    --cc=avri.altman@wdc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=naresh.kamboju@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).