c/7414: GCC 3.1 gens bad pointer arithmetic? SIGSEGV

blackkm@juno.com blackkm@juno.com
Fri Jul 26 08:36:00 GMT 2002


>Number:         7414
>Category:       c
>Synopsis:       GCC 3.1 gens bad pointer arithmetic? SIGSEGV
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 26 08:26:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     K Black
>Release:        gcc version 3.1
>Organization:
>Environment:
Windows XP Home, Cygwin
>Description:
code appears to compile with no errors and no warnings.
But always produces SIGSEGV at run time
>How-To-Repeat:
Line 10 (/* fails here */) appears to always fail with a segmentation fault (SIGSEGV?)?

char *t[3]={
	"\0one",
	"\0two",
	"zzz"};

main() {

   printf("t[1] before: %s\n",t[1]);
   t[1][0]=' ';   /* fails here */
   printf("t[1] afterwords: %s\n",t[1]);
}
>Fix:
unknown - tried several variations on pointers and arrays
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list