https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102162
--- Comment #1 from John David Anglin <danglin at gcc dot gnu.org> --- Created attachment 51395 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51395&action=edit Second test case Changing the optimization of get_unaligned_le32 to 0 results in correct code generation. We have the following in test-unaligned.c.235t.optimized: ave@atlas:~/linux/misc$ cat test-unaligned.c.235t.optimized ;; Function get_unaligned_le32 (get_unaligned_le32, funcdef_no=0, decl_uid=1506, cgraph_uid=1, symbol_order=1) __attribute__((optimize (0))) get_unaligned_le32 (const void * p) { const struct { u32 x; } * __pptr; u32 D.1517; u32 _4; <bb 2> : __pptr_2 = p_1(D); _4 = __pptr_2->x; <bb 3> : <L0>: return _4; } ;; Function test (test, funcdef_no=1, decl_uid=1512, cgraph_uid=2, symbol_order=2) test () { unsigned int _1; int _4; <bb 2> [local count: 1073741824]: _1 = get_unaligned_le32 (&output_len); [tail call] _4 = (int) _1; return _4; }