On Fri, 2022-12-02 at 14:04 +0000, Scott Ashcroft wrote: > Hi, > > I agree if you only read the C then the code looks fine, if a bit > odd. > However, having looked at the coredump with gdb it seems the compiler > optomises the dereference out and passes back a pointer to the soon > to > be invalid stack address rather than the value. > It only crashes with the stack protection on and I initially > struggled > to reproduce the issue as I was using the upstream compiler flags. > > It isn't even handling endianness conversions as it copies the bytes > in > the same order they come in. I think their idea was to support > architectures where you can't access an 32-bit int at an odd address. > > I'll try you patch and report back.
The patch works! It does give a build warning due to the return type of sizeof being a size_t not an int. If you chnage it to: for (size_t i = 0; i < sizeof(u.u8); i++) then everything is fine. The files produced by running the grom test match exactly those from your packaged x86_64 version. Cheers, Scott -- debian-science-maintainers mailing list [email protected] https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/debian-science-maintainers
