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/17884] asm 'volatile' is not honored as documented


------- Additional Comments From rth at gcc dot gnu dot org  2005-01-20 01:33 -------
In reply to comment #20:

Again, this is not scheduling, per se.  This is register
rematerialization.  We have a value at some point, and we
decide that it's cheaper to move the computation rather
than store and reload it.

This is really no different than if we decided to CSE the
computation as in

    __fnstsw(&s1);
    __fldenv(envp->x87);            /* volatile */
    __fnstsw(&s2);
->
    __fnstsw(&s1);
    __fldenv(envp->x87);            /* volatile */
    s2 = s1;

I must repeat myself that the original source code is 
buggy.  You've got asms that affect, or are affected by,
architectural state that is not visible to the compiler.
As such you REALLY REALLY MUST mark the asm as volatile.

-- 


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


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