Re: Behaviour of #pragma in statement context

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

 



Stephen Huw CLARKE <stephen.clarke@xxxxxx> writes:

> I'm having some difficulty understanding gcc behaviour
> on the following example.  It relates to the treatment
> of the pragma.
>
> $ cat test22.c
> #include <stdio.h>
>
> int x;
> void foo (void)
> {
>   int i, j;
>   for (i = 0; i < 10; i++)
> #pragma GCC visibility push(default)
>     for (j = 0; j < 10; j++)
>       x++;
> }
>
> int main(void)
> {
>   foo ();
>   printf ("x = %d (should be 100)\n", x);
>   return 0;
> }
>
>
> If I compile and run (using gcc 4.3.3, Target: i686-pc-linux-gnu)
> I get:
> $ gcc -Wall test22.c
> $ ./a.out
> x = 10 (should be 100)


This certainly looks like a bug.  I encourage you to file a bug report
according to the instructions at http://gcc.gnu.org/bugs.html .

Ian

[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