This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug other/31071] New: A discrepancy in handling %{...} and %W{...} in function do_spec_1
- From: "wuhui1973 at 21cn dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Mar 2007 13:57:38 -0000
- Subject: [Bug other/31071] New: A discrepancy in handling %{...} and %W{...} in function do_spec_1
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
In spec langauge, %{...} and %W{...} are exactly same, except that %W{...} mark
last argument supplied within as a file to be deleted on failure. According to
this definition, the handling of these two commands is descrepant.
In do_spec_1, the handling of %W{...} is:
4943 case 'W':
{
int cur_index = argbuf_index;
/* Handle the {...} following the %W. */
if (*p != '{')
fatal ("spec '%s' has invalid '%%W%c", spec, *p);
p = handle_braces (p + 1);
if (p == 0)
return -1;
/* End any pending argument. */
4953 if (arg_going)
{
obstack_1grow (&obstack, 0);
string = XOBFINISH (&obstack, const char *);
if (this_is_library_file)
string = find_file (string);
store_arg (string, delete_this_arg, this_is_output_file);
if (this_is_output_file)
outfiles[input_file_number] = string;
arg_going = 0;
4963 }
/* If any args were output, mark the last one for deletion
on failure. */
if (argbuf_index != cur_index)
record_temp_file (argbuf[argbuf_index - 1], 0, 1);
break;
}
This processing I think is correct.
However for %{...}, that is:
5111 case '{':
p = handle_braces (p);
if (p == 0)
return -1;
5115 break;
It's possible for the last pending argument being lose. So suggest add
statements same of line 4953 to 4963 before 5115
--
Summary: A discrepancy in handling %{...} and %W{...} in function
do_spec_1
Product: gcc
Version: 4.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: other
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: wuhui1973 at 21cn dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31071