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

            Bug ID: 57933
           Summary: function dwf_regno accesses dbx_register_map beyond
                    its upper limit
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zeccav at gmail dot com

Compiling the following code with -m32 option
the gcc front end array extern int const
dbx_register_map[FIRST_PSEUDO_REGISTER]
declared in i386.h is accessed beyond its upper limit
in function dwf_regno in dwarf2cfi.c:898.
This is because FIRST_PSEUDO_REGISTER is 53,
while REGNO (reg) is 61.
I double checked this one putting the statement
gcc_assert ( REGNO (reg) < FIRST_PSEUDO_REGISTER );
immediately before
return DWARF_FRAME_REGNUM (REGNO (reg));
in dwarf2cfi.c:898. 
The macro DWARF_FRAME_REGNUM is defined as macro DBX_REGISTER_NUMBER.
I have an x86-64 CPU with Linux Fedora 19 64 bits.
Compiler command: gcc -S -m32 p.c
/********* Code begins ****************/
void sigsetjmp (void);

typedef struct {} *S;

void __attribute__((__stdcall__))  f(S);

void  __attribute__((__force_align_arg_pointer__))
g(S hS) 
{
 sigsetjmp (); 
 f(hS);
}
/********* Code ends *******************/
p.c: In function ā€˜gā€™:
p.c:13:1: internal compiler error: in dwf_regno, at dwarf2cfi.c:898
 }
 ^
0x885bc7 dwf_regno
    ../../gcc-4.8.1/gcc/dwarf2cfi.c:898
0x88bb7c dwarf2out_frame_debug
    ../../gcc-4.8.1/gcc/dwarf2cfi.c:1990
0x88d80e scan_insn_after
    ../../gcc-4.8.1/gcc/dwarf2cfi.c:2340
0x88e2ac scan_trace
    ../../gcc-4.8.1/gcc/dwarf2cfi.c:2497
0x88e413 create_cfi_notes
    ../../gcc-4.8.1/gcc/dwarf2cfi.c:2541
0x890096 execute_dwarf2_frame
    ../../gcc-4.8.1/gcc/dwarf2cfi.c:2898
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
[vitti winesan]$

Reply via email to