This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/47812] [x32] __builtin_strlen is miscompiled at -O2


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

davidxl <xinliangli at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |xinliangli at gmail dot com

--- Comment #1 from davidxl <xinliangli at gmail dot com> 2011-02-19 07:05:47 UTC ---

There is a bug in the expand phase.   Pseudo reg 59 is not initialized which
leads to an initialization to 0 by the init-reg pass. combine pass then happily
simply the comparison result with 1 which is returned.


The bad case with x32 where reg:SI 64 is initialized instead of 59:

insn 25 24 0 (parallel [
            (set (reg:DI 64)
                (minus:DI (reg:DI 64)
                    (reg:DI 62)))
            (clobber (reg:CC 17 flags))
        ]) pr47812.c:5 -1
     (nil))

;; return D.2771_2;

(insn 29 25 30 (set (reg:CCZ 17 flags)
        (compare:CCZ (reg:SI 59 [ D.2772 ])
            (const_int 3 [0x3]))) pr47812.c:5 -1
     (nil))

The good case x86_64:

(insn 24 23 0 (parallel [
            (set (reg:DI 59 [ D.2772 ])
                (minus:DI (reg:DI 59 [ D.2772 ])
                    (reg:DI 62)))
            (clobber (reg:CC 17 flags))
        ]) pr47812.c:5 -1
     (nil))

;; return D.2771_2;

(insn 26 24 27 (set (reg:CCZ 17 flags)
        (compare:CCZ (reg:DI 59 [ D.2772 ])
            (const_int 3 [0x3]))) pr47812.c:5 -1
     (nil))


David


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]