From: Jens Axboe <axboe@kernel.dk>
To: Bart Van Assche <bvanassche@acm.org>
Cc: fio@vger.kernel.org, Damien Le Moal <damien.lemoal@wdc.com>
Subject: Re: [PATCH 3/5] Refine packed annotations in stat.h
Date: Mon, 12 Aug 2019 20:53:54 -0600 [thread overview]
Message-ID: <cfaf773a-8fe0-ceaa-3b7d-bbfe7116e2bf@kernel.dk> (raw)
In-Reply-To: <20190813020136.15798-4-bvanassche@acm.org>
On 8/12/19 8:01 PM, Bart Van Assche wrote:
> Instead of declaring the whole structure packed, only declare non-aligned
> members packed. This patch is an alternative way to fix the following gcc 9
> compiler warnings:
>
> eta.c: In function 'calc_thread_status':
> eta.c:510:7: error: taking address of packed member of 'struct jobs_eta' may result in an unaligned pointer value [-Werror=address-of-packed-member]
> 510 | je->rate);
> | ~~^~~~~~
> eta.c:522:66: error: taking address of packed member of 'struct jobs_eta' may result in an unaligned pointer value [-Werror=address-of-packed-member]
> 522 | calc_rate(unified_rw_rep, disp_time, io_bytes, disp_io_bytes, je->rate);
> | ~~^~~~~~
> eta.c:523:64: error: taking address of packed member of 'struct jobs_eta' may result in an unaligned pointer value [-Werror=address-of-packed-member]
> 523 | calc_iops(unified_rw_rep, disp_time, io_iops, disp_io_iops, je->iops);
> |
This seems fragile. Not that we change the struct all the time, or even often,
but it'd be easy to add members and end up with different layout on 32-bit
vs 64-bit.
How do we improve on that?
--
Jens Axboe
next prev parent reply other threads:[~2019-08-13 2:53 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-13 2:01 [PATCH 0/5] Five fio patches Bart Van Assche
2019-08-13 2:01 ` [PATCH 1/5] Optimize the code that copies strings Bart Van Assche
2019-08-13 2:01 ` [PATCH 2/5] Verify the size of struct jobs_eta at compile time Bart Van Assche
2019-08-13 2:01 ` [PATCH 3/5] Refine packed annotations in stat.h Bart Van Assche
2019-08-13 2:53 ` Jens Axboe [this message]
2019-08-13 15:12 ` Bart Van Assche
2019-08-13 20:25 ` Jens Axboe
2019-08-13 20:51 ` Bart Van Assche
2019-08-13 21:04 ` Jens Axboe
2019-08-13 21:46 ` Bart Van Assche
2019-08-13 2:01 ` [PATCH 4/5] Revert "eta: Fix compiler warning" Bart Van Assche
2019-08-13 2:01 ` [PATCH 5/5] make test: Also run zbd tests Bart Van Assche
2019-08-13 4:39 ` Sitsofe Wheeler
2019-08-13 15:06 ` Bart Van Assche
2019-08-13 20:10 ` Sitsofe Wheeler
2019-08-13 20:22 ` Jens Axboe
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=cfaf773a-8fe0-ceaa-3b7d-bbfe7116e2bf@kernel.dk \
--to=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=damien.lemoal@wdc.com \
--cc=fio@vger.kernel.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