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 tree-optimization/43629] [4.3/4.4 Regression] Struct to register optimization fails



------- Comment #2 from rguenth at gcc dot gnu dot org  2010-04-02 11:47 -------
SRA introduces a use of the uninitialized value when re-constructing the
unsigned long representation.  That boils down to later CCP recognizing
the result as undefined and thus:

Visiting statement:
SR.16_25 = (unsigned int) result$A3_24(D);
which is likely UNDEFINED

Visiting statement:
SR.17_26 = (long unsigned int) SR.16_25;
which is likely UNDEFINED

Visiting statement:
SR.18_27 = SR.17_26 << 32;
which is likely UNDEFINED

Visiting statement:
SR.3_34 = SR.18_27 & 0x0ffffffff00000000;
which is likely UNDEFINED

Visiting PHI node: SR.3_2 = PHI <12885032961(2), SR.3_34(3)>

    Argument #0 (2 -> 4 executable)
        12885032961     Value: CONSTANT 12885032961

    Argument #1 (3 -> 4 executable)
        SR.3_34 Value: UNDEFINED

    PHI node value: CONSTANT 12885032961

Lattice value changed to CONSTANT 12885032961.


and we completely ignore the taken path.

One issue is that

Visiting statement:
SR.3_34 = SR.18_27 & 0x0ffffffff00000000;
which is likely UNDEFINED

is not 100% true - the value is only partially undefined (only the defined
pieces will be used later).  But of course that's splitting hairs somewhat
(but it might be the easiest fix for this bug).

tree-ssa-ccp.c:likely_value needs to look at regular rhs operands for
literal constants (see trunk version) but also make sure to re-set
all_undefined_operands if it encounters such.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2010-04-02 11:31:52         |2010-04-02 11:47:23
               date|                            |


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


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