This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
pending/1590: Bug in structure???
- From: Yannick Copin <y dot copin at ipnl dot in2p3 dot fr>
- To: gdb-gnats at sources dot redhat dot com
- Date: Mon, 23 Feb 2004 19:22:07 +0100
- Subject: pending/1590: Bug in structure???
>Number: 1590
>Category: pending
>Synopsis: Bug in structure???
>Confidential: yes
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: change-request
>Submitter-Id: unknown
>Arrival-Date: Mon Mar 22 21:18:01 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:
>Release:
>Organization:
>Environment:
>Description:
Hi,
sorry to bother you with probably a stupid question regarding gdb, but I
found a strange behavior in gdb 6.0 used along with gcc 3.3.2 (RedHat
7.2). Consider the following minimalist program:
#define lg_name 80L
typedef struct
{
char name[lg_name+1];
double step;
} E3D_file;
int main()
{
E3D_file cube;
cube.step = 1.;
return(0);
}
After standard compilation (gcc -g -Wall, version 3.3.2), gdb ./a.out gives:
GNU gdb 6.0
[...]
(gdb) b main
Breakpoint 1 at 0x80483a0: file testE3D.c, line 14.
(gdb) r
Starting program: /home/novae/ycopin/soft/c/tests/a.out
Breakpoint 1, main () at testE3D.c:14
14 cube.step = 1.;
(gdb) display cube.step
1: cube.step = 5.3440552952533551
(gdb) n
16 return(0);
1: cube.step = 5.3440561285242438
(gdb)
17 }
1: cube.step = 5.3440561285242438
(gdb)
Program exited normally.
The 1st cube.step = 5.34 is normal, but after the initialization
cube.step = 1, I still got 5.34!!!
This behavior doesnt show up with gcc 2.96 (RedHat):
GNU gdb Red Hat Linux 7.x (5.0rh-15) (MI_OUT)
Breakpoint 1, main () at testE3D.c:14
14 cube.step = 1.;
(gdb) display cube.step
1: cube.step = -1.9967124462120234
(gdb) n
16 return(0);
1: cube.step = 1
but it's there with gcc 3.3 (instead of 3.3.2), and with gdb 5.3 and
5.2.1 (instead of 6.0).
Furthermore, if I add a printf from the stdio lib, here is what I got
(gcc 3.3.2):
Breakpoint 1, main () at testE3D.c:16
16 printf("step (before) = %lf\n",cube.step);
(gdb) display cube.step
1: cube.step = 5.3440552952534404
(gdb) n
step (before) = 0.000000
17 cube.step = 1.;
1: cube.step = 5.3440552952534404
(gdb) n
18 printf("step (after) = %lf\n",cube.step);
1: cube.step = 5.3440561285242438
(gdb)
step (after) = 1.000000
20 return(0);
1: cube.step = 5.3440561285242438
The print-out via printf and the display of gdb don't give the same thing!!!
Is it a bug in gdb (or gcc?), or is it just that I don't know how to use
it???
Cheers.
--
.~. Yannick COPIN (o:>* Doctus cum libro
/V\ Institut de physique nucleaire de Lyon (IN2P3 - France)
// \\ Tel: (33/0) 472 448 065
/( )\ http://snovae.in2p3.fr/ycopin/
^`~'^
_______________________________________________
Bug-gdb mailing list
Bug-gdb@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-gdb
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: