delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/10/19/10:57:46

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
content-class: urn:content-classes:message
MIME-Version: 1.0
X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0
Subject: RE: 1.3.12: gcc bug: variable named "end"
Date: Sat, 19 Oct 2002 10:57:37 -0400
Message-ID: <83040F98B407E6428FEC18AC720F5D73E50076@exchange.tropicnetworks.com>
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
From: "Rolf Campbell" <rcampbell AT tropicnetworks DOT com>
To: <cygwin AT cygwin DOT com>
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id g9JEvjc13308

Doesn't this mean that gcc is not a true ANSI compiler?  Shouldn't that
variable be "__end" or something to conform with ANSI rules?

-R

> -----Original Message-----
> From: Randall R Schulz [mailto:rrschulz AT cris DOT com] 
> Sent: Saturday, October 19, 2002 1:53 AM
> To: cygwin AT cygwin DOT com
> Subject: Re: 1.3.12: gcc bug: variable named "end"
> 
> 
> 
> As it has been since time immemorial in compilers with a Unix 
> lineage or 
> patterned after compilers of that lineage. Clearly GCC is 
> such a compiler.
> 
> The linker binds the symbol "end" to the first unused address 
> in the linked 
> program. Some linkers also define "etext" and "edata" to 
> indicate the end 
> of the program text (its instructions) and of the initialized 
> data, resp.
> 
> This program:
> 
> -==--==--==--==--==--==--==--==--==--==--==-
> #include <stdio.h>
> 
> extern int main(int argc, char **argv);
> 
> extern int end;
> 
> int
> main(int argc, char **argv)
> {
>      printf("etext=%#lx\n");
> 
>      return 0;
> }
> -==--==--==--==--==--==--==--==--==--==--==-
> 
> when compiled and run on my Cygwin system prints this:
> 
> end=0x407000
> 
> 
> Note the "extern" storage class on the declaration of "end." 
> It's supplied 
> elsewhere (by the linker, i.e.).
> 
> 
> Randall Schulz
> Mountain View, CA USA
> 
> 
> At 22:16 2002-10-18, you wrote:
> >CYGWIN_NT-5.1 X22CHIKAYAMA 1.3.12(0.54/3/2) 2002-07-06 02:16 i686 
> >unknown gcc 2.95.3-5
> >
> >The following program causes a segmentation fault.
> >---
> >int end;
> >main() { end = 0; }
> >---
> >Seems that the problem is with the variable name "end".
> >In the object code tries to store in some invalid address. Variables 
> >with other names, of course, does not cause this.
> >
> >- Takashi Chikayama
> 
> 
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting:         http://cygwin.com/bugs.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
> 
> 

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019