This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/21089] [4.0/4.1 Regression] C++ front-end does not "inline" the static const double
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Apr 2005 18:04:15 -0000
- Subject: [Bug c++/21089] [4.0/4.1 Regression] C++ front-end does not "inline" the static const double
- References: <20050418172616.21089.matz@suse.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-04-18 18:04 -------
(In reply to comment #6)
> With -O0 we also don't inline 'a'. I thought in the past this already
> was done in the frontend, so the -O option didn't matter? If yes, this
> has changed (if not, well, I'm wrong ;-) ).
The code for 3.4.0 at -O0 for the example in comment #5:
.LC0:
.long 0
.long 1073741824
.text
.align 2
.globl _Z1cv
.type _Z1cv, @function
_Z1cv:
pushl %ebp
movl %esp, %ebp
fldl .LC0
popl %ebp
ret
.size _Z1cv, .-_Z1cv
.section .rodata
.align 8
.type a, @object
.size a, 8
a:
.long 0
.long 1072693248
.align 8
.type b, @object
.size b, 8
b:
.long 0
.long 1073741824
so we did inline 2.0 before.
The code for 4.0.0 and above is even worse:
_Z1cv:
pushl %ebp
movl %esp, %ebp
fldl b
popl %ebp
ret
.size _Z1cv, .-_Z1cv
.text
.align 2
.type _Z41__static_initialization_and_destruction_0ii, @function
_Z41__static_initialization_and_destruction_0ii:
pushl %ebp
movl %esp, %ebp
subl $8, %esp
movl %eax, -4(%ebp)
movl %edx, -8(%ebp)
cmpl $65535, -8(%ebp)
jne .L7
cmpl $1, -4(%ebp)
jne .L7
fldl a
fld1
faddp %st, %st(1)
fstpl b
.L7:
leave
ret
.size _Z41__static_initialization_and_destruction_0ii, .-
_Z41__static_initialization_and_destruction_0ii
.text
.align 2
.type _GLOBAL__I__Z1cv, @function
_GLOBAL__I__Z1cv:
pushl %ebp
movl %esp, %ebp
movl $65535, %edx
movl $1, %eax
call _Z41__static_initialization_and_destruction_0ii
popl %ebp
ret
We dymanically initialize b too which is what partly PR 20912 is about, Diego filed after seeing eon fail
because the front-end was still marking b as constant.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21089