This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Behaviour of #pragma in statement context


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]