Behaviour of #pragma in statement context
Ian Lance Taylor
iant@google.com
Wed Sep 30 00:16:00 GMT 2009
Stephen Huw CLARKE <stephen.clarke@st.com> 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
More information about the Gcc-help
mailing list