This is the mail archive of the gcc-prs@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]

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


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


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