This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/17972] [3.4 Regression] const/pure functions result in bad asm
- From: "ebotcazou at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Feb 2005 15:59:56 -0000
- Subject: [Bug c++/17972] [3.4 Regression] const/pure functions result in bad asm
- References: <20041013124723.17972.mostrows@watson.ibm.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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