[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#572512: module-init-tools: depmod unaligned trap on alpha

On 15/04/10 20:53, Marco d'Itri wrote:
On Apr 15, Meelis Roos<mroos@linux.ee>  wrote:

Please find out exactly which operation is causing the traps.
Are there any news?

I just found a moment to look at this:

Core was generated by `depmod -a'.
Program terminated with signal 10, Bus error.
#0  0x000000012000e34c in native_endianness () at ../util.c:205
205		return (char) *((uint32_t*)("\1\0\0\2"));
(gdb) bt
#0  0x000000012000e34c in native_endianness () at ../util.c:205
#1 0x000000012000738c in main (argc=2, argv=0x11facdc98) at ../depmod.c:1312
(gdb) list
200	int __attribute__ ((pure)) native_endianness()
201	{
202		/* Encoding the endianness enums in a string and then reading that
203 * string as a 32-bit int, returns the correct endianness automagically.
204		 */
205		return (char) *((uint32_t*)("\1\0\0\2"));
206	}

Yeah, nice programming guys.  Allocate a string, i.e. an array of
char, which the compiler will merely byte align and then read it
back as a long word which must be long word aligned.  And the
programmer thinks he is so smart that he descibes it
as "automagically"!  Doh.


Reply to: