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/2979: Resulting prog crashes with segmentation fault



>Number:         2979
>Category:       c
>Synopsis:       Resulting prog crashes with segmentation fault
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon May 28 08:26:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Andreas Galli, Freiburg, Germany
>Release:        GCC 2.95.2/3 runtime
>Organization:
>Environment:
Linux SuSE 6.4; HP-UX 10.20/11; Solaris 2.7
>Description:
Following program crashes with segmentation fault, in reason of a null pointer to the printf function.

#include <stdio.h>
char *buff;
main( int argc, char *argv[]){
  buff = (char *)0;
  printf("Text is [%s]\n", buff);
}

I know this is not a acceptable programming style, but:
1. it's really not easy to find the places to check it
2. native  eg. from HP do handle this

Is it possible fix this (via compiler switch) or maybe workaround?
Please help me!

Regards 
Andreas Galli
>How-To-Repeat:

>Fix:

>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]