This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c/7414: GCC 3.1 gens bad pointer arithmetic? SIGSEGV
- From: blackkm at juno dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 26 Jul 2002 15:18:02 -0000
- Subject: c/7414: GCC 3.1 gens bad pointer arithmetic? SIGSEGV
- Reply-to: blackkm at juno dot com
>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: