[cfe-dev] bug in clang

Dongsheng Song dongsheng.song at gmail.com
Mon Nov 22 17:52:44 PST 2010


-char character[5];
+char character[6];

On Mon, Nov 22, 2010 at 22:49, Andrew Wells <amtaw at comcast.net> wrote:
> Hi,
>     I was coding a USACO practice problem mhen I came across this bug
> which causes a Segmentation fault (I am using Fedora 14 x86_64).  Please
> consider the following code:
>
> #include <stdio.h>
>
> int main ()
> {
>
>     FILE *fout = fopen ("test.txt", "w");
>     char character[5];
>     int i;
>     for(i = 0; i < 6; i++)
>     {
>         character[i] = 'A'; //This statement causes an error
>     }
>
>
> fprintf(fout, "Point 1\n");
>
>     return (0);
> }
>
> God bless you,
> Andrew Wells
>
>
>
>
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>




More information about the cfe-dev mailing list