public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/35246] New: declaration of threadprivate variable considered first use
@ 2008-02-18 4:29 hailijuan at gmail dot com
2008-02-18 4:38 ` [Bug c++/35246] " hailijuan at gmail dot com
2008-02-18 5:09 ` pinskia at gcc dot gnu dot org
0 siblings, 2 replies; 3+ messages in thread
From: hailijuan at gmail dot com @ 2008-02-18 4:29 UTC (permalink / raw)
To: gcc-bugs
the simple omp-c++ testcase a.c caused g++ report error messages like
following:
# g++ -fopenmp a.c
a.c:14: error: 'a' declared 'threadprivate' after first use
# g++ -v
Using built-in specs.
Target: sparc-sun-solaris2.10
Configured with: /import/dr2/starlex/orig/trunk/configure
--prefix=/import/dr3/s10/gcc-4.3/ --enable-languages=c,c++,fortran
--disable-gnattools --with-mpfr=/ws/gccfss/tools --with-gmp=/ws/gccfss/tools
Thread model: posix
gcc version 4.3.0 20070912 (experimental) (GCC)
---------- src of a.c ----------
#include <stdio.h>
#include <omp.h>
class A {
public:
int i;
A()
{
i = 10;
};
};
A a;
#pragma omp threadprivate(a)
main()
{
omp_set_dynamic(false);
omp_set_num_threads(5);
#pragma omp parallel
{
printf("a.i = %d\n", a.i);
}
}
---------- end ----------
--
Summary: declaration of threadprivate variable considered first
use
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: hailijuan at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35246
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/35246] declaration of threadprivate variable considered first use
2008-02-18 4:29 [Bug c++/35246] New: declaration of threadprivate variable considered first use hailijuan at gmail dot com
@ 2008-02-18 4:38 ` hailijuan at gmail dot com
2008-02-18 5:09 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: hailijuan at gmail dot com @ 2008-02-18 4:38 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from hailijuan at gmail dot com 2008-02-18 04:37 -------
the error message was raised in finish_omp_threadprivate (cp/semantics.c). It
was the field TREE_USED set to 1 that trigered the error. build_aggr_init set
TREE_USED of variable a. the call frame looks like:
=>[1] build_aggr_init(exp = 0xfed99a00, init = 0xfee99ad0, flags = 0), line
1087 in "init.c"
[2] check_initializer(decl = 0xfed99a00, init = 0xfee99ad0, flags = 0,
cleanup = 0xffbff26c), line 4881 in "decl.c"
[3] cp_finish_decl(decl = 0xfed99a00, init = 0xfee99ad0, init_const_expr_p =
'\001', asmspec_tree = (nil), flags = 0), line 5292 in "decl.c"
[4] cp_parser_init_declarator(parser = 0xfee973b0, decl_specifiers = (nil),
checks = (nil), function_definition_allowed_p = '\001', member_p = '\0',
declares_class_or_enum = 0, function_definition_p = (nil)), line 11359 in
"parser.c"
[5] cp_parser_simple_declaration(parser = 0xfee973b0,
function_definition_allowed_p = '\001'), line 7433 in "parser.c"
[6] cp_parser_block_declaration(parser = 0xfee973b0, statement_p = '\0'),
line 7333 in "parser.c"
[7] cp_parser_declaration(parser = 0xfee973b0), line 7249 in "parser.c"
[8] cp_parser_declaration_seq_opt(parser = 0xfee973b0), line 7144 in
"parser.c"
[9] cp_parser_translation_unit(parser = 0xfee973b0), line 2847 in "parser.c"
[10] c_parse_file(), line 19552 in "parser.c"
[11] c_common_parse_file(set_yydebug = 0), line 1226 in "c-opts.c"
[12] compile_file(), line 1040 in "toplev.c"
[13] do_compile(), line 2037 in "toplev.c"
[14] toplev_main(argc = 0, argv = 0xffbff804), line 2069 in "toplev.c"
[15] main(argc = 17, argv = 0xffbff804), line 35 in "main.c"
so we'd know if the variables actually used in the source lines before raising
such error messages.
--
hailijuan at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hailijuan at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35246
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/35246] declaration of threadprivate variable considered first use
2008-02-18 4:29 [Bug c++/35246] New: declaration of threadprivate variable considered first use hailijuan at gmail dot com
2008-02-18 4:38 ` [Bug c++/35246] " hailijuan at gmail dot com
@ 2008-02-18 5:09 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-02-18 5:09 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2008-02-18 05:08 -------
*** This bug has been marked as a duplicate of 27557 ***
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35246
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-02-18 5:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-18 4:29 [Bug c++/35246] New: declaration of threadprivate variable considered first use hailijuan at gmail dot com
2008-02-18 4:38 ` [Bug c++/35246] " hailijuan at gmail dot com
2008-02-18 5:09 ` pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).