c/10844: Wrong computation on nan initialized vectors.

Christian Szegedy szegedy@or.uni-bonn.de
Mon May 19 12:01:00 GMT 2003


ehrhardt@mathematik.uni-ulm.de wrote:

>Synopsis: Wrong computation on nan initialized vectors.
>
>State-Changed-From-To: open->feedback
>State-Changed-By: cae
>State-Changed-When: Sun May 18 17:49:33 2003
>State-Changed-Why:
>    I can't reproduce this. Could you tell us the compiler options used
>    to compile the code, the output of gcc -v and the assemble code
>    generated for the main function? Additionally your libc version might
>    be of interest here.
>    
>        regards  Christian
>    
>
>http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10844
>
>  
>
I just used "gcc -lm bug.c" to compile the code.
I am at work, but I can reproduce the bug on my SuSe 8.0 box, with

Reading specs from 
/home/szegedy/extern/gcc-3.2-install/lib/gcc-lib/i686-pc-linux-gnu/3.2/specs
Configured with: ../gcc-3.2/configure 
--prefix=/home/szegedy/extern/gcc-3.2-install
Thread model: posix
gcc version 3.2

How can I determine the glibc version?

The bug also occurs with the old 2.95 compiler.

The assembler output is:

        .file   "bug.c"
        .section        .rodata
.LC0:
        .string ""
.LC2:
        .string "%lg\n"
        .text
        .align 2
.globl main
        .type   main,@function
main:
        pushl   %ebp
        movl    %esp, %ebp
        pushl   %esi
        pushl   %ebx
        subl    $32, %esp
        andl    $-16, %esp
        movl    $0, %eax
        subl    %eax, %esp
        movl    $10, -16(%ebp)
        movl    -16(%ebp), %eax
        sall    $3, %eax
        movl    %eax, (%esp)
        call    malloc
        movl    %eax, -20(%ebp)
        movl    $0, -12(%ebp)
.L2:
        movl    -12(%ebp), %eax
        cmpl    -16(%ebp), %eax
        jl      .L5
        jmp     .L3
.L5:
        movl    -12(%ebp), %eax
        leal    0(,%eax,8), %esi
        movl    -20(%ebp), %ebx
        movl    $.LC0, (%esp)
        call    nan
        pushl   %eax
        fildl   (%esp)
        leal    4(%esp), %esp
        fstpl   (%ebx,%esi)
        leal    -12(%ebp), %eax
        incl    (%eax)
        jmp     .L2
.L3:
        movl    -20(%ebp), %eax
        movl    $0, (%eax)
        movl    $0, 4(%eax)
        movl    -20(%ebp), %edx
        movl    -20(%ebp), %eax
        fldl    (%eax)
        fldz
        faddp   %st, %st(1)
        fstpl   (%edx)
        movl    $.LC2, (%esp)
        movl    -20(%ebp), %eax
        movl    4(%eax), %edx
        movl    (%eax), %eax
        movl    %eax, 4(%esp)
        movl    %edx, 8(%esp)
        call    printf
        movl    $0, %eax
        leal    -8(%ebp), %esp
        popl    %ebx
        popl    %esi
        popl    %ebp
        ret
.Lfe1:
        .size   main,.Lfe1-main
        .ident  "GCC: (GNU) 3.2"




More information about the Gcc-bugs mailing list