Compiling the attached testcase with gcc -O2 -S signals.c, the generated asm
contains:

        .loc 1 51 0
        bl __canonicalize_funcptr_for_compare,%r2
        ldo -2(%r7),%r26
        ldi -4,%r26
        bl __canonicalize_funcptr_for_compare,%r2
        copy %r28,%r4
        .loc 1 52 0
        .loc 1 51 0
        comb,>>= %r28,%r4,.L15
        ldi 0,%r28

"old" is assigned to %r7. Why is it subtracting 2 from it before passing it to
__cffc?

gcc-3.x does not have this problem.

This testcase was extracted from signals.c from glibc/linuxthreads, based on our
investigation of Debian BTS bug #321785

-- 
           Summary: [4.0.x regression] Generates wrong code for funcptr
                    comparison
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tausq at debian dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: hppa-unknown-linux
  GCC host triplet: hppa-unknown-linux
GCC target triplet: hppa-unknown-linux


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

Reply via email to