This is using gcc (GCC) 3.4 20031203 (experimental): ------------- %cat test.hh #include <stdio.h> const char test_var2[] = "normal string"; const wchar_t test_var[] = L"wide string"; %cat test.cpp #include "test.hh" int main(int argc, char **argv) { printf("wide: %S\r\n", test_var); printf("normal: %s\r\n", test_var2); return 0; } ----- Create test.hh.gch using: %g++ test.hh Create testprog using: %g++ -o testprog test.cc The output of testprog is: wide: normal: normal string If I remove test.hh.gch, and then recompile testprog, the output is: wide: wide string normal: normal string
Confirmed (the C front-end is right). The header file should have #include <wchar.h> in it.
Looks like for some reason the C++ front-end is defering the output of const wchar_t unlike the C front-end and unlike the const char also.
Confirmed on powerpc-darwin.
Subject: Bug 13361 CVSROOT: /cvs/gcc Module name: gcc Changes by: geoffk@gcc.gnu.org 2004-01-16 07:20:38 Modified files: gcc : ChangeLog c-typeck.c dwarf2out.c stmt.c tree.c tree.def tree.h gcc/config/sh : sh.c gcc/cp : ChangeLog lex.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/pch: wchar-1.C wchar-1.Hs Log message: Index: ChangeLog 2004-01-15 Geoffrey Keating <geoffk@apple.com> PR pch/13361 * c-typeck.c (constructor_asmspec): Delete. (struct initializer_stack): Delete field 'asmspec'. (start_init): Delete saving of asmspec. (finish_init): Don't update constructor_asmspec. * dwarf2out.c (rtl_for_decl_location): Duplicate string from tree. * stmt.c (expand_asm): Duplicate strings from tree. (expand_asm_operands): Likewise. * tree.c (tree_size): Update computation of size of STRING_CST. (make_node): Don't make STRING_CST nodes. (build_string): Allocate string with tree node. * tree.def (STRING_CST): Update comment. * tree.h (TREE_STRING_POINTER): Adjust for change to STRING_CST. (tree_string): Place contents of string in tree node. * config/sh/sh.c (sh_handle_sp_switch_attribute): Duplicate string from tree. Index: cp/ChangeLog 2004-01-15 Geoffrey Keating <geoffk@apple.com> PR pch/13361 * cp/lex.c (handle_pragma_interface): Duplicate string from tree. (handle_pragma_implementation): Likewise. Index: testsuite/ChangeLog 2004-01-15 Geoffrey Keating <geoffk@apple.com> PR pch/13361 * testsuite/g++.dg/pch/wchar-1.C: New. * testsuite/g++.dg/pch/wchar-1.Hs: New. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.2318&r2=2.2319 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-typeck.c.diff?cvsroot=gcc&r1=1.271&r2=1.272 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/dwarf2out.c.diff?cvsroot=gcc&r1=1.476&r2=1.477 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/stmt.c.diff?cvsroot=gcc&r1=1.341&r2=1.342 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.c.diff?cvsroot=gcc&r1=1.341&r2=1.342 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.def.diff?cvsroot=gcc&r1=1.69&r2=1.70 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.h.diff?cvsroot=gcc&r1=1.457&r2=1.458 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sh/sh.c.diff?cvsroot=gcc&r1=1.246&r2=1.247 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3885&r2=1.3886 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/lex.c.diff?cvsroot=gcc&r1=1.322&r2=1.323 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3382&r2=1.3383 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/pch/wchar-1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/pch/wchar-1.Hs.diff?cvsroot=gcc&r1=NONE&r2=1.1
That should have fixed it.
Subject: Bug 13361 CVSROOT: /cvs/gcc Module name: gcc Changes by: ro@gcc.gnu.org 2004-02-05 21:56:43 Modified files: gcc : ChangeLog c-typeck.c dwarf2out.c stmt.c tree.c tree.def tree.h gcc/config/sh : sh.c gcc/cp : ChangeLog lex.c gcc/testsuite : ChangeLog Removed files: gcc/testsuite/g++.dg/pch: wchar-1.C wchar-1.Hs Log message: PR middle-end/13750 Revert: 2004-01-15 Geoffrey Keating <geoffk@apple.com> PR pch/13361 * c-typeck.c (constructor_asmspec): Delete. (struct initializer_stack): Delete field 'asmspec'. (start_init): Delete saving of asmspec. (finish_init): Don't update constructor_asmspec. * dwarf2out.c (rtl_for_decl_location): Duplicate string from tree. * stmt.c (expand_asm): Duplicate strings from tree. (expand_asm_operands): Likewise. * tree.c (tree_size): Update computation of size of STRING_CST. (make_node): Don't make STRING_CST nodes. (build_string): Allocate string with tree node. * tree.def (STRING_CST): Update comment. * tree.h (TREE_STRING_POINTER): Adjust for change to STRING_CST. (tree_string): Place contents of string in tree node. * config/sh/sh.c (sh_handle_sp_switch_attribute): Duplicate string from tree. cp: PR middle-end/13750 Revert: 2004-01-15 Geoffrey Keating <geoffk@apple.com> PR pch/13361 * cp/lex.c (handle_pragma_interface): Duplicate string from tree. (handle_pragma_implementation): Likewise. testsuite: PR middle-end/13750 Revert: 2004-01-15 Geoffrey Keating <geoffk@apple.com> PR pch/13361 * testsuite/g++.dg/pch/wchar-1.C: New. * testsuite/g++.dg/pch/wchar-1.Hs: New. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.2659&r2=2.2660 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-typeck.c.diff?cvsroot=gcc&r1=1.275&r2=1.276 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/dwarf2out.c.diff?cvsroot=gcc&r1=1.484&r2=1.485 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/stmt.c.diff?cvsroot=gcc&r1=1.345&r2=1.346 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.c.diff?cvsroot=gcc&r1=1.345&r2=1.346 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.def.diff?cvsroot=gcc&r1=1.70&r2=1.71 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.h.diff?cvsroot=gcc&r1=1.461&r2=1.462 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sh/sh.c.diff?cvsroot=gcc&r1=1.255&r2=1.256 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3940&r2=1.3941 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/lex.c.diff?cvsroot=gcc&r1=1.323&r2=1.324 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/pch/wchar-1.C.diff?cvsroot=gcc&r1=1.1&r2=NONE http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/pch/wchar-1.Hs.diff?cvsroot=gcc&r1=1.1&r2=NONE http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3473&r2=1.3474
Subject: Bug 13361 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: ro@gcc.gnu.org 2004-02-05 22:01:42 Modified files: gcc : ChangeLog c-typeck.c dwarf2out.c stmt.c tree.c tree.def tree.h gcc/config/sh : sh.c gcc/cp : ChangeLog lex.c gcc/testsuite : ChangeLog Removed files: gcc/testsuite/g++.dg/pch: wchar-1.C wchar-1.Hs Log message: PR middle-end/13750 Revert: 2004-01-15 Geoffrey Keating <geoffk@apple.com> PR pch/13361 * c-typeck.c (constructor_asmspec): Delete. (struct initializer_stack): Delete field 'asmspec'. (start_init): Delete saving of asmspec. (finish_init): Don't update constructor_asmspec. * dwarf2out.c (rtl_for_decl_location): Duplicate string from tree. * stmt.c (expand_asm): Duplicate strings from tree. (expand_asm_operands): Likewise. * tree.c (tree_size): Update computation of size of STRING_CST. (make_node): Don't make STRING_CST nodes. (build_string): Allocate string with tree node. * tree.def (STRING_CST): Update comment. * tree.h (TREE_STRING_POINTER): Adjust for change to STRING_CST. (tree_string): Place contents of string in tree node. * config/sh/sh.c (sh_handle_sp_switch_attribute): Duplicate string from tree. cp: PR middle-end/13750 Revert: 2004-01-15 Geoffrey Keating <geoffk@apple.com> PR pch/13361 * cp/lex.c (handle_pragma_interface): Duplicate string from tree. (handle_pragma_implementation): Likewise. testsuite: PR middle-end/13750 Revert: 2004-01-15 Geoffrey Keating <geoffk@apple.com> PR pch/13361 * testsuite/g++.dg/pch/wchar-1.C: New. * testsuite/g++.dg/pch/wchar-1.Hs: New. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.147&r2=2.2326.2.148 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-typeck.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.272&r2=1.272.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/dwarf2out.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.478.2.2&r2=1.478.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/stmt.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.342&r2=1.342.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.342.2.2&r2=1.342.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.def.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.70&r2=1.70.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.458.2.2&r2=1.458.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sh/sh.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.247.2.2&r2=1.247.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.39&r2=1.3892.2.40 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/lex.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.323&r2=1.323.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/pch/wchar-1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.1&r2=NONE http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/pch/wchar-1.Hs.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.1&r2=NONE http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.54&r2=1.3389.2.55
Reopening as this had to be reverted.
Assigning to person who reintroduced the bug. Suggested fix: 1. Work out what's wrong on tru64 2. Fix it 3. Re-install patch.
Note the Tru64 problem is recorded in PR 13750.
Is there any progress on this bug?
Rainer -- What's the status here? -- Mark
Subject: Re: const wchar_t * strings not stored in pch mmitchel at gcc dot gnu dot org writes: > What's the status here? I didn't have much time for gcc work lately. Besides, when I pointed out the regression caused by the original patch in PR target/13750, Geoff's only reaction to my request for help (not being a target maintainer, but only interested to keep my platforms regression-free) was: find the target bug and fix it. Without lots of help, this is way beyond my capabilities. Rainer
Postponed until GCC 3.4.2. Geoff, it would be nice if you would help Rainer solve this problem. We shouldn't have to choose between supporting that platform and having PCH that works with wide-character literals, and it's going to be really hard for him to work this out by himself.
Subject: Re: const wchar_t * strings not stored in pch On 18/06/2004, at 4:45 PM, mmitchel at gcc dot gnu dot org wrote: > Postponed until GCC 3.4.2. > > Geoff, it would be nice if you would help Rainer solve this problem. > We > shouldn't have to choose between supporting that platform and having > PCH that > works with wide-character literals, and it's going to be really hard > for him to > work this out by himself. I believe that this is a problem in the Alpha backend (which I don't know much about) or in the system C library on Tru64 (which I know nothing at all about, and don't have access to); and exposing it requires building Ada (which I can't do, and don't know about) on Tru64 (which I don't have access to). But given those constraints, I'd be happy to give any help I can. I'd suggest, though, that if we want to support Ada on Tru64-alpha, that we should have someone who *does* have access to the platform and *can* solve problems like these.
Postponed until GCC 3.4.3.
Taking over this bug, to give it a chance of being fixed for 4.0.
Subject: Bug 13361 CVSROOT: /cvs/gcc Module name: gcc Changes by: geoffk@gcc.gnu.org 2004-09-18 05:50:52 Modified files: gcc : ChangeLog c-typeck.c dwarf2out.c stmt.c tree-inline.c tree.c tree.def tree.h gcc/config/sh : sh.c gcc/cp : ChangeLog lex.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/pch: wchar-1.C wchar-1.Hs Log message: * tree-inline.c (copy_tree_r): Don't duplicate constants, they're shared anyway. PR pch/13361 * c-typeck.c (constructor_asmspec): Delete. (struct initializer_stack): Delete field 'asmspec'. (start_init): Delete saving of asmspec. (finish_init): Don't update constructor_asmspec. * dwarf2out.c (rtl_for_decl_location): Duplicate string from tree. * stmt.c (expand_asm): Duplicate strings from tree. (expand_asm_operands): Likewise. * tree.c (tree_size): Update computation of size of STRING_CST. (make_node): Don't make STRING_CST nodes. (build_string): Allocate string with tree node. (tree_code_size): Clean up assertions, don't allow requests for "the size of a STRING_CST". * tree.def (STRING_CST): Update comment. * tree.h (TREE_STRING_POINTER): Adjust for change to STRING_CST. (tree_string): Place contents of string in tree node. * config/sh/sh.c (sh_handle_sp_switch_attribute): Duplicate string from tree. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.5508&r2=2.5509 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-typeck.c.diff?cvsroot=gcc&r1=1.374&r2=1.375 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/dwarf2out.c.diff?cvsroot=gcc&r1=1.546&r2=1.547 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/stmt.c.diff?cvsroot=gcc&r1=1.394&r2=1.395 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-inline.c.diff?cvsroot=gcc&r1=1.141&r2=1.142 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.c.diff?cvsroot=gcc&r1=1.432&r2=1.433 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.def.diff?cvsroot=gcc&r1=1.99&r2=1.100 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.h.diff?cvsroot=gcc&r1=1.624&r2=1.625 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sh/sh.c.diff?cvsroot=gcc&r1=1.299&r2=1.300 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4362&r2=1.4363 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/lex.c.diff?cvsroot=gcc&r1=1.345&r2=1.346 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4311&r2=1.4312 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/pch/wchar-1.C.diff?cvsroot=gcc&r1=1.2&r2=1.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/pch/wchar-1.Hs.diff?cvsroot=gcc&r1=1.2&r2=1.3
This should be fixed again now.