[Bug gdb/26325] New: Setting a breakpoint to the start of a function using AVX corrupts the calculations

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Bug gdb/26325] New: Setting a breakpoint to the start of a function using AVX corrupts the calculations

Sourceware - gdb-prs mailing list
https://sourceware.org/bugzilla/show_bug.cgi?id=26325

            Bug ID: 26325
           Summary: Setting a breakpoint to the start of a function using
                    AVX corrupts the calculations
           Product: gdb
           Version: 9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: harrisonf100 at gmail dot com
  Target Milestone: ---

GDB seems to corrupt values on AVX calculations simply by setting a breakpoint
to the start of a function, it works fine when using SSE
Below are the steps I did to reproduce the bug

$ gcc --version
gcc (GCC) 10.1.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


$ gdb --version
GNU gdb (GDB) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.


$ uname -a
Linux harrison 5.7.11-arch1-1 #1 SMP PREEMPT Wed, 29 Jul 2020 21:38:21 +0000
x86_64 GNU/Linux


$ cat main.c
#include <stdio.h>

float transform(float x){
    float k = x / 10.0f;
    return k;
}

void main(){
    float r = transform(3.21f);
    fprintf(stderr,"Result: %f\n",r);
}


$ gcc -g -Og -mavx -o test main.c
$ ./test
Result: 0.321000

$ gdb ./test
GNU gdb (GDB) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./test...
(gdb) break 4
Breakpoint 1 at 0x1139: file main.c, line 4.
(gdb) run
Starting program: /home/harrison/dev/testebug/test

Breakpoint 1, transform (x=3.21000004) at main.c:4
4           float k = x / 10.0f;
(gdb) c
Continuing.
Result: inf
[Inferior 1 (process 18125) exited with code 014]
(gdb) quit

--
You are receiving this mail because:
You are on the CC list for the bug.