[coreboot] [PATCH]AMDHT misbehaves on recent compilers

Patrick Georgi patrick at georgi-clan.de
Wed Jan 6 11:01:39 CET 2010


Hi,

src/northbridge/amdht/ht_wrapper.c miscompiles on recent compilers
(gcc-4.4.1 in crossgcc for example). The compiler is correct in what it
does, our code isn't.

The issue is that with recent compilers swaplist is generated on the
stack, and then a pointer to that structure on stack is passed around.
The data is nearly immediately destroyed by subsequent calls.

The "const" modifier only makes the compiler ensure that no write
operations are made to the data, but says nothing about the life cycle.
To force the compiler to keep the array in read-only memory, it must be
global const or static const.

Thanks go to Myles for isolating the problem.

Signed-off-by: Patrick Georgi <patrick.georgi at coresystems.de>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 20100106-1-bug-in-amdht
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20100106/9b174114/attachment.ksh>


More information about the coreboot mailing list