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/30785] Test to null pointer optimised away at -O2



------- Comment #4 from tg at mirbsd dot org  2007-03-10 20:31 -------
It's not fixed on 4.1 branch:

tglaser@hephaistos:~/tmp $ cat _t.c
typedef unsigned size_t;
char *xxcpy(  char *pDest, const char *pSrc, size_t n);
char *strncpy(  char *pDest, const char *pSrc, size_t n) {
  if (pDest == 0 || pSrc == 0) {
      if (pDest)
          *pDest = 0;
      return pDest;
      }
  return xxcpy (pDest, pSrc, n);
  }

Neither with 4.1.2 (release):

tglaser@hephaistos:~/tmp $ ~/tmp/gp/bin/gcc -O2 -S _t.c -o -
        .file   "_t.c"
        .text
        .p2align 4,,15
.globl strncpy
        .type   strncpy, @function
strncpy:
        pushl   %ebp
        movl    %esp, %ebp
        popl    %ebp
        jmp     xxcpy
        .size   strncpy, .-strncpy
        .ident  "GCC: (GNU) 4.1.2"
        .section        .note.GNU-stack,"",@progbits

Nor with today's weekly snapshot:

tglaser@hephaistos:~/tmp $ ~/tmp/gp/bin/gcc -O2 -S _t.c -o -
        .file   "_t.c"
        .text
        .p2align 4,,15
.globl strncpy
        .type   strncpy, @function
strncpy:
        pushl   %ebp
        movl    %esp, %ebp
        popl    %ebp
        jmp     xxcpy
        .size   strncpy, .-strncpy
        .ident  "GCC: (GNU) 4.1.3 20070305 (prerelease)"
        .section        .note.GNU-stack,"",@progbits

For the meantime, I'm using -fno-tree-vrp as well, but this
is a serious bug, please fix it.

(tried to reopen the PR but that didn't work)


-- 


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


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