linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] btrfs-progs: GCC9 fixes
@ 2019-06-17  7:59 Qu Wenruo
  2019-06-17  7:59 ` [PATCH 1/4] btrfs-progs: constify extent buffer reader Qu Wenruo
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Qu Wenruo @ 2019-06-17  7:59 UTC (permalink / raw)
  To: linux-btrfs

This patchset will address the remaining warning when compiling
btrfs-progs devel branch with GCC9.

It's based on the following commit:
commit 9a1d86a9ac7384b332db498822585a2255f7d3e6 (david/devel)
Author: David Sterba <dsterba@suse.com>
Date:   Thu Jun 13 20:45:49 2019 +0200

    btrfs-progs: build: disable -Waddress-of-packed-member by default


Please note that the 2nd patch mostly replace commit 691656abdc9a
("btrfs-progs: fix gcc9 warning and potentially unaligned access to dev stats") by
backporing kernel btrfs_dev_stats_value() to btrfs-progs.
Thus the original fix can be removed.

The remaining warning is -Warray-boundary, but that one looks pretty
strange. The code looks good, and I backported an easy version:

  #include <stdio.h>
  #include <stdlib.h>
  #include <string.h>
  #include <stddef.h>
  
  struct test_struct {
  	long long off_0_7;
  	int	offset_8_11;
  	unsigned char offset_12_12;
  } __attribute__ ((packed));
  
  void reset_values(struct test_struct *ptr)
  {
  	memset(&ptr->offset_8_11, 0, sizeof(struct test_struct) - offsetof(struct test_struct, offset_8_11));
  }
  
  int main()
  {
  	struct test_struct my_struct = { 0xffff, 0xff, 0xff};
  
  	printf("struct=0x%llx start=0x%llx len=0x%x\n",
  		&my_struct, &my_struct.offset_8_11, sizeof(struct test_struct) - offsetof(struct test_struct, offset_8_11));
  	reset_values(&my_struct);
  	printf("0x%lx 0x%x 0x%x\n", my_struct.off_0_7, my_struct.offset_8_11, my_struct.offset_12_12);
  	return 0;
  }

Which doesn't reproduce the warning.
Thus looks like a false warning and a bug in gcc.

Qu Wenruo (4):
  btrfs-progs: constify extent buffer reader
  btrfs-progs: Fix -Waddress-of-packed-member warning in
    btrfs_dev_stats_values callers
  btrfs-progs: Remove unnecessary fallthrough attribute in
    test_num_disk_vs_raid()
  btrfs-progs: Fix Wformat-overflow warning in cmds-receive.c

 cmds-receive.c |  4 ++--
 ctree.h        | 13 +++++++++++++
 extent_io.c    |  4 ++--
 extent_io.h    |  4 ++--
 print-tree.c   | 21 ++++++---------------
 utils.c        |  1 -
 6 files changed, 25 insertions(+), 22 deletions(-)

-- 
2.22.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-06-18 13:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-17  7:59 [PATCH 0/4] btrfs-progs: GCC9 fixes Qu Wenruo
2019-06-17  7:59 ` [PATCH 1/4] btrfs-progs: constify extent buffer reader Qu Wenruo
2019-06-17  7:59 ` [PATCH 2/4] btrfs-progs: Fix -Waddress-of-packed-member warning in btrfs_dev_stats_values callers Qu Wenruo
2019-06-17  7:59 ` [PATCH 3/4] btrfs-progs: Remove unnecessary fallthrough attribute in test_num_disk_vs_raid() Qu Wenruo
2019-06-18 13:14   ` David Sterba
2019-06-17  7:59 ` [PATCH 4/4] btrfs-progs: Fix Wformat-overflow warning in cmds-receive.c Qu Wenruo
2019-06-18 13:20 ` [PATCH 0/4] btrfs-progs: GCC9 fixes David Sterba

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).