https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64233

            Bug ID: 64233
           Summary: [m68k coldfire] Another misoptimisation with
                    -fschedule-insns
           Product: gcc
           Version: 4.8.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jifl-bugzilla at jifvik dot org

Created attachment 34226
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34226&action=edit
Main testcase source file to reproduce problem

I submitted bug 63347 about a misoptimisation on m68k coldfire with
-fschedule-insns. I have found another problem with different code when
compiling with gcc 4.8.3, although I'm submitting it separately as it could
have an unrelated cause.

This code has been reduced from an OpenSSL test case, but the files I'm
attaching are self-contained. There are two files: one is h1.c which is the
main one which gets misoptimised; the other is h2.c which is used to provide
some empty stubs called from h1.c, assuming you want a linkable program to
execute.

Compile them with: m68k-elf-gcc -m528x -c -g -O1 -fschedule-insns
although I expect other coldfire will fail similarly.

The problem is that the return value from execute_heartbeat() is always 0, but
num_failed manages to get set to 1. Looking at the disassembly, things get
confused, with an 'sne' instruction but no preceding 'tst', along with stomping
over a valid return value. I am also attaching an annotated partial disassembly
of main.

Needless to say, it would be good if someone could fix this in 4.8!

Jifl

Reply via email to