Bug 26325 - Setting a breakpoint to the start of a function using AVX corrupts the calculations
Summary: Setting a breakpoint to the start of a function using AVX corrupts the calcul...
Status: UNCONFIRMED
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: 9.2
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-31 21:11 UTC by Harrison
Modified: 2020-07-31 21:11 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Harrison 2020-07-31 21:11:49 UTC
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