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 c++/17972] [3.4 Regression] const/pure functions result in bad asm


------- Additional Comments From ebotcazou at gcc dot gnu dot org  2005-02-24 15:59 -------
> New test case exhibits same problem.

Confirmed.  Reduced testcase:

struct demo {
    int s;
};

extern struct demo * const *xd;

static inline struct demo *fn1(void) __attribute__((pure));
static inline struct demo *fn1(void)
{
    struct demo **d;
    return *xd;
}

unsigned long foo()
{
    unsigned long old = 0;
    fn1()->s -= 1;
    return old;
}

The code is correct with an explicit decrement operator.


-- 


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


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