This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/52600] OpenMP: declaration as structured block
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 26 Mar 2012 10:17:02 +0000
- Subject: [Bug c/52600] OpenMP: declaration as structured block
- Auto-submitted: auto-generated
- References: <bug-52600-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52600
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org,
| |rth at gcc dot gnu.org
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-03-26 10:17:02 UTC ---
In C++ we accept this, in C we don't (we call c_parser_statement, but
declarations aren't handled by that, due to the allowing/disallowing of mixing
of declarations and statements in C99 vs. C90).
I guess we could move the loop body from c_parser_compound_statement_nostart
to a new function and use it there as well as in c_parser_omp_structured_block,
c_parser_omp_{parallel,task} and c_parser_omp_sections_scope.
It is very ugly to allow there declarations though, that means code behaves
very differently between -fopenmp and -fno-openmp - in the former case the
declared var would go out of scope immediately, in the latter would be around
until closing }.