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

debug/1706: Stabs definition for "complex" and "double complex" incorrect



>Number:         1706
>Category:       debug
>Synopsis:       Stabs definition for "complex" and "double complex" incorrect
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 19 13:56:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Steve Chen
>Release:        g77 version 2.95.2 19991024
>Organization:
>Environment:
host    :powerpc-unknown-linux-gnu 2.2.18-1
build   :powerpc-unknown-linux-gnu
target  :powerpc-unknown-linux-gnu
machine : Gemini VSS4, rev C, eco 2, quad Motorola processor

__G77_LIBF77_VERSION__: 0.5.25 19991030 (prerelease)

gcc version 2.95.2 19991024 (release/franzo)
 /usr/lib/gcc-lib/ppc-yellowdog-linux/2.95.2/cpp -lang-c -v -D__GNUC__=2 -D__GNUC_MINOR__=95 -D__PPC__ -D__ELF__ -D__powerpc__ -D__PPC -D__powerpc -Acpu(powerpc) -Amachine(powerpc) -D_LANGUAGE_FORTRAN -D__CHAR_UNSIGNED__ -traditional -D_CALL_SYSV -D_BIG_ENDIAN -D__BIG_ENDIAN__ -Amachine(bigendian) -D_ARCH_PPC -D__unix__ -D__linux__ -Dunix -Dlinux -Asystem(unix) -Asystem(posix) /dev/null /dev/null
>Description:
The sizes given for complex variables in the stabs information are incorrect.
A portion of the stabs output that was produced by "objdump" from code built
with g77-2.95.2 is included below:

17     LSYM   0      0      00000000 700    complex int:t(0,15)=s8real:(0,1),0,32;imag:(0,1),32,32;;
18     LSYM   0      0      00000000 757    complex float:t(0,16)=r(0,16);4;0;
19     LSYM   0      0      00000000 792    complex double:t(0,17)=r(0,17);8;0;
20     LSYM   0      0      00000000 828    complex long double:t(0,18)=r(0,18);8;0;

36     LSYM   0      0      00000000 1532   complex:t(0,34)=r(0,34);4;0;
37     LSYM   0      0      00000000 1561   double complex:t(0,35)=r(0,35);8;0;

42     LSYM   0      0      00000000 1769   __g77_f2c_complex:t(0,40)=r(0,40);4;0;
43     LSYM   0      0      00000000 1808   __g77_f2c_doublecomplex:t(0,41)=r(0,41);8;0;

For example, the entry for "complex" (line 36) should be 8 bytes, not 4.
(The "complex int" appears to be correct).

Compare this with the stabs output produced by egcs-2.91.66:

17     LSYM   0      0      00000000 708    complex int:t(0,15)=s8r:(0,1),0,32;i:(0,1),32,32;;
18     LSYM   0      0      00000000 759    complex float:t(0,16)=s8r:(0,12),0,32;i:(0,12),32,32;;
19     LSYM   0      0      00000000 814    complex double:t(0,17)=s16r:(0,13),0,64;i:(0,13),64,64;;
20     LSYM   0      0      00000000 871    complex long double:t(0,18)=s24r:(0,14),0,96;i:(0,14),96,96;;

36     LSYM   0      0      00000000 1596   complex:t(0,34)=s8r:(0,32),0,32;i:(0,32),32,32;;
37     LSYM   0      0      00000000 1645   double complex:t(0,35)=s16r:(0,33),0,64;i:(0,33),64,64;;

42     LSYM   0      0      00000000 1874   __g77_f2c_complex:T(0,40)=s8r:(0,38),0,32;i:(0,38),32,32;;
43     LSYM   0      0      00000000 1933   __g77_f2c_complex:t(0,40)
44     LSYM   0      0      00000000 1959   __g77_f2c_doublecomplex:T(0,41)=s16r:(0,39),0,64;i:(0,39),64,64;;
45     LSYM   0      0      00000000 2025   __g77_f2c_doublecomplex:t(0,41)

NOTE:  The definition of the types are different, also, but according to the latest
stabs documentation I found, the gcc-2.95.2 format is correct.  The reported
sizes are the primary issues.

This is related to PR 1621.  However, this PR focuses on the incorrect sizes
reported by stabs, not on how it interfaces with GDB.
>How-To-Repeat:
FORTRAN source code example:

File:  test_complex.f
---CUT HERE---
      subroutine test_complex

      common /testcomm/ xdummy1, xdummy2

      complex xdummy1, xdummy2
      real dummy1

      end
---CUT HERE---

Build with:

    g77 -g -c test_complex.f

Run:

    objdump --stabs test_complex.o
>Fix:
Complex numbers are effectively stored as two variables of a given type.
Thus, the size of a float-based complex should be 2*sizeof(float).
>Release-Note:
>Audit-Trail:
>Unformatted:

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