This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/38659] New: Enhancement in _cpp_save_parameter
- From: "wuhui1973 at 21cn dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Dec 2008 07:45:19 -0000
- Subject: [Bug c++/38659] New: Enhancement in _cpp_save_parameter
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
In following definition of _cpp_save_parameter of v3.4.6 (It also can be found
in v4.3.0)
1238 bool
1239 _cpp_save_parameter (cpp_reader *pfile, cpp_macro *macro, cpp_hashnode
*node)
1240 {
...
1255 node->flags |= NODE_MACRO_ARG;
1256 len = macro->paramc * sizeof (union _cpp_hashnode_value);
1257 if (len > pfile->macro_buffer_len)
1258 {
1259 pfile->macro_buffer = xrealloc (pfile->macro_buffer, len);
1260 pfile->macro_buffer_len = len;
1261 }
1262 ((union _cpp_hashnode_value *) pfile->macro_buffer)[macro->paramc - 1]
= node->value;
1263
1264 node->value.arg_index = macro->paramc;
1265 return false;
1266 }
Above line 1262 saves the value of cpp_hashnode by copying the struct, per my
understanding it is because the hashnode will be used by other identifiers of
same name in other following definitions, by saving the value, we can restore
the node when needed. However, operation done at line 1264 can not be included
by the copy, and in macro_buffer, arg_index is unset. Though currently, I can't
find the place using this field, I also suggest to swap line 1264 and 1262.
--
Summary: Enhancement in _cpp_save_parameter
Product: gcc
Version: 3.4.6
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: wuhui1973 at 21cn dot com
GCC build triplet: i686-dell-linux
GCC host triplet: linux-i386
GCC target triplet: linux-i386
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38659