gcc generates wrong code on the test case when called with
/opt/cgcc-3.4.3-20050125/bin/sh-elf-gcc -m4 -S -Os -fomit-frame-pointer test2.c

Adding -fno-if-conversion2 creates working code. It seems that the code that
modifies the stack pointer to make space for function arguments is shifted
across a branch to a point where some paths through the function end up with a
wrong stack pointer at the end.

Attached: test2.c, test2.s, test2.c.27.flow2, test2.c.29.ce3

-- 
           Summary: if-conversion2 generates wrong code / crash on SH4
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: michael dot schwingen at lancom dot de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: unknown-i686-linux
  GCC host triplet: unknown-i686-linux
GCC target triplet: unknown-sh-elf


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19627

Reply via email to