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]

c/640: Code generated for simultaneous debugging and profiling with basic blocks segfaults on Linux



>Number:         640
>Category:       c
>Synopsis:       Code generated for simultaneous debugging and profiling with basic blocks segfaults on Linux
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 14 19:56:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Feliks J. Welfeld, Solidum Systems Corp
>Release:        2.95.1
>Organization:
>Environment:
linux, i386
>Description:
When one asks for both stabs debug info and profiling 
with basic blocks, and the initialized global data
are at the end of the source file, some data structures
generated by the compiler for the benefit of the
basic blocks profiling are placed in the .text
section instead in the .data section, and the
resulting executable segfaults upon entry to the
first function from such source file.
>How-To-Repeat:
/******************************************************************
 *
 * This program, when compiled / linked as below
 *
 *  /tools/cross/linux/gcc-2.95.1/bin/gcc -g -pg -a -o bad.exe bad.c
 *
 * causes segmentation fault in __bb_init_func.
 * If the global initialized data at the end of the file
 * are removed, or moved before the last function, it runs
 * just fine. Also, it runs just fine as is when
 * compiled with egcs-2.91.66.
 *
 ******************************************************************/

#include <stdio.h>

static void func( void );

int main( /*  Returns: zero on success or positive int error code */
         int     argc,     /* argument count  */
         char  **argv      /* arguments vector */
         ) 
{
  
  func();
  return( 0 );
}

static void func( void )
{
  printf( "Hello, world!\n" );
}

int globalDatum = 5;

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/x-unknown-content-type-c_auto_file; name="bad.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="bad.c"

LyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq
KioqKioqKioqKgogKgogKiBUaGlzIHByb2dyYW0sIHdoZW4gY29tcGlsZWQgLyBsaW5rZWQgYXMg
YmVsb3cKICoKICogIC90b29scy9jcm9zcy9saW51eC9nY2MtMi45NS4xL2Jpbi9nY2MgLWcgLXBn
IC1hIC1vIGJhZC5leGUgYmFkLmMKICoKICogY2F1c2VzIHNlZ21lbnRhdGlvbiBmYXVsdCBpbiBf
X2JiX2luaXRfZnVuYy4KICogSWYgdGhlIGdsb2JhbCBpbml0aWFsaXplZCBkYXRhIGF0IHRoZSBl
bmQgb2YgdGhlIGZpbGUKICogYXJlIHJlbW92ZWQsIG9yIG1vdmVkIGJlZm9yZSB0aGUgbGFzdCBm
dW5jdGlvbiwgaXQgcnVucwogKiBqdXN0IGZpbmUuIEFsc28sIGl0IHJ1bnMganVzdCBmaW5lIGFz
IGlzIHdoZW4KICogY29tcGlsZWQgd2l0aCBlZ2NzLTIuOTEuNjYuCiAqCiAqKioqKioqKioqKioq
KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCgoj
aW5jbHVkZSA8c3RkaW8uaD4KCnN0YXRpYyB2b2lkIGZ1bmMoIHZvaWQgKTsKCmludCBtYWluKCAv
KiAgUmV0dXJuczogemVybyBvbiBzdWNjZXNzIG9yIHBvc2l0aXZlIGludCBlcnJvciBjb2RlICov
CiAgICAgICAgIGludCAgICAgYXJnYywgICAgIC8qIGFyZ3VtZW50IGNvdW50ICAqLwogICAgICAg
ICBjaGFyICAqKmFyZ3YgICAgICAvKiBhcmd1bWVudHMgdmVjdG9yICovCiAgICAgICAgICkgCnsK
ICAKICBmdW5jKCk7CiAgcmV0dXJuKCAwICk7Cn0KCnN0YXRpYyB2b2lkIGZ1bmMoIHZvaWQgKQp7
CiAgcHJpbnRmKCAiSGVsbG8sIHdvcmxkIVxuIiApOwp9CgppbnQgZ2xvYmFsRGF0dW0gPSA1OwoK
Cg==

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