16407 – [3.3/3.4 Regression] Unaligned access to local variables (original) (raw)

Description Richard Sandiford 2004-07-07 12:32:57 UTC

The following testcase causes an unaligned access when compiled with mips64-elf-gcc.

struct s { char c1, c2; }; void foo (struct s s) { static struct s s1; s1 = s; } int main () { static struct s s2; foo (s2); exit (0); }

The problem is that s1 and s2 are supposed to get word alignment, but their asm declarations don't guarantee this.

The bug dates back to at least 3.2.3, but not 3.0.4, which didn't take advantage of the extra alignment.