[vlc-devel] Re: CVS Commit (gbazin)
Gildas Bazin
gbazin at netcourrier.com
Tue Dec 10 11:12:41 CET 2002
On Tuesday 10 December 2002 10:30, Sam Hocevar wrote:
> On Tue, Dec 10, 2002, cvs at videolan.org wrote:
>
> > * include/configuration.h: rolled back the last changes made to this
file.
> > There is no sense in manually initializing all the fields of
module_config_t
> > as it will be done by the compiler anyway. Furthermore mingw32 gcc seems
to
> > have problems optimizing code that manually initializes structures to 0.
>
> Uh? Why would any optimizations be needed at all here? Could you
> elaborate on the real problem?
>
Ok, I'll give you the code gcc outputs for the 2 different cases.
1 - "module_config_t tmp = { CONFIG_HINT_CATEGORY, NULL, NULL, '\0', text,
longtext };" :
LC3:
.long 2 /* CONFIG_HINT_CATEGORY */
.long 0
.long 0
.byte 0
.space 3
.long LC2 /* text */
.long 0 /* longtext */
.space 28
This exactly what you would have expected.
2 - "module_config_t tmp = { CONFIG_HINT_CATEGORY, NULL, NULL, '\0', text,
longtext, 0, 0 };" :
.globl _vlc_entry__0_5_0_cvs
.def _vlc_entry__0_5_0_cvs; .scl 2; .type 32;
.endef
_vlc_entry__0_5_0_cvs:
blablabla
...
movl $13, %ecx
movl %edx, %edi
movl $2, 32(%esp) /* CONFIG_HINT_CATEGORY */
movl $LC2, 48(%esp) /* text */
rep
movsl
Strange no ? And the problem disappears with "module_config_t tmp = {
CONFIG_HINT_CATEGORY, NULL, NULL, '\0', text, longtext, 0, 1 };"
I honestly don't understand why gcc is making this optimization (well it
seems to save some space in the final object because it puts things in the
stack, but still...) but this seems to be a pretty old behaviour as this is
what gcc-2.95 and gcc-3.2 do.
Regards,
--
Gildas
--
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://www.videolan.org/lists.html
If you are in trouble, please contact <postmaster at videolan.org>
More information about the vlc-devel
mailing list