[Bug c/51455] Possible uninitialized register use when array subscript is unsigned

2011-12-07 Thread pinskia at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51455

--- Comment #1 from Andrew Pinski pinskia at gcc dot gnu.org 2011-12-07 
19:10:55 UTC ---
((unsigned char *)offsets)[index] still sign extends to int.


[Bug c/51455] Possible uninitialized register use when array subscript is unsigned

2011-12-07 Thread frederik.deweerdt at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51455

--- Comment #2 from frederik.deweerdt at gmail dot com 2011-12-07 19:25:30 UTC 
---
(In reply to comment #1)
 ((unsigned char *)offsets)[index] still sign extends to int.

I'm not sure how to parse this. My problem is that '((unsigned char
*)offsets)[index]' uses the 'l' version of mov and eax as destination register.
I would expect the generate asm to use the 'q' version of mov and use rax as
destination register.


[Bug c/51455] Possible uninitialized register use when array subscript is unsigned

2011-12-07 Thread pinskia at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51455

--- Comment #3 from Andrew Pinski pinskia at gcc dot gnu.org 2011-12-07 
19:28:29 UTC ---
movzbl 0x20d(%rsp),%eax
is the same as:
movzbq 0x20d(%rsp),%rax

as all l instructions zero extend to q.


[Bug c/51455] Possible uninitialized register use when array subscript is unsigned

2011-12-07 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51455

--- Comment #4 from Jakub Jelinek jakub at gcc dot gnu.org 2011-12-07 
19:30:21 UTC ---
Probably time for you to read the docs.
E.g. AMD 24592 pdf, in 3.1.2 says:
In general, byte and word operands are stored in the low 8 or 16
bits of GPRs without modifying their high 56 or 48 bits,
respectively. Doubleword operands, however, are normally
stored in the low 32 bits of GPRs and zero-extended to 64 bits.

Of course movzbl insn clears all upper 56 bits of the destination register,
like movzbq, but is one byte shorter.


[Bug c/51455] Possible uninitialized register use when array subscript is unsigned

2011-12-07 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51455

Jakub Jelinek jakub at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 CC||jakub at gcc dot gnu.org
 Resolution||INVALID

--- Comment #5 from Jakub Jelinek jakub at gcc dot gnu.org 2011-12-07 
19:31:10 UTC ---
Invalid.