Page MenuHomeFreeBSD

Fix build of si with base gcc on i386
ClosedPublic

Authored by dim on Jun 11 2018, 8:21 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 25, 6:53 AM
Unknown Object (File)
Thu, Dec 25, 2:36 AM
Unknown Object (File)
Wed, Dec 24, 1:05 AM
Unknown Object (File)
Dec 17 2025, 10:23 PM
Unknown Object (File)
Nov 24 2025, 10:44 AM
Unknown Object (File)
Nov 21 2025, 1:55 AM
Unknown Object (File)
Nov 21 2025, 1:53 AM
Unknown Object (File)
Nov 21 2025, 1:51 AM
Subscribers

Details

Summary

Base gcc fails to compile sys/dev/si/si_isa.c and
sys/dev/si/si_pci.c for i386, with the following -Werror warnings:

cc1: warnings being treated as errors
/usr/src/sys/modules/si/../../dev/si/si_isa.c: In function 'si_isa_probe':
/usr/src/sys/modules/si/../../dev/si/si_isa.c:68: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/usr/src/sys/modules/si/../../dev/si/si_isa.c: In function 'si_isa_attach':
/usr/src/sys/modules/si/../../dev/si/si_isa.c:282: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

cc1: warnings being treated as errors
/usr/src/sys/modules/si/../../dev/si/si_pci.c: In function 'si_pci_attach':
/usr/src/sys/modules/si/../../dev/si/si_pci.c:89: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

This is because on i386, the casts from rman_res_t (aka uintmax_t)
to a pointer reduces the value from 64 bit to 32 bit.

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

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Btw, this will be a direct commit to stable/11, since si was removed from head.

Ok I guess. This driver was a dumpster fire. I had patches to fix things like this but no one tested them. This bandaid is probably fine.

This revision is now accepted and ready to land.Jun 13 2018, 5:53 PM
This revision was automatically updated to reflect the committed changes.