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]

i386, latest snapshot codesourcery, use of uninited reg


  Hello,

  Here is a simple soft:
void fct (void)
  {
  static unsigned stub_orig;

  stub_orig = *(unsigned*)__builtin_frame_address(0);
  }

  With http://www.codesourcery.com/gcc-compile.html
  and option -Os it is OK:
---------------------------
        .file   "@11584.1"
        .version        "01.01"
gcc2_compiled.:
        .local  stub_orig.0
        .comm   stub_orig.0,4,4
.text
        .align 4
.globl fct
        .type    fct,@function
fct:
        pushl   %ebp
        movl    %esp, %ebp
        movl    0(%ebp), %eax
        movl    %eax, stub_orig.0
        popl    %ebp
        ret
.Lfe1:
        .size    fct,.Lfe1-fct
        .ident  "GCC: (GNU) 2.96 20000414 (experimental)"
---------------------------

  But if I add -fomit-frame-pointer, I get:
---------------------------
        .file   "@11627.1"
        .version        "01.01"
gcc2_compiled.:
        .local  stub_orig.0
        .comm   stub_orig.0,4,4
.text
        .align 4
.globl fct
        .type    fct,@function
fct:
        movl    0(%ebp), %eax              !!!!!!!!!!!!!!!
        pushl   %ebp
        movl    %eax, stub_orig.0
        popl    %ebp
        ret
.Lfe1:
        .size    fct,.Lfe1-fct
        .ident  "GCC: (GNU) 2.96 20000414(experimental)"
---------------------------

  i.e. %ebp is not initialised before been referenced,
  the line "movl 0(%ebp), %eax" should be "movl (%esp), %eax".
  Was working with GCC-2.95.2, but not with gcc version 2.96 20000327

  Have a nice day,
  Etienne.

___________________________________________________________
Do You Yahoo!?
Achetez, vendez! À votre prix! Sur http://encheres.yahoo.fr

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