other/5563: using a pointer named "end" consistently produces segfault in windows.

arlankfo@141.com arlankfo@141.com
Thu Jan 31 21:06:00 GMT 2002


>Number:         5563
>Category:       other
>Synopsis:       using a pointer named "end" consistently produces segfault in windows.
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 31 21:06:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Andrew Lankford
>Release:        gcc-2.95.3 (cygwin and mingw)
>Organization:
>Environment:
Windows 98
>Description:
The following terse (and useless) will compile and link fine,
but the executable crashes immediately:

--------------snip--------------
char mystring[]="hello";
char *end;
int main() {
  end=mystring;
  return 0;
}
--------------snip--------------

I first noticed this problem with another program
I wrote that created a pointer to a structure named "end".
I renamed it to "cend" and the program works fine now.
The Free/NetBSD versions of gcc don't have this problem.
The crash seems to occur any time you use "end" with the assignment operator.
>How-To-Repeat:
compile and attempt to run this program in a Windows environment.
>Fix:
rename any variables named "end"
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="test.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test.c"

Y2hhciBteXN0cmluZ1tdPSJoZWxsbyI7CmNoYXIgKmVuZDsKaW50IG1haW4gKCkgewogIGVuZD1t
eXN0cmluZzsKICByZXR1cm4gMDsKfQo=



More information about the Gcc-prs mailing list