[Bug c/41302] New: Cast of return value from uint32 to pointer cannot be optimized by a jump to called rtn.

dferbas at etech dot cz gcc-bugzilla@gcc.gnu.org
Mon Sep 7 22:24:00 GMT 2009


Called fn returns value in d0 (non pointer), but findZipEntry should return
value in a0 (address register). So in that case optimization cannot be done by
simply jumping to the called fn.

typedef u_int32_t       w_word;
typedef struct *        z_zipEntry;

z_zipEntry findZipEntry(z_zipFile dir, w_byte *name) {

        return (z_zipEntry) ht_read(dir->ht, (w_word)name);
}


findZipEntry:
        move.l 4(%sp),%a0
        move.l 8(%a0),4(%sp)

        jra ht_read

There should be:
        jbsr ht_read
        move.l %d0,%a0
        rts


-- 
           Summary: Cast of return value from uint32 to pointer cannot be
                    optimized by a jump to called rtn.
           Product: gcc
           Version: 4.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dferbas at etech dot cz


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



More information about the Gcc-bugs mailing list