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)
Dec 20 2023, 4:50 AM
Unknown Object (File)
Nov 1 2023, 4:58 AM
Unknown Object (File)
Sep 6 2023, 5:05 AM
Unknown Object (File)
Sep 6 2023, 5:04 AM
Unknown Object (File)
Sep 6 2023, 5:04 AM
Unknown Object (File)
Sep 1 2023, 3:51 AM
Unknown Object (File)
Jun 26 2023, 11:00 PM
Unknown Object (File)
Jun 15 2023, 6:59 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 Not Applicable
Unit
Tests Not Applicable

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.