Bug 206665

Summary: ports-mgmt/pkg : 1.6.3 building for RPI2 (arm) gets: passing 'size_t *' (aka 'unsigned int *') to type 'off_t *' (aka 'long long *')
Product: Ports & Packages Reporter: Mark Millard <marklmi26-fbsd>
Component: Individual Port(s)Assignee: freebsd-pkg (Nobody) <pkg>
Status: Closed FIXED    
Severity: Affects Only Me CC: bernd
Priority: --- Keywords: needs-qa
Version: LatestFlags: bugzilla: maintainer-feedback? (pkg)
Hardware: arm   
OS: Any   

Description Mark Millard 2016-01-27 08:34:47 UTC
On the RPI2B (arm) build for my context there are incompatible pointer types in use when I try to build the 1.6.3 port: size_t and off_t are different types: unsigned int vs. long long. So the file_to_buffer use is odd:

pkg_add.c:121:39: warning: incompatible pointer types passing 'size_t *' (aka 'unsigned int *') to parameter of type 'off_t *' (aka 'long long *') [-Wincompatible-pointer-types]
        file_to_buffer(pathname, &localconf, &sz);
                                             ^~~
./private/utils.h:77:50: note: passing argument to parameter here
int file_to_buffer(const char *, char **, off_t *);

pkg_ports.c:382:39: warning: incompatible pointer types passing 'size_t *' (aka 'unsigned int *') to parameter of type 'off_t *' (aka 'long long *') [-Wincompatible-pointer-types]
                        file_to_buffer(testpath, &content, &sz);
                                                           ^~~
./private/utils.h:77:50: note: passing argument to parameter here
int file_to_buffer(const char *, char **, off_t *);


Of note is that I'm working on a RPI2B and everything from buildworld/buildkernel to ports in my build activities are targeting the armv7-a/cortex-a7 that an RPI2B has, not a more generic armv6. Also I'm using projects/clang380-import because clang++ 3.7.1 Bus Errors during most C++ compiles in this RPI2B context. 3.8.0 has a bunch of alignment fixes in it to allow use with SCTLR Bit[1]==1 on arm (and on sparc's that require alignment).



As for the details of my targeting armv7-a and cortex-a7, I show some of the checking output that shows the command's arguments for such:

checking for /usr/bin/clang -target armv6--freebsd11.0-gnueabi -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=softfp -mno-unaligned-access option to accept ISO C99... none needed
. . .
checking if /usr/bin/clang -target armv6--freebsd11.0-gnueabi -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=softfp -mno-unaligned-access supports -fno-rtti -fno-exceptions... yes
checking for /usr/bin/clang -target armv6--freebsd11.0-gnueabi -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=softfp -mno-unaligned-access option to produce PIC... -fPIC -DPIC
checking if /usr/bin/clang -target armv6--freebsd11.0-gnueabi -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=softfp -mno-unaligned-access PIC flag -fPIC -DPIC works... yes
checking if /usr/bin/clang -target armv6--freebsd11.0-gnueabi -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=softfp -mno-unaligned-access static flag -static works... yes
checking if /usr/bin/clang -target armv6--freebsd11.0-gnueabi -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=softfp -mno-unaligned-access supports -c -o file.o... yes
checking if /usr/bin/clang -target armv6--freebsd11.0-gnueabi -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=softfp -mno-unaligned-access supports -c -o file.o... (cached) yes


Side note. . .

There are some other warnings as well, tied to shifting negative, signed quantities. I show a few below.

utils.c:281:12: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
        if (opt & INFO_RAW) {
                  ^~~~~~~~
./pkgcli.h:243:24: note: expanded from macro 'INFO_RAW'
#define INFO_RAW                (-1LL<<63)
                                 ~~~~^
. . .
utils.c:322:22: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
                switch (options & (INFO_RAW_YAML|INFO_RAW_JSON|INFO_RAW_JSON_COMPACT|INFO_RAW_UCL)) {
                                   ^~~~~~~~~~~~~
./pkgcli.h:244:29: note: expanded from macro 'INFO_RAW_YAML'
#define INFO_RAW_YAML           (-1LL<<62)
                                 ~~~~^
utils.c:322:36: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
                switch (options & (INFO_RAW_YAML|INFO_RAW_JSON|INFO_RAW_JSON_COMPACT|INFO_RAW_UCL)) {
                                                 ^~~~~~~~~~~~~
./pkgcli.h:245:29: note: expanded from macro 'INFO_RAW_JSON'
#define INFO_RAW_JSON           (-1LL<<61)
                                 ~~~~^
utils.c:322:50: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
                switch (options & (INFO_RAW_YAML|INFO_RAW_JSON|INFO_RAW_JSON_COMPACT|INFO_RAW_UCL)) {
                                                               ^~~~~~~~~~~~~~~~~~~~~
./pkgcli.h:246:36: note: expanded from macro 'INFO_RAW_JSON_COMPACT'
#define INFO_RAW_JSON_COMPACT   (-1LL<<60)
                                 ~~~~^
utils.c:322:72: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
                switch (options & (INFO_RAW_YAML|INFO_RAW_JSON|INFO_RAW_JSON_COMPACT|INFO_RAW_UCL)) {
                                                                                     ^~~~~~~~~~~~
./pkgcli.h:247:28: note: expanded from macro 'INFO_RAW_UCL'
#define INFO_RAW_UCL            (-1LL<<59)
                                 ~~~~^
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2016-01-27 08:41:13 UTC
Thank you for your report Mark :)

Was pkg building successfully prior to 1.6.3?

Also, please use attachments for build logs, large bodies or text, diffs, settings or configuration files instead of comments, as it allows conversations to be followed much easier
Comment 2 Mark Millard 2016-01-27 09:04:39 UTC
(In reply to Kubilay Kocak from comment #1)

This was the very first time that I've built pkg as a port on the RPI2B (arm). The unsigned int* vs. long long* warning did not stop the build but look problematical to me.

My powerpc64 (PowerMac) and amd64 history would be less likely to generate such a warning and if they did I did not notice historically.

A powerpc (32-bit PowerMac) might get the warnings but I've not done any port building activity there for a very long time. It would add big endian to the mix (RPI2B arms being set up for little endian). Big endian long long (64 bit) getting a big endian long int (32 bit) for the same address is more likely to be problematical:  the 32 bits ends up as the most significant part of the 64 bits.


Sorry if the extractions from the log were too long for a description.
Comment 3 Baptiste Daroussin freebsd_committer freebsd_triage 2016-02-10 22:58:11 UTC
this is fixed in master will be in pkg 1.6.4
Comment 4 Mark Millard 2016-02-12 02:17:52 UTC
(In reply to Baptiste Daroussin from comment #3)

I did svnlite update -r408706 /usr/ports on the rpi2 and then portupgrade pkg on it. During this processing I still got text about:

incompatible pointer types passing 'size_t *' (aka 'unsigned int *') to parameter of type 'off_t *' (aka 'long long *')
Comment 5 Baptiste Daroussin freebsd_committer freebsd_triage 2016-05-22 15:21:56 UTC
is it still an issue with pkg 1.8 (released today?)
Comment 6 Mark Millard 2016-05-29 08:37:58 UTC
(In reply to Baptiste Daroussin from comment #5)

I've only tried powerpc so far, not armv6/armv7a, but when I updated to /usr/ports -r415649 and rebuilt pkg the size_t* vs. off_t* warning messages were not generated. (On -r411420 the messages were produced so it is a change for powerpc.)

-r415739 also did not get the warnings.

(armv7a is pending my updating to a hardfloat 11.0 vintage that also allows more misalignments.)