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 optimization/10409] [ARM] "__attribute__((const))" apparently not working


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From gonz@ratloop.com  2003-06-04 07:43 -------
I would expect the problem to occur with -O0, since folding pure functions is a 
common subexpression optimization, not a semantics issue.  

Regarding my previous comments about the assembly langauge, I should note that 
under GCC 3.2.3, this code:

int test(int x) {
  return pure_func(x) << 1;
}

...produces this output:

	.size	_Z8testorigi,.Lfe1-_Z8testorigi
	.align	2
	.global	_Z4testi
	.type	_Z4testi,function
_Z4testi:
	@ Function supports interworking.
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	mov	ip, sp
	stmfd	sp!, {fp, ip, lr, pc}
	sub	fp, ip, #4
	bl	_Z9pure_funci
	mov	r0, r0, asl #1
	ldmea	fp, {fp, sp, lr}
	bx	lr

...which is nearly identical to the code you pasted, and therefore GCC 3.4 is 
doing the right thing.  If "-fomit-frame-pointer" is failing to eliminate those 
extra pushes, it is a totally unrelated bug.

Therefore, it seems your most significant finding is that powerpc-darwin is 
still has the problem.

-Pete




------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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