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 amodra at bigpond dot net dot au  2004-12-06 23:31 -------
I checked again with a current x86 gcc, 3.4.4 20041206, and the problem is still
there.  Note that this only happens with cc1plus.  As to why we get the
"impossible" assembly, what happens is that the inline function cti gets
expanded twice, but the first return label is used for both expansions:

 cti body
 jump ret_label
ret_label
 cti body
 jump ret_label

A simpler testcase is:

struct thread_info
{
  short preempt_count;
} x;

static inline struct thread_info *cti (void) __attribute__ ((const));
static inline struct thread_info *cti (void)
{
  return &x;
}

void fn (void)
{
  ++cti()->preempt_count;
}


-- 


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]