Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

buildworld broke in sbin/nvmecontrol; r240620 suspected

2 views
Skip to first unread message

David Wolfskill

unread,
Sep 18, 2012, 8:53:03 AM9/18/12
to
This was on:

FreeBSD g1-227.catwhisker.org 10.0-CURRENT FreeBSD 10.0-CURRENT #681 240597M: Mon Sep 17 15:34:41 PDT 2012 ro...@d134.dwolf.juniper.net.:/usr/obj/usr/src/sys/CANARY i386

using clang as the C compiler:

...
===> sbin/nvmecontrol (all)
clang -O2 -pipe -std=gnu99 -Qunused-arguments -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -c /usr/src/sbin/nvmecontrol/nvmecontrol.c
/usr/src/sbin/nvmecontrol/nvmecontrol.c:77:6: error: cast from 'struct nvme_controller_data *' to 'uint32_t *' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Werror,-Wcast-align]
p = (uint32_t *)cdata;
^~~~~~~~~~~~~~~~~
1 error generated.
*** [nvmecontrol.o] Error code 1
1 error
*** [all] Error code 2
1 error
*** [sbin.all__D] Error code 2

Peace,
david
--
David H. Wolfskill da...@catwhisker.org
Depriving a girl or boy of an opportunity for education is evil.

See http://www.catwhisker.org/~david/publickey.gpg for my public key.

Garrett Cooper

unread,
Sep 18, 2012, 11:28:24 AM9/18/12
to
On Sep 18, 2012, at 5:53 AM, David Wolfskill <da...@catwhisker.org> wrote:

> This was on:
>
> FreeBSD g1-227.catwhisker.org 10.0-CURRENT FreeBSD 10.0-CURRENT #681 240597M: Mon Sep 17 15:34:41 PDT 2012 ro...@d134.dwolf.juniper.net.:/usr/obj/usr/src/sys/CANARY i386
>
> using clang as the C compiler:
>
> ...
> ===> sbin/nvmecontrol (all)
> clang -O2 -pipe -std=gnu99 -Qunused-arguments -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -c /usr/src/sbin/nvmecontrol/nvmecontrol.c
> /usr/src/sbin/nvmecontrol/nvmecontrol.c:77:6: error: cast from 'struct nvme_controller_data *' to 'uint32_t *' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Werror,-Wcast-align]
> p = (uint32_t *)cdata;
> ^~~~~~~~~~~~~~~~~
> 1 error generated.
> *** [nvmecontrol.o] Error code 1
> 1 error
> *** [all] Error code 2
> 1 error
> *** [sbin.all__D] Error code 2

Probably should be using memcpy for that.
Thanks!
-Garrett_______________________________________________
freebsd...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-curre...@freebsd.org"

Dimitry Andric

unread,
Sep 18, 2012, 1:01:35 PM9/18/12
to
On 2012-09-18 14:53, David Wolfskill wrote:
...
> using clang as the C compiler:
>
> ...
> ===> sbin/nvmecontrol (all)
> clang -O2 -pipe -std=gnu99 -Qunused-arguments -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -c /usr/src/sbin/nvmecontrol/nvmecontrol.c
> /usr/src/sbin/nvmecontrol/nvmecontrol.c:77:6: error: cast from 'struct nvme_controller_data *' to 'uint32_t *' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Werror,-Wcast-align]
> p = (uint32_t *)cdata;
> ^~~~~~~~~~~~~~~~~

Since this tool (nvmecontrol) is currently only compiled for amd64 and
i386, we might as well ignore these alignment warnings, or cast them
away.

Jim, I don't expect this tool to ever be applicable to non-x86 arches,
but can you please confirm that?

Jim Harris

unread,
Sep 18, 2012, 1:09:54 PM9/18/12
to
On Tue, Sep 18, 2012 at 8:28 AM, Garrett Cooper <yane...@gmail.com> wrote:
> On Sep 18, 2012, at 5:53 AM, David Wolfskill <da...@catwhisker.org> wrote:
>
>> This was on:
>>
>> FreeBSD g1-227.catwhisker.org 10.0-CURRENT FreeBSD 10.0-CURRENT #681 240597M: Mon Sep 17 15:34:41 PDT 2012 ro...@d134.dwolf.juniper.net.:/usr/obj/usr/src/sys/CANARY i386
>>
>> using clang as the C compiler:
>>
>> ...
>> ===> sbin/nvmecontrol (all)
>> clang -O2 -pipe -std=gnu99 -Qunused-arguments -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -c /usr/src/sbin/nvmecontrol/nvmecontrol.c
>> /usr/src/sbin/nvmecontrol/nvmecontrol.c:77:6: error: cast from 'struct nvme_controller_data *' to 'uint32_t *' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Werror,-Wcast-align]
>> p = (uint32_t *)cdata;
>> ^~~~~~~~~~~~~~~~~
>> 1 error generated.
>> *** [nvmecontrol.o] Error code 1
>> 1 error
>> *** [all] Error code 2
>> 1 error
>> *** [sbin.all__D] Error code 2
>
> Probably should be using memcpy for that.
> Thanks!
> -Garrett

I think adding __aligned(4) to struct nvme_controller_data is the better way
to go. This structure is already marked as __packed which seems to
cause clang to think the structure could be unaligned. I've confirmed
this fixes the issue.

An an FYI - If I remove the __packed specifier (and do not add __aligned),
clang compiles without nvmecontrol without warning as well.

Regards,

-Jim

Adrian Chadd

unread,
Sep 18, 2012, 1:35:20 PM9/18/12
to
On 18 September 2012 10:01, Dimitry Andric <d...@freebsd.org> wrote:
> Since this tool (nvmecontrol) is currently only compiled for amd64 and
> i386, we might as well ignore these alignment warnings, or cast them
> away.
>
> Jim, I don't expect this tool to ever be applicable to non-x86 arches,
> but can you please confirm that?

Oh dear lordie, please don't assume that code/hardware won't be
recycled for other arches. I thought we had figured that stuff out for
2012. :-)



Adrian

Jim Harris

unread,
Sep 18, 2012, 2:24:27 PM9/18/12
to
On Tue, Sep 18, 2012 at 5:53 AM, David Wolfskill <da...@catwhisker.org> wrote:
> This was on:
>
> FreeBSD g1-227.catwhisker.org 10.0-CURRENT FreeBSD 10.0-CURRENT #681 240597M: Mon Sep 17 15:34:41 PDT 2012 ro...@d134.dwolf.juniper.net.:/usr/obj/usr/src/sys/CANARY i386
>
> using clang as the C compiler:
>
> ...
> ===> sbin/nvmecontrol (all)
> clang -O2 -pipe -std=gnu99 -Qunused-arguments -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -c /usr/src/sbin/nvmecontrol/nvmecontrol.c
> /usr/src/sbin/nvmecontrol/nvmecontrol.c:77:6: error: cast from 'struct nvme_controller_data *' to 'uint32_t *' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Werror,-Wcast-align]
> p = (uint32_t *)cdata;
> ^~~~~~~~~~~~~~~~~
> 1 error generated.
> *** [nvmecontrol.o] Error code 1
> 1 error
> *** [all] Error code 2
> 1 error
> *** [sbin.all__D] Error code 2

Fixed in r240671.

On a related note, r240672 fixes a build warning in nvme(4), found
only with clang.

> Peace,
> david
> --
> David H. Wolfskill da...@catwhisker.org
> Depriving a girl or boy of an opportunity for education is evil.
>
> See http://www.catwhisker.org/~david/publickey.gpg for my public key.
0 new messages