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)
Thu, Dec 25, 11:10 AM
Unknown Object (File)
Nov 27 2025, 6:07 PM
Unknown Object (File)
Nov 20 2025, 11:11 PM
Unknown Object (File)
Nov 20 2025, 11:10 PM
Unknown Object (File)
Nov 20 2025, 11:06 PM
Unknown Object (File)
Nov 20 2025, 10:58 PM
Unknown Object (File)
Nov 18 2025, 1:03 AM
Unknown Object (File)
Oct 21 2025, 11:30 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.