This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Behaviour of #pragma in statement context
- From: Ian Lance Taylor <iant at google dot com>
- To: Stephen Huw CLARKE <stephen dot clarke at st dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Tue, 29 Sep 2009 17:15:38 -0700
- Subject: Re: Behaviour of #pragma in statement context
- References: <4AC24B06.4070507@st.com>
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