Page MenuHomeFreeBSD

Fix build of atk0110 with base gcc on i386
ClosedPublic

Authored by dim on Jun 9 2018, 9:07 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, May 18, 2:53 PM
Unknown Object (File)
Sun, May 17, 9:19 AM
Unknown Object (File)
Sun, May 17, 3:24 AM
Unknown Object (File)
Sat, May 16, 11:52 AM
Unknown Object (File)
Fri, May 15, 4:12 PM
Unknown Object (File)
Wed, May 13, 12:05 AM
Unknown Object (File)
Mon, May 11, 12:26 PM
Unknown Object (File)
Sun, May 10, 4:09 PM
Subscribers

Details

Summary

Base gcc fails to compile sys/dev/acpi_support/atk0110.c for i386,
with the following -Werror warnings:

cc1: warnings being treated as errors
/usr/src/sys/dev/acpi_support/atk0110.c: In function 'aibs_sysctl':
/usr/src/sys/dev/acpi_support/atk0110.c:456: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/usr/src/sys/dev/acpi_support/atk0110.c: In function 'aibs_sysctl_ggrp':
/usr/src/sys/dev/acpi_support/atk0110.c:522: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
*** [atk0110.o] Error code 1

This is because on i386, the casts from SYSCTL_HANDLER_ARGS's arg2
(which is an intmax_t) to a pointer reduces the value from 64 bit to
32 bit.

For gcc, this can be fixed by an intermediate cast to intptr_t. Note
that I am assuming the incoming arg2 will always fit into 32 bit!

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 17125
Build 16981: arc lint + arc unit

Event Timeline

dim retitled this revision from Fix build of atk0110 with base gcc to Fix build of atk0110 with base gcc on i386.Jun 10 2018, 8:17 AM

Oops, I thought I approved this, but apparently it was "only" on IRC.
I hope that your commit message will not contain "assume" and instead will state that we indeed pass a pointer via means of uintmax_t (that must not be narrower than uintptr_t) as we discussed.

This revision is now accepted and ready to land.Jun 15 2018, 8:38 PM
This revision was automatically updated to reflect the committed changes.