This is the mail archive of the gcc-help@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]

Re: Tcsh - Gentoo


On 2015.03.30 at 21:45 +0200, David Kredba wrote:
> Could you plese help me?
> What information I have to provide as good enough for gcc-5 possible
> bug report if Gentoo tcsh-6.18.01-r2 is maybe miscompiled with "-g O2
> -march=core2 -mtune=core2"?

markus@x4 tmp % cat tc.alloc.i
typedef long unsigned int size_t;
extern void *memset(void *__s, int __c, size_t __n);
extern void *malloc(size_t __size);

void *calloc(size_t i, size_t j) {
  char *cp;
  i *= j;
  cp = malloc(i);
  memset(cp, 0, i);
  return ((void *)cp);
}

markus@x4 tmp % gcc -O2 -S tc.alloc.i

markus@x4 tmp % cat tc.alloc.s
        .file   "tc.alloc.i"
        .section        .text.unlikely,"ax",@progbits
.LCOLDB0:
        .text
.LHOTB0:
        .p2align 4,,15
        .globl  calloc
        .type   calloc, @function
calloc:
.LFB0:
        .cfi_startproc
        imulq   %rsi, %rdi
        movl    $1, %esi
        jmp     calloc
        .cfi_endproc
.LFE0:
        .size   calloc, .-calloc
        .section        .text.unlikely
.LCOLDE0:
        .text
.LHOTE0:
        .ident  "GCC: (GNU) 5.0.0 20150330 (experimental)"
        .section        .note.GNU-stack,"",@progbits

So it gets compiled into an endless loop.
-fno-builtin fixes the issue.

-- 
Markus


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