Re: GCC Compilation problem in HP LINUX server

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

 



gkarthi29 wrote:

> Compiling the following program 
> 
> #include <stdio.h>
> int main()
> {
>         char **variable=NULL;
> 
>         printf("Starting\n");
>         fflush(stdout);
>         while(*variable)
>         {
>                 printf("Inside while\n");
>                 fflush(stdout);
>                 break;
>         }
>         printf("Ending\n");
>         fflush(stdout);
> }
> 
> Produces the output 
> 
> Starting
> Segmentation fault
> 
> My System configuration is,
> 
> Linux 2.6.9-55.0.2.ELsmp #1 SMP x86_64 x86_64 x86_64 GNU/Linux
> gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-8)
> 
> basically i need to dereference NULL pointer in the above code.Is there any
> option available in Gcc?

No.  Dereferencing a NULL pointer is always undefined behaviour.

Andrew.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux