Deutsch   English   Français   Italiano  
<20240702184518.000057bf@yahoo.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Michael S <already5chosen@yahoo.com>
Newsgroups: comp.lang.c
Subject: Re: tcc - first impression. Was: Baby X is bor nagain
Date: Tue, 2 Jul 2024 18:45:18 +0300
Organization: A noiseless patient Spider
Lines: 60
Message-ID: <20240702184518.000057bf@yahoo.com>
References: <v494f9$von8$1@dont-email.me>
	<v53vh6$368vf$1@dont-email.me>
	<v54se1$3bqsk$1@dont-email.me>
	<20240624160941.0000646a@yahoo.com>
	<v5bu5r$va3a$1@dont-email.me>
	<20240624181006.00003b94@yahoo.com>
	<v5c86d$11ac7$1@dont-email.me>
	<JEheO.108086$ED9b.74955@fx11.iad>
	<v5cblg$11q0j$1@dont-email.me>
	<gEieO.108089$ED9b.25598@fx11.iad>
	<20240625113616.000075e0@yahoo.com>
	<mUzeO.141609$Cqra.55051@fx10.iad>
	<v5elql$1jmii$1@dont-email.me>
	<m3BeO.24907$Gurd.16179@fx34.iad>
	<v5empd$1jndv$2@dont-email.me>
	<v5eph4$1k6a9$1@dont-email.me>
	<87ed8jnbmf.fsf@bsb.me.uk>
	<v5jhls$2m7np$1@dont-email.me>
	<867ceadtih.fsf@linuxsc.com>
	<20240701200924.00003d9a@yahoo.com>
	<20240702181750.00000590@yahoo.com>
	<875xtnlshk.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 02 Jul 2024 17:44:57 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="5fbca3f539c7d7fdf38abe2835a4f1fd";
	logging-data="1787620"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19WYsq1BAKFtsYPv5g6p6z9GX3brJtu4mo="
Cancel-Lock: sha1:Qu4Wg25SSsGKuYKZCwN+HnG9W5w=
X-Newsreader: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32)
Bytes: 3274

On Tue, 02 Jul 2024 16:32:23 +0100
Ben Bacarisse <ben@bsb.me.uk> wrote:

> Michael S <already5chosen@yahoo.com> writes:
> 
> > On Mon, 1 Jul 2024 20:09:24 +0300
> > Michael S <already5chosen@yahoo.com> wrote:
> >
> > As far as I am concerned, the most intriguing feature of tcc is
> > "Memory and Bound checks". Unfortunately, I was not able to make it
> > work. It keeps telling me "segmentation error" at first attempt to
> > dereference argv. Is this feature Linux-only or 32-bit only or some
> > other type of "only" ?  
> 
> The documentation says it should work on x86_64 in Windows.
> 
> Can you post the code so we can compare.  With this little program
> 
>   #include <stdio.h>
>    
>   void f(int *a, int n)
>   {
>        printf("a[%d] == %d\n", n, a[n]);
>   }
>    
>   int main(int argc, char **argv)
>   {
>        for (int i = 0; i <= argc; i++)
>             if (argv[i])
>                  printf("argv[%d] == %s\n", i, argv[i]);
>             else printf("argv[%d] is a null pointer\n", i);
>        int a[3];
>        f(a, 3);
>   }
> 
> I get this output:
> 
> $ ./a.out 1
> argv[0] == ./a.out
> argv[1] == 1
> argv[2] is a null pointer
> 004021b9 : at ???: BCHECK: 0x7ffca6719404 is outside of the region
> t.c:5: by f
> t.c:15: by main
> t.c:5: at f: RUNTIME ERROR: invalid memory access
> t.c:15: by main    
> 

I got plain "Segmentation fault".

I it gets me "Segmentation fault" on something as simple as:

#include <stdio.h>
int main(int argc, char **argv)
{
  printf("%p\n", argv[0]);
  return 0;
}