tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Bounds checking not working?


From: Joshua Phillips
Subject: Re: [Tinycc-devel] Bounds checking not working?
Date: Fri, 12 Jun 2009 18:48:29 +0000
User-agent: KMail/1.9.10

I have a feeling bounds checking was broken a while ago, but don't quote me on 
that.

On Friday 12 June 2009 15:06:26 Arnold Meijster wrote:
> Hi,
>
> I just subscribed to the devel-list so don't flame me if
> I write this to the wrong list, please.
>
> I will be teaching a course in C programming at the university
> and was looking for a C compiler/interpreter that does
> bound checking (for first year's students that seems to be a good idea).
> After some googling, I found tcc. It seems to be perfect for what I
> want, however after compiling it, I tried the following:
>
> address@hidden:~$ cat outofbound.c
> #include <stdio.h>
>
> int main(int argc, char **argv) {
>   int i, sum, tab[10];
>
>   printf ("Before\n");
>   sum = 0;
>   for(i=0;i<11;i++) {
>     sum += tab[i];
>   }
>   printf ("After\n");
>   return 0;
> }
> address@hidden:~$ uname -a
> Linux wingtip82 2.6.26 #1 SMP Sun Mar 29 12:17:22 CEST 2009 i686
> GNU/Linux
> address@hidden:~$ tcc outofbound.c
> address@hidden:~$ ./a.out
> Before
> After
> address@hidden:~$ tcc -b -g outofbound.c
> address@hidden:~$ ./a.out
> Before
> Segmentation fault
>
>
> As you can see, the boundschecking version is somewhat different; it
> crashes instead of running on without any error (as without checking).
> However, I don't think this is the behaviour to be expected, or is it?
>
> Regards,
>
>   Arnold Meijster
>
>
>
>
> _______________________________________________
> Tinycc-devel mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/tinycc-devel


Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]