All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Garzarella <sgarzare@redhat.com>
To: "Thomas Huth" <thuth@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Janosch Frank" <frankja@linux.ibm.com>,
	"Cornelia Huck" <cohuck@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	qemu-devel <qemu-devel@nongnu.org>,
	"Christian Borntraeger" <borntraeger@de.ibm.com>,
	qemu-s390x <qemu-s390x@nongnu.org>
Subject: Re: s390-ccw: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
Date: Fri, 23 Apr 2021 08:40:01 +0200	[thread overview]
Message-ID: <20210423064001.fjouibdcwadtgijy@steredhat> (raw)
In-Reply-To: <fb127bc3-aa4a-dc04-484a-d747c3aa503e@redhat.com>

On Thu, Apr 22, 2021 at 06:54:21PM +0200, Philippe Mathieu-Daudé wrote:
>On 4/22/21 6:07 PM, Thomas Huth wrote:
>> On 22/04/2021 17.52, Stefano Garzarella wrote:
>>> On Thu, Apr 22, 2021 at 05:38:26PM +0200, Thomas Huth wrote:
>>>> On 22/04/2021 16.31, Philippe Mathieu-Daudé wrote:
>>>>> On 4/22/21 2:41 PM, Christian Borntraeger wrote:
>>>>>> On 22.04.21 13:47, Thomas Huth wrote:
>>>>>>> On 22/04/2021 13.24, Philippe Mathieu-Daudé wrote:
>>>>>>>> On 4/22/21 12:30 PM, Peter Maydell wrote:
>>>>>>>>> On Thu, 22 Apr 2021 at 11:18, Daniel P. Berrangé
>>>>>>>>> <berrange@redhat.com> wrote:
>>>>>
>>>>>>>> This silents the warning however:
>>>>>>>>
>>>>>>>> -- >8 --
>>>>>>>> diff --git a/pc-bios/s390-ccw/libc.h b/pc-bios/s390-ccw/libc.h
>>>>>>>> index bcdc45732d..2dea399904 100644
>>>>>>>> --- a/pc-bios/s390-ccw/libc.h
>>>>>>>> +++ b/pc-bios/s390-ccw/libc.h
>>>>>>>> @@ -19,6 +19,8 @@ typedef unsigned short     uint16_t;
>>>>>>>>   typedef unsigned int       uint32_t;
>>>>>>>>   typedef unsigned long long uint64_t;
>>>>>>>>
>>>>>>>> +#pragma GCC diagnostic push
>>>>>>>> +#pragma GCC diagnostic ignored "-Wstringop-overflow"
>>>>>>>>   static inline void *memset(void *s, int c, size_t n)
>>>>>>>>   {
>>>>>>>>       size_t i;
>>>>>>>> @@ -30,6 +32,7 @@ static inline void *memset(void *s, int c,
>>>>>>>> size_t n)
>>>>>>>>
>>>>>>>>       return s;
>>>>>>>>   }
>>>>>>>> +#pragma GCC diagnostic pop
>>>>>>>
>>>>>>> Honestly, that compiler "bug" sounds like it could trigger at any
>>>>>>> other spot in the bios code, too, since we are doing lots of direct
>>>>>>> accesses to low memory there. I think it's likely best if we shut it
>>>>>>> off with -Wno-stringop-overflow in the pc-bios/s390-ccw/Makefile ...
>>>>>>> could you please try to add it there?
>>>>>>
>>>>>
>>>>> We are good with:
>>>>>
>>>>> -- >8 --
>>>>> diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile
>>>>> index 29fd9019b8..dcec09b6f9 100644
>>>>> --- a/pc-bios/s390-ccw/Makefile
>>>>> +++ b/pc-bios/s390-ccw/Makefile
>>>>> @@ -8,6 +8,9 @@ CFLAGS = -O2 -g
>>>>>  quiet-command = $(if $(V),$1,$(if $(2),@printf "  %-7s %s\n" $2 $3 &&
>>>>> $1, @$1))
>>>>>  cc-option = $(if $(shell $(CC) $1 -S -o /dev/null -xc /dev/null >
>>>>> /dev/null \
>>>>>               2>&1 && echo OK), $1, $2)
>>>>> +cc-c-option = $(if $(shell $(CC) $1 $2 -c -o /dev/null -xc /dev/null \
>>>>> +                >/dev/null 2>&1 && echo OK), $2, $3)
>>>>>
>>>>>  VPATH_SUFFIXES = %.c %.h %.S %.m %.mak %.sh %.rc Kconfig% %.json.in
>>>>>  set-vpath = $(if $1,$(foreach PATTERN,$(VPATH_SUFFIXES),$(eval vpath
>>>>> $(PATTERN) $1)))
>>>>> @@ -30,6 +33,7 @@ OBJECTS = start.o main.o bootmap.o jump2ipl.o sclp.o
>>>>> menu.o \
>>>>>           virtio.o virtio-scsi.o virtio-blkdev.o libc.o cio.o
>>>>> dasd-ipl.o
>>>>>
>>>>>  QEMU_CFLAGS := -Wall $(filter -W%, $(QEMU_CFLAGS))
>>>>> +QEMU_CFLAGS += $(call cc-c-option, $(QEMU_CFLAGS),
>>>>> -Wno-stringop-overflow)
>>>>>  QEMU_CFLAGS += -ffreestanding -fno-delete-null-pointer-checks
>>>>
>>>> I think you don't need the "cc-c-option" magic here. Just add the
>>>> -Wno-stringop-overflow. All supported versions of GCC and Clang
>>>> simply silently ignore unknown -Wno-something options (try e.g. "gcc
>>>> -Wno-yadayadayada" on the command line).
>>>
>>> Clang seems not to like it. It's always a mess to do anything for gcc
>>> and clang :-(
>
>I didn't know we could build s390-ccw with clang.
>
>Not with clang-12:
>
>clang version 12.0.0 (Fedora 12.0.0-0.3.rc1.fc34)
>
>warning: unknown warning option '-Wold-style-declaration'; did you mean
>'-Wout-of-line-declaration'? [-Wunknown-warning-option]
>warning: unknown warning option '-Wimplicit-fallthrough=2'; did you mean
>'-Wimplicit-fallthrough'? [-Wunknown-warning-option]
>warning: unknown warning option '-Wno-stringop-overflow'; did you mean
>'-Wno-shift-overflow'? [-Wunknown-warning-option]
>warning: unknown warning option '-Wold-style-declaration'; did you mean
>'-Wout-of-line-declaration'? [-Wunknown-warning-option]
>warning: unknown warning option '-Wimplicit-fallthrough=2'; did you mean
>'-Wimplicit-fallthrough'? [-Wunknown-warning-option]
>warning: unknown warning option '-Wno-stringop-overflow'; did you mean
>'-Wno-shift-overflow'? [-Wunknown-warning-option]
>error: unknown target CPU 'z900'
>note: valid target CPU values are: arch8, z10, arch9, z196, arch10,
>zEC12, arch11, z13, arch12, z14, arch13, z15

Ah, I didn't know that, I just tried the unknown -Wno-yadayadayada :-)

>
>>> Maybe we can set also `-Wno-unknown-warning-option`.
>>>
>>> $ clang -Wno-stringop-overflow -Werror main.c
>>> error: unknown warning option '-Wno-stringop-overflow'; did you mean
>>> '-Wno-shift-overflow'? [-Werror,-Wunknown-warning-option]
>>
>> D'oh, I was pretty sure that Clang behaves the same with regards to
>> -Wno-something, but seems I was wrong, sorry.

Np :-) I'm always confused between gcc and clang...

>>
>> So I think we should simply keep this v1 of Philippe's patch.
>>

Yep, I agree.

Thanks,
Stefano



  reply	other threads:[~2021-04-23  6:41 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-22  4:18 s390-ccw: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=] Philippe Mathieu-Daudé
2021-04-22  4:47 ` Thomas Huth
2021-04-22  6:04   ` Christian Borntraeger
2021-04-22 10:15   ` Daniel P. Berrangé
2021-04-22 10:30     ` Peter Maydell
2021-04-22 11:24       ` Philippe Mathieu-Daudé
2021-04-22 11:47         ` Thomas Huth
2021-04-22 12:41           ` Christian Borntraeger
2021-04-22 14:31             ` Philippe Mathieu-Daudé
2021-04-22 15:38               ` Thomas Huth
2021-04-22 15:43                 ` Philippe Mathieu-Daudé
2021-04-22 15:52                 ` Stefano Garzarella
2021-04-22 16:07                   ` Thomas Huth
2021-04-22 16:54                     ` Philippe Mathieu-Daudé
2021-04-23  6:40                       ` Stefano Garzarella [this message]
2021-04-23  6:52                         ` Christian Borntraeger
2021-04-23  7:57                           ` Compiling the s390-ccw bios with clang (was: Re: s390-ccw: warning: writing 1 byte into a region of size 0) Thomas Huth
2021-04-23  8:05                             ` Compiling the s390-ccw bios with clang Christian Borntraeger
2021-04-23  8:07                             ` Compiling the s390-ccw bios with clang (was: Re: s390-ccw: warning: writing 1 byte into a region of size 0) Cornelia Huck
2021-04-23  8:22                               ` Thomas Huth
2021-04-23  8:47                                 ` Daniel P. Berrangé
2021-04-23  8:52                                   ` Thomas Huth
2021-04-23  9:00                                     ` Daniel P. Berrangé
2021-04-22 11:48         ` s390-ccw: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=] Daniel P. Berrangé
2021-04-22 14:34           ` Philippe Mathieu-Daudé

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=20210423064001.fjouibdcwadtgijy@steredhat \
    --to=sgarzare@redhat.com \
    --cc=berrange@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.