When compiling the attached C code with gcc 4.4.1 [gcc-4_4-branch revision
150839] w/ -O2 -fstrict-aliasing, gcc outputs broken machine code.
>From what I can gather by stepping thru the generated program with gdb, gcc has
dropped a number of statements that are required for the code to properly
function. For example, it has dropped:
- the initialization of list
- the initialization of tail
- the updating of the tail pointer after each iteration thru the loop (if you
pretend like gcc didn't unroll the loop)
- the comparison of list to NULL after the loop
I'll also attach my gdb session.
--
Summary: -fstrict-aliasing breaks valid code
Product: gcc
Version: 4.4.1
Status: UNCONFIRMED
Severity: critical
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: fejj at novell dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42907