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]
Other format: [Raw text]

[Bug debug/18655] New: Incorrect data in .debug_frame section for PowerPC


The output generated in the .debug_frame section is incorrect, as follows:

1. The return_address_register in the CIE is given as 65.  In the ABI 
supplement for the PowerPC, this is the ID of the Floating Point Status and 
Control Register.  This should probably have been 108, the ID of the Link 
Register.

2. In the body of the FDE, the return address is put into in register 108.  
Since the CIE specifies that the return is in register 65, this value is lost 
when traversing the stack

These two register IDs should be the same. (They were both 65 in the 3.2 
version of the compiler).  The simple test case provided generates one CIE, and 
three FDE entries.  The FDEs for main and sub2 are both inconsistent with the 
CIE.

Results from gcc -v:

Reading specs from /usr/lib/gcc/ppc64-redhat-linux/3.4.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --
infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-
checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-
exceptions --enable-languages=c,c++,objc,java,f77 --enable-java-awt=gtk --
host=ppc64-redhat-linux --build=ppc64-redhat-linux --target=ppc64-redhat-linux -
-with-cpu=default32
Thread model: posix
gcc version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)


command line:
g++ -v x.cpp

Original source file (x.cpp):
//#include <stdio.h>
int sub1(int x)
{
  return x + 1;
}
int sub2(int x)
{
  for (int i = 0; i < 10; i++)
    x = sub1(x + i);
  return 0;
}
int main(int argc, char** argv)
{
  return sub2(argc);
}
//------------------------------------------------------------------------------

Preprocessed file x.ii:
# 1 "x.cpp"
# 1 "/home/pett/dev/test//"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "x.cpp"

int sub1(int x)
{
  return x + 1;
}
int sub2(int x)
{
  for (int i = 0; i < 10; i++)
    x = sub1(x + i);
  return 0;
}
int main(int argc, char** argv)
{
  return sub2(argc);
}

-- 
           Summary: Incorrect data in  .debug_frame  section for PowerPC
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pett at ca dot ibm dot com
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18655


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