Problem with put_reg_into_stack

H.J. Lu hjl@lucon.org
Sat Dec 12 18:59:00 GMT 1998


Hi,

Here is a simplified version of my previous bug report. I think that
may be another addressof related bug. mark_addressable () in
cp/typeck.c has

      case CONST_DECL:
      case RESULT_DECL:
        if (DECL_REGISTER (x) && !TREE_ADDRESSABLE (x)
            && !DECL_ARTIFICIAL (x) && extra_warnings)
          cp_warning ("address requested for `%D', which is declared `register'",
                      x);
        put_var_into_stack (x);
        TREE_ADDRESSABLE (x) = 1;
        return 1;

The related RTL code is
 
(set (reg:QI 23)
    (mem/s:QI (plus:SI (reg/v/u:SI 22)
            (const_int 4))))

That is done on purpose since the x86 pattern doesn't allow memory
to memory move. put_var_into_stack () calls put_reg_into_stack ()
which turns

(reg:QI 23)

into

(mem:QI (plus:SI (reg:SI 18)
        (const_int -2)))

Now we get

(set (mem:QI (plus:SI (reg:SI 18)
        	(const_int -2)))
    (mem/s:QI (plus:SI (reg/v/u:SI 22)
            (const_int 4))))

It is not a valid x86 pattern. I have no idea if it can be fixed
easily. Maybe i386.md can be modified to fix it.

Thanks.



-- 
H.J. Lu (hjl@gnu.org)
---
typedef unsigned long int pthread_t;
class JTCThreadId
{
public:
    JTCThreadId();
    operator pthread_t() const;
};
class JTCRecursiveMutex
{
    int count_;  
    JTCThreadId owner_;  
public:
    JTCThreadId _JTC_getId() const;
};
JTCThreadId
JTCRecursiveMutex::_JTC_getId() const
{
    JTCThreadId id = (count_ > 0) ? owner_ : JTCThreadId();
    return id;
}



More information about the Gcc-bugs mailing list